fluxy-bot 0.4.11 → 0.4.13

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.
@@ -1,4 +1,4 @@
1
- import{c as de,r as U,j as y,L as Gc,A as jc,g as du,R as Ce,a as kn,m as Ot,M as dl,b as Hc,O as Vc}from"./globals-BmcQJ_1f.js";const Wc=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],qc=de("arrow-left",Wc);const Yc=[["path",{d:"M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z",key:"18u6gg"}],["circle",{cx:"12",cy:"13",r:"3",key:"1vg3eu"}]],Kc=de("camera",Yc);const Xc=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],Zc=de("chevron-left",Xc);const Qc=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Jc=de("chevron-right",Qc);const ed=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],td=de("download",ed);const nd=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]],rd=de("ellipsis-vertical",nd);const ad=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],id=de("lock",ad);const od=[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]],Tn=de("paperclip",od);const sd=[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]],ld=de("pause",sd);const ud=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],cd=de("play",ud);const dd=[["path",{d:"M3.714 3.048a.498.498 0 0 0-.683.627l2.843 7.627a2 2 0 0 1 0 1.396l-2.842 7.627a.498.498 0 0 0 .682.627l18-8.5a.5.5 0 0 0 0-.904z",key:"117uat"}],["path",{d:"M6 12h16",key:"s4cdu5"}]],pd=de("send-horizontal",dd);const gd=[["path",{d:"M12 2v13",key:"1km8f5"}],["path",{d:"m16 6-4-4-4 4",key:"13yo43"}],["path",{d:"M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8",key:"1b2hhj"}]],fd=de("share",gd);const md=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],bd=de("square",md);const hd=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],pu=de("trash-2",hd);const Ed=[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]],yd=de("wand-sparkles",Ed);const Sd=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],$n=de("x",Sd);class zn{ws=null;handlers=new Map;statusHandlers=new Set;reconnectTimer=null;heartbeatTimer=null;url;queue=[];intentionalClose=!1;reconnectDelay=1e3;static MAX_RECONNECT_DELAY=8e3;tokenGetter=null;constructor(t,n){const r=location.protocol==="https:"?"wss:":"ws:",a=location.host;this.url=t??`${r}//${a}/ws`,this.tokenGetter=n??null}connect(){this.intentionalClose=!1;let t=this.url;if(this.tokenGetter){const n=this.tokenGetter();if(n){const r=t.includes("?")?"&":"?";t=`${t}${r}token=${n}`}}this.ws=new WebSocket(t),this.ws.onopen=()=>{this.reconnectDelay=1e3,this.notifyStatus(!0),this.flushQueue(),this.startHeartbeat()},this.ws.onmessage=n=>{if(n.data==="pong")return;const r=JSON.parse(n.data);this.handlers.get(r.type)?.forEach(i=>i(r.data))},this.ws.onclose=()=>{this.stopHeartbeat(),this.notifyStatus(!1),this.intentionalClose||(this.reconnectTimer=setTimeout(()=>{this.reconnectDelay=Math.min(this.reconnectDelay*2,zn.MAX_RECONNECT_DELAY),this.connect()},this.reconnectDelay))},this.ws.onerror=()=>this.ws?.close()}disconnect(){this.intentionalClose=!0,this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.stopHeartbeat(),this.ws?.close(),this.ws=null}on(t,n){return this.handlers.has(t)||this.handlers.set(t,new Set),this.handlers.get(t).add(n),()=>this.handlers.get(t)?.delete(n)}onStatus(t){return this.statusHandlers.add(t),()=>this.statusHandlers.delete(t)}send(t,n){const r={type:t,data:n};this.ws?.readyState===WebSocket.OPEN?this.ws.send(JSON.stringify(r)):this.queue.push(r)}get connected(){return this.ws?.readyState===WebSocket.OPEN}flushQueue(){for(;this.queue.length>0&&this.ws?.readyState===WebSocket.OPEN;){const t=this.queue.shift();this.ws.send(JSON.stringify(t))}}notifyStatus(t){this.statusHandlers.forEach(n=>n(t))}startHeartbeat(){this.stopHeartbeat(),this.heartbeatTimer=setInterval(()=>{this.ws?.readyState===WebSocket.OPEN&&this.ws.send("ping")},25e3)}stopHeartbeat(){this.heartbeatTimer&&(clearInterval(this.heartbeatTimer),this.heartbeatTimer=null)}}const Gn="fluxy_token";let gu=null;function An(){return localStorage.getItem(Gn)}function wd(e){localStorage.setItem(Gn,e)}function fu(){localStorage.removeItem(Gn)}function kd(e){gu=e}async function Ft(e,t={}){const n=An(),r=new Headers(t.headers);n&&r.set("Authorization",`Bearer ${n}`);const a=await fetch(e,{...t,headers:r});return a.status===401&&n&&(fu(),gu?.()),a}function Td(e,t,n=!0){const[r,a]=U.useState([]),[i,o]=U.useState(null),[s,l]=U.useState(!1),[u,c]=U.useState(""),[d,g]=U.useState([]),p=U.useRef(!1),m=U.useCallback(async()=>{try{const _=await Ft("/api/context/current").then(N=>N.json());if(!_.conversationId)return;o(_.conversationId);const k=await Ft(`/api/conversations/${_.conversationId}`);if(!k.ok)return;const I=await k.json();if(!I.messages?.length)return;a(I.messages.filter(N=>N.role==="user"||N.role==="assistant").map(N=>{let A;N.audio_data&&(N.audio_data.startsWith("data:")?A=N.audio_data:N.audio_data.includes("/")?A=`/api/files/${N.audio_data}`:A=`data:audio/webm;base64,${N.audio_data}`);let x;if(N.attachments)try{x=JSON.parse(N.attachments)}catch{}return{id:N.id,role:N.role,content:N.content,timestamp:N.created_at,audioData:A,hasAttachments:!!(x&&x.length>0),attachments:x}}))}catch{}},[]);U.useEffect(()=>{!n||p.current||(p.current=!0,m())},[n,m]),U.useEffect(()=>{n&&t&&t>0&&m()},[n,t,m]),U.useEffect(()=>{if(!e)return;const _=[e.on("bot:typing",()=>{l(!0),g([])}),e.on("bot:token",k=>{c(I=>I+k.token)}),e.on("bot:tool",k=>{g(I=>I.find(A=>A.name===k.name&&A.status==="running")?I:[...I,{name:k.name,status:"running"}])}),e.on("bot:response",k=>{o(k.conversationId),a(I=>[...I,{id:k.messageId||Date.now().toString(),role:"assistant",content:k.content,timestamp:new Date().toISOString()}]),c(""),l(!1),g([])}),e.on("bot:error",k=>{c(""),l(!1),g([]),a(I=>[...I,{id:Date.now().toString(),role:"assistant",content:`Error: ${k.error}`,timestamp:new Date().toISOString()}])}),e.on("chat:sync",k=>{i&&k.conversationId!==i||a(I=>[...I,{id:Date.now().toString(),role:k.message.role,content:k.message.content,timestamp:k.message.timestamp}])}),e.on("chat:conversation-created",k=>{o(k.conversationId)}),e.on("chat:cleared",()=>{a([]),o(null),c(""),l(!1),g([]),p.current=!1})];return()=>_.forEach(k=>k())},[e,i]);const w=U.useCallback((_,k,I)=>{if(!e||!_.trim()&&(!k||k.length===0))return;const N={id:Date.now().toString(),role:"user",content:_,timestamp:new Date().toISOString(),hasAttachments:!!(k&&k.length>0),audioData:I?I.startsWith("data:")?I:`data:audio/webm;base64,${I}`:void 0};a(x=>[...x,N]);const A={conversationId:i,content:_};I&&(A.audioData=I.includes(",")?I.split(",")[1]:I),k?.length&&(A.attachments=k.map(x=>{const M=x.preview.match(/^data:([^;]+);base64,(.+)$/);return{type:x.type,name:x.name,mediaType:M?.[1]||"application/octet-stream",data:M?.[2]||""}})),e.send("user:message",A)},[e,i]),S=U.useCallback(()=>{e&&(e.send("user:stop",{conversationId:i}),l(!1),c(""),g([]))},[e,i]),E=U.useCallback(()=>{e&&e.send("user:clear-context",{}),a([]),o(null),c(""),l(!1),g([]),p.current=!1},[e]);return{messages:r,streaming:s,streamBuffer:u,conversationId:i,tools:d,sendMessage:w,stopStreaming:S,clearContext:E}}function Ad({onLogin:e}){const[t,n]=U.useState(""),[r,a]=U.useState(""),[i,o]=U.useState(!1),s=async()=>{if(!(!t.trim()||i)){o(!0),a("");try{const c=btoa(`admin:${t}`),d=await fetch("/api/portal/login",{headers:{Authorization:`Basic ${c}`}}),g=await d.json();d.ok&&g.token?e(g.token):a(g.error||"Invalid password")}catch{a("Could not reach server")}finally{o(!1)}}},l=c=>{c.key==="Enter"&&s()};return y.jsx("div",{className:"flex flex-col items-center justify-center h-dvh px-6",children:y.jsxs("div",{className:"w-full max-w-[320px] flex flex-col items-center",children:[y.jsx("div",{className:"w-14 h-14 rounded-2xl bg-white/[0.04] border border-white/[0.08] flex items-center justify-center mb-5",children:y.jsx(id,{className:"h-6 w-6 text-white/40"})}),y.jsx("h1",{className:"text-xl font-bold text-white tracking-tight mb-1",children:"Welcome back"}),y.jsx("p",{className:"text-white/40 text-[13px] mb-6",children:"Enter your password to continue."}),r&&y.jsx("div",{className:"w-full bg-red-500/8 border border-red-500/15 rounded-xl px-4 py-2.5 mb-4",children:y.jsx("p",{className:"text-red-400/90 text-[12px]",children:r})}),y.jsx("input",{type:"password",value:t,onChange:c=>n(c.target.value),onKeyDown:l,placeholder:"Password",autoFocus:!0,autoComplete:"current-password",className:"w-full bg-white/[0.05] border border-white/[0.08] text-white rounded-xl px-4 py-3 text-base outline-none input-glow placeholder:text-white/20 transition-all"}),y.jsx("button",{onClick:s,disabled:!t.trim()||i,className:"w-full mt-4 py-3 bg-gradient-brand hover:opacity-90 text-white text-[14px] font-semibold rounded-full transition-colors flex items-center justify-center gap-2 disabled:opacity-40",children:i?y.jsxs(y.Fragment,{children:[y.jsx(Gc,{className:"h-4 w-4 animate-spin"}),"Signing in..."]}):y.jsxs(y.Fragment,{children:["Sign In",y.jsx(jc,{className:"h-4 w-4"})]})})]})})}function pl(e){const t=[],n=String(e||"");let r=n.indexOf(","),a=0,i=!1;for(;!i;){r===-1&&(r=n.length,i=!0);const o=n.slice(a,r).trim();(o||!i)&&t.push(o),a=r+1,r=n.indexOf(",",a)}return t}function _d(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const Id=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Nd=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Rd={};function gl(e,t){return(Rd.jsx?Nd:Id).test(e)}const xd=/[ \t\n\f\r]/g;function vd(e){return typeof e=="object"?e.type==="text"?fl(e.value):!1:fl(e)}function fl(e){return e.replace(xd,"")===""}class Et{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}Et.prototype.normal={};Et.prototype.property={};Et.prototype.space=void 0;function mu(e,t){const n={},r={};for(const a of e)Object.assign(n,a.property),Object.assign(r,a.normal);return new Et(n,r,t)}function gt(e){return e.toLowerCase()}class he{constructor(t,n){this.attribute=n,this.property=t}}he.prototype.attribute="";he.prototype.booleanish=!1;he.prototype.boolean=!1;he.prototype.commaOrSpaceSeparated=!1;he.prototype.commaSeparated=!1;he.prototype.defined=!1;he.prototype.mustUseProperty=!1;he.prototype.number=!1;he.prototype.overloadedBoolean=!1;he.prototype.property="";he.prototype.spaceSeparated=!1;he.prototype.space=void 0;let Cd=0;const q=Pe(),se=Pe(),_n=Pe(),C=Pe(),ae=Pe(),qe=Pe(),Se=Pe();function Pe(){return 2**++Cd}const In=Object.freeze(Object.defineProperty({__proto__:null,boolean:q,booleanish:se,commaOrSpaceSeparated:Se,commaSeparated:qe,number:C,overloadedBoolean:_n,spaceSeparated:ae},Symbol.toStringTag,{value:"Module"})),nn=Object.keys(In);class jn extends he{constructor(t,n,r,a){let i=-1;if(super(t,n),ml(this,"space",a),typeof r=="number")for(;++i<nn.length;){const o=nn[i];ml(this,nn[i],(r&In[o])===In[o])}}}jn.prototype.defined=!0;function ml(e,t,n){n&&(e[t]=n)}function Ke(e){const t={},n={};for(const[r,a]of Object.entries(e.properties)){const i=new jn(r,e.transform(e.attributes||{},r),a,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(i.mustUseProperty=!0),t[r]=i,n[gt(r)]=r,n[gt(i.attribute)]=r}return new Et(t,n,e.space)}const bu=Ke({properties:{ariaActiveDescendant:null,ariaAtomic:se,ariaAutoComplete:null,ariaBusy:se,ariaChecked:se,ariaColCount:C,ariaColIndex:C,ariaColSpan:C,ariaControls:ae,ariaCurrent:null,ariaDescribedBy:ae,ariaDetails:null,ariaDisabled:se,ariaDropEffect:ae,ariaErrorMessage:null,ariaExpanded:se,ariaFlowTo:ae,ariaGrabbed:se,ariaHasPopup:null,ariaHidden:se,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:ae,ariaLevel:C,ariaLive:null,ariaModal:se,ariaMultiLine:se,ariaMultiSelectable:se,ariaOrientation:null,ariaOwns:ae,ariaPlaceholder:null,ariaPosInSet:C,ariaPressed:se,ariaReadOnly:se,ariaRelevant:null,ariaRequired:se,ariaRoleDescription:ae,ariaRowCount:C,ariaRowIndex:C,ariaRowSpan:C,ariaSelected:se,ariaSetSize:C,ariaSort:null,ariaValueMax:C,ariaValueMin:C,ariaValueNow:C,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function hu(e,t){return t in e?e[t]:t}function Eu(e,t){return hu(e,t.toLowerCase())}const Od=Ke({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:qe,acceptCharset:ae,accessKey:ae,action:null,allow:null,allowFullScreen:q,allowPaymentRequest:q,allowUserMedia:q,alt:null,as:null,async:q,autoCapitalize:null,autoComplete:ae,autoFocus:q,autoPlay:q,blocking:ae,capture:null,charSet:null,checked:q,cite:null,className:ae,cols:C,colSpan:null,content:null,contentEditable:se,controls:q,controlsList:ae,coords:C|qe,crossOrigin:null,data:null,dateTime:null,decoding:null,default:q,defer:q,dir:null,dirName:null,disabled:q,download:_n,draggable:se,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:q,formTarget:null,headers:ae,height:C,hidden:_n,high:C,href:null,hrefLang:null,htmlFor:ae,httpEquiv:ae,id:null,imageSizes:null,imageSrcSet:null,inert:q,inputMode:null,integrity:null,is:null,isMap:q,itemId:null,itemProp:ae,itemRef:ae,itemScope:q,itemType:ae,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:q,low:C,manifest:null,max:null,maxLength:C,media:null,method:null,min:null,minLength:C,multiple:q,muted:q,name:null,nonce:null,noModule:q,noValidate:q,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:q,optimum:C,pattern:null,ping:ae,placeholder:null,playsInline:q,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:q,referrerPolicy:null,rel:ae,required:q,reversed:q,rows:C,rowSpan:C,sandbox:ae,scope:null,scoped:q,seamless:q,selected:q,shadowRootClonable:q,shadowRootDelegatesFocus:q,shadowRootMode:null,shape:null,size:C,sizes:null,slot:null,span:C,spellCheck:se,src:null,srcDoc:null,srcLang:null,srcSet:null,start:C,step:null,style:null,tabIndex:C,target:null,title:null,translate:null,type:null,typeMustMatch:q,useMap:null,value:se,width:C,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:ae,axis:null,background:null,bgColor:null,border:C,borderColor:null,bottomMargin:C,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:q,declare:q,event:null,face:null,frame:null,frameBorder:null,hSpace:C,leftMargin:C,link:null,longDesc:null,lowSrc:null,marginHeight:C,marginWidth:C,noResize:q,noHref:q,noShade:q,noWrap:q,object:null,profile:null,prompt:null,rev:null,rightMargin:C,rules:null,scheme:null,scrolling:se,standby:null,summary:null,text:null,topMargin:C,valueType:null,version:null,vAlign:null,vLink:null,vSpace:C,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:q,disableRemotePlayback:q,prefix:null,property:null,results:C,security:null,unselectable:null},space:"html",transform:Eu}),Ld=Ke({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Se,accentHeight:C,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:C,amplitude:C,arabicForm:null,ascent:C,attributeName:null,attributeType:null,azimuth:C,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:C,by:null,calcMode:null,capHeight:C,className:ae,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:C,diffuseConstant:C,direction:null,display:null,dur:null,divisor:C,dominantBaseline:null,download:q,dx:null,dy:null,edgeMode:null,editable:null,elevation:C,enableBackground:null,end:null,event:null,exponent:C,externalResourcesRequired:null,fill:null,fillOpacity:C,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:qe,g2:qe,glyphName:qe,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:C,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:C,horizOriginX:C,horizOriginY:C,id:null,ideographic:C,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:C,k:C,k1:C,k2:C,k3:C,k4:C,kernelMatrix:Se,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:C,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:C,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:C,overlineThickness:C,paintOrder:null,panose1:null,path:null,pathLength:C,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:ae,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:C,pointsAtY:C,pointsAtZ:C,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Se,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Se,rev:Se,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Se,requiredFeatures:Se,requiredFonts:Se,requiredFormats:Se,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:C,specularExponent:C,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:C,strikethroughThickness:C,string:null,stroke:null,strokeDashArray:Se,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:C,strokeOpacity:C,strokeWidth:null,style:null,surfaceScale:C,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Se,tabIndex:C,tableValues:null,target:null,targetX:C,targetY:C,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Se,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:C,underlineThickness:C,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:C,values:null,vAlphabetic:C,vMathematical:C,vectorEffect:null,vHanging:C,vIdeographic:C,version:null,vertAdvY:C,vertOriginX:C,vertOriginY:C,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:C,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:hu}),yu=Ke({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),Su=Ke({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Eu}),wu=Ke({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),Dd={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},Md=/[A-Z]/g,bl=/-[a-z]/g,Fd=/^data[-\w.:]+$/i;function ku(e,t){const n=gt(t);let r=t,a=he;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&Fd.test(t)){if(t.charAt(4)==="-"){const i=t.slice(5).replace(bl,Bd);r="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=t.slice(4);if(!bl.test(i)){let o=i.replace(Md,Ud);o.charAt(0)!=="-"&&(o="-"+o),t="data"+o}}a=jn}return new a(r,t)}function Ud(e){return"-"+e.toLowerCase()}function Bd(e){return e.charAt(1).toUpperCase()}const Tu=mu([bu,Od,yu,Su,wu],"html"),zt=mu([bu,Ld,yu,Su,wu],"svg");function hl(e){const t=String(e||"").trim();return t?t.split(/[ \t\n\r\f]+/g):[]}function Pd(e){return e.join(" ").trim()}var je={},rn,El;function $d(){if(El)return rn;El=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,a=/^:\s*/,i=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,o=/^[;\s]*/,s=/^\s+|\s+$/g,l=`
1
+ import{c as de,r as U,j as y,L as Gc,A as jc,g as du,R as Ce,a as kn,m as Ot,M as dl,b as Hc,O as Vc}from"./globals-Bs_8hHwU.js";const Wc=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],qc=de("arrow-left",Wc);const Yc=[["path",{d:"M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z",key:"18u6gg"}],["circle",{cx:"12",cy:"13",r:"3",key:"1vg3eu"}]],Kc=de("camera",Yc);const Xc=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],Zc=de("chevron-left",Xc);const Qc=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Jc=de("chevron-right",Qc);const ed=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],td=de("download",ed);const nd=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]],rd=de("ellipsis-vertical",nd);const ad=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],id=de("lock",ad);const od=[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]],Tn=de("paperclip",od);const sd=[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]],ld=de("pause",sd);const ud=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],cd=de("play",ud);const dd=[["path",{d:"M3.714 3.048a.498.498 0 0 0-.683.627l2.843 7.627a2 2 0 0 1 0 1.396l-2.842 7.627a.498.498 0 0 0 .682.627l18-8.5a.5.5 0 0 0 0-.904z",key:"117uat"}],["path",{d:"M6 12h16",key:"s4cdu5"}]],pd=de("send-horizontal",dd);const gd=[["path",{d:"M12 2v13",key:"1km8f5"}],["path",{d:"m16 6-4-4-4 4",key:"13yo43"}],["path",{d:"M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8",key:"1b2hhj"}]],fd=de("share",gd);const md=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],bd=de("square",md);const hd=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],pu=de("trash-2",hd);const Ed=[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]],yd=de("wand-sparkles",Ed);const Sd=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],$n=de("x",Sd);class zn{ws=null;handlers=new Map;statusHandlers=new Set;reconnectTimer=null;heartbeatTimer=null;url;queue=[];intentionalClose=!1;reconnectDelay=1e3;static MAX_RECONNECT_DELAY=8e3;tokenGetter=null;constructor(t,n){const r=location.protocol==="https:"?"wss:":"ws:",a=location.host;this.url=t??`${r}//${a}/ws`,this.tokenGetter=n??null}connect(){this.intentionalClose=!1;let t=this.url;if(this.tokenGetter){const n=this.tokenGetter();if(n){const r=t.includes("?")?"&":"?";t=`${t}${r}token=${n}`}}this.ws=new WebSocket(t),this.ws.onopen=()=>{this.reconnectDelay=1e3,this.notifyStatus(!0),this.flushQueue(),this.startHeartbeat()},this.ws.onmessage=n=>{if(n.data==="pong")return;const r=JSON.parse(n.data);this.handlers.get(r.type)?.forEach(i=>i(r.data))},this.ws.onclose=()=>{this.stopHeartbeat(),this.notifyStatus(!1),this.intentionalClose||(this.reconnectTimer=setTimeout(()=>{this.reconnectDelay=Math.min(this.reconnectDelay*2,zn.MAX_RECONNECT_DELAY),this.connect()},this.reconnectDelay))},this.ws.onerror=()=>this.ws?.close()}disconnect(){this.intentionalClose=!0,this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.stopHeartbeat(),this.ws?.close(),this.ws=null}on(t,n){return this.handlers.has(t)||this.handlers.set(t,new Set),this.handlers.get(t).add(n),()=>this.handlers.get(t)?.delete(n)}onStatus(t){return this.statusHandlers.add(t),()=>this.statusHandlers.delete(t)}send(t,n){const r={type:t,data:n};this.ws?.readyState===WebSocket.OPEN?this.ws.send(JSON.stringify(r)):this.queue.push(r)}get connected(){return this.ws?.readyState===WebSocket.OPEN}flushQueue(){for(;this.queue.length>0&&this.ws?.readyState===WebSocket.OPEN;){const t=this.queue.shift();this.ws.send(JSON.stringify(t))}}notifyStatus(t){this.statusHandlers.forEach(n=>n(t))}startHeartbeat(){this.stopHeartbeat(),this.heartbeatTimer=setInterval(()=>{this.ws?.readyState===WebSocket.OPEN&&this.ws.send("ping")},25e3)}stopHeartbeat(){this.heartbeatTimer&&(clearInterval(this.heartbeatTimer),this.heartbeatTimer=null)}}const Gn="fluxy_token";let gu=null;function An(){return localStorage.getItem(Gn)}function wd(e){localStorage.setItem(Gn,e)}function fu(){localStorage.removeItem(Gn)}function kd(e){gu=e}async function Ft(e,t={}){const n=An(),r=new Headers(t.headers);n&&r.set("Authorization",`Bearer ${n}`);const a=await fetch(e,{...t,headers:r});return a.status===401&&n&&(fu(),gu?.()),a}function Td(e,t,n=!0){const[r,a]=U.useState([]),[i,o]=U.useState(null),[s,l]=U.useState(!1),[u,c]=U.useState(""),[d,g]=U.useState([]),p=U.useRef(!1),m=U.useCallback(async()=>{try{const _=await Ft("/api/context/current").then(N=>N.json());if(!_.conversationId)return;o(_.conversationId);const k=await Ft(`/api/conversations/${_.conversationId}`);if(!k.ok)return;const I=await k.json();if(!I.messages?.length)return;a(I.messages.filter(N=>N.role==="user"||N.role==="assistant").map(N=>{let A;N.audio_data&&(N.audio_data.startsWith("data:")?A=N.audio_data:N.audio_data.includes("/")?A=`/api/files/${N.audio_data}`:A=`data:audio/webm;base64,${N.audio_data}`);let x;if(N.attachments)try{x=JSON.parse(N.attachments)}catch{}return{id:N.id,role:N.role,content:N.content,timestamp:N.created_at,audioData:A,hasAttachments:!!(x&&x.length>0),attachments:x}}))}catch{}},[]);U.useEffect(()=>{!n||p.current||(p.current=!0,m())},[n,m]),U.useEffect(()=>{n&&t&&t>0&&m()},[n,t,m]),U.useEffect(()=>{if(!e)return;const _=[e.on("bot:typing",()=>{l(!0),g([])}),e.on("bot:token",k=>{c(I=>I+k.token)}),e.on("bot:tool",k=>{g(I=>I.find(A=>A.name===k.name&&A.status==="running")?I:[...I,{name:k.name,status:"running"}])}),e.on("bot:response",k=>{o(k.conversationId),a(I=>[...I,{id:k.messageId||Date.now().toString(),role:"assistant",content:k.content,timestamp:new Date().toISOString()}]),c(""),l(!1),g([])}),e.on("bot:error",k=>{c(""),l(!1),g([]),a(I=>[...I,{id:Date.now().toString(),role:"assistant",content:`Error: ${k.error}`,timestamp:new Date().toISOString()}])}),e.on("chat:sync",k=>{i&&k.conversationId!==i||a(I=>[...I,{id:Date.now().toString(),role:k.message.role,content:k.message.content,timestamp:k.message.timestamp}])}),e.on("chat:conversation-created",k=>{o(k.conversationId)}),e.on("chat:cleared",()=>{a([]),o(null),c(""),l(!1),g([]),p.current=!1})];return()=>_.forEach(k=>k())},[e,i]);const w=U.useCallback((_,k,I)=>{if(!e||!_.trim()&&(!k||k.length===0))return;const N={id:Date.now().toString(),role:"user",content:_,timestamp:new Date().toISOString(),hasAttachments:!!(k&&k.length>0),audioData:I?I.startsWith("data:")?I:`data:audio/webm;base64,${I}`:void 0};a(x=>[...x,N]);const A={conversationId:i,content:_};I&&(A.audioData=I.includes(",")?I.split(",")[1]:I),k?.length&&(A.attachments=k.map(x=>{const M=x.preview.match(/^data:([^;]+);base64,(.+)$/);return{type:x.type,name:x.name,mediaType:M?.[1]||"application/octet-stream",data:M?.[2]||""}})),e.send("user:message",A)},[e,i]),S=U.useCallback(()=>{e&&(e.send("user:stop",{conversationId:i}),l(!1),c(""),g([]))},[e,i]),E=U.useCallback(()=>{e&&e.send("user:clear-context",{}),a([]),o(null),c(""),l(!1),g([]),p.current=!1},[e]);return{messages:r,streaming:s,streamBuffer:u,conversationId:i,tools:d,sendMessage:w,stopStreaming:S,clearContext:E}}function Ad({onLogin:e}){const[t,n]=U.useState(""),[r,a]=U.useState(""),[i,o]=U.useState(!1),s=async()=>{if(!(!t.trim()||i)){o(!0),a("");try{const c=btoa(`admin:${t}`),d=await fetch("/api/portal/login",{headers:{Authorization:`Basic ${c}`}}),g=await d.json();d.ok&&g.token?e(g.token):a(g.error||"Invalid password")}catch{a("Could not reach server")}finally{o(!1)}}},l=c=>{c.key==="Enter"&&s()};return y.jsx("div",{className:"flex flex-col items-center justify-center h-dvh px-6",children:y.jsxs("div",{className:"w-full max-w-[320px] flex flex-col items-center",children:[y.jsx("div",{className:"w-14 h-14 rounded-2xl bg-white/[0.04] border border-white/[0.08] flex items-center justify-center mb-5",children:y.jsx(id,{className:"h-6 w-6 text-white/40"})}),y.jsx("h1",{className:"text-xl font-bold text-white tracking-tight mb-1",children:"Welcome back"}),y.jsx("p",{className:"text-white/40 text-[13px] mb-6",children:"Enter your password to continue."}),r&&y.jsx("div",{className:"w-full bg-red-500/8 border border-red-500/15 rounded-xl px-4 py-2.5 mb-4",children:y.jsx("p",{className:"text-red-400/90 text-[12px]",children:r})}),y.jsx("input",{type:"password",value:t,onChange:c=>n(c.target.value),onKeyDown:l,placeholder:"Password",autoFocus:!0,autoComplete:"current-password",className:"w-full bg-white/[0.05] border border-white/[0.08] text-white rounded-xl px-4 py-3 text-base outline-none input-glow placeholder:text-white/20 transition-all"}),y.jsx("button",{onClick:s,disabled:!t.trim()||i,className:"w-full mt-4 py-3 bg-gradient-brand hover:opacity-90 text-white text-[14px] font-semibold rounded-full transition-colors flex items-center justify-center gap-2 disabled:opacity-40",children:i?y.jsxs(y.Fragment,{children:[y.jsx(Gc,{className:"h-4 w-4 animate-spin"}),"Signing in..."]}):y.jsxs(y.Fragment,{children:["Sign In",y.jsx(jc,{className:"h-4 w-4"})]})})]})})}function pl(e){const t=[],n=String(e||"");let r=n.indexOf(","),a=0,i=!1;for(;!i;){r===-1&&(r=n.length,i=!0);const o=n.slice(a,r).trim();(o||!i)&&t.push(o),a=r+1,r=n.indexOf(",",a)}return t}function _d(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const Id=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Nd=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Rd={};function gl(e,t){return(Rd.jsx?Nd:Id).test(e)}const xd=/[ \t\n\f\r]/g;function vd(e){return typeof e=="object"?e.type==="text"?fl(e.value):!1:fl(e)}function fl(e){return e.replace(xd,"")===""}class Et{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}Et.prototype.normal={};Et.prototype.property={};Et.prototype.space=void 0;function mu(e,t){const n={},r={};for(const a of e)Object.assign(n,a.property),Object.assign(r,a.normal);return new Et(n,r,t)}function gt(e){return e.toLowerCase()}class he{constructor(t,n){this.attribute=n,this.property=t}}he.prototype.attribute="";he.prototype.booleanish=!1;he.prototype.boolean=!1;he.prototype.commaOrSpaceSeparated=!1;he.prototype.commaSeparated=!1;he.prototype.defined=!1;he.prototype.mustUseProperty=!1;he.prototype.number=!1;he.prototype.overloadedBoolean=!1;he.prototype.property="";he.prototype.spaceSeparated=!1;he.prototype.space=void 0;let Cd=0;const q=Pe(),se=Pe(),_n=Pe(),C=Pe(),ae=Pe(),qe=Pe(),Se=Pe();function Pe(){return 2**++Cd}const In=Object.freeze(Object.defineProperty({__proto__:null,boolean:q,booleanish:se,commaOrSpaceSeparated:Se,commaSeparated:qe,number:C,overloadedBoolean:_n,spaceSeparated:ae},Symbol.toStringTag,{value:"Module"})),nn=Object.keys(In);class jn extends he{constructor(t,n,r,a){let i=-1;if(super(t,n),ml(this,"space",a),typeof r=="number")for(;++i<nn.length;){const o=nn[i];ml(this,nn[i],(r&In[o])===In[o])}}}jn.prototype.defined=!0;function ml(e,t,n){n&&(e[t]=n)}function Ke(e){const t={},n={};for(const[r,a]of Object.entries(e.properties)){const i=new jn(r,e.transform(e.attributes||{},r),a,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(i.mustUseProperty=!0),t[r]=i,n[gt(r)]=r,n[gt(i.attribute)]=r}return new Et(t,n,e.space)}const bu=Ke({properties:{ariaActiveDescendant:null,ariaAtomic:se,ariaAutoComplete:null,ariaBusy:se,ariaChecked:se,ariaColCount:C,ariaColIndex:C,ariaColSpan:C,ariaControls:ae,ariaCurrent:null,ariaDescribedBy:ae,ariaDetails:null,ariaDisabled:se,ariaDropEffect:ae,ariaErrorMessage:null,ariaExpanded:se,ariaFlowTo:ae,ariaGrabbed:se,ariaHasPopup:null,ariaHidden:se,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:ae,ariaLevel:C,ariaLive:null,ariaModal:se,ariaMultiLine:se,ariaMultiSelectable:se,ariaOrientation:null,ariaOwns:ae,ariaPlaceholder:null,ariaPosInSet:C,ariaPressed:se,ariaReadOnly:se,ariaRelevant:null,ariaRequired:se,ariaRoleDescription:ae,ariaRowCount:C,ariaRowIndex:C,ariaRowSpan:C,ariaSelected:se,ariaSetSize:C,ariaSort:null,ariaValueMax:C,ariaValueMin:C,ariaValueNow:C,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function hu(e,t){return t in e?e[t]:t}function Eu(e,t){return hu(e,t.toLowerCase())}const Od=Ke({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:qe,acceptCharset:ae,accessKey:ae,action:null,allow:null,allowFullScreen:q,allowPaymentRequest:q,allowUserMedia:q,alt:null,as:null,async:q,autoCapitalize:null,autoComplete:ae,autoFocus:q,autoPlay:q,blocking:ae,capture:null,charSet:null,checked:q,cite:null,className:ae,cols:C,colSpan:null,content:null,contentEditable:se,controls:q,controlsList:ae,coords:C|qe,crossOrigin:null,data:null,dateTime:null,decoding:null,default:q,defer:q,dir:null,dirName:null,disabled:q,download:_n,draggable:se,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:q,formTarget:null,headers:ae,height:C,hidden:_n,high:C,href:null,hrefLang:null,htmlFor:ae,httpEquiv:ae,id:null,imageSizes:null,imageSrcSet:null,inert:q,inputMode:null,integrity:null,is:null,isMap:q,itemId:null,itemProp:ae,itemRef:ae,itemScope:q,itemType:ae,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:q,low:C,manifest:null,max:null,maxLength:C,media:null,method:null,min:null,minLength:C,multiple:q,muted:q,name:null,nonce:null,noModule:q,noValidate:q,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:q,optimum:C,pattern:null,ping:ae,placeholder:null,playsInline:q,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:q,referrerPolicy:null,rel:ae,required:q,reversed:q,rows:C,rowSpan:C,sandbox:ae,scope:null,scoped:q,seamless:q,selected:q,shadowRootClonable:q,shadowRootDelegatesFocus:q,shadowRootMode:null,shape:null,size:C,sizes:null,slot:null,span:C,spellCheck:se,src:null,srcDoc:null,srcLang:null,srcSet:null,start:C,step:null,style:null,tabIndex:C,target:null,title:null,translate:null,type:null,typeMustMatch:q,useMap:null,value:se,width:C,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:ae,axis:null,background:null,bgColor:null,border:C,borderColor:null,bottomMargin:C,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:q,declare:q,event:null,face:null,frame:null,frameBorder:null,hSpace:C,leftMargin:C,link:null,longDesc:null,lowSrc:null,marginHeight:C,marginWidth:C,noResize:q,noHref:q,noShade:q,noWrap:q,object:null,profile:null,prompt:null,rev:null,rightMargin:C,rules:null,scheme:null,scrolling:se,standby:null,summary:null,text:null,topMargin:C,valueType:null,version:null,vAlign:null,vLink:null,vSpace:C,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:q,disableRemotePlayback:q,prefix:null,property:null,results:C,security:null,unselectable:null},space:"html",transform:Eu}),Ld=Ke({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Se,accentHeight:C,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:C,amplitude:C,arabicForm:null,ascent:C,attributeName:null,attributeType:null,azimuth:C,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:C,by:null,calcMode:null,capHeight:C,className:ae,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:C,diffuseConstant:C,direction:null,display:null,dur:null,divisor:C,dominantBaseline:null,download:q,dx:null,dy:null,edgeMode:null,editable:null,elevation:C,enableBackground:null,end:null,event:null,exponent:C,externalResourcesRequired:null,fill:null,fillOpacity:C,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:qe,g2:qe,glyphName:qe,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:C,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:C,horizOriginX:C,horizOriginY:C,id:null,ideographic:C,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:C,k:C,k1:C,k2:C,k3:C,k4:C,kernelMatrix:Se,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:C,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:C,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:C,overlineThickness:C,paintOrder:null,panose1:null,path:null,pathLength:C,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:ae,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:C,pointsAtY:C,pointsAtZ:C,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Se,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Se,rev:Se,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Se,requiredFeatures:Se,requiredFonts:Se,requiredFormats:Se,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:C,specularExponent:C,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:C,strikethroughThickness:C,string:null,stroke:null,strokeDashArray:Se,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:C,strokeOpacity:C,strokeWidth:null,style:null,surfaceScale:C,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Se,tabIndex:C,tableValues:null,target:null,targetX:C,targetY:C,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Se,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:C,underlineThickness:C,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:C,values:null,vAlphabetic:C,vMathematical:C,vectorEffect:null,vHanging:C,vIdeographic:C,version:null,vertAdvY:C,vertOriginX:C,vertOriginY:C,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:C,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:hu}),yu=Ke({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),Su=Ke({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Eu}),wu=Ke({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),Dd={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},Md=/[A-Z]/g,bl=/-[a-z]/g,Fd=/^data[-\w.:]+$/i;function ku(e,t){const n=gt(t);let r=t,a=he;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&Fd.test(t)){if(t.charAt(4)==="-"){const i=t.slice(5).replace(bl,Bd);r="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=t.slice(4);if(!bl.test(i)){let o=i.replace(Md,Ud);o.charAt(0)!=="-"&&(o="-"+o),t="data"+o}}a=jn}return new a(r,t)}function Ud(e){return"-"+e.toLowerCase()}function Bd(e){return e.charAt(1).toUpperCase()}const Tu=mu([bu,Od,yu,Su,wu],"html"),zt=mu([bu,Ld,yu,Su,wu],"svg");function hl(e){const t=String(e||"").trim();return t?t.split(/[ \t\n\r\f]+/g):[]}function Pd(e){return e.join(" ").trim()}var je={},rn,El;function $d(){if(El)return rn;El=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,a=/^:\s*/,i=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,o=/^[;\s]*/,s=/^\s+|\s+$/g,l=`
2
2
  `,u="/",c="*",d="",g="comment",p="declaration";function m(S,E){if(typeof S!="string")throw new TypeError("First argument must be a string");if(!S)return[];E=E||{};var _=1,k=1;function I(F){var L=F.match(t);L&&(_+=L.length);var H=F.lastIndexOf(l);k=~H?F.length-H:k+F.length}function N(){var F={line:_,column:k};return function(L){return L.position=new A(F),$(),L}}function A(F){this.start=F,this.end={line:_,column:k},this.source=E.source}A.prototype.content=S;function x(F){var L=new Error(E.source+":"+_+":"+k+": "+F);if(L.reason=F,L.filename=E.source,L.line=_,L.column=k,L.source=S,!E.silent)throw L}function M(F){var L=F.exec(S);if(L){var H=L[0];return I(H),S=S.slice(H.length),L}}function $(){M(n)}function T(F){var L;for(F=F||[];L=v();)L!==!1&&F.push(L);return F}function v(){var F=N();if(!(u!=S.charAt(0)||c!=S.charAt(1))){for(var L=2;d!=S.charAt(L)&&(c!=S.charAt(L)||u!=S.charAt(L+1));)++L;if(L+=2,d===S.charAt(L-1))return x("End of comment missing");var H=S.slice(2,L-2);return k+=2,I(H),S=S.slice(L),k+=2,F({type:g,comment:H})}}function O(){var F=N(),L=M(r);if(L){if(v(),!M(a))return x("property missing ':'");var H=M(i),W=F({type:p,property:w(L[0].replace(e,d)),value:H?w(H[0].replace(e,d)):d});return M(o),W}}function D(){var F=[];T(F);for(var L;L=O();)L!==!1&&(F.push(L),T(F));return F}return $(),D()}function w(S){return S?S.replace(s,d):d}return rn=m,rn}var yl;function zd(){if(yl)return je;yl=1;var e=je&&je.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(je,"__esModule",{value:!0}),je.default=n;const t=e($d());function n(r,a){let i=null;if(!r||typeof r!="string")return i;const o=(0,t.default)(r),s=typeof a=="function";return o.forEach(l=>{if(l.type!=="declaration")return;const{property:u,value:c}=l;s?a(u,c,l):c&&(i=i||{},i[u]=c)}),i}return je}var it={},Sl;function Gd(){if(Sl)return it;Sl=1,Object.defineProperty(it,"__esModule",{value:!0}),it.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,i=function(u){return!u||n.test(u)||e.test(u)},o=function(u,c){return c.toUpperCase()},s=function(u,c){return"".concat(c,"-")},l=function(u,c){return c===void 0&&(c={}),i(u)?u:(u=u.toLowerCase(),c.reactCompat?u=u.replace(a,s):u=u.replace(r,s),u.replace(t,o))};return it.camelCase=l,it}var ot,wl;function jd(){if(wl)return ot;wl=1;var e=ot&&ot.__importDefault||function(a){return a&&a.__esModule?a:{default:a}},t=e(zd()),n=Gd();function r(a,i){var o={};return!a||typeof a!="string"||(0,t.default)(a,function(s,l){s&&l&&(o[(0,n.camelCase)(s,i)]=l)}),o}return r.default=r,ot=r,ot}var Hd=jd();const Vd=du(Hd),Au=_u("end"),Hn=_u("start");function _u(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function Wd(e){const t=Hn(e),n=Au(e);if(t&&n)return{start:t,end:n}}function ut(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?kl(e.position):"start"in e||"end"in e?kl(e):"line"in e||"column"in e?Nn(e):""}function Nn(e){return Tl(e&&e.line)+":"+Tl(e&&e.column)}function kl(e){return Nn(e&&e.start)+"-"+Nn(e&&e.end)}function Tl(e){return e&&typeof e=="number"?e:1}class pe extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let a="",i={},o=!1;if(n&&("line"in n&&"column"in n?i={place:n}:"start"in n&&"end"in n?i={place:n}:"type"in n?i={ancestors:[n],place:n.position}:i={...n}),typeof t=="string"?a=t:!i.cause&&t&&(o=!0,a=t.message,i.cause=t),!i.ruleId&&!i.source&&typeof r=="string"){const l=r.indexOf(":");l===-1?i.ruleId=r:(i.source=r.slice(0,l),i.ruleId=r.slice(l+1))}if(!i.place&&i.ancestors&&i.ancestors){const l=i.ancestors[i.ancestors.length-1];l&&(i.place=l.position)}const s=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=s?s.column:void 0,this.fatal=void 0,this.file="",this.message=a,this.line=s?s.line:void 0,this.name=ut(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=o&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}pe.prototype.file="";pe.prototype.name="";pe.prototype.reason="";pe.prototype.message="";pe.prototype.stack="";pe.prototype.column=void 0;pe.prototype.line=void 0;pe.prototype.ancestors=void 0;pe.prototype.cause=void 0;pe.prototype.fatal=void 0;pe.prototype.place=void 0;pe.prototype.ruleId=void 0;pe.prototype.source=void 0;const Vn={}.hasOwnProperty,qd=new Map,Yd=/[A-Z]/g,Kd=new Set(["table","tbody","thead","tfoot","tr"]),Xd=new Set(["td","th"]),Iu="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function Zd(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=ip(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=ap(n,t.jsx,t.jsxs)}const a={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?zt:Tu,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},i=Nu(a,e,void 0);return i&&typeof i!="string"?i:a.create(e,a.Fragment,{children:i||void 0},void 0)}function Nu(e,t,n){if(t.type==="element")return Qd(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return Jd(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return tp(e,t,n);if(t.type==="mdxjsEsm")return ep(e,t);if(t.type==="root")return np(e,t,n);if(t.type==="text")return rp(e,t)}function Qd(e,t,n){const r=e.schema;let a=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(a=zt,e.schema=a),e.ancestors.push(t);const i=xu(e,t.tagName,!1),o=op(e,t);let s=qn(e,t);return Kd.has(t.tagName)&&(s=s.filter(function(l){return typeof l=="string"?!vd(l):!0})),Ru(e,o,i,t),Wn(o,s),e.ancestors.pop(),e.schema=r,e.create(t,i,o,n)}function Jd(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}ft(e,t.position)}function ep(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);ft(e,t.position)}function tp(e,t,n){const r=e.schema;let a=r;t.name==="svg"&&r.space==="html"&&(a=zt,e.schema=a),e.ancestors.push(t);const i=t.name===null?e.Fragment:xu(e,t.name,!0),o=sp(e,t),s=qn(e,t);return Ru(e,o,i,t),Wn(o,s),e.ancestors.pop(),e.schema=r,e.create(t,i,o,n)}function np(e,t,n){const r={};return Wn(r,qn(e,t)),e.create(t,e.Fragment,r,n)}function rp(e,t){return t.value}function Ru(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Wn(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function ap(e,t,n){return r;function r(a,i,o,s){const u=Array.isArray(o.children)?n:t;return s?u(i,o,s):u(i,o)}}function ip(e,t){return n;function n(r,a,i,o){const s=Array.isArray(i.children),l=Hn(r);return t(a,i,o,s,{columnNumber:l?l.column-1:void 0,fileName:e,lineNumber:l?l.line:void 0},void 0)}}function op(e,t){const n={};let r,a;for(a in t.properties)if(a!=="children"&&Vn.call(t.properties,a)){const i=lp(e,a,t.properties[a]);if(i){const[o,s]=i;e.tableCellAlignToStyle&&o==="align"&&typeof s=="string"&&Xd.has(t.tagName)?r=s:n[o]=s}}if(r){const i=n.style||(n.style={});i[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function sp(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const i=r.data.estree.body[0];i.type;const o=i.expression;o.type;const s=o.properties[0];s.type,Object.assign(n,e.evaluater.evaluateExpression(s.argument))}else ft(e,t.position);else{const a=r.name;let i;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const s=r.value.data.estree.body[0];s.type,i=e.evaluater.evaluateExpression(s.expression)}else ft(e,t.position);else i=r.value===null?!0:r.value;n[a]=i}return n}function qn(e,t){const n=[];let r=-1;const a=e.passKeys?new Map:qd;for(;++r<t.children.length;){const i=t.children[r];let o;if(e.passKeys){const l=i.type==="element"?i.tagName:i.type==="mdxJsxFlowElement"||i.type==="mdxJsxTextElement"?i.name:void 0;if(l){const u=a.get(l)||0;o=l+"-"+u,a.set(l,u+1)}}const s=Nu(e,i,o);s!==void 0&&n.push(s)}return n}function lp(e,t,n){const r=ku(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?_d(n):Pd(n)),r.property==="style"){let a=typeof n=="object"?n:up(e,String(n));return e.stylePropertyNameCase==="css"&&(a=cp(a)),["style",a]}return[e.elementAttributeNameCase==="react"&&r.space?Dd[r.property]||r.property:r.attribute,n]}}function up(e,t){try{return Vd(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,a=new pe("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw a.file=e.filePath||void 0,a.url=Iu+"#cannot-parse-style-attribute",a}}function xu(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const a=t.split(".");let i=-1,o;for(;++i<a.length;){const s=gl(a[i])?{type:"Identifier",name:a[i]}:{type:"Literal",value:a[i]};o=o?{type:"MemberExpression",object:o,property:s,computed:!!(i&&s.type==="Literal"),optional:!1}:s}r=o}else r=gl(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const a=r.value;return Vn.call(e.components,a)?e.components[a]:a}if(e.evaluater)return e.evaluater.evaluateExpression(r);ft(e)}function ft(e,t){const n=new pe("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=Iu+"#cannot-handle-mdx-estrees-without-createevaluater",n}function cp(e){const t={};let n;for(n in e)Vn.call(e,n)&&(t[dp(n)]=e[n]);return t}function dp(e){let t=e.replace(Yd,pp);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function pp(e){return"-"+e.toLowerCase()}const an={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},gp={};function Yn(e,t){const n=gp,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,a=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return vu(e,r,a)}function vu(e,t,n){if(fp(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return Al(e.children,t,n)}return Array.isArray(e)?Al(e,t,n):""}function Al(e,t,n){const r=[];let a=-1;for(;++a<e.length;)r[a]=vu(e[a],t,n);return r.join("")}function fp(e){return!!(e&&typeof e=="object")}const _l=document.createElement("i");function mt(e){const t="&"+e+";";_l.innerHTML=t;const n=_l.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function we(e,t,n,r){const a=e.length;let i=0,o;if(t<0?t=-t>a?0:a+t:t=t>a?a:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);i<r.length;)o=r.slice(i,i+1e4),o.unshift(t,0),e.splice(...o),i+=1e4,t+=1e4}function Te(e,t){return e.length>0?(we(e,e.length,0,t),e):t}const Il={}.hasOwnProperty;function Cu(e){const t={};let n=-1;for(;++n<e.length;)mp(t,e[n]);return t}function mp(e,t){let n;for(n in t){const a=(Il.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let o;if(i)for(o in i){Il.call(a,o)||(a[o]=[]);const s=i[o];bp(a[o],Array.isArray(s)?s:s?[s]:[])}}}function bp(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);we(e,0,0,r)}function Ou(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function _e(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const me=Me(/[A-Za-z]/),ce=Me(/[\dA-Za-z]/),hp=Me(/[#-'*+\--9=?A-Z^-~]/);function Ut(e){return e!==null&&(e<32||e===127)}const Rn=Me(/\d/),Ep=Me(/[\dA-Fa-f]/),yp=Me(/[!-/:-@[-`{-~]/);function G(e){return e!==null&&e<-2}function re(e){return e!==null&&(e<0||e===32)}function K(e){return e===-2||e===-1||e===32}const Gt=Me(new RegExp("\\p{P}|\\p{S}","u")),Be=Me(/\s/);function Me(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Xe(e){const t=[];let n=-1,r=0,a=0;for(;++n<e.length;){const i=e.charCodeAt(n);let o="";if(i===37&&ce(e.charCodeAt(n+1))&&ce(e.charCodeAt(n+2)))a=2;else if(i<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(i))||(o=String.fromCharCode(i));else if(i>55295&&i<57344){const s=e.charCodeAt(n+1);i<56320&&s>56319&&s<57344?(o=String.fromCharCode(i,s),a=1):o="�"}else o=String.fromCharCode(i);o&&(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+a+1,o=""),a&&(n+=a,a=0)}return t.join("")+e.slice(r)}function ee(e,t,n,r){const a=r?r-1:Number.POSITIVE_INFINITY;let i=0;return o;function o(l){return K(l)?(e.enter(n),s(l)):t(l)}function s(l){return K(l)&&i++<a?(e.consume(l),s):(e.exit(n),t(l))}}const Sp={tokenize:wp};function wp(e){const t=e.attempt(this.parser.constructs.contentInitial,r,a);let n;return t;function r(s){if(s===null){e.consume(s);return}return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),ee(e,t,"linePrefix")}function a(s){return e.enter("paragraph"),i(s)}function i(s){const l=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=l),n=l,o(s)}function o(s){if(s===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(s);return}return G(s)?(e.consume(s),e.exit("chunkText"),i):(e.consume(s),o)}}const kp={tokenize:Tp},Nl={tokenize:Ap};function Tp(e){const t=this,n=[];let r=0,a,i,o;return s;function s(k){if(r<n.length){const I=n[r];return t.containerState=I[1],e.attempt(I[0].continuation,l,u)(k)}return u(k)}function l(k){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,a&&_();const I=t.events.length;let N=I,A;for(;N--;)if(t.events[N][0]==="exit"&&t.events[N][1].type==="chunkFlow"){A=t.events[N][1].end;break}E(r);let x=I;for(;x<t.events.length;)t.events[x][1].end={...A},x++;return we(t.events,N+1,0,t.events.slice(I)),t.events.length=x,u(k)}return s(k)}function u(k){if(r===n.length){if(!a)return g(k);if(a.currentConstruct&&a.currentConstruct.concrete)return m(k);t.interrupt=!!(a.currentConstruct&&!a._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Nl,c,d)(k)}function c(k){return a&&_(),E(r),g(k)}function d(k){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,m(k)}function g(k){return t.containerState={},e.attempt(Nl,p,m)(k)}function p(k){return r++,n.push([t.currentConstruct,t.containerState]),g(k)}function m(k){if(k===null){a&&_(),E(0),e.consume(k);return}return a=a||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:a,contentType:"flow",previous:i}),w(k)}function w(k){if(k===null){S(e.exit("chunkFlow"),!0),E(0),e.consume(k);return}return G(k)?(e.consume(k),S(e.exit("chunkFlow")),r=0,t.interrupt=void 0,s):(e.consume(k),w)}function S(k,I){const N=t.sliceStream(k);if(I&&N.push(null),k.previous=i,i&&(i.next=k),i=k,a.defineSkip(k.start),a.write(N),t.parser.lazy[k.start.line]){let A=a.events.length;for(;A--;)if(a.events[A][1].start.offset<o&&(!a.events[A][1].end||a.events[A][1].end.offset>o))return;const x=t.events.length;let M=x,$,T;for(;M--;)if(t.events[M][0]==="exit"&&t.events[M][1].type==="chunkFlow"){if($){T=t.events[M][1].end;break}$=!0}for(E(r),A=x;A<t.events.length;)t.events[A][1].end={...T},A++;we(t.events,M+1,0,t.events.slice(x)),t.events.length=A}}function E(k){let I=n.length;for(;I-- >k;){const N=n[I];t.containerState=N[1],N[0].exit.call(t,e)}n.length=k}function _(){a.write([null]),i=void 0,a=void 0,t.containerState._closeFlow=void 0}}function Ap(e,t,n){return ee(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Ye(e){if(e===null||re(e)||Be(e))return 1;if(Gt(e))return 2}function jt(e,t,n){const r=[];let a=-1;for(;++a<e.length;){const i=e[a].resolveAll;i&&!r.includes(i)&&(t=i(t,n),r.push(i))}return t}const xn={name:"attention",resolveAll:_p,tokenize:Ip};function _p(e,t){let n=-1,r,a,i,o,s,l,u,c;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;l=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const d={...e[r][1].end},g={...e[n][1].start};Rl(d,-l),Rl(g,l),o={type:l>1?"strongSequence":"emphasisSequence",start:d,end:{...e[r][1].end}},s={type:l>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:g},i={type:l>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},a={type:l>1?"strong":"emphasis",start:{...o.start},end:{...s.end}},e[r][1].end={...o.start},e[n][1].start={...s.end},u=[],e[r][1].end.offset-e[r][1].start.offset&&(u=Te(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=Te(u,[["enter",a,t],["enter",o,t],["exit",o,t],["enter",i,t]]),u=Te(u,jt(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=Te(u,[["exit",i,t],["enter",s,t],["exit",s,t],["exit",a,t]]),e[n][1].end.offset-e[n][1].start.offset?(c=2,u=Te(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):c=0,we(e,r-1,n-r+3,u),n=r+u.length-c-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function Ip(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,a=Ye(r);let i;return o;function o(l){return i=l,e.enter("attentionSequence"),s(l)}function s(l){if(l===i)return e.consume(l),s;const u=e.exit("attentionSequence"),c=Ye(l),d=!c||c===2&&a||n.includes(l),g=!a||a===2&&c||n.includes(r);return u._open=!!(i===42?d:d&&(a||!g)),u._close=!!(i===42?g:g&&(c||!d)),t(l)}}function Rl(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const Np={name:"autolink",tokenize:Rp};function Rp(e,t,n){let r=0;return a;function a(p){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i}function i(p){return me(p)?(e.consume(p),o):p===64?n(p):u(p)}function o(p){return p===43||p===45||p===46||ce(p)?(r=1,s(p)):u(p)}function s(p){return p===58?(e.consume(p),r=0,l):(p===43||p===45||p===46||ce(p))&&r++<32?(e.consume(p),s):(r=0,u(p))}function l(p){return p===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):p===null||p===32||p===60||Ut(p)?n(p):(e.consume(p),l)}function u(p){return p===64?(e.consume(p),c):hp(p)?(e.consume(p),u):n(p)}function c(p){return ce(p)?d(p):n(p)}function d(p){return p===46?(e.consume(p),r=0,c):p===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):g(p)}function g(p){if((p===45||ce(p))&&r++<63){const m=p===45?g:d;return e.consume(p),m}return n(p)}}const yt={partial:!0,tokenize:xp};function xp(e,t,n){return r;function r(i){return K(i)?ee(e,a,"linePrefix")(i):a(i)}function a(i){return i===null||G(i)?t(i):n(i)}}const Lu={continuation:{tokenize:Cp},exit:Op,name:"blockQuote",tokenize:vp};function vp(e,t,n){const r=this;return a;function a(o){if(o===62){const s=r.containerState;return s.open||(e.enter("blockQuote",{_container:!0}),s.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(o),e.exit("blockQuoteMarker"),i}return n(o)}function i(o){return K(o)?(e.enter("blockQuotePrefixWhitespace"),e.consume(o),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(o))}}function Cp(e,t,n){const r=this;return a;function a(o){return K(o)?ee(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):i(o)}function i(o){return e.attempt(Lu,t,n)(o)}}function Op(e){e.exit("blockQuote")}const Du={name:"characterEscape",tokenize:Lp};function Lp(e,t,n){return r;function r(i){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(i),e.exit("escapeMarker"),a}function a(i){return yp(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}const Mu={name:"characterReference",tokenize:Dp};function Dp(e,t,n){const r=this;let a=0,i,o;return s;function s(d){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(d),e.exit("characterReferenceMarker"),l}function l(d){return d===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(d),e.exit("characterReferenceMarkerNumeric"),u):(e.enter("characterReferenceValue"),i=31,o=ce,c(d))}function u(d){return d===88||d===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(d),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),i=6,o=Ep,c):(e.enter("characterReferenceValue"),i=7,o=Rn,c(d))}function c(d){if(d===59&&a){const g=e.exit("characterReferenceValue");return o===ce&&!mt(r.sliceSerialize(g))?n(d):(e.enter("characterReferenceMarker"),e.consume(d),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return o(d)&&a++<i?(e.consume(d),c):n(d)}}const xl={partial:!0,tokenize:Fp},vl={concrete:!0,name:"codeFenced",tokenize:Mp};function Mp(e,t,n){const r=this,a={partial:!0,tokenize:N};let i=0,o=0,s;return l;function l(A){return u(A)}function u(A){const x=r.events[r.events.length-1];return i=x&&x[1].type==="linePrefix"?x[2].sliceSerialize(x[1],!0).length:0,s=A,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),c(A)}function c(A){return A===s?(o++,e.consume(A),c):o<3?n(A):(e.exit("codeFencedFenceSequence"),K(A)?ee(e,d,"whitespace")(A):d(A))}function d(A){return A===null||G(A)?(e.exit("codeFencedFence"),r.interrupt?t(A):e.check(xl,w,I)(A)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),g(A))}function g(A){return A===null||G(A)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),d(A)):K(A)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),ee(e,p,"whitespace")(A)):A===96&&A===s?n(A):(e.consume(A),g)}function p(A){return A===null||G(A)?d(A):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),m(A))}function m(A){return A===null||G(A)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),d(A)):A===96&&A===s?n(A):(e.consume(A),m)}function w(A){return e.attempt(a,I,S)(A)}function S(A){return e.enter("lineEnding"),e.consume(A),e.exit("lineEnding"),E}function E(A){return i>0&&K(A)?ee(e,_,"linePrefix",i+1)(A):_(A)}function _(A){return A===null||G(A)?e.check(xl,w,I)(A):(e.enter("codeFlowValue"),k(A))}function k(A){return A===null||G(A)?(e.exit("codeFlowValue"),_(A)):(e.consume(A),k)}function I(A){return e.exit("codeFenced"),t(A)}function N(A,x,M){let $=0;return T;function T(L){return A.enter("lineEnding"),A.consume(L),A.exit("lineEnding"),v}function v(L){return A.enter("codeFencedFence"),K(L)?ee(A,O,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(L):O(L)}function O(L){return L===s?(A.enter("codeFencedFenceSequence"),D(L)):M(L)}function D(L){return L===s?($++,A.consume(L),D):$>=o?(A.exit("codeFencedFenceSequence"),K(L)?ee(A,F,"whitespace")(L):F(L)):M(L)}function F(L){return L===null||G(L)?(A.exit("codeFencedFence"),x(L)):M(L)}}}function Fp(e,t,n){const r=this;return a;function a(o){return o===null?n(o):(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i)}function i(o){return r.parser.lazy[r.now().line]?n(o):t(o)}}const on={name:"codeIndented",tokenize:Bp},Up={partial:!0,tokenize:Pp};function Bp(e,t,n){const r=this;return a;function a(u){return e.enter("codeIndented"),ee(e,i,"linePrefix",5)(u)}function i(u){const c=r.events[r.events.length-1];return c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?o(u):n(u)}function o(u){return u===null?l(u):G(u)?e.attempt(Up,o,l)(u):(e.enter("codeFlowValue"),s(u))}function s(u){return u===null||G(u)?(e.exit("codeFlowValue"),o(u)):(e.consume(u),s)}function l(u){return e.exit("codeIndented"),t(u)}}function Pp(e,t,n){const r=this;return a;function a(o){return r.parser.lazy[r.now().line]?n(o):G(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),a):ee(e,i,"linePrefix",5)(o)}function i(o){const s=r.events[r.events.length-1];return s&&s[1].type==="linePrefix"&&s[2].sliceSerialize(s[1],!0).length>=4?t(o):G(o)?a(o):n(o)}}const $p={name:"codeText",previous:Gp,resolve:zp,tokenize:jp};function zp(e){let t=e.length-4,n=3,r,a;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)a===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(a=r):(r===t||e[r][1].type==="lineEnding")&&(e[a][1].type="codeTextData",r!==a+2&&(e[a][1].end=e[r-1][1].end,e.splice(a+2,r-a-2),t-=r-a-2,r=a+2),a=void 0);return e}function Gp(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function jp(e,t,n){let r=0,a,i;return o;function o(d){return e.enter("codeText"),e.enter("codeTextSequence"),s(d)}function s(d){return d===96?(e.consume(d),r++,s):(e.exit("codeTextSequence"),l(d))}function l(d){return d===null?n(d):d===32?(e.enter("space"),e.consume(d),e.exit("space"),l):d===96?(i=e.enter("codeTextSequence"),a=0,c(d)):G(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),l):(e.enter("codeTextData"),u(d))}function u(d){return d===null||d===32||d===96||G(d)?(e.exit("codeTextData"),l(d)):(e.consume(d),u)}function c(d){return d===96?(e.consume(d),a++,c):a===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(d)):(i.type="codeTextData",u(d))}}class Hp{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const a=n||0;this.setCursor(Math.trunc(t));const i=this.right.splice(this.right.length-a,Number.POSITIVE_INFINITY);return r&&st(this.left,r),i.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),st(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),st(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);st(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);st(this.left,n.reverse())}}}function st(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function Fu(e){const t={};let n=-1,r,a,i,o,s,l,u;const c=new Hp(e);for(;++n<c.length;){for(;n in t;)n=t[n];if(r=c.get(n),n&&r[1].type==="chunkFlow"&&c.get(n-1)[1].type==="listItemPrefix"&&(l=r[1]._tokenizer.events,i=0,i<l.length&&l[i][1].type==="lineEndingBlank"&&(i+=2),i<l.length&&l[i][1].type==="content"))for(;++i<l.length&&l[i][1].type!=="content";)l[i][1].type==="chunkText"&&(l[i][1]._isInFirstContentOfListItem=!0,i++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,Vp(c,n)),n=t[n],u=!0);else if(r[1]._container){for(i=n,a=void 0;i--;)if(o=c.get(i),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank")o[0]==="enter"&&(a&&(c.get(a)[1].type="lineEndingBlank"),o[1].type="lineEnding",a=i);else if(!(o[1].type==="linePrefix"||o[1].type==="listItemIndent"))break;a&&(r[1].end={...c.get(a)[1].start},s=c.slice(a,n),s.unshift(r),c.splice(a,n-a+1,s))}}return we(e,0,Number.POSITIVE_INFINITY,c.slice(0)),!u}function Vp(e,t){const n=e.get(t)[1],r=e.get(t)[2];let a=t-1;const i=[];let o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));const s=o.events,l=[],u={};let c,d,g=-1,p=n,m=0,w=0;const S=[w];for(;p;){for(;e.get(++a)[1]!==p;);i.push(a),p._tokenizer||(c=r.sliceStream(p),p.next||c.push(null),d&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(c),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),d=p,p=p.next}for(p=n;++g<s.length;)s[g][0]==="exit"&&s[g-1][0]==="enter"&&s[g][1].type===s[g-1][1].type&&s[g][1].start.line!==s[g][1].end.line&&(w=g+1,S.push(w),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):S.pop(),g=S.length;g--;){const E=s.slice(S[g],S[g+1]),_=i.pop();l.push([_,_+E.length-1]),e.splice(_,2,E)}for(l.reverse(),g=-1;++g<l.length;)u[m+l[g][0]]=m+l[g][1],m+=l[g][1]-l[g][0]-1;return u}const Wp={resolve:Yp,tokenize:Kp},qp={partial:!0,tokenize:Xp};function Yp(e){return Fu(e),e}function Kp(e,t){let n;return r;function r(s){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),a(s)}function a(s){return s===null?i(s):G(s)?e.check(qp,o,i)(s):(e.consume(s),a)}function i(s){return e.exit("chunkContent"),e.exit("content"),t(s)}function o(s){return e.consume(s),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,a}}function Xp(e,t,n){const r=this;return a;function a(o){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),ee(e,i,"linePrefix")}function i(o){if(o===null||G(o))return n(o);const s=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&s&&s[1].type==="linePrefix"&&s[2].sliceSerialize(s[1],!0).length>=4?t(o):e.interrupt(r.parser.constructs.flow,n,t)(o)}}function Uu(e,t,n,r,a,i,o,s,l){const u=l||Number.POSITIVE_INFINITY;let c=0;return d;function d(E){return E===60?(e.enter(r),e.enter(a),e.enter(i),e.consume(E),e.exit(i),g):E===null||E===32||E===41||Ut(E)?n(E):(e.enter(r),e.enter(o),e.enter(s),e.enter("chunkString",{contentType:"string"}),w(E))}function g(E){return E===62?(e.enter(i),e.consume(E),e.exit(i),e.exit(a),e.exit(r),t):(e.enter(s),e.enter("chunkString",{contentType:"string"}),p(E))}function p(E){return E===62?(e.exit("chunkString"),e.exit(s),g(E)):E===null||E===60||G(E)?n(E):(e.consume(E),E===92?m:p)}function m(E){return E===60||E===62||E===92?(e.consume(E),p):p(E)}function w(E){return!c&&(E===null||E===41||re(E))?(e.exit("chunkString"),e.exit(s),e.exit(o),e.exit(r),t(E)):c<u&&E===40?(e.consume(E),c++,w):E===41?(e.consume(E),c--,w):E===null||E===32||E===40||Ut(E)?n(E):(e.consume(E),E===92?S:w)}function S(E){return E===40||E===41||E===92?(e.consume(E),w):w(E)}}function Bu(e,t,n,r,a,i){const o=this;let s=0,l;return u;function u(p){return e.enter(r),e.enter(a),e.consume(p),e.exit(a),e.enter(i),c}function c(p){return s>999||p===null||p===91||p===93&&!l||p===94&&!s&&"_hiddenFootnoteSupport"in o.parser.constructs?n(p):p===93?(e.exit(i),e.enter(a),e.consume(p),e.exit(a),e.exit(r),t):G(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),c):(e.enter("chunkString",{contentType:"string"}),d(p))}function d(p){return p===null||p===91||p===93||G(p)||s++>999?(e.exit("chunkString"),c(p)):(e.consume(p),l||(l=!K(p)),p===92?g:d)}function g(p){return p===91||p===92||p===93?(e.consume(p),s++,d):d(p)}}function Pu(e,t,n,r,a,i){let o;return s;function s(g){return g===34||g===39||g===40?(e.enter(r),e.enter(a),e.consume(g),e.exit(a),o=g===40?41:g,l):n(g)}function l(g){return g===o?(e.enter(a),e.consume(g),e.exit(a),e.exit(r),t):(e.enter(i),u(g))}function u(g){return g===o?(e.exit(i),l(o)):g===null?n(g):G(g)?(e.enter("lineEnding"),e.consume(g),e.exit("lineEnding"),ee(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),c(g))}function c(g){return g===o||g===null||G(g)?(e.exit("chunkString"),u(g)):(e.consume(g),g===92?d:c)}function d(g){return g===o||g===92?(e.consume(g),c):c(g)}}function ct(e,t){let n;return r;function r(a){return G(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),n=!0,r):K(a)?ee(e,r,n?"linePrefix":"lineSuffix")(a):t(a)}}const Zp={name:"definition",tokenize:Jp},Qp={partial:!0,tokenize:eg};function Jp(e,t,n){const r=this;let a;return i;function i(p){return e.enter("definition"),o(p)}function o(p){return Bu.call(r,e,s,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function s(p){return a=_e(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),p===58?(e.enter("definitionMarker"),e.consume(p),e.exit("definitionMarker"),l):n(p)}function l(p){return re(p)?ct(e,u)(p):u(p)}function u(p){return Uu(e,c,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function c(p){return e.attempt(Qp,d,d)(p)}function d(p){return K(p)?ee(e,g,"whitespace")(p):g(p)}function g(p){return p===null||G(p)?(e.exit("definition"),r.parser.defined.push(a),t(p)):n(p)}}function eg(e,t,n){return r;function r(s){return re(s)?ct(e,a)(s):n(s)}function a(s){return Pu(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(s)}function i(s){return K(s)?ee(e,o,"whitespace")(s):o(s)}function o(s){return s===null||G(s)?t(s):n(s)}}const tg={name:"hardBreakEscape",tokenize:ng};function ng(e,t,n){return r;function r(i){return e.enter("hardBreakEscape"),e.consume(i),a}function a(i){return G(i)?(e.exit("hardBreakEscape"),t(i)):n(i)}}const rg={name:"headingAtx",resolve:ag,tokenize:ig};function ag(e,t){let n=e.length-2,r=3,a,i;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(a={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},i={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},we(e,r,n-r+1,[["enter",a,t],["enter",i,t],["exit",i,t],["exit",a,t]])),e}function ig(e,t,n){let r=0;return a;function a(c){return e.enter("atxHeading"),i(c)}function i(c){return e.enter("atxHeadingSequence"),o(c)}function o(c){return c===35&&r++<6?(e.consume(c),o):c===null||re(c)?(e.exit("atxHeadingSequence"),s(c)):n(c)}function s(c){return c===35?(e.enter("atxHeadingSequence"),l(c)):c===null||G(c)?(e.exit("atxHeading"),t(c)):K(c)?ee(e,s,"whitespace")(c):(e.enter("atxHeadingText"),u(c))}function l(c){return c===35?(e.consume(c),l):(e.exit("atxHeadingSequence"),s(c))}function u(c){return c===null||c===35||re(c)?(e.exit("atxHeadingText"),s(c)):(e.consume(c),u)}}const og=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],Cl=["pre","script","style","textarea"],sg={concrete:!0,name:"htmlFlow",resolveTo:cg,tokenize:dg},lg={partial:!0,tokenize:gg},ug={partial:!0,tokenize:pg};function cg(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function dg(e,t,n){const r=this;let a,i,o,s,l;return u;function u(b){return c(b)}function c(b){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(b),d}function d(b){return b===33?(e.consume(b),g):b===47?(e.consume(b),i=!0,w):b===63?(e.consume(b),a=3,r.interrupt?t:h):me(b)?(e.consume(b),o=String.fromCharCode(b),S):n(b)}function g(b){return b===45?(e.consume(b),a=2,p):b===91?(e.consume(b),a=5,s=0,m):me(b)?(e.consume(b),a=4,r.interrupt?t:h):n(b)}function p(b){return b===45?(e.consume(b),r.interrupt?t:h):n(b)}function m(b){const Y="CDATA[";return b===Y.charCodeAt(s++)?(e.consume(b),s===Y.length?r.interrupt?t:O:m):n(b)}function w(b){return me(b)?(e.consume(b),o=String.fromCharCode(b),S):n(b)}function S(b){if(b===null||b===47||b===62||re(b)){const Y=b===47,J=o.toLowerCase();return!Y&&!i&&Cl.includes(J)?(a=1,r.interrupt?t(b):O(b)):og.includes(o.toLowerCase())?(a=6,Y?(e.consume(b),E):r.interrupt?t(b):O(b)):(a=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(b):i?_(b):k(b))}return b===45||ce(b)?(e.consume(b),o+=String.fromCharCode(b),S):n(b)}function E(b){return b===62?(e.consume(b),r.interrupt?t:O):n(b)}function _(b){return K(b)?(e.consume(b),_):T(b)}function k(b){return b===47?(e.consume(b),T):b===58||b===95||me(b)?(e.consume(b),I):K(b)?(e.consume(b),k):T(b)}function I(b){return b===45||b===46||b===58||b===95||ce(b)?(e.consume(b),I):N(b)}function N(b){return b===61?(e.consume(b),A):K(b)?(e.consume(b),N):k(b)}function A(b){return b===null||b===60||b===61||b===62||b===96?n(b):b===34||b===39?(e.consume(b),l=b,x):K(b)?(e.consume(b),A):M(b)}function x(b){return b===l?(e.consume(b),l=null,$):b===null||G(b)?n(b):(e.consume(b),x)}function M(b){return b===null||b===34||b===39||b===47||b===60||b===61||b===62||b===96||re(b)?N(b):(e.consume(b),M)}function $(b){return b===47||b===62||K(b)?k(b):n(b)}function T(b){return b===62?(e.consume(b),v):n(b)}function v(b){return b===null||G(b)?O(b):K(b)?(e.consume(b),v):n(b)}function O(b){return b===45&&a===2?(e.consume(b),H):b===60&&a===1?(e.consume(b),W):b===62&&a===4?(e.consume(b),j):b===63&&a===3?(e.consume(b),h):b===93&&a===5?(e.consume(b),z):G(b)&&(a===6||a===7)?(e.exit("htmlFlowData"),e.check(lg,P,D)(b)):b===null||G(b)?(e.exit("htmlFlowData"),D(b)):(e.consume(b),O)}function D(b){return e.check(ug,F,P)(b)}function F(b){return e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),L}function L(b){return b===null||G(b)?D(b):(e.enter("htmlFlowData"),O(b))}function H(b){return b===45?(e.consume(b),h):O(b)}function W(b){return b===47?(e.consume(b),o="",te):O(b)}function te(b){if(b===62){const Y=o.toLowerCase();return Cl.includes(Y)?(e.consume(b),j):O(b)}return me(b)&&o.length<8?(e.consume(b),o+=String.fromCharCode(b),te):O(b)}function z(b){return b===93?(e.consume(b),h):O(b)}function h(b){return b===62?(e.consume(b),j):b===45&&a===2?(e.consume(b),h):O(b)}function j(b){return b===null||G(b)?(e.exit("htmlFlowData"),P(b)):(e.consume(b),j)}function P(b){return e.exit("htmlFlow"),t(b)}}function pg(e,t,n){const r=this;return a;function a(o){return G(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i):n(o)}function i(o){return r.parser.lazy[r.now().line]?n(o):t(o)}}function gg(e,t,n){return r;function r(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),e.attempt(yt,t,n)}}const fg={name:"htmlText",tokenize:mg};function mg(e,t,n){const r=this;let a,i,o;return s;function s(h){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(h),l}function l(h){return h===33?(e.consume(h),u):h===47?(e.consume(h),N):h===63?(e.consume(h),k):me(h)?(e.consume(h),M):n(h)}function u(h){return h===45?(e.consume(h),c):h===91?(e.consume(h),i=0,m):me(h)?(e.consume(h),_):n(h)}function c(h){return h===45?(e.consume(h),p):n(h)}function d(h){return h===null?n(h):h===45?(e.consume(h),g):G(h)?(o=d,W(h)):(e.consume(h),d)}function g(h){return h===45?(e.consume(h),p):d(h)}function p(h){return h===62?H(h):h===45?g(h):d(h)}function m(h){const j="CDATA[";return h===j.charCodeAt(i++)?(e.consume(h),i===j.length?w:m):n(h)}function w(h){return h===null?n(h):h===93?(e.consume(h),S):G(h)?(o=w,W(h)):(e.consume(h),w)}function S(h){return h===93?(e.consume(h),E):w(h)}function E(h){return h===62?H(h):h===93?(e.consume(h),E):w(h)}function _(h){return h===null||h===62?H(h):G(h)?(o=_,W(h)):(e.consume(h),_)}function k(h){return h===null?n(h):h===63?(e.consume(h),I):G(h)?(o=k,W(h)):(e.consume(h),k)}function I(h){return h===62?H(h):k(h)}function N(h){return me(h)?(e.consume(h),A):n(h)}function A(h){return h===45||ce(h)?(e.consume(h),A):x(h)}function x(h){return G(h)?(o=x,W(h)):K(h)?(e.consume(h),x):H(h)}function M(h){return h===45||ce(h)?(e.consume(h),M):h===47||h===62||re(h)?$(h):n(h)}function $(h){return h===47?(e.consume(h),H):h===58||h===95||me(h)?(e.consume(h),T):G(h)?(o=$,W(h)):K(h)?(e.consume(h),$):H(h)}function T(h){return h===45||h===46||h===58||h===95||ce(h)?(e.consume(h),T):v(h)}function v(h){return h===61?(e.consume(h),O):G(h)?(o=v,W(h)):K(h)?(e.consume(h),v):$(h)}function O(h){return h===null||h===60||h===61||h===62||h===96?n(h):h===34||h===39?(e.consume(h),a=h,D):G(h)?(o=O,W(h)):K(h)?(e.consume(h),O):(e.consume(h),F)}function D(h){return h===a?(e.consume(h),a=void 0,L):h===null?n(h):G(h)?(o=D,W(h)):(e.consume(h),D)}function F(h){return h===null||h===34||h===39||h===60||h===61||h===96?n(h):h===47||h===62||re(h)?$(h):(e.consume(h),F)}function L(h){return h===47||h===62||re(h)?$(h):n(h)}function H(h){return h===62?(e.consume(h),e.exit("htmlTextData"),e.exit("htmlText"),t):n(h)}function W(h){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),te}function te(h){return K(h)?ee(e,z,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(h):z(h)}function z(h){return e.enter("htmlTextData"),o(h)}}const Kn={name:"labelEnd",resolveAll:yg,resolveTo:Sg,tokenize:wg},bg={tokenize:kg},hg={tokenize:Tg},Eg={tokenize:Ag};function yg(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const a=r.type==="labelImage"?4:2;r.type="data",t+=a}}return e.length!==n.length&&we(e,0,e.length,n),e}function Sg(e,t){let n=e.length,r=0,a,i,o,s;for(;n--;)if(a=e[n][1],i){if(a.type==="link"||a.type==="labelLink"&&a._inactive)break;e[n][0]==="enter"&&a.type==="labelLink"&&(a._inactive=!0)}else if(o){if(e[n][0]==="enter"&&(a.type==="labelImage"||a.type==="labelLink")&&!a._balanced&&(i=n,a.type!=="labelLink")){r=2;break}}else a.type==="labelEnd"&&(o=n);const l={type:e[i][1].type==="labelLink"?"link":"image",start:{...e[i][1].start},end:{...e[e.length-1][1].end}},u={type:"label",start:{...e[i][1].start},end:{...e[o][1].end}},c={type:"labelText",start:{...e[i+r+2][1].end},end:{...e[o-2][1].start}};return s=[["enter",l,t],["enter",u,t]],s=Te(s,e.slice(i+1,i+r+3)),s=Te(s,[["enter",c,t]]),s=Te(s,jt(t.parser.constructs.insideSpan.null,e.slice(i+r+4,o-3),t)),s=Te(s,[["exit",c,t],e[o-2],e[o-1],["exit",u,t]]),s=Te(s,e.slice(o+1)),s=Te(s,[["exit",l,t]]),we(e,i,e.length,s),e}function wg(e,t,n){const r=this;let a=r.events.length,i,o;for(;a--;)if((r.events[a][1].type==="labelImage"||r.events[a][1].type==="labelLink")&&!r.events[a][1]._balanced){i=r.events[a][1];break}return s;function s(g){return i?i._inactive?d(g):(o=r.parser.defined.includes(_e(r.sliceSerialize({start:i.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(g),e.exit("labelMarker"),e.exit("labelEnd"),l):n(g)}function l(g){return g===40?e.attempt(bg,c,o?c:d)(g):g===91?e.attempt(hg,c,o?u:d)(g):o?c(g):d(g)}function u(g){return e.attempt(Eg,c,d)(g)}function c(g){return t(g)}function d(g){return i._balanced=!0,n(g)}}function kg(e,t,n){return r;function r(d){return e.enter("resource"),e.enter("resourceMarker"),e.consume(d),e.exit("resourceMarker"),a}function a(d){return re(d)?ct(e,i)(d):i(d)}function i(d){return d===41?c(d):Uu(e,o,s,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(d)}function o(d){return re(d)?ct(e,l)(d):c(d)}function s(d){return n(d)}function l(d){return d===34||d===39||d===40?Pu(e,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(d):c(d)}function u(d){return re(d)?ct(e,c)(d):c(d)}function c(d){return d===41?(e.enter("resourceMarker"),e.consume(d),e.exit("resourceMarker"),e.exit("resource"),t):n(d)}}function Tg(e,t,n){const r=this;return a;function a(s){return Bu.call(r,e,i,o,"reference","referenceMarker","referenceString")(s)}function i(s){return r.parser.defined.includes(_e(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(s):n(s)}function o(s){return n(s)}}function Ag(e,t,n){return r;function r(i){return e.enter("reference"),e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),a}function a(i){return i===93?(e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),e.exit("reference"),t):n(i)}}const _g={name:"labelStartImage",resolveAll:Kn.resolveAll,tokenize:Ig};function Ig(e,t,n){const r=this;return a;function a(s){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(s),e.exit("labelImageMarker"),i}function i(s){return s===91?(e.enter("labelMarker"),e.consume(s),e.exit("labelMarker"),e.exit("labelImage"),o):n(s)}function o(s){return s===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(s):t(s)}}const Ng={name:"labelStartLink",resolveAll:Kn.resolveAll,tokenize:Rg};function Rg(e,t,n){const r=this;return a;function a(o){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(o),e.exit("labelMarker"),e.exit("labelLink"),i}function i(o){return o===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(o):t(o)}}const sn={name:"lineEnding",tokenize:xg};function xg(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),ee(e,t,"linePrefix")}}const Lt={name:"thematicBreak",tokenize:vg};function vg(e,t,n){let r=0,a;return i;function i(u){return e.enter("thematicBreak"),o(u)}function o(u){return a=u,s(u)}function s(u){return u===a?(e.enter("thematicBreakSequence"),l(u)):r>=3&&(u===null||G(u))?(e.exit("thematicBreak"),t(u)):n(u)}function l(u){return u===a?(e.consume(u),r++,l):(e.exit("thematicBreakSequence"),K(u)?ee(e,s,"whitespace")(u):s(u))}}const be={continuation:{tokenize:Dg},exit:Fg,name:"list",tokenize:Lg},Cg={partial:!0,tokenize:Ug},Og={partial:!0,tokenize:Mg};function Lg(e,t,n){const r=this,a=r.events[r.events.length-1];let i=a&&a[1].type==="linePrefix"?a[2].sliceSerialize(a[1],!0).length:0,o=0;return s;function s(p){const m=r.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(m==="listUnordered"?!r.containerState.marker||p===r.containerState.marker:Rn(p)){if(r.containerState.type||(r.containerState.type=m,e.enter(m,{_container:!0})),m==="listUnordered")return e.enter("listItemPrefix"),p===42||p===45?e.check(Lt,n,u)(p):u(p);if(!r.interrupt||p===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),l(p)}return n(p)}function l(p){return Rn(p)&&++o<10?(e.consume(p),l):(!r.interrupt||o<2)&&(r.containerState.marker?p===r.containerState.marker:p===41||p===46)?(e.exit("listItemValue"),u(p)):n(p)}function u(p){return e.enter("listItemMarker"),e.consume(p),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||p,e.check(yt,r.interrupt?n:c,e.attempt(Cg,g,d))}function c(p){return r.containerState.initialBlankLine=!0,i++,g(p)}function d(p){return K(p)?(e.enter("listItemPrefixWhitespace"),e.consume(p),e.exit("listItemPrefixWhitespace"),g):n(p)}function g(p){return r.containerState.size=i+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(p)}}function Dg(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(yt,a,i);function a(s){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,ee(e,t,"listItemIndent",r.containerState.size+1)(s)}function i(s){return r.containerState.furtherBlankLines||!K(s)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(s)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(Og,t,o)(s))}function o(s){return r.containerState._closeFlow=!0,r.interrupt=void 0,ee(e,e.attempt(be,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s)}}function Mg(e,t,n){const r=this;return ee(e,a,"listItemIndent",r.containerState.size+1);function a(i){const o=r.events[r.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===r.containerState.size?t(i):n(i)}}function Fg(e){e.exit(this.containerState.type)}function Ug(e,t,n){const r=this;return ee(e,a,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function a(i){const o=r.events[r.events.length-1];return!K(i)&&o&&o[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}const Ol={name:"setextUnderline",resolveTo:Bg,tokenize:Pg};function Bg(e,t){let n=e.length,r,a,i;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(a=n)}else e[n][1].type==="content"&&e.splice(n,1),!i&&e[n][1].type==="definition"&&(i=n);const o={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[a][1].type="setextHeadingText",i?(e.splice(a,0,["enter",o,t]),e.splice(i+1,0,["exit",e[r][1],t]),e[r][1].end={...e[i][1].end}):e[r][1]=o,e.push(["exit",o,t]),e}function Pg(e,t,n){const r=this;let a;return i;function i(u){let c=r.events.length,d;for(;c--;)if(r.events[c][1].type!=="lineEnding"&&r.events[c][1].type!=="linePrefix"&&r.events[c][1].type!=="content"){d=r.events[c][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||d)?(e.enter("setextHeadingLine"),a=u,o(u)):n(u)}function o(u){return e.enter("setextHeadingLineSequence"),s(u)}function s(u){return u===a?(e.consume(u),s):(e.exit("setextHeadingLineSequence"),K(u)?ee(e,l,"lineSuffix")(u):l(u))}function l(u){return u===null||G(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const $g={tokenize:zg};function zg(e){const t=this,n=e.attempt(yt,r,e.attempt(this.parser.constructs.flowInitial,a,ee(e,e.attempt(this.parser.constructs.flow,a,e.attempt(Wp,a)),"linePrefix")));return n;function r(i){if(i===null){e.consume(i);return}return e.enter("lineEndingBlank"),e.consume(i),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function a(i){if(i===null){e.consume(i);return}return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const Gg={resolveAll:zu()},jg=$u("string"),Hg=$u("text");function $u(e){return{resolveAll:zu(e==="text"?Vg:void 0),tokenize:t};function t(n){const r=this,a=this.parser.constructs[e],i=n.attempt(a,o,s);return o;function o(c){return u(c)?i(c):s(c)}function s(c){if(c===null){n.consume(c);return}return n.enter("data"),n.consume(c),l}function l(c){return u(c)?(n.exit("data"),i(c)):(n.consume(c),l)}function u(c){if(c===null)return!0;const d=a[c];let g=-1;if(d)for(;++g<d.length;){const p=d[g];if(!p.previous||p.previous.call(r,r.previous))return!0}return!1}}}function zu(e){return t;function t(n,r){let a=-1,i;for(;++a<=n.length;)i===void 0?n[a]&&n[a][1].type==="data"&&(i=a,a++):(!n[a]||n[a][1].type!=="data")&&(a!==i+2&&(n[i][1].end=n[a-1][1].end,n.splice(i+2,a-i-2),a=i+2),i=void 0);return e?e(n,r):n}}function Vg(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],a=t.sliceStream(r);let i=a.length,o=-1,s=0,l;for(;i--;){const u=a[i];if(typeof u=="string"){for(o=u.length;u.charCodeAt(o-1)===32;)s++,o--;if(o)break;o=-1}else if(u===-2)l=!0,s++;else if(u!==-1){i++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(s=0),s){const u={type:n===e.length||l||s<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:i?o:r.start._bufferIndex+o,_index:r.start._index+i,line:r.end.line,column:r.end.column-s,offset:r.end.offset-s},end:{...r.end}};r.end={...u.start},r.start.offset===r.end.offset?Object.assign(r,u):(e.splice(n,0,["enter",u,t],["exit",u,t]),n+=2)}n++}return e}const Wg={42:be,43:be,45:be,48:be,49:be,50:be,51:be,52:be,53:be,54:be,55:be,56:be,57:be,62:Lu},qg={91:Zp},Yg={[-2]:on,[-1]:on,32:on},Kg={35:rg,42:Lt,45:[Ol,Lt],60:sg,61:Ol,95:Lt,96:vl,126:vl},Xg={38:Mu,92:Du},Zg={[-5]:sn,[-4]:sn,[-3]:sn,33:_g,38:Mu,42:xn,60:[Np,fg],91:Ng,92:[tg,Du],93:Kn,95:xn,96:$p},Qg={null:[xn,Gg]},Jg={null:[42,95]},ef={null:[]},tf=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:Jg,contentInitial:qg,disable:ef,document:Wg,flow:Kg,flowInitial:Yg,insideSpan:Qg,string:Xg,text:Zg},Symbol.toStringTag,{value:"Module"}));function nf(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const a={},i=[];let o=[],s=[];const l={attempt:x(N),check:x(A),consume:_,enter:k,exit:I,interrupt:x(A,{interrupt:!0})},u={code:null,containerState:{},defineSkip:w,events:[],now:m,parser:e,previous:null,sliceSerialize:g,sliceStream:p,write:d};let c=t.tokenize.call(u,l);return t.resolveAll&&i.push(t),u;function d(v){return o=Te(o,v),S(),o[o.length-1]!==null?[]:(M(t,0),u.events=jt(i,u.events,u),u.events)}function g(v,O){return af(p(v),O)}function p(v){return rf(o,v)}function m(){const{_bufferIndex:v,_index:O,line:D,column:F,offset:L}=r;return{_bufferIndex:v,_index:O,line:D,column:F,offset:L}}function w(v){a[v.line]=v.column,T()}function S(){let v;for(;r._index<o.length;){const O=o[r._index];if(typeof O=="string")for(v=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===v&&r._bufferIndex<O.length;)E(O.charCodeAt(r._bufferIndex));else E(O)}}function E(v){c=c(v)}function _(v){G(v)?(r.line++,r.column=1,r.offset+=v===-3?2:1,T()):v!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),u.previous=v}function k(v,O){const D=O||{};return D.type=v,D.start=m(),u.events.push(["enter",D,u]),s.push(D),D}function I(v){const O=s.pop();return O.end=m(),u.events.push(["exit",O,u]),O}function N(v,O){M(v,O.from)}function A(v,O){O.restore()}function x(v,O){return D;function D(F,L,H){let W,te,z,h;return Array.isArray(F)?P(F):"tokenize"in F?P([F]):j(F);function j(Z){return ie;function ie(oe){const Ee=oe!==null&&Z[oe],ke=oe!==null&&Z.null,ze=[...Array.isArray(Ee)?Ee:Ee?[Ee]:[],...Array.isArray(ke)?ke:ke?[ke]:[]];return P(ze)(oe)}}function P(Z){return W=Z,te=0,Z.length===0?H:b(Z[te])}function b(Z){return ie;function ie(oe){return h=$(),z=Z,Z.partial||(u.currentConstruct=Z),Z.name&&u.parser.constructs.disable.null.includes(Z.name)?J():Z.tokenize.call(O?Object.assign(Object.create(u),O):u,l,Y,J)(oe)}}function Y(Z){return v(z,h),L}function J(Z){return h.restore(),++te<W.length?b(W[te]):H}}}function M(v,O){v.resolveAll&&!i.includes(v)&&i.push(v),v.resolve&&we(u.events,O,u.events.length-O,v.resolve(u.events.slice(O),u)),v.resolveTo&&(u.events=v.resolveTo(u.events,u))}function $(){const v=m(),O=u.previous,D=u.currentConstruct,F=u.events.length,L=Array.from(s);return{from:F,restore:H};function H(){r=v,u.previous=O,u.currentConstruct=D,u.events.length=F,s=L,T()}}function T(){r.line in a&&r.column<2&&(r.column=a[r.line],r.offset+=a[r.line]-1)}}function rf(e,t){const n=t.start._index,r=t.start._bufferIndex,a=t.end._index,i=t.end._bufferIndex;let o;if(n===a)o=[e[n].slice(r,i)];else{if(o=e.slice(n,a),r>-1){const s=o[0];typeof s=="string"?o[0]=s.slice(r):o.shift()}i>0&&o.push(e[a].slice(0,i))}return o}function af(e,t){let n=-1;const r=[];let a;for(;++n<e.length;){const i=e[n];let o;if(typeof i=="string")o=i;else switch(i){case-5:{o="\r";break}case-4:{o=`
3
3
  `;break}case-3:{o=`\r
4
4
  `;break}case-2:{o=t?" ":" ";break}case-1:{if(!t&&a)continue;o=" ";break}default:o=String.fromCharCode(i)}a=i===-2,r.push(o)}return r.join("")}function of(e){const r={constructs:Cu([tf,...(e||{}).extensions||[]]),content:a(Sp),defined:[],document:a(kp),flow:a($g),lazy:{},string:a(jg),text:a(Hg)};return r;function a(i){return o;function o(s){return nf(r,i,s)}}}function sf(e){for(;!Fu(e););return e}const Ll=/[\0\t\n\r]/g;function lf(){let e=1,t="",n=!0,r;return a;function a(i,o,s){const l=[];let u,c,d,g,p;for(i=t+(typeof i=="string"?i.toString():new TextDecoder(o||void 0).decode(i)),d=0,t="",n&&(i.charCodeAt(0)===65279&&d++,n=void 0);d<i.length;){if(Ll.lastIndex=d,u=Ll.exec(i),g=u&&u.index!==void 0?u.index:i.length,p=i.charCodeAt(g),!u){t=i.slice(d);break}if(p===10&&d===g&&r)l.push(-3),r=void 0;else switch(r&&(l.push(-5),r=void 0),d<g&&(l.push(i.slice(d,g)),e+=g-d),p){case 0:{l.push(65533),e++;break}case 9:{for(c=Math.ceil(e/4)*4,l.push(-2);e++<c;)l.push(-1);break}case 10:{l.push(-4),e=1;break}default:r=!0,e=1}d=g+1}return s&&(r&&l.push(-5),t&&l.push(t),l.push(null)),l}}const uf=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function cf(e){return e.replace(uf,df)}function df(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const a=n.charCodeAt(1),i=a===120||a===88;return Ou(n.slice(i?2:1),i?16:10)}return mt(n)||e}const Gu={}.hasOwnProperty;function pf(e,t,n){return typeof t!="string"&&(n=t,t=void 0),gf(n)(sf(of(n).document().write(lf()(e,t,!0))))}function gf(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(ul),autolinkProtocol:$,autolinkEmail:$,atxHeading:i(ol),blockQuote:i(ke),characterEscape:$,characterReference:$,codeFenced:i(ze),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:i(ze,o),codeText:i(Lc,o),codeTextData:$,data:$,codeFlowValue:$,definition:i(Dc),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:i(Mc),hardBreakEscape:i(sl),hardBreakTrailing:i(sl),htmlFlow:i(ll,o),htmlFlowData:$,htmlText:i(ll,o),htmlTextData:$,image:i(Fc),label:o,link:i(ul),listItem:i(Uc),listItemValue:g,listOrdered:i(cl,d),listUnordered:i(cl),paragraph:i(Bc),reference:b,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:i(ol),strong:i(Pc),thematicBreak:i(zc)},exit:{atxHeading:l(),atxHeadingSequence:N,autolink:l(),autolinkEmail:Ee,autolinkProtocol:oe,blockQuote:l(),characterEscapeValue:T,characterReferenceMarkerHexadecimal:J,characterReferenceMarkerNumeric:J,characterReferenceValue:Z,characterReference:ie,codeFenced:l(S),codeFencedFence:w,codeFencedFenceInfo:p,codeFencedFenceMeta:m,codeFlowValue:T,codeIndented:l(E),codeText:l(L),codeTextData:T,data:T,definition:l(),definitionDestinationString:I,definitionLabelString:_,definitionTitleString:k,emphasis:l(),hardBreakEscape:l(O),hardBreakTrailing:l(O),htmlFlow:l(D),htmlFlowData:T,htmlText:l(F),htmlTextData:T,image:l(W),label:z,labelText:te,lineEnding:v,link:l(H),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:Y,resourceDestinationString:h,resourceTitleString:j,resource:P,setextHeading:l(M),setextHeadingLineSequence:x,setextHeadingText:A,strong:l(),thematicBreak:l()}};ju(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(R){let B={type:"root",children:[]};const V={stack:[B],tokenStack:[],config:t,enter:s,exit:u,buffer:o,resume:c,data:n},Q=[];let ne=-1;for(;++ne<R.length;)if(R[ne][1].type==="listOrdered"||R[ne][1].type==="listUnordered")if(R[ne][0]==="enter")Q.push(ne);else{const Ae=Q.pop();ne=a(R,Ae,ne)}for(ne=-1;++ne<R.length;){const Ae=t[R[ne][0]];Gu.call(Ae,R[ne][1].type)&&Ae[R[ne][1].type].call(Object.assign({sliceSerialize:R[ne][2].sliceSerialize},V),R[ne][1])}if(V.tokenStack.length>0){const Ae=V.tokenStack[V.tokenStack.length-1];(Ae[1]||Dl).call(V,void 0,Ae[0])}for(B.position={start:Le(R.length>0?R[0][1].start:{line:1,column:1,offset:0}),end:Le(R.length>0?R[R.length-2][1].end:{line:1,column:1,offset:0})},ne=-1;++ne<t.transforms.length;)B=t.transforms[ne](B)||B;return B}function a(R,B,V){let Q=B-1,ne=-1,Ae=!1,Fe,xe,rt,at;for(;++Q<=V;){const ye=R[Q];switch(ye[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{ye[0]==="enter"?ne++:ne--,at=void 0;break}case"lineEndingBlank":{ye[0]==="enter"&&(Fe&&!at&&!ne&&!rt&&(rt=Q),at=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:at=void 0}if(!ne&&ye[0]==="enter"&&ye[1].type==="listItemPrefix"||ne===-1&&ye[0]==="exit"&&(ye[1].type==="listUnordered"||ye[1].type==="listOrdered")){if(Fe){let Ge=Q;for(xe=void 0;Ge--;){const ve=R[Ge];if(ve[1].type==="lineEnding"||ve[1].type==="lineEndingBlank"){if(ve[0]==="exit")continue;xe&&(R[xe][1].type="lineEndingBlank",Ae=!0),ve[1].type="lineEnding",xe=Ge}else if(!(ve[1].type==="linePrefix"||ve[1].type==="blockQuotePrefix"||ve[1].type==="blockQuotePrefixWhitespace"||ve[1].type==="blockQuoteMarker"||ve[1].type==="listItemIndent"))break}rt&&(!xe||rt<xe)&&(Fe._spread=!0),Fe.end=Object.assign({},xe?R[xe][1].start:ye[1].end),R.splice(xe||Q,0,["exit",Fe,ye[2]]),Q++,V++}if(ye[1].type==="listItemPrefix"){const Ge={type:"listItem",_spread:!1,start:Object.assign({},ye[1].start),end:void 0};Fe=Ge,R.splice(Q,0,["enter",Ge,ye[2]]),Q++,V++,rt=void 0,at=!0}}}return R[B][1]._spread=Ae,V}function i(R,B){return V;function V(Q){s.call(this,R(Q),Q),B&&B.call(this,Q)}}function o(){this.stack.push({type:"fragment",children:[]})}function s(R,B,V){this.stack[this.stack.length-1].children.push(R),this.stack.push(R),this.tokenStack.push([B,V||void 0]),R.position={start:Le(B.start),end:void 0}}function l(R){return B;function B(V){R&&R.call(this,V),u.call(this,V)}}function u(R,B){const V=this.stack.pop(),Q=this.tokenStack.pop();if(Q)Q[0].type!==R.type&&(B?B.call(this,R,Q[0]):(Q[1]||Dl).call(this,R,Q[0]));else throw new Error("Cannot close `"+R.type+"` ("+ut({start:R.start,end:R.end})+"): it’s not open");V.position.end=Le(R.end)}function c(){return Yn(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function g(R){if(this.data.expectingFirstListItemValue){const B=this.stack[this.stack.length-2];B.start=Number.parseInt(this.sliceSerialize(R),10),this.data.expectingFirstListItemValue=void 0}}function p(){const R=this.resume(),B=this.stack[this.stack.length-1];B.lang=R}function m(){const R=this.resume(),B=this.stack[this.stack.length-1];B.meta=R}function w(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function S(){const R=this.resume(),B=this.stack[this.stack.length-1];B.value=R.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function E(){const R=this.resume(),B=this.stack[this.stack.length-1];B.value=R.replace(/(\r?\n|\r)$/g,"")}function _(R){const B=this.resume(),V=this.stack[this.stack.length-1];V.label=B,V.identifier=_e(this.sliceSerialize(R)).toLowerCase()}function k(){const R=this.resume(),B=this.stack[this.stack.length-1];B.title=R}function I(){const R=this.resume(),B=this.stack[this.stack.length-1];B.url=R}function N(R){const B=this.stack[this.stack.length-1];if(!B.depth){const V=this.sliceSerialize(R).length;B.depth=V}}function A(){this.data.setextHeadingSlurpLineEnding=!0}function x(R){const B=this.stack[this.stack.length-1];B.depth=this.sliceSerialize(R).codePointAt(0)===61?1:2}function M(){this.data.setextHeadingSlurpLineEnding=void 0}function $(R){const V=this.stack[this.stack.length-1].children;let Q=V[V.length-1];(!Q||Q.type!=="text")&&(Q=$c(),Q.position={start:Le(R.start),end:void 0},V.push(Q)),this.stack.push(Q)}function T(R){const B=this.stack.pop();B.value+=this.sliceSerialize(R),B.position.end=Le(R.end)}function v(R){const B=this.stack[this.stack.length-1];if(this.data.atHardBreak){const V=B.children[B.children.length-1];V.position.end=Le(R.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(B.type)&&($.call(this,R),T.call(this,R))}function O(){this.data.atHardBreak=!0}function D(){const R=this.resume(),B=this.stack[this.stack.length-1];B.value=R}function F(){const R=this.resume(),B=this.stack[this.stack.length-1];B.value=R}function L(){const R=this.resume(),B=this.stack[this.stack.length-1];B.value=R}function H(){const R=this.stack[this.stack.length-1];if(this.data.inReference){const B=this.data.referenceType||"shortcut";R.type+="Reference",R.referenceType=B,delete R.url,delete R.title}else delete R.identifier,delete R.label;this.data.referenceType=void 0}function W(){const R=this.stack[this.stack.length-1];if(this.data.inReference){const B=this.data.referenceType||"shortcut";R.type+="Reference",R.referenceType=B,delete R.url,delete R.title}else delete R.identifier,delete R.label;this.data.referenceType=void 0}function te(R){const B=this.sliceSerialize(R),V=this.stack[this.stack.length-2];V.label=cf(B),V.identifier=_e(B).toLowerCase()}function z(){const R=this.stack[this.stack.length-1],B=this.resume(),V=this.stack[this.stack.length-1];if(this.data.inReference=!0,V.type==="link"){const Q=R.children;V.children=Q}else V.alt=B}function h(){const R=this.resume(),B=this.stack[this.stack.length-1];B.url=R}function j(){const R=this.resume(),B=this.stack[this.stack.length-1];B.title=R}function P(){this.data.inReference=void 0}function b(){this.data.referenceType="collapsed"}function Y(R){const B=this.resume(),V=this.stack[this.stack.length-1];V.label=B,V.identifier=_e(this.sliceSerialize(R)).toLowerCase(),this.data.referenceType="full"}function J(R){this.data.characterReferenceType=R.type}function Z(R){const B=this.sliceSerialize(R),V=this.data.characterReferenceType;let Q;V?(Q=Ou(B,V==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Q=mt(B);const ne=this.stack[this.stack.length-1];ne.value+=Q}function ie(R){const B=this.stack.pop();B.position.end=Le(R.end)}function oe(R){T.call(this,R);const B=this.stack[this.stack.length-1];B.url=this.sliceSerialize(R)}function Ee(R){T.call(this,R);const B=this.stack[this.stack.length-1];B.url="mailto:"+this.sliceSerialize(R)}function ke(){return{type:"blockquote",children:[]}}function ze(){return{type:"code",lang:null,meta:null,value:""}}function Lc(){return{type:"inlineCode",value:""}}function Dc(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Mc(){return{type:"emphasis",children:[]}}function ol(){return{type:"heading",depth:0,children:[]}}function sl(){return{type:"break"}}function ll(){return{type:"html",value:""}}function Fc(){return{type:"image",title:null,url:"",alt:null}}function ul(){return{type:"link",title:null,url:"",children:[]}}function cl(R){return{type:"list",ordered:R.type==="listOrdered",start:null,spread:R._spread,children:[]}}function Uc(R){return{type:"listItem",spread:R._spread,checked:null,children:[]}}function Bc(){return{type:"paragraph",children:[]}}function Pc(){return{type:"strong",children:[]}}function $c(){return{type:"text",value:""}}function zc(){return{type:"thematicBreak"}}}function Le(e){return{line:e.line,column:e.column,offset:e.offset}}function ju(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?ju(e,r):ff(e,r)}}function ff(e,t){let n;for(n in t)if(Gu.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function Dl(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+ut({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+ut({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+ut({start:t.start,end:t.end})+") is still open")}function mf(e){const t=this;t.parser=n;function n(r){return pf(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function bf(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function hf(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
@@ -14,4 +14,4 @@ Error generating stack: `+a.message+`
14
14
  ${K}px !important;
15
15
  ${G}px !important;
16
16
  }
17
- `),()=>{Z.contains(k)&&Z.removeChild(k)}},[l]),b.jsx(s2,{isPresent:l,childRef:p,sizeRef:g,pop:d,children:d===!1?i:U.cloneElement(i,{ref:x})})}const o2=({children:i,initial:l,isPresent:u,onExitComplete:o,custom:c,presenceAffectsLayout:d,mode:h,anchorX:p,anchorY:g,root:m})=>{const v=tf(r2),x=U.useId();let T=!0,N=U.useMemo(()=>(T=!1,{id:x,initial:l,isPresent:u,custom:c,onExitComplete:z=>{v.set(z,!0);for(const Y of v.values())if(!Y)return;o&&o()},register:z=>(v.set(z,!1),()=>v.delete(z))}),[u,v,o]);return d&&T&&(N={...N}),U.useMemo(()=>{v.forEach((z,Y)=>v.set(Y,!1))},[u]),U.useEffect(()=>{!u&&!v.size&&o&&o()},[u]),i=b.jsx(u2,{pop:h==="popLayout",isPresent:u,anchorX:p,anchorY:g,root:m,children:i}),b.jsx(Gu.Provider,{value:N,children:i})};function r2(){return new Map}function Cg(i=!0){const l=U.useContext(Gu);if(l===null)return[!0,null];const{isPresent:u,onExitComplete:o,register:c}=l,d=U.useId();U.useEffect(()=>{if(i)return c(d)},[i]);const h=U.useCallback(()=>i&&o&&o(d),[d,o,i]);return!u&&o?[!1,h]:[!0]}const Cu=i=>i.key||"";function Vy(i){const l=[];return U.Children.forEach(i,u=>{U.isValidElement(u)&&l.push(u)}),l}const c2=({children:i,custom:l,initial:u=!0,onExitComplete:o,presenceAffectsLayout:c=!0,mode:d="sync",propagate:h=!1,anchorX:p="left",anchorY:g="top",root:m})=>{const[v,x]=Cg(h),T=U.useMemo(()=>Vy(i),[i]),N=h&&!v?[]:T.map(Cu),z=U.useRef(!0),Y=U.useRef(T),X=tf(()=>new Map),q=U.useRef(new Set),[K,G]=U.useState(T),[k,Z]=U.useState(T);Iy(()=>{z.current=!1,Y.current=T;for(let F=0;F<k.length;F++){const lt=Cu(k[F]);N.includes(lt)?(X.delete(lt),q.current.delete(lt)):X.get(lt)!==!0&&X.set(lt,!1)}},[k,N.length,N.join("-")]);const it=[];if(T!==K){let F=[...T];for(let lt=0;lt<k.length;lt++){const xt=k[lt],At=Cu(xt);N.includes(At)||(F.splice(lt,0,xt),it.push(xt))}return d==="wait"&&it.length&&(F=it),Z(Vy(F)),G(T),null}const{forceRender:J}=U.useContext(Ic);return b.jsx(b.Fragment,{children:k.map(F=>{const lt=Cu(F),xt=h&&!v?!1:T===k||N.includes(lt),At=()=>{if(q.current.has(lt))return;if(q.current.add(lt),X.has(lt))X.set(lt,!0);else return;let Bt=!0;X.forEach(se=>{se||(Bt=!1)}),Bt&&(J?.(),Z(Y.current),h&&x?.(),o&&o())};return b.jsx(o2,{isPresent:xt,initial:!z.current||u?void 0:!1,custom:l,presenceAffectsLayout:c,mode:d,root:m,onExitComplete:xt?void 0:At,anchorX:p,anchorY:g,children:F},lt)})})},Mg=U.createContext({strict:!1}),_y={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]};let Uy=!1;function f2(){if(Uy)return;const i={};for(const l in _y)i[l]={isEnabled:u=>_y[l].some(o=>!!u[o])};eg(i),Uy=!0}function Dg(){return f2(),PS()}function h2(i){const l=Dg();for(const u in i)l[u]={...l[u],...i[u]};eg(l)}const d2=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","propagate","ignoreStrict","viewport"]);function qu(i){return i.startsWith("while")||i.startsWith("drag")&&i!=="draggable"||i.startsWith("layout")||i.startsWith("onTap")||i.startsWith("onPan")||i.startsWith("onLayout")||d2.has(i)}let wg=i=>!qu(i);function m2(i){typeof i=="function"&&(wg=l=>l.startsWith("on")?!qu(l):i(l))}try{m2(require("@emotion/is-prop-valid").default)}catch{}function p2(i,l,u){const o={};for(const c in i)c==="values"&&typeof i.values=="object"||(wg(c)||u===!0&&qu(c)||!l&&!qu(c)||i.draggable&&c.startsWith("onDrag"))&&(o[c]=i[c]);return o}const Qu=U.createContext({});function y2(i,l){if(Ku(i)){const{initial:u,animate:o}=i;return{initial:u===!1||Pl(u)?u:void 0,animate:Pl(o)?o:void 0}}return i.inherit!==!1?l:{}}function g2(i){const{initial:l,animate:u}=y2(i,U.useContext(Qu));return U.useMemo(()=>({initial:l,animate:u}),[By(l),By(u)])}function By(i){return Array.isArray(i)?i.join(" "):i}const Nf=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function Ng(i,l,u){for(const o in l)!de(l[o])&&!og(o,u)&&(i[o]=l[o])}function v2({transformTemplate:i},l){return U.useMemo(()=>{const u=Nf();return Mf(u,l,i),Object.assign({},u.vars,u.style)},[l])}function x2(i,l){const u=i.style||{},o={};return Ng(o,u,i),Object.assign(o,v2(i,l)),o}function b2(i,l){const u={},o=x2(i,l);return i.drag&&i.dragListener!==!1&&(u.draggable=!1,o.userSelect=o.WebkitUserSelect=o.WebkitTouchCallout="none",o.touchAction=i.drag===!0?"none":`pan-${i.drag==="x"?"y":"x"}`),i.tabIndex===void 0&&(i.onTap||i.onTapStart||i.whileTap)&&(u.tabIndex=0),u.style=o,u}const jg=()=>({...Nf(),attrs:{}});function S2(i,l,u,o){const c=U.useMemo(()=>{const d=jg();return rg(d,l,fg(o),i.transformTemplate,i.style),{...d.attrs,style:{...d.style}}},[l]);if(i.style){const d={};Ng(d,i.style,i),c.style={...d,...c.style}}return c}const T2=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function jf(i){return typeof i!="string"||i.includes("-")?!1:!!(T2.indexOf(i)>-1||/[A-Z]/u.test(i))}function A2(i,l,u,{latestValues:o},c,d=!1,h){const g=(h??jf(i)?S2:b2)(l,o,c,i),m=p2(l,typeof i=="string",d),v=i!==U.Fragment?{...m,...g,ref:u}:{},{children:x}=l,T=U.useMemo(()=>de(x)?x.get():x,[x]);return U.createElement(i,{...v,children:T})}function E2({scrapeMotionValuesFromProps:i,createRenderState:l},u,o,c){return{latestValues:C2(u,o,c,i),renderState:l()}}function C2(i,l,u,o){const c={},d=o(i,{});for(const T in d)c[T]=zu(d[T]);let{initial:h,animate:p}=i;const g=Ku(i),m=I0(i);l&&m&&!g&&i.inherit!==!1&&(h===void 0&&(h=l.initial),p===void 0&&(p=l.animate));let v=u?u.initial===!1:!1;v=v||h===!1;const x=v?p:h;if(x&&typeof x!="boolean"&&!Xu(x)){const T=Array.isArray(x)?x:[x];for(let N=0;N<T.length;N++){const z=vf(i,T[N]);if(z){const{transitionEnd:Y,transition:X,...q}=z;for(const K in q){let G=q[K];if(Array.isArray(G)){const k=v?G.length-1:0;G=G[k]}G!==null&&(c[K]=G)}for(const K in Y)c[K]=Y[K]}}}return c}const Og=i=>(l,u)=>{const o=U.useContext(Qu),c=U.useContext(Gu),d=()=>E2(i,l,o,c);return u?d():tf(d)},M2=Og({scrapeMotionValuesFromProps:Df,createRenderState:Nf}),D2=Og({scrapeMotionValuesFromProps:hg,createRenderState:jg}),w2=Symbol.for("motionComponentSymbol");function N2(i,l,u){const o=U.useRef(u);U.useInsertionEffect(()=>{o.current=u});const c=U.useRef(null);return U.useCallback(d=>{d&&i.onMount?.(d),l&&(d?l.mount(d):l.unmount());const h=o.current;if(typeof h=="function")if(d){const p=h(d);typeof p=="function"&&(c.current=p)}else c.current?(c.current(),c.current=null):h(d);else h&&(h.current=d)},[l])}const zg=U.createContext({});function _i(i){return i&&typeof i=="object"&&Object.prototype.hasOwnProperty.call(i,"current")}function j2(i,l,u,o,c,d){const{visualElement:h}=U.useContext(Qu),p=U.useContext(Mg),g=U.useContext(Gu),m=U.useContext(wf),v=m.reducedMotion,x=m.skipAnimations,T=U.useRef(null),N=U.useRef(!1);o=o||p.renderer,!T.current&&o&&(T.current=o(i,{visualState:l,parent:h,props:u,presenceContext:g,blockInitialAnimation:g?g.initial===!1:!1,reducedMotionConfig:v,skipAnimations:x,isSVG:d}),N.current&&T.current&&(T.current.manuallyAnimateOnMount=!0));const z=T.current,Y=U.useContext(zg);z&&!z.projection&&c&&(z.type==="html"||z.type==="svg")&&O2(T.current,u,c,Y);const X=U.useRef(!1);U.useInsertionEffect(()=>{z&&X.current&&z.update(u,g)});const q=u[Y0],K=U.useRef(!!q&&!window.MotionHandoffIsComplete?.(q)&&window.MotionHasOptimisedAnimation?.(q));return Iy(()=>{N.current=!0,z&&(X.current=!0,window.MotionIsMounted=!0,z.updateFeatures(),z.scheduleRenderMicrotask(),K.current&&z.animationState&&z.animationState.animateChanges())}),U.useEffect(()=>{z&&(!K.current&&z.animationState&&z.animationState.animateChanges(),K.current&&(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(q)}),K.current=!1),z.enteringChildren=void 0)}),z}function O2(i,l,u,o){const{layoutId:c,layout:d,drag:h,dragConstraints:p,layoutScroll:g,layoutRoot:m,layoutCrossfade:v}=l;i.projection=new u(i.latestValues,l["data-framer-portal-id"]?void 0:Rg(i.parent)),i.projection.setOptions({layoutId:c,layout:d,alwaysMeasureLayout:!!h||p&&_i(p),visualElement:i,animationType:typeof d=="string"?d:"both",initialPromotionConfig:o,crossfade:v,layoutScroll:g,layoutRoot:m})}function Rg(i){if(i)return i.options.allowProjection!==!1?i.projection:Rg(i.parent)}function Tc(i,{forwardMotionProps:l=!1,type:u}={},o,c){o&&h2(o);const d=u?u==="svg":jf(i),h=d?D2:M2;function p(m,v){let x;const T={...U.useContext(wf),...m,layoutId:z2(m)},{isStatic:N}=T,z=g2(m),Y=h(m,N);if(!N&&$y){R2();const X=V2(T);x=X.MeasureLayout,z.visualElement=j2(i,Y,T,c,X.ProjectionNode,d)}return b.jsxs(Qu.Provider,{value:z,children:[x&&z.visualElement?b.jsx(x,{visualElement:z.visualElement,...T}):null,A2(i,m,N2(Y,z.visualElement,v),Y,N,l,d)]})}p.displayName=`motion.${typeof i=="string"?i:`create(${i.displayName??i.name??""})`}`;const g=U.forwardRef(p);return g[w2]=i,g}function z2({layoutId:i}){const l=U.useContext(Ic).id;return l&&i!==void 0?l+"-"+i:i}function R2(i,l){U.useContext(Mg).strict}function V2(i){const l=Dg(),{drag:u,layout:o}=l;if(!u&&!o)return{};const c={...u,...o};return{MeasureLayout:u?.isEnabled(i)||o?.isEnabled(i)?c.MeasureLayout:void 0,ProjectionNode:c.ProjectionNode}}function _2(i,l){if(typeof Proxy>"u")return Tc;const u=new Map,o=(d,h)=>Tc(d,h,i,l),c=(d,h)=>o(d,h);return new Proxy(c,{get:(d,h)=>h==="create"?o:(u.has(h)||u.set(h,Tc(h,void 0,i,l)),u.get(h))})}const U2=(i,l)=>l.isSVG??jf(i)?new dT(l):new uT(l,{allowProjection:i!==U.Fragment});class B2 extends pa{constructor(l){super(l),l.animationState||(l.animationState=vT(l))}updateAnimationControlsSubscription(){const{animate:l}=this.node.getProps();Xu(l)&&(this.unmountControls=l.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:l}=this.node.getProps(),{animate:u}=this.node.prevProps||{};l!==u&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}}let L2=0;class H2 extends pa{constructor(){super(...arguments),this.id=L2++}update(){if(!this.node.presenceContext)return;const{isPresent:l,onExitComplete:u}=this.node.presenceContext,{isPresent:o}=this.node.prevPresenceContext||{};if(!this.node.animationState||l===o)return;const c=this.node.animationState.setActive("exit",!l);u&&!l&&c.then(()=>{u(this.id)})}mount(){const{register:l,onExitComplete:u}=this.node.presenceContext||{};u&&u(this.id),l&&(this.unmount=l(this.id))}unmount(){}}const Y2={animation:{Feature:B2},exit:{Feature:H2}};function es(i){return{point:{x:i.pageX,y:i.pageY}}}const q2=i=>l=>Tf(l)&&i(l,es(l));function Zl(i,l,u,o){return Wl(i,l,q2(u),o)}const Vg=({current:i})=>i?i.ownerDocument.defaultView:null,Ly=(i,l)=>Math.abs(i-l);function G2(i,l){const u=Ly(i.x,l.x),o=Ly(i.y,l.y);return Math.sqrt(u**2+o**2)}const Hy=new Set(["auto","scroll"]);class _g{constructor(l,u,{transformPagePoint:o,contextWindow:c=window,dragSnapToOrigin:d=!1,distanceThreshold:h=3,element:p}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=N=>{this.handleScroll(N.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const N=Ec(this.lastMoveEventInfo,this.history),z=this.startEvent!==null,Y=G2(N.offset,{x:0,y:0})>=this.distanceThreshold;if(!z&&!Y)return;const{point:X}=N,{timestamp:q}=le;this.history.push({...X,timestamp:q});const{onStart:K,onMove:G}=this.handlers;z||(K&&K(this.lastMoveEvent,N),this.startEvent=this.lastMoveEvent),G&&G(this.lastMoveEvent,N)},this.handlePointerMove=(N,z)=>{this.lastMoveEvent=N,this.lastMoveEventInfo=Ac(z,this.transformPagePoint),zt.update(this.updatePoint,!0)},this.handlePointerUp=(N,z)=>{this.end();const{onEnd:Y,onSessionEnd:X,resumeAnimation:q}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&q&&q(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const K=Ec(N.type==="pointercancel"?this.lastMoveEventInfo:Ac(z,this.transformPagePoint),this.history);this.startEvent&&Y&&Y(N,K),X&&X(N,K)},!Tf(l))return;this.dragSnapToOrigin=d,this.handlers=u,this.transformPagePoint=o,this.distanceThreshold=h,this.contextWindow=c||window;const g=es(l),m=Ac(g,this.transformPagePoint),{point:v}=m,{timestamp:x}=le;this.history=[{...v,timestamp:x}];const{onSessionStart:T}=u;T&&T(l,Ec(m,this.history)),this.removeListeners=$l(Zl(this.contextWindow,"pointermove",this.handlePointerMove),Zl(this.contextWindow,"pointerup",this.handlePointerUp),Zl(this.contextWindow,"pointercancel",this.handlePointerUp)),p&&this.startScrollTracking(p)}startScrollTracking(l){let u=l.parentElement;for(;u;){const o=getComputedStyle(u);(Hy.has(o.overflowX)||Hy.has(o.overflowY))&&this.scrollPositions.set(u,{x:u.scrollLeft,y:u.scrollTop}),u=u.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener("scroll",this.onElementScroll,{capture:!0}),window.addEventListener("scroll",this.onWindowScroll),this.removeScrollListeners=()=>{window.removeEventListener("scroll",this.onElementScroll,{capture:!0}),window.removeEventListener("scroll",this.onWindowScroll)}}handleScroll(l){const u=this.scrollPositions.get(l);if(!u)return;const o=l===window,c=o?{x:window.scrollX,y:window.scrollY}:{x:l.scrollLeft,y:l.scrollTop},d={x:c.x-u.x,y:c.y-u.y};d.x===0&&d.y===0||(o?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=d.x,this.lastMoveEventInfo.point.y+=d.y):this.history.length>0&&(this.history[0].x-=d.x,this.history[0].y-=d.y),this.scrollPositions.set(l,c),zt.update(this.updatePoint,!0))}updateHandlers(l){this.handlers=l}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),ma(this.updatePoint)}}function Ac(i,l){return l?{point:l(i.point)}:i}function Yy(i,l){return{x:i.x-l.x,y:i.y-l.y}}function Ec({point:i},l){return{point:i,delta:Yy(i,Ug(l)),offset:Yy(i,X2(l)),velocity:K2(l,.1)}}function X2(i){return i[0]}function Ug(i){return i[i.length-1]}function K2(i,l){if(i.length<2)return{x:0,y:0};let u=i.length-1,o=null;const c=Ug(i);for(;u>=0&&(o=i[u],!(c.timestamp-o.timestamp>ln(l)));)u--;if(!o)return{x:0,y:0};o===i[0]&&i.length>2&&c.timestamp-o.timestamp>ln(l)*2&&(o=i[1]);const d=Qe(c.timestamp-o.timestamp);if(d===0)return{x:0,y:0};const h={x:(c.x-o.x)/d,y:(c.y-o.y)/d};return h.x===1/0&&(h.x=0),h.y===1/0&&(h.y=0),h}function Q2(i,{min:l,max:u},o){return l!==void 0&&i<l?i=o?Lt(l,i,o.min):Math.max(i,l):u!==void 0&&i>u&&(i=o?Lt(u,i,o.max):Math.min(i,u)),i}function qy(i,l,u){return{min:l!==void 0?i.min+l:void 0,max:u!==void 0?i.max+u-(i.max-i.min):void 0}}function Z2(i,{top:l,left:u,bottom:o,right:c}){return{x:qy(i.x,u,c),y:qy(i.y,l,o)}}function Gy(i,l){let u=l.min-i.min,o=l.max-i.max;return l.max-l.min<i.max-i.min&&([u,o]=[o,u]),{min:u,max:o}}function k2(i,l){return{x:Gy(i.x,l.x),y:Gy(i.y,l.y)}}function J2(i,l){let u=.5;const o=ye(i),c=ye(l);return c>o?u=kl(l.min,l.max-o,i.min):o>c&&(u=kl(i.min,i.max-c,l.min)),xn(0,1,u)}function F2(i,l){const u={};return l.min!==void 0&&(u.min=l.min-i.min),l.max!==void 0&&(u.max=l.max-i.min),u}const Pc=.35;function P2(i=Pc){return i===!1?i=0:i===!0&&(i=Pc),{x:Xy(i,"left","right"),y:Xy(i,"top","bottom")}}function Xy(i,l,u){return{min:Ky(i,l),max:Ky(i,u)}}function Ky(i,l){return typeof i=="number"?i:i[l]||0}const W2=new WeakMap;class $2{constructor(l){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=$t(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=l}start(l,{snapToCursor:u=!1,distanceThreshold:o}={}){const{presenceContext:c}=this.visualElement;if(c&&c.isPresent===!1)return;const d=x=>{u&&this.snapToCursor(es(x).point),this.stopAnimation()},h=(x,T)=>{const{drag:N,dragPropagation:z,onDragStart:Y}=this.getProps();if(N&&!z&&(this.openDragLock&&this.openDragLock(),this.openDragLock=MS(N),!this.openDragLock))return;this.latestPointerEvent=x,this.latestPanInfo=T,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),gn(q=>{let K=this.getAxisMotionValue(q).get()||0;if(vn.test(K)){const{projection:G}=this.visualElement;if(G&&G.layout){const k=G.layout.layoutBox[q];k&&(K=ye(k)*(parseFloat(K)/100))}}this.originPoint[q]=K}),Y&&zt.update(()=>Y(x,T),!1,!0),qc(this.visualElement,"transform");const{animationState:X}=this.visualElement;X&&X.setActive("whileDrag",!0)},p=(x,T)=>{this.latestPointerEvent=x,this.latestPanInfo=T;const{dragPropagation:N,dragDirectionLock:z,onDirectionLock:Y,onDrag:X}=this.getProps();if(!N&&!this.openDragLock)return;const{offset:q}=T;if(z&&this.currentDirection===null){this.currentDirection=tA(q),this.currentDirection!==null&&Y&&Y(this.currentDirection);return}this.updateAxis("x",T.point,q),this.updateAxis("y",T.point,q),this.visualElement.render(),X&&zt.update(()=>X(x,T),!1,!0)},g=(x,T)=>{this.latestPointerEvent=x,this.latestPanInfo=T,this.stop(x,T),this.latestPointerEvent=null,this.latestPanInfo=null},m=()=>{const{dragSnapToOrigin:x}=this.getProps();(x||this.constraints)&&this.startAnimation({x:0,y:0})},{dragSnapToOrigin:v}=this.getProps();this.panSession=new _g(l,{onSessionStart:d,onStart:h,onMove:p,onSessionEnd:g,resumeAnimation:m},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:v,distanceThreshold:o,contextWindow:Vg(this.visualElement),element:this.visualElement.current})}stop(l,u){const o=l||this.latestPointerEvent,c=u||this.latestPanInfo,d=this.isDragging;if(this.cancel(),!d||!c||!o)return;const{velocity:h}=c;this.startAnimation(h);const{onDragEnd:p}=this.getProps();p&&zt.postRender(()=>p(o,c))}cancel(){this.isDragging=!1;const{projection:l,animationState:u}=this.visualElement;l&&(l.isAnimationBlocked=!1),this.endPanSession();const{dragPropagation:o}=this.getProps();!o&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),u&&u.setActive("whileDrag",!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(l,u,o){const{drag:c}=this.getProps();if(!o||!Mu(l,c,this.currentDirection))return;const d=this.getAxisMotionValue(l);let h=this.originPoint[l]+o[l];this.constraints&&this.constraints[l]&&(h=Q2(h,this.constraints[l],this.elastic[l])),d.set(h)}resolveConstraints(){const{dragConstraints:l,dragElastic:u}=this.getProps(),o=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,c=this.constraints;l&&_i(l)?this.constraints||(this.constraints=this.resolveRefConstraints()):l&&o?this.constraints=Z2(o.layoutBox,l):this.constraints=!1,this.elastic=P2(u),c!==this.constraints&&!_i(l)&&o&&this.constraints&&!this.hasMutatedConstraints&&gn(d=>{this.constraints!==!1&&this.getAxisMotionValue(d)&&(this.constraints[d]=F2(o.layoutBox[d],this.constraints[d]))})}resolveRefConstraints(){const{dragConstraints:l,onMeasureDragConstraints:u}=this.getProps();if(!l||!_i(l))return!1;const o=l.current,{projection:c}=this.visualElement;if(!c||!c.layout)return!1;const d=eT(o,c.root,this.visualElement.getTransformPagePoint());let h=k2(c.layout.layoutBox,d);if(u){const p=u($S(h));this.hasMutatedConstraints=!!p,p&&(h=ag(p))}return h}startAnimation(l){const{drag:u,dragMomentum:o,dragElastic:c,dragTransition:d,dragSnapToOrigin:h,onDragTransitionEnd:p}=this.getProps(),g=this.constraints||{},m=gn(v=>{if(!Mu(v,u,this.currentDirection))return;let x=g&&g[v]||{};h&&(x={min:0,max:0});const T=c?200:1e6,N=c?40:1e7,z={type:"inertia",velocity:o?l[v]:0,bounceStiffness:T,bounceDamping:N,timeConstant:750,restDelta:1,restSpeed:10,...d,...x};return this.startAxisValueAnimation(v,z)});return Promise.all(m).then(p)}startAxisValueAnimation(l,u){const o=this.getAxisMotionValue(l);return qc(this.visualElement,l),o.start(gf(l,o,0,u,this.visualElement,!1))}stopAnimation(){gn(l=>this.getAxisMotionValue(l).stop())}getAxisMotionValue(l){const u=`_drag${l.toUpperCase()}`,o=this.visualElement.getProps(),c=o[u];return c||this.visualElement.getValue(l,(o.initial?o.initial[l]:void 0)||0)}snapToCursor(l){gn(u=>{const{drag:o}=this.getProps();if(!Mu(u,o,this.currentDirection))return;const{projection:c}=this.visualElement,d=this.getAxisMotionValue(u);if(c&&c.layout){const{min:h,max:p}=c.layout.layoutBox[u],g=d.get()||0;d.set(l[u]-Lt(h,p,.5)+g)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:l,dragConstraints:u}=this.getProps(),{projection:o}=this.visualElement;if(!_i(u)||!o||!this.constraints)return;this.stopAnimation();const c={x:0,y:0};gn(h=>{const p=this.getAxisMotionValue(h);if(p&&this.constraints!==!1){const g=p.get();c[h]=J2({min:g,max:g},this.constraints[h])}});const{transformTemplate:d}=this.visualElement.getProps();this.visualElement.current.style.transform=d?d({},""):"none",o.root&&o.root.updateScroll(),o.updateLayout(),this.constraints=!1,this.resolveConstraints(),gn(h=>{if(!Mu(h,l,null))return;const p=this.getAxisMotionValue(h),{min:g,max:m}=this.constraints[h];p.set(Lt(g,m,c[h]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;W2.set(this.visualElement,this);const l=this.visualElement.current,u=Zl(l,"pointerdown",m=>{const{drag:v,dragListener:x=!0}=this.getProps(),T=m.target,N=T!==l&&zS(T);v&&x&&!N&&this.start(m)});let o;const c=()=>{const{dragConstraints:m}=this.getProps();_i(m)&&m.current&&(this.constraints=this.resolveRefConstraints(),o||(o=I2(l,m.current,()=>this.scalePositionWithinConstraints())))},{projection:d}=this.visualElement,h=d.addEventListener("measure",c);d&&!d.layout&&(d.root&&d.root.updateScroll(),d.updateLayout()),zt.read(c);const p=Wl(window,"resize",()=>this.scalePositionWithinConstraints()),g=d.addEventListener("didUpdate",(({delta:m,hasLayoutChanged:v})=>{this.isDragging&&v&&(gn(x=>{const T=this.getAxisMotionValue(x);T&&(this.originPoint[x]+=m[x].translate,T.set(T.get()+m[x].translate))}),this.visualElement.render())}));return()=>{p(),u(),h(),g&&g(),o&&o()}}getProps(){const l=this.visualElement.getProps(),{drag:u=!1,dragDirectionLock:o=!1,dragPropagation:c=!1,dragConstraints:d=!1,dragElastic:h=Pc,dragMomentum:p=!0}=l;return{...l,drag:u,dragDirectionLock:o,dragPropagation:c,dragConstraints:d,dragElastic:h,dragMomentum:p}}}function Qy(i){let l=!0;return()=>{if(l){l=!1;return}i()}}function I2(i,l,u){const o=$p(i,Qy(u)),c=$p(l,Qy(u));return()=>{o(),c()}}function Mu(i,l,u){return(l===!0||l===i)&&(u===null||u===i)}function tA(i,l=10){let u=null;return Math.abs(i.y)>l?u="y":Math.abs(i.x)>l&&(u="x"),u}class eA extends pa{constructor(l){super(l),this.removeGroupControls=Ze,this.removeListeners=Ze,this.controls=new $2(l)}mount(){const{dragControls:l}=this.node.getProps();l&&(this.removeGroupControls=l.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Ze}update(){const{dragControls:l}=this.node.getProps(),{dragControls:u}=this.node.prevProps||{};l!==u&&(this.removeGroupControls(),l&&(this.removeGroupControls=l.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}}const Cc=i=>(l,u)=>{i&&zt.update(()=>i(l,u),!1,!0)};class nA extends pa{constructor(){super(...arguments),this.removePointerDownListener=Ze}onPointerDown(l){this.session=new _g(l,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:Vg(this.node)})}createPanHandlers(){const{onPanSessionStart:l,onPanStart:u,onPan:o,onPanEnd:c}=this.node.getProps();return{onSessionStart:Cc(l),onStart:Cc(u),onMove:Cc(o),onEnd:(d,h)=>{delete this.session,c&&zt.postRender(()=>c(d,h))}}}mount(){this.removePointerDownListener=Zl(this.node.current,"pointerdown",l=>this.onPointerDown(l))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}let Mc=!1;class aA extends U.Component{componentDidMount(){const{visualElement:l,layoutGroup:u,switchLayoutGroup:o,layoutId:c}=this.props,{projection:d}=l;d&&(u.group&&u.group.add(d),o&&o.register&&c&&o.register(d),Mc&&d.root.didUpdate(),d.addEventListener("animationComplete",()=>{this.safeToRemove()}),d.setOptions({...d.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),Ru.hasEverUpdated=!0}getSnapshotBeforeUpdate(l){const{layoutDependency:u,visualElement:o,drag:c,isPresent:d}=this.props,{projection:h}=o;return h&&(h.isPresent=d,l.layoutDependency!==u&&h.setOptions({...h.options,layoutDependency:u}),Mc=!0,c||l.layoutDependency!==u||u===void 0||l.isPresent!==d?h.willUpdate():this.safeToRemove(),l.isPresent!==d&&(d?h.promote():h.relegate()||zt.postRender(()=>{const p=h.getStack();(!p||!p.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:l}=this.props.visualElement;l&&(l.root.didUpdate(),Sf.postRender(()=>{!l.currentAnimation&&l.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:l,layoutGroup:u,switchLayoutGroup:o}=this.props,{projection:c}=l;Mc=!0,c&&(c.scheduleCheckAfterUnmount(),u&&u.group&&u.group.remove(c),o&&o.deregister&&o.deregister(c))}safeToRemove(){const{safeToRemove:l}=this.props;l&&l()}render(){return null}}function Bg(i){const[l,u]=Cg(),o=U.useContext(Ic);return b.jsx(aA,{...i,layoutGroup:o,switchLayoutGroup:U.useContext(zg),isPresent:l,safeToRemove:u})}const iA={pan:{Feature:nA},drag:{Feature:eA,ProjectionNode:Eg,MeasureLayout:Bg}};function Zy(i,l,u){const{props:o}=i;i.animationState&&o.whileHover&&i.animationState.setActive("whileHover",u==="Start");const c="onHover"+u,d=o[c];d&&zt.postRender(()=>d(l,es(l)))}class lA extends pa{mount(){const{current:l}=this.node;l&&(this.unmount=wS(l,(u,o)=>(Zy(this.node,o,"Start"),c=>Zy(this.node,c,"End"))))}unmount(){}}class sA extends pa{constructor(){super(...arguments),this.isActive=!1}onFocus(){let l=!1;try{l=this.node.current.matches(":focus-visible")}catch{l=!0}!l||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=$l(Wl(this.node.current,"focus",()=>this.onFocus()),Wl(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function ky(i,l,u){const{props:o}=i;if(i.current instanceof HTMLButtonElement&&i.current.disabled)return;i.animationState&&o.whileTap&&i.animationState.setActive("whileTap",u==="Start");const c="onTap"+(u==="End"?"":u),d=o[c];d&&zt.postRender(()=>d(l,es(l)))}class uA extends pa{mount(){const{current:l}=this.node;if(!l)return;const{globalTapTarget:u,propagate:o}=this.node.props;this.unmount=VS(l,(c,d)=>(ky(this.node,d,"Start"),(h,{success:p})=>ky(this.node,h,p?"End":"Cancel")),{useGlobalTarget:u,stopPropagation:o?.tap===!1})}unmount(){}}const Wc=new WeakMap,Dc=new WeakMap,oA=i=>{const l=Wc.get(i.target);l&&l(i)},rA=i=>{i.forEach(oA)};function cA({root:i,...l}){const u=i||document;Dc.has(u)||Dc.set(u,{});const o=Dc.get(u),c=JSON.stringify(l);return o[c]||(o[c]=new IntersectionObserver(rA,{root:i,...l})),o[c]}function fA(i,l,u){const o=cA(l);return Wc.set(i,u),o.observe(i),()=>{Wc.delete(i),o.unobserve(i)}}const hA={some:0,all:1};class dA extends pa{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:l={}}=this.node.getProps(),{root:u,margin:o,amount:c="some",once:d}=l,h={root:u?u.current:void 0,rootMargin:o,threshold:typeof c=="number"?c:hA[c]},p=g=>{const{isIntersecting:m}=g;if(this.isInView===m||(this.isInView=m,d&&!m&&this.hasEnteredView))return;m&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",m);const{onViewportEnter:v,onViewportLeave:x}=this.node.getProps(),T=m?v:x;T&&T(g)};return fA(this.node.current,h,p)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:l,prevProps:u}=this.node;["amount","margin","root"].some(mA(l,u))&&this.startObserver()}unmount(){}}function mA({viewport:i={}},{viewport:l={}}={}){return u=>i[u]!==l[u]}const pA={inView:{Feature:dA},tap:{Feature:uA},focus:{Feature:sA},hover:{Feature:lA}},yA={layout:{ProjectionNode:Eg,MeasureLayout:Bg}},gA={...Y2,...pA,...iA,...yA},Jy=_2(gA,U2),vA=[{id:"anthropic",name:"Claude",subtitle:"by Anthropic",icon:"/icons/claude.png"},{id:"openai",name:"OpenAI Codex",subtitle:"ChatGPT Plus / Pro",icon:"/icons/codex.png"}],xA={anthropic:[{id:"claude-opus-4-6",label:"Opus 4.6"},{id:"claude-sonnet-4-6",label:"Sonnet 4.6"},{id:"claude-haiku-4-5-20251001",label:"Haiku 4.5"}],openai:[{id:"gpt-5.2-codex:medium",label:"GPT-5.2 Codex Medium"},{id:"gpt-5.2-codex:high",label:"GPT-5.2 Codex High"},{id:"gpt-5.2-codex:xhigh",label:"GPT-5.2 Codex Extra High"},{id:"gpt-5.3-codex:medium",label:"GPT-5.3 Codex Medium (Pro)"},{id:"gpt-5.3-codex:high",label:"GPT-5.3 Codex High (Pro)"},{id:"gpt-5.3-codex:xhigh",label:"GPT-5.3 Codex Extra High (Pro)"}]},Fy=[{tier:"premium",label:i=>`${i}.fluxy.bot`,badge:"$5",badgeCls:"bg-[#AF27E3]/15 text-[#AF27E3] border-[#AF27E3]/20",highlight:!0},{tier:"at",label:i=>`${i}.at.fluxy.bot`,badge:"Free",badgeCls:"bg-emerald-500/10 text-emerald-400 border-emerald-500/20",highlight:!1}];function bA({models:i,value:l,onChange:u}){const[o,c]=U.useState(!1),d=U.useRef(null);U.useEffect(()=>{if(!o)return;const p=g=>{d.current&&!d.current.contains(g.target)&&c(!1)};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[o]);const h=i.find(p=>p.id===l);return b.jsxs("div",{className:"relative",ref:d,children:[b.jsxs("button",{type:"button",onClick:()=>c(p=>!p),className:"w-full flex items-center justify-between bg-white/[0.03] border border-white/[0.08] text-white rounded-xl px-4 py-2.5 text-[13px] outline-none hover:border-white/15 focus:border-[#AF27E3]/30 transition-colors",children:[b.jsx("span",{className:h?"text-white":"text-white/20",children:h?h.label:"Choose a model..."}),b.jsx(fx,{className:`h-4 w-4 text-white/30 transition-transform ${o?"rotate-180":""}`})]}),o&&b.jsx("div",{className:"absolute left-0 right-0 top-full mt-1 bg-[#222] border border-white/[0.08] rounded-xl shadow-xl py-1 z-10 max-h-48 overflow-y-auto",children:i.map(p=>b.jsx("button",{onClick:()=>{u(p.id),c(!1)},className:`w-full text-left px-4 py-2 text-[13px] transition-colors ${l===p.id?"text-[#AF27E3] bg-[#AF27E3]/10":"text-white/70 hover:bg-white/[0.04] hover:text-white"}`,children:p.label},p.id))})]})}function EA({onComplete:i,isInitialSetup:l=!1,onSave:u}){const o=l?7:6,[c,d]=U.useState(0),[h,p]=U.useState(""),[g,m]=U.useState("anthropic"),[v,x]=U.useState(""),[T,N]=U.useState(!1),[z,Y]=U.useState({anthropic:"idle",openai:"idle"}),[X,q]=U.useState(!1),[K,G]=U.useState(""),[k,Z]=U.useState(!1),[it,J]=U.useState(),[F,lt]=U.useState(!1),[xt,At]=U.useState(!1),[Bt,se]=U.useState(),[Nt,Pt]=U.useState(""),[O,H]=U.useState(null),[$,ut]=U.useState(""),[ht,E]=U.useState({}),[V,Q]=U.useState("at"),[P,st]=U.useState(!1),[nt,dt]=U.useState(!1),[Rt,jt]=U.useState(""),ke=U.useRef(null),[ge,Ga]=U.useState(null),[Je,Fe]=U.useState(!1),[Xa,Ka]=U.useState(!1),[Zu,ns]=U.useState("admin"),[Ee,Zi]=U.useState(""),[ya,ku]=U.useState(""),[Ju,ue]=U.useState(!1),[un,as]=U.useState(!1),[ki,Qa]=U.useState(!1),[Ji,is]=U.useState(""),[ls,Za]=U.useState(""),[on,oe]=U.useState(!1),[Pe,re]=U.useState(!1),[rn,ss]=U.useState(!1),[We,ga]=U.useState(""),qn=U.useRef(!1),Re=z[g]==="connected";U.useEffect(()=>{fetch("/api/onboard/status").then(B=>B.json()).then(B=>{B.userName&&p(B.userName),B.handle&&(Pt(B.handle.username),Q(B.handle.tier||"at"),Ga({username:B.handle.username,tier:B.handle.tier,url:B.handle.url}),dt(!0),jt(B.handle.url)),B.portalUser&&ns(B.portalUser),B.portalConfigured&&as(!0),B.provider&&m(B.provider),B.model&&x(B.model),B.whisperEnabled&&(ss(!0),ga(B.whisperKey||"")),qn.current=!0}).catch(()=>{qn.current=!0})},[]),U.useEffect(()=>{g!=="anthropic"||z.anthropic==="connected"||fetch("/api/auth/claude/status").then(B=>B.json()).then(B=>{B.authenticated&&Y(ot=>({...ot,anthropic:"connected"}))}).catch(()=>{})},[g]),U.useEffect(()=>{g!=="openai"||z.openai==="connected"||fetch("/api/auth/codex/status").then(B=>B.json()).then(B=>{B.authenticated&&Y(ot=>({...ot,openai:"connected"}))}).catch(()=>{})},[g]),U.useEffect(()=>{if(!xt)return;const B=setInterval(async()=>{try{(await(await fetch("/api/auth/codex/status")).json()).authenticated&&(At(!1),Y(Ve=>({...Ve,openai:"connected"})))}catch{}},2e3);return()=>clearInterval(B)},[xt]),U.useEffect(()=>{if(ke.current&&clearTimeout(ke.current),!qn.current||ge&&nt&&Nt===ge.username)return;H(null),ut(""),E({}),dt(!1),jt("");const B=Nt.trim();if(B){if(B.length<3){H("invalid"),ut("At least 3 characters");return}return H("checking"),ke.current=setTimeout(async()=>{try{const fe=await(await fetch(`/api/handle/check/${encodeURIComponent(B)}`)).json();if(!fe.valid)H("invalid"),ut(fe.error);else{const Ve={};for(const $e of fe.handles)Ve[$e.tier]=$e.available;E(Ve),H("ready");const Pa=Fy.find($e=>Ve[$e.tier]);Pa&&!Ve[V]&&Q(Pa.tier)}}catch{H(null)}},400),()=>{ke.current&&clearTimeout(ke.current)}}},[Nt]);const Sn=B=>{Pt(B.toLowerCase().replace(/[^a-z0-9-]/g,""))},ka=async()=>{if(!(!Nt||O!=="ready"||!ht[V])){st(!0);try{const ot=await(await fetch("/api/handle/register",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:Nt,tier:V})})).json();ot.ok?(dt(!0),jt(ot.url)):(ut(ot.error||"Registration failed"),H("invalid"))}catch{ut("Could not reach server"),H("invalid")}finally{st(!1)}}},va=async()=>{if(!(!Nt||O!=="ready"||!ht[V])){Ka(!0);try{const ot=await(await fetch("/api/handle/change",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:Nt,tier:V})})).json();ot.ok?(dt(!0),jt(ot.url),Ga({username:Nt,tier:V,url:ot.url}),Fe(!1)):(ut(ot.error||"Handle change failed"),H("invalid"))}catch{ut("Could not reach server"),H("invalid")}finally{Ka(!1)}}},Fu=B=>{g==="openai"&&B!=="openai"&&xt&&(fetch("/api/auth/codex/cancel",{method:"POST"}),At(!1)),m(B),x(""),q(!1),G(""),J(void 0),At(!1),se(void 0)},us=async()=>{J(void 0);try{const ot=await(await fetch("/api/auth/claude/start",{method:"POST"})).json();ot.success&&ot.authUrl?(window.open(ot.authUrl,"_blank"),q(!0)):J(ot.error||"Failed to start authentication")}catch(B){J(B.message)}},Ja=async()=>{if(K.trim()){Z(!0),J(void 0);try{const ot=await(await fetch("/api/auth/claude/exchange",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:K.trim()})})).json();ot.success?Y(fe=>({...fe,anthropic:"connected"})):J(ot.error||"Code exchange failed")}catch(B){J(B.message)}finally{Z(!1)}}},xa=async()=>{try{const B=await navigator.clipboard.readText();B&&G(B.trim())}catch{}},Pu=async()=>{lt(!0),J(void 0);try{(await(await fetch("/api/auth/claude/status")).json()).authenticated?Y(fe=>({...fe,anthropic:"connected"})):J("No active session found. Please authenticate first.")}catch{}finally{lt(!1)}},os=async()=>{At(!0),se(void 0);try{const ot=await(await fetch("/api/auth/codex/start",{method:"POST"})).json();ot.success&&ot.authUrl?window.open(ot.authUrl,"_blank"):(At(!1),se(ot.error||"Failed to start authentication"))}catch(B){At(!1),se(B.message)}},rs=()=>{At(!1),fetch("/api/auth/codex/cancel",{method:"POST"})},Fi=Ee===ya,Fa=Ee.length>=6&&Fi,Pi=un?Ee.length===0||on&&Fa:Fa,Gn=(()=>{switch(c){case 0:return!0;case 1:return h.trim().length>0;case 2:return nt;case 3:return Pi;case 4:return!!(g&&v&&Re);case 5:return!0;default:return!1}})(),cn=()=>{Gn&&c<o-1&&d(B=>B+1)},fn=()=>{c>0&&d(B=>B-1)},Gt=B=>{B.key==="Enter"&&Gn&&cn()},ce=async()=>{N(!0);const B={userName:h.trim(),agentName:Nt.trim()||"Fluxy",provider:g,model:v,apiKey:"",whisperEnabled:rn,whisperKey:rn?We:"",portalUser:Zu.trim(),portalPass:Ee};try{u?await u(B):await fetch("/api/onboard",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(B)}),l?(N(!1),d(6)):i()}catch(ot){console.error("[OnboardWizard] Onboard failed:",ot),N(!1)}},Ce="w-full bg-white/[0.05] border border-white/[0.08] text-white rounded-xl px-4 py-3 text-base outline-none input-glow placeholder:text-white/20 transition-all";return b.jsxs("div",{className:"fixed inset-0 z-[200] flex items-center justify-center p-4",children:[b.jsx("div",{className:"absolute inset-0 bg-black/85 backdrop-blur-md"}),b.jsxs(Jy.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},transition:{duration:.3},className:"relative w-full max-w-[480px] bg-[#181818] border border-white/[0.06] rounded-[24px] shadow-2xl overflow-hidden",children:[b.jsx("div",{className:"flex justify-center gap-2 pt-6",children:Array.from({length:o},(B,ot)=>b.jsx("div",{className:`h-1.5 rounded-full transition-all duration-300 ${ot===c?"w-7 bg-gradient-brand":ot<c?"w-1.5 bg-gradient-brand opacity-60":"w-1.5 bg-white/10"}`},ot))}),b.jsx(c2,{mode:"wait",children:b.jsxs(Jy.div,{initial:{opacity:0,x:30},animate:{opacity:1,x:0},exit:{opacity:0,x:-30},transition:{duration:.2,ease:"easeOut"},className:"px-8 pt-6 pb-8",children:[c===0&&b.jsxs("div",{className:"flex flex-col items-center text-center",children:[b.jsx("video",{src:"/fluxy_say_hi.webm",autoPlay:!0,loop:!0,muted:!0,playsInline:!0,className:"h-[180px] mb-4"}),b.jsx("h1",{className:"text-2xl font-bold text-white tracking-tight",children:"Welcome to Fluxy"}),b.jsx("p",{className:"text-white/40 text-[14px] mt-2 leading-relaxed max-w-[320px]",children:"Let's set up your AI assistant in just a few steps."}),b.jsxs("button",{onClick:cn,className:"mt-6 px-7 py-3 bg-gradient-brand hover:opacity-90 text-white text-[14px] font-semibold rounded-full transition-colors flex items-center gap-2",children:["Get Started",b.jsx(yn,{className:"h-4 w-4"})]})]}),c===1&&b.jsxs("div",{children:[b.jsx("h1",{className:"text-xl font-bold text-white tracking-tight",children:"What's your name?"}),b.jsx("p",{className:"text-white/40 text-[13px] mt-1.5 leading-relaxed",children:"This is how your agent will address you."}),b.jsxs("div",{className:"mt-5 flex items-center gap-3",children:[b.jsx("input",{type:"text",value:h,onChange:B=>p(B.target.value),onKeyDown:Gt,placeholder:"Enter your name",autoFocus:!0,className:Ce+" flex-1"}),b.jsx("button",{onClick:cn,disabled:!Gn,className:"shrink-0 h-12 w-12 flex items-center justify-center rounded-full bg-gradient-brand hover:opacity-90 text-white transition-colors disabled:opacity-30",children:b.jsx(yn,{className:"h-5 w-5"})})]})]}),c===2&&b.jsxs("div",{children:[b.jsx("h1",{className:"text-xl font-bold text-white tracking-tight",children:"Name your bot"}),b.jsx("p",{className:"text-white/40 text-[13px] mt-1.5 leading-relaxed",children:"This is your bot's name and permanent handle — access it from anywhere."}),ge&&nt&&!Je&&b.jsxs(b.Fragment,{children:[b.jsxs("div",{className:"mt-4 bg-emerald-500/8 border border-emerald-500/15 rounded-xl px-4 py-3",children:[b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx(Ri,{className:"h-4 w-4 text-emerald-400"}),b.jsx("p",{className:"text-emerald-400/90 text-[13px] font-medium",children:"Current handle"})]}),b.jsx("p",{className:"text-emerald-400/60 text-[12px] mt-1 font-mono",children:Rt})]}),b.jsxs("div",{className:"flex gap-2 mt-4",children:[b.jsxs("button",{onClick:cn,className:"flex-1 py-3 bg-gradient-brand hover:opacity-90 text-white text-[14px] font-semibold rounded-full transition-colors flex items-center justify-center gap-2",children:["Continue",b.jsx(yn,{className:"h-4 w-4"})]}),b.jsx("button",{onClick:()=>{Fe(!0),dt(!1),Pt(""),H(null),E({})},className:"px-5 py-3 bg-white/[0.04] hover:bg-white/[0.08] border border-white/[0.08] text-white/60 text-[13px] font-medium rounded-full transition-colors",children:"Change"})]})]}),Je&&!nt&&b.jsxs("div",{className:"mt-4 bg-amber-500/8 border border-amber-500/20 rounded-xl px-4 py-3",children:[b.jsx("p",{className:"text-amber-400/90 text-[13px] font-medium",children:"Changing your handle"}),b.jsxs("p",{className:"text-amber-400/60 text-[12px] mt-1",children:["Your current handle ",b.jsx("span",{className:"font-mono",children:ge?.url})," will be released and become available for others."]})]}),(!ge||Je||!nt)&&!(ge&&nt&&!Je)&&b.jsxs(b.Fragment,{children:[b.jsxs("div",{className:"relative mt-5",children:[b.jsx("input",{type:"text",value:Nt,onChange:B=>Sn(B.target.value),maxLength:30,placeholder:"your-bot-name",spellCheck:!1,autoCapitalize:"none",autoCorrect:"off",autoFocus:!0,disabled:nt,className:Ce+" pr-10 font-mono"+(nt?" opacity-50":"")}),O&&Nt.length>0&&!nt&&b.jsxs("div",{className:"absolute right-4 top-1/2 -translate-y-1/2",children:[O==="checking"&&b.jsx("div",{className:"w-5 h-5 border-2 border-white/10 border-t-[#04D1FE] rounded-full animate-spin"}),O==="invalid"&&b.jsx("div",{className:"w-6 h-6 rounded-full bg-amber-500/15 flex items-center justify-center",children:b.jsx("svg",{className:"w-3.5 h-3.5 text-amber-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:3,children:b.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v3m0 4h.01"})})})]})]}),O==="invalid"&&$&&b.jsx("p",{className:"text-amber-400 text-[12px] mt-2",children:$}),O==="ready"&&Nt.length>0&&!nt&&b.jsx("div",{className:"space-y-2 mt-4",children:Fy.map(B=>{const fe=ht[B.tier]===!1;return b.jsxs("button",{onClick:()=>!fe&&Q(B.tier),disabled:fe,className:`w-full flex items-center justify-between px-4 py-3 rounded-xl border transition-all duration-200 text-left ${fe?"border-white/[0.04] bg-transparent opacity-50 cursor-not-allowed":V===B.tier?B.highlight?"border-[#AF27E3]/40 bg-[#AF27E3]/[0.06]":"border-[#AF27E3]/30 bg-white/[0.04]":"border-white/[0.06] bg-transparent hover:border-white/10 hover:bg-white/[0.02]"}`,children:[b.jsx("span",{className:"font-mono text-[13px] text-white/70",children:B.label(Nt)}),fe?b.jsx("span",{className:"text-[11px] font-medium px-2.5 py-0.5 rounded-full border bg-red-500/10 text-red-400 border-red-500/20",children:"Taken"}):b.jsx("span",{className:`text-[11px] font-medium px-2.5 py-0.5 rounded-full border ${B.badgeCls}`,children:B.badge})]},B.tier)})}),nt&&b.jsxs("div",{className:"mt-4 bg-emerald-500/8 border border-emerald-500/15 rounded-xl px-4 py-3",children:[b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx(Ri,{className:"h-4 w-4 text-emerald-400"}),b.jsx("p",{className:"text-emerald-400/90 text-[13px] font-medium",children:"Handle claimed!"})]}),b.jsx("p",{className:"text-emerald-400/60 text-[12px] mt-1 font-mono",children:Rt})]}),O==="ready"&&ht[V]&&Nt.length>0&&!nt&&b.jsx("button",{onClick:Je?va:ka,disabled:P||Xa,className:"w-full mt-4 py-3 bg-gradient-brand hover:opacity-90 text-white text-[14px] font-semibold rounded-full transition-colors flex items-center justify-center gap-2 disabled:opacity-40",children:P||Xa?b.jsxs(b.Fragment,{children:[b.jsx(Vi,{className:"h-4 w-4 animate-spin"}),Je?"Changing...":"Claiming..."]}):b.jsxs(b.Fragment,{children:[Je?"Change Handle":"Claim & Continue",b.jsx(yn,{className:"h-4 w-4"})]})}),nt&&b.jsxs("button",{onClick:cn,className:"w-full mt-4 py-3 bg-gradient-brand hover:opacity-90 text-white text-[14px] font-semibold rounded-full transition-colors flex items-center justify-center gap-2",children:["Continue",b.jsx(yn,{className:"h-4 w-4"})]}),Je&&!nt&&b.jsx("button",{onClick:()=>{Fe(!1),Pt(ge.username),dt(!0),jt(ge.url),Q(ge.tier),H(null)},className:"w-full mt-2 py-2 text-white/25 hover:text-white/40 text-[12px] transition-colors",children:"Cancel — keep current handle"})]})]}),c===3&&b.jsxs("div",{children:[b.jsx("h1",{className:"text-xl font-bold text-white tracking-tight",children:"Set a password"}),b.jsx("p",{className:"text-white/40 text-[13px] mt-1.5 leading-relaxed",children:"You'll need this password to access your agent's chat. Keep it safe — anyone with your URL will need it to log in."}),un&&b.jsx("div",{className:"mt-4 bg-white/[0.02] border border-white/[0.06] rounded-xl px-4 py-2.5",children:b.jsx("p",{className:"text-white/40 text-[12px]",children:"Password already set. Leave fields empty to keep your current password, or enter your current password to change it."})}),un&&b.jsxs("div",{className:"mt-5",children:[b.jsx("label",{className:"text-[12px] text-white/40 font-medium mb-1.5 block",children:"Current password"}),b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx("input",{type:"password",value:Ji,onChange:B=>{is(B.target.value),Za(""),oe(!1)},placeholder:"Enter current password to change it",autoComplete:"current-password",autoFocus:!0,className:Ce+" flex-1"}),Ji.length>0&&!on&&b.jsx("button",{onClick:async()=>{re(!0),Za("");try{(await(await fetch("/api/portal/verify-password",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({password:Ji})})).json()).valid?oe(!0):Za("Incorrect password")}catch{Za("Could not verify")}finally{re(!1)}},disabled:Pe,className:"shrink-0 px-4 py-3 bg-white/[0.06] hover:bg-white/[0.1] text-white/60 text-[13px] font-medium rounded-xl transition-colors disabled:opacity-40",children:Pe?b.jsx(Vi,{className:"h-4 w-4 animate-spin"}):"Verify"}),on&&b.jsx("div",{className:"shrink-0 w-10 h-10 flex items-center justify-center",children:b.jsx(Ri,{className:"h-4 w-4 text-emerald-400"})})]}),ls&&b.jsx("p",{className:"text-red-400/70 text-[11px] mt-1",children:ls})]}),(!un||on)&&b.jsxs(b.Fragment,{children:[b.jsxs("div",{className:un?"mt-3":"mt-5",children:[b.jsx("label",{className:"text-[12px] text-white/40 font-medium mb-1.5 block",children:un?"New password":"Password"}),b.jsx("input",{type:"password",value:Ee,onChange:B=>Zi(B.target.value),placeholder:"••••••••",autoComplete:"new-password",autoFocus:!un,onKeyDown:Gt,className:Ce}),Ee.length>0&&Ee.length<6&&b.jsx("p",{className:"text-amber-400/70 text-[11px] mt-1",children:"At least 6 characters"})]}),b.jsxs("div",{className:"mt-3",children:[b.jsx("label",{className:"text-[12px] text-white/40 font-medium mb-1.5 block",children:un?"Confirm new password":"Confirm password"}),b.jsx("input",{type:"password",value:ya,onChange:B=>ku(B.target.value),placeholder:"••••••••",autoComplete:"new-password",onKeyDown:Gt,className:Ce}),ya.length>0&&!Fi&&b.jsx("p",{className:"text-red-400/70 text-[11px] mt-1",children:"Passwords don't match"})]})]}),b.jsxs("button",{onClick:cn,disabled:!Gn,className:"w-full mt-5 py-3 bg-gradient-brand hover:opacity-90 text-white text-[14px] font-semibold rounded-full transition-colors flex items-center justify-center gap-2 disabled:opacity-40",children:["Continue",b.jsx(yn,{className:"h-4 w-4"})]})]}),c===4&&b.jsxs("div",{children:[b.jsx("h1",{className:"text-xl font-bold text-white tracking-tight",children:"Choose your AI provider"}),b.jsx("p",{className:"text-white/40 text-[13px] mt-1.5 leading-relaxed",children:"Pick one provider to power your bot, authenticate, and select a model."}),b.jsx("div",{className:"flex gap-2.5 mt-4",children:vA.map(B=>b.jsxs("button",{onClick:()=>Fu(B.id),className:`flex-1 relative rounded-xl border transition-all duration-200 p-3 text-left ${g===B.id?"bg-white/[0.04] border-[#AF27E3]/40":"bg-transparent border-white/[0.06] hover:border-white/10 hover:bg-white/[0.02]"}`,children:[b.jsxs("div",{className:"flex flex-col items-center gap-1.5 py-0.5",children:[B.icon?b.jsx("img",{src:B.icon,alt:B.name,className:"w-8 h-8 rounded-lg"}):b.jsx("div",{className:"w-8 h-8 rounded-lg bg-white/[0.06] flex items-center justify-center text-white/50 text-sm font-bold",children:"O"}),b.jsxs("div",{className:"text-center",children:[b.jsx("div",{className:"text-[13px] font-medium text-white",children:B.name}),b.jsx("div",{className:"text-[10px] text-white/30",children:B.subtitle})]})]}),z[B.id]==="connected"?b.jsx("div",{className:"absolute top-2 right-2 w-4 h-4 rounded-full bg-emerald-500/15 flex items-center justify-center",children:b.jsx(Ri,{className:"h-2.5 w-2.5 text-emerald-400"})}):g===B.id?b.jsx("div",{className:"absolute top-2 right-2 w-2 h-2 rounded-full bg-gradient-brand"}):null]},B.id))}),b.jsx("div",{className:"border-t border-white/[0.06] mt-4 mb-3"}),g==="anthropic"&&b.jsxs("div",{className:"space-y-2.5",children:[Re&&b.jsx("div",{className:"bg-emerald-500/8 border border-emerald-500/15 rounded-lg px-3.5 py-2.5",children:b.jsx("p",{className:"text-emerald-400/90 text-[12px]",children:"Connected — Anthropic subscription is active."})}),!Re&&b.jsxs(b.Fragment,{children:[it&&b.jsx("div",{className:"bg-red-500/8 border border-red-500/15 rounded-lg px-3.5 py-2.5",children:b.jsx("p",{className:"text-red-400/90 text-[12px]",children:it})}),b.jsx("div",{className:"space-y-1.5",children:["Click the button below to open Anthropic's login page","Sign in with your Anthropic account — a code will be generated","Copy the code and paste it in the field below"].map((B,ot)=>b.jsxs("div",{className:"flex items-start gap-2",children:[b.jsx("span",{className:"flex-shrink-0 w-[18px] h-[18px] rounded-full bg-white/[0.06] text-white/30 text-[10px] font-medium flex items-center justify-center mt-px",children:ot+1}),b.jsx("p",{className:"text-white/40 text-[12px] leading-relaxed",children:B})]},ot))}),b.jsx("button",{onClick:us,className:"w-full py-2.5 px-4 bg-gradient-brand hover:opacity-90 text-white text-[13px] font-medium rounded-xl transition-colors flex items-center justify-center gap-2",children:X?b.jsxs(b.Fragment,{children:[b.jsx(Op,{className:"h-3.5 w-3.5 opacity-60"}),"Open authentication page again"]}):b.jsxs(b.Fragment,{children:["Authenticate with Anthropic",b.jsx(yn,{className:"h-3.5 w-3.5 opacity-60"})]})}),b.jsxs("div",{className:"relative",children:[b.jsx("input",{type:"text",value:K,onChange:B=>G(B.target.value),onKeyDown:B=>B.key==="Enter"&&Ja(),placeholder:"Paste your code here...",className:"w-full bg-white/[0.03] border border-white/[0.08] text-white rounded-xl px-4 py-2.5 text-[13px] outline-none input-glow placeholder:text-white/20 transition-all"+" pr-10 font-mono"}),b.jsx("button",{onClick:xa,className:"absolute right-3 top-1/2 -translate-y-1/2 text-white/20 hover:text-white/50 transition-colors",children:b.jsx(dx,{className:"h-3.5 w-3.5"})})]}),b.jsx("button",{onClick:Ja,disabled:!K.trim()||k,className:"w-full py-2.5 px-4 bg-gradient-brand hover:opacity-90 text-white text-[13px] font-medium rounded-xl transition-colors flex items-center justify-center gap-2 disabled:opacity-40",children:k?b.jsxs(b.Fragment,{children:[b.jsx(Vi,{className:"h-3.5 w-3.5 animate-spin"}),"Verifying..."]}):"Connect"}),b.jsxs("button",{onClick:Pu,disabled:F,className:"w-full py-1.5 text-white/25 text-[11px] hover:text-white/40 transition-colors flex items-center justify-center gap-1.5 disabled:opacity-50",children:[F?b.jsx(Vi,{className:"h-3 w-3 animate-spin"}):b.jsx(Ax,{className:"h-3 w-3"}),F?"Checking...":"I'm already authenticated"]})]})]}),g==="openai"&&b.jsxs("div",{className:"space-y-2.5",children:[Re&&b.jsx("div",{className:"bg-emerald-500/8 border border-emerald-500/15 rounded-lg px-3.5 py-2.5",children:b.jsx("p",{className:"text-emerald-400/90 text-[12px]",children:"Connected — ChatGPT subscription is active."})}),!Re&&b.jsxs(b.Fragment,{children:[Bt&&b.jsx("div",{className:"bg-red-500/8 border border-red-500/15 rounded-lg px-3.5 py-2.5",children:b.jsx("p",{className:"text-red-400/90 text-[12px]",children:Bt})}),b.jsx("div",{className:"space-y-1.5",children:["Click the button below — your browser will open for ChatGPT sign-in","Sign in with your ChatGPT Plus or Pro account","Authentication completes automatically — no code to copy"].map((B,ot)=>b.jsxs("div",{className:"flex items-start gap-2",children:[b.jsx("span",{className:"flex-shrink-0 w-[18px] h-[18px] rounded-full bg-white/[0.06] text-white/30 text-[10px] font-medium flex items-center justify-center mt-px",children:ot+1}),b.jsx("p",{className:"text-white/40 text-[12px] leading-relaxed",children:B})]},ot))}),b.jsx("button",{onClick:os,disabled:xt,className:"w-full py-2.5 px-4 bg-white/[0.06] hover:bg-white/[0.09] text-white text-[13px] font-medium rounded-xl transition-colors flex items-center justify-center gap-2 disabled:opacity-60",children:xt?b.jsxs(b.Fragment,{children:[b.jsx(Vi,{className:"h-3.5 w-3.5 animate-spin opacity-60"}),"Waiting for sign-in..."]}):b.jsxs(b.Fragment,{children:["Authenticate with ChatGPT",b.jsx(yn,{className:"h-3.5 w-3.5 opacity-60"})]})}),xt&&b.jsx("button",{onClick:rs,className:"w-full py-1.5 text-white/25 text-[11px] hover:text-white/40 transition-colors",children:"Cancel"})]})]}),Re&&b.jsxs(b.Fragment,{children:[b.jsx("div",{className:"border-t border-white/[0.06] mt-4 mb-3"}),b.jsx("label",{className:"text-[12px] text-white/40 font-medium mb-1.5 block",children:"Select a model"}),b.jsx(bA,{models:xA[g]||[],value:v,onChange:x})]}),Re&&b.jsxs("button",{onClick:cn,disabled:!Gn,className:"w-full mt-4 py-3 bg-gradient-brand hover:opacity-90 text-white text-[14px] font-semibold rounded-full transition-colors flex items-center justify-center gap-2 disabled:opacity-40",children:["Continue",b.jsx(yn,{className:"h-4 w-4"})]})]}),c===5&&b.jsxs("div",{children:[b.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[b.jsx("h1",{className:"text-xl font-bold text-white tracking-tight",children:"Voice Messages"}),b.jsx("span",{className:"text-[11px] text-white/25 font-medium bg-white/[0.04] border border-white/[0.06] rounded-full px-2.5 py-0.5",children:"Optional"})]}),b.jsx("p",{className:"text-white/40 text-[13px] mt-1 leading-relaxed",children:"Allow users to send audio messages that are automatically transcribed."}),b.jsx("button",{onClick:()=>ss(B=>!B),className:`w-full mt-5 rounded-xl border transition-all duration-200 p-4 text-left ${rn?"bg-white/[0.04] border-[#AF27E3]/40":"bg-transparent border-white/[0.06] hover:border-white/10 hover:bg-white/[0.02]"}`,children:b.jsxs("div",{className:"flex items-center gap-3.5",children:[b.jsx("img",{src:"/icons/openai.svg",alt:"OpenAI",className:"w-10 h-10 rounded-xl bg-white/[0.04] p-1.5"}),b.jsxs("div",{className:"flex-1",children:[b.jsx("div",{className:"text-[14px] font-medium text-white",children:"OpenAI Whisper"}),b.jsx("div",{className:"text-[12px] text-white/35 mt-0.5 leading-relaxed",children:"Speech-to-text powered by OpenAI. Requires an OpenAI API key."})]}),b.jsx("div",{className:`w-10 h-[22px] rounded-full transition-colors duration-200 flex items-center px-0.5 shrink-0 ${rn?"bg-gradient-brand":"bg-white/[0.08]"}`,children:b.jsx("div",{className:`w-[18px] h-[18px] rounded-full bg-white shadow-sm transition-transform duration-200 ${rn?"translate-x-[18px]":"translate-x-0"}`})})]})}),rn&&b.jsxs("div",{className:"mt-3",children:[b.jsx("label",{className:"text-[12px] text-white/40 font-medium mb-1.5 block",children:"OpenAI API Key"}),b.jsx("input",{type:"password",value:We,onChange:B=>ga(B.target.value.trim()),placeholder:"sk-...",autoComplete:"off",className:Ce+" font-mono text-[13px]"}),We.length>0&&!We.startsWith("sk-")&&b.jsx("p",{className:"text-amber-400/70 text-[11px] mt-1",children:"Key should start with sk-"}),We.length>0&&We.startsWith("sk-")&&We.length<20&&b.jsx("p",{className:"text-amber-400/70 text-[11px] mt-1",children:"Key looks too short"}),b.jsxs("div",{className:"flex items-start gap-2.5 mt-3 bg-white/[0.02] border border-white/[0.06] rounded-xl px-4 py-3",children:[b.jsx(Sx,{className:"h-4 w-4 text-[#AF27E3]/60 mt-0.5 shrink-0"}),b.jsx("p",{className:"text-white/35 text-[12px] leading-relaxed",children:"Users will see a microphone button in the chat. Audio is sent to OpenAI's Whisper API for transcription, then processed as a regular text message."})]})]}),b.jsx("button",{onClick:ce,disabled:T||rn&&(!We.startsWith("sk-")||We.length<20),className:"w-full mt-5 py-3 bg-gradient-brand hover:opacity-90 text-white text-[14px] font-semibold rounded-full transition-colors flex items-center justify-center gap-2 disabled:opacity-40",children:T?b.jsxs(b.Fragment,{children:[b.jsx(Vi,{className:"h-4 w-4 animate-spin"}),"Setting up..."]}):b.jsxs(b.Fragment,{children:["Complete Setup",b.jsx(yn,{className:"h-4 w-4"})]})}),!rn&&b.jsx("p",{className:"text-center text-white/20 text-[11px] mt-2.5",children:"You can enable this later in Settings."})]}),c===6&&l&&b.jsxs("div",{className:"flex flex-col items-center text-center",children:[b.jsx("div",{className:"w-16 h-16 rounded-full bg-emerald-500/10 border border-emerald-500/20 flex items-center justify-center mb-5",children:b.jsx(Ri,{className:"h-8 w-8 text-emerald-400"})}),b.jsx("h1",{className:"text-2xl font-bold text-white tracking-tight",children:"All Set!"}),b.jsx("p",{className:"text-white/40 text-[13px] mt-2 leading-relaxed max-w-[340px]",children:"Your agent is live and ready. From now on, access it using your custom URL below."}),b.jsxs("div",{className:"w-full mt-6 flex items-center gap-2 bg-white/[0.03] border border-white/[0.06] rounded-xl px-4 py-3",children:[b.jsx("span",{className:"font-mono text-[13px] text-white/70 truncate flex-1 text-left",children:Rt}),b.jsx("button",{onClick:()=>{const B=Rt.startsWith("http")?Rt:`https://${Rt}`;navigator.clipboard.writeText(B),ue(!0),setTimeout(()=>ue(!1),2e3)},className:"shrink-0 text-white/30 hover:text-white/60 transition-colors",children:Ju?b.jsx(Ri,{className:"h-4 w-4 text-emerald-400"}):b.jsxs("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[b.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2"}),b.jsx("path",{d:"M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1"})]})})]}),b.jsxs("div",{className:"w-full mt-3",children:[b.jsx("label",{className:"text-[12px] text-white/40 font-medium mb-1.5 block text-left",children:"Your password"}),b.jsxs("div",{className:"flex items-center gap-2 bg-white/[0.03] border border-white/[0.06] rounded-xl px-4 py-3",children:[b.jsx("span",{className:"font-mono text-[13px] text-white/70 truncate flex-1 text-left",children:ki?Ee:"•".repeat(Math.max(Ee.length,8))}),b.jsx("button",{onClick:()=>Qa(B=>!B),className:"shrink-0 text-white/30 hover:text-white/60 transition-colors",children:ki?b.jsx(yx,{className:"h-4 w-4"}):b.jsx(vx,{className:"h-4 w-4"})})]})]}),b.jsxs("button",{onClick:()=>{const B=Rt.startsWith("http")?Rt:`https://${Rt}`;(window.top||window).location.href=B},className:"w-full mt-6 py-3 bg-gradient-brand hover:opacity-90 text-white text-[14px] font-semibold rounded-full transition-colors flex items-center justify-center gap-2",children:["Go to your agent",b.jsx(Op,{className:"h-4 w-4"})]}),b.jsx("p",{className:"text-white/20 text-[11px] mt-3 leading-relaxed",children:"You'll be redirected to your custom URL."})]})]},c)}),c>0&&c<o-1&&!(c===6&&l)&&b.jsx("div",{className:"px-8 pb-5 -mt-3",children:b.jsx("button",{onClick:fn,className:"text-white/25 hover:text-white/50 text-[12px] transition-colors",children:"← Back"})})]})]})}export{yn as A,Vi as L,Sx as M,EA as O,SA as R,c2 as a,TA as b,bn as c,Py as g,b as j,Jy as m,U as r};
17
+ `),()=>{Z.contains(k)&&Z.removeChild(k)}},[l]),b.jsx(s2,{isPresent:l,childRef:p,sizeRef:g,pop:d,children:d===!1?i:U.cloneElement(i,{ref:x})})}const o2=({children:i,initial:l,isPresent:u,onExitComplete:o,custom:c,presenceAffectsLayout:d,mode:h,anchorX:p,anchorY:g,root:m})=>{const v=tf(r2),x=U.useId();let T=!0,N=U.useMemo(()=>(T=!1,{id:x,initial:l,isPresent:u,custom:c,onExitComplete:z=>{v.set(z,!0);for(const Y of v.values())if(!Y)return;o&&o()},register:z=>(v.set(z,!1),()=>v.delete(z))}),[u,v,o]);return d&&T&&(N={...N}),U.useMemo(()=>{v.forEach((z,Y)=>v.set(Y,!1))},[u]),U.useEffect(()=>{!u&&!v.size&&o&&o()},[u]),i=b.jsx(u2,{pop:h==="popLayout",isPresent:u,anchorX:p,anchorY:g,root:m,children:i}),b.jsx(Gu.Provider,{value:N,children:i})};function r2(){return new Map}function Cg(i=!0){const l=U.useContext(Gu);if(l===null)return[!0,null];const{isPresent:u,onExitComplete:o,register:c}=l,d=U.useId();U.useEffect(()=>{if(i)return c(d)},[i]);const h=U.useCallback(()=>i&&o&&o(d),[d,o,i]);return!u&&o?[!1,h]:[!0]}const Cu=i=>i.key||"";function Vy(i){const l=[];return U.Children.forEach(i,u=>{U.isValidElement(u)&&l.push(u)}),l}const c2=({children:i,custom:l,initial:u=!0,onExitComplete:o,presenceAffectsLayout:c=!0,mode:d="sync",propagate:h=!1,anchorX:p="left",anchorY:g="top",root:m})=>{const[v,x]=Cg(h),T=U.useMemo(()=>Vy(i),[i]),N=h&&!v?[]:T.map(Cu),z=U.useRef(!0),Y=U.useRef(T),X=tf(()=>new Map),q=U.useRef(new Set),[K,G]=U.useState(T),[k,Z]=U.useState(T);Iy(()=>{z.current=!1,Y.current=T;for(let F=0;F<k.length;F++){const lt=Cu(k[F]);N.includes(lt)?(X.delete(lt),q.current.delete(lt)):X.get(lt)!==!0&&X.set(lt,!1)}},[k,N.length,N.join("-")]);const it=[];if(T!==K){let F=[...T];for(let lt=0;lt<k.length;lt++){const xt=k[lt],At=Cu(xt);N.includes(At)||(F.splice(lt,0,xt),it.push(xt))}return d==="wait"&&it.length&&(F=it),Z(Vy(F)),G(T),null}const{forceRender:J}=U.useContext(Ic);return b.jsx(b.Fragment,{children:k.map(F=>{const lt=Cu(F),xt=h&&!v?!1:T===k||N.includes(lt),At=()=>{if(q.current.has(lt))return;if(q.current.add(lt),X.has(lt))X.set(lt,!0);else return;let Bt=!0;X.forEach(se=>{se||(Bt=!1)}),Bt&&(J?.(),Z(Y.current),h&&x?.(),o&&o())};return b.jsx(o2,{isPresent:xt,initial:!z.current||u?void 0:!1,custom:l,presenceAffectsLayout:c,mode:d,root:m,onExitComplete:xt?void 0:At,anchorX:p,anchorY:g,children:F},lt)})})},Mg=U.createContext({strict:!1}),_y={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]};let Uy=!1;function f2(){if(Uy)return;const i={};for(const l in _y)i[l]={isEnabled:u=>_y[l].some(o=>!!u[o])};eg(i),Uy=!0}function Dg(){return f2(),PS()}function h2(i){const l=Dg();for(const u in i)l[u]={...l[u],...i[u]};eg(l)}const d2=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","propagate","ignoreStrict","viewport"]);function qu(i){return i.startsWith("while")||i.startsWith("drag")&&i!=="draggable"||i.startsWith("layout")||i.startsWith("onTap")||i.startsWith("onPan")||i.startsWith("onLayout")||d2.has(i)}let wg=i=>!qu(i);function m2(i){typeof i=="function"&&(wg=l=>l.startsWith("on")?!qu(l):i(l))}try{m2(require("@emotion/is-prop-valid").default)}catch{}function p2(i,l,u){const o={};for(const c in i)c==="values"&&typeof i.values=="object"||(wg(c)||u===!0&&qu(c)||!l&&!qu(c)||i.draggable&&c.startsWith("onDrag"))&&(o[c]=i[c]);return o}const Qu=U.createContext({});function y2(i,l){if(Ku(i)){const{initial:u,animate:o}=i;return{initial:u===!1||Pl(u)?u:void 0,animate:Pl(o)?o:void 0}}return i.inherit!==!1?l:{}}function g2(i){const{initial:l,animate:u}=y2(i,U.useContext(Qu));return U.useMemo(()=>({initial:l,animate:u}),[By(l),By(u)])}function By(i){return Array.isArray(i)?i.join(" "):i}const Nf=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function Ng(i,l,u){for(const o in l)!de(l[o])&&!og(o,u)&&(i[o]=l[o])}function v2({transformTemplate:i},l){return U.useMemo(()=>{const u=Nf();return Mf(u,l,i),Object.assign({},u.vars,u.style)},[l])}function x2(i,l){const u=i.style||{},o={};return Ng(o,u,i),Object.assign(o,v2(i,l)),o}function b2(i,l){const u={},o=x2(i,l);return i.drag&&i.dragListener!==!1&&(u.draggable=!1,o.userSelect=o.WebkitUserSelect=o.WebkitTouchCallout="none",o.touchAction=i.drag===!0?"none":`pan-${i.drag==="x"?"y":"x"}`),i.tabIndex===void 0&&(i.onTap||i.onTapStart||i.whileTap)&&(u.tabIndex=0),u.style=o,u}const jg=()=>({...Nf(),attrs:{}});function S2(i,l,u,o){const c=U.useMemo(()=>{const d=jg();return rg(d,l,fg(o),i.transformTemplate,i.style),{...d.attrs,style:{...d.style}}},[l]);if(i.style){const d={};Ng(d,i.style,i),c.style={...d,...c.style}}return c}const T2=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function jf(i){return typeof i!="string"||i.includes("-")?!1:!!(T2.indexOf(i)>-1||/[A-Z]/u.test(i))}function A2(i,l,u,{latestValues:o},c,d=!1,h){const g=(h??jf(i)?S2:b2)(l,o,c,i),m=p2(l,typeof i=="string",d),v=i!==U.Fragment?{...m,...g,ref:u}:{},{children:x}=l,T=U.useMemo(()=>de(x)?x.get():x,[x]);return U.createElement(i,{...v,children:T})}function E2({scrapeMotionValuesFromProps:i,createRenderState:l},u,o,c){return{latestValues:C2(u,o,c,i),renderState:l()}}function C2(i,l,u,o){const c={},d=o(i,{});for(const T in d)c[T]=zu(d[T]);let{initial:h,animate:p}=i;const g=Ku(i),m=I0(i);l&&m&&!g&&i.inherit!==!1&&(h===void 0&&(h=l.initial),p===void 0&&(p=l.animate));let v=u?u.initial===!1:!1;v=v||h===!1;const x=v?p:h;if(x&&typeof x!="boolean"&&!Xu(x)){const T=Array.isArray(x)?x:[x];for(let N=0;N<T.length;N++){const z=vf(i,T[N]);if(z){const{transitionEnd:Y,transition:X,...q}=z;for(const K in q){let G=q[K];if(Array.isArray(G)){const k=v?G.length-1:0;G=G[k]}G!==null&&(c[K]=G)}for(const K in Y)c[K]=Y[K]}}}return c}const Og=i=>(l,u)=>{const o=U.useContext(Qu),c=U.useContext(Gu),d=()=>E2(i,l,o,c);return u?d():tf(d)},M2=Og({scrapeMotionValuesFromProps:Df,createRenderState:Nf}),D2=Og({scrapeMotionValuesFromProps:hg,createRenderState:jg}),w2=Symbol.for("motionComponentSymbol");function N2(i,l,u){const o=U.useRef(u);U.useInsertionEffect(()=>{o.current=u});const c=U.useRef(null);return U.useCallback(d=>{d&&i.onMount?.(d),l&&(d?l.mount(d):l.unmount());const h=o.current;if(typeof h=="function")if(d){const p=h(d);typeof p=="function"&&(c.current=p)}else c.current?(c.current(),c.current=null):h(d);else h&&(h.current=d)},[l])}const zg=U.createContext({});function _i(i){return i&&typeof i=="object"&&Object.prototype.hasOwnProperty.call(i,"current")}function j2(i,l,u,o,c,d){const{visualElement:h}=U.useContext(Qu),p=U.useContext(Mg),g=U.useContext(Gu),m=U.useContext(wf),v=m.reducedMotion,x=m.skipAnimations,T=U.useRef(null),N=U.useRef(!1);o=o||p.renderer,!T.current&&o&&(T.current=o(i,{visualState:l,parent:h,props:u,presenceContext:g,blockInitialAnimation:g?g.initial===!1:!1,reducedMotionConfig:v,skipAnimations:x,isSVG:d}),N.current&&T.current&&(T.current.manuallyAnimateOnMount=!0));const z=T.current,Y=U.useContext(zg);z&&!z.projection&&c&&(z.type==="html"||z.type==="svg")&&O2(T.current,u,c,Y);const X=U.useRef(!1);U.useInsertionEffect(()=>{z&&X.current&&z.update(u,g)});const q=u[Y0],K=U.useRef(!!q&&!window.MotionHandoffIsComplete?.(q)&&window.MotionHasOptimisedAnimation?.(q));return Iy(()=>{N.current=!0,z&&(X.current=!0,window.MotionIsMounted=!0,z.updateFeatures(),z.scheduleRenderMicrotask(),K.current&&z.animationState&&z.animationState.animateChanges())}),U.useEffect(()=>{z&&(!K.current&&z.animationState&&z.animationState.animateChanges(),K.current&&(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(q)}),K.current=!1),z.enteringChildren=void 0)}),z}function O2(i,l,u,o){const{layoutId:c,layout:d,drag:h,dragConstraints:p,layoutScroll:g,layoutRoot:m,layoutCrossfade:v}=l;i.projection=new u(i.latestValues,l["data-framer-portal-id"]?void 0:Rg(i.parent)),i.projection.setOptions({layoutId:c,layout:d,alwaysMeasureLayout:!!h||p&&_i(p),visualElement:i,animationType:typeof d=="string"?d:"both",initialPromotionConfig:o,crossfade:v,layoutScroll:g,layoutRoot:m})}function Rg(i){if(i)return i.options.allowProjection!==!1?i.projection:Rg(i.parent)}function Tc(i,{forwardMotionProps:l=!1,type:u}={},o,c){o&&h2(o);const d=u?u==="svg":jf(i),h=d?D2:M2;function p(m,v){let x;const T={...U.useContext(wf),...m,layoutId:z2(m)},{isStatic:N}=T,z=g2(m),Y=h(m,N);if(!N&&$y){R2();const X=V2(T);x=X.MeasureLayout,z.visualElement=j2(i,Y,T,c,X.ProjectionNode,d)}return b.jsxs(Qu.Provider,{value:z,children:[x&&z.visualElement?b.jsx(x,{visualElement:z.visualElement,...T}):null,A2(i,m,N2(Y,z.visualElement,v),Y,N,l,d)]})}p.displayName=`motion.${typeof i=="string"?i:`create(${i.displayName??i.name??""})`}`;const g=U.forwardRef(p);return g[w2]=i,g}function z2({layoutId:i}){const l=U.useContext(Ic).id;return l&&i!==void 0?l+"-"+i:i}function R2(i,l){U.useContext(Mg).strict}function V2(i){const l=Dg(),{drag:u,layout:o}=l;if(!u&&!o)return{};const c={...u,...o};return{MeasureLayout:u?.isEnabled(i)||o?.isEnabled(i)?c.MeasureLayout:void 0,ProjectionNode:c.ProjectionNode}}function _2(i,l){if(typeof Proxy>"u")return Tc;const u=new Map,o=(d,h)=>Tc(d,h,i,l),c=(d,h)=>o(d,h);return new Proxy(c,{get:(d,h)=>h==="create"?o:(u.has(h)||u.set(h,Tc(h,void 0,i,l)),u.get(h))})}const U2=(i,l)=>l.isSVG??jf(i)?new dT(l):new uT(l,{allowProjection:i!==U.Fragment});class B2 extends pa{constructor(l){super(l),l.animationState||(l.animationState=vT(l))}updateAnimationControlsSubscription(){const{animate:l}=this.node.getProps();Xu(l)&&(this.unmountControls=l.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:l}=this.node.getProps(),{animate:u}=this.node.prevProps||{};l!==u&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}}let L2=0;class H2 extends pa{constructor(){super(...arguments),this.id=L2++}update(){if(!this.node.presenceContext)return;const{isPresent:l,onExitComplete:u}=this.node.presenceContext,{isPresent:o}=this.node.prevPresenceContext||{};if(!this.node.animationState||l===o)return;const c=this.node.animationState.setActive("exit",!l);u&&!l&&c.then(()=>{u(this.id)})}mount(){const{register:l,onExitComplete:u}=this.node.presenceContext||{};u&&u(this.id),l&&(this.unmount=l(this.id))}unmount(){}}const Y2={animation:{Feature:B2},exit:{Feature:H2}};function es(i){return{point:{x:i.pageX,y:i.pageY}}}const q2=i=>l=>Tf(l)&&i(l,es(l));function Zl(i,l,u,o){return Wl(i,l,q2(u),o)}const Vg=({current:i})=>i?i.ownerDocument.defaultView:null,Ly=(i,l)=>Math.abs(i-l);function G2(i,l){const u=Ly(i.x,l.x),o=Ly(i.y,l.y);return Math.sqrt(u**2+o**2)}const Hy=new Set(["auto","scroll"]);class _g{constructor(l,u,{transformPagePoint:o,contextWindow:c=window,dragSnapToOrigin:d=!1,distanceThreshold:h=3,element:p}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=N=>{this.handleScroll(N.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const N=Ec(this.lastMoveEventInfo,this.history),z=this.startEvent!==null,Y=G2(N.offset,{x:0,y:0})>=this.distanceThreshold;if(!z&&!Y)return;const{point:X}=N,{timestamp:q}=le;this.history.push({...X,timestamp:q});const{onStart:K,onMove:G}=this.handlers;z||(K&&K(this.lastMoveEvent,N),this.startEvent=this.lastMoveEvent),G&&G(this.lastMoveEvent,N)},this.handlePointerMove=(N,z)=>{this.lastMoveEvent=N,this.lastMoveEventInfo=Ac(z,this.transformPagePoint),zt.update(this.updatePoint,!0)},this.handlePointerUp=(N,z)=>{this.end();const{onEnd:Y,onSessionEnd:X,resumeAnimation:q}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&q&&q(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const K=Ec(N.type==="pointercancel"?this.lastMoveEventInfo:Ac(z,this.transformPagePoint),this.history);this.startEvent&&Y&&Y(N,K),X&&X(N,K)},!Tf(l))return;this.dragSnapToOrigin=d,this.handlers=u,this.transformPagePoint=o,this.distanceThreshold=h,this.contextWindow=c||window;const g=es(l),m=Ac(g,this.transformPagePoint),{point:v}=m,{timestamp:x}=le;this.history=[{...v,timestamp:x}];const{onSessionStart:T}=u;T&&T(l,Ec(m,this.history)),this.removeListeners=$l(Zl(this.contextWindow,"pointermove",this.handlePointerMove),Zl(this.contextWindow,"pointerup",this.handlePointerUp),Zl(this.contextWindow,"pointercancel",this.handlePointerUp)),p&&this.startScrollTracking(p)}startScrollTracking(l){let u=l.parentElement;for(;u;){const o=getComputedStyle(u);(Hy.has(o.overflowX)||Hy.has(o.overflowY))&&this.scrollPositions.set(u,{x:u.scrollLeft,y:u.scrollTop}),u=u.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener("scroll",this.onElementScroll,{capture:!0}),window.addEventListener("scroll",this.onWindowScroll),this.removeScrollListeners=()=>{window.removeEventListener("scroll",this.onElementScroll,{capture:!0}),window.removeEventListener("scroll",this.onWindowScroll)}}handleScroll(l){const u=this.scrollPositions.get(l);if(!u)return;const o=l===window,c=o?{x:window.scrollX,y:window.scrollY}:{x:l.scrollLeft,y:l.scrollTop},d={x:c.x-u.x,y:c.y-u.y};d.x===0&&d.y===0||(o?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=d.x,this.lastMoveEventInfo.point.y+=d.y):this.history.length>0&&(this.history[0].x-=d.x,this.history[0].y-=d.y),this.scrollPositions.set(l,c),zt.update(this.updatePoint,!0))}updateHandlers(l){this.handlers=l}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),ma(this.updatePoint)}}function Ac(i,l){return l?{point:l(i.point)}:i}function Yy(i,l){return{x:i.x-l.x,y:i.y-l.y}}function Ec({point:i},l){return{point:i,delta:Yy(i,Ug(l)),offset:Yy(i,X2(l)),velocity:K2(l,.1)}}function X2(i){return i[0]}function Ug(i){return i[i.length-1]}function K2(i,l){if(i.length<2)return{x:0,y:0};let u=i.length-1,o=null;const c=Ug(i);for(;u>=0&&(o=i[u],!(c.timestamp-o.timestamp>ln(l)));)u--;if(!o)return{x:0,y:0};o===i[0]&&i.length>2&&c.timestamp-o.timestamp>ln(l)*2&&(o=i[1]);const d=Qe(c.timestamp-o.timestamp);if(d===0)return{x:0,y:0};const h={x:(c.x-o.x)/d,y:(c.y-o.y)/d};return h.x===1/0&&(h.x=0),h.y===1/0&&(h.y=0),h}function Q2(i,{min:l,max:u},o){return l!==void 0&&i<l?i=o?Lt(l,i,o.min):Math.max(i,l):u!==void 0&&i>u&&(i=o?Lt(u,i,o.max):Math.min(i,u)),i}function qy(i,l,u){return{min:l!==void 0?i.min+l:void 0,max:u!==void 0?i.max+u-(i.max-i.min):void 0}}function Z2(i,{top:l,left:u,bottom:o,right:c}){return{x:qy(i.x,u,c),y:qy(i.y,l,o)}}function Gy(i,l){let u=l.min-i.min,o=l.max-i.max;return l.max-l.min<i.max-i.min&&([u,o]=[o,u]),{min:u,max:o}}function k2(i,l){return{x:Gy(i.x,l.x),y:Gy(i.y,l.y)}}function J2(i,l){let u=.5;const o=ye(i),c=ye(l);return c>o?u=kl(l.min,l.max-o,i.min):o>c&&(u=kl(i.min,i.max-c,l.min)),xn(0,1,u)}function F2(i,l){const u={};return l.min!==void 0&&(u.min=l.min-i.min),l.max!==void 0&&(u.max=l.max-i.min),u}const Pc=.35;function P2(i=Pc){return i===!1?i=0:i===!0&&(i=Pc),{x:Xy(i,"left","right"),y:Xy(i,"top","bottom")}}function Xy(i,l,u){return{min:Ky(i,l),max:Ky(i,u)}}function Ky(i,l){return typeof i=="number"?i:i[l]||0}const W2=new WeakMap;class $2{constructor(l){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=$t(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=l}start(l,{snapToCursor:u=!1,distanceThreshold:o}={}){const{presenceContext:c}=this.visualElement;if(c&&c.isPresent===!1)return;const d=x=>{u&&this.snapToCursor(es(x).point),this.stopAnimation()},h=(x,T)=>{const{drag:N,dragPropagation:z,onDragStart:Y}=this.getProps();if(N&&!z&&(this.openDragLock&&this.openDragLock(),this.openDragLock=MS(N),!this.openDragLock))return;this.latestPointerEvent=x,this.latestPanInfo=T,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),gn(q=>{let K=this.getAxisMotionValue(q).get()||0;if(vn.test(K)){const{projection:G}=this.visualElement;if(G&&G.layout){const k=G.layout.layoutBox[q];k&&(K=ye(k)*(parseFloat(K)/100))}}this.originPoint[q]=K}),Y&&zt.update(()=>Y(x,T),!1,!0),qc(this.visualElement,"transform");const{animationState:X}=this.visualElement;X&&X.setActive("whileDrag",!0)},p=(x,T)=>{this.latestPointerEvent=x,this.latestPanInfo=T;const{dragPropagation:N,dragDirectionLock:z,onDirectionLock:Y,onDrag:X}=this.getProps();if(!N&&!this.openDragLock)return;const{offset:q}=T;if(z&&this.currentDirection===null){this.currentDirection=tA(q),this.currentDirection!==null&&Y&&Y(this.currentDirection);return}this.updateAxis("x",T.point,q),this.updateAxis("y",T.point,q),this.visualElement.render(),X&&zt.update(()=>X(x,T),!1,!0)},g=(x,T)=>{this.latestPointerEvent=x,this.latestPanInfo=T,this.stop(x,T),this.latestPointerEvent=null,this.latestPanInfo=null},m=()=>{const{dragSnapToOrigin:x}=this.getProps();(x||this.constraints)&&this.startAnimation({x:0,y:0})},{dragSnapToOrigin:v}=this.getProps();this.panSession=new _g(l,{onSessionStart:d,onStart:h,onMove:p,onSessionEnd:g,resumeAnimation:m},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:v,distanceThreshold:o,contextWindow:Vg(this.visualElement),element:this.visualElement.current})}stop(l,u){const o=l||this.latestPointerEvent,c=u||this.latestPanInfo,d=this.isDragging;if(this.cancel(),!d||!c||!o)return;const{velocity:h}=c;this.startAnimation(h);const{onDragEnd:p}=this.getProps();p&&zt.postRender(()=>p(o,c))}cancel(){this.isDragging=!1;const{projection:l,animationState:u}=this.visualElement;l&&(l.isAnimationBlocked=!1),this.endPanSession();const{dragPropagation:o}=this.getProps();!o&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),u&&u.setActive("whileDrag",!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(l,u,o){const{drag:c}=this.getProps();if(!o||!Mu(l,c,this.currentDirection))return;const d=this.getAxisMotionValue(l);let h=this.originPoint[l]+o[l];this.constraints&&this.constraints[l]&&(h=Q2(h,this.constraints[l],this.elastic[l])),d.set(h)}resolveConstraints(){const{dragConstraints:l,dragElastic:u}=this.getProps(),o=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,c=this.constraints;l&&_i(l)?this.constraints||(this.constraints=this.resolveRefConstraints()):l&&o?this.constraints=Z2(o.layoutBox,l):this.constraints=!1,this.elastic=P2(u),c!==this.constraints&&!_i(l)&&o&&this.constraints&&!this.hasMutatedConstraints&&gn(d=>{this.constraints!==!1&&this.getAxisMotionValue(d)&&(this.constraints[d]=F2(o.layoutBox[d],this.constraints[d]))})}resolveRefConstraints(){const{dragConstraints:l,onMeasureDragConstraints:u}=this.getProps();if(!l||!_i(l))return!1;const o=l.current,{projection:c}=this.visualElement;if(!c||!c.layout)return!1;const d=eT(o,c.root,this.visualElement.getTransformPagePoint());let h=k2(c.layout.layoutBox,d);if(u){const p=u($S(h));this.hasMutatedConstraints=!!p,p&&(h=ag(p))}return h}startAnimation(l){const{drag:u,dragMomentum:o,dragElastic:c,dragTransition:d,dragSnapToOrigin:h,onDragTransitionEnd:p}=this.getProps(),g=this.constraints||{},m=gn(v=>{if(!Mu(v,u,this.currentDirection))return;let x=g&&g[v]||{};h&&(x={min:0,max:0});const T=c?200:1e6,N=c?40:1e7,z={type:"inertia",velocity:o?l[v]:0,bounceStiffness:T,bounceDamping:N,timeConstant:750,restDelta:1,restSpeed:10,...d,...x};return this.startAxisValueAnimation(v,z)});return Promise.all(m).then(p)}startAxisValueAnimation(l,u){const o=this.getAxisMotionValue(l);return qc(this.visualElement,l),o.start(gf(l,o,0,u,this.visualElement,!1))}stopAnimation(){gn(l=>this.getAxisMotionValue(l).stop())}getAxisMotionValue(l){const u=`_drag${l.toUpperCase()}`,o=this.visualElement.getProps(),c=o[u];return c||this.visualElement.getValue(l,(o.initial?o.initial[l]:void 0)||0)}snapToCursor(l){gn(u=>{const{drag:o}=this.getProps();if(!Mu(u,o,this.currentDirection))return;const{projection:c}=this.visualElement,d=this.getAxisMotionValue(u);if(c&&c.layout){const{min:h,max:p}=c.layout.layoutBox[u],g=d.get()||0;d.set(l[u]-Lt(h,p,.5)+g)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:l,dragConstraints:u}=this.getProps(),{projection:o}=this.visualElement;if(!_i(u)||!o||!this.constraints)return;this.stopAnimation();const c={x:0,y:0};gn(h=>{const p=this.getAxisMotionValue(h);if(p&&this.constraints!==!1){const g=p.get();c[h]=J2({min:g,max:g},this.constraints[h])}});const{transformTemplate:d}=this.visualElement.getProps();this.visualElement.current.style.transform=d?d({},""):"none",o.root&&o.root.updateScroll(),o.updateLayout(),this.constraints=!1,this.resolveConstraints(),gn(h=>{if(!Mu(h,l,null))return;const p=this.getAxisMotionValue(h),{min:g,max:m}=this.constraints[h];p.set(Lt(g,m,c[h]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;W2.set(this.visualElement,this);const l=this.visualElement.current,u=Zl(l,"pointerdown",m=>{const{drag:v,dragListener:x=!0}=this.getProps(),T=m.target,N=T!==l&&zS(T);v&&x&&!N&&this.start(m)});let o;const c=()=>{const{dragConstraints:m}=this.getProps();_i(m)&&m.current&&(this.constraints=this.resolveRefConstraints(),o||(o=I2(l,m.current,()=>this.scalePositionWithinConstraints())))},{projection:d}=this.visualElement,h=d.addEventListener("measure",c);d&&!d.layout&&(d.root&&d.root.updateScroll(),d.updateLayout()),zt.read(c);const p=Wl(window,"resize",()=>this.scalePositionWithinConstraints()),g=d.addEventListener("didUpdate",(({delta:m,hasLayoutChanged:v})=>{this.isDragging&&v&&(gn(x=>{const T=this.getAxisMotionValue(x);T&&(this.originPoint[x]+=m[x].translate,T.set(T.get()+m[x].translate))}),this.visualElement.render())}));return()=>{p(),u(),h(),g&&g(),o&&o()}}getProps(){const l=this.visualElement.getProps(),{drag:u=!1,dragDirectionLock:o=!1,dragPropagation:c=!1,dragConstraints:d=!1,dragElastic:h=Pc,dragMomentum:p=!0}=l;return{...l,drag:u,dragDirectionLock:o,dragPropagation:c,dragConstraints:d,dragElastic:h,dragMomentum:p}}}function Qy(i){let l=!0;return()=>{if(l){l=!1;return}i()}}function I2(i,l,u){const o=$p(i,Qy(u)),c=$p(l,Qy(u));return()=>{o(),c()}}function Mu(i,l,u){return(l===!0||l===i)&&(u===null||u===i)}function tA(i,l=10){let u=null;return Math.abs(i.y)>l?u="y":Math.abs(i.x)>l&&(u="x"),u}class eA extends pa{constructor(l){super(l),this.removeGroupControls=Ze,this.removeListeners=Ze,this.controls=new $2(l)}mount(){const{dragControls:l}=this.node.getProps();l&&(this.removeGroupControls=l.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Ze}update(){const{dragControls:l}=this.node.getProps(),{dragControls:u}=this.node.prevProps||{};l!==u&&(this.removeGroupControls(),l&&(this.removeGroupControls=l.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}}const Cc=i=>(l,u)=>{i&&zt.update(()=>i(l,u),!1,!0)};class nA extends pa{constructor(){super(...arguments),this.removePointerDownListener=Ze}onPointerDown(l){this.session=new _g(l,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:Vg(this.node)})}createPanHandlers(){const{onPanSessionStart:l,onPanStart:u,onPan:o,onPanEnd:c}=this.node.getProps();return{onSessionStart:Cc(l),onStart:Cc(u),onMove:Cc(o),onEnd:(d,h)=>{delete this.session,c&&zt.postRender(()=>c(d,h))}}}mount(){this.removePointerDownListener=Zl(this.node.current,"pointerdown",l=>this.onPointerDown(l))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}let Mc=!1;class aA extends U.Component{componentDidMount(){const{visualElement:l,layoutGroup:u,switchLayoutGroup:o,layoutId:c}=this.props,{projection:d}=l;d&&(u.group&&u.group.add(d),o&&o.register&&c&&o.register(d),Mc&&d.root.didUpdate(),d.addEventListener("animationComplete",()=>{this.safeToRemove()}),d.setOptions({...d.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),Ru.hasEverUpdated=!0}getSnapshotBeforeUpdate(l){const{layoutDependency:u,visualElement:o,drag:c,isPresent:d}=this.props,{projection:h}=o;return h&&(h.isPresent=d,l.layoutDependency!==u&&h.setOptions({...h.options,layoutDependency:u}),Mc=!0,c||l.layoutDependency!==u||u===void 0||l.isPresent!==d?h.willUpdate():this.safeToRemove(),l.isPresent!==d&&(d?h.promote():h.relegate()||zt.postRender(()=>{const p=h.getStack();(!p||!p.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:l}=this.props.visualElement;l&&(l.root.didUpdate(),Sf.postRender(()=>{!l.currentAnimation&&l.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:l,layoutGroup:u,switchLayoutGroup:o}=this.props,{projection:c}=l;Mc=!0,c&&(c.scheduleCheckAfterUnmount(),u&&u.group&&u.group.remove(c),o&&o.deregister&&o.deregister(c))}safeToRemove(){const{safeToRemove:l}=this.props;l&&l()}render(){return null}}function Bg(i){const[l,u]=Cg(),o=U.useContext(Ic);return b.jsx(aA,{...i,layoutGroup:o,switchLayoutGroup:U.useContext(zg),isPresent:l,safeToRemove:u})}const iA={pan:{Feature:nA},drag:{Feature:eA,ProjectionNode:Eg,MeasureLayout:Bg}};function Zy(i,l,u){const{props:o}=i;i.animationState&&o.whileHover&&i.animationState.setActive("whileHover",u==="Start");const c="onHover"+u,d=o[c];d&&zt.postRender(()=>d(l,es(l)))}class lA extends pa{mount(){const{current:l}=this.node;l&&(this.unmount=wS(l,(u,o)=>(Zy(this.node,o,"Start"),c=>Zy(this.node,c,"End"))))}unmount(){}}class sA extends pa{constructor(){super(...arguments),this.isActive=!1}onFocus(){let l=!1;try{l=this.node.current.matches(":focus-visible")}catch{l=!0}!l||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=$l(Wl(this.node.current,"focus",()=>this.onFocus()),Wl(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function ky(i,l,u){const{props:o}=i;if(i.current instanceof HTMLButtonElement&&i.current.disabled)return;i.animationState&&o.whileTap&&i.animationState.setActive("whileTap",u==="Start");const c="onTap"+(u==="End"?"":u),d=o[c];d&&zt.postRender(()=>d(l,es(l)))}class uA extends pa{mount(){const{current:l}=this.node;if(!l)return;const{globalTapTarget:u,propagate:o}=this.node.props;this.unmount=VS(l,(c,d)=>(ky(this.node,d,"Start"),(h,{success:p})=>ky(this.node,h,p?"End":"Cancel")),{useGlobalTarget:u,stopPropagation:o?.tap===!1})}unmount(){}}const Wc=new WeakMap,Dc=new WeakMap,oA=i=>{const l=Wc.get(i.target);l&&l(i)},rA=i=>{i.forEach(oA)};function cA({root:i,...l}){const u=i||document;Dc.has(u)||Dc.set(u,{});const o=Dc.get(u),c=JSON.stringify(l);return o[c]||(o[c]=new IntersectionObserver(rA,{root:i,...l})),o[c]}function fA(i,l,u){const o=cA(l);return Wc.set(i,u),o.observe(i),()=>{Wc.delete(i),o.unobserve(i)}}const hA={some:0,all:1};class dA extends pa{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:l={}}=this.node.getProps(),{root:u,margin:o,amount:c="some",once:d}=l,h={root:u?u.current:void 0,rootMargin:o,threshold:typeof c=="number"?c:hA[c]},p=g=>{const{isIntersecting:m}=g;if(this.isInView===m||(this.isInView=m,d&&!m&&this.hasEnteredView))return;m&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",m);const{onViewportEnter:v,onViewportLeave:x}=this.node.getProps(),T=m?v:x;T&&T(g)};return fA(this.node.current,h,p)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:l,prevProps:u}=this.node;["amount","margin","root"].some(mA(l,u))&&this.startObserver()}unmount(){}}function mA({viewport:i={}},{viewport:l={}}={}){return u=>i[u]!==l[u]}const pA={inView:{Feature:dA},tap:{Feature:uA},focus:{Feature:sA},hover:{Feature:lA}},yA={layout:{ProjectionNode:Eg,MeasureLayout:Bg}},gA={...Y2,...pA,...iA,...yA},Jy=_2(gA,U2),vA=[{id:"anthropic",name:"Claude",subtitle:"by Anthropic",icon:"/icons/claude.png"},{id:"openai",name:"OpenAI Codex",subtitle:"ChatGPT Plus / Pro",icon:"/icons/codex.png"}],xA={anthropic:[{id:"claude-opus-4-6",label:"Opus 4.6"},{id:"claude-sonnet-4-6",label:"Sonnet 4.6"},{id:"claude-haiku-4-5-20251001",label:"Haiku 4.5"}],openai:[{id:"gpt-5.2-codex:medium",label:"GPT-5.2 Codex Medium"},{id:"gpt-5.2-codex:high",label:"GPT-5.2 Codex High"},{id:"gpt-5.2-codex:xhigh",label:"GPT-5.2 Codex Extra High"},{id:"gpt-5.3-codex:medium",label:"GPT-5.3 Codex Medium (Pro)"},{id:"gpt-5.3-codex:high",label:"GPT-5.3 Codex High (Pro)"},{id:"gpt-5.3-codex:xhigh",label:"GPT-5.3 Codex Extra High (Pro)"}]},Fy=[{tier:"premium",label:i=>`fluxy.bot/${i}`,badge:"$5",badgeCls:"bg-[#AF27E3]/15 text-[#AF27E3] border-[#AF27E3]/20",highlight:!0},{tier:"at",label:i=>`my.fluxy.bot/${i}`,badge:"Free",badgeCls:"bg-emerald-500/10 text-emerald-400 border-emerald-500/20",highlight:!1}];function bA({models:i,value:l,onChange:u}){const[o,c]=U.useState(!1),d=U.useRef(null);U.useEffect(()=>{if(!o)return;const p=g=>{d.current&&!d.current.contains(g.target)&&c(!1)};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[o]);const h=i.find(p=>p.id===l);return b.jsxs("div",{className:"relative",ref:d,children:[b.jsxs("button",{type:"button",onClick:()=>c(p=>!p),className:"w-full flex items-center justify-between bg-white/[0.03] border border-white/[0.08] text-white rounded-xl px-4 py-2.5 text-[13px] outline-none hover:border-white/15 focus:border-[#AF27E3]/30 transition-colors",children:[b.jsx("span",{className:h?"text-white":"text-white/20",children:h?h.label:"Choose a model..."}),b.jsx(fx,{className:`h-4 w-4 text-white/30 transition-transform ${o?"rotate-180":""}`})]}),o&&b.jsx("div",{className:"absolute left-0 right-0 top-full mt-1 bg-[#222] border border-white/[0.08] rounded-xl shadow-xl py-1 z-10 max-h-48 overflow-y-auto",children:i.map(p=>b.jsx("button",{onClick:()=>{u(p.id),c(!1)},className:`w-full text-left px-4 py-2 text-[13px] transition-colors ${l===p.id?"text-[#AF27E3] bg-[#AF27E3]/10":"text-white/70 hover:bg-white/[0.04] hover:text-white"}`,children:p.label},p.id))})]})}function EA({onComplete:i,isInitialSetup:l=!1,onSave:u}){const o=l?7:6,[c,d]=U.useState(0),[h,p]=U.useState(""),[g,m]=U.useState("anthropic"),[v,x]=U.useState(""),[T,N]=U.useState(!1),[z,Y]=U.useState({anthropic:"idle",openai:"idle"}),[X,q]=U.useState(!1),[K,G]=U.useState(""),[k,Z]=U.useState(!1),[it,J]=U.useState(),[F,lt]=U.useState(!1),[xt,At]=U.useState(!1),[Bt,se]=U.useState(),[Nt,Pt]=U.useState(""),[O,H]=U.useState(null),[$,ut]=U.useState(""),[ht,E]=U.useState({}),[V,Q]=U.useState("at"),[P,st]=U.useState(!1),[nt,dt]=U.useState(!1),[Rt,jt]=U.useState(""),ke=U.useRef(null),[ge,Ga]=U.useState(null),[Je,Fe]=U.useState(!1),[Xa,Ka]=U.useState(!1),[Zu,ns]=U.useState("admin"),[Ee,Zi]=U.useState(""),[ya,ku]=U.useState(""),[Ju,ue]=U.useState(!1),[un,as]=U.useState(!1),[ki,Qa]=U.useState(!1),[Ji,is]=U.useState(""),[ls,Za]=U.useState(""),[on,oe]=U.useState(!1),[Pe,re]=U.useState(!1),[rn,ss]=U.useState(!1),[We,ga]=U.useState(""),qn=U.useRef(!1),Re=z[g]==="connected";U.useEffect(()=>{fetch("/api/onboard/status").then(B=>B.json()).then(B=>{B.userName&&p(B.userName),B.handle&&(Pt(B.handle.username),Q(B.handle.tier||"at"),Ga({username:B.handle.username,tier:B.handle.tier,url:B.handle.url}),dt(!0),jt(B.handle.url)),B.portalUser&&ns(B.portalUser),B.portalConfigured&&as(!0),B.provider&&m(B.provider),B.model&&x(B.model),B.whisperEnabled&&(ss(!0),ga(B.whisperKey||"")),qn.current=!0}).catch(()=>{qn.current=!0})},[]),U.useEffect(()=>{g!=="anthropic"||z.anthropic==="connected"||fetch("/api/auth/claude/status").then(B=>B.json()).then(B=>{B.authenticated&&Y(ot=>({...ot,anthropic:"connected"}))}).catch(()=>{})},[g]),U.useEffect(()=>{g!=="openai"||z.openai==="connected"||fetch("/api/auth/codex/status").then(B=>B.json()).then(B=>{B.authenticated&&Y(ot=>({...ot,openai:"connected"}))}).catch(()=>{})},[g]),U.useEffect(()=>{if(!xt)return;const B=setInterval(async()=>{try{(await(await fetch("/api/auth/codex/status")).json()).authenticated&&(At(!1),Y(Ve=>({...Ve,openai:"connected"})))}catch{}},2e3);return()=>clearInterval(B)},[xt]),U.useEffect(()=>{if(ke.current&&clearTimeout(ke.current),!qn.current||ge&&nt&&Nt===ge.username)return;H(null),ut(""),E({}),dt(!1),jt("");const B=Nt.trim();if(B){if(B.length<3){H("invalid"),ut("At least 3 characters");return}return H("checking"),ke.current=setTimeout(async()=>{try{const fe=await(await fetch(`/api/handle/check/${encodeURIComponent(B)}`)).json();if(!fe.valid)H("invalid"),ut(fe.error);else{const Ve={};for(const $e of fe.handles)Ve[$e.tier]=$e.available;E(Ve),H("ready");const Pa=Fy.find($e=>Ve[$e.tier]);Pa&&!Ve[V]&&Q(Pa.tier)}}catch{H(null)}},400),()=>{ke.current&&clearTimeout(ke.current)}}},[Nt]);const Sn=B=>{Pt(B.toLowerCase().replace(/[^a-z0-9-]/g,""))},ka=async()=>{if(!(!Nt||O!=="ready"||!ht[V])){st(!0);try{const ot=await(await fetch("/api/handle/register",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:Nt,tier:V})})).json();ot.ok?(dt(!0),jt(ot.url)):(ut(ot.error||"Registration failed"),H("invalid"))}catch{ut("Could not reach server"),H("invalid")}finally{st(!1)}}},va=async()=>{if(!(!Nt||O!=="ready"||!ht[V])){Ka(!0);try{const ot=await(await fetch("/api/handle/change",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:Nt,tier:V})})).json();ot.ok?(dt(!0),jt(ot.url),Ga({username:Nt,tier:V,url:ot.url}),Fe(!1)):(ut(ot.error||"Handle change failed"),H("invalid"))}catch{ut("Could not reach server"),H("invalid")}finally{Ka(!1)}}},Fu=B=>{g==="openai"&&B!=="openai"&&xt&&(fetch("/api/auth/codex/cancel",{method:"POST"}),At(!1)),m(B),x(""),q(!1),G(""),J(void 0),At(!1),se(void 0)},us=async()=>{J(void 0);try{const ot=await(await fetch("/api/auth/claude/start",{method:"POST"})).json();ot.success&&ot.authUrl?(window.open(ot.authUrl,"_blank"),q(!0)):J(ot.error||"Failed to start authentication")}catch(B){J(B.message)}},Ja=async()=>{if(K.trim()){Z(!0),J(void 0);try{const ot=await(await fetch("/api/auth/claude/exchange",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:K.trim()})})).json();ot.success?Y(fe=>({...fe,anthropic:"connected"})):J(ot.error||"Code exchange failed")}catch(B){J(B.message)}finally{Z(!1)}}},xa=async()=>{try{const B=await navigator.clipboard.readText();B&&G(B.trim())}catch{}},Pu=async()=>{lt(!0),J(void 0);try{(await(await fetch("/api/auth/claude/status")).json()).authenticated?Y(fe=>({...fe,anthropic:"connected"})):J("No active session found. Please authenticate first.")}catch{}finally{lt(!1)}},os=async()=>{At(!0),se(void 0);try{const ot=await(await fetch("/api/auth/codex/start",{method:"POST"})).json();ot.success&&ot.authUrl?window.open(ot.authUrl,"_blank"):(At(!1),se(ot.error||"Failed to start authentication"))}catch(B){At(!1),se(B.message)}},rs=()=>{At(!1),fetch("/api/auth/codex/cancel",{method:"POST"})},Fi=Ee===ya,Fa=Ee.length>=6&&Fi,Pi=un?Ee.length===0||on&&Fa:Fa,Gn=(()=>{switch(c){case 0:return!0;case 1:return h.trim().length>0;case 2:return nt;case 3:return Pi;case 4:return!!(g&&v&&Re);case 5:return!0;default:return!1}})(),cn=()=>{Gn&&c<o-1&&d(B=>B+1)},fn=()=>{c>0&&d(B=>B-1)},Gt=B=>{B.key==="Enter"&&Gn&&cn()},ce=async()=>{N(!0);const B={userName:h.trim(),agentName:Nt.trim()||"Fluxy",provider:g,model:v,apiKey:"",whisperEnabled:rn,whisperKey:rn?We:"",portalUser:Zu.trim(),portalPass:Ee};try{u?await u(B):await fetch("/api/onboard",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(B)}),l?(N(!1),d(6)):i()}catch(ot){console.error("[OnboardWizard] Onboard failed:",ot),N(!1)}},Ce="w-full bg-white/[0.05] border border-white/[0.08] text-white rounded-xl px-4 py-3 text-base outline-none input-glow placeholder:text-white/20 transition-all";return b.jsxs("div",{className:"fixed inset-0 z-[200] flex items-center justify-center p-4",children:[b.jsx("div",{className:"absolute inset-0 bg-black/85 backdrop-blur-md"}),b.jsxs(Jy.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},transition:{duration:.3},className:"relative w-full max-w-[480px] bg-[#181818] border border-white/[0.06] rounded-[24px] shadow-2xl overflow-hidden",children:[b.jsx("div",{className:"flex justify-center gap-2 pt-6",children:Array.from({length:o},(B,ot)=>b.jsx("div",{className:`h-1.5 rounded-full transition-all duration-300 ${ot===c?"w-7 bg-gradient-brand":ot<c?"w-1.5 bg-gradient-brand opacity-60":"w-1.5 bg-white/10"}`},ot))}),b.jsx(c2,{mode:"wait",children:b.jsxs(Jy.div,{initial:{opacity:0,x:30},animate:{opacity:1,x:0},exit:{opacity:0,x:-30},transition:{duration:.2,ease:"easeOut"},className:"px-8 pt-6 pb-8",children:[c===0&&b.jsxs("div",{className:"flex flex-col items-center text-center",children:[b.jsx("video",{src:"/fluxy_say_hi.webm",autoPlay:!0,loop:!0,muted:!0,playsInline:!0,className:"h-[180px] mb-4"}),b.jsx("h1",{className:"text-2xl font-bold text-white tracking-tight",children:"Welcome to Fluxy"}),b.jsx("p",{className:"text-white/40 text-[14px] mt-2 leading-relaxed max-w-[320px]",children:"Let's set up your AI assistant in just a few steps."}),b.jsxs("button",{onClick:cn,className:"mt-6 px-7 py-3 bg-gradient-brand hover:opacity-90 text-white text-[14px] font-semibold rounded-full transition-colors flex items-center gap-2",children:["Get Started",b.jsx(yn,{className:"h-4 w-4"})]})]}),c===1&&b.jsxs("div",{children:[b.jsx("h1",{className:"text-xl font-bold text-white tracking-tight",children:"What's your name?"}),b.jsx("p",{className:"text-white/40 text-[13px] mt-1.5 leading-relaxed",children:"This is how your agent will address you."}),b.jsxs("div",{className:"mt-5 flex items-center gap-3",children:[b.jsx("input",{type:"text",value:h,onChange:B=>p(B.target.value),onKeyDown:Gt,placeholder:"Enter your name",autoFocus:!0,className:Ce+" flex-1"}),b.jsx("button",{onClick:cn,disabled:!Gn,className:"shrink-0 h-12 w-12 flex items-center justify-center rounded-full bg-gradient-brand hover:opacity-90 text-white transition-colors disabled:opacity-30",children:b.jsx(yn,{className:"h-5 w-5"})})]})]}),c===2&&b.jsxs("div",{children:[b.jsx("h1",{className:"text-xl font-bold text-white tracking-tight",children:"Name your bot"}),b.jsx("p",{className:"text-white/40 text-[13px] mt-1.5 leading-relaxed",children:"This is your bot's name and permanent handle — access it from anywhere."}),ge&&nt&&!Je&&b.jsxs(b.Fragment,{children:[b.jsxs("div",{className:"mt-4 bg-emerald-500/8 border border-emerald-500/15 rounded-xl px-4 py-3",children:[b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx(Ri,{className:"h-4 w-4 text-emerald-400"}),b.jsx("p",{className:"text-emerald-400/90 text-[13px] font-medium",children:"Current handle"})]}),b.jsx("p",{className:"text-emerald-400/60 text-[12px] mt-1 font-mono",children:Rt})]}),b.jsxs("div",{className:"flex gap-2 mt-4",children:[b.jsxs("button",{onClick:cn,className:"flex-1 py-3 bg-gradient-brand hover:opacity-90 text-white text-[14px] font-semibold rounded-full transition-colors flex items-center justify-center gap-2",children:["Continue",b.jsx(yn,{className:"h-4 w-4"})]}),b.jsx("button",{onClick:()=>{Fe(!0),dt(!1),Pt(""),H(null),E({})},className:"px-5 py-3 bg-white/[0.04] hover:bg-white/[0.08] border border-white/[0.08] text-white/60 text-[13px] font-medium rounded-full transition-colors",children:"Change"})]})]}),Je&&!nt&&b.jsxs("div",{className:"mt-4 bg-amber-500/8 border border-amber-500/20 rounded-xl px-4 py-3",children:[b.jsx("p",{className:"text-amber-400/90 text-[13px] font-medium",children:"Changing your handle"}),b.jsxs("p",{className:"text-amber-400/60 text-[12px] mt-1",children:["Your current handle ",b.jsx("span",{className:"font-mono",children:ge?.url})," will be released and become available for others."]})]}),(!ge||Je||!nt)&&!(ge&&nt&&!Je)&&b.jsxs(b.Fragment,{children:[b.jsxs("div",{className:"relative mt-5",children:[b.jsx("input",{type:"text",value:Nt,onChange:B=>Sn(B.target.value),maxLength:30,placeholder:"your-bot-name",spellCheck:!1,autoCapitalize:"none",autoCorrect:"off",autoFocus:!0,disabled:nt,className:Ce+" pr-10 font-mono"+(nt?" opacity-50":"")}),O&&Nt.length>0&&!nt&&b.jsxs("div",{className:"absolute right-4 top-1/2 -translate-y-1/2",children:[O==="checking"&&b.jsx("div",{className:"w-5 h-5 border-2 border-white/10 border-t-[#04D1FE] rounded-full animate-spin"}),O==="invalid"&&b.jsx("div",{className:"w-6 h-6 rounded-full bg-amber-500/15 flex items-center justify-center",children:b.jsx("svg",{className:"w-3.5 h-3.5 text-amber-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:3,children:b.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v3m0 4h.01"})})})]})]}),O==="invalid"&&$&&b.jsx("p",{className:"text-amber-400 text-[12px] mt-2",children:$}),O==="ready"&&Nt.length>0&&!nt&&b.jsx("div",{className:"space-y-2 mt-4",children:Fy.map(B=>{const fe=ht[B.tier]===!1;return b.jsxs("button",{onClick:()=>!fe&&Q(B.tier),disabled:fe,className:`w-full flex items-center justify-between px-4 py-3 rounded-xl border transition-all duration-200 text-left ${fe?"border-white/[0.04] bg-transparent opacity-50 cursor-not-allowed":V===B.tier?B.highlight?"border-[#AF27E3]/40 bg-[#AF27E3]/[0.06]":"border-[#AF27E3]/30 bg-white/[0.04]":"border-white/[0.06] bg-transparent hover:border-white/10 hover:bg-white/[0.02]"}`,children:[b.jsx("span",{className:"font-mono text-[13px] text-white/70",children:B.label(Nt)}),fe?b.jsx("span",{className:"text-[11px] font-medium px-2.5 py-0.5 rounded-full border bg-red-500/10 text-red-400 border-red-500/20",children:"Taken"}):b.jsx("span",{className:`text-[11px] font-medium px-2.5 py-0.5 rounded-full border ${B.badgeCls}`,children:B.badge})]},B.tier)})}),nt&&b.jsxs("div",{className:"mt-4 bg-emerald-500/8 border border-emerald-500/15 rounded-xl px-4 py-3",children:[b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx(Ri,{className:"h-4 w-4 text-emerald-400"}),b.jsx("p",{className:"text-emerald-400/90 text-[13px] font-medium",children:"Handle claimed!"})]}),b.jsx("p",{className:"text-emerald-400/60 text-[12px] mt-1 font-mono",children:Rt})]}),O==="ready"&&ht[V]&&Nt.length>0&&!nt&&b.jsx("button",{onClick:Je?va:ka,disabled:P||Xa,className:"w-full mt-4 py-3 bg-gradient-brand hover:opacity-90 text-white text-[14px] font-semibold rounded-full transition-colors flex items-center justify-center gap-2 disabled:opacity-40",children:P||Xa?b.jsxs(b.Fragment,{children:[b.jsx(Vi,{className:"h-4 w-4 animate-spin"}),Je?"Changing...":"Claiming..."]}):b.jsxs(b.Fragment,{children:[Je?"Change Handle":"Claim & Continue",b.jsx(yn,{className:"h-4 w-4"})]})}),nt&&b.jsxs("button",{onClick:cn,className:"w-full mt-4 py-3 bg-gradient-brand hover:opacity-90 text-white text-[14px] font-semibold rounded-full transition-colors flex items-center justify-center gap-2",children:["Continue",b.jsx(yn,{className:"h-4 w-4"})]}),Je&&!nt&&b.jsx("button",{onClick:()=>{Fe(!1),Pt(ge.username),dt(!0),jt(ge.url),Q(ge.tier),H(null)},className:"w-full mt-2 py-2 text-white/25 hover:text-white/40 text-[12px] transition-colors",children:"Cancel — keep current handle"})]})]}),c===3&&b.jsxs("div",{children:[b.jsx("h1",{className:"text-xl font-bold text-white tracking-tight",children:"Set a password"}),b.jsx("p",{className:"text-white/40 text-[13px] mt-1.5 leading-relaxed",children:"You'll need this password to access your agent's chat. Keep it safe — anyone with your URL will need it to log in."}),un&&b.jsx("div",{className:"mt-4 bg-white/[0.02] border border-white/[0.06] rounded-xl px-4 py-2.5",children:b.jsx("p",{className:"text-white/40 text-[12px]",children:"Password already set. Leave fields empty to keep your current password, or enter your current password to change it."})}),un&&b.jsxs("div",{className:"mt-5",children:[b.jsx("label",{className:"text-[12px] text-white/40 font-medium mb-1.5 block",children:"Current password"}),b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx("input",{type:"password",value:Ji,onChange:B=>{is(B.target.value),Za(""),oe(!1)},placeholder:"Enter current password to change it",autoComplete:"current-password",autoFocus:!0,className:Ce+" flex-1"}),Ji.length>0&&!on&&b.jsx("button",{onClick:async()=>{re(!0),Za("");try{(await(await fetch("/api/portal/verify-password",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({password:Ji})})).json()).valid?oe(!0):Za("Incorrect password")}catch{Za("Could not verify")}finally{re(!1)}},disabled:Pe,className:"shrink-0 px-4 py-3 bg-white/[0.06] hover:bg-white/[0.1] text-white/60 text-[13px] font-medium rounded-xl transition-colors disabled:opacity-40",children:Pe?b.jsx(Vi,{className:"h-4 w-4 animate-spin"}):"Verify"}),on&&b.jsx("div",{className:"shrink-0 w-10 h-10 flex items-center justify-center",children:b.jsx(Ri,{className:"h-4 w-4 text-emerald-400"})})]}),ls&&b.jsx("p",{className:"text-red-400/70 text-[11px] mt-1",children:ls})]}),(!un||on)&&b.jsxs(b.Fragment,{children:[b.jsxs("div",{className:un?"mt-3":"mt-5",children:[b.jsx("label",{className:"text-[12px] text-white/40 font-medium mb-1.5 block",children:un?"New password":"Password"}),b.jsx("input",{type:"password",value:Ee,onChange:B=>Zi(B.target.value),placeholder:"••••••••",autoComplete:"new-password",autoFocus:!un,onKeyDown:Gt,className:Ce}),Ee.length>0&&Ee.length<6&&b.jsx("p",{className:"text-amber-400/70 text-[11px] mt-1",children:"At least 6 characters"})]}),b.jsxs("div",{className:"mt-3",children:[b.jsx("label",{className:"text-[12px] text-white/40 font-medium mb-1.5 block",children:un?"Confirm new password":"Confirm password"}),b.jsx("input",{type:"password",value:ya,onChange:B=>ku(B.target.value),placeholder:"••••••••",autoComplete:"new-password",onKeyDown:Gt,className:Ce}),ya.length>0&&!Fi&&b.jsx("p",{className:"text-red-400/70 text-[11px] mt-1",children:"Passwords don't match"})]})]}),b.jsxs("button",{onClick:cn,disabled:!Gn,className:"w-full mt-5 py-3 bg-gradient-brand hover:opacity-90 text-white text-[14px] font-semibold rounded-full transition-colors flex items-center justify-center gap-2 disabled:opacity-40",children:["Continue",b.jsx(yn,{className:"h-4 w-4"})]})]}),c===4&&b.jsxs("div",{children:[b.jsx("h1",{className:"text-xl font-bold text-white tracking-tight",children:"Choose your AI provider"}),b.jsx("p",{className:"text-white/40 text-[13px] mt-1.5 leading-relaxed",children:"Pick one provider to power your bot, authenticate, and select a model."}),b.jsx("div",{className:"flex gap-2.5 mt-4",children:vA.map(B=>b.jsxs("button",{onClick:()=>Fu(B.id),className:`flex-1 relative rounded-xl border transition-all duration-200 p-3 text-left ${g===B.id?"bg-white/[0.04] border-[#AF27E3]/40":"bg-transparent border-white/[0.06] hover:border-white/10 hover:bg-white/[0.02]"}`,children:[b.jsxs("div",{className:"flex flex-col items-center gap-1.5 py-0.5",children:[B.icon?b.jsx("img",{src:B.icon,alt:B.name,className:"w-8 h-8 rounded-lg"}):b.jsx("div",{className:"w-8 h-8 rounded-lg bg-white/[0.06] flex items-center justify-center text-white/50 text-sm font-bold",children:"O"}),b.jsxs("div",{className:"text-center",children:[b.jsx("div",{className:"text-[13px] font-medium text-white",children:B.name}),b.jsx("div",{className:"text-[10px] text-white/30",children:B.subtitle})]})]}),z[B.id]==="connected"?b.jsx("div",{className:"absolute top-2 right-2 w-4 h-4 rounded-full bg-emerald-500/15 flex items-center justify-center",children:b.jsx(Ri,{className:"h-2.5 w-2.5 text-emerald-400"})}):g===B.id?b.jsx("div",{className:"absolute top-2 right-2 w-2 h-2 rounded-full bg-gradient-brand"}):null]},B.id))}),b.jsx("div",{className:"border-t border-white/[0.06] mt-4 mb-3"}),g==="anthropic"&&b.jsxs("div",{className:"space-y-2.5",children:[Re&&b.jsx("div",{className:"bg-emerald-500/8 border border-emerald-500/15 rounded-lg px-3.5 py-2.5",children:b.jsx("p",{className:"text-emerald-400/90 text-[12px]",children:"Connected — Anthropic subscription is active."})}),!Re&&b.jsxs(b.Fragment,{children:[it&&b.jsx("div",{className:"bg-red-500/8 border border-red-500/15 rounded-lg px-3.5 py-2.5",children:b.jsx("p",{className:"text-red-400/90 text-[12px]",children:it})}),b.jsx("div",{className:"space-y-1.5",children:["Click the button below to open Anthropic's login page","Sign in with your Anthropic account — a code will be generated","Copy the code and paste it in the field below"].map((B,ot)=>b.jsxs("div",{className:"flex items-start gap-2",children:[b.jsx("span",{className:"flex-shrink-0 w-[18px] h-[18px] rounded-full bg-white/[0.06] text-white/30 text-[10px] font-medium flex items-center justify-center mt-px",children:ot+1}),b.jsx("p",{className:"text-white/40 text-[12px] leading-relaxed",children:B})]},ot))}),b.jsx("button",{onClick:us,className:"w-full py-2.5 px-4 bg-gradient-brand hover:opacity-90 text-white text-[13px] font-medium rounded-xl transition-colors flex items-center justify-center gap-2",children:X?b.jsxs(b.Fragment,{children:[b.jsx(Op,{className:"h-3.5 w-3.5 opacity-60"}),"Open authentication page again"]}):b.jsxs(b.Fragment,{children:["Authenticate with Anthropic",b.jsx(yn,{className:"h-3.5 w-3.5 opacity-60"})]})}),b.jsxs("div",{className:"relative",children:[b.jsx("input",{type:"text",value:K,onChange:B=>G(B.target.value),onKeyDown:B=>B.key==="Enter"&&Ja(),placeholder:"Paste your code here...",className:"w-full bg-white/[0.03] border border-white/[0.08] text-white rounded-xl px-4 py-2.5 text-[13px] outline-none input-glow placeholder:text-white/20 transition-all"+" pr-10 font-mono"}),b.jsx("button",{onClick:xa,className:"absolute right-3 top-1/2 -translate-y-1/2 text-white/20 hover:text-white/50 transition-colors",children:b.jsx(dx,{className:"h-3.5 w-3.5"})})]}),b.jsx("button",{onClick:Ja,disabled:!K.trim()||k,className:"w-full py-2.5 px-4 bg-gradient-brand hover:opacity-90 text-white text-[13px] font-medium rounded-xl transition-colors flex items-center justify-center gap-2 disabled:opacity-40",children:k?b.jsxs(b.Fragment,{children:[b.jsx(Vi,{className:"h-3.5 w-3.5 animate-spin"}),"Verifying..."]}):"Connect"}),b.jsxs("button",{onClick:Pu,disabled:F,className:"w-full py-1.5 text-white/25 text-[11px] hover:text-white/40 transition-colors flex items-center justify-center gap-1.5 disabled:opacity-50",children:[F?b.jsx(Vi,{className:"h-3 w-3 animate-spin"}):b.jsx(Ax,{className:"h-3 w-3"}),F?"Checking...":"I'm already authenticated"]})]})]}),g==="openai"&&b.jsxs("div",{className:"space-y-2.5",children:[Re&&b.jsx("div",{className:"bg-emerald-500/8 border border-emerald-500/15 rounded-lg px-3.5 py-2.5",children:b.jsx("p",{className:"text-emerald-400/90 text-[12px]",children:"Connected — ChatGPT subscription is active."})}),!Re&&b.jsxs(b.Fragment,{children:[Bt&&b.jsx("div",{className:"bg-red-500/8 border border-red-500/15 rounded-lg px-3.5 py-2.5",children:b.jsx("p",{className:"text-red-400/90 text-[12px]",children:Bt})}),b.jsx("div",{className:"space-y-1.5",children:["Click the button below — your browser will open for ChatGPT sign-in","Sign in with your ChatGPT Plus or Pro account","Authentication completes automatically — no code to copy"].map((B,ot)=>b.jsxs("div",{className:"flex items-start gap-2",children:[b.jsx("span",{className:"flex-shrink-0 w-[18px] h-[18px] rounded-full bg-white/[0.06] text-white/30 text-[10px] font-medium flex items-center justify-center mt-px",children:ot+1}),b.jsx("p",{className:"text-white/40 text-[12px] leading-relaxed",children:B})]},ot))}),b.jsx("button",{onClick:os,disabled:xt,className:"w-full py-2.5 px-4 bg-white/[0.06] hover:bg-white/[0.09] text-white text-[13px] font-medium rounded-xl transition-colors flex items-center justify-center gap-2 disabled:opacity-60",children:xt?b.jsxs(b.Fragment,{children:[b.jsx(Vi,{className:"h-3.5 w-3.5 animate-spin opacity-60"}),"Waiting for sign-in..."]}):b.jsxs(b.Fragment,{children:["Authenticate with ChatGPT",b.jsx(yn,{className:"h-3.5 w-3.5 opacity-60"})]})}),xt&&b.jsx("button",{onClick:rs,className:"w-full py-1.5 text-white/25 text-[11px] hover:text-white/40 transition-colors",children:"Cancel"})]})]}),Re&&b.jsxs(b.Fragment,{children:[b.jsx("div",{className:"border-t border-white/[0.06] mt-4 mb-3"}),b.jsx("label",{className:"text-[12px] text-white/40 font-medium mb-1.5 block",children:"Select a model"}),b.jsx(bA,{models:xA[g]||[],value:v,onChange:x})]}),Re&&b.jsxs("button",{onClick:cn,disabled:!Gn,className:"w-full mt-4 py-3 bg-gradient-brand hover:opacity-90 text-white text-[14px] font-semibold rounded-full transition-colors flex items-center justify-center gap-2 disabled:opacity-40",children:["Continue",b.jsx(yn,{className:"h-4 w-4"})]})]}),c===5&&b.jsxs("div",{children:[b.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[b.jsx("h1",{className:"text-xl font-bold text-white tracking-tight",children:"Voice Messages"}),b.jsx("span",{className:"text-[11px] text-white/25 font-medium bg-white/[0.04] border border-white/[0.06] rounded-full px-2.5 py-0.5",children:"Optional"})]}),b.jsx("p",{className:"text-white/40 text-[13px] mt-1 leading-relaxed",children:"Allow users to send audio messages that are automatically transcribed."}),b.jsx("button",{onClick:()=>ss(B=>!B),className:`w-full mt-5 rounded-xl border transition-all duration-200 p-4 text-left ${rn?"bg-white/[0.04] border-[#AF27E3]/40":"bg-transparent border-white/[0.06] hover:border-white/10 hover:bg-white/[0.02]"}`,children:b.jsxs("div",{className:"flex items-center gap-3.5",children:[b.jsx("img",{src:"/icons/openai.svg",alt:"OpenAI",className:"w-10 h-10 rounded-xl bg-white/[0.04] p-1.5"}),b.jsxs("div",{className:"flex-1",children:[b.jsx("div",{className:"text-[14px] font-medium text-white",children:"OpenAI Whisper"}),b.jsx("div",{className:"text-[12px] text-white/35 mt-0.5 leading-relaxed",children:"Speech-to-text powered by OpenAI. Requires an OpenAI API key."})]}),b.jsx("div",{className:`w-10 h-[22px] rounded-full transition-colors duration-200 flex items-center px-0.5 shrink-0 ${rn?"bg-gradient-brand":"bg-white/[0.08]"}`,children:b.jsx("div",{className:`w-[18px] h-[18px] rounded-full bg-white shadow-sm transition-transform duration-200 ${rn?"translate-x-[18px]":"translate-x-0"}`})})]})}),rn&&b.jsxs("div",{className:"mt-3",children:[b.jsx("label",{className:"text-[12px] text-white/40 font-medium mb-1.5 block",children:"OpenAI API Key"}),b.jsx("input",{type:"password",value:We,onChange:B=>ga(B.target.value.trim()),placeholder:"sk-...",autoComplete:"off",className:Ce+" font-mono text-[13px]"}),We.length>0&&!We.startsWith("sk-")&&b.jsx("p",{className:"text-amber-400/70 text-[11px] mt-1",children:"Key should start with sk-"}),We.length>0&&We.startsWith("sk-")&&We.length<20&&b.jsx("p",{className:"text-amber-400/70 text-[11px] mt-1",children:"Key looks too short"}),b.jsxs("div",{className:"flex items-start gap-2.5 mt-3 bg-white/[0.02] border border-white/[0.06] rounded-xl px-4 py-3",children:[b.jsx(Sx,{className:"h-4 w-4 text-[#AF27E3]/60 mt-0.5 shrink-0"}),b.jsx("p",{className:"text-white/35 text-[12px] leading-relaxed",children:"Users will see a microphone button in the chat. Audio is sent to OpenAI's Whisper API for transcription, then processed as a regular text message."})]})]}),b.jsx("button",{onClick:ce,disabled:T||rn&&(!We.startsWith("sk-")||We.length<20),className:"w-full mt-5 py-3 bg-gradient-brand hover:opacity-90 text-white text-[14px] font-semibold rounded-full transition-colors flex items-center justify-center gap-2 disabled:opacity-40",children:T?b.jsxs(b.Fragment,{children:[b.jsx(Vi,{className:"h-4 w-4 animate-spin"}),"Setting up..."]}):b.jsxs(b.Fragment,{children:["Complete Setup",b.jsx(yn,{className:"h-4 w-4"})]})}),!rn&&b.jsx("p",{className:"text-center text-white/20 text-[11px] mt-2.5",children:"You can enable this later in Settings."})]}),c===6&&l&&b.jsxs("div",{className:"flex flex-col items-center text-center",children:[b.jsx("div",{className:"w-16 h-16 rounded-full bg-emerald-500/10 border border-emerald-500/20 flex items-center justify-center mb-5",children:b.jsx(Ri,{className:"h-8 w-8 text-emerald-400"})}),b.jsx("h1",{className:"text-2xl font-bold text-white tracking-tight",children:"All Set!"}),b.jsx("p",{className:"text-white/40 text-[13px] mt-2 leading-relaxed max-w-[340px]",children:"Your agent is live and ready. From now on, access it using your custom URL below."}),b.jsxs("div",{className:"w-full mt-6 flex items-center gap-2 bg-white/[0.03] border border-white/[0.06] rounded-xl px-4 py-3",children:[b.jsx("span",{className:"font-mono text-[13px] text-white/70 truncate flex-1 text-left",children:Rt}),b.jsx("button",{onClick:()=>{const B=Rt.startsWith("http")?Rt:`https://${Rt}`;navigator.clipboard.writeText(B),ue(!0),setTimeout(()=>ue(!1),2e3)},className:"shrink-0 text-white/30 hover:text-white/60 transition-colors",children:Ju?b.jsx(Ri,{className:"h-4 w-4 text-emerald-400"}):b.jsxs("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[b.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2"}),b.jsx("path",{d:"M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1"})]})})]}),b.jsxs("div",{className:"w-full mt-3",children:[b.jsx("label",{className:"text-[12px] text-white/40 font-medium mb-1.5 block text-left",children:"Your password"}),b.jsxs("div",{className:"flex items-center gap-2 bg-white/[0.03] border border-white/[0.06] rounded-xl px-4 py-3",children:[b.jsx("span",{className:"font-mono text-[13px] text-white/70 truncate flex-1 text-left",children:ki?Ee:"•".repeat(Math.max(Ee.length,8))}),b.jsx("button",{onClick:()=>Qa(B=>!B),className:"shrink-0 text-white/30 hover:text-white/60 transition-colors",children:ki?b.jsx(yx,{className:"h-4 w-4"}):b.jsx(vx,{className:"h-4 w-4"})})]})]}),b.jsxs("button",{onClick:()=>{const B=Rt.startsWith("http")?Rt:`https://${Rt}`;(window.top||window).location.href=B},className:"w-full mt-6 py-3 bg-gradient-brand hover:opacity-90 text-white text-[14px] font-semibold rounded-full transition-colors flex items-center justify-center gap-2",children:["Go to your agent",b.jsx(Op,{className:"h-4 w-4"})]}),b.jsx("p",{className:"text-white/20 text-[11px] mt-3 leading-relaxed",children:"You'll be redirected to your custom URL."})]})]},c)}),c>0&&c<o-1&&!(c===6&&l)&&b.jsx("div",{className:"px-8 pb-5 -mt-3",children:b.jsx("button",{onClick:fn,className:"text-white/25 hover:text-white/50 text-[12px] transition-colors",children:"← Back"})})]})]})}export{yn as A,Vi as L,Sx as M,EA as O,SA as R,c2 as a,TA as b,bn as c,Py as g,b as j,Jy as m,U as r};
@@ -1 +1 @@
1
- import{b as o,j as e,R as n,O as r}from"./globals-BmcQJ_1f.js";function a(){const t=()=>{window.parent?.postMessage({type:"fluxy:onboard-complete"},"*")};return e.jsx(r,{onComplete:t,isInitialSetup:!0})}o.createRoot(document.getElementById("root")).render(e.jsx(n.StrictMode,{children:e.jsx(a,{})}));
1
+ import{b as o,j as e,R as n,O as r}from"./globals-Bs_8hHwU.js";function a(){const t=()=>{window.parent?.postMessage({type:"fluxy:onboard-complete"},"*")};return e.jsx(r,{onComplete:t,isInitialSetup:!0})}o.createRoot(document.getElementById("root")).render(e.jsx(n.StrictMode,{children:e.jsx(a,{})}));
@@ -4,8 +4,8 @@
4
4
  <meta charset="UTF-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0, interactive-widget=resizes-content" />
6
6
  <title>Fluxy Chat</title>
7
- <script type="module" crossorigin src="/fluxy/assets/fluxy-BXld9bgF.js"></script>
8
- <link rel="modulepreload" crossorigin href="/fluxy/assets/globals-BmcQJ_1f.js">
7
+ <script type="module" crossorigin src="/fluxy/assets/fluxy-C1pMuYez.js"></script>
8
+ <link rel="modulepreload" crossorigin href="/fluxy/assets/globals-Bs_8hHwU.js">
9
9
  <link rel="stylesheet" crossorigin href="/fluxy/assets/globals-BdY9BJIP.css">
10
10
  </head>
11
11
  <body class="bg-background text-foreground">
@@ -4,8 +4,8 @@
4
4
  <meta charset="UTF-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0, interactive-widget=resizes-content" />
6
6
  <title>Fluxy Setup</title>
7
- <script type="module" crossorigin src="/fluxy/assets/onboard-Cp7fEIFC.js"></script>
8
- <link rel="modulepreload" crossorigin href="/fluxy/assets/globals-BmcQJ_1f.js">
7
+ <script type="module" crossorigin src="/fluxy/assets/onboard-DPS-PRxn.js"></script>
8
+ <link rel="modulepreload" crossorigin href="/fluxy/assets/globals-Bs_8hHwU.js">
9
9
  <link rel="stylesheet" crossorigin href="/fluxy/assets/globals-BdY9BJIP.css">
10
10
  </head>
11
11
  <body class="bg-background text-foreground">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fluxy-bot",
3
- "version": "0.4.11",
3
+ "version": "0.4.13",
4
4
  "description": "Self-hosted, self-evolving AI agent with its own dashboard.",
5
5
  "type": "module",
6
6
  "license": "MIT",