moi-computer 0.12.1-next.2 → 0.12.1-next.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/client/app/app-router.tsx +2 -0
- package/client/app/routes/settings-route.tsx +10 -0
- package/client/app/shell/sidebar-layout.tsx +34 -53
- package/client/features/account/account-menu.tsx +96 -0
- package/client/features/account/account-provider.tsx +142 -0
- package/client/features/account/account-test-utils.tsx +293 -0
- package/client/features/account/api.ts +142 -0
- package/client/features/account/identity.ts +23 -0
- package/client/features/collab/applet-api.ts +15 -14
- package/client/features/collab/components/cursors.tsx +61 -24
- package/client/features/collab/components/presence-avatars.tsx +25 -12
- package/client/features/collab/components/presence-frame.tsx +20 -24
- package/client/features/collab/components/presence-group.tsx +15 -7
- package/client/features/collab/components/user-avatar-group.tsx +21 -8
- package/client/features/collab/components/user-avatar.tsx +38 -7
- package/client/features/collab/components/user.tsx +31 -12
- package/client/features/collab/users.ts +0 -5
- package/client/features/collab/workspace-users-menu.tsx +3 -3
- package/client/features/dev/collab/collab-playground.tsx +7 -7
- package/client/features/dev/collab/local-user-settings.tsx +7 -53
- package/client/features/settings/connectors-settings.tsx +3 -3
- package/client/features/settings/environment-settings.tsx +3 -3
- package/client/features/settings/general-settings.tsx +1 -1
- package/client/features/settings/profile-settings.tsx +95 -0
- package/client/features/settings/settings-page.tsx +44 -0
- package/client/features/settings/settings-section.tsx +26 -0
- package/client/features/settings/users-settings.tsx +195 -0
- package/client/features/update/update-control.tsx +1 -1
- package/client/features/workspace/add/create-workspace-dialog.tsx +5 -2
- package/client/lib/user-display-name.ts +6 -0
- package/client/main.tsx +4 -1
- package/dist/{chunk-vt6zybej.js → chunk-20ynagd4.js} +2 -2
- package/dist/chunk-42tde9a6.js +1 -0
- package/dist/{chunk-hmka9rt5.js → chunk-9w543s0r.js} +2 -2
- package/dist/{chunk-y8nbwp21.js → chunk-a5372n61.js} +2 -2
- package/dist/chunk-aja9y1vn.js +68 -0
- package/dist/chunk-fvcvrh3d.css +1 -0
- package/dist/{chunk-ysfdcew7.js → chunk-gtfjw3nx.js} +1 -1
- package/dist/{chunk-hvh9f5h0.js → chunk-j39y2aky.js} +1 -1
- package/dist/chunk-pja30km3.js +1 -0
- package/dist/{chunk-d7cbm65e.js → chunk-rm894bc2.js} +1 -1
- package/dist/chunk-tevvtfbk.js +10 -0
- package/dist/{chunk-am4agx6v.js → chunk-tgt9zd0r.js} +1 -1
- package/dist/chunk-tv5k5z00.js +1 -0
- package/dist/chunk-zq2ae5dx.js +2 -0
- package/dist/index.html +1 -1
- package/lib/types.ts +1 -1
- package/package.json +1 -1
- package/server/api/index.ts +2 -6
- package/server/app-config.ts +7 -0
- package/server/web.ts +1 -0
- package/server/workspaces/init.ts +0 -10
- package/server/workspaces/registry.ts +31 -9
- package/dist/chunk-00rh9df4.js +0 -2
- package/dist/chunk-4nh7y1hq.css +0 -1
- package/dist/chunk-hbpdv7vd.js +0 -1
- package/dist/chunk-mjjregkn.js +0 -10
- package/dist/chunk-rt30jbcm.js +0 -1
- package/dist/chunk-wbkwf6cc.js +0 -68
- package/dist/chunk-xjyfyz64.js +0 -1
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import{$ as BU,$a as Ek,A as h8,Aa as jb,Ab as pY,Ac as nU,B as d2,Ba as Kk,Bc as QR,C as oB,Ca as Wk,Cb as fk,Cc as K5,D as v8,Da as Nk,Db as cY,Dc as FR,E as BJ,Ea as TN,Eb as Qu,Ec as KR,F as PD,Fa as qk,Fb as gk,Fc as d1,G as m0,Ga as Ak,Gb as Ur,Gc as Pe,H as l2,Ha as Dk,Hb as c_,Hc as q5,I as Tf,Ia as Vk,Ib as Yr,Ic as fR,J as K2,Ja as Lk,Jb as pN,Jc as P2,K as G0,Ka as mY,Kb as mk,Kc as zt,L as yn,La as nR,Lb as t2,Lc as Y3,M as BH,Ma as VW,Mb as JR,N as ZH,Na as yf,Nb as Ls,O as w5,Ob as uk,P as QT,Pa as Mk,Pb as pk,Q as Q0,Qa as AW,Qb as Cv,R as r6,Ra as lJ,Rb as TH,S as d0,Sa as Pk,Sb as F3,T as M9,Ta as _k,Tb as ck,U as L0,Ua as ts,Ub as dk,V as jr,Va as ze,Vb as TX,W as Je,Wa as Ok,Wb as Ev,X as He,Xa as Tk,Xb as lk,Y as Be,Ya as jk,Yb as ik,Z as eI,Za as Ck,_ as Tb,_b as rk,aa as $k,ab as bk,ac as ak,b as u,ba as Hu,bc as ok,c as uq0,ca as oK,cb as Bu,cc as nk,d as G1,da as dn,db as wk,dc as sk,e as Q4,ea as Mg,eb as Cb,ec as iN,f as D1,fa as fY,fb as uY,fc as tk,g as H5,ga as rI,gb as DW,h as H0,ha as jg,hb as ot,hc as tm,i as I0,ia as qW,ib as Sk,ic as rn,j as tz,ja as Zk,jb as Sq,jc as mU,k as hC,ka as Jk,kb as hg,l as Y0,la as jQ,lc as em,m as A8,ma as Hk,mb as r5,mc as ek,n as R2,na as Bk,nb as Eb,nc as $y,o as k1,oa as Qk,ob as kh,oc as i5,p as l3,pa as gY,pb as Rk,pc as Sa,q as iC,qa as Xk,qb as Ik,qc as dm,r as s0,ra as zk,rb as yh,rc as IF,s as L1,sa as Gk,sb as aI,sc as Xu,t as O6,ta as Uk,tb as kk,tc as om,u as aB,ua as Yk,ub as Lo,uc as Kw,v as gE,va as i8,vb as ln,vc as Ww,w as aG,wa as Fk,wb as yk,wc as YR,x as _D,xa as cU,xb as xk,y as mE,ya as B6,yb as hk,yc as MR,z as OD,za as Rr,zb as vk,zc as m4}from"/chunk-tevvtfbk.js";import{Nc as N4}from"/chunk-20ynagd4.js";import{Oc as m}from"/chunk-zq2ae5dx.js";import{Pc as Mw,Qc as x$,Rc as CR,Sc as JM,Tc as DQ,Uc as v6,Vc as JQ,Wc as v4,Xc as S$,Yc as HY,_c as yR}from"/chunk-9w543s0r.js";import{cd as B1,dd as W4,ed as Z5}from"/chunk-tgt9zd0r.js";import{fd as P,gd as b5,hd as k5,id as MM}from"/chunk-rm894bc2.js";var iZ=b5((se)=>{var Q9=P(m());function pe($,Z){return $===Z&&($!==0||1/$===1/Z)||$!==$&&Z!==Z}var ce=typeof Object.is==="function"?Object.is:pe,de=Q9.useState,le=Q9.useEffect,ie=Q9.useLayoutEffect,re=Q9.useDebugValue;function ae($,Z){var J=Z(),H=de({inst:{value:J,getSnapshot:Z}}),B=H[0].inst,Q=H[1];return ie(function(){B.value=J,B.getSnapshot=Z,KA(B)&&Q({inst:B})},[$,J,Z]),le(function(){return KA(B)&&Q({inst:B}),$(function(){KA(B)&&Q({inst:B})})},[$]),re(J),J}function KA($){var Z=$.getSnapshot;$=$.value;try{var J=Z();return!ce($,J)}catch(H){return!0}}function oe($,Z){return Z()}var ne=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?oe:ae;se.useSyncExternalStore=Q9.useSyncExternalStore!==void 0?Q9.useSyncExternalStore:ne});var Pu=b5((WQ1,Mu)=>{var Au=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,_Z0=/\n/g,OZ0=/^\s*/,TZ0=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,jZ0=/^:\s*/,CZ0=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,EZ0=/^[;\s]*/,bZ0=/^\s+|\s+$/g,wZ0=`
|
|
2
|
+
`,Du="/",Vu="*",zZ="",SZ0="comment",RZ0="declaration";function IZ0($,Z){if(typeof $!=="string")throw TypeError("First argument must be a string");if(!$)return[];Z=Z||{};var J=1,H=1;function B(N){var q=N.match(_Z0);if(q)J+=q.length;var D=N.lastIndexOf(wZ0);H=~D?N.length-D:H+N.length}function Q(){var N={line:J,column:H};return function(q){return q.position=new X(N),U(),q}}function X(N){this.start=N,this.end={line:J,column:H},this.source=Z.source}X.prototype.content=$;function z(N){var q=Error(Z.source+":"+J+":"+H+": "+N);if(q.reason=N,q.filename=Z.source,q.line=J,q.column=H,q.source=$,Z.silent);else throw q}function G(N){var q=N.exec($);if(!q)return;var D=q[0];return B(D),$=$.slice(D.length),q}function U(){G(OZ0)}function Y(N){var q;N=N||[];while(q=F())if(q!==!1)N.push(q);return N}function F(){var N=Q();if(Du!=$.charAt(0)||Vu!=$.charAt(1))return;var q=2;while(zZ!=$.charAt(q)&&(Vu!=$.charAt(q)||Du!=$.charAt(q+1)))++q;if(q+=2,zZ===$.charAt(q-1))return z("End of comment missing");var D=$.slice(2,q-2);return H+=2,B(D),$=$.slice(q),H+=2,N({type:SZ0,comment:D})}function K(){var N=Q(),q=G(TZ0);if(!q)return;if(F(),!G(jZ0))return z("property missing ':'");var D=G(CZ0),A=N({type:RZ0,property:Lu(q[0].replace(Au,zZ)),value:D?Lu(D[0].replace(Au,zZ)):zZ});return G(EZ0),A}function W(){var N=[];Y(N);var q;while(q=K())if(q!==!1)N.push(q),Y(N);return N}return U(),W()}function Lu($){return $?$.replace(bZ0,zZ):zZ}Mu.exports=IZ0});var _u=b5((wX)=>{var kZ0=wX&&wX.__importDefault||function($){return $&&$.__esModule?$:{default:$}};Object.defineProperty(wX,"__esModule",{value:!0});wX.default=xZ0;var yZ0=kZ0(Pu());function xZ0($,Z){let J=null;if(!$||typeof $!=="string")return J;let H=(0,yZ0.default)($),B=typeof Z==="function";return H.forEach((Q)=>{if(Q.type!=="declaration")return;let{property:X,value:z}=Q;if(B)Z(X,z,Q);else if(z)J=J||{},J[X]=z}),J}});var Cu=b5((Tu)=>{Object.defineProperty(Tu,"__esModule",{value:!0});Tu.camelCase=void 0;var hZ0=/^--[a-zA-Z0-9_-]+$/,vZ0=/-([a-z])/g,fZ0=/^[^-]+$/,gZ0=/^-(webkit|moz|ms|o|khtml)-/,mZ0=/^-(ms)-/,uZ0=function($){return!$||fZ0.test($)||hZ0.test($)},pZ0=function($,Z){return Z.toUpperCase()},Ou=function($,Z){return"".concat(Z,"-")},cZ0=function($,Z){if(Z===void 0)Z={};if(uZ0($))return $;if($=$.toLowerCase(),Z.reactCompat)$=$.replace(mZ0,Ou);else $=$.replace(gZ0,Ou);return $.replace(vZ0,pZ0)};Tu.camelCase=cZ0});var bu=b5((sM,Eu)=>{var dZ0=sM&&sM.__importDefault||function($){return $&&$.__esModule?$:{default:$}},lZ0=dZ0(_u()),iZ0=Cu();function nM($,Z){var J={};if(!$||typeof $!=="string")return J;return(0,lZ0.default)($,function(H,B){if(H&&B)J[(0,iZ0.camelCase)(H,Z)]=B}),J}nM.default=nM;Eu.exports=nM});var op=b5((BF1,ap)=>{var oW=Object.prototype.hasOwnProperty,rp=Object.prototype.toString,up=Object.defineProperty,pp=Object.getOwnPropertyDescriptor,cp=function(Z){if(typeof Array.isArray==="function")return Array.isArray(Z);return rp.call(Z)==="[object Array]"},dp=function(Z){if(!Z||rp.call(Z)!=="[object Object]")return!1;var J=oW.call(Z,"constructor"),H=Z.constructor&&Z.constructor.prototype&&oW.call(Z.constructor.prototype,"isPrototypeOf");if(Z.constructor&&!J&&!H)return!1;var B;for(B in Z);return typeof B>"u"||oW.call(Z,B)},lp=function(Z,J){if(up&&J.name==="__proto__")up(Z,J.name,{enumerable:!0,configurable:!0,value:J.newValue,writable:!0});else Z[J.name]=J.newValue},ip=function(Z,J){if(J==="__proto__"){if(!oW.call(Z,J))return;else if(pp)return pp(Z,J).value}return Z[J]};ap.exports=function $(){var Z,J,H,B,Q,X,z=arguments[0],G=1,U=arguments.length,Y=!1;if(typeof z==="boolean")Y=z,z=arguments[1]||{},G=2;if(z==null||typeof z!=="object"&&typeof z!=="function")z={};for(;G<U;++G)if(Z=arguments[G],Z!=null){for(J in Z)if(H=ip(z,J),B=ip(Z,J),z!==B){if(Y&&B&&(dp(B)||(Q=cp(B)))){if(Q)Q=!1,X=H&&cp(H)?H:[];else X=H&&dp(H)?H:{};lp(z,{name:J,newValue:$(Y,X,B)})}else if(typeof B<"u")lp(z,{name:J,newValue:B})}}return z}});var md=b5((jW1,gd)=>{function Td($){if($ instanceof Map)$.clear=$.delete=$.set=function(){throw Error("map is read-only")};else if($ instanceof Set)$.add=$.clear=$.delete=function(){throw Error("set is read-only")};return Object.freeze($),Object.getOwnPropertyNames($).forEach((Z)=>{let J=$[Z],H=typeof J;if((H==="object"||H==="function")&&!Object.isFrozen(J))Td(J)}),$}class pP{constructor($){if($.data===void 0)$.data={};this.data=$.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function jd($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function f7($,...Z){let J=Object.create(null);for(let H in $)J[H]=$[H];return Z.forEach(function(H){for(let B in H)J[B]=H[B]}),J}var DQ0="</span>",Vd=($)=>{return!!$.scope},VQ0=($,{prefix:Z})=>{if($.startsWith("language:"))return $.replace("language:","language-");if($.includes(".")){let J=$.split(".");return[`${Z}${J.shift()}`,...J.map((H,B)=>`${H}${"_".repeat(B+1)}`)].join(" ")}return`${Z}${$}`};class Cd{constructor($,Z){this.buffer="",this.classPrefix=Z.classPrefix,$.walk(this)}addText($){this.buffer+=jd($)}openNode($){if(!Vd($))return;let Z=VQ0($.scope,{prefix:this.classPrefix});this.span(Z)}closeNode($){if(!Vd($))return;this.buffer+=DQ0}value(){return this.buffer}span($){this.buffer+=`<span class="${$}">`}}var Ld=($={})=>{let Z={children:[]};return Object.assign(Z,$),Z};class cP{constructor(){this.rootNode=Ld(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add($){this.top.children.push($)}openNode($){let Z=Ld({scope:$});this.add(Z),this.stack.push(Z)}closeNode(){if(this.stack.length>1)return this.stack.pop();return}closeAllNodes(){while(this.closeNode());}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk($){return this.constructor._walk($,this.rootNode)}static _walk($,Z){if(typeof Z==="string")$.addText(Z);else if(Z.children)$.openNode(Z),Z.children.forEach((J)=>this._walk($,J)),$.closeNode(Z);return $}static _collapse($){if(typeof $==="string")return;if(!$.children)return;if($.children.every((Z)=>typeof Z==="string"))$.children=[$.children.join("")];else $.children.forEach((Z)=>{cP._collapse(Z)})}}class Ed extends cP{constructor($){super();this.options=$}addText($){if($==="")return;this.add($)}startScope($){this.openNode($)}endScope(){this.closeNode()}__addSublanguage($,Z){let J=$.root;if(Z)J.scope=`language:${Z}`;this.add(J)}toHTML(){return new Cd(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function iX($){if(!$)return null;if(typeof $==="string")return $;return $.source}function bd($){return DZ("(?=",$,")")}function LQ0($){return DZ("(?:",$,")*")}function MQ0($){return DZ("(?:",$,")?")}function DZ(...$){return $.map((J)=>iX(J)).join("")}function PQ0($){let Z=$[$.length-1];if(typeof Z==="object"&&Z.constructor===Object)return $.splice($.length-1,1),Z;else return{}}function dP(...$){return"("+(PQ0($).capture?"":"?:")+$.map((H)=>iX(H)).join("|")+")"}function wd($){return new RegExp($.toString()+"|").exec("").length-1}function _Q0($,Z){let J=$&&$.exec(Z);return J&&J.index===0}var OQ0=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function lP($,{joinWith:Z}){let J=0;return $.map((H)=>{J+=1;let B=J,Q=iX(H),X="";while(Q.length>0){let z=OQ0.exec(Q);if(!z){X+=Q;break}if(X+=Q.substring(0,z.index),Q=Q.substring(z.index+z[0].length),z[0][0]==="\\"&&z[1])X+="\\"+String(Number(z[1])+B);else if(X+=z[0],z[0]==="(")J++}return X}).map((H)=>`(${H})`).join(Z)}var TQ0=/\b\B/,Sd="[a-zA-Z]\\w*",iP="[a-zA-Z_]\\w*",Rd="\\b\\d+(\\.\\d+)?",Id="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",kd="\\b(0b[01]+)",jQ0="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",CQ0=($={})=>{let Z=/^#![ ]*\//;if($.binary)$.begin=DZ(Z,/.*\b/,$.binary,/\b.*/);return f7({scope:"meta",begin:Z,end:/$/,relevance:0,"on:begin":(J,H)=>{if(J.index!==0)H.ignoreMatch()}},$)},rX={begin:"\\\\[\\s\\S]",relevance:0},EQ0={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[rX]},bQ0={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[rX]},wQ0={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},UN=function($,Z,J={}){let H=f7({scope:"comment",begin:$,end:Z,contains:[]},J);H.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});let B=dP("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return H.contains.push({begin:DZ(/[ ]+/,"(",B,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),H},SQ0=UN("//","$"),RQ0=UN("/\\*","\\*/"),IQ0=UN("#","$"),kQ0={scope:"number",begin:Rd,relevance:0},yQ0={scope:"number",begin:Id,relevance:0},xQ0={scope:"number",begin:kd,relevance:0},hQ0={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[rX,{begin:/\[/,end:/\]/,relevance:0,contains:[rX]}]},vQ0={scope:"title",begin:Sd,relevance:0},fQ0={scope:"title",begin:iP,relevance:0},gQ0={begin:"\\.\\s*"+iP,relevance:0},mQ0=function($){return Object.assign($,{"on:begin":(Z,J)=>{J.data._beginMatch=Z[1]},"on:end":(Z,J)=>{if(J.data._beginMatch!==Z[1])J.ignoreMatch()}})},zN=Object.freeze({__proto__:null,APOS_STRING_MODE:EQ0,BACKSLASH_ESCAPE:rX,BINARY_NUMBER_MODE:xQ0,BINARY_NUMBER_RE:kd,COMMENT:UN,C_BLOCK_COMMENT_MODE:RQ0,C_LINE_COMMENT_MODE:SQ0,C_NUMBER_MODE:yQ0,C_NUMBER_RE:Id,END_SAME_AS_BEGIN:mQ0,HASH_COMMENT_MODE:IQ0,IDENT_RE:Sd,MATCH_NOTHING_RE:TQ0,METHOD_GUARD:gQ0,NUMBER_MODE:kQ0,NUMBER_RE:Rd,PHRASAL_WORDS_MODE:wQ0,QUOTE_STRING_MODE:bQ0,REGEXP_MODE:hQ0,RE_STARTERS_RE:jQ0,SHEBANG:CQ0,TITLE_MODE:vQ0,UNDERSCORE_IDENT_RE:iP,UNDERSCORE_TITLE_MODE:fQ0});function uQ0($,Z){if($.input[$.index-1]===".")Z.ignoreMatch()}function pQ0($,Z){if($.className!==void 0)$.scope=$.className,delete $.className}function cQ0($,Z){if(!Z)return;if(!$.beginKeywords)return;if($.begin="\\b("+$.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",$.__beforeBegin=uQ0,$.keywords=$.keywords||$.beginKeywords,delete $.beginKeywords,$.relevance===void 0)$.relevance=0}function dQ0($,Z){if(!Array.isArray($.illegal))return;$.illegal=dP(...$.illegal)}function lQ0($,Z){if(!$.match)return;if($.begin||$.end)throw Error("begin & end are not supported with match");$.begin=$.match,delete $.match}function iQ0($,Z){if($.relevance===void 0)$.relevance=1}var rQ0=($,Z)=>{if(!$.beforeMatch)return;if($.starts)throw Error("beforeMatch cannot be used with starts");let J=Object.assign({},$);Object.keys($).forEach((H)=>{delete $[H]}),$.keywords=J.keywords,$.begin=DZ(J.beforeMatch,bd(J.begin)),$.starts={relevance:0,contains:[Object.assign(J,{endsParent:!0})]},$.relevance=0,delete J.beforeMatch},aQ0=["of","and","for","in","not","or","if","then","parent","list","value"],oQ0="keyword";function yd($,Z,J=oQ0){let H=Object.create(null);if(typeof $==="string")B(J,$.split(" "));else if(Array.isArray($))B(J,$);else Object.keys($).forEach(function(Q){Object.assign(H,yd($[Q],Z,Q))});return H;function B(Q,X){if(Z)X=X.map((z)=>z.toLowerCase());X.forEach(function(z){let G=z.split("|");H[G[0]]=[Q,nQ0(G[0],G[1])]})}}function nQ0($,Z){if(Z)return Number(Z);return sQ0($)?0:1}function sQ0($){return aQ0.includes($.toLowerCase())}var Md={},AZ=($)=>{console.error($)},Pd=($,...Z)=>{console.log(`WARN: ${$}`,...Z)},pH=($,Z)=>{if(Md[`${$}/${Z}`])return;console.log(`Deprecated as of ${$}. ${Z}`),Md[`${$}/${Z}`]=!0},GN=Error();function xd($,Z,{key:J}){let H=0,B=$[J],Q={},X={};for(let z=1;z<=Z.length;z++)X[z+H]=B[z],Q[z+H]=!0,H+=wd(Z[z-1]);$[J]=X,$[J]._emit=Q,$[J]._multi=!0}function tQ0($){if(!Array.isArray($.begin))return;if($.skip||$.excludeBegin||$.returnBegin)throw AZ("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),GN;if(typeof $.beginScope!=="object"||$.beginScope===null)throw AZ("beginScope must be object"),GN;xd($,$.begin,{key:"beginScope"}),$.begin=lP($.begin,{joinWith:""})}function eQ0($){if(!Array.isArray($.end))return;if($.skip||$.excludeEnd||$.returnEnd)throw AZ("skip, excludeEnd, returnEnd not compatible with endScope: {}"),GN;if(typeof $.endScope!=="object"||$.endScope===null)throw AZ("endScope must be object"),GN;xd($,$.end,{key:"endScope"}),$.end=lP($.end,{joinWith:""})}function $X0($){if($.scope&&typeof $.scope==="object"&&$.scope!==null)$.beginScope=$.scope,delete $.scope}function ZX0($){if($X0($),typeof $.beginScope==="string")$.beginScope={_wrap:$.beginScope};if(typeof $.endScope==="string")$.endScope={_wrap:$.endScope};tQ0($),eQ0($)}function JX0($){function Z(X,z){return new RegExp(iX(X),"m"+($.case_insensitive?"i":"")+($.unicodeRegex?"u":"")+(z?"g":""))}class J{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(X,z){z.position=this.position++,this.matchIndexes[this.matchAt]=z,this.regexes.push([z,X]),this.matchAt+=wd(X)+1}compile(){if(this.regexes.length===0)this.exec=()=>null;let X=this.regexes.map((z)=>z[1]);this.matcherRe=Z(lP(X,{joinWith:"|"}),!0),this.lastIndex=0}exec(X){this.matcherRe.lastIndex=this.lastIndex;let z=this.matcherRe.exec(X);if(!z)return null;let G=z.findIndex((Y,F)=>F>0&&Y!==void 0),U=this.matchIndexes[G];return z.splice(0,G),Object.assign(z,U)}}class H{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(X){if(this.multiRegexes[X])return this.multiRegexes[X];let z=new J;return this.rules.slice(X).forEach(([G,U])=>z.addRule(G,U)),z.compile(),this.multiRegexes[X]=z,z}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(X,z){if(this.rules.push([X,z]),z.type==="begin")this.count++}exec(X){let z=this.getMatcher(this.regexIndex);z.lastIndex=this.lastIndex;let G=z.exec(X);if(this.resumingScanAtSamePosition())if(G&&G.index===this.lastIndex);else{let U=this.getMatcher(0);U.lastIndex=this.lastIndex+1,G=U.exec(X)}if(G){if(this.regexIndex+=G.position+1,this.regexIndex===this.count)this.considerAll()}return G}}function B(X){let z=new H;if(X.contains.forEach((G)=>z.addRule(G.begin,{rule:G,type:"begin"})),X.terminatorEnd)z.addRule(X.terminatorEnd,{type:"end"});if(X.illegal)z.addRule(X.illegal,{type:"illegal"});return z}function Q(X,z){let G=X;if(X.isCompiled)return G;[pQ0,lQ0,ZX0,rQ0].forEach((Y)=>Y(X,z)),$.compilerExtensions.forEach((Y)=>Y(X,z)),X.__beforeBegin=null,[cQ0,dQ0,iQ0].forEach((Y)=>Y(X,z)),X.isCompiled=!0;let U=null;if(typeof X.keywords==="object"&&X.keywords.$pattern)X.keywords=Object.assign({},X.keywords),U=X.keywords.$pattern,delete X.keywords.$pattern;if(U=U||/\w+/,X.keywords)X.keywords=yd(X.keywords,$.case_insensitive);if(G.keywordPatternRe=Z(U,!0),z){if(!X.begin)X.begin=/\B|\b/;if(G.beginRe=Z(G.begin),!X.end&&!X.endsWithParent)X.end=/\B|\b/;if(X.end)G.endRe=Z(G.end);if(G.terminatorEnd=iX(G.end)||"",X.endsWithParent&&z.terminatorEnd)G.terminatorEnd+=(X.end?"|":"")+z.terminatorEnd}if(X.illegal)G.illegalRe=Z(X.illegal);if(!X.contains)X.contains=[];if(X.contains=[].concat(...X.contains.map(function(Y){return HX0(Y==="self"?X:Y)})),X.contains.forEach(function(Y){Q(Y,G)}),X.starts)Q(X.starts,z);return G.matcher=B(G),G}if(!$.compilerExtensions)$.compilerExtensions=[];if($.contains&&$.contains.includes("self"))throw Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return $.classNameAliases=f7($.classNameAliases||{}),Q($)}function hd($){if(!$)return!1;return $.endsWithParent||hd($.starts)}function HX0($){if($.variants&&!$.cachedVariants)$.cachedVariants=$.variants.map(function(Z){return f7($,{variants:null},Z)});if($.cachedVariants)return $.cachedVariants;if(hd($))return f7($,{starts:$.starts?f7($.starts):null});if(Object.isFrozen($))return f7($);return $}var BX0="11.11.1";class vd extends Error{constructor($,Z){super($);this.name="HTMLInjectionError",this.html=Z}}var uP=jd,_d=f7,Od=Symbol("nomatch"),QX0=7,fd=function($){let Z=Object.create(null),J=Object.create(null),H=[],B=!0,Q="Could not find the language '{}', did you forget to load/include a language module?",X={disableAutodetect:!0,name:"Plain text",contains:[]},z={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:Ed};function G(R){return z.noHighlightRe.test(R)}function U(R){let x=R.className+" ";x+=R.parentNode?R.parentNode.className:"";let v=z.languageDetectRe.exec(x);if(v){let f=C(v[1]);if(!f)Pd(Q.replace("{}",v[1])),Pd("Falling back to no-highlight mode for this block.",R);return f?v[1]:"no-highlight"}return x.split(/\s+/).find((f)=>G(f)||C(f))}function Y(R,x,v){let f="",b="";if(typeof x==="object")f=R,v=x.ignoreIllegals,b=x.language;else pH("10.7.0","highlight(lang, code, ...args) has been deprecated."),pH("10.7.0",`Please use highlight(code, options) instead.
|
|
3
|
+
https://github.com/highlightjs/highlight.js/issues/2277`),b=R,f=x;if(v===void 0)v=!0;let l={code:f,language:b};j("before:highlight",l);let r=l.result?l.result:F(l.language,l.code,v);return r.code=l.code,j("after:highlight",r),r}function F(R,x,v,f){let b=Object.create(null);function l(g,p){return g.keywords[p]}function r(){if(!a.keywords){t.addText(B0);return}let g=0;a.keywordPatternRe.lastIndex=0;let p=a.keywordPatternRe.exec(B0),e="";while(p){e+=B0.substring(g,p.index);let W0=q0.case_insensitive?p[0].toLowerCase():p[0],S0=l(a,W0);if(S0){let[h0,v0]=S0;if(t.addText(e),e="",b[W0]=(b[W0]||0)+1,b[W0]<=QX0)_0+=v0;if(h0.startsWith("_"))e+=p[0];else{let j0=q0.classNameAliases[h0]||h0;o(p[0],j0)}}else e+=p[0];g=a.keywordPatternRe.lastIndex,p=a.keywordPatternRe.exec(B0)}e+=B0.substring(g),t.addText(e)}function h(){if(B0==="")return;let g=null;if(typeof a.subLanguage==="string"){if(!Z[a.subLanguage]){t.addText(B0);return}g=F(a.subLanguage,B0,!0,$0[a.subLanguage]),$0[a.subLanguage]=g._top}else g=W(B0,a.subLanguage.length?a.subLanguage:null);if(a.relevance>0)_0+=g.relevance;t.__addSublanguage(g._emitter,g.language)}function d(){if(a.subLanguage!=null)h();else r();B0=""}function o(g,p){if(g==="")return;t.startScope(p),t.addText(g),t.endScope()}function c(g,p){let e=1,W0=p.length-1;while(e<=W0){if(!g._emit[e]){e++;continue}let S0=q0.classNameAliases[g[e]]||g[e],h0=p[e];if(S0)o(h0,S0);else B0=h0,r(),B0="";e++}}function i(g,p){if(g.scope&&typeof g.scope==="string")t.openNode(q0.classNameAliases[g.scope]||g.scope);if(g.beginScope){if(g.beginScope._wrap)o(B0,q0.classNameAliases[g.beginScope._wrap]||g.beginScope._wrap),B0="";else if(g.beginScope._multi)c(g.beginScope,p),B0=""}return a=Object.create(g,{parent:{value:a}}),a}function n(g,p,e){let W0=_Q0(g.endRe,e);if(W0){if(g["on:end"]){let S0=new pP(g);if(g["on:end"](p,S0),S0.isMatchIgnored)W0=!1}if(W0){while(g.endsParent&&g.parent)g=g.parent;return g}}if(g.endsWithParent)return n(g.parent,p,e)}function Z0(g){if(a.matcher.regexIndex===0)return B0+=g[0],1;else return M0=!0,0}function J0(g){let p=g[0],e=g.rule,W0=new pP(e),S0=[e.__beforeBegin,e["on:begin"]];for(let h0 of S0){if(!h0)continue;if(h0(g,W0),W0.isMatchIgnored)return Z0(p)}if(e.skip)B0+=p;else{if(e.excludeBegin)B0+=p;if(d(),!e.returnBegin&&!e.excludeBegin)B0=p}return i(e,g),e.returnBegin?0:p.length}function U0(g){let p=g[0],e=x.substring(g.index),W0=n(a,g,e);if(!W0)return Od;let S0=a;if(a.endScope&&a.endScope._wrap)d(),o(p,a.endScope._wrap);else if(a.endScope&&a.endScope._multi)d(),c(a.endScope,g);else if(S0.skip)B0+=p;else{if(!(S0.returnEnd||S0.excludeEnd))B0+=p;if(d(),S0.excludeEnd)B0=p}do{if(a.scope)t.closeNode();if(!a.skip&&!a.subLanguage)_0+=a.relevance;a=a.parent}while(a!==W0.parent);if(W0.starts)i(W0.starts,g);return S0.returnEnd?0:p.length}function z0(){let g=[];for(let p=a;p!==q0;p=p.parent)if(p.scope)g.unshift(p.scope);g.forEach((p)=>t.openNode(p))}let X0={};function N0(g,p){let e=p&&p[0];if(B0+=g,e==null)return d(),0;if(X0.type==="begin"&&p.type==="end"&&X0.index===p.index&&e===""){if(B0+=x.slice(p.index,p.index+1),!B){let W0=Error(`0 width match regex (${R})`);throw W0.languageName=R,W0.badRule=X0.rule,W0}return 1}if(X0=p,p.type==="begin")return J0(p);else if(p.type==="illegal"&&!v){let W0=Error('Illegal lexeme "'+e+'" for mode "'+(a.scope||"<unnamed>")+'"');throw W0.mode=a,W0}else if(p.type==="end"){let W0=U0(p);if(W0!==Od)return W0}if(p.type==="illegal"&&e==="")return B0+=`
|
|
4
|
+
`,1;if(A0>1e5&&A0>p.index*3)throw Error("potential infinite loop, way more iterations than matches");return B0+=e,e.length}let q0=C(R);if(!q0)throw AZ(Q.replace("{}",R)),Error('Unknown language: "'+R+'"');let K0=JX0(q0),s="",a=f||K0,$0={},t=new z.__emitter(z);z0();let B0="",_0=0,P0=0,A0=0,M0=!1;try{if(!q0.__emitTokens){a.matcher.considerAll();for(;;){if(A0++,M0)M0=!1;else a.matcher.considerAll();a.matcher.lastIndex=P0;let g=a.matcher.exec(x);if(!g)break;let p=x.substring(P0,g.index),e=N0(p,g);P0=g.index+e}N0(x.substring(P0))}else q0.__emitTokens(x,t);return t.finalize(),s=t.toHTML(),{language:R,value:s,relevance:_0,illegal:!1,_emitter:t,_top:a}}catch(g){if(g.message&&g.message.includes("Illegal"))return{language:R,value:uP(x),illegal:!0,relevance:0,_illegalBy:{message:g.message,index:P0,context:x.slice(P0-100,P0+100),mode:g.mode,resultSoFar:s},_emitter:t};else if(B)return{language:R,value:uP(x),illegal:!1,relevance:0,errorRaised:g,_emitter:t,_top:a};else throw g}}function K(R){let x={value:uP(R),illegal:!1,relevance:0,_top:X,_emitter:new z.__emitter(z)};return x._emitter.addText(R),x}function W(R,x){x=x||z.languages||Object.keys(Z);let v=K(R),f=x.filter(C).filter(T).map((d)=>F(d,R,!1));f.unshift(v);let b=f.sort((d,o)=>{if(d.relevance!==o.relevance)return o.relevance-d.relevance;if(d.language&&o.language){if(C(d.language).supersetOf===o.language)return 1;else if(C(o.language).supersetOf===d.language)return-1}return 0}),[l,r]=b,h=l;return h.secondBest=r,h}function N(R,x,v){let f=x&&J[x]||v;R.classList.add("hljs"),R.classList.add(`language-${f}`)}function q(R){let x=null,v=U(R);if(G(v))return;if(j("before:highlightElement",{el:R,language:v}),R.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",R);return}if(R.children.length>0){if(!z.ignoreUnescapedHTML)console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(R);if(z.throwUnescapedHTML)throw new vd("One of your code blocks includes unescaped HTML.",R.innerHTML)}x=R;let f=x.textContent,b=v?Y(f,{language:v,ignoreIllegals:!0}):W(f);if(R.innerHTML=b.value,R.dataset.highlighted="yes",N(R,v,b.language),R.result={language:b.language,re:b.relevance,relevance:b.relevance},b.secondBest)R.secondBest={language:b.secondBest.language,relevance:b.secondBest.relevance};j("after:highlightElement",{el:R,result:b,text:f})}function D(R){z=_d(z,R)}let A=()=>{O(),pH("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function V(){O(),pH("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let L=!1;function O(){function R(){O()}if(document.readyState==="loading"){if(!L)window.addEventListener("DOMContentLoaded",R,!1);L=!0;return}document.querySelectorAll(z.cssSelector).forEach(q)}function M(R,x){let v=null;try{v=x($)}catch(f){if(AZ("Language definition for '{}' could not be registered.".replace("{}",R)),!B)throw f;else AZ(f);v=X}if(!v.name)v.name=R;if(Z[R]=v,v.rawDefinition=x.bind(null,$),v.aliases)E(v.aliases,{languageName:R})}function _(R){delete Z[R];for(let x of Object.keys(J))if(J[x]===R)delete J[x]}function w(){return Object.keys(Z)}function C(R){return R=(R||"").toLowerCase(),Z[R]||Z[J[R]]}function E(R,{languageName:x}){if(typeof R==="string")R=[R];R.forEach((v)=>{J[v.toLowerCase()]=x})}function T(R){let x=C(R);return x&&!x.disableAutodetect}function k(R){if(R["before:highlightBlock"]&&!R["before:highlightElement"])R["before:highlightElement"]=(x)=>{R["before:highlightBlock"](Object.assign({block:x.el},x))};if(R["after:highlightBlock"]&&!R["after:highlightElement"])R["after:highlightElement"]=(x)=>{R["after:highlightBlock"](Object.assign({block:x.el},x))}}function S(R){k(R),H.push(R)}function I(R){let x=H.indexOf(R);if(x!==-1)H.splice(x,1)}function j(R,x){let v=R;H.forEach(function(f){if(f[v])f[v](x)})}function y(R){return pH("10.7.0","highlightBlock will be removed entirely in v12.0"),pH("10.7.0","Please use highlightElement now."),q(R)}Object.assign($,{highlight:Y,highlightAuto:W,highlightAll:O,highlightElement:q,highlightBlock:y,configure:D,initHighlighting:A,initHighlightingOnLoad:V,registerLanguage:M,unregisterLanguage:_,listLanguages:w,getLanguage:C,registerAliases:E,autoDetection:T,inherit:_d,addPlugin:S,removePlugin:I}),$.debugMode=function(){B=!1},$.safeMode=function(){B=!0},$.versionString=BX0,$.regex={concat:DZ,lookahead:bd,either:dP,optional:MQ0,anyNumberOfTimes:LQ0};for(let R in zN)if(typeof zN[R]==="object")Td(zN[R]);return Object.assign($,zN),$},cH=fd({});cH.newInstance=()=>fd({});gd.exports=cH;cH.HighlightJS=cH;cH.default=cH});var mi=b5((TL1,gi)=>{var RG0=["||","&&",";;","|&","<(","<<<",">>",">&","<&","&",";","(",")","|","<",">"],fi=/[\n\r\u2028\u2029]/,IG0=/[\s#!"$&'():;<=>@\\^`|]/g;gi.exports=function(Z){return Z.map(function(J){if(J==="")return"''";if(J&&typeof J==="object"){if("op"in J&&J.op==="glob"){if(typeof J.pattern!=="string")throw TypeError("glob token requires a string `pattern`");if(fi.test(J.pattern))throw TypeError("glob `pattern` must not contain line terminators");return J.pattern.replace(IG0,"\\$&")}if("op"in J&&typeof J.op==="string"){if(RG0.indexOf(J.op)<0)throw TypeError("invalid `op` value: "+JSON.stringify(J.op));return J.op.replace(/[\s\S]/g,"\\$&")}if("comment"in J&&typeof J.comment==="string"){if(fi.test(J.comment))throw TypeError("`comment` must not contain line terminators");return"#"+J.comment}throw TypeError("unrecognized object token shape")}if(/["\s\\]/.test(J)&&!/'/.test(J))return"'"+J.replace(/(['])/g,"\\$1")+"'";if(/["'\s]/.test(J))return'"'+J.replace(/(["\\$`!])/g,"\\$1")+'"';return String(J).replace(/([A-Za-z]:)?([#!"$&'()*,:;<=>?@[\\\]^`{|}~])/g,"$1\\$2")}).join(" ")}});var ri=b5((jL1,ii)=>{var li="(?:"+["\\|\\|","\\&\\&",";;","\\|\\&","\\<\\(","\\<\\<\\<",">>",">\\&","<\\&","[&;()|<>]"].join("|")+")",ui=new RegExp("^"+li+"$"),pi="|&;()<> \\t",kG0="'([^']*?)'",yG0='"((\\\\"|[^"])*?)"',xG0=/^#$/,ci="'",di='"',LN="$",MZ="",hG0=4294967296;for(MN=0;MN<4;MN++)MZ+=(hG0*Math.random()).toString(16);var MN,vG0=new RegExp("^"+MZ);function fG0($,Z){var J=Z.lastIndex,H=[],B;while(B=Z.exec($))if(H[H.length]=B,Z.lastIndex===B.index)Z.lastIndex+=1;return Z.lastIndex=J,H}function gG0($,Z,J){var H=typeof $==="function"?$(J):$[J];if(typeof H>"u"&&J!="")H="";else if(typeof H>"u")H="$";if(typeof H==="object")return Z+MZ+JSON.stringify(H)+MZ;return Z+H}function mG0($,Z,J){if(!J)J={};var H=J.escape||"\\",B=J.splitUnquoted===!0?`
|
|
5
|
+
`:typeof J.splitUnquoted==="string"?J.splitUnquoted:"",Q="(\\"+H+`['"`+pi+`]|[^\\s'"`+pi+"])+",X=new RegExp(["("+li+")","("+Q+"|"+yG0+"|"+kG0+")+"].join("|"),"g"),z=fG0($,X);if(z.length===0)return[];if(!Z)Z={};var G=!1;return z.map(function(U){var Y=U[0];if(!Y||G)return;if(ui.test(Y))return{op:Y};var F=!1,K=!1,W="",N=[],q=!1,D=null,A=!1,V;function L(){V+=1;var k,S,I=Y.charAt(V);if(I==="{"){if(V+=1,Y.charAt(V)==="}")throw Error("Bad substitution: "+Y.slice(V-2,V+1));var j=1;k=V;while(j>0&&k<Y.length){if(Y.charAt(k)==="{"&&Y.charAt(k-1)==="$")j+=1;else if(Y.charAt(k)==="}")j-=1;k+=1}if(j!==0)throw Error("Bad substitution: "+Y.slice(V));k-=1,S=Y.slice(V,k),V=k}else if(/[*@#?$!_-]/.test(I))S=I,V+=1;else{var y=Y.slice(V);if(k=y.match(/[^\w\d_]/),!k)S=y,V=Y.length;else S=y.slice(0,k.index),V+=k.index-1}return gG0(Z,"",S)}function O(){if(D===null)return;if(D===0){if(W!=="")N[N.length]=W,W=""}else{N[N.length]=W,W="";for(var k=1;k<D;k+=1)N[N.length]=""}D=null}for(V=0;V<Y.length;V++){var M=Y.charAt(V);if(B&&M!==LN)O();if(A=A||!F&&(M==="*"||M==="?"),K)W+=M,K=!1;else if(F)if(M===F)F=!1;else if(F==ci)W+=M;else if(M===H)if(V+=1,M=Y.charAt(V),M===di||M===H||M===LN)W+=M;else W+=H+M;else if(M===LN)W+=L();else W+=M;else if(M===di||M===ci)F=M,q=!0;else if(ui.test(M))return{op:Y};else if(xG0.test(M)){G=!0;var _={comment:$.slice(U.index+V+1)};if(W.length)return[W,_];return[_]}else if(M===H)K=!0;else if(M===LN){var w=L();if(!B)W+=w;else for(var C=0;C<w.length;C+=1){var E=w.charAt(C);if(B.indexOf(E)<0)O(),W+=E;else if(D===null)D=E===" "||E==="\t"||E===`
|
|
6
|
+
`?0:1;else if(E!==" "&&E!=="\t"&&E!==`
|
|
7
|
+
`)D+=1}}else W+=M}if(A)return{op:"glob",pattern:W};if(B){if(D!==null&&D>0){N[N.length]=W,W="";for(var T=1;T<D;T+=1)N[N.length]=""}if(W!==""||q&&N.length===0)N[N.length]=W;return N}return W}).reduce(function(U,Y){if(typeof Y>"u")return U;return[].concat(Y).forEach(function(F){U[U.length]=F}),U},[])}ii.exports=function(Z,J,H){var B=mG0(Z,J,H);if(typeof J!=="function")return B;return B.reduce(function(Q,X){if(typeof X==="object")return Q[Q.length]=X,Q;var z=X.split(RegExp("("+MZ+".*?"+MZ+")","g"));if(z.length===1)return Q[Q.length]=z[0],Q;return z.filter(Boolean).forEach(function(G){Q[Q.length]=vG0.test(G)?JSON.parse(G.split(MZ)[1]):G}),Q},[])}});var kr=b5((MP1,Ir)=>{var sU0="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";Ir.exports=sU0});var vr=b5((PP1,hr)=>{var tU0=kr();function yr(){}function xr(){}xr.resetWarningCache=yr;hr.exports=function(){function $(H,B,Q,X,z,G){if(G===tU0)return;var U=Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw U.name="Invariant Violation",U}$.isRequired=$;function Z(){return $}var J={array:$,bigint:$,bool:$,func:$,number:$,object:$,string:$,symbol:$,any:$,arrayOf:Z,element:$,elementType:$,instanceOf:Z,node:$,objectOf:Z,oneOf:Z,oneOfType:Z,shape:Z,exact:Z,checkPropTypes:xr,resetWarningCache:yr};return J.PropTypes=J,J}});var Zz=b5((_P1,fr)=>{fr.exports=vr()();var eU0,$Y0});var ur=b5((OP1,ZO)=>{function mr($){var Z,J,H="";if(typeof $=="string"||typeof $=="number")H+=$;else if(typeof $=="object")if(Array.isArray($)){var B=$.length;for(Z=0;Z<B;Z++)$[Z]&&(J=mr($[Z]))&&(H&&(H+=" "),H+=J)}else for(J in $)$[J]&&(H&&(H+=" "),H+=J);return H}function gr(){for(var $,Z,J=0,H="",B=arguments.length;J<B;J++)($=arguments[J])&&(Z=mr($))&&(H&&(H+=" "),H+=Z);return H}ZO.exports=gr,ZO.exports.clsx=gr});var Jz=b5((pr)=>{Object.defineProperty(pr,"__esModule",{value:!0});pr.dontSetMe=QY0;pr.findInArray=ZY0;pr.int=BY0;pr.isFunction=JY0;pr.isNum=HY0;function ZY0($,Z){for(let J=0,H=$.length;J<H;J++)if(Z.apply(Z,[$[J],J,$]))return $[J]}function JY0($){return typeof $==="function"||Object.prototype.toString.call($)==="[object Function]"}function HY0($){return typeof $==="number"&&!isNaN($)}function BY0($){return parseInt($,10)}function QY0($,Z,J){if($[Z])return Error(`Invalid prop ${Z} passed to ${J} - do not set this, set it on the child.`)}});var rr=b5((lr)=>{Object.defineProperty(lr,"__esModule",{value:!0});lr.browserPrefixToKey=dr;lr.browserPrefixToStyle=FY0;lr.default=void 0;lr.getPrefix=cr;var JO=["Moz","Webkit","O","ms"];function cr(){let $=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"transform";if(typeof window>"u")return"";let Z=window.document?.documentElement?.style;if(!Z)return"";if($ in Z)return"";for(let J=0;J<JO.length;J++)if(dr($,JO[J])in Z)return JO[J];return""}function dr($,Z){return Z?`${Z}${KY0($)}`:$}function FY0($,Z){return Z?`-${Z.toLowerCase()}-${$}`:$}function KY0($){let Z="",J=!0;for(let H=0;H<$.length;H++)if(J)Z+=$[H].toUpperCase(),J=!1;else if($[H]==="-")J=!0;else Z+=$[H];return Z}var jP1=lr.default=cr()});var bN=b5(($a)=>{Object.defineProperty($a,"__esModule",{value:!0});$a.addClassName=tr;$a.addEvent=DY0;$a.addUserSelectStyles=bY0;$a.createCSSTransform=TY0;$a.createSVGTransform=jY0;$a.getTouch=CY0;$a.getTouchIdentifier=EY0;$a.getTranslation=HO;$a.innerHeight=PY0;$a.innerWidth=_Y0;$a.matchesSelector=sr;$a.matchesSelectorAndParentsTo=AY0;$a.offsetXYFromParent=OY0;$a.outerHeight=LY0;$a.outerWidth=MY0;$a.removeClassName=er;$a.removeEvent=VY0;$a.scheduleRemoveUserSelectStyles=wY0;var j8=Jz(),ar=nr(rr());function nr($,Z){if(typeof WeakMap=="function")var J=new WeakMap,H=new WeakMap;return(nr=function(B,Q){if(!Q&&B&&B.__esModule)return B;var X,z,G={__proto__:null,default:B};if(B===null||typeof B!="object"&&typeof B!="function")return G;if(X=Q?H:J){if(X.has(B))return X.get(B);X.set(B,G)}for(let U in B)U!=="default"&&{}.hasOwnProperty.call(B,U)&&((z=(X=Object.defineProperty)&&Object.getOwnPropertyDescriptor(B,U))&&(z.get||z.set)?X(G,U,z):G[U]=B[U]);return G})($,Z)}var EN="";function sr($,Z){if(!EN)EN=(0,j8.findInArray)(["matches","webkitMatchesSelector","mozMatchesSelector","msMatchesSelector","oMatchesSelector"],function(J){return(0,j8.isFunction)($[J])});if(!(0,j8.isFunction)($[EN]))return!1;return $[EN](Z)}function AY0($,Z,J){let H=$;do{if(sr(H,Z))return!0;if(H===J)return!1;H=H.parentNode}while(H);return!1}function DY0($,Z,J,H){if(!$)return;let B={capture:!0,...H};if($.addEventListener)$.addEventListener(Z,J,B);else if($.attachEvent)$.attachEvent("on"+Z,J);else $["on"+Z]=J}function VY0($,Z,J,H){if(!$)return;let B={capture:!0,...H};if($.removeEventListener)$.removeEventListener(Z,J,B);else if($.detachEvent)$.detachEvent("on"+Z,J);else $["on"+Z]=null}function LY0($){let Z=$.clientHeight,J=$.ownerDocument.defaultView.getComputedStyle($);return Z+=(0,j8.int)(J.borderTopWidth),Z+=(0,j8.int)(J.borderBottomWidth),Z}function MY0($){let Z=$.clientWidth,J=$.ownerDocument.defaultView.getComputedStyle($);return Z+=(0,j8.int)(J.borderLeftWidth),Z+=(0,j8.int)(J.borderRightWidth),Z}function PY0($){let Z=$.clientHeight,J=$.ownerDocument.defaultView.getComputedStyle($);return Z-=(0,j8.int)(J.paddingTop),Z-=(0,j8.int)(J.paddingBottom),Z}function _Y0($){let Z=$.clientWidth,J=$.ownerDocument.defaultView.getComputedStyle($);return Z-=(0,j8.int)(J.paddingLeft),Z-=(0,j8.int)(J.paddingRight),Z}function OY0($,Z,J){let B=Z===Z.ownerDocument.body?{left:0,top:0}:Z.getBoundingClientRect(),Q=($.clientX+Z.scrollLeft-B.left)/J,X=($.clientY+Z.scrollTop-B.top)/J;return{x:Q,y:X}}function TY0($,Z){let J=HO($,Z,"px");return{[(0,ar.browserPrefixToKey)("transform",ar.default)]:J}}function jY0($,Z){return HO($,Z,"")}function HO($,Z,J){let{x:H,y:B}=$,Q=`translate(${H}${J},${B}${J})`;if(Z){let X=`${typeof Z.x==="string"?Z.x:Z.x+J}`,z=`${typeof Z.y==="string"?Z.y:Z.y+J}`;Q=`translate(${X}, ${z})`+Q}return Q}function CY0($,Z){return $.targetTouches&&(0,j8.findInArray)($.targetTouches,(J)=>Z===J.identifier)||$.changedTouches&&(0,j8.findInArray)($.changedTouches,(J)=>Z===J.identifier)}function EY0($){if($.targetTouches&&$.targetTouches[0])return $.targetTouches[0].identifier;if($.changedTouches&&$.changedTouches[0])return $.changedTouches[0].identifier}function bY0($){if(!$)return;let Z=$.getElementById("react-draggable-style-el");if(!Z)Z=$.createElement("style"),Z.type="text/css",Z.id="react-draggable-style-el",Z.innerHTML=`.react-draggable-transparent-selection *::-moz-selection {all: inherit;}
|
|
8
|
+
`,Z.innerHTML+=`.react-draggable-transparent-selection *::selection {all: inherit;}
|
|
9
|
+
`,$.getElementsByTagName("head")[0].appendChild(Z);if($.body)tr($.body,"react-draggable-transparent-selection")}function wY0($){if(window.requestAnimationFrame)window.requestAnimationFrame(()=>{or($)});else or($)}function or($){if(!$)return;try{if($.body)er($.body,"react-draggable-transparent-selection");if($.selection)$.selection.empty();else{let Z=($.defaultView||window).getSelection();if(Z&&Z.type!=="Caret")Z.removeAllRanges()}}catch(Z){}}function tr($,Z){if($.classList)$.classList.add(Z);else if(!$.className.match(new RegExp(`(?:^|\\s)${Z}(?!\\S)`)))$.className+=` ${Z}`}function er($,Z){if($.classList)$.classList.remove(Z);else $.className=$.className.replace(new RegExp(`(?:^|\\s)${Z}(?!\\S)`,"g"),"")}});var QO=b5((Za)=>{Object.defineProperty(Za,"__esModule",{value:!0});Za.canDragX=nY0;Za.canDragY=sY0;Za.createCoreData=eY0;Za.createDraggableData=$F0;Za.getBoundPosition=aY0;Za.getControlPosition=tY0;Za.snapToGrid=oY0;var C8=Jz(),$B=bN();function aY0($,Z,J){if(!$.props.bounds)return[Z,J];let{bounds:H}=$.props;H=typeof H==="string"?H:ZF0(H);let B=BO($);if(typeof H==="string"){let{ownerDocument:Q}=B,X=Q.defaultView,z;if(H==="parent")z=B.parentNode;else z=B.getRootNode().querySelector(H);if(!(z instanceof X.HTMLElement))throw Error('Bounds selector "'+H+'" could not find an element.');let G=z,U=X.getComputedStyle(B),Y=X.getComputedStyle(G);H={left:-B.offsetLeft+(0,C8.int)(Y.paddingLeft)+(0,C8.int)(U.marginLeft),top:-B.offsetTop+(0,C8.int)(Y.paddingTop)+(0,C8.int)(U.marginTop),right:(0,$B.innerWidth)(G)-(0,$B.outerWidth)(B)-B.offsetLeft+(0,C8.int)(Y.paddingRight)-(0,C8.int)(U.marginRight),bottom:(0,$B.innerHeight)(G)-(0,$B.outerHeight)(B)-B.offsetTop+(0,C8.int)(Y.paddingBottom)-(0,C8.int)(U.marginBottom)}}if((0,C8.isNum)(H.right))Z=Math.min(Z,H.right);if((0,C8.isNum)(H.bottom))J=Math.min(J,H.bottom);if((0,C8.isNum)(H.left))Z=Math.max(Z,H.left);if((0,C8.isNum)(H.top))J=Math.max(J,H.top);return[Z,J]}function oY0($,Z,J){let H=Math.round(Z/$[0])*$[0],B=Math.round(J/$[1])*$[1];return[H,B]}function nY0($){return $.props.axis==="both"||$.props.axis==="x"}function sY0($){return $.props.axis==="both"||$.props.axis==="y"}function tY0($,Z,J){let H=typeof Z==="number"?(0,$B.getTouch)($,Z):null;if(typeof Z==="number"&&!H)return null;let B=BO(J),Q=J.props.offsetParent||B.offsetParent||B.ownerDocument.body;return(0,$B.offsetXYFromParent)(H||$,Q,J.props.scale)}function eY0($,Z,J){let H=!(0,C8.isNum)($.lastX),B=BO($);if(H)return{node:B,deltaX:0,deltaY:0,lastX:Z,lastY:J,x:Z,y:J};else return{node:B,deltaX:Z-$.lastX,deltaY:J-$.lastY,lastX:$.lastX,lastY:$.lastY,x:Z,y:J}}function $F0($,Z){let J=$.props.scale;return{node:Z.node,x:$.state.x+Z.deltaX/J,y:$.state.y+Z.deltaY/J,deltaX:Z.deltaX/J,deltaY:Z.deltaY/J,lastX:$.state.x,lastY:$.state.y}}function ZF0($){return{left:$.left,top:$.top,right:$.right,bottom:$.bottom}}function BO($){let Z=$.findDOMNode();if(!Z)throw Error("<DraggableCore>: Unmounted during event!");return Z}});var XO=b5((Ja)=>{Object.defineProperty(Ja,"__esModule",{value:!0});Ja.default=UF0;function UF0(){}});var Xa=b5((Ba)=>{var NF0=P(m()),qF0=P(A8());Object.defineProperty(Ba,"__esModule",{value:!0});Ba.default=void 0;var zO=Ha(NF0),d4=UO(Zz()),FF0=UO(qF0),E4=bN(),u7=QO(),GO=Jz(),Hz=UO(XO());function UO($){return $&&$.__esModule?$:{default:$}}function Ha($,Z){if(typeof WeakMap=="function")var J=new WeakMap,H=new WeakMap;return(Ha=function(B,Q){if(!Q&&B&&B.__esModule)return B;var X,z,G={__proto__:null,default:B};if(B===null||typeof B!="object"&&typeof B!="function")return G;if(X=Q?H:J){if(X.has(B))return X.get(B);X.set(B,G)}for(let U in B)U!=="default"&&{}.hasOwnProperty.call(B,U)&&((z=(X=Object.defineProperty)&&Object.getOwnPropertyDescriptor(B,U))&&(z.get||z.set)?X(G,U,z):G[U]=B[U]);return G})($,Z)}function l4($,Z,J){return(Z=KF0(Z))in $?Object.defineProperty($,Z,{value:J,enumerable:!0,configurable:!0,writable:!0}):$[Z]=J,$}function KF0($){var Z=WF0($,"string");return typeof Z=="symbol"?Z:Z+""}function WF0($,Z){if(typeof $!="object"||!$)return $;var J=$[Symbol.toPrimitive];if(J!==void 0){var H=J.call($,Z||"default");if(typeof H!="object")return H;throw TypeError("@@toPrimitive must return a primitive value.")}return(Z==="string"?String:Number)($)}var b9={touch:{start:"touchstart",move:"touchmove",stop:"touchend"},mouse:{start:"mousedown",move:"mousemove",stop:"mouseup"}},p7=b9.mouse;class Bz extends zO.Component{constructor(){super(...arguments);l4(this,"dragging",!1),l4(this,"lastX",NaN),l4(this,"lastY",NaN),l4(this,"touchIdentifier",null),l4(this,"mounted",!1),l4(this,"handleDragStart",($)=>{if(this.props.onMouseDown($),!this.props.allowAnyClick&&typeof $.button==="number"&&$.button!==0)return!1;let Z=this.findDOMNode();if(!Z||!Z.ownerDocument||!Z.ownerDocument.body)throw Error("<DraggableCore> not mounted on DragStart!");let{ownerDocument:J}=Z;if(this.props.disabled||!($.target instanceof J.defaultView.Node)||this.props.handle&&!(0,E4.matchesSelectorAndParentsTo)($.target,this.props.handle,Z)||this.props.cancel&&(0,E4.matchesSelectorAndParentsTo)($.target,this.props.cancel,Z))return;if($.type==="touchstart"&&!this.props.allowMobileScroll)$.preventDefault();let H=(0,E4.getTouchIdentifier)($);this.touchIdentifier=H;let B=(0,u7.getControlPosition)($,H,this);if(B==null)return;let{x:Q,y:X}=B,z=(0,u7.createCoreData)(this,Q,X);if((0,Hz.default)("DraggableCore: handleDragStart: %j",z),(0,Hz.default)("calling",this.props.onStart),this.props.onStart($,z)===!1||this.mounted===!1)return;if(this.props.enableUserSelectHack)(0,E4.addUserSelectStyles)(J);this.dragging=!0,this.lastX=Q,this.lastY=X,(0,E4.addEvent)(J,p7.move,this.handleDrag),(0,E4.addEvent)(J,p7.stop,this.handleDragStop)}),l4(this,"handleDrag",($)=>{let Z=(0,u7.getControlPosition)($,this.touchIdentifier,this);if(Z==null)return;let{x:J,y:H}=Z;if(Array.isArray(this.props.grid)){let X=J-this.lastX,z=H-this.lastY;if([X,z]=(0,u7.snapToGrid)(this.props.grid,X,z),!X&&!z)return;J=this.lastX+X,H=this.lastY+z}let B=(0,u7.createCoreData)(this,J,H);if((0,Hz.default)("DraggableCore: handleDrag: %j",B),this.props.onDrag($,B)===!1||this.mounted===!1){try{this.handleDragStop(new MouseEvent("mouseup"))}catch(X){let z=document.createEvent("MouseEvents");z.initMouseEvent("mouseup",!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),this.handleDragStop(z)}return}this.lastX=J,this.lastY=H}),l4(this,"handleDragStop",($)=>{if(!this.dragging)return;let Z=(0,u7.getControlPosition)($,this.touchIdentifier,this);if(Z==null)return;let{x:J,y:H}=Z;if(Array.isArray(this.props.grid)){let z=J-this.lastX||0,G=H-this.lastY||0;[z,G]=(0,u7.snapToGrid)(this.props.grid,z,G),J=this.lastX+z,H=this.lastY+G}let B=(0,u7.createCoreData)(this,J,H);if(this.props.onStop($,B)===!1||this.mounted===!1)return!1;let X=this.findDOMNode();if(X){if(this.props.enableUserSelectHack)(0,E4.scheduleRemoveUserSelectStyles)(X.ownerDocument)}if((0,Hz.default)("DraggableCore: handleDragStop: %j",B),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,X)(0,Hz.default)("DraggableCore: Removing handlers"),(0,E4.removeEvent)(X.ownerDocument,p7.move,this.handleDrag),(0,E4.removeEvent)(X.ownerDocument,p7.stop,this.handleDragStop)}),l4(this,"onMouseDown",($)=>{return p7=b9.mouse,this.handleDragStart($)}),l4(this,"onMouseUp",($)=>{return p7=b9.mouse,this.handleDragStop($)}),l4(this,"onTouchStart",($)=>{return p7=b9.touch,this.handleDragStart($)}),l4(this,"onTouchEnd",($)=>{return p7=b9.touch,this.handleDragStop($)})}componentDidMount(){this.mounted=!0;let $=this.findDOMNode();if($)(0,E4.addEvent)($,b9.touch.start,this.onTouchStart,{passive:!1})}componentWillUnmount(){this.mounted=!1;let $=this.findDOMNode();if($){let{ownerDocument:Z}=$;if((0,E4.removeEvent)(Z,b9.mouse.move,this.handleDrag),(0,E4.removeEvent)(Z,b9.touch.move,this.handleDrag),(0,E4.removeEvent)(Z,b9.mouse.stop,this.handleDragStop),(0,E4.removeEvent)(Z,b9.touch.stop,this.handleDragStop),(0,E4.removeEvent)($,b9.touch.start,this.onTouchStart,{passive:!1}),this.props.enableUserSelectHack)(0,E4.scheduleRemoveUserSelectStyles)(Z)}}findDOMNode(){return this.props?.nodeRef?this.props?.nodeRef?.current:FF0.default.findDOMNode(this)}render(){return zO.cloneElement(zO.Children.only(this.props.children),{onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}}Ba.default=Bz;l4(Bz,"displayName","DraggableCore");l4(Bz,"propTypes",{allowAnyClick:d4.default.bool,allowMobileScroll:d4.default.bool,children:d4.default.node.isRequired,disabled:d4.default.bool,enableUserSelectHack:d4.default.bool,offsetParent:function($,Z){if($[Z]&&$[Z].nodeType!==1)throw Error("Draggable's offsetParent must be a DOM Node.")},grid:d4.default.arrayOf(d4.default.number),handle:d4.default.string,cancel:d4.default.string,nodeRef:d4.default.object,onStart:d4.default.func,onDrag:d4.default.func,onStop:d4.default.func,onMouseDown:d4.default.func,scale:d4.default.number,className:GO.dontSetMe,style:GO.dontSetMe,transform:GO.dontSetMe});l4(Bz,"defaultProps",{allowAnyClick:!1,allowMobileScroll:!1,disabled:!1,enableUserSelectHack:!0,onStart:function(){},onDrag:function(){},onStop:function(){},onMouseDown:function(){},scale:1})});var Ya=b5((KO)=>{var MF0=P(m()),PF0=P(A8());Object.defineProperty(KO,"__esModule",{value:!0});Object.defineProperty(KO,"DraggableCore",{enumerable:!0,get:function(){return RN.default}});KO.default=void 0;var wN=Ga(MF0),g5=IN(Zz()),AF0=IN(PF0),DF0=ur(),za=bN(),ZB=QO(),YO=Jz(),RN=IN(Xa()),SN=IN(XO());function IN($){return $&&$.__esModule?$:{default:$}}function Ga($,Z){if(typeof WeakMap=="function")var J=new WeakMap,H=new WeakMap;return(Ga=function(B,Q){if(!Q&&B&&B.__esModule)return B;var X,z,G={__proto__:null,default:B};if(B===null||typeof B!="object"&&typeof B!="function")return G;if(X=Q?H:J){if(X.has(B))return X.get(B);X.set(B,G)}for(let U in B)U!=="default"&&{}.hasOwnProperty.call(B,U)&&((z=(X=Object.defineProperty)&&Object.getOwnPropertyDescriptor(B,U))&&(z.get||z.set)?X(G,U,z):G[U]=B[U]);return G})($,Z)}function FO(){return FO=Object.assign?Object.assign.bind():function($){for(var Z=1;Z<arguments.length;Z++){var J=arguments[Z];for(var H in J)({}).hasOwnProperty.call(J,H)&&($[H]=J[H])}return $},FO.apply(null,arguments)}function JB($,Z,J){return(Z=VF0(Z))in $?Object.defineProperty($,Z,{value:J,enumerable:!0,configurable:!0,writable:!0}):$[Z]=J,$}function VF0($){var Z=LF0($,"string");return typeof Z=="symbol"?Z:Z+""}function LF0($,Z){if(typeof $!="object"||!$)return $;var J=$[Symbol.toPrimitive];if(J!==void 0){var H=J.call($,Z||"default");if(typeof H!="object")return H;throw TypeError("@@toPrimitive must return a primitive value.")}return(Z==="string"?String:Number)($)}class Qz extends wN.Component{static getDerivedStateFromProps($,Z){let{position:J}=$,{prevPropsPosition:H}=Z;if(J&&(!H||J.x!==H.x||J.y!==H.y))return(0,SN.default)("Draggable: getDerivedStateFromProps %j",{position:J,prevPropsPosition:H}),{x:J.x,y:J.y,prevPropsPosition:{...J}};return null}constructor($){super($);if(JB(this,"onDragStart",(Z,J)=>{if((0,SN.default)("Draggable: onDragStart: %j",J),this.props.onStart(Z,(0,ZB.createDraggableData)(this,J))===!1)return!1;this.setState({dragging:!0,dragged:!0})}),JB(this,"onDrag",(Z,J)=>{if(!this.state.dragging)return!1;(0,SN.default)("Draggable: onDrag: %j",J);let H=(0,ZB.createDraggableData)(this,J),B={x:H.x,y:H.y,slackX:0,slackY:0};if(this.props.bounds){let{x:X,y:z}=B;B.x+=this.state.slackX,B.y+=this.state.slackY;let[G,U]=(0,ZB.getBoundPosition)(this,B.x,B.y);B.x=G,B.y=U,B.slackX=this.state.slackX+(X-B.x),B.slackY=this.state.slackY+(z-B.y),H.x=B.x,H.y=B.y,H.deltaX=B.x-this.state.x,H.deltaY=B.y-this.state.y}if(this.props.onDrag(Z,H)===!1)return!1;this.setState(B)}),JB(this,"onDragStop",(Z,J)=>{if(!this.state.dragging)return!1;if(this.props.onStop(Z,(0,ZB.createDraggableData)(this,J))===!1)return!1;(0,SN.default)("Draggable: onDragStop: %j",J);let B={dragging:!1,slackX:0,slackY:0};if(Boolean(this.props.position)){let{x:X,y:z}=this.props.position;B.x=X,B.y=z}this.setState(B)}),this.state={dragging:!1,dragged:!1,x:$.position?$.position.x:$.defaultPosition.x,y:$.position?$.position.y:$.defaultPosition.y,prevPropsPosition:{...$.position},slackX:0,slackY:0,isElementSVG:!1},$.position&&!($.onDrag||$.onStop))console.warn("A `position` was applied to this <Draggable>, without drag handlers. This will make this component effectively undraggable. Please attach `onDrag` or `onStop` handlers so you can adjust the `position` of this element.")}componentDidMount(){if(typeof window.SVGElement<"u"&&this.findDOMNode()instanceof window.SVGElement)this.setState({isElementSVG:!0})}componentWillUnmount(){if(this.state.dragging)this.setState({dragging:!1})}findDOMNode(){return this.props?.nodeRef?.current??AF0.default.findDOMNode(this)}render(){let{axis:$,bounds:Z,children:J,defaultPosition:H,defaultClassName:B,defaultClassNameDragging:Q,defaultClassNameDragged:X,position:z,positionOffset:G,scale:U,...Y}=this.props,F={},K=null,N=!Boolean(z)||this.state.dragging,q=z||H,D={x:(0,ZB.canDragX)(this)&&N?this.state.x:q.x,y:(0,ZB.canDragY)(this)&&N?this.state.y:q.y};if(this.state.isElementSVG)K=(0,za.createSVGTransform)(D,G);else F=(0,za.createCSSTransform)(D,G);let A=(0,DF0.clsx)(J.props.className||"",B,{[Q]:this.state.dragging,[X]:this.state.dragged});return wN.createElement(RN.default,FO({},Y,{onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop}),wN.cloneElement(wN.Children.only(J),{className:A,style:{...J.props.style,...F},transform:K}))}}KO.default=Qz;JB(Qz,"displayName","Draggable");JB(Qz,"propTypes",{...RN.default.propTypes,axis:g5.default.oneOf(["both","x","y","none"]),bounds:g5.default.oneOfType([g5.default.shape({left:g5.default.number,right:g5.default.number,top:g5.default.number,bottom:g5.default.number}),g5.default.string,g5.default.oneOf([!1])]),defaultClassName:g5.default.string,defaultClassNameDragging:g5.default.string,defaultClassNameDragged:g5.default.string,defaultPosition:g5.default.shape({x:g5.default.number,y:g5.default.number}),positionOffset:g5.default.shape({x:g5.default.oneOfType([g5.default.number,g5.default.string]),y:g5.default.oneOfType([g5.default.number,g5.default.string])}),position:g5.default.shape({x:g5.default.number,y:g5.default.number}),className:YO.dontSetMe,style:YO.dontSetMe,transform:YO.dontSetMe});JB(Qz,"defaultProps",{...RN.default.defaultProps,axis:"both",bounds:!1,defaultClassName:"react-draggable",defaultClassNameDragging:"react-draggable-dragging",defaultClassNameDragged:"react-draggable-dragged",defaultPosition:{x:0,y:0},scale:1})});var yN=b5((IP1,kN)=>{var{default:Fa,DraggableCore:_F0}=Ya();kN.exports=Fa;kN.exports.default=Fa;kN.exports.DraggableCore=_F0});var Na=b5((wF0)=>{var IF0=P(m());wF0.__esModule=!0;wF0.cloneElement=bF0;var OF0=TF0(IF0);function TF0($){return $&&$.__esModule?$:{default:$}}function Ka($,Z){var J=Object.keys($);if(Object.getOwnPropertySymbols){var H=Object.getOwnPropertySymbols($);Z&&(H=H.filter(function(B){return Object.getOwnPropertyDescriptor($,B).enumerable})),J.push.apply(J,H)}return J}function Wa($){for(var Z=1;Z<arguments.length;Z++){var J=arguments[Z]!=null?arguments[Z]:{};Z%2?Ka(Object(J),!0).forEach(function(H){jF0($,H,J[H])}):Object.getOwnPropertyDescriptors?Object.defineProperties($,Object.getOwnPropertyDescriptors(J)):Ka(Object(J)).forEach(function(H){Object.defineProperty($,H,Object.getOwnPropertyDescriptor(J,H))})}return $}function jF0($,Z,J){return(Z=CF0(Z))in $?Object.defineProperty($,Z,{value:J,enumerable:!0,configurable:!0,writable:!0}):$[Z]=J,$}function CF0($){var Z=EF0($,"string");return typeof Z=="symbol"?Z:Z+""}function EF0($,Z){if(typeof $!="object"||!$)return $;var J=$[Symbol.toPrimitive];if(J!==void 0){var H=J.call($,Z||"default");if(typeof H!="object")return H;throw TypeError("@@toPrimitive must return a primitive value.")}return(Z==="string"?String:Number)($)}function bF0($,Z){if(Z.style&&$.props.style)Z.style=Wa(Wa({},$.props.style),Z.style);if(Z.className&&$.props.className)Z.className=$.props.className+" "+Z.className;return OF0.default.cloneElement($,Z)}});var WO=b5((yF0)=>{yF0.__esModule=!0;yF0.resizableProps=void 0;var S1=kF0(Zz()),yP1=yN();function kF0($){return $&&$.__esModule?$:{default:$}}var xP1=yF0.resizableProps={axis:S1.default.oneOf(["both","x","y","none"]),className:S1.default.string,children:S1.default.element.isRequired,draggableOpts:S1.default.shape({allowAnyClick:S1.default.bool,cancel:S1.default.string,children:S1.default.node,disabled:S1.default.bool,enableUserSelectHack:S1.default.bool,offsetParent:typeof Element<"u"?S1.default.instanceOf(Element):S1.default.any,grid:S1.default.arrayOf(S1.default.number),handle:S1.default.string,nodeRef:S1.default.object,onStart:S1.default.func,onDrag:S1.default.func,onStop:S1.default.func,onMouseDown:S1.default.func,scale:S1.default.number}),height:function(){for(var $=arguments.length,Z=Array($),J=0;J<$;J++)Z[J]=arguments[J];let H=Z[0];if(H.axis==="both"||H.axis==="y")return S1.default.number.isRequired(...Z);return S1.default.number(...Z)},handle:S1.default.oneOfType([S1.default.node,S1.default.func]),handleSize:S1.default.arrayOf(S1.default.number),lockAspectRatio:S1.default.bool,maxConstraints:S1.default.arrayOf(S1.default.number),minConstraints:S1.default.arrayOf(S1.default.number),onResizeStop:S1.default.func,onResizeStart:S1.default.func,onResize:S1.default.func,resizeHandles:S1.default.arrayOf(S1.default.oneOf(["s","w","e","n","sw","nw","se","ne"])),transformScale:S1.default.number,width:function(){for(var $=arguments.length,Z=Array($),J=0;J<$;J++)Z[J]=arguments[J];let H=Z[0];if(H.axis==="both"||H.axis==="x")return S1.default.number.isRequired(...Z);return S1.default.number(...Z)}}});var AO=b5((dF0)=>{var iF0=P(m());dF0.__esModule=!0;dF0.default=void 0;var HB=Da(iF0),hF0=yN(),vF0=Na(),fF0=WO(),gF0=["children","className","draggableOpts","width","height","handle","handleSize","lockAspectRatio","axis","minConstraints","maxConstraints","onResize","onResizeStop","onResizeStart","resizeHandles","transformScale"];function Da($,Z){if(typeof WeakMap=="function")var J=new WeakMap,H=new WeakMap;return(Da=function(B,Q){if(!Q&&B&&B.__esModule)return B;var X,z,G={__proto__:null,default:B};if(B===null||typeof B!="object"&&typeof B!="function")return G;if(X=Q?H:J){if(X.has(B))return X.get(B);X.set(B,G)}for(let U in B)U!=="default"&&{}.hasOwnProperty.call(B,U)&&((z=(X=Object.defineProperty)&&Object.getOwnPropertyDescriptor(B,U))&&(z.get||z.set)?X(G,U,z):G[U]=B[U]);return G})($,Z)}function qO(){return qO=Object.assign?Object.assign.bind():function($){for(var Z=1;Z<arguments.length;Z++){var J=arguments[Z];for(var H in J)({}).hasOwnProperty.call(J,H)&&($[H]=J[H])}return $},qO.apply(null,arguments)}function mF0($,Z){if($==null)return{};var J={};for(var H in $)if({}.hasOwnProperty.call($,H)){if(Z.indexOf(H)!==-1)continue;J[H]=$[H]}return J}function Aa($,Z){var J=Object.keys($);if(Object.getOwnPropertySymbols){var H=Object.getOwnPropertySymbols($);Z&&(H=H.filter(function(B){return Object.getOwnPropertyDescriptor($,B).enumerable})),J.push.apply(J,H)}return J}function NO($){for(var Z=1;Z<arguments.length;Z++){var J=arguments[Z]!=null?arguments[Z]:{};Z%2?Aa(Object(J),!0).forEach(function(H){uF0($,H,J[H])}):Object.getOwnPropertyDescriptors?Object.defineProperties($,Object.getOwnPropertyDescriptors(J)):Aa(Object(J)).forEach(function(H){Object.defineProperty($,H,Object.getOwnPropertyDescriptor(J,H))})}return $}function uF0($,Z,J){return(Z=pF0(Z))in $?Object.defineProperty($,Z,{value:J,enumerable:!0,configurable:!0,writable:!0}):$[Z]=J,$}function pF0($){var Z=cF0($,"string");return typeof Z=="symbol"?Z:Z+""}function cF0($,Z){if(typeof $!="object"||!$)return $;var J=$[Symbol.toPrimitive];if(J!==void 0){var H=J.call($,Z||"default");if(typeof H!="object")return H;throw TypeError("@@toPrimitive must return a primitive value.")}return(Z==="string"?String:Number)($)}class xN extends HB.Component{constructor(){super(...arguments);this.handleRefs={},this.lastHandleRect=null,this.slack=null,this.lastSize=null}componentWillUnmount(){this.resetData()}resetData(){this.lastHandleRect=this.slack=this.lastSize=null}runConstraints($,Z){let J=this.props,H=J.minConstraints,B=J.maxConstraints,Q=J.lockAspectRatio;if(!H&&!B&&!Q)return[$,Z];if(Q){let F=this.props.width/this.props.height,K=$-this.props.width,W=Z-this.props.height;if(Math.abs(K)>Math.abs(W*F))Z=$/F;else $=Z*F}let X=$,z=Z,G=this.slack||[0,0],U=G[0],Y=G[1];if($+=U,Z+=Y,H)$=Math.max(H[0],$),Z=Math.max(H[1],Z);if(B)$=Math.min(B[0],$),Z=Math.min(B[1],Z);return this.slack=[U+(X-$),Y+(z-Z)],[$,Z]}resizeHandler($,Z){return(J,H)=>{var B,Q,X,z;let{node:G,deltaX:U,deltaY:Y}=H;if($==="onResizeStart")this.resetData();let F=(this.props.axis==="both"||this.props.axis==="x")&&Z!=="n"&&Z!=="s",K=(this.props.axis==="both"||this.props.axis==="y")&&Z!=="e"&&Z!=="w";if(!F&&!K)return;let W=Z[0],N=Z[Z.length-1],q=G.getBoundingClientRect();if(this.lastHandleRect!=null){if(N==="w"){let E=q.left-this.lastHandleRect.left;U+=E}if(W==="n"){let E=q.top-this.lastHandleRect.top;Y+=E}}if(this.lastHandleRect=q,N==="w")U=-U;if(W==="n")Y=-Y;let D=(B=(Q=this.lastSize)==null?void 0:Q.width)!=null?B:this.props.width,A=(X=(z=this.lastSize)==null?void 0:z.height)!=null?X:this.props.height,V=D+(F?U/this.props.transformScale:0),L=A+(K?Y/this.props.transformScale:0);var O=this.runConstraints(V,L);if(V=O[0],L=O[1],$==="onResizeStop"&&this.lastSize){var M=this.lastSize;V=M.width,L=M.height}let _=V!==D||L!==A;if($!=="onResizeStop")this.lastSize={width:V,height:L};let w=typeof this.props[$]==="function"?this.props[$]:null;if(w&&!($==="onResize"&&!_))J.persist==null||J.persist(),w(J,{node:G,size:{width:V,height:L},handle:Z});if($==="onResizeStop")this.resetData()}}renderResizeHandle($,Z){let J=this.props.handle;if(!J)return HB.createElement("span",{className:"react-resizable-handle react-resizable-handle-"+$,ref:Z});if(typeof J==="function")return J($,Z);let H=typeof J.type==="string",B=NO({ref:Z},H?{}:{handleAxis:$});return HB.cloneElement(J,B)}render(){let $=this.props,Z=$.children,J=$.className,H=$.draggableOpts,B=$.width,Q=$.height,X=$.handle,z=$.handleSize,G=$.lockAspectRatio,U=$.axis,Y=$.minConstraints,F=$.maxConstraints,K=$.onResize,W=$.onResizeStop,N=$.onResizeStart,q=$.resizeHandles,D=$.transformScale,A=mF0($,gF0);return(0,vF0.cloneElement)(Z,NO(NO({},A),{},{className:(J?J+" ":"")+"react-resizable",children:[...HB.Children.toArray(Z.props.children),...q.map((V)=>{var L;let O=(L=this.handleRefs[V])!=null?L:this.handleRefs[V]=HB.createRef();return HB.createElement(hF0.DraggableCore,qO({},H,{nodeRef:O,key:"resizableHandle-"+V,onStop:this.resizeHandler("onResizeStop",V),onStart:this.resizeHandler("onResizeStart",V),onDrag:this.resizeHandler("onResize",V)}),this.renderResizeHandle(V,O))})]}))}}dF0.default=xN;xN.propTypes=fF0.resizableProps;xN.defaultProps={axis:"both",handleSize:[20,20],lockAspectRatio:!1,minConstraints:[20,20],maxConstraints:[1/0,1/0],resizeHandles:["se"],transformScale:1}});var Oa=b5((ZK0)=>{var HK0=P(m());ZK0.__esModule=!0;ZK0.default=void 0;var DO=Pa(HK0),rF0=Ma(Zz()),aF0=Ma(AO()),oF0=WO(),nF0=["handle","handleSize","onResize","onResizeStart","onResizeStop","draggableOpts","minConstraints","maxConstraints","lockAspectRatio","axis","width","height","resizeHandles","style","transformScale"];function Ma($){return $&&$.__esModule?$:{default:$}}function Pa($,Z){if(typeof WeakMap=="function")var J=new WeakMap,H=new WeakMap;return(Pa=function(B,Q){if(!Q&&B&&B.__esModule)return B;var X,z,G={__proto__:null,default:B};if(B===null||typeof B!="object"&&typeof B!="function")return G;if(X=Q?H:J){if(X.has(B))return X.get(B);X.set(B,G)}for(let U in B)U!=="default"&&{}.hasOwnProperty.call(B,U)&&((z=(X=Object.defineProperty)&&Object.getOwnPropertyDescriptor(B,U))&&(z.get||z.set)?X(G,U,z):G[U]=B[U]);return G})($,Z)}function VO(){return VO=Object.assign?Object.assign.bind():function($){for(var Z=1;Z<arguments.length;Z++){var J=arguments[Z];for(var H in J)({}).hasOwnProperty.call(J,H)&&($[H]=J[H])}return $},VO.apply(null,arguments)}function La($,Z){var J=Object.keys($);if(Object.getOwnPropertySymbols){var H=Object.getOwnPropertySymbols($);Z&&(H=H.filter(function(B){return Object.getOwnPropertyDescriptor($,B).enumerable})),J.push.apply(J,H)}return J}function hN($){for(var Z=1;Z<arguments.length;Z++){var J=arguments[Z]!=null?arguments[Z]:{};Z%2?La(Object(J),!0).forEach(function(H){sF0($,H,J[H])}):Object.getOwnPropertyDescriptors?Object.defineProperties($,Object.getOwnPropertyDescriptors(J)):La(Object(J)).forEach(function(H){Object.defineProperty($,H,Object.getOwnPropertyDescriptor(J,H))})}return $}function sF0($,Z,J){return(Z=tF0(Z))in $?Object.defineProperty($,Z,{value:J,enumerable:!0,configurable:!0,writable:!0}):$[Z]=J,$}function tF0($){var Z=eF0($,"string");return typeof Z=="symbol"?Z:Z+""}function eF0($,Z){if(typeof $!="object"||!$)return $;var J=$[Symbol.toPrimitive];if(J!==void 0){var H=J.call($,Z||"default");if(typeof H!="object")return H;throw TypeError("@@toPrimitive must return a primitive value.")}return(Z==="string"?String:Number)($)}function $K0($,Z){if($==null)return{};var J={};for(var H in $)if({}.hasOwnProperty.call($,H)){if(Z.indexOf(H)!==-1)continue;J[H]=$[H]}return J}class LO extends DO.Component{constructor(){super(...arguments);this.state={width:this.props.width,height:this.props.height,propsWidth:this.props.width,propsHeight:this.props.height},this.onResize=($,Z)=>{let J=Z.size;if(this.props.onResize)$.persist==null||$.persist(),this.setState(J,()=>this.props.onResize&&this.props.onResize($,Z));else this.setState(J)}}static getDerivedStateFromProps($,Z){if(Z.propsWidth!==$.width||Z.propsHeight!==$.height)return{width:$.width,height:$.height,propsWidth:$.width,propsHeight:$.height};return null}render(){let $=this.props,Z=$.handle,J=$.handleSize,H=$.onResize,B=$.onResizeStart,Q=$.onResizeStop,X=$.draggableOpts,z=$.minConstraints,G=$.maxConstraints,U=$.lockAspectRatio,Y=$.axis,F=$.width,K=$.height,W=$.resizeHandles,N=$.style,q=$.transformScale,D=$K0($,nF0);return DO.createElement(aF0.default,{axis:Y,draggableOpts:X,handle:Z,handleSize:J,height:this.state.height,lockAspectRatio:U,maxConstraints:G,minConstraints:z,onResizeStart:B,onResize:this.onResize,onResizeStop:Q,resizeHandles:W,transformScale:q,width:this.state.width},DO.createElement("div",VO({},D,{style:hN(hN({},N),{},{width:this.state.width+"px",height:this.state.height+"px"})})))}}ZK0.default=LO;LO.propTypes=hN(hN({},oF0.resizableProps),{},{children:rF0.default.element})});var MO=b5((gP1,vN)=>{vN.exports=function(){throw Error("Don't instantiate Resizable directly! Use require('react-resizable').Resizable")};vN.exports.Resizable=AO().default;vN.exports.ResizableBox=Oa().default});var Fs=b5((wq,Ys)=>{(function($,Z){typeof wq==="object"&&typeof Ys<"u"?Z(wq):typeof define==="function"&&define.amd?define(["exports"],Z):($=typeof globalThis<"u"?globalThis:$||self,Z($["fast-equals"]={}))})(wq,function($){function Z(c){return function(n,Z0,J0,U0,z0,X0,N0){return c(n,Z0,N0)}}function J(c){return function(n,Z0,J0,U0){if(!n||!Z0||typeof n!=="object"||typeof Z0!=="object")return c(n,Z0,J0,U0);var z0=U0.get(n),X0=U0.get(Z0);if(z0&&X0)return z0===Z0&&X0===n;U0.set(n,Z0),U0.set(Z0,n);var N0=c(n,Z0,J0,U0);return U0.delete(n),U0.delete(Z0),N0}}function H(c,i){var n={};for(var Z0 in c)n[Z0]=c[Z0];for(var Z0 in i)n[Z0]=i[Z0];return n}function B(c){return c.constructor===Object||c.constructor==null}function Q(c){return typeof c.then==="function"}function X(c,i){return c===i||c!==c&&i!==i}var z="[object Arguments]",G="[object Boolean]",U="[object Date]",Y="[object RegExp]",F="[object Map]",K="[object Number]",W="[object Object]",N="[object Set]",q="[object String]",D=Object.prototype.toString;function A(c){var{areArraysEqual:i,areDatesEqual:n,areMapsEqual:Z0,areObjectsEqual:J0,areRegExpsEqual:U0,areSetsEqual:z0,createIsNestedEqual:X0}=c,N0=X0(q0);function q0(K0,s,a){if(K0===s)return!0;if(!K0||!s||typeof K0!=="object"||typeof s!=="object")return K0!==K0&&s!==s;if(B(K0)&&B(s))return J0(K0,s,N0,a);var $0=Array.isArray(K0),t=Array.isArray(s);if($0||t)return $0===t&&i(K0,s,N0,a);var B0=D.call(K0);if(B0!==D.call(s))return!1;if(B0===U)return n(K0,s,N0,a);if(B0===Y)return U0(K0,s,N0,a);if(B0===F)return Z0(K0,s,N0,a);if(B0===N)return z0(K0,s,N0,a);if(B0===W||B0===z)return Q(K0)||Q(s)?!1:J0(K0,s,N0,a);if(B0===G||B0===K||B0===q)return X(K0.valueOf(),s.valueOf());return!1}return q0}function V(c,i,n,Z0){var J0=c.length;if(i.length!==J0)return!1;while(J0-- >0)if(!n(c[J0],i[J0],J0,J0,c,i,Z0))return!1;return!0}var L=J(V);function O(c,i){return X(c.valueOf(),i.valueOf())}function M(c,i,n,Z0){var J0=c.size===i.size;if(!J0)return!1;if(!c.size)return!0;var U0={},z0=0;return c.forEach(function(X0,N0){if(!J0)return;var q0=!1,K0=0;i.forEach(function(s,a){if(!q0&&!U0[K0]&&(q0=n(N0,a,z0,K0,c,i,Z0)&&n(X0,s,N0,a,c,i,Z0)))U0[K0]=!0;K0++}),z0++,J0=q0}),J0}var _=J(M),w="_owner",C=Object.prototype.hasOwnProperty;function E(c,i,n,Z0){var J0=Object.keys(c),U0=J0.length;if(Object.keys(i).length!==U0)return!1;var z0;while(U0-- >0){if(z0=J0[U0],z0===w){var X0=!!c.$$typeof,N0=!!i.$$typeof;if((X0||N0)&&X0!==N0)return!1}if(!C.call(i,z0)||!n(c[z0],i[z0],z0,z0,c,i,Z0))return!1}return!0}var T=J(E);function k(c,i){return c.source===i.source&&c.flags===i.flags}function S(c,i,n,Z0){var J0=c.size===i.size;if(!J0)return!1;if(!c.size)return!0;var U0={};return c.forEach(function(z0,X0){if(!J0)return;var N0=!1,q0=0;i.forEach(function(K0,s){if(!N0&&!U0[q0]&&(N0=n(z0,K0,X0,s,c,i,Z0)))U0[q0]=!0;q0++}),J0=N0}),J0}var I=J(S),j=Object.freeze({areArraysEqual:V,areDatesEqual:O,areMapsEqual:M,areObjectsEqual:E,areRegExpsEqual:k,areSetsEqual:S,createIsNestedEqual:Z}),y=Object.freeze({areArraysEqual:L,areDatesEqual:O,areMapsEqual:_,areObjectsEqual:T,areRegExpsEqual:k,areSetsEqual:I,createIsNestedEqual:Z}),R=A(j);function x(c,i){return R(c,i,void 0)}var v=A(H(j,{createIsNestedEqual:function(){return X}}));function f(c,i){return v(c,i,void 0)}var b=A(y);function l(c,i){return b(c,i,new WeakMap)}var r=A(H(y,{createIsNestedEqual:function(){return X}}));function h(c,i){return r(c,i,new WeakMap)}function d(c){return A(H(j,c(j)))}function o(c){var i=A(H(y,c(y)));return function(n,Z0,J0){if(J0===void 0)J0=new WeakMap;return i(n,Z0,J0)}}$.circularDeepEqual=l,$.circularShallowEqual=h,$.createCustomCircularEqual=o,$.createCustomEqual=d,$.deepEqual=x,$.sameValueZeroEqual=X,$.shallowEqual=f,Object.defineProperty($,"__esModule",{value:!0})})});var gZ=P(m(),1),kT=P(u(),1),$A=gZ.createContext(void 0),a0=($)=>{let Z=gZ.useContext($A);if($)return $;if(!Z)throw Error("No QueryClient set, use QueryClientProvider to set one");return Z},ZA=({client:$,children:Z})=>{return gZ.useEffect(()=>{return $.mount(),()=>{$.unmount()}},[$]),kT.jsx($A.Provider,{value:$,children:Z})};var vz=P(m(),1),yT=vz.createContext(!1),xT=()=>vz.useContext(yT),cq0=yT.Provider;var _B=P(m(),1),we=P(u(),1);function Se(){let $=!1;return{clearReset:()=>{$=!1},reset:()=>{$=!0},isReset:()=>{return $}}}var Re=_B.createContext(Se()),hT=()=>_B.useContext(Re);var Jj=P(m(),1);var Ie={setTimeout:($,Z)=>setTimeout($,Z),clearTimeout:($)=>clearTimeout($),setInterval:($,Z)=>setInterval($,Z),clearInterval:($)=>clearInterval($)},ke=class{#$=Ie;#Z=!1;setTimeoutProvider($){this.#$=$}setTimeout($,Z){return this.#$.setTimeout($,Z)}clearTimeout($){this.#$.clearTimeout($)}setInterval($,Z){return this.#$.setInterval($,Z)}clearInterval($){this.#$.clearInterval($)}},f9=new ke;function vT($){setTimeout($,0)}var HA=typeof window>"u"||"Deno"in globalThis;function l5(){}function mT($,Z){return typeof $==="function"?$(Z):$}function fz($){return typeof $==="number"&&$>=0&&$!==1/0}function gz($,Z){return Math.max($+(Z||0)-Date.now(),0)}function h5($,Z){return typeof $==="function"?$(Z):$}function mz($,Z){let{type:J="all",exact:H,fetchStatus:B,predicate:Q,queryKey:X,stale:z}=$;if(X){if(H){if(Z.queryHash!==OB(X,Z.options))return!1}else if(!V6(Z.queryKey,X))return!1}if(J!=="all"){let G=Z.isActive();if(J==="active"&&!G)return!1;if(J==="inactive"&&G)return!1}if(typeof z==="boolean"&&Z.isStale()!==z)return!1;if(B&&B!==Z.state.fetchStatus)return!1;if(Q&&!Q(Z))return!1;return!0}function uz($,Z){let{exact:J,status:H,predicate:B,mutationKey:Q}=$;if(Q){if(!Z.options.mutationKey)return!1;if(J){if(g9(Z.options.mutationKey)!==g9(Q))return!1}else if(!V6(Z.options.mutationKey,Q))return!1}if(H&&Z.state.status!==H)return!1;if(B&&!B(Z))return!1;return!0}function OB($,Z){return(Z?.queryKeyHashFn||g9)($)}function g9($){return JSON.stringify($,(Z,J)=>JA(J)?Object.keys(J).sort().reduce((H,B)=>{return H[B]=J[B],H},{}):J)}function V6($,Z){if($===Z)return!0;if(typeof $!==typeof Z)return!1;if($&&Z&&typeof $==="object"&&typeof Z==="object"){if(Array.isArray($)&&Array.isArray(Z)){for(let H=0;H<Z.length;H++)if(!V6($[H],Z[H]))return!1;return!0}let J=Object.keys(Z);for(let H of J)if(!V6($[H],Z[H]))return!1;return!0}return!1}var ye=Object.prototype.hasOwnProperty;function TB($,Z,J=0){if($===Z)return $;if(J>500)return Z;let H=fT($)&&fT(Z);if(!H&&!(JA($)&&JA(Z)))return Z;let B=(H?$:Object.keys($)).length,Q=H?Z:Object.keys(Z),X=Q.length,z=H?Array(X):{},G=0;for(let U=0;U<X;U++){let Y=H?U:Q[U],F=$[Y],K=Z[Y];if(F===K){if(z[Y]=F,H?U<B:ye.call($,Y))G++;continue}if(F===null||K===null||typeof F!=="object"||typeof K!=="object"){z[Y]=K;continue}let W=TB(F,K,J+1);if(z[Y]=W,W===F)G++}return B===X&&G===B?$:z}function mZ($,Z){if(!Z||Object.keys($).length!==Object.keys(Z).length)return!1;for(let J in $)if($[J]!==Z[J])return!1;return!0}function fT($){return Array.isArray($)&&$.length===Object.keys($).length}function JA($){if(!gT($))return!1;let Z=$.constructor;if(Z===void 0)return!0;let J=Z.prototype;if(!gT(J))return!1;if(!J.hasOwnProperty("isPrototypeOf"))return!1;if(Object.getPrototypeOf($)!==Object.prototype)return!1;return!0}function gT($){return Object.prototype.toString.call($)==="[object Object]"}function uT($){return new Promise((Z)=>{f9.setTimeout(Z,$)})}function jB($,Z,J){if(typeof J.structuralSharing==="function")return J.structuralSharing($,Z);else if(J.structuralSharing!==!1)return TB($,Z);return Z}function pT($,Z,J=0){let H=[...$,Z];return J&&H.length>J?H.slice(1):H}function cT($,Z,J=0){let H=[Z,...$];return J&&H.length>J?H.slice(0,-1):H}var uZ=Symbol();function pz($,Z){if(!$.queryFn&&Z?.initialPromise)return()=>Z.initialPromise;if(!$.queryFn||$.queryFn===uZ)return()=>Promise.reject(Error(`Missing queryFn: '${$.queryHash}'`));return $.queryFn}function pZ($,Z){if(typeof $==="function")return $(...Z);return!!$}function dT($,Z,J){let H=!1,B;return Object.defineProperty($,"signal",{enumerable:!0,get:()=>{if(B??=Z(),H)return B;if(H=!0,B.aborted)J();else B.addEventListener("abort",J,{once:!0});return B}}),$}var xe=()=>HA,cZ=()=>xe();var S8=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe($){return this.listeners.add($),this.onSubscribe(),()=>{this.listeners.delete($),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}};var he=class extends S8{#$;#Z;#J;constructor(){super();this.#J=($)=>{if(typeof window<"u"&&window.addEventListener){let Z=()=>$();return window.addEventListener("visibilitychange",Z,!1),()=>{window.removeEventListener("visibilitychange",Z)}}}}onSubscribe(){if(!this.#Z)this.setEventListener(this.#J)}onUnsubscribe(){if(!this.hasListeners())this.#Z?.(),this.#Z=void 0}setEventListener($){this.#J=$,this.#Z?.(),this.#Z=$((Z)=>{if(typeof Z==="boolean")this.setFocused(Z);else this.onFocus()})}setFocused($){if(this.#$!==$)this.#$=$,this.onFocus()}onFocus(){let $=this.isFocused();this.listeners.forEach((Z)=>{Z($)})}isFocused(){if(typeof this.#$==="boolean")return this.#$;return globalThis.document?.visibilityState!=="hidden"}},dZ=new he;var lT=vT;function ve(){let $=[],Z=0,J=(z)=>{z()},H=(z)=>{z()},B=lT,Q=(z)=>{if(Z)$.push(z);else B(()=>{J(z)})},X=()=>{let z=$;if($=[],z.length)B(()=>{H(()=>{z.forEach((G)=>{J(G)})})})};return{batch:(z)=>{let G;Z++;try{G=z()}finally{if(Z--,!Z)X()}return G},batchCalls:(z)=>{return(...G)=>{Q(()=>{z(...G)})}},schedule:Q,setNotifyFunction:(z)=>{J=z},setBatchNotifyFunction:(z)=>{H=z},setScheduler:(z)=>{B=z}}}var Y5=ve();var fe=class extends S8{#$=!0;#Z;#J;constructor(){super();this.#J=($)=>{if(typeof window<"u"&&window.addEventListener){let Z=()=>$(!0),J=()=>$(!1);return window.addEventListener("online",Z,!1),window.addEventListener("offline",J,!1),()=>{window.removeEventListener("online",Z),window.removeEventListener("offline",J)}}}}onSubscribe(){if(!this.#Z)this.setEventListener(this.#J)}onUnsubscribe(){if(!this.hasListeners())this.#Z?.(),this.#Z=void 0}setEventListener($){this.#J=$,this.#Z?.(),this.#Z=$(this.setOnline.bind(this))}setOnline($){if(this.#$!==$)this.#$=$,this.listeners.forEach((Z)=>{Z($)})}isOnline(){return this.#$}},lZ=new fe;function ge($){return Math.min(1000*2**$,30000)}function BA($){return($??"online")==="online"?lZ.isOnline():!0}var cz=class extends Error{constructor($){super("CancelledError");this.revert=$?.revert,this.silent=$?.silent}};function dz($){let Z=!1,J=0,H,B="pending",Q,X,z=new Promise((V,L)=>{Q=V,X=L});z.catch(l5);let G=()=>B!=="pending",U=(V)=>{if(!G()){let L=new cz(V);q(L),$.onCancel?.(L)}},Y=()=>{Z=!0},F=()=>{Z=!1},K=()=>dZ.isFocused()&&($.networkMode==="always"||lZ.isOnline())&&$.canRun(),W=()=>BA($.networkMode)&&$.canRun(),N=(V)=>{if(!G())H?.(),B="resolved",Q(V)},q=(V)=>{if(!G())H?.(),B="rejected",X(V)},D=()=>{return new Promise((V)=>{H=(L)=>{if(G()||K())V(L)},$.onPause?.()}).then(()=>{if(H=void 0,!G())$.onContinue?.()})},A=()=>{if(G())return;let V,L=J===0?$.initialPromise:void 0;try{V=L??$.fn()}catch(O){V=Promise.reject(O)}Promise.resolve(V).then(N).catch((O)=>{if(G())return;let M=$.retry??(cZ()?0:3),_=$.retryDelay??ge,w=typeof _==="function"?_(J,O):_,C=M===!0||typeof M==="number"&&J<M||typeof M==="function"&&M(J,O);if(Z||!C){q(O);return}J++,$.onFail?.(J,O),uT(w).then(()=>{return K()?void 0:D()}).then(()=>{if(Z)q(O);else A()})})};return{promise:z,status:()=>B,cancel:U,continue:()=>{return H?.(),z},cancelRetry:Y,continueRetry:F,canStart:W,start:()=>{if(W())A();else D().then(A);return z}}}var lz=class{#$;destroy(){this.clearGcTimeout()}scheduleGc(){if(this.clearGcTimeout(),fz(this.gcTime))this.#$=f9.setTimeout(()=>{this.optionalRemove()},this.gcTime)}updateGcTime($){this.gcTime=Math.max(this.gcTime||0,$??(cZ()?1/0:300000))}clearGcTimeout(){if(this.#$!==void 0)f9.clearTimeout(this.#$),this.#$=void 0}};function rT($){return{onFetch:(Z,J)=>{let H=Z.options,B=Z.fetchOptions?.meta?.fetchMore?.direction,Q=Z.state.data?.pages||[],X=Z.state.data?.pageParams||[],z={pages:[],pageParams:[]},G=0,U=async()=>{let Y=!1,F=(N)=>{dT(N,()=>Z.signal,()=>Y=!0)},K=pz(Z.options,Z.fetchOptions),W=async(N,q,D)=>{if(Y)return Promise.reject(Z.signal.reason);if(q==null&&N.pages.length)return Promise.resolve(N);let V=(()=>{let _={client:Z.client,queryKey:Z.queryKey,pageParam:q,direction:D?"backward":"forward",meta:Z.options.meta};return F(_),_})(),L=await K(V),{maxPages:O}=Z.options,M=D?cT:pT;return{pages:M(N.pages,L,O),pageParams:M(N.pageParams,q,O)}};if(B&&Q.length){let N=B==="backward",q=N?me:iT,D={pages:Q,pageParams:X};z=await W(D,q(H,D),N)}else{let N=$??Q.length;do{let q=G===0?X[0]??H.initialPageParam:iT(H,z);if(G>0&&q==null)break;z=await W(z,q),G++}while(G<N)}return z};if(Z.options.persister)Z.fetchFn=()=>{return Z.options.persister?.(U,{client:Z.client,queryKey:Z.queryKey,meta:Z.options.meta,signal:Z.signal},J)};else Z.fetchFn=U}}}function iT($,{pages:Z,pageParams:J}){let H=Z.length-1;return Z.length>0?$.getNextPageParam(Z[H],Z,J[H],J):void 0}function me($,{pages:Z,pageParams:J}){return Z.length>0?$.getPreviousPageParam?.(Z[0],Z,J[0],J):void 0}var nT=class extends lz{#$;#Z;#J;#H;#Q;#B;#X;#G;constructor($){super();this.#G=!1,this.#X=$.defaultOptions,this.setOptions($.options),this.observers=[],this.#Q=$.client,this.#H=this.#Q.getQueryCache(),this.queryKey=$.queryKey,this.queryHash=$.queryHash,this.#Z=oT(this.options),this.state=$.state??this.#Z,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#$}get promise(){return this.#B?.promise}setOptions($){if(this.options={...this.#X,...$},$?._type)this.#$=$._type;if(this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let Z=oT(this.options);if(Z.data!==void 0)this.setState(aT(Z.data,Z.dataUpdatedAt)),this.#Z=Z}}optionalRemove(){if(!this.observers.length&&this.state.fetchStatus==="idle")this.#H.remove(this)}setData($,Z){let J=jB(this.state.data,$,this.options);return this.#z({data:J,type:"success",dataUpdatedAt:Z?.updatedAt,manual:Z?.manual}),J}setState($){this.#z({type:"setState",state:$})}cancel($){let Z=this.#B?.promise;return this.#B?.cancel($),Z?Z.then(l5).catch(l5):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#Z}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(($)=>h5($.options.enabled,this)!==!1)}isDisabled(){if(this.getObserversCount()>0)return!this.isActive();return this.options.queryFn===uZ||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){if(this.getObserversCount()>0)return this.observers.some(($)=>h5($.options.staleTime,this)==="static");return!1}isStale(){if(this.getObserversCount()>0)return this.observers.some(($)=>$.getCurrentResult().isStale);return this.state.data===void 0||this.state.isInvalidated}isStaleByTime($=0){if(this.state.data===void 0)return!0;if($==="static")return!1;if(this.state.isInvalidated)return!0;return!gz(this.state.dataUpdatedAt,$)}onFocus(){this.observers.find(($)=>$.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#B?.continue()}onOnline(){this.observers.find(($)=>$.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#B?.continue()}addObserver($){if(!this.observers.includes($))this.observers.push($),this.clearGcTimeout(),this.#H.notify({type:"observerAdded",query:this,observer:$})}removeObserver($){let Z=this.observers.indexOf($);if(Z!==-1){if(this.observers.splice(Z,1),!this.observers.length){if(this.#B)if(this.#G||this.state.fetchStatus==="paused"&&this.state.status==="pending")this.#B.cancel({revert:!0});else this.#B.cancelRetry();this.scheduleGc()}this.#H.notify({type:"observerRemoved",query:this,observer:$})}}getObserversCount(){return this.observers.length}invalidate(){if(!this.state.isInvalidated)this.#z({type:"invalidate"})}async fetch($,Z){if(this.state.fetchStatus!=="idle"&&this.#B?.status()!=="rejected"){if(this.state.data!==void 0&&Z?.cancelRefetch)this.cancel({silent:!0});else if(this.#B)return this.#B.continueRetry(),this.#B.promise}if($)this.setOptions($);if(!this.options.queryFn){let G=this.observers.find((U)=>U.options.queryFn);if(G)this.setOptions(G.options)}let J=new AbortController,H=(G)=>{Object.defineProperty(G,"signal",{enumerable:!0,get:()=>{return this.#G=!0,J.signal}})},B=()=>{let G=pz(this.options,Z),Y=(()=>{let F={client:this.#Q,queryKey:this.queryKey,meta:this.meta};return H(F),F})();if(this.#G=!1,this.options.persister)return this.options.persister(G,Y,this);return G(Y)},X=(()=>{let G={fetchOptions:Z,options:this.options,queryKey:this.queryKey,client:this.#Q,state:this.state,fetchFn:B};return H(G),G})();if((this.#$==="infinite"?rT(this.options.pages):this.options.behavior)?.onFetch(X,this),this.#J=this.state,this.state.fetchStatus==="idle"||this.state.fetchMeta!==X.fetchOptions?.meta)this.#z({type:"fetch",meta:X.fetchOptions?.meta});let z=this.#B=dz({initialPromise:Z?.initialPromise,fn:X.fetchFn,onCancel:(G)=>{if(G instanceof cz&&G.revert)this.setState({...this.#J,fetchStatus:"idle"});J.abort()},onFail:(G,U)=>{this.#z({type:"failed",failureCount:G,error:U})},onPause:()=>{this.#z({type:"pause"})},onContinue:()=>{this.#z({type:"continue"})},retry:X.options.retry,retryDelay:X.options.retryDelay,networkMode:X.options.networkMode,canRun:()=>!0});try{let G=await z.start();if(G===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(G),this.#H.config.onSuccess?.(G,this),this.#H.config.onSettled?.(G,this.state.error,this),G}catch(G){if(G instanceof cz){if(G.silent)return this.#B.promise;else if(G.revert){if(this.state.data===void 0)throw G;return this.state.data}}throw this.#z({type:"error",error:G}),this.#H.config.onError?.(G,this),this.#H.config.onSettled?.(this.state.data,G,this),G}finally{if(this.#B===z)this.#B=void 0;this.scheduleGc()}}#z($){let Z=(J)=>{switch($.type){case"failed":return{...J,fetchFailureCount:$.failureCount,fetchFailureReason:$.error};case"pause":return{...J,fetchStatus:"paused"};case"continue":return{...J,fetchStatus:"fetching"};case"fetch":return{...J,...QA(J.data,this.options),fetchMeta:$.meta??null};case"success":let H={...J,...aT($.data,$.dataUpdatedAt),dataUpdateCount:J.dataUpdateCount+1,...!$.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#J=$.manual?H:void 0,H;case"error":let B=$.error;return{...J,error:B,errorUpdateCount:J.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:J.fetchFailureCount+1,fetchFailureReason:B,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...J,isInvalidated:!0};case"setState":return{...J,...$.state}}};this.state=Z(this.state),Y5.batch(()=>{this.observers.slice().forEach((J)=>{J.onQueryUpdate()}),this.#H.notify({query:this,type:"updated",action:$})})}};function QA($,Z){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:BA(Z.networkMode)?"fetching":"paused",...$===void 0&&{error:null,status:"pending"}}}function aT($,Z){return{data:$,dataUpdatedAt:Z??Date.now(),error:null,isInvalidated:!1,status:"success"}}function oT($){let Z=typeof $.initialData==="function"?$.initialData():$.initialData,J=Z!==void 0,H=J?typeof $.initialDataUpdatedAt==="function"?$.initialDataUpdatedAt():$.initialDataUpdatedAt:0;return{data:Z,dataUpdateCount:0,dataUpdatedAt:J?H??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:J?"success":"pending",fetchStatus:"idle"}}var zA=class extends S8{#$;#Z=void 0;#J=void 0;#H=void 0;#Q;#B;#X;#G;#z;#W;#Y;#F;#U;#N=new Set;constructor($,Z){super();this.options=Z,this.#$=$,this.#X=null,this.bindMethods(),this.setOptions(Z)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){if(this.listeners.size===1){if(this.#Z.addObserver(this),sT(this.#Z,this.options))this.#K();else this.updateResult();this.#L()}}onUnsubscribe(){if(!this.hasListeners())this.destroy()}shouldFetchOnReconnect(){return XA(this.#Z,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return XA(this.#Z,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#M(),this.#P(),this.#Z.removeObserver(this)}setOptions($){let Z=this.options,J=this.#Z;if(this.options=this.#$.defaultQueryOptions($),this.options.enabled!==void 0&&typeof this.options.enabled!=="boolean"&&typeof this.options.enabled!=="function"&&typeof h5(this.options.enabled,this.#Z)!=="boolean")throw Error("Expected enabled to be a boolean or a callback that returns a boolean");if(this.#_(),this.#Z.setOptions(this.options),Z._defaulted&&!mZ(this.options,Z))this.#$.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#Z,observer:this});let H=this.hasListeners();if(H&&tT(this.#Z,J,this.options,Z))this.#K();if(this.updateResult(),H&&(this.#Z!==J||h5(this.options.enabled,this.#Z)!==h5(Z.enabled,this.#Z)||h5(this.options.staleTime,this.#Z)!==h5(Z.staleTime,this.#Z)))this.#A();let B=this.#D();if(H&&(this.#Z!==J||h5(this.options.enabled,this.#Z)!==h5(Z.enabled,this.#Z)||B!==this.#U))this.#V(B)}getOptimisticResult($){let Z=this.#$.getQueryCache().build(this.#$,$),J=this.createResult(Z,$);if(!mZ(this.getCurrentResult(),J))this.#H=J,this.#B=this.options,this.#Q=this.#Z.state;return J}getCurrentResult(){return this.#H}trackResult($,Z){return new Proxy($,{get:(J,H)=>{return this.trackProp(H),Z?.(H),Reflect.get(J,H)}})}trackProp($){this.#N.add($)}getCurrentQuery(){return this.#Z}refetch({...$}={}){return this.fetch({...$})}fetchOptimistic($){let Z=this.#$.defaultQueryOptions($),J=this.#$.getQueryCache().build(this.#$,Z),H=()=>{},B,Q=new Promise((X)=>{B=X,H=this.#$.getQueryCache().subscribe((z)=>{if(z.type==="updated"&&z.query.queryHash===J.queryHash&&J.state.data!==void 0)H(),X(this.createResult(J,Z))})});return Promise.race([J.fetch().then(()=>{let X=this.createResult(J,Z);return B?.(X),X}).finally(()=>{H()}),Q])}fetch($){return this.#K({...$,cancelRefetch:$.cancelRefetch??!0}).then(()=>{return this.updateResult(),this.#H})}#K($){this.#_();let Z=this.#Z.fetch(this.options,$);if(!$?.throwOnError)Z=Z.catch(l5);return Z}#q($){return!cZ()&&h5(this.options.enabled,this.#Z)!==!1&&fz($)}#A(){this.#M();let $=h5(this.options.staleTime,this.#Z);if(this.#H.isStale||!this.#q($))return;let Z=gz(this.#H.dataUpdatedAt,$)+1;this.#Y=f9.setTimeout(()=>{if(!this.#H.isStale)this.updateResult()},Z)}#D(){return(typeof this.options.refetchInterval==="function"?this.options.refetchInterval(this.#Z):this.options.refetchInterval)??!1}#V($){if(this.#P(),this.#U=$,this.#U===0||!this.#q(this.#U))return;this.#F=f9.setInterval(()=>{if(this.options.refetchIntervalInBackground||dZ.isFocused())this.#K()},this.#U)}#L(){this.#A(),this.#V(this.#D())}#M(){if(this.#Y!==void 0)f9.clearTimeout(this.#Y),this.#Y=void 0}#P(){if(this.#F!==void 0)f9.clearInterval(this.#F),this.#F=void 0}createResult($,Z){let J=this.#Z,H=this.options,B=this.#H,Q=this.#Q,X=this.#B,z=$!==J?$.state:this.#J,{state:G}=$,U={...G},Y=!1,F;if(Z._optimisticResults){let M=this.hasListeners(),_=!M&&sT($,Z),w=M&&tT($,J,Z,H);if(_||w)U={...U,...QA(G.data,$.options)};if(Z._optimisticResults==="isRestoring")U.fetchStatus="idle"}let{error:K,errorUpdatedAt:W,status:N}=U;F=U.data;let q=!1;if(Z.placeholderData!==void 0&&F===void 0&&N==="pending"){let M;if(B?.isPlaceholderData&&Z.placeholderData===X?.placeholderData)M=B.data,q=!0;else M=typeof Z.placeholderData==="function"?Z.placeholderData(this.#W?.state.data,this.#W):Z.placeholderData;if(M!==void 0)N="success",F=jB(B?.data,M,Z),Y=!0}if(Z.select&&F!==void 0&&!q)if(B&&F===Q?.data&&Z.select===this.#G)F=this.#z;else try{this.#G=Z.select,F=Z.select(F),F=jB(B?.data,F,Z),this.#z=F,this.#X=null}catch(M){this.#X=M}else if(F===void 0)this.#X=null;if(this.#X)K=this.#X,F=this.#z,W=Date.now(),N="error",Y=!1;let D=U.fetchStatus==="fetching",A=N==="pending",V=N==="error",L=A&&D,O=F!==void 0;return{status:N,fetchStatus:U.fetchStatus,isPending:A,isSuccess:N==="success",isError:V,isInitialLoading:L,isLoading:L,data:F,dataUpdatedAt:U.dataUpdatedAt,error:K,errorUpdatedAt:W,failureCount:U.fetchFailureCount,failureReason:U.fetchFailureReason,errorUpdateCount:U.errorUpdateCount,isFetched:$.isFetched(),isFetchedAfterMount:U.dataUpdateCount>z.dataUpdateCount||U.errorUpdateCount>z.errorUpdateCount,isFetching:D,isRefetching:D&&!A,isLoadingError:V&&!O,isPaused:U.fetchStatus==="paused",isPlaceholderData:Y,isRefetchError:V&&O,isStale:GA($,Z),refetch:this.refetch,isEnabled:h5(Z.enabled,$)!==!1}}updateResult(){let $=this.#H,Z=this.createResult(this.#Z,this.options);if(this.#Q=this.#Z.state,this.#B=this.options,this.#Q.data!==void 0)this.#W=this.#Z;if(mZ(Z,$))return;this.#H=Z;let H=(()=>{if(!$)return!0;let{notifyOnChangeProps:B}=this.options,Q=typeof B==="function"?B():B;if(Q==="all"||!Q&&!this.#N.size)return!0;let X=new Set(Q??this.#N);if(this.options.throwOnError)X.add("error");return Object.keys(this.#H).some((z)=>{let G=z;return this.#H[G]!==$[G]&&X.has(G)})})();Y5.batch(()=>{if(H)this.listeners.forEach((B)=>{B(this.#H)});this.#$.getQueryCache().notify({query:this.#Z,type:"observerResultsUpdated"})})}#_(){let $=this.#$.getQueryCache().build(this.#$,this.options);if($===this.#Z)return;let Z=this.#Z;if(this.#Z=$,this.#J=$.state,this.hasListeners())Z?.removeObserver(this),$.addObserver(this)}onQueryUpdate(){if(this.updateResult(),this.hasListeners())this.#L()}};function ue($,Z){return h5(Z.enabled,$)!==!1&&$.state.data===void 0&&!($.state.status==="error"&&h5(Z.retryOnMount,$)===!1)}function sT($,Z){return ue($,Z)||$.state.data!==void 0&&XA($,Z,Z.refetchOnMount)}function XA($,Z,J){if(h5(Z.enabled,$)!==!1&&h5(Z.staleTime,$)!=="static"){let H=typeof J==="function"?J($):J;return H==="always"||H!==!1&&GA($,Z)}return!1}function tT($,Z,J,H){return($!==Z||h5(H.enabled,$)===!1)&&(!J.suspense||$.state.status!=="error")&&GA($,J)}function GA($,Z){return h5(Z.enabled,$)!==!1&&$.isStaleByTime(h5(Z.staleTime,$))}var eT=class extends lz{#$;#Z;#J;#H;constructor($){super();this.#$=$.client,this.mutationId=$.mutationId,this.#J=$.mutationCache,this.#Z=[],this.state=$.state||UA(),this.setOptions($.options),this.scheduleGc()}setOptions($){this.options=$,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver($){if(!this.#Z.includes($))this.#Z.push($),this.clearGcTimeout(),this.#J.notify({type:"observerAdded",mutation:this,observer:$})}removeObserver($){this.#Z=this.#Z.filter((Z)=>Z!==$),this.scheduleGc(),this.#J.notify({type:"observerRemoved",mutation:this,observer:$})}optionalRemove(){if(!this.#Z.length)if(this.state.status==="pending")this.scheduleGc();else this.#J.remove(this)}continue(){return this.#H?.continue()??(this.state.status==="pending"?this.execute(this.state.variables):Promise.resolve())}async execute($){let Z=()=>{this.#Q({type:"continue"})},J={client:this.#$,meta:this.options.meta,mutationKey:this.options.mutationKey},H=this.#H=dz({fn:()=>{if(!this.options.mutationFn)return Promise.reject(Error("No mutationFn found"));return this.options.mutationFn($,J)},onFail:(X,z)=>{this.#Q({type:"failed",failureCount:X,error:z})},onPause:()=>{this.#Q({type:"pause"})},onContinue:Z,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#J.canRun(this)}),B=this.state.status==="pending",Q=!H.canStart();try{if(B)Z();else{if(this.#Q({type:"pending",variables:$,isPaused:Q}),this.#J.config.onMutate)await this.#J.config.onMutate($,this,J);let z=await this.options.onMutate?.($,J);if(z!==this.state.context)this.#Q({type:"pending",context:z,variables:$,isPaused:Q})}let X=await H.start();return await this.#J.config.onSuccess?.(X,$,this.state.context,this,J),await this.options.onSuccess?.(X,$,this.state.context,J),await this.#J.config.onSettled?.(X,null,this.state.variables,this.state.context,this,J),await this.options.onSettled?.(X,null,$,this.state.context,J),this.#Q({type:"success",data:X}),X}catch(X){try{await this.#J.config.onError?.(X,$,this.state.context,this,J)}catch(z){Promise.reject(z)}try{await this.options.onError?.(X,$,this.state.context,J)}catch(z){Promise.reject(z)}try{await this.#J.config.onSettled?.(void 0,X,this.state.variables,this.state.context,this,J)}catch(z){Promise.reject(z)}try{await this.options.onSettled?.(void 0,X,$,this.state.context,J)}catch(z){Promise.reject(z)}throw this.#Q({type:"error",error:X}),X}finally{if(this.#H===H)this.#H=void 0;this.#J.runNext(this)}}#Q($){let Z=(J)=>{switch($.type){case"failed":return{...J,failureCount:$.failureCount,failureReason:$.error};case"pause":return{...J,isPaused:!0};case"continue":return{...J,isPaused:!1};case"pending":return{...J,context:$.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:$.isPaused,status:"pending",variables:$.variables,submittedAt:Date.now()};case"success":return{...J,data:$.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...J,data:void 0,error:$.error,failureCount:J.failureCount+1,failureReason:$.error,isPaused:!1,status:"error"}}};this.state=Z(this.state),Y5.batch(()=>{this.#Z.forEach((J)=>{J.onMutationUpdate($)}),this.#J.notify({mutation:this,type:"updated",action:$})})}};function UA(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var $j=class extends S8{#$;#Z;#J;constructor($={}){super();this.config=$,this.#$=new Set,this.#Z=new Map,this.#J=0}build($,Z,J){let H=new eT({client:$,mutationCache:this,mutationId:++this.#J,options:$.defaultMutationOptions(Z),state:J});return this.add(H),H}add($){this.#$.add($);let Z=iz($);if(typeof Z==="string"){let J=this.#Z.get(Z);if(J)J.push($);else this.#Z.set(Z,[$])}this.notify({type:"added",mutation:$})}remove($){if(this.#$.delete($)){let Z=iz($);if(typeof Z==="string"){let J=this.#Z.get(Z);if(J){if(J.length>1){let H=J.indexOf($);if(H!==-1)J.splice(H,1)}else if(J[0]===$)this.#Z.delete(Z)}}}this.notify({type:"removed",mutation:$})}canRun($){let Z=iz($);if(typeof Z==="string"){let J=this.#Z.get(Z)?.find((H)=>H.state.status==="pending");return!J||J===$}else return!0}runNext($){let Z=iz($);if(typeof Z==="string")return this.#Z.get(Z)?.find((J)=>J!==$&&J.state.isPaused)?.continue()??Promise.resolve();else return Promise.resolve()}clear(){Y5.batch(()=>{this.#$.forEach(($)=>{this.notify({type:"removed",mutation:$})}),this.#$.clear(),this.#Z.clear()})}getAll(){return Array.from(this.#$)}find($){let Z={exact:!0,...$};return this.getAll().find((J)=>uz(Z,J))}findAll($={}){return this.getAll().filter((Z)=>uz($,Z))}notify($){Y5.batch(()=>{this.listeners.forEach((Z)=>{Z($)})})}resumePausedMutations(){let $=this.getAll().filter((Z)=>Z.state.isPaused);return Y5.batch(()=>Promise.all($.map((Z)=>Z.continue().catch(l5))))}};function iz($){return $.options.scope?.id}var YA=class extends S8{#$;#Z=void 0;#J;#H;constructor($,Z){super();this.#$=$,this.setOptions(Z),this.bindMethods(),this.#Q()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions($){let Z=this.options;if(this.options=this.#$.defaultMutationOptions($),!mZ(this.options,Z))this.#$.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#J,observer:this});if(Z?.mutationKey&&this.options.mutationKey&&g9(Z.mutationKey)!==g9(this.options.mutationKey))this.reset();else if(this.#J?.state.status==="pending")this.#J.setOptions(this.options)}onSubscribe(){if(this.listeners.size===1&&this.#J)this.#J.addObserver(this),this.#Q()}onUnsubscribe(){if(!this.hasListeners())this.#J?.removeObserver(this)}onMutationUpdate($){this.#Q(),this.#B($)}getCurrentResult(){return this.#Z}reset(){this.#J?.removeObserver(this),this.#J=void 0,this.#Q(),this.#B()}mutate($,Z){return this.#H=Z,this.#J?.removeObserver(this),this.#J=this.#$.getMutationCache().build(this.#$,this.options),this.#J.addObserver(this),this.#J.execute($)}#Q(){let $=this.#J?.state??UA();this.#Z={...$,isPending:$.status==="pending",isSuccess:$.status==="success",isError:$.status==="error",isIdle:$.status==="idle",mutate:this.mutate,reset:this.reset}}#B($){Y5.batch(()=>{if(this.#H&&this.hasListeners()){let Z=this.#Z.variables,J=this.#Z.context,H={client:this.#$,meta:this.options.meta,mutationKey:this.options.mutationKey};if($?.type==="success"){try{this.#H.onSuccess?.($.data,Z,J,H)}catch(B){Promise.reject(B)}try{this.#H.onSettled?.($.data,null,Z,J,H)}catch(B){Promise.reject(B)}}else if($?.type==="error"){try{this.#H.onError?.($.error,Z,J,H)}catch(B){Promise.reject(B)}try{this.#H.onSettled?.(void 0,$.error,Z,J,H)}catch(B){Promise.reject(B)}}}this.listeners.forEach((Z)=>{Z(this.#Z)})})}};var Zj=class extends S8{#$;constructor($={}){super();this.config=$,this.#$=new Map}build($,Z,J){let H=Z.queryKey,B=Z.queryHash??OB(H,Z),Q=this.get(B);if(!Q)Q=new nT({client:$,queryKey:H,queryHash:B,options:$.defaultQueryOptions(Z),state:J,defaultOptions:$.getQueryDefaults(H)}),this.add(Q);return Q}add($){if(!this.#$.has($.queryHash))this.#$.set($.queryHash,$),this.notify({type:"added",query:$})}remove($){let Z=this.#$.get($.queryHash);if(Z){if($.destroy(),Z===$)this.#$.delete($.queryHash);this.notify({type:"removed",query:$})}}clear(){Y5.batch(()=>{this.getAll().forEach(($)=>{this.remove($)})})}get($){return this.#$.get($)}getAll(){return[...this.#$.values()]}find($){let Z={exact:!0,...$};return this.getAll().find((J)=>mz(Z,J))}findAll($={}){let Z=this.getAll();return Object.keys($).length>0?Z.filter((J)=>mz($,J)):Z}notify($){Y5.batch(()=>{this.listeners.forEach((Z)=>{Z($)})})}onFocus(){Y5.batch(()=>{this.getAll().forEach(($)=>{$.onFocus()})})}onOnline(){Y5.batch(()=>{this.getAll().forEach(($)=>{$.onOnline()})})}};var FA=class{#$;#Z;#J;#H;#Q;#B;#X;#G;constructor($={}){this.#$=$.queryCache||new Zj,this.#Z=$.mutationCache||new $j,this.#J=$.defaultOptions||{},this.#H=new Map,this.#Q=new Map,this.#B=0}mount(){if(this.#B++,this.#B!==1)return;this.#X=dZ.subscribe(async($)=>{if($)await this.resumePausedMutations(),this.#$.onFocus()}),this.#G=lZ.subscribe(async($)=>{if($)await this.resumePausedMutations(),this.#$.onOnline()})}unmount(){if(this.#B--,this.#B!==0)return;this.#X?.(),this.#X=void 0,this.#G?.(),this.#G=void 0}isFetching($){return this.#$.findAll({...$,fetchStatus:"fetching"}).length}isMutating($){return this.#Z.findAll({...$,status:"pending"}).length}getQueryData($){let Z=this.defaultQueryOptions({queryKey:$});return this.#$.get(Z.queryHash)?.state.data}ensureQueryData($){let Z=this.defaultQueryOptions($),J=this.#$.build(this,Z),H=J.state.data;if(H===void 0)return this.fetchQuery($);if($.revalidateIfStale&&J.isStaleByTime(h5(Z.staleTime,J)))this.prefetchQuery(Z);return Promise.resolve(H)}getQueriesData($){return this.#$.findAll($).map(({queryKey:Z,state:J})=>{return[Z,J.data]})}setQueryData($,Z,J){let H=this.defaultQueryOptions({queryKey:$}),B=this.#$.get(H.queryHash)?.state.data,Q=mT(Z,B);if(Q===void 0)return;return this.#$.build(this,H).setData(Q,{...J,manual:!0})}setQueriesData($,Z,J){return Y5.batch(()=>this.#$.findAll($).map(({queryKey:H})=>[H,this.setQueryData(H,Z,J)]))}getQueryState($){let Z=this.defaultQueryOptions({queryKey:$});return this.#$.get(Z.queryHash)?.state}removeQueries($){let Z=this.#$;Y5.batch(()=>{Z.findAll($).forEach((J)=>{Z.remove(J)})})}resetQueries($,Z){let J=this.#$;return Y5.batch(()=>{let H=J.findAll($),B=new Set(H);return H.forEach((Q)=>{Q.reset()}),this.refetchQueries({type:"active",predicate:(Q)=>B.has(Q)},Z)})}cancelQueries($,Z={}){let J={revert:!0,...Z},H=Y5.batch(()=>this.#$.findAll($).map((B)=>B.cancel(J)));return Promise.all(H).then(l5).catch(l5)}invalidateQueries($,Z={}){return Y5.batch(()=>{if(this.#$.findAll($).forEach((J)=>{J.invalidate()}),$?.refetchType==="none")return Promise.resolve();return this.refetchQueries({...$,type:$?.refetchType??$?.type??"active"},Z)})}refetchQueries($,Z={}){let J={...Z,cancelRefetch:Z.cancelRefetch??!0},H=Y5.batch(()=>this.#$.findAll($).filter((B)=>!B.isDisabled()&&!B.isStatic()).map((B)=>{let Q=B.fetch(void 0,J);if(!J.throwOnError)Q=Q.catch(l5);return B.state.fetchStatus==="paused"?Promise.resolve():Q}));return Promise.all(H).then(l5)}async query($){let Z=this.defaultQueryOptions($);if(Z.retry===void 0)Z.retry=!1;let J=this.#$.build(this,Z),H=J.isStaleByTime(h5(Z.staleTime,J))?await J.fetch(Z):J.state.data,B=Z.select;if(B)return B(H);return H}fetchQuery($){let Z=this.defaultQueryOptions($);if(Z.retry===void 0)Z.retry=!1;let J=this.#$.build(this,Z);return J.isStaleByTime(h5(Z.staleTime,J))?J.fetch(Z):Promise.resolve(J.state.data)}prefetchQuery($){return this.fetchQuery($).then(l5).catch(l5)}infiniteQuery($){return $._type="infinite",this.query($)}fetchInfiniteQuery($){return $._type="infinite",this.fetchQuery($)}prefetchInfiniteQuery($){return this.fetchInfiniteQuery($).then(l5).catch(l5)}ensureInfiniteQueryData($){return $._type="infinite",this.ensureQueryData($)}resumePausedMutations(){if(lZ.isOnline())return this.#Z.resumePausedMutations();return Promise.resolve()}getQueryCache(){return this.#$}getMutationCache(){return this.#Z}getDefaultOptions(){return this.#J}setDefaultOptions($){this.#J=$}setQueryDefaults($,Z){this.#H.set(g9($),{queryKey:$,defaultOptions:Z})}getQueryDefaults($){let Z=[...this.#H.values()],J={};return Z.forEach((H)=>{if(V6($,H.queryKey))Object.assign(J,H.defaultOptions)}),J}setMutationDefaults($,Z){this.#Q.set(g9($),{mutationKey:$,defaultOptions:Z})}getMutationDefaults($){let Z=[...this.#Q.values()],J={};return Z.forEach((H)=>{if(V6($,H.mutationKey))Object.assign(J,H.defaultOptions)}),J}defaultQueryOptions($){if($._defaulted)return $;let Z={...this.#J.queries,...this.getQueryDefaults($.queryKey),...$,_defaulted:!0};if(!Z.queryHash)Z.queryHash=OB(Z.queryKey,Z);if(Z.refetchOnReconnect===void 0)Z.refetchOnReconnect=Z.networkMode!=="always";if(Z.throwOnError===void 0)Z.throwOnError=!!Z.suspense;if(!Z.networkMode&&Z.persister)Z.networkMode="offlineFirst";if(Z.queryFn===uZ)Z.enabled=!1;return Z}defaultMutationOptions($){if($?._defaulted)return $;return{...this.#J.mutations,...$?.mutationKey&&this.getMutationDefaults($.mutationKey),...$,_defaulted:!0}}clear(){this.#$.clear(),this.#Z.clear()}};var Hj=($,Z,J)=>{let H=J?.state.error&&typeof $.throwOnError==="function"?pZ($.throwOnError,[J.state.error,J]):$.throwOnError;if($.suspense||H){if(!Z.isReset())$.retryOnMount=!1}},Bj=($)=>{Jj.useEffect(()=>{$.clearReset()},[$])},Qj=({result:$,errorResetBoundary:Z,throwOnError:J,query:H,suspense:B})=>{return $.isError&&!Z.isReset()&&!$.isFetching&&H&&(B&&$.data===void 0||pZ(J,[$.error,H]))};var Xj=($)=>{if($.suspense){let J=(B)=>B==="static"?B:Math.max(B??1000,1000),H=$.staleTime;if($.staleTime=typeof H==="function"?(...B)=>J(H(...B)):J(H),typeof $.gcTime==="number")$.gcTime=Math.max($.gcTime,1000)}},zj=($,Z)=>$?.suspense&&Z.isPending,Gj=($,Z,J)=>Z.fetchOptimistic($).catch(()=>{J.clearReset()});var L6=P(m(),1);function Uj($,Z,J){let H=xT(),B=hT(),Q=a0(J),X=Q.defaultQueryOptions($),z=Q.getQueryCache().get(X.queryHash),G=$.subscribed!==!1;X._optimisticResults=H?"isRestoring":G?"optimistic":void 0,Xj(X),Hj(X,B,z),Bj(B);let[U]=L6.useState(()=>new Z(Q,X)),Y=U.getOptimisticResult(X),F=!H&&G;if(L6.useSyncExternalStore(L6.useCallback((K)=>{let W=F?U.subscribe(Y5.batchCalls(K)):l5;return U.updateResult(),W},[U,F]),()=>U.getCurrentResult(),()=>U.getCurrentResult()),L6.useEffect(()=>{U.setOptions(X)},[X,U]),zj(X,Y))throw Gj(X,U,B);if(Qj({result:Y,errorResetBoundary:B,throwOnError:X.throwOnError,query:z,suspense:X.suspense}))throw Y.error;return!X.notifyOnChangeProps?U.trackResult(Y):Y}function m1($,Z){return Uj($,zA,Z)}function M6($){return $}var x3=P(m(),1);function CB($,Z){let J=a0(Z);return Fj({filters:{...$,status:"pending"}},J).length}function Yj($,Z){return $.findAll(Z.filters).map((J)=>Z.select?Z.select(J):J.state)}function Fj($={},Z){let J=a0(Z).getMutationCache(),H=x3.useRef($),B=x3.useRef(null);if(B.current===null)B.current=Yj(J,$);return x3.useEffect(()=>{H.current=$}),x3.useSyncExternalStore(x3.useCallback((Q)=>J.subscribe(()=>{let X=TB(B.current,Yj(J,H.current));if(B.current!==X)B.current=X,Y5.schedule(Q)}),[J]),()=>B.current,()=>B.current)}var h3=P(m(),1);function r1($,Z){let J=a0(Z),[H]=h3.useState(()=>new YA(J,$));h3.useEffect(()=>{H.setOptions($)},[H,$]);let B=h3.useSyncExternalStore(h3.useCallback((X)=>H.subscribe(Y5.batchCalls(X)),[H]),()=>H.getCurrentResult(),()=>H.getCurrentResult()),Q=h3.useCallback((...X)=>{H.mutate(X[0],X[1]).catch(l5)},[H]);if(B.error&&pZ(H.options.throwOnError,[B.error]))throw B.error;return{...B,mutate:Q,mutateAsync:B.mutate}}var je=P(uq0(),1);function Kj($,Z){if($ instanceof RegExp)return{keys:!1,pattern:$};var J,H,B,Q,X=[],z="",G=$.split("/");G[0]||G.shift();while(B=G.shift())if(J=B[0],J==="*")X.push(J),z+=B[1]==="?"?"(?:/(.*))?":"/(.*)";else if(J===":"){if(H=B.indexOf("?",1),Q=B.indexOf(".",1),X.push(B.substring(1,~H?H:~Q?Q:B.length)),z+=!!~H&&!~Q?"(?:/([^/]+?))?":"/([^/]+?)",~Q)z+=(~H?"?":"")+"\\"+B.substring(Q)}else z+="/"+B;return{keys:X,pattern:new RegExp("^"+z+(Z?"(?=$|/)":"/?$"),"i")}}var Q$=P(m(),1),c1=P(m(),1);var rz=P(iZ(),1);var ee=Q$.useInsertionEffect,$00=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",WA=$00?Q$.useLayoutEffect:Q$.useEffect,Z00=ee||WA,az=($)=>{let Z=Q$.useRef([$,(...J)=>Z[0](...J)]).current;return Z00(()=>{Z[0]=$}),Z[1]};var Wj=["popstate","pushState","replaceState","hashchange"],EB=[],Nj=()=>EB.forEach(($)=>$()),J00=($)=>{if(EB.push($)===1)Wj.forEach((Z)=>addEventListener(Z,Nj));return()=>{if(EB=EB.filter((Z)=>Z!==$),!EB.length)Wj.forEach((Z)=>removeEventListener(Z,Nj))}},Vj=($,Z)=>rz.useSyncExternalStore(J00,$,Z),qj=()=>location.search,oz=({ssrSearch:$}={})=>Vj(qj,$!=null?()=>$:qj),Aj=()=>location.pathname,X$=({ssrPath:$}={})=>Vj(Aj,$!=null?()=>$:Aj);var H00=($,{replace:Z=!1,state:J=null}={})=>history[Z?"replaceState":"pushState"](J,"",$),Lj=($)=>[X$($),H00],Dj=Symbol.for("wouter_v3");if(typeof history<"u"&&typeof window[Dj]>"u"){for(let $ of["pushState","replaceState"]){let Z=history[$];history[$]=function(){let J=Z.apply(this,arguments),H=new Event($);return H.arguments=arguments,dispatchEvent(H),J}}Object.defineProperty(window,Dj,{value:!0})}var Pj=($="")=>$==="/"?"":$,_j=($,Z)=>$[0]==="~"?$.slice(1):Pj(Z)+$,NA=($,Z)=>{return $=Mj(Pj($)),Z=Mj(Z),!$||!Z.toLowerCase().indexOf($.toLowerCase())?Z.slice($.length)||"/":"~"+Z},Mj=($)=>{try{return $.includes("%")?decodeURI($):$}catch(Z){return $}};var Oj={hook:Lj,searchHook:oz,parser:Kj,base:"",ssrPath:void 0,ssrSearch:void 0,ssrContext:void 0,hrefs:($)=>$,aroundNav:($,Z,J)=>$(Z,J)},Tj=c1.createContext(Oj),w2=()=>c1.useContext(Tj),jj={},Cj=c1.createContext(jj),qA=()=>c1.useContext(Cj),Ej=($,Z=$.base)=>NA(Z,$.hook($)[0]),AA=($)=>{let[Z,J]=$.hook($);return[NA($.base,Z),az((H,B)=>$.aroundNav(J,_j(H,$.base),B))]},a4=()=>AA(w2());var bj=($,Z,J,H)=>{let{pattern:B,keys:Q}=Z instanceof RegExp?{pattern:Z}:$(Z||"*",H),X=B.exec(J);if(!X)return[!1,null];let z={};for(let G=1;G<X.length;G++)z[G-1]=X[G];if(Q)for(let G=0;G<Q.length;G++)z[Q[G]]=X[G+1];else Object.assign(z,X.groups);return H?[!0,z,X[0]]:[!0,z]};var DA=({children:$,...Z})=>{let J=w2(),H=Z.hook?Oj:J,B=H;if(Z.ssrPath){let[G,U=Z.ssrSearch??""]=Z.ssrPath.split("?");if(G)Z.ssrSearch=U,Z.ssrPath=G}Z.hrefs=Z.hrefs??Z.hook?.hrefs,Z.searchHook=Z.searchHook??Z.hook?.searchHook;let Q=c1.useRef(H),X=Q.current,z=X;for(let G in H){let U=G==="base"?H[G]+(Z[G]??""):Z[G]??H[G];if(U!==z[G]){if(X===z)Q.current=z={...z};z[G]=U}if(U!==H[G]||U!==B[G])B=z}return c1.createElement(Tj.Provider,{value:B},$)},B00=({children:$,component:Z},J)=>{if(Z)return c1.createElement(Z,{params:J});return typeof $==="function"?$(J):$},Q00=($)=>{let Z=c1.useRef(jj),J=Z.current,H=Object.keys($);return Z.current=H.length!==Object.keys(J).length||H.some((B)=>$[B]!==J[B])?$:J};var bB=({path:$,nest:Z,match:J,...H})=>{let B=w2(),Q=Ej(B),[X,z,G]=J??bj(B.parser,$,Q,Z),U=Q00({...qA(),...z});if(!X)return null;let Y=B00(H,U);return c1.createElement(Cj.Provider,{value:U},G?c1.createElement(DA,{base:G},Y):Y)},v3=c1.forwardRef(($,Z)=>{let J=w2(),[H,B]=AA(J),{to:Q="",href:X=Q,onClick:z,asChild:G,children:U,className:Y,replace:F,state:K,transition:W,...N}=$;if(N.onClick=az((q)=>{if(q.ctrlKey||q.metaKey||q.altKey||q.shiftKey||q.button!==0)return;if(z?.(q),!q.defaultPrevented)q.preventDefault(),B(X,$)}),N.href=J.hrefs(X[0]==="~"?X.slice(1):J.base+X,J),Y!==void 0)N.className=Y?.call?Y(H===X):Y;if(Z)N.ref=Z;return G&&c1.isValidElement(U)?c1.cloneElement(U,N):c1.createElement("a",N,U)}),wj=($,Z=[])=>{if(Array.isArray($))for(let J of $)wj(J&&J.type===c1.Fragment?J.props.children:J,Z);else Z.push($);return Z},Sj=({children:$,location:Z})=>{let J=w2(),H=Ej(J);for(let B of wj($)){let Q=0;if(c1.isValidElement(B)&&(Q=bj(J.parser,B.props.path,Z||H,B.props.nest))[0])return c1.cloneElement(B,{match:Q})}return null},nz=($)=>{let{to:Z,href:J=Z}=$,H=w2(),[,B]=AA(H),Q=az(()=>B(Z||J,$)),{ssrContext:X}=H;if(WA(()=>{Q()},[]),X)X.redirectTo=Z;return null};var F4={};k5(F4,{useToastManager:()=>_b,createToastManager:()=>Ob,Viewport:()=>NC,Title:()=>pC,Root:()=>IC,Provider:()=>YC,Positioner:()=>Vb,Portal:()=>tC,Description:()=>mC,Content:()=>kC,Close:()=>cC,Arrow:()=>Mb,Action:()=>lC});var UC=P(m(),1);var Rj=P(m(),1);function P6($){Rj.useEffect($,Q4)}var sz=P(m(),1),VA=sz.createContext(void 0);function m9(){let $=sz.useContext(VA);if(!$)throw Error(I0(73));return $}var xj=P(m(),1),_A=P(iZ(),1);var _6=P(m(),1),X00=iZ();function z00($,Z){return $===Z&&($!==0||1/$===1/Z)||$!==$&&Z!==Z}var G00=typeof Object.is==="function"?Object.is:z00,U00=X00.useSyncExternalStore,Y00=_6.useRef,F00=_6.useEffect,K00=_6.useMemo,W00=_6.useDebugValue;var LA=function($,Z,J,H,B){var Q=Y00(null);if(Q.current===null){var X={hasValue:!1,value:null};Q.current=X}else X=Q.current;Q=K00(function(){function G(W){if(!U){if(U=!0,Y=W,W=H(W),B!==void 0&&X.hasValue){var N=X.value;if(B(N,W))return F=N}return F=W}if(N=F,G00(Y,W))return N;var q=H(W);if(B!==void 0&&B(N,q))return Y=W,N;return Y=W,F=q}var U=!1,Y,F,K=J===void 0?null:J;return[function(){return G(Z())},K===null?void 0:function(){return G(K())}]},[Z,J,H,B]);var z=U00($,Q[0],Q[1]);return F00(function(){X.hasValue=!0,X.value=z},[z]),W00(z),z};var Ij=P(m(),1);var MA=[],PA=void 0;function kj(){return PA}function yj($){MA.push($)}function X9($){let Z=(J,H)=>{let B=H5(N00).current,Q;try{PA=B;for(let X of MA)X.before(B);Q=$(J,H);for(let X of MA)X.after(B);B.didInitialize=!0}finally{PA=void 0}return Q};return Z.displayName=$.displayName||$.name,Z}function u9($){return Ij.forwardRef(X9($))}function N00(){return{didInitialize:!1}}var q00=tz(19),A00=q00?V00:L00;function ez($,Z,J,H,B){return A00($,Z,J,H,B)}function D00($,Z,J,H,B){let Q=xj.useCallback(()=>Z($.getSnapshot(),J,H,B),[$,Z,J,H,B]);return _A.useSyncExternalStore($.subscribe,Q,Q)}yj({before($){if($.syncIndex=0,!$.didInitialize)$.syncTick=1,$.syncHooks=[],$.didChangeStore=!0,$.getSnapshot=()=>{let Z=!1;for(let J=0;J<$.syncHooks.length;J+=1){let H=$.syncHooks[J],B=H.selector(H.store.state,H.a1,H.a2,H.a3);if(!Object.is(H.value,B))Z=!0,H.value=B}if(Z)$.syncTick+=1;return $.syncTick}},after($){if($.syncHooks.length>0){if($.didChangeStore)$.didChangeStore=!1,$.subscribe=(Z)=>{let J=new Set;for(let B of $.syncHooks)J.add(B.store);let H=[];for(let B of J)H.push(B.subscribe(Z));return()=>{for(let B of H)B()}};_A.useSyncExternalStore($.subscribe,$.getSnapshot,$.getSnapshot)}}});function V00($,Z,J,H,B){let Q=kj();if(!Q)return D00($,Z,J,H,B);let X=Q.syncIndex;Q.syncIndex+=1;let z;if(!Q.didInitialize)z={store:$,selector:Z,a1:J,a2:H,a3:B,value:Z($.getSnapshot(),J,H,B)},Q.syncHooks.push(z);else if(z=Q.syncHooks[X],z.store!==$||z.selector!==Z||!Object.is(z.a1,J)||!Object.is(z.a2,H)||!Object.is(z.a3,B)){if(z.store!==$)Q.didChangeStore=!0;z.store=$,z.selector=Z,z.a1=J,z.a2=H,z.a3=B,z.value=Z($.getSnapshot(),J,H,B)}return z.value}function L00($,Z,J,H,B){return LA($.subscribe,$.getSnapshot,$.getSnapshot,(Q)=>Z(Q,J,H,B))}class OA{static create($){return new this($)}constructor($){this.state=$,this.listeners=new Set,this.updateTick=0}subscribe=($)=>{return this.listeners.add($),()=>{this.listeners.delete($)}};getSnapshot=()=>{return this.state};setState($){if(this.state===$)return;this.state=$,this.updateTick+=1;let Z=this.updateTick;for(let J of this.listeners){if(Z!==this.updateTick)return;J($)}}update($){for(let Z in $)if(!Object.is(this.state[Z],$[Z])){this.setState({...this.state,...$});return}}set($,Z){if(!Object.is(this.state[$],Z))this.setState({...this.state,[$]:Z})}notifyAll(){let $={...this.state};this.setState($)}use($,Z,J,H){return ez(this,$,Z,J,H)}}var z$=P(m(),1);class p2 extends OA{constructor($,Z={},J){super($);this.context=Z,this.selectors=J}useSyncedValue($,Z){z$.useDebugValue($);let J=this;H0(()=>{if(J.state[$]!==Z)J.set($,Z)},[J,$,Z])}useSyncedValueWithCleanup($,Z){let J=this;H0(()=>{if(J.state[$]!==Z)J.set($,Z);return()=>{J.set($,void 0)}},[J,$,Z])}useSyncedValues($){let Z=this,J=Object.values($);H0(()=>{Z.update($)},[Z,...J])}useControlledProp($,Z){z$.useDebugValue($);let J=this,H=Z!==void 0;H0(()=>{if(H&&!Object.is(J.state[$],Z))J.setState({...J.state,[$]:Z})},[J,$,Z,H])}select($,Z,J,H){let B=this.selectors[$];return B(this.state,Z,J,H)}useState($,Z,J,H){return z$.useDebugValue($),ez(this,this.selectors[$],Z,J,H)}useContextCallback($,Z){z$.useDebugValue($);let J=Y0(Z??G1);this.context[$]=J}useStateSetter($){let Z=z$.useRef(void 0);if(Z.current===void 0)Z.current=(J)=>{this.set($,J)};return Z.current}observe($,Z){let J;if(typeof $==="function")J=$;else J=this.selectors[$];let H=J(this.state);return Z(H,H,this),this.subscribe((B)=>{let Q=J(B);if(!Object.is(H,Q)){let X=H;H=Q,Z(Q,X,this)}})}}function S2(...$){return()=>{for(let Z=0;Z<$.length;Z+=1){let J=$[Z];if(J)J()}}}function o0($,Z,J,H){return $.addEventListener(Z,J,H),()=>{$.removeEventListener(Z,J,H)}}var $G=P(m(),1);function hj(){let[,$]=$G.useState({});return $G.useCallback(()=>{$({})},[])}var ZG=null,XL0=globalThis.requestAnimationFrame;class vj{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=($)=>{this.isScheduled=!1;let Z=this.callbacks,J=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,J>0)for(let H=0;H<Z.length;H+=1)Z[H]?.($)};request($){let Z=this.nextId;this.nextId+=1,this.callbacks.push($),this.callbacksCount+=1;let J=!1;if(!this.isScheduled||J)requestAnimationFrame(this.tick),this.isScheduled=!0;return Z}cancel($){let Z=$-this.startId;if(Z<0||Z>=this.callbacks.length)return;if(this.callbacks[Z]===null)return;this.callbacks[Z]=null,this.callbacksCount-=1}}var JG=new vj;class c2{static create(){return new c2}static request($){return JG.request($)}static cancel($){return JG.cancel($)}currentId=ZG;request($){this.cancel(),this.currentId=JG.request(()=>{this.currentId=ZG,$()})}cancel=()=>{if(this.currentId!==ZG)JG.cancel(this.currentId),this.currentId=ZG};disposeEffect=()=>{return this.cancel}}function I4(){let $=H5(c2.create).current;return P6($.disposeEffect),$}var wB=0;class n5{static create(){return new n5}currentId=wB;start($,Z){this.clear(),this.currentId=setTimeout(()=>{this.currentId=wB,Z()},$)}isStarted(){return this.currentId!==wB}clear=()=>{if(this.currentId!==wB)clearTimeout(this.currentId),this.currentId=wB};disposeEffect=()=>{return this.clear}}function s1(){let $=H5(n5.create).current;return P6($.disposeEffect),$}var fj=0;function HG($){return fj+=1,`${$}-${Math.random().toString(36).slice(2,6)}-${fj}`}function BG($,Z){if(typeof $==="string")return{description:$};if(typeof $==="function"){let J=$(Z);return typeof J==="string"?{description:J}:J}return $}var B5={};k5(B5,{screenReader:()=>wA,os:()=>CA,mediaQuery:()=>RA,env:()=>SA,engine:()=>bA});var CA={};k5(CA,{windows:()=>O00,mac:()=>pj,linux:()=>T00,ios:()=>TA,apple:()=>jA,android:()=>uj});function M00(){if(typeof navigator>"u")return{userAgent:"",platform:"",maxTouchPoints:0};return{userAgent:navigator.userAgent,platform:navigator.platform??"",maxTouchPoints:navigator.maxTouchPoints??0}}var{userAgent:P00,platform:_00,maxTouchPoints:gj}=M00(),G$=P00.toLowerCase(),U$=_00.toLowerCase();var TA=/^i(os$|p)/.test(U$)||U$==="macintel"&&gj>1,mj="android",uj=U$===mj||G$.includes(mj),pj=!TA&&U$.startsWith("mac"),O00=U$.startsWith("win"),T00=!uj&&/^(linux|chrome os)/.test(U$),jA=pj||TA;var bA={};k5(bA,{webkit:()=>EA,gecko:()=>j00,blink:()=>C00});var EA=typeof CSS<"u"&&!!CSS.supports?.("-webkit-backdrop-filter:none"),j00=!EA&&G$.includes("firefox"),C00=!EA&&G$.includes("chrom");var wA={};k5(wA,{voiceOver:()=>E00});var E00=jA;var SA={};k5(SA,{jsdom:()=>b00});var b00=/jsdom|happydom/.test(G$);var RA={};k5(RA,{iOS:()=>w00});var w00="@supports (-webkit-touch-callout: none)";function a1($){let Z=$.activeElement;while(Z?.shadowRoot?.activeElement!=null)Z=Z.shadowRoot.activeElement;return Z}function R0($,Z){if(!$||!Z)return!1;let J=Z.getRootNode?.();if($.contains(Z))return!0;if(J&&O6(J)){let H=Z;while(H){if($===H)return!0;H=H.parentNode||H.host}}return!1}function V1($){if("composedPath"in $)return $.composedPath()[0]??$.target;return $.target}var SB="data-base-ui-focusable";var IA="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])",RB="ArrowLeft",IB="ArrowRight",kA="ArrowUp",QG="ArrowDown";var W8={};k5(W8,{startingStyle:()=>Y$,endingStyle:()=>kB});var Y$="data-starting-style",kB="data-ending-style";var S00={[Y$]:""},R00={[kB]:""},Y2={transitionStatus($){if($==="starting")return S00;if($==="ending")return R00;return null}};var F$={};k5(F$,{startingStyle:()=>I00,side:()=>y00,open:()=>yA,endingStyle:()=>k00,closed:()=>xA,anchorHidden:()=>hA,align:()=>x00});var yA="data-open",xA="data-closed",I00=Y$,k00=kB,hA="data-anchor-hidden",y00="data-side",x00="data-align";var zG={};k5(zG,{pressed:()=>vA,popupOpen:()=>XG});var XG="data-popup-open",vA="data-pressed";var h00={[XG]:""},v00={[XG]:"",[vA]:""},f00={[yA]:""},g00={[xA]:""},m00={[hA]:""},p9={open($){if($)return h00;return null}},yB={open($){if($)return v00;return null}},N8={open($){if($)return f00;return g00},anchorHidden($){if($)return m00;return null}},X4={...N8,...Y2};var CL0=zG.popupOpen,xB="data-trigger-disabled";function T6($,Z){if(!s0($))return!1;let J=$;if(Z.hasElement(J))return!J.hasAttribute(xB);for(let[,H]of Z.entries())if(R0(H,J))return!H.hasAttribute(xB);return!1}function GG($,Z){if(Z==null)return!1;if("composedPath"in $)return $.composedPath().includes(Z);let J=$;return J.target!=null&&Z.contains(J.target)}function dj($){return $.matches("html,body")}function K$($){return L1($)&&$.matches(IA)}function fA($){return $?.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${IA}`)!=null}function hB($){if(!$)return!1;return $.getAttribute("role")==="combobox"&&K$($)}function c9($){if(!$||B5.env.jsdom)return!0;try{return $.matches(":focus-visible")}catch(Z){return!0}}function vB($){if(!$)return null;return $.hasAttribute(SB)?$:$.querySelector(`[${SB}]`)||$}function R8($,Z,J=!0){return $.filter((B)=>B.parentId===Z).flatMap((B)=>[...!J||B.context?.open?[B]:[],...R8($,B.id,J)])}function gA($,Z){let J=[],H=$.find((B)=>B.id===Z)?.parentId;while(H){let B=$.find((Q)=>Q.id===H);if(H=B?.parentId,B)J=J.concat(B)}return J}function o4($){$.preventDefault(),$.stopPropagation()}function lj($){return"nativeEvent"in $}function rZ($){if($.pointerType===""&&$.isTrusted)return!0;if(B5.os.android&&$.pointerType)return $.type==="click"&&$.buttons===1;return $.detail===0&&!$.pointerType}function aZ($){if(B5.env.jsdom)return!1;return!B5.os.android&&$.width===0&&$.height===0||B5.os.android&&$.width===1&&$.height===1&&$.pressure===0&&$.detail===0&&$.pointerType==="mouse"||$.width<1&&$.height<1&&$.pressure===0&&$.detail===0&&$.pointerType==="touch"}function q8($,Z){let J=["mouse","pen"];if(!Z)J.push("",void 0);return J.includes($)}function ij($){let Z=$.type;return Z==="click"||Z==="mousedown"||Z==="keydown"||Z==="keyup"}var{min:j6,max:z9,round:C6,floor:gB}=Math,d9=($)=>({x:$,y:$}),u00={left:"right",right:"left",bottom:"top",top:"bottom"};function YG($,Z,J){return z9($,j6(Z,J))}function l9($,Z){return typeof $==="function"?$(Z):$}function z4($){return $.split("-")[0]}function I8($){return $.split("-")[1]}function FG($){return $==="x"?"y":"x"}function mB($){return $==="y"?"height":"width"}function n4($){let Z=$[0];return Z==="t"||Z==="b"?"y":"x"}function uB($){return FG(n4($))}function oj($,Z,J){if(J===void 0)J=!1;let H=I8($),B=uB($),Q=mB(B),X=B==="x"?H===(J?"end":"start")?"right":"left":H==="start"?"bottom":"top";if(Z.reference[Q]>Z.floating[Q])X=fB(X);return[X,fB(X)]}function nj($){let Z=fB($);return[UG($),Z,UG(Z)]}function UG($){return $.includes("start")?$.replace("start","end"):$.replace("end","start")}var rj=["left","right"],aj=["right","left"],p00=["top","bottom"],c00=["bottom","top"];function d00($,Z,J){switch($){case"top":case"bottom":if(J)return Z?aj:rj;return Z?rj:aj;case"left":case"right":return Z?p00:c00;default:return[]}}function sj($,Z,J,H){let B=I8($),Q=d00(z4($),J==="start",H);if(B){if(Q=Q.map((X)=>X+"-"+B),Z)Q=Q.concat(Q.map(UG))}return Q}function fB($){let Z=z4($);return u00[Z]+$.slice(Z.length)}function l00($){var Z,J,H,B;return{top:(Z=$.top)!=null?Z:0,right:(J=$.right)!=null?J:0,bottom:(H=$.bottom)!=null?H:0,left:(B=$.left)!=null?B:0}}function KG($){return typeof $!=="number"?l00($):{top:$,right:$,bottom:$,left:$}}function W$($){let{x:Z,y:J,width:H,height:B}=$;return{width:H,height:B,top:J,left:Z,right:Z+H,bottom:J+B,x:Z,y:J}}function E6($,Z){return Z<0||Z>=$.length}function N$($,Z){return k8($.current,{disabledIndices:Z})}function oZ($,Z){return k8($.current,{decrement:!0,startingIndex:$.current.length,disabledIndices:Z})}function k8($,{startingIndex:Z=-1,decrement:J=!1,disabledIndices:H,amount:B=1}={}){let Q=Z;do Q+=J?-B:B;while(Q>=0&&Q<=$.length-1&&f3($,Q,H));return Q}function f3($,Z,J){if(typeof J==="function"?J(Z):J?.includes(Z)??!1)return!0;let B=$[Z];if(!B)return!1;if(!q$(B))return!0;if(B.matches(":disabled"))return!0;return!J&&(B.hasAttribute("disabled")||B.getAttribute("aria-disabled")==="true")}function i00($){return $.visibility==="hidden"||$.visibility==="collapse"}function q$($,Z=$?d2($):null){if(!$||!$.isConnected||!Z||i00(Z))return!1;if(typeof $.checkVisibility==="function")return $.checkVisibility();return Z.display!=="none"&&Z.display!=="contents"}var r00='a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]';function a00($){let Z=$.assignedSlot;if(Z)return Z;if($.parentElement)return $.parentElement;let J=$.getRootNode();return O6(J)?J.host:null}function uA($){for(let Z of Array.from($.children))if(R2(Z)==="summary")return Z;return null}function o00($,Z){let J=uA(Z);return!!J&&($===J||R0(J,$))}function tj($){let Z=$?R2($):"";return $!=null&&$.matches(r00)&&(Z!=="summary"||$.parentElement!=null&&R2($.parentElement)==="details"&&uA($.parentElement)===$)&&(Z!=="details"||uA($)==null)&&(Z!=="input"||$.type!=="hidden")}function ej($){if(!tj($)||!$.isConnected||$.matches(":disabled"))return!1;for(let Z=$;Z;Z=a00(Z)){let J=Z!==$,H=R2(Z)==="slot";if(Z.hasAttribute("inert"))return!1;if(J&&R2(Z)==="details"&&!Z.open&&!o00($,Z)||Z.hasAttribute("hidden")||!H&&!n00(Z,J))return!1}return!0}function n00($,Z){let J=d2($);if(!Z)return q$($,J);return J.display!=="none"}function $C($){let Z=$.tabIndex;if(Z<0){let J=R2($);if(J==="details"||J==="audio"||J==="video"||L1($)&&$.isContentEditable)return 0}return Z}function mA($){if(R2($)!=="input")return null;let Z=$;return Z.type==="radio"&&Z.name!==""?Z:null}function s00($,Z){let J=mA($);if(!J)return!0;let H=Z.find((B)=>{let Q=mA(B);return Q?.name===J.name&&Q.form===J.form&&Q.checked});if(H)return H===J;return Z.find((B)=>{let Q=mA(B);return Q?.name===J.name&&Q.form===J.form})===J}function ZC($){if(L1($)&&R2($)==="slot"){let Z=$.assignedElements({flatten:!0});if(Z.length>0)return Z}if(L1($)&&$.shadowRoot)return Array.from($.shadowRoot.children);return Array.from($.children)}function JC($,Z){ZC($).forEach((J)=>{if(tj(J))Z.push(J);JC(J,Z)})}function HC($,Z,J){ZC($).forEach((H)=>{if(L1(H)&&H.matches(Z))J.push(H);HC(H,Z,J)})}function WG($){return ej($)&&$C($)>=0}function pA($){let Z=[];return JC($,Z),Z.filter(ej)}function nZ($){let Z=pA($);return Z.filter((J)=>$C(J)>=0&&s00(J,Z))}function BC($,Z){let J=nZ($),H=J.length;if(H===0)return;let B=a1(m0($)),Q=J.indexOf(B),X=Q===-1?Z===1?0:H-1:Q+Z;return J[X]}function sZ($){return BC(m0($).body,1)||$}function NG($){return BC(m0($).body,-1)||$}function QC($,Z){if(!$)return null;let J=nZ(m0($).body),H=J.length;if(H===0)return null;let B=J.indexOf($);if(B===-1)return null;let Q=(B+Z+H)%H;return J[Q]}function XC($){return QC($,1)}function zC($){return QC($,-1)}function g3($,Z){let J=Z||$.currentTarget,H=$.relatedTarget;return!H||!R0(J,H)}function GC($){nZ($).forEach((J)=>{J.dataset.tabindex=J.getAttribute("tabindex")||"",J.setAttribute("tabindex","-1")})}function cA($){let Z=[];HC($,"[data-tabindex]",Z),Z.forEach((J)=>{let H=J.dataset.tabindex;if(delete J.dataset.tabindex,H)J.setAttribute("tabindex",H);else J.removeAttribute("tabindex")})}function dA($){let Z=new Map,J=0,H=0;return $.forEach((B,Q)=>{let X=B.transitionStatus==="ending";if(Z.set(B.id,{value:B,domIndex:Q,visibleIndex:X?-1:J,offsetY:H}),H+=B.height||0,!X)J+=1}),Z}function lA($,Z){let J=0;return $.map((H)=>{if(H.transitionStatus==="ending")return H;let B=J>=Z;return J+=1,H.limited===B?H:{...H,limited:B}})}var G9={toasts:($)=>$.toasts,isEmpty:($)=>$.toasts.length===0,toast:($,Z)=>$.toastMetadata.get(Z)?.value,toastIndex:($,Z)=>$.toastMetadata.get(Z)?.domIndex??-1,toastOffsetY:($,Z)=>$.toastMetadata.get(Z)?.offsetY??0,toastVisibleIndex:($,Z)=>$.toastMetadata.get(Z)?.visibleIndex??-1,focused:($)=>$.focused,expanded:($)=>$.hovering||$.focused,expandedOrOutOfFocus:($)=>$.hovering||$.focused||!$.isWindowFocused,prevFocusElement:($)=>$.prevFocusElement};class iA extends p2{timers=new Map;areTimersPaused=!1;constructor($){super({...$,toastMetadata:dA($.toasts)},{},G9)}setViewport=($)=>{this.set("viewport",$)};syncProviderProps($,Z){let J=this.state.limit!==Z;if(this.state.timeout===$&&!J)return;let H={timeout:$,limit:Z};if(J){let B=lA(this.state.toasts,Z);H.toasts=B,H.toastMetadata=dA(B)}this.update(H)}disposeEffect=()=>{return()=>{this.timers.forEach(($)=>{$.timeout?.clear()}),this.timers.clear()}};removeToast($,Z=!1){let J=G9.toastIndex(this.state,$);if(J===-1)return;let H=this.state.toasts[J];if(!Z)H?.onRemove?.();let B=[...this.state.toasts];B.splice(J,1),this.setToasts(B)}addToast=($)=>{let{timeout:Z,limit:J}=this.state,H=$.id||HG("toast");if($.id){let z=G9.toast(this.state,$.id);if(z)if(z.transitionStatus==="ending")this.removeToast($.id,!0);else{let{id:G,transitionStatus:U,...Y}=$;return this.updateToastInternal($.id,Y,!0,!0),$.id}}let B={...$,id:H,updateKey:0,transitionStatus:"starting"},Q=[B,...this.state.toasts];this.setToasts(lA(Q,J));let X=B.timeout??Z;if(B.type!=="loading"&&X>0)this.scheduleTimer(H,X,()=>this.closeToast(H));if(G9.expandedOrOutOfFocus(this.state))this.pauseTimers();return H};updateToast=($,Z)=>{let J=G9.toast(this.state,$);if(!J||J.transitionStatus==="ending")return;this.updateToastInternal($,typeof Z==="function"?Z(J):Z,!1,!0)};updateToastInternal=($,Z,J=!1,H=!1)=>{let{timeout:B,toasts:Q}=this.state,X=G9.toast(this.state,$);if(!X)return;if(X.transitionStatus==="ending")return;let z={...X,...Z,...H&&{updateKey:X.updateKey+1}};this.setToasts(Q.map((q)=>q.id===$?z:q));let G=z.timeout??B,U=X.timeout??B,Y=Object.hasOwn(Z,"timeout"),F=z.transitionStatus!=="ending"&&z.type!=="loading"&&G>0,K=this.timers.has($),W=U!==G,N=X.type==="loading";if(!F&&K){this.clearTimer($);return}if(F&&(!K||W||Y||N||J)){if(this.clearTimer($),this.scheduleTimer($,G,()=>this.closeToast($)),G9.expandedOrOutOfFocus(this.state))this.pauseTimers()}};closeToast=($)=>{let Z=$===void 0,{limit:J,toasts:H}=this.state,B;if(Z)B=H,this.clearTimers();else{let z=G9.toast(this.state,$);if(!z)return;B=[z],this.clearTimer($)}let Q=H.map((z)=>Z||z.id===$?{...z,transitionStatus:"ending",height:0}:z),X=lA(Q,J);this.setToasts(X,!X.some((z)=>z.transitionStatus!=="ending")),B.forEach((z)=>{if(z.transitionStatus!=="ending")z.onClose?.()}),this.handleFocusManagement($)};promiseToast=($,Z)=>{let J=BG(Z.loading),H=this.addToast({...J,type:"loading"}),B=$.then((Q)=>{let X=BG(Z.success,Q);return this.updateToast(H,{...X,type:"success",timeout:X.timeout}),Q}).catch((Q)=>{let X=BG(Z.error,Q);return this.updateToast(H,{...X,type:"error",timeout:X.timeout}),Promise.reject(Q)});if({}.hasOwnProperty.call(Z,"setPromise"))Z.setPromise(B);return B};pauseTimers(){if(this.areTimersPaused)return;this.areTimersPaused=!0,this.timers.forEach(($)=>{if($.timeout)$.timeout.clear(),$.remaining=Math.max($.remaining-(Date.now()-$.start),0)})}resumeTimers(){if(!this.areTimersPaused)return;this.areTimersPaused=!1,this.timers.forEach(($,Z)=>{$.remaining=$.remaining>0?$.remaining:$.delay,$.timeout??=n5.create(),$.timeout.start($.remaining,()=>{this.handleTimerFired(Z),$.callback()}),$.start=Date.now()})}restoreFocusToPrevElement(){this.state.prevFocusElement?.focus({preventScroll:!0})}handleDocumentPointerDown=($)=>{if($.pointerType!=="touch")return;let Z=V1($);if(R0(this.state.viewport,Z))return;this.resumeTimers(),this.update({hovering:!1,focused:!1})};scheduleTimer($,Z,J){let H=Date.now(),Q=!G9.expandedOrOutOfFocus(this.state)?n5.create():void 0;Q?.start(Z,()=>{this.handleTimerFired($),J()}),this.timers.set($,{timeout:Q,start:H,delay:Z,remaining:Z,callback:J})}clearTimers(){this.timers.forEach(($)=>{$.timeout?.clear()}),this.timers.clear(),this.areTimersPaused=!1}clearTimer($){this.timers.get($)?.timeout?.clear(),this.timers.delete($),this.resetPausedStateIfNoTimersRemain()}handleTimerFired($){this.timers.delete($),this.resetPausedStateIfNoTimersRemain()}resetPausedStateIfNoTimersRemain(){if(this.timers.size===0)this.areTimersPaused=!1}setToasts($,Z=$.length===0){let J={toasts:$,toastMetadata:dA($)};if(Z)J.hovering=!1,J.focused=!1;this.update(J)}handleFocusManagement($){let Z=a1(m0(this.state.viewport));if(!this.state.viewport||!R0(this.state.viewport,Z)||!c9(Z))return;if($===void 0){this.restoreFocusToPrevElement();return}let J=G9.toasts(this.state),H=G9.toastIndex(this.state,$),B=(X,z)=>{for(let G=X;G>=0&&G<J.length;G+=z)if(J[G].transitionStatus!=="ending")return J[G];return null},Q=B(H+1,1)??B(H-1,-1);if(Q)Q.ref?.current?.focus();else this.restoreFocusToPrevElement()}}var qG=P(u(),1),YC=function(Z){let{children:J,timeout:H=5000,limit:B=3,toastManager:Q}=Z,X=H5(()=>new iA({timeout:H,limit:B,viewport:null,toasts:[],hovering:!1,focused:!1,isWindowFocused:!0,prevFocusElement:null})).current;return P6(X.disposeEffect),UC.useEffect(function(){if(!Q)return;return Q[" subscribe"](({action:U,options:Y})=>{let F=Y.id;if(U==="promise"&&Y.promise)X.promiseToast(Y.promise,Y);else if(U==="update"&&F)X.updateToast(F,Y.updates);else if(U==="close")X.closeToast(F);else X.addToast(Y)})},[X,Q]),qG.jsxs(VA.Provider,{value:X,children:[qG.jsx(t00,{store:X,timeout:H,limit:B}),J]})};function t00($){let{store:Z,timeout:J,limit:H}=$;return H0(()=>{Z.syncProviderProps(J,H)},[Z,J,H]),null}var y8=P(m(),1);var FC={clipPath:"inset(50%)",overflow:"hidden",whiteSpace:"nowrap",border:0,padding:0,width:1,height:1,margin:-1},U9={...FC,position:"fixed",top:0,left:0},AG={...FC,position:"absolute"};var DG=P(m(),1);var KC=P(u(),1),s4=DG.forwardRef(function(Z,J){let[H,B]=DG.useState();return H0(()=>{if(B5.screenReader.voiceOver&&B5.engine.webkit)B("button")},[]),KC.jsx("span",{...Z,ref:J,style:U9,"aria-hidden":H?void 0:!0,...{tabIndex:0,role:H},"data-base-ui-focus-guard":""})});var WC="--toast-frontmost-height";var m3=P(u(),1),NC=y8.forwardRef(function(Z,J){let{render:H,className:B,style:Q,children:X,...z}=Z,G=m9(),U=s1(),Y=y8.useRef(!1),F=y8.useRef(!1),K=y8.useRef(!1),W=G.useState("isEmpty"),N=G.useState("toasts"),q=G.useState("focused"),D=G.useState("expanded"),A=G.useState("prevFocusElement"),V=N[0]?.height,L=N.some((f)=>f.transitionStatus==="ending"),O=N.filter((f)=>f.priority==="high");y8.useEffect(()=>{let f=G.state.viewport;if(!f||W)return;let b=k1(f),l=m0(f);function r(o){if(o.key==="F6"&&V1(o)!==f)o.preventDefault(),G.set("prevFocusElement",a1(l)),f?.focus({preventScroll:!0}),G.pauseTimers(),G.set("focused",!0)}function h(o){if(V1(o)!==b)return;G.set("isWindowFocused",!1),G.pauseTimers()}function d(o){if(o.relatedTarget)return;let c=V1(o),i=a1(m0(f));if(c===b||!R0(f,c)||!c9(i))G.resumeTimers();U.start(0,()=>G.set("isWindowFocused",!0))}return S2(o0(b,"keydown",r),o0(b,"blur",h,!0),o0(b,"focus",d,!0),o0(l,"pointerdown",G.handleDocumentPointerDown,!0))},[G,U,W]);function M(f){Y.current=!0;let b=f.relatedTarget===G.state.viewport?N.find((l)=>l.transitionStatus!=="ending"&&!l.limited):void 0;if(b)b.ref?.current?.focus();else G.restoreFocusToPrevElement()}function _(f){if(f.key==="Tab"&&f.shiftKey&&V1(f.nativeEvent)===G.state.viewport)f.preventDefault(),G.restoreFocusToPrevElement()}function w(){if(G.state.toasts.some((b)=>b.transitionStatus==="ending")||K.current||!F.current)return;if(G.state.isWindowFocused)G.resumeTimers();G.set("hovering",!1),F.current=!1}y8.useEffect(w,[L,G]);function C(){G.pauseTimers(),G.set("hovering",!0),F.current=!1}function E(){if(G.state.isWindowFocused)G.resumeTimers()}function T(){F.current=!0,w()}function k(f){if(f.pointerType==="touch")K.current=!0}function S(f){if(f.pointerType!=="touch")return;K.current=!1,w()}function I(){if(Y.current){Y.current=!1;return}if(q)return;if(c9(a1(m0(G.state.viewport))))G.set("focused",!0),G.pauseTimers()}function j(f){if(!q||R0(G.state.viewport,f.relatedTarget))return;G.set("focused",!1),E()}let y={tabIndex:-1,role:"region","aria-live":"polite","aria-atomic":!1,"aria-relevant":"additions text","aria-label":"Notifications",onMouseEnter:C,onMouseMove:C,onMouseLeave:T,onFocus:I,onBlur:j,onKeyDown:_,onClick:I,onPointerDown:k,onPointerUp:S,onPointerCancel:S,style:{[WC]:V?`${V}px`:void 0}},R={expanded:D},x=!W&&A&&m3.jsx(s4,{onFocus:M}),v=G0("div",Z,{ref:[J,G.setViewport],state:R,props:[y,z,{children:m3.jsxs(y8.Fragment,{children:[x,X,x]})}]});return m3.jsxs(y8.Fragment,{children:[x,v,!q&&O.length>0&&m3.jsx("div",{style:U9,children:O.map((f)=>m3.jsxs("div",{role:"alert","aria-atomic":!0,children:[m3.jsx("div",{children:f.title}),m3.jsx("div",{children:f.description})]},f.id))})]})});var M5=P(m(),1),SC=P(A8(),1);function x8($){if(tz(19))return $;return $?"true":void 0}var VG=P(m(),1),rA=VG.createContext(void 0);function b6(){let $=VG.useContext(rA);if(!$)throw Error(I0(66));return $}var qC=P(m(),1);var aA=P(A8(),1);function Y9($){if($==null)return $;return"current"in $?$.current:$}var LG=null;function $10($){if(!LG){let Z=[];LG=Z,queueMicrotask(()=>{LG=null,aA.flushSync(()=>{for(let J of Z)J()})})}LG.push($)}function t4($,Z=!1,J=!1){let H=I4();return Y0((B,Q=null)=>{H.cancel();let X=Y9($);if(X==null)return;let z=X,G=()=>{if(!J){aA.flushSync(B);return}$10(()=>{if(!Q?.aborted)B()})};if(typeof z.getAnimations!=="function"||globalThis.BASE_UI_ANIMATIONS_DISABLED){B();return}function U(){Promise.all(z.getAnimations().map((Y)=>Y.finished)).then(()=>{if(!Q?.aborted)G()},()=>{if(Q?.aborted)return;if(z.getAnimations().some((F)=>F.pending||F.playState!=="finished")){U();return}G()})}if(Z){let Y=Y$;if(!z.hasAttribute(Y)){H.request(U);return}let F=new MutationObserver(()=>{if(!z.hasAttribute(Y))F.disconnect(),U()});F.observe(z,{attributes:!0,attributeFilter:[Y]}),Q?.addEventListener("abort",()=>F.disconnect(),{once:!0});return}H.request(U)})}function L5($){let{enabled:Z=!0,open:J,ref:H,batch:B=!1,onComplete:Q}=$,X=Y0(Q),z=t4(H,J,B);qC.useEffect(()=>{if(!Z)return;let G=new AbortController;return z(X,G.signal),()=>{G.abort()}},[Z,J,X,z])}var AC=500,MG=500,DC={style:{transition:"none"}},tZ="data-base-ui-click-trigger";var VC="[data-base-ui-swipe-ignore]",LC="[data-swipe-ignore]",MC={fallbackAxisSide:"none"},i9={fallbackAxisSide:"end"},PC={clipPath:"inset(50%)",position:"fixed",top:0,left:0};var _G=P(m(),1);function I2($,Z=Number.MIN_SAFE_INTEGER,J=Number.MAX_SAFE_INTEGER){return Math.max(Z,Math.min($,J))}function PG($,Z){let J=(Z??k1($).getComputedStyle($)).transform,H=0,B=0,Q=1;if(J&&J!=="none"){let X=J.match(/matrix(?:3d)?\(([^)]+)\)/);if(X){let z=X[1].split(", ").map(parseFloat);if(z.length===6)H=z[4],B=z[5],Q=Math.sqrt(z[0]*z[0]+z[1]*z[1]);else if(z.length===16)H=z[12],B=z[13],Q=z[0]}}return{x:H,y:B,scale:Q}}function OG($,Z,J){switch($){case"up":return-J;case"down":return J;case"left":return-Z;case"right":return Z;default:return 0}}var TG="--toast-index",_C="--toast-offset-y",OC="--toast-height",TC="--toast-swipe-movement-x",jC="--toast-swipe-movement-y";var EC="data-swipe-direction",gM0=W8.startingStyle,mM0=W8.endingStyle;var RC=P(u(),1),J10={...Y2,swipeDirection($){return $?{[EC]:$}:null}},bC=40,H10=10,wC=0.5,B10=1,Q10=`${VC},${LC}`,IC=M5.forwardRef(function(Z,J){let{toast:H,render:B,className:Q,swipeDirection:X=["down","right"],style:z,...G}=Z,U=H.positionerProps?.anchor!==void 0,Y=[];if(!U)Y=Array.isArray(X)?X:[X];let F=Y.length>0,K=m9(),[W,N]=M5.useState(void 0),[q,D]=M5.useState(!1),[A,V]=M5.useState(!1),[L,O]=M5.useState({x:0,y:0}),[M,_]=M5.useState({x:0,y:0,scale:1}),[w,C]=M5.useState(),[E,T]=M5.useState(),[k,S]=M5.useState(null),I=M5.useRef(null),j=M5.useRef(void 0),y=M5.useRef({x:0,y:0}),R=M5.useRef({x:0,y:0,scale:1}),x=M5.useRef(void 0),v=M5.useRef(0),f=M5.useRef(!1),b=M5.useRef({x:0,y:0}),l=M5.useRef(!1),r=M5.useRef({x:0,y:0}),h=M5.useRef(null),d=M5.useRef(null),o=K.useState("toastIndex",H.id),c=K.useState("toastVisibleIndex",H.id),i=K.useState("toastOffsetY",H.id),n=K.useState("focused"),Z0=K.useState("expanded");L5({open:H.transitionStatus!=="ending",ref:I,onComplete(){if(H.transitionStatus==="ending")K.removeToast(H.id)}});let J0=Y0((P0=!1)=>{let A0=I.current;if(!A0)return;let M0=A0.style.height;A0.style.height="auto";let g=A0.offsetHeight;A0.style.height=M0;function p(){K.updateToastInternal(H.id,{ref:I,height:g,transitionStatus:void 0})}if(P0)SC.flushSync(p);else p()});H0(()=>{let P0=j.current;if(H.transitionStatus!=="starting"&&P0===H.id)return;if(P0!==void 0)N(void 0),_({x:0,y:0,scale:1}),U0({x:0,y:0});j.current=H.id,J0()},[J0,H.id,H.transitionStatus]);function U0(P0){r.current=P0,O(P0)}H0(()=>{return()=>{d.current?.abort()}},[]);function z0(P0,A0){let M0=(e)=>e>0?e**wC:-(Math.abs(e)**wC),g=P0>0&&!Y.includes("right")||P0<0&&!Y.includes("left"),p=A0>0&&!Y.includes("down")||A0<0&&!Y.includes("up");return{x:g?M0(P0):P0,y:p?M0(A0):A0}}let X0=Y0((P0)=>{if(P0.pointerId!==h.current)return;h.current=null,d.current?.abort(),d.current=null,D(!1),V(!1),S(null);let A0=R.current;if(P0.type==="pointercancel"||f.current){U0({x:A0.x,y:A0.y}),N(void 0);return}let M0=r.current,g=M0.x-A0.x,p=M0.y-A0.y,e;for(let W0 of Y)if(OG(W0,g,p)>bC){e=W0;break}if(e)N(e),K.closeToast(H.id);else U0({x:A0.x,y:A0.y}),N(void 0)});function N0(P0){if(P0.button!==0)return;if(P0.pointerType==="touch")K.pauseTimers();if(V1(P0.nativeEvent)?.closest(`button,a,input,textarea,[role="button"],${Q10}`))return;f.current=!1,x.current=void 0,v.current=0,h.current=P0.pointerId,y.current={x:P0.clientX,y:P0.clientY},b.current=y.current;let g=P0.currentTarget,p=PG(g);R.current=p,_(p),U0({x:p.x,y:p.y}),K.set("hovering",!0),D(!0),V(!1),S(null),l.current=!0,d.current?.abort();let e=new AbortController;d.current=e;let W0=m0(g);W0.addEventListener("pointerup",X0,{signal:e.signal}),W0.addEventListener("pointercancel",X0,{signal:e.signal}),g.setPointerCapture?.(P0.pointerId)}function q0(P0){if(P0.pointerId!==h.current)return;if(P0.preventDefault(),l.current)y.current={x:P0.clientX,y:P0.clientY},l.current=!1;let{clientY:A0,clientX:M0,movementX:g,movementY:p}=P0;if(p<0&&A0>b.current.y||p>0&&A0<b.current.y)b.current={x:b.current.x,y:A0};if(g<0&&M0>b.current.x||g>0&&M0<b.current.x)b.current={x:M0,y:b.current.y};let e=M0-y.current.x,W0=A0-y.current.y,S0=A0-b.current.y,h0=M0-b.current.x,v0=k;if(!A){if(Math.sqrt(e*e+W0*W0)>=B10){V(!0);let Y1=Y.includes("left")||Y.includes("right"),U5=Y.includes("up")||Y.includes("down");if(Y1&&U5){let C0=Math.abs(e),p0=Math.abs(W0);v0=C0>p0?"horizontal":"vertical",S(v0)}}}let j0;if(!x.current){if(v0==="vertical"){if(W0>0)j0="down";else if(W0<0)j0="up"}else if(v0==="horizontal"){if(e>0)j0="right";else if(e<0)j0="left"}else if(Math.abs(e)>=Math.abs(W0))j0=e>0?"right":"left";else j0=W0>0?"down":"up";if(j0&&Y.includes(j0))x.current=j0,v.current=OG(j0,e,W0),N(j0)}else{let R1=x.current,Y1=OG(R1,h0,S0);if(Y1>bC)f.current=!1,N(R1);else if(!(Y.includes("left")&&Y.includes("right"))&&!(Y.includes("up")&&Y.includes("down"))&&v.current-Y1>=H10)f.current=!0}let c0=z0(e,W0),z1=R.current.x,A1=R.current.y,l0=Y.includes("left")||Y.includes("right"),k0=Y.includes("up")||Y.includes("down");if(v0!=="vertical"&&l0)z1+=c0.x;if(v0!=="horizontal"&&k0)A1+=c0.y;U0({x:z1,y:A1})}function K0(P0){if(P0.key==="Escape"){if(!I.current||!R0(I.current,a1(m0(I.current))))return;K.closeToast(H.id)}}M5.useEffect(()=>{let P0=I.current;if(!F||!P0)return;function A0(M0){if(h.current===null||!R0(P0,V1(M0)))return;M0.preventDefault()}return o0(P0,"touchmove",A0,{passive:!1})},[F]);function s(){let P0=L.x-M.x,A0=L.y-M.y;return{transition:q?"none":void 0,transform:q?`translateX(${L.x}px) translateY(${L.y}px) scale(${M.scale})`:void 0,[TC]:`${P0}px`,[jC]:`${A0}px`}}let a=H.priority==="high",$0={role:a?"alertdialog":"dialog",tabIndex:0,"aria-modal":!1,"aria-labelledby":w,"aria-describedby":E,"aria-hidden":a&&!n?!0:void 0,onPointerDown:F?N0:void 0,onPointerMove:F?q0:void 0,onPointerUp:F?X0:void 0,onPointerCancel:F?X0:void 0,onKeyDown:K0,inert:x8(H.limited),style:{...s(),[TG]:H.transitionStatus==="ending"?o:c,[_C]:`${i}px`,[OC]:H.height?`${H.height}px`:void 0}},t=M5.useMemo(()=>({toast:H,setTitleId:C,setDescriptionId:T,recalculateHeight:J0,visibleIndex:c,expanded:Z0}),[H,C,T,J0,c,Z0]),B0={transitionStatus:H.transitionStatus,expanded:Z0,limited:H.limited||!1,type:H.type,swiping:q,swipeDirection:W},_0=G0("div",Z,{ref:[J,I],state:B0,stateAttributesMapping:J10,props:[$0,G]});return RC.jsx(rA.Provider,{value:t,children:_0})});var jG=P(m(),1);var kC=jG.forwardRef(function(Z,J){let{render:H,className:B,style:Q,...X}=Z,{visibleIndex:z,expanded:G,recalculateHeight:U}=b6(),Y=jG.useRef(null);H0(()=>{U();let W=Y.current;if(!W||typeof ResizeObserver!=="function"||typeof MutationObserver!=="function")return;let N=new ResizeObserver(()=>U(!0)),q=new MutationObserver(()=>U(!0));return N.observe(W),q.observe(W,{childList:!0,subtree:!0,characterData:!0}),()=>{N.disconnect(),q.disconnect()}},[U]);let F=z>0;return G0("div",Z,{ref:[J,Y],state:{expanded:G,behind:F},props:X})});var gC=P(m(),1);var CG=P(m(),1);var yC=0;function X10($,Z="mui"){let[J,H]=CG.useState($),B=$||J;return CG.useEffect(()=>{if(J==null)yC+=1,H(`${Z}-${yC}`)},[J,Z]),B}var xC=hC.useId;function k4($,Z){if(xC!==void 0){let J=xC();return $??(Z?`${Z}-${J}`:J)}return X10($,Z)}var vC=P(m(),1);function fC($){if($==null||typeof $==="boolean"||$==="")return!1;if(Array.isArray($))return $.some(fC);return!0}function EG($){return vC.isValidElement($)&&fC($.props.children)}function bG($,Z,J){let{toast:H,setTitleId:B,setDescriptionId:Q}=b6(),X=J==="title"?B:Q,z=Z??(J==="title"?H.title:H.description);return{id:k4($),children:z,type:H.type,setId:X}}function wG($,Z,J){let H=EG($);return H0(()=>{if(!H)return;return J(Z),()=>{J((B)=>B===Z?void 0:B)}},[H,Z,J]),H?$:null}var mC=gC.forwardRef(function(Z,J){let{render:H,className:B,style:Q,id:X,children:z,...G}=Z,{id:U,children:Y,type:F,setId:K}=bG(X,z,"description"),N=G0("p",Z,{ref:J,state:{type:F},props:{...G,id:U,children:Y}});return wG(N,U,K)});var uC=P(m(),1);var pC=uC.forwardRef(function(Z,J){let{render:H,className:B,style:Q,id:X,children:z,...G}=Z,{id:U,children:Y,type:F,setId:K}=bG(X,z,"title"),N=G0("h2",Z,{ref:J,state:{type:F},props:{...G,id:U,children:Y}});return wG(N,U,K)});var SG=P(m(),1);var cC=SG.forwardRef(function(Z,J){let{render:H,className:B,style:Q,disabled:X,nativeButton:z=!0,...G}=Z,U=m9(),{toast:Y,expanded:F}=b6(),[K,W]=SG.useState(!1),{getButtonProps:N,buttonRef:q}=w5({disabled:X,native:z}),D={type:Y.type};return G0("button",Z,{ref:[J,q],state:D,props:[{"aria-hidden":!F&&!K,onClick(){U.closeToast(Y.id)},onFocus(){W(!0)},onBlur(){W(!1)}},G,N]})});var dC=P(m(),1);var lC=dC.forwardRef(function(Z,J){let{render:H,className:B,style:Q,disabled:X,nativeButton:z=!0,...G}=Z,{toast:U}=b6(),Y=U.actionProps?.children??G.children,{getButtonProps:F,buttonRef:K}=w5({disabled:X,native:z}),W={type:U.type},N=G0("button",Z,{ref:[J,K],state:W,props:[G,U.actionProps,F,{children:Y}]});return EG(N)?N:null});var nC=P(m(),1);var kG=P(m(),1),aC=P(A8(),1);var v5=P(m(),1),oA=P(A8(),1);var F0={};k5(F0,{windowResize:()=>u10,wheel:()=>I10,triggerPress:()=>G10,triggerHover:()=>U10,triggerFocus:()=>Y10,trackPress:()=>D10,swipe:()=>m10,siblingOpen:()=>x10,scrub:()=>k10,pointer:()=>S10,outsidePress:()=>F10,none:()=>z10,missing:()=>v10,listNavigation:()=>b10,linkPress:()=>N10,keyboard:()=>w10,itemPress:()=>K10,inputPress:()=>T10,inputPaste:()=>O10,inputClear:()=>P10,inputChange:()=>M10,inputBlur:()=>_10,initial:()=>f10,incrementPress:()=>V10,imperativeAction:()=>g10,focusOut:()=>j10,escapeKey:()=>C10,drag:()=>R10,disabled:()=>h10,decrementPress:()=>L10,closeWatcher:()=>E10,closePress:()=>W10,clearPress:()=>q10,chipRemovePress:()=>A10,cancelOpen:()=>y10});var z10="none",G10="trigger-press",U10="trigger-hover",Y10="trigger-focus",F10="outside-press",K10="item-press",W10="close-press",N10="link-press",q10="clear-press",A10="chip-remove-press",D10="track-press",V10="increment-press",L10="decrement-press",M10="input-change",P10="input-clear",_10="input-blur",O10="input-paste",T10="input-press",j10="focus-out",C10="escape-key",E10="close-watcher",b10="list-navigation",w10="keyboard",S10="pointer",R10="drag",I10="wheel",k10="scrub",y10="cancel-open",x10="sibling-open",h10="disabled",v10="missing",f10="initial",g10="imperative-action",m10="swipe",u10="window-resize";function w0($,Z,J,H){let B=!1,Q=!1,X=H??D1;return{reason:$,event:Z??new Event("base-ui"),cancel(){B=!0},allowPropagation(){Q=!0},get isCanceled(){return B},get isPropagationAllowed(){return Q},trigger:J,...X}}function RG($,Z,J){let H=J??D1;return{reason:$,event:Z??new Event("base-ui"),...H}}function u3($){return`data-base-ui-${$}`}var A$=P(u(),1),rC=v5.createContext(null),nA=()=>v5.useContext(rC),p10=u3("portal");function IG($={}){let{ref:Z,container:J,componentProps:H=D1,elementProps:B}=$,Q=k4(),z=nA()?.portalNode,[G,U]=v5.useState(null),[Y,F]=v5.useState(null),K=Y0((D)=>{if(D!==null)F(D)}),W=v5.useRef(null);H0(()=>{if(J===null){if(W.current)W.current=null,F(null),U(null);return}let D=(J&&(iC(J)?J:J.current))??z??document.body;if(D==null){if(W.current)W.current=null,F(null),U(null);return}if(W.current!==D)W.current=D,F(null),U(D)},[J,z]);let N=G0("div",H,{ref:[Z,K],props:[{id:Q,[p10]:""},B]}),q=G&&N?oA.createPortal(N,G):null;return{node:Y,nodeId:v5.isValidElement(N)?N.props.id:void 0,subtree:q}}var D$=v5.forwardRef(function(Z,J){let{render:H,className:B,style:Q,children:X,container:z,portalOwnerRole:G,...U}=Z,{node:Y,nodeId:F,subtree:K}=IG({container:z,ref:J,componentProps:Z,elementProps:U}),W=v5.useRef(null),N=v5.useRef(null),q=v5.useRef(null),D=v5.useRef(null),[A,V]=v5.useState(null),L=v5.useRef(!1),O=A?.modal,M=A?.open,_=!!A&&!A.modal&&A.open&&!!Y;v5.useEffect(()=>{if(!Y||O)return;function C(E){if(Y&&E.relatedTarget&&g3(E))if(E.type==="focusin"){if(L.current)cA(Y),L.current=!1}else GC(Y),L.current=!0}return S2(o0(Y,"focusin",C,!0),o0(Y,"focusout",C,!0))},[Y,O]),H0(()=>{if(!Y||M!==!0||!L.current)return;cA(Y),L.current=!1},[M,Y]);let w=v5.useMemo(()=>({beforeOutsideRef:W,afterOutsideRef:N,beforeInsideRef:q,afterInsideRef:D,portalNode:Y,setFocusManagerState:V}),[Y]);return A$.jsxs(v5.Fragment,{children:[K,A$.jsxs(rC.Provider,{value:w,children:[_&&Y&&A$.jsx(s4,{"data-type":"outside",ref:W,onFocus:(C)=>{if(g3(C,Y))q.current?.focus();else{let E=A?A.domReference:null;NG(E)?.focus()}}}),_&&Y&&A$.jsx("span",{role:G,"aria-owns":F,style:PC}),Y&&oA.createPortal(X,Y),_&&Y&&A$.jsx(s4,{"data-type":"outside",ref:N,onFocus:(C)=>{if(g3(C,Y))D.current?.focus();else{let E=A?A.domReference:null;if(sZ(E)?.focus(),A?.closeOnFocusOut)A?.onOpenChange(!1,w0(F0.focusOut,C.nativeEvent))}}})]})]})});var oC=P(u(),1),eZ=kG.forwardRef(function(Z,J){let{children:H,container:B,className:Q,render:X,style:z,...G}=Z,{node:U,subtree:Y}=IG({container:B,ref:J,componentProps:Z,elementProps:G});if(!Y&&!U)return null;return oC.jsxs(kG.Fragment,{children:[Y,U&&aC.createPortal(H,U)]})});var sC=P(u(),1),tC=nC.forwardRef(function(Z,J){return sC.jsx(eZ,{ref:J,...Z})});var HU=P(m(),1);var D8=P(m(),1);function N5($){let Z=H5(c10,$).current;return Z.next=$,H0(Z.effect),Z}function c10($){let Z={current:$,next:$,effect:()=>{Z.current=Z.next}};return Z}var y4=P(m(),1);function d10($,Z){if(Z!=null&&!q8(Z))return 0;if(typeof $==="function")return $();return $}function F9($,Z,J){let H=d10($,J);if(typeof H==="number")return H;return H?.[Z]}function sA($){if(typeof $==="function")return $();return $}function yG($,Z){return Z||$==="click"||$==="mousedown"}function eC($){return $?.includes("mouse")&&$!=="mousedown"}var $E=P(u(),1),ZE=y4.createContext({hasProvider:!1,timeoutMs:0,delayRef:{current:0},initialDelayRef:{current:0},timeout:new n5,currentIdRef:{current:null},currentContextRef:{current:null}});function l10($,Z){$.current=Z.current}function tA($){let{children:Z,delay:J,timeoutMs:H=0}=$,B=y4.useRef(J),Q=y4.useRef(J),X=y4.useRef(null),z=y4.useRef(null),G=s1();return H0(()=>{if(Q.current=J,!X.current){B.current=J;return}B.current={open:F9(B.current,"open"),close:F9(J,"close")}},[J,X,B,Q]),$E.jsx(ZE.Provider,{value:y4.useMemo(()=>({hasProvider:!0,delayRef:B,initialDelayRef:Q,currentIdRef:X,timeoutMs:H,currentContextRef:z,timeout:G}),[H,G]),children:Z})}function eA($,Z={open:!1}){let{open:J}=Z,H="rootStore"in $?$.rootStore:$,B=H.useState("floatingId"),Q=y4.useContext(ZE),{currentIdRef:X,delayRef:z,timeoutMs:G,initialDelayRef:U,currentContextRef:Y,hasProvider:F,timeout:K}=Q,[W,N]=y4.useState(!1),q=y4.useRef(J);return H0(()=>{q.current=J},[J]),H0(()=>{function D(){Y.current?.setIsInstantPhase(!1),X.current=null,Y.current=null,z.current=U.current,K.clear()}if(!X.current)return;if(!J&&X.current===B){if(N(!1),G){let A=B;return K.start(G,()=>{if(H.select("open")||X.current&&X.current!==A)return;D()}),()=>{if(q.current||X.current!==A)K.clear()}}D()}return},[J,B,X,z,G,U,Y,K,H]),H0(()=>{if(!J)return;let D=Y.current,A=X.current;if(K.clear(),Y.current={onOpenChange:H.setOpen,setIsInstantPhase:N},X.current=B,z.current={open:0,close:F9(U.current,"close")},A!==null&&A!==B)N(!0),D?.setIsInstantPhase(!0),D?.onOpenChange(!1,w0(F0.none));else N(!1),D?.setIsInstantPhase(!1)},[J,B,H,X,z,U,Y,K]),H0(()=>{return()=>{if(X.current===B){if(Y.current=null,!q.current)return;X.current=null,l10(z,U),K.clear()}}},[Y,X,z,B,U,K]),y4.useMemo(()=>({activeIdRef:X,hasProvider:F,delayRef:z,isInstantPhase:W}),[X,F,z,W])}var U4=P(m(),1);var xG=0;function $J($,Z={}){let{preventScroll:J=!1,sync:H=!1,shouldFocus:B}=Z;cancelAnimationFrame(xG);function Q(){if(B&&!B())return;$?.focus({preventScroll:J})}if(H)return Q(),G1;let X=requestAnimationFrame(Q);return xG=X,()=>{if(xG===X)cancelAnimationFrame(X),xG=0}}var $D={inert:new WeakMap,"aria-hidden":new WeakMap},JE="data-base-ui-inert",JD={inert:new WeakSet,"aria-hidden":new WeakSet},pB=new WeakMap,ZD=0;function i10($){return JD[$]}function XE($){if(!$)return null;return O6($)?$.host:XE($.parentNode)}var HE=($,Z)=>Z.map((J)=>{if($.contains(J))return J;let H=XE(J);if($.contains(H))return H;return null}).filter((J)=>J!=null),BE=($)=>{let Z=new Set;return $.forEach((J)=>{let H=J;while(H&&!Z.has(H))Z.add(H),H=H.parentNode}),Z},QE=($,Z,J)=>{let H=[],B=(Q)=>{if(!Q||J.has(Q))return;Array.from(Q.children).forEach((X)=>{if(R2(X)==="script")return;if(Z.has(X))B(X);else H.push(X)})};return B($),H};function r10($,Z,J,H,{mark:B=!0}){let Q=null;if(H)Q="inert";else if(J)Q="aria-hidden";let X=null,z=null,G=HE(Z,$),U=B?QE(Z,BE(G),new Set(G)):[],Y=[],F=[];if(Q){let K=$D[Q],W=i10(Q);z=W,X=K;let N=HE(Z,Array.from(Z.querySelectorAll("[aria-live]"))),q=G.concat(N);QE(Z,BE(q),new Set(q)).forEach((A)=>{let V=A.getAttribute(Q),L=V!==null&&V!=="false",O=(K.get(A)||0)+1;if(K.set(A,O),Y.push(A),O===1&&L)W.add(A);if(!L)A.setAttribute(Q,Q==="inert"?"":"true")})}if(B)U.forEach((K)=>{let W=(pB.get(K)||0)+1;if(pB.set(K,W),F.push(K),W===1)K.setAttribute(JE,"")});return ZD+=1,()=>{if(X)Y.forEach((K)=>{let N=(X.get(K)||0)-1;if(X.set(K,N),!N){if(!z?.has(K)&&Q)K.removeAttribute(Q);z?.delete(K)}});if(B)F.forEach((K)=>{let W=(pB.get(K)||0)-1;if(pB.set(K,W),!W)K.removeAttribute(JE)});if(ZD-=1,!ZD)$D.inert=new WeakMap,$D["aria-hidden"]=new WeakMap,JD.inert=new WeakSet,JD["aria-hidden"]=new WeakSet,pB=new WeakMap}}function HD($,Z={}){let{ariaHidden:J=!1,inert:H=!1,mark:B=!0}=Z,Q=m0($[0]).body;return r10($,Q,J,H,{mark:B})}var w6=P(m(),1);function hG(){let $=new Map;return{emit(Z,J){$.get(Z)?.forEach((H)=>H(J))},on(Z,J){if(!$.has(Z))$.set(Z,new Set);$.get(Z).add(J)},off(Z,J){$.get(Z)?.delete(J)}}}class V${nodesRef={current:[]};events=hG();addNode($){this.nodesRef.current.push($)}removeNode($){let Z=this.nodesRef.current.findIndex((J)=>J===$);if(Z!==-1)this.nodesRef.current.splice(Z,1)}}var BD=P(u(),1),zE=w6.createContext(null),GE=w6.createContext(null),x4=()=>w6.useContext(zE)?.id||null,G4=($)=>{let Z=w6.useContext(GE);return $??Z};function p3($){let Z=k4(),J=G4($),H=x4();return H0(()=>{if(!Z)return;let B={id:Z,parentId:H};return J?.addNode(B),()=>{J?.removeNode(B)}},[J,Z,H]),Z}function L$($){let{children:Z,id:J}=$,H=x4();return BD.jsx(zE.Provider,{value:w6.useMemo(()=>({id:J,parentId:H}),[J,H]),children:Z})}function M$($){let{children:Z,externalTree:J}=$,H=H5(()=>J??new V$).current;return BD.jsx(GE.Provider,{value:H,children:Z})}var cB=P(u(),1);function a10($,Z){let J=k1(V1($));if($ instanceof J.KeyboardEvent)return"keyboard";if($ instanceof J.FocusEvent)return Z||"keyboard";if("pointerType"in $)return $.pointerType||"keyboard";if("touches"in $)return"touch";if($ instanceof J.MouseEvent)return Z||($.detail===0?"keyboard":"mouse");return""}var UE=20,S6=[];function QD(){S6=S6.filter(($)=>{return $.deref()?.isConnected})}function YE($){if(QD(),$&&R2($)!=="body"){if(S6.push(new WeakRef($)),S6.length>UE)S6=S6.slice(-UE)}}function FE(){return QD(),S6[S6.length-1]?.deref()}function o10($){if(!$)return null;if(WG($))return $;return nZ($)[0]||$}function KE($){if($.hasAttribute("tabindex")&&!$.hasAttribute("data-tabindex"))return;if(!$.getAttribute("role")?.includes("dialog"))return;let J=pA($).filter((B)=>{let Q=B.getAttribute("data-tabindex")||"";return WG(B)||B.hasAttribute("data-tabindex")&&!Q.startsWith("-")}),H=$.getAttribute("tabindex");if(J.length===0){if(H!=="0")$.setAttribute("tabindex","0"),$.setAttribute("data-tabindex","0")}else if(H!=="-1"||$.hasAttribute("data-tabindex")&&$.getAttribute("data-tabindex")!=="-1")$.setAttribute("tabindex","-1"),$.setAttribute("data-tabindex","-1")}function P$($){let{context:Z,children:J,disabled:H=!1,initialFocus:B=!0,returnFocus:Q=!0,restoreFocus:X=!1,modal:z=!0,closeOnFocusOut:G=!0,openInteractionType:U="",nextFocusableElement:Y,previousFocusableElement:F,beforeContentFocusGuardRef:K,externalTree:W,getInsideElements:N}=$,q="rootStore"in Z?Z.rootStore:Z,D=q.useState("open"),A=q.useState("domReferenceElement"),V=q.useState("floatingElement"),{events:L,dataRef:O}=q.context,M=Y0(()=>O.current.floatingContext?.nodeId),_=B===!1,w=hB(A)&&_,C=N5(B),E=N5(Q),T=N5(U),k=N5(D),S=G4(W),I=nA(),j=U4.useRef(!1),y=U4.useRef(!1),R=U4.useRef(!1),x=U4.useRef(null),v=U4.useRef(""),f=U4.useRef(""),b=U4.useRef(null),l=U4.useRef(null),r=l2(b,K,I?.beforeInsideRef),h=l2(l,I?.afterInsideRef),d=s1(),o=s1(),c=I4(),i=I!=null,n=vB(V),Z0=Y0((z0=n)=>{return z0?nZ(z0):[]}),J0=Y0(()=>N?.().filter((z0)=>z0!=null)??[]);U4.useEffect(()=>{if(H||!z)return;function z0(N0){if(N0.key==="Tab"){if(R0(n,a1(m0(n)))&&Z0().length===0&&!w)o4(N0)}}let X0=m0(n);return o0(X0,"keydown",z0)},[H,n,z,w,Z0]),U4.useEffect(()=>{if(H||!D)return;let z0=m0(n);function X0(){R.current=!1}function N0(K0){let s=V1(K0),a=J0(),$0=R0(V,s)||R0(A,s)||R0(I?.portalNode,s)||a.some((t)=>t===s||R0(t,s));if(R.current=!$0,f.current=K0.pointerType||"keyboard",s?.closest(`[${tZ}]`))y.current=!0,o.start(0,()=>{y.current=!1})}function q0(){f.current="keyboard"}return S2(o0(z0,"pointerdown",N0,!0),o0(z0,"pointerup",X0,!0),o0(z0,"pointercancel",X0,!0),o0(z0,"keydown",q0,!0),X0)},[H,V,A,n,D,I,o,J0]),U4.useEffect(()=>{if(H||!G)return;let z0=m0(n);function X0(){y.current=!0,o.start(0,()=>{y.current=!1})}function N0(a){let $0=V1(a);if(WG($0))x.current=$0}function q0(a){let{relatedTarget:$0,currentTarget:t}=a,B0=V1(a);if(z&&$0==null&&B0!=null&&R0(V,B0))YE(B0);queueMicrotask(()=>{let _0=M(),P0=q.context.triggerElements,A0=J0(),M0=$0?.hasAttribute(u3("focus-guard"))&&[b.current,l.current,I?.beforeInsideRef.current,I?.afterInsideRef.current,I?.beforeOutsideRef.current,I?.afterOutsideRef.current,Y9(F),Y9(Y)].includes($0),g=!(R0(A,$0)||R0(V,$0)||R0($0,V)||R0(I?.portalNode,$0)||A0.some((p)=>p===$0||R0(p,$0))||P0.hasMatchingElement((p)=>R0(p,$0))||M0||S&&(R8(S.nodesRef.current,_0).find((p)=>R0(p.context?.elements.floating,$0)||R0(p.context?.elements.domReference,$0))||gA(S.nodesRef.current,_0).find((p)=>[p.context?.elements.floating,vB(p.context?.elements.floating)].includes($0)||p.context?.elements.domReference===$0)));if(t===A&&n)KE(n);if(X&&t!==A&&!q$(B0)&&a1(z0)===z0.body){if(L1(n)){if(n.focus(),X==="popup"){c.request(()=>{n.focus()});return}}let p=Z0(),e=x.current,W0=(e&&p.includes(e)?e:null)||p[p.length-1]||n;if(L1(W0))W0.focus()}if(O.current.insideReactTree){O.current.insideReactTree=!1;return}if((w?!0:!z)&&$0&&g&&!y.current&&(w||$0!==FE()))j.current=!0,q.setOpen(!1,w0(F0.focusOut,a))})}function K0(){if(R.current)return;O.current.insideReactTree=!0,d.start(0,()=>{O.current.insideReactTree=!1})}let s=L1(A)?A:null;if(!V&&!s)return;return S2(s&&o0(s,"focusout",q0),s&&o0(s,"pointerdown",X0),V&&o0(V,"focusin",N0),V&&o0(V,"focusout",q0),V&&I&&o0(V,"focusout",K0,!0))},[H,A,V,n,z,S,I,q,G,X,Z0,w,M,O,d,o,c,Y,F,J0]),U4.useEffect(()=>{if(H||!V||!D)return;let z0=Array.from(I?.portalNode?.querySelectorAll(`[${u3("portal")}]`)||[]),N0=(S?gA(S.nodesRef.current,M()):[]).find((t)=>hB(t.context?.elements.domReference||null))?.context?.elements.domReference,K0=[...[V,...z0,b.current,l.current,I?.beforeOutsideRef.current,I?.afterOutsideRef.current,...J0()],N0,Y9(F),Y9(Y),w?A:null].filter((t)=>t!=null),s=HD(K0,{ariaHidden:z||w,mark:!1}),a=[V,...z0].filter((t)=>t!=null),$0=HD(a);return()=>{$0(),s()}},[D,H,A,V,z,I,w,S,M,Y,F,J0]),H0(()=>{if(!D||H||!L1(n))return;v.current="",f.current="";let z0=m0(n),X0=a1(z0);queueMicrotask(()=>{let N0=C.current,q0=typeof N0==="function"?N0(T.current||""):N0;if(q0===void 0||q0===!1)return;if(R0(n,X0))return;let s=null,a=()=>{if(s==null)s=Z0(n);return s[0]||n},$0;if(q0===!0||q0===null)$0=a();else $0=Y9(q0);$0=$0||a();let t=R0(n,a1(z0));$J($0,{preventScroll:$0===n,shouldFocus(){if(!k.current)return!1;if(t)return!0;let B0=a1(z0);return!(B0!==$0&&R0(n,B0))}})})},[H,D,n,Z0,C,T,k]),H0(()=>{if(H||!n)return;let z0=m0(n),X0=a1(z0),N0=T.current==null;YE(X0);function q0(s){if(!s.open)v.current=a10(s.nativeEvent,f.current);if(s.reason===F0.triggerHover&&s.nativeEvent.type==="mouseleave")j.current=!0;if(s.reason!==F0.outsidePress)return;if(s.nested)j.current=!1;else if(rZ(s.nativeEvent)||aZ(s.nativeEvent))j.current=!1;else{let a=!1;if(m0(n).createElement("div").focus({get preventScroll(){return a=!0,!1}}),a)j.current=!1;else j.current=!0}}L.on("openchange",q0);function K0(s){let a=E.current,$0=typeof a==="function"?a(s):a;if($0===void 0||$0===!1)return null;if($0===null)$0=!0;let t=A?.isConnected?A:null,B0=X0?.isConnected&&R2(X0)!=="body"?X0:null,_0=N0?B0||t:t||B0;if(!_0)_0=FE()||null;if(typeof $0==="boolean")return _0;return Y9($0)||_0||null}return()=>{L.off("openchange",q0);let s=a1(z0),a=J0(),$0=R0(V,s)||a.some((P0)=>P0===s||R0(P0,s))||S&&R8(S.nodesRef.current,M(),!1).some((P0)=>R0(P0.context?.elements.floating,s)),t=E.current,B0=v.current,_0=K0(B0);queueMicrotask(()=>{let P0=o10(_0),A0=typeof t!=="boolean";if(t&&!j.current&&L1(P0)&&(!A0&&P0!==s&&s!==z0.body?$0:!0)){let M0={preventScroll:!0};if(B0==="keyboard")M0.focusVisible=!0;P0.focus(M0)}j.current=!1})}},[H,V,n,E,T,L,S,A,M,J0]),H0(()=>{if(!B5.engine.webkit||D||!V)return;let z0=a1(m0(V));if(!L1(z0)||!K$(z0))return;if(R0(V,z0))z0.blur()},[D,V]),H0(()=>{if(H||!I)return;return I.setFocusManagerState({modal:z,closeOnFocusOut:G,open:D,onOpenChange:q.setOpen,domReference:A}),()=>{I.setFocusManagerState(null)}},[H,I,z,D,q,G,A]),H0(()=>{if(H||!n)return;return KE(n),()=>{queueMicrotask(QD)}},[H,n]);let U0=!H&&(z?!w:!0)&&(i||z);return cB.jsxs(U4.Fragment,{children:[U0&&cB.jsx(s4,{"data-type":"inside",ref:r,onFocus:(z0)=>{if(z){let X0=Z0();$J(X0[X0.length-1])}else if(I?.portalNode)if(j.current=!1,g3(z0,I.portalNode))sZ(A)?.focus();else Y9(F??I.beforeOutsideRef)?.focus()}}),J,U0&&cB.jsx(s4,{"data-type":"inside",ref:h,onFocus:(z0)=>{if(z)$J(Z0()[0]);else if(I?.portalNode){if(G)j.current=!0;if(g3(z0,I.portalNode))NG(A)?.focus();else Y9(Y??I.afterOutsideRef)?.focus()}}})]})}var dB=P(m(),1);function c3($,Z={}){let{enabled:J=!0,event:H="click",toggle:B=!0,ignoreMouse:Q=!1,stickIfOpen:X=!0,touchOpenDelay:z=0,reason:G=F0.triggerPress}=Z,U="rootStore"in $?$.rootStore:$,Y=U.context.dataRef,F=dB.useRef(void 0),K=I4(),W=s1(),N=dB.useMemo(()=>{function q(A,V,L,O){let M=w0(G,V,L);if(A&&O==="touch"&&z>0)W.start(z,()=>{U.setOpen(!0,M)});else U.setOpen(A,M)}function D(A,V,L){let O=Y.current.openEvent,M=U.select("domReferenceElement")!==V;if(A&&M)return!0;if(!A)return!0;if(!B)return!0;if(O&&X)return!L(O.type);return!1}return{onPointerDown(A){F.current=q8(A.pointerType,!0)&&aZ(A.nativeEvent)?"virtual":A.pointerType},onMouseDown(A){let V=F.current,L=A.nativeEvent,O=U.select("open");if(A.button!==0||H==="click"||q8(V,!0)&&Q)return;let M=D(O,A.currentTarget,(C)=>C==="click"||C==="mousedown"),_=V1(L);if(K$(_)){q(M,L,_,V);return}let w=A.currentTarget;K.request(()=>{q(M,L,w,V)})},onClick(A){if(H==="mousedown-only")return;let V=F.current;if(H==="mousedown"&&V){F.current=void 0;return}if(q8(V,!0)&&Q)return;let L=U.select("open"),O=D(L,A.currentTarget,(M)=>M==="click"||M==="mousedown"||M==="keydown"||M==="keyup");q(O,A.nativeEvent,A.currentTarget,V)},onKeyDown(){F.current=void 0}}},[Y,H,Q,G,U,X,B,K,W,z]);return dB.useMemo(()=>J?{reference:N}:D1,[J,N])}var e4=P(m(),1);function n10($,Z){let J=null,H=null,B=!1;return{contextElement:$||void 0,getBoundingClientRect(){let Q=$?.getBoundingClientRect()||{width:0,height:0,x:0,y:0},X=Z.axis==="x"||Z.axis==="both",z=Z.axis==="y"||Z.axis==="both",G=["mouseenter","mousemove"].includes(Z.dataRef.current.openEvent?.type||"")&&Z.pointerType!=="touch",U=Q.width,Y=Q.height,F=Q.x,K=Q.y;if(J==null&&Z.x&&X)J=Q.x-Z.x;if(H==null&&Z.y&&z)H=Q.y-Z.y;if(F-=J||0,K-=H||0,U=0,Y=0,!B||G)U=Z.axis==="y"?Q.width:0,Y=Z.axis==="x"?Q.height:0,F=X&&Z.x!=null?Z.x:F,K=z&&Z.y!=null?Z.y:K;else if(B&&!G)Y=Z.axis==="x"?Q.height:Y,U=Z.axis==="y"?Q.width:U;return B=!0,{width:U,height:Y,x:F,y:K,top:K,right:F+U,bottom:K+Y,left:F}}}}function WE($){return $!=null&&$.clientX!=null}function XD($,Z={}){let{enabled:J=!0,axis:H="both"}=Z,B="rootStore"in $?$.rootStore:$,Q=B.useState("open"),X=B.useState("floatingElement"),z=B.useState("domReferenceElement"),G=B.context.dataRef,U=e4.useRef(!1),Y=e4.useRef(null),[F,K]=e4.useState(),[W,N]=e4.useState([]),q=Y0((O)=>{B.set("positionReference",O)}),D=Y0((O,M,_)=>{if(U.current)return;if(G.current.openEvent&&!WE(G.current.openEvent))return;B.set("positionReference",n10(_??z,{x:O,y:M,axis:H,dataRef:G,pointerType:F}))}),A=Y0((O)=>{if(!Q)D(O.clientX,O.clientY,O.currentTarget);else if(!Y.current)D(O.clientX,O.clientY,O.currentTarget),N([])}),V=q8(F)?X:Q;e4.useEffect(()=>{if(!J){q(z);return}if(!V)return;function O(){Y.current?.(),Y.current=null}let M=k1(X);function _(w){let C=V1(w);if(!R0(X,C))D(w.clientX,w.clientY);else O()}if(!G.current.openEvent||WE(G.current.openEvent))Y.current=o0(M,"mousemove",_);else q(z);return O},[V,J,X,G,z,B,D,q,W]),e4.useEffect(()=>()=>{B.set("positionReference",null)},[B]),e4.useEffect(()=>{if(J&&!X)U.current=!1},[J,X]),e4.useEffect(()=>{if(!J&&Q)U.current=!0},[J,Q]);let L=e4.useMemo(()=>{function O(M){K(M.pointerType)}return{onPointerDown:O,onPointerEnter:O,onMouseMove:A,onMouseEnter:A}},[A]);return e4.useMemo(()=>J?{reference:L,trigger:L}:{},[J,L])}var h4=P(m(),1);function s10(){return!1}function t10($){return{escapeKey:typeof $==="boolean"?$:$?.escapeKey??!1,outsidePress:typeof $==="boolean"?$:$?.outsidePress??!0}}function K9($,Z={}){let{enabled:J=!0,escapeKey:H=!0,outsidePress:B=!0,outsidePressEvent:Q="sloppy",referencePress:X=s10,bubbles:z,externalTree:G}=Z,U="rootStore"in $?$.rootStore:$,Y=U.useState("open"),F=U.useState("floatingElement"),{dataRef:K,events:W}=U.context,N=G4(G),q=Y0(typeof B==="function"?B:()=>!1),D=typeof B==="function"?q:B,A=D!==!1,V=Y0(()=>Q),{escapeKey:L,outsidePress:O}=t10(z),M=h4.useRef(!1),_=h4.useRef(!1),w=h4.useRef(!1),C=h4.useRef(!1),E=h4.useRef(!1),T=h4.useRef(""),k=h4.useRef(null),S=s1(),I=s1(),j=Y0(()=>{I.clear(),K.current.insideReactTree=!1}),y=Y0((d)=>{let o=K.current.floatingContext?.nodeId;return(N?R8(N.nodesRef.current,o):[]).some((i)=>i.context?.open&&!i.context.dataRef.current[d])}),R=Y0((d)=>{return GG(d,U.select("floatingElement"))||GG(d,U.select("domReferenceElement"))}),x=Y0((d)=>{if(!X())return;U.setOpen(!1,w0(F0.triggerPress,d.nativeEvent))}),v=Y0((d)=>{if(!Y||!J||!H||d.key!=="Escape")return;if(E.current)return;if(!L&&y("__escapeKeyBubbles"))return;let o=lj(d)?d.nativeEvent:d,c=w0(F0.escapeKey,o);if(U.setOpen(!1,c),!c.isCanceled)d.preventDefault();if(!L&&!c.isPropagationAllowed)d.stopPropagation()}),f=Y0(()=>{K.current.insideReactTree=!0,I.start(0,j)}),b=Y0((d)=>{if(!Y||!J||d.button!==0)return;let o=V1(d.nativeEvent);if(!R0(U.select("floatingElement"),o))return;if(!M.current)M.current=!0,_.current=!1}),l=Y0((d)=>{if(!Y||!J)return;if(!(d.defaultPrevented||d.nativeEvent.defaultPrevented))return;if(M.current)_.current=!0});h4.useEffect(()=>{function d(o){if(!o.open)C.current=!1}return W.on("openchange",d),()=>{W.off("openchange",d)}},[W]),h4.useEffect(()=>{if(!Y||!J){if(!Y)C.current=!1;return j}K.current.__escapeKeyBubbles=L,K.current.__outsidePressBubbles=O;let d=new n5,o=new n5,c=m0(F);function i(){d.clear(),E.current=!0}function n(){d.start(B5.engine.webkit?5:0,()=>{E.current=!1})}function Z0(){w.current=!0,o.start(0,()=>{w.current=!1})}function J0(){M.current=!1,_.current=!1}function U0(){let g=T.current,p=g==="pen"||!g?"mouse":g,e=V(),W0=typeof e==="function"?e():e;if(typeof W0==="string")return W0;return W0[p]}function z0(g){let p=U0();return p==="intentional"&&g.type!=="click"||p==="sloppy"&&g.type==="click"}function X0(g){let p=K.current.floatingContext?.nodeId,e=N&&R8(N.nodesRef.current,p).some((W0)=>GG(g,W0.context?.elements.floating));return R(g)||e}function N0(g){if(z0(g)){if(g.type!=="click"&&!R(g))o.clear(),w.current=!1;j();return}if(K.current.insideReactTree){j();return}let p=V1(g),e=`[${u3("inert")}]`,W0=s0(p)?p.getRootNode():null,S0=Array.from((O6(W0)?W0:m0(U.select("floatingElement"))).querySelectorAll(e)),h0=U.context.triggerElements;if(p&&(h0.hasElement(p)||h0.hasMatchingElement((j0)=>R0(j0,p))))return;let v0=s0(p)?p:null;while(v0&&!h8(v0)){let j0=v8(v0);if(h8(j0)||!s0(j0))break;v0=j0}if(S0.length&&s0(p)&&!dj(p)&&!R0(p,U.select("floatingElement"))&&S0.every((j0)=>!R0(v0,j0)))return;if(L1(p)&&!("touches"in g)){let j0=h8(p),c0=d2(p),z1=/auto|scroll/,A1=j0||z1.test(c0.overflowX),l0=j0||z1.test(c0.overflowY),k0=A1&&p.clientWidth>0&&p.scrollWidth>p.clientWidth,R1=l0&&p.clientHeight>0&&p.scrollHeight>p.clientHeight,Y1=c0.direction==="rtl",U5=R1&&(Y1?g.offsetX<=p.offsetWidth-p.clientWidth:g.offsetX>p.clientWidth),C0=k0&&g.offsetY>p.clientHeight;if(U5||C0)return}if(X0(g))return;if(U0()==="intentional"){if(g.detail!==0&&!rZ(g)&&!C.current)return;if(w.current){o.clear(),w.current=!1;return}}if(typeof D==="function"&&!D(g))return;if(y("__outsidePressBubbles"))return;U.setOpen(!1,w0(F0.outsidePress,g)),j()}function q0(g){if(U0()!=="sloppy"||g.pointerType==="touch"||!U.select("open")||!J||R(g))return;N0(g)}function K0(g){if(U0()!=="sloppy"||!U.select("open")||!J||R(g))return;let p=g.touches[0];if(p)k.current={startTime:Date.now(),startX:p.clientX,startY:p.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},S.start(1000,()=>{if(k.current)k.current.dismissOnTouchEnd=!1,k.current.dismissOnMouseDown=!1})}function s(g,p){let e=V1(g);if(!e)return;let W0=o0(e,g.type,()=>{p(g),W0()})}function a(g){T.current="touch",s(g,K0)}function $0(g){if(S.clear(),g.type==="pointerdown"){if(g.button===0)C.current=!0;T.current=g.pointerType}if(g.type==="mousedown"&&k.current&&!k.current.dismissOnMouseDown)return;s(g,(p)=>{if(p.type==="pointerdown")q0(p);else N0(p)})}function t(g){if(g.type==="pointercancel")C.current=!1;if(!M.current)return;let p=_.current;if(J0(),U0()!=="intentional")return;if(g.type==="pointercancel"){if(p)Z0();return}if(X0(g))return;if(p){Z0();return}if(typeof D==="function"&&!D(g))return;o.clear(),w.current=!0,j()}function B0(g){if(U0()!=="sloppy"||!k.current||R(g))return;let p=g.touches[0];if(!p)return;let e=Math.abs(p.clientX-k.current.startX),W0=Math.abs(p.clientY-k.current.startY),S0=Math.sqrt(e*e+W0*W0);if(S0>5)k.current.dismissOnTouchEnd=!0;if(S0>10)N0(g),S.clear(),k.current=null}function _0(g){s(g,B0)}function P0(g){if(U0()!=="sloppy"||!k.current||R(g))return;if(k.current.dismissOnTouchEnd)N0(g);S.clear(),k.current=null}function A0(g){s(g,P0)}let M0=S2(H&&S2(o0(c,"keydown",v),o0(c,"compositionstart",i),o0(c,"compositionend",n)),A&&S2(o0(c,"click",$0,!0),o0(c,"pointerdown",$0,!0),o0(c,"pointerup",t,!0),o0(c,"pointercancel",t,!0),o0(c,"mousedown",$0,!0),o0(c,"mouseup",t,!0),o0(c,"touchstart",a,{capture:!0,passive:!0}),o0(c,"touchmove",_0,{capture:!0,passive:!0}),o0(c,"touchend",A0,{capture:!0,passive:!0})));return()=>{M0(),d.clear(),o.clear(),J0(),w.current=!1,j()}},[K,F,H,A,D,Y,J,L,O,v,j,V,y,R,N,U,S]);let r=h4.useMemo(()=>({onKeyDown:v,onPointerDown:x,onClick:x}),[v,x]),h=h4.useMemo(()=>({onKeyDown:v,onPointerDown:l,onMouseDown:l,onClickCapture:f,onMouseDownCapture(d){f(),b(d)},onPointerDownCapture(d){f(),b(d)},onMouseUpCapture:f,onTouchEndCapture:f,onTouchMoveCapture:f}),[v,f,b,l]);return h4.useMemo(()=>J?{reference:r,floating:h,trigger:r}:{},[J,r,h])}function vG($,Z,J,H){return{left:$,top:Z,right:J,bottom:H,x:$,y:Z,width:J-$,height:H-Z}}function e10($){return{left:$.left,top:$.top,right:$.right,bottom:$.bottom,width:$.width,height:$.height}}function qE($){let Z=[],J,H=Number.POSITIVE_INFINITY,B=Number.POSITIVE_INFINITY,Q=Number.NEGATIVE_INFINITY,X=Number.NEGATIVE_INFINITY;for(let z of Array.from($).sort((G,U)=>G.top-U.top)){if(H=Math.min(H,z.left),B=Math.min(B,z.top),Q=Math.max(Q,z.right),X=Math.max(X,z.bottom),!J||z.top-J.top>J.height/2)Z.push(e10(z));else{let G=Z[Z.length-1];G.left=Math.min(G.left,z.left),G.right=Math.max(G.right,z.right),G.bottom=Math.max(G.bottom,z.bottom),G.width=G.right-G.left,G.height=G.bottom-G.top}J=z}return{lines:Z,fallback:vG(H,B,Q,X)}}function AE($,Z,J){return $.findIndex((H)=>Z>H.left-2&&Z<H.right+2&&J>H.top-2&&J<H.bottom+2)}function NE($){return vG($.left,$.top,$.right,$.bottom)}function $50($,Z,J){let{lines:H}=qE($.getClientRects());if(H.length<2)return;let B=AE(H,Z,J);return{x:Z,y:J,lineIndex:B===-1?void 0:B,element:$}}function Z50($,Z,J){let{lines:H,fallback:B}=qE($.getClientRects());if(H.length<2)return null;let Q=J?.x,X=J?.y,z=Z[0];if(J?.lineIndex!=null&&H[J.lineIndex])return NE(H[J.lineIndex]);if(Q!=null&&X!=null){let N=AE(H,Q,X);if(N!==-1)return NE(H[N])}if(H.length===2&&H[0].left>H[1].right&&Q!=null&&X!=null)return B;if(z==="t"||z==="b"){let N=H[0],q=H[H.length-1],D=z==="t"?N:q;return vG(D.left,N.top,D.right,q.bottom)}let G=z==="l",U=H[0].left,Y=H[0].right,F=G?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY,K=H[0],W=H[0];for(let N of H){U=Math.min(U,N.left),Y=Math.max(Y,N.right);let q=G?N.left:N.right;if(G&&q<F||!G&&q>F)F=q,K=N,W=N;else if(q===F)W=N}return vG(U,K.top,Y,W.bottom)}function J50($){if("contextElement"in $&&$.contextElement)return $.contextElement;return s0($)?$:void 0}function DE($,Z){function J(B){zD($,B.currentTarget,B.clientX,B.clientY)}function H(B){if(!Z)J(B)}return{onFocus(){$.current=void 0},onMouseEnter:H,onMouseMove:H}}function zD($,Z,J,H){let B=$50(Z,J,H);return $.current=B,B}function VE($){return{name:"inline",async fn(Z){let J=Z.elements.reference;if(typeof J?.getClientRects!=="function")return{};let H=J50(J),B=$.current,Q=B?.element===J||B?.element===H?B:void 0,X=Z50(J,Z.placement,Q);if(!X||typeof Z.platform.getElementRects!=="function")return{};let z=await Z.platform.getElementRects({reference:{contextElement:H,getBoundingClientRect(){return X}},floating:Z.elements.floating,strategy:Z.strategy});if(Z.rects.reference.x===z.reference.x&&Z.rects.reference.y===z.reference.y&&Z.rects.reference.width===z.reference.width&&Z.rects.reference.height===z.reference.height)return{};return{reset:{rects:z}}}}}class W9{attachedStores=[];attachedStoreValue=null;storeListeners=new Set;constructor($,Z,J=!0){this.fallbackStore=$,this.componentName=Z,this.throwOnMissingTrigger=J}get attachedStore(){return this.attachedStoreValue}get store(){return this.attachedStoreValue??this.fallbackStore}get serverStore(){return this.fallbackStore}subscribeStore($){return this.storeListeners.add($),()=>{this.storeListeners.delete($)}}attachStore($){return this.attachedStores.push($),this.setActiveStore($),()=>{let Z=this.attachedStores.lastIndexOf($);if(Z!==-1)this.attachedStores.splice(Z,1);this.setActiveStore(this.attachedStores[this.attachedStores.length-1]??null)}}setActiveStore($){if(this.attachedStoreValue!==$)this.attachedStoreValue=$,this.storeListeners.forEach((Z)=>{Z()})}openByTrigger($){let Z=this.attachedStore;if(Z===null)return;let J;if($){for(let H=this.attachedStores.length-1;H>=0&&!J;H-=1)J=this.attachedStores[H].context.triggerElements.getById($);J??=this.fallbackStore.context.triggerElements.getById($)}if($&&!J){if(this.throwOnMissingTrigger)throw Error(I0(99,this.componentName,$,this.componentName))}Z.setOpen(!0,w0(F0.imperativeAction,void 0,J))}closePopup(){let $=this.attachedStore;if($===null)return;$.setOpen(!1,w0(F0.imperativeAction))}}var UD=P(m(),1),PE=P(A8(),1);var LE=P(m(),1);var H50={open:($)=>$.open,transitionStatus:($)=>$.transitionStatus,domReferenceElement:($)=>$.domReferenceElement,referenceElement:($)=>$.positionReference??$.referenceElement,floatingElement:($)=>$.floatingElement,floatingId:($)=>$.floatingId};class _$ extends p2{constructor($){let{syncOnly:Z,nested:J,onOpenChange:H,triggerElements:B,...Q}=$;super({...Q,positionReference:Q.referenceElement,domReferenceElement:Q.referenceElement},{onOpenChange:H,dataRef:{current:{}},events:hG(),nested:J,triggerElements:B},H50);this.syncOnly=Z}syncOpenEvent=($,Z)=>{if(!$||!this.state.open||Z!=null&&ij(Z))this.context.dataRef.current.openEvent=$?Z:void 0};dispatchOpenChange=($,Z)=>{this.syncOpenEvent($,Z.event);let J={open:$,reason:Z.reason,nativeEvent:Z.event,nested:this.context.nested,triggerElement:Z.trigger};this.context.events.emit("openchange",J)};setOpen=($,Z)=>{if(this.syncOnly){this.context.onOpenChange?.($,Z);return}this.dispatchOpenChange($,Z),this.context.onOpenChange?.($,Z)}}function lB($){let{popupStore:Z,treatPopupAsFloatingElement:J=!1,floatingRootContext:H,floatingId:B,nested:Q,onOpenChange:X}=$,z=Z.useState("open"),G=Z.useState("activeTriggerElement"),U=Z.useState(J?"popupElement":"positionerElement"),Y=Z.context.triggerElements,F=X,K=LE.useRef(null);if(H===void 0&&K.current===null)K.current=new _$({open:z,transitionStatus:void 0,referenceElement:G,floatingElement:U,triggerElements:Y,onOpenChange:F,floatingId:B,syncOnly:!0,nested:Q});let W=H??K.current;return Z.useSyncedValue("floatingId",B),H0(()=>{let N={open:z,floatingId:B,referenceElement:G,floatingElement:U};if(s0(G))N.domReferenceElement=G;if(W.state.positionReference===W.state.referenceElement)N.positionReference=G;W.update(N)},[z,B,G,U,W]),W.context.onOpenChange=F,W.context.nested=Q,W}var GD=P(m(),1);function k2($,Z=!1,J=!1,H=!1){let[B,Q]=GD.useState($&&Z?"idle":void 0),[X,z]=GD.useState($&&!H);if($&&!X)z(!0),Q("starting");if(!$&&X&&B!=="ending"&&!J)Q("ending");if(!$&&!X&&B==="ending")Q(void 0);return H0(()=>{if(!$&&X&&B!=="ending"&&J){let G=c2.request(()=>{Q("ending")});return()=>{c2.cancel(G)}}return},[$,X,B,J]),H0(()=>{if(!$||Z)return;let G=c2.request(()=>{Q(void 0)});return()=>{c2.cancel(G)}},[Z,$]),H0(()=>{if(!$||!Z)return;if($&&X&&B!=="idle")Q("starting");let G=c2.request(()=>{Q("idle")});return()=>{c2.cancel(G)}},[Z,$,X,B]),{mounted:X,setMounted:z,transitionStatus:B}}var r9={tabIndex:-1,[SB]:""};function fG($){return(Z)=>Z==="touch"?$.current:!0}function R6($,Z=!1){let J=k4(),H=x4()!=null,B=H5(()=>$(J,H)).current;return lB({popupStore:B,treatPopupAsFloatingElement:Z,floatingRootContext:B.state.floatingRootContext,floatingId:J,nested:H,onOpenChange:B.setOpen}),B}function a9({handle:$,store:Z}){return H0(()=>{return $.attachStore(Z)},[$,Z]),null}function ME($){let Z=$.context.triggerElements.size;if($.select("open")&&$.state.triggerCount!==Z)$.set("triggerCount",Z)}function YD($,Z){let J=UD.useRef(null);return Y0((H)=>{let B=J.current;if(B!==null){if(B.element===H&&B.store===Z&&B.id===$)return;J.current=null;let Q=B.store;if(Q.context.triggerElements.getById(B.id)===B.element)Q.context.triggerElements.delete(B.id),ME(Q)}if(H!==null&&$!==void 0)J.current={store:Z,id:$,element:H},Z.context.triggerElements.add($,H),ME(Z)})}function O$($,Z,J,H=!1){let B=$.preventUnmountingOnClose;if(Z)B=!1;else if(H)B=!0;let Q=J?.id??null,X=$.activeTriggerId,z=$.activeTriggerElement;if(Q||Z)X=Q,z=J??null;return{open:Z,preventUnmountingOnClose:B,activeTriggerId:X,activeTriggerElement:z}}function iB($){let Z=!1;return $.preventUnmountOnClose=()=>{Z=!0},()=>Z}function gG($,Z,J,H={}){let B=J.reason,Q=B===F0.triggerHover,X=Z&&B===F0.triggerFocus,z=!Z&&(B===F0.triggerPress||B===F0.escapeKey),G=iB(J);if($.context.onOpenChange?.(Z,J),J.isCanceled)return;H.onBeforeDispatch?.(),$.state.floatingRootContext.dispatchOpenChange(Z,J);let U=()=>{let Y=O$($.state,Z,J.trigger,G()),F={...H.extraState,...Y};if(X)F.instantType="focus";else if(z)F.instantType="dismiss";else if(Q)F.instantType=void 0;$.update(F)};if(Q)PE.flushSync(U);else U()}function o9($,Z,J,H){let B=J.useState("isMountedByTrigger",$),Q=YD($,J),X=Y0((G)=>{let U=J.select("open"),Y=J.select("activeTriggerId");if(Y===$){let F={activeTriggerElement:G,...U?H:null};J.update(F);return}if(Y==null&&U){let F={activeTriggerId:$??null,activeTriggerElement:G,...H};J.update(F)}}),z=Y0((G)=>{if(Q(G),G)X(G)});return H0(()=>{return z(Z.current),()=>z(null)},[z,Z,J,$]),H0(()=>{if(B){let G={activeTriggerElement:Z.current,...H};J.update(G)}},[B,J,Z,...Object.values(H)]),{registerTrigger:z,isMountedByThisTrigger:B}}function n9($,Z={}){let{closeOnActiveTriggerUnmount:J=!1}=Z,H=UD.useRef(null),B=$.useState("open"),Q=$.useState("triggerCount"),X=$.useState("activeTriggerId"),z=$.useState("activeTriggerElement");H0(()=>{if(!B){if(H.current=null,$.state.triggerCount!==0)$.set("triggerCount",0);return}let G=$.context.triggerElements.size,U={};if($.state.triggerCount!==G)U.triggerCount=G;let Y=$.select("activeTriggerId"),F=null;if(Y){let K=$.context.triggerElements.getById(Y);if(!K){for(let[W,N]of $.context.triggerElements.entries())if(N===$.state.activeTriggerElement){U.activeTriggerId=W,U.activeTriggerElement=N,H.current=W;break}if(U.activeTriggerId===void 0)if(H.current===Y)F=Y;else H.current=null}else if(H.current=Y,K!==$.state.activeTriggerElement)U.activeTriggerElement=K}else H.current=null;if(!F&&!Y&&G===1){let K=$.context.triggerElements.entries().next();if(!K.done){let[W,N]=K.value;U.activeTriggerId=W,U.activeTriggerElement=N,H.current=W}}if(U.triggerCount!==void 0||U.activeTriggerId!==void 0||U.activeTriggerElement!==void 0)$.update(U);if(F){if(J)queueMicrotask(()=>{if($.select("open")&&$.select("activeTriggerId")===F&&!$.context.triggerElements.getById(F)){let K=w0(F0.none);if($.setOpen(!1,K),!K.isCanceled)$.update({activeTriggerId:null,activeTriggerElement:null})}})}},[B,$,Q,X,z,J])}function s9($,Z,J,H){let{mounted:B,setMounted:Q,transitionStatus:X}=k2($,!1,!1,H),z=Z.useState("preventUnmountingOnClose"),G=$?!1:z;Z.useSyncedValues({mounted:B,transitionStatus:X,preventUnmountingOnClose:G});let U=Y0(()=>{Q(!1),Z.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1,preventUnmountingOnClose:!1}),J?.(),Z.context.onOpenChangeComplete?.(!1)});return L5({enabled:B&&!$&&!G,open:$,ref:Z.context.popupRef,onComplete(){if(!$)U()}}),{forceUnmount:U,transitionStatus:X}}function t9($,Z){$.useSyncedValues(Z),H0(()=>()=>{$.update({activeTriggerProps:D1,inactiveTriggerProps:D1,popupProps:D1})},[$])}function mG($,Z){H0(()=>{if(!Z&&$.state.openMethod!==null)$.set("openMethod",null)},[Z,$]),H0(()=>()=>{if($.state.openMethod!==null)$.set("openMethod",null)},[$])}class y2{constructor(){this.idMap=new Map}add($,Z){this.idMap.set($,Z)}delete($){this.idMap.delete($)}hasElement($){for(let Z of this.idMap.values())if(Z===$)return!0;return!1}hasMatchingElement($){for(let Z of this.idMap.values())if($(Z))return!0;return!1}getById($){return this.idMap.get($)}entries(){return this.idMap.entries()}elements(){return this.idMap.values()}get size(){return this.idMap.size}}function e9($,Z,J=!1){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:new _$({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:$,floatingId:Z,syncOnly:!0,nested:J,onOpenChange:void 0}),floatingId:Z,triggerCount:0,preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:D1,inactiveTriggerProps:D1,popupProps:D1}}var rB=($)=>$.triggerIdProp??$.activeTriggerId,FD=($)=>$.openProp??$.open,_E=($)=>{return($.popupElement?.id??$.floatingId)||void 0};function OE($,Z){return Z!==void 0&&FD($)&&rB($)===Z}function B50($,Z){if(OE($,Z))return!0;return Z!==void 0&&FD($)&&rB($)==null&&$.triggerCount===1}var $3={open:FD,mounted:($)=>$.mounted,transitionStatus:($)=>$.transitionStatus,floatingRootContext:($)=>$.floatingRootContext,triggerCount:($)=>$.triggerCount,preventUnmountingOnClose:($)=>$.preventUnmountingOnClose,payload:($)=>$.payload,activeTriggerId:rB,activeTriggerElement:($)=>$.mounted?$.activeTriggerElement:null,popupId:_E,isTriggerActive:($,Z)=>Z!==void 0&&rB($)===Z,isOpenedByTrigger:($,Z)=>OE($,Z),isMountedByTrigger:($,Z)=>Z!==void 0&&rB($)===Z&&$.mounted,triggerProps:($,Z)=>Z?$.activeTriggerProps:$.inactiveTriggerProps,triggerPopupId:($,Z)=>B50($,Z)?_E($):void 0,popupProps:($)=>$.popupProps,popupElement:($)=>$.popupElement,positionerElement:($)=>$.positionerElement};var KD=P(m(),1),TE=P(iZ(),1);function Z3($){let Z=KD.useCallback((H)=>{if($===void 0)return G1;return $.subscribeStore(H)},[$]),J=KD.useCallback(()=>{return $===void 0?void 0:$.store},[$]);return TE.useSyncExternalStore(Z,J,()=>$?.serverStore)}function WD($){let{open:Z=!1,onOpenChange:J,elements:H={}}=$,B=k4(),Q=x4()!=null,X=H5(()=>new _$({open:Z,transitionStatus:void 0,onOpenChange:J,referenceElement:H.reference??null,floatingElement:H.floating??null,triggerElements:new y2,floatingId:B,syncOnly:!1,nested:Q})).current;return H0(()=>{let z={open:Z,floatingId:B};if(H.reference!==void 0)z.referenceElement=H.reference,z.domReferenceElement=s0(H.reference)?H.reference:null;if(H.floating!==void 0)z.floatingElement=H.floating;X.update(z)},[Z,B,H.reference,H.floating,X]),X.context.onOpenChange=J,X.context.nested=Q,X}var J3=P(m(),1);var ND=B5.os.mac&&B5.engine.webkit;function T$($,Z={}){let{enabled:J=!0,delay:H}=Z,B="rootStore"in $?$.rootStore:$,{events:Q,dataRef:X}=B.context,z=J3.useRef(!1),G=J3.useRef(null),U=J3.useRef(!0),Y=s1();J3.useEffect(()=>{let K=B.select("domReferenceElement");if(!J)return;let W=k1(K);function N(){let A=B.select("domReferenceElement");if(!B.select("open")&&L1(A)&&A===a1(m0(A)))z.current=!0,G.current=A}function q(){U.current=!0}function D(){U.current=!1}return S2(o0(W,"blur",N),ND&&o0(W,"keydown",q,!0),ND&&o0(W,"pointerdown",D,!0))},[B,J]),J3.useEffect(()=>{if(!J)return;function K(W){if(W.reason===F0.triggerPress||W.reason===F0.escapeKey){let N=B.select("domReferenceElement");if(s0(N))G.current=N,z.current=!0}}return Q.on("openchange",K),()=>{Q.off("openchange",K)}},[Q,J,B]);let F=J3.useMemo(()=>{function K(){z.current=!1,G.current=null}return{onMouseLeave(){K()},onFocus(W){let N=W.currentTarget;if(z.current){if(G.current===N)return;K()}let q=V1(W.nativeEvent);if(s0(q)){if(ND&&!W.relatedTarget){if(!U.current&&!K$(q))return}else if(!c9(q))return}let D=T6(W.relatedTarget,B.context.triggerElements),{nativeEvent:A,currentTarget:V}=W,L=typeof H==="function"?H():H;if(B.select("open")&&D||L===0||L===void 0){B.setOpen(!0,w0(F0.triggerFocus,A,V));return}Y.start(L,()=>{if(z.current)return;B.setOpen(!0,w0(F0.triggerFocus,A,V))})},onBlur(W){K();let{relatedTarget:N,nativeEvent:q}=W,D=s0(N)&&N.hasAttribute(u3("focus-guard"))&&N.getAttribute("data-type")==="outside";Y.start(0,()=>{let A=B.select("domReferenceElement"),V=a1(m0(A));if(!N&&V===A)return;if(R0(X.current.floatingContext?.refs.floating.current,V)||R0(A,V)||D)return;if(T6(N??V,B.context.triggerElements))return;B.setOpen(!1,w0(F0.triggerFocus,q))})}}},[X,H,B,Y]);return J3.useMemo(()=>J?{reference:F,trigger:F}:{},[J,F])}var AD=P(m(),1);class qD{constructor(){this.pointerType=void 0,this.interactedInside=!1,this.handler=void 0,this.blockMouseMove=!0,this.performedPointerEventsMutation=!1,this.pointerEventsScopeElement=null,this.pointerEventsReferenceElement=null,this.pointerEventsFloatingElement=null,this.restTimeoutPending=!1,this.openChangeTimeout=new n5,this.restTimeout=new n5,this.handleCloseOptions=void 0}static create(){return new qD}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>{return this.dispose}}var uG=new WeakMap;function ZJ($){if(!$.performedPointerEventsMutation)return;let Z=$.pointerEventsScopeElement;if(Z&&uG.get(Z)===$)$.pointerEventsScopeElement?.style.removeProperty("pointer-events"),$.pointerEventsReferenceElement?.style.removeProperty("pointer-events"),$.pointerEventsFloatingElement?.style.removeProperty("pointer-events"),uG.delete(Z);$.performedPointerEventsMutation=!1,$.pointerEventsScopeElement=null,$.pointerEventsReferenceElement=null,$.pointerEventsFloatingElement=null}function pG($,Z){let{scopeElement:J,referenceElement:H,floatingElement:B}=Z,Q=uG.get(J);if(Q&&Q!==$)ZJ(Q);ZJ($),$.performedPointerEventsMutation=!0,$.pointerEventsScopeElement=J,$.pointerEventsReferenceElement=H,$.pointerEventsFloatingElement=B,uG.set(J,$),J.style.pointerEvents="none",H.style.pointerEvents="auto",B.style.pointerEvents="auto"}function JJ($){let Z=$.context.dataRef.current,J=H5(()=>Z.hoverInteractionState??qD.create()).current;if(!Z.hoverInteractionState)Z.hoverInteractionState=J;return P6(Z.hoverInteractionState.disposeEffect),Z.hoverInteractionState}function d3($,Z={}){let{enabled:J=!0,closeDelay:H=0,nodeId:B}=Z,Q="rootStore"in $?$.rootStore:$,X=Q.useState("open"),z=Q.useState("floatingElement"),G=Q.useState("domReferenceElement"),{dataRef:U}=Q.context,Y=G4(),F=x4(),K=JJ(Q),W=s1(),N=Y0(()=>{return yG(U.current.openEvent?.type,K.interactedInside)}),q=Y0(()=>{return eC(U.current.openEvent?.type)}),D=Y0(()=>{ZJ(K)});H0(()=>{if(!X)K.pointerType=void 0,K.restTimeoutPending=!1,K.interactedInside=!1,D()},[X,K,D]),AD.useEffect(()=>{return D},[D]),H0(()=>{if(!J)return;if(X&&K.handleCloseOptions?.blockPointerEvents&&q()&&s0(G)&&z){let A=G,V=z,L=m0(z),O=Y?.nodesRef.current.find((C)=>C.id===F)?.context?.elements.floating;if(O)O.style.pointerEvents="";let M=K.pointerEventsScopeElement!==V?K.pointerEventsScopeElement:null,_=O!==V?O:null,w=K.handleCloseOptions?.getScope?.()??M??_??A.closest("[data-rootownerid]")??L.body;return pG(K,{scopeElement:w,referenceElement:A,floatingElement:V}),()=>{D()}}return},[J,X,G,z,K,q,Y,F,D]),AD.useEffect(()=>{if(!J)return;function A(){return!!(Y&&F&&R8(Y.nodesRef.current,F).length>0)}function V(C){let E=F9(H,"close",K.pointerType),T=()=>{Q.setOpen(!1,w0(F0.triggerHover,C)),Y?.events.emit("floating.closed",C)};if(E)K.openChangeTimeout.start(E,T);else K.openChangeTimeout.clear(),T()}function L(C){let E=V1(C);if(!fA(E)){K.interactedInside=!1;return}K.interactedInside=E?.closest("[aria-haspopup]")!=null}function O(){K.openChangeTimeout.clear(),W.clear(),Y?.events.off("floating.closed",_),D()}function M(C){if(A()&&Y){Y.events.on("floating.closed",_);return}if(T6(C.relatedTarget,Q.context.triggerElements))return;let E=U.current.floatingContext?.nodeId??B,T=C.relatedTarget;if(Y&&E&&s0(T)&&R8(Y.nodesRef.current,E,!1).some((S)=>R0(S.context?.elements.floating,T)))return;if(K.handler){K.handler(C);return}if(D(),q()&&!N())V(C)}function _(C){if(!Y||!F||A())return;W.start(0,()=>{Y.events.off("floating.closed",_),Q.setOpen(!1,w0(F0.triggerHover,C)),Y.events.emit("floating.closed",C)})}let w=z;return S2(w&&o0(w,"mouseenter",O),w&&o0(w,"mouseleave",M),w&&o0(w,"pointerdown",L,!0),()=>{Y?.events.off("floating.closed",_)})},[J,z,Q,U,H,B,q,N,D,K,Y,F,W])}var I6=P(m(),1),jE=P(A8(),1);var Q50={current:null};function N9($,Z={}){let{enabled:J=!0,delay:H=0,handleClose:B=null,mouseOnly:Q=!1,restMs:X=0,move:z=!0,triggerElementRef:G=Q50,externalTree:U,isActiveTrigger:Y=!0,getHandleCloseContext:F,isClosing:K,shouldOpen:W,guardStaleOpen:N=!1}=Z,q="rootStore"in $?$.rootStore:$,{dataRef:D,events:A}=q.context,V=G4(U),L=JJ(q),O=I6.useRef(!1),M=N5(B),_=N5(H),w=N5(X),C=N5(J),E=N5(W),T=N5(K),k=Y0(()=>{return yG(D.current.openEvent?.type,L.interactedInside)}),S=Y0(()=>{return E.current?.()!==!1}),I=Y0((R,x,v)=>{let f=q.context.triggerElements;if(f.hasElement(x))return!R||!R0(R,x);if(!s0(v))return!1;let b=v;return f.hasMatchingElement((l)=>R0(l,b))&&(!R||!R0(R,b))}),j=Y0(()=>{if(!L.handler)return;m0(q.select("domReferenceElement")).removeEventListener("mousemove",L.handler),L.handler=void 0}),y=Y0(()=>{ZJ(L)});if(Y)L.handleCloseOptions=B?.__options;return I6.useEffect(()=>j,[j]),I6.useEffect(()=>{if(!J)return;function R(x){if(!x.open)O.current=x.reason===F0.triggerHover,j(),L.openChangeTimeout.clear(),L.restTimeout.clear(),L.blockMouseMove=!0,L.restTimeoutPending=!1;else O.current=!1}return A.on("openchange",R),()=>{A.off("openchange",R)}},[J,A,L,j]),I6.useEffect(()=>{if(!J)return;function R(r,h=!0){let d=F9(_.current,"close",L.pointerType);if(d)L.openChangeTimeout.start(d,()=>{q.setOpen(!1,w0(F0.triggerHover,r)),V?.events.emit("floating.closed",r)});else if(h)L.openChangeTimeout.clear(),q.setOpen(!1,w0(F0.triggerHover,r)),V?.events.emit("floating.closed",r)}let x=G.current??(Y?q.select("domReferenceElement"):null);if(!s0(x))return;function v(r){if(L.openChangeTimeout.clear(),L.blockMouseMove=!1,Q&&!q8(L.pointerType))return;let h=sA(w.current),d=F9(_.current,"open",L.pointerType),o=V1(r),c=r.currentTarget??null,i=q.select("domReferenceElement"),n=c;if(s0(o)&&!q.context.triggerElements.hasElement(o)){for(let s of q.context.triggerElements.elements())if(R0(s,o)){n=s;break}}if(s0(c)&&s0(i)&&!q.context.triggerElements.hasElement(c)&&R0(c,i))n=i;let Z0=n==null?!1:I(i,n,o),J0=q.select("open"),U0=T.current?.()??q.select("transitionStatus")==="ending",z0=!J0&&U0&&O.current,X0=!Z0&&s0(n)&&s0(i)&&R0(i,n)&&z0,N0=h>0&&!d,q0=Z0&&(J0||z0)||X0,K0=!J0||Z0;if(q0){if(S())q.setOpen(!0,w0(F0.triggerHover,r,n));return}if(N0)return;if(d)L.openChangeTimeout.start(d,()=>{if(K0&&S())q.setOpen(!0,w0(F0.triggerHover,r,n))});else if(K0){if(S())q.setOpen(!0,w0(F0.triggerHover,r,n))}}function f(r){if(k()){y();return}j();let h=q.select("domReferenceElement"),d=m0(h);L.restTimeout.clear(),L.restTimeoutPending=!1;let o=D.current.floatingContext??F?.();if(T6(r.relatedTarget,q.context.triggerElements))return;if(M.current&&o){if(!q.select("open"))L.openChangeTimeout.clear();let i=G.current;L.handler=M.current({...o,tree:V,x:r.clientX,y:r.clientY,onClose(){if(y(),j(),C.current&&!k()&&i===q.select("domReferenceElement"))R(r,!0)}}),d.addEventListener("mousemove",L.handler),L.handler(r);return}if(L.pointerType==="touch"?!R0(q.select("floatingElement"),r.relatedTarget):!0)R(r)}function b(r){if(R0(x,r.relatedTarget))return;L.openChangeTimeout.clear(),L.restTimeout.clear(),L.restTimeoutPending=!1}let l=N?o0(x,"mouseout",b):void 0;if(z)return S2(o0(x,"mousemove",v,{once:!0}),o0(x,"mouseenter",v),o0(x,"mouseleave",f),l);return S2(o0(x,"mouseenter",v),o0(x,"mouseleave",f),l)},[j,y,D,_,q,J,M,L,Y,I,k,Q,z,w,G,V,C,F,T,S,N]),I6.useMemo(()=>{if(!J)return;function R(x){L.pointerType=x.pointerType}return{onPointerDown:R,onPointerEnter:R,onMouseMove(x){let{nativeEvent:v}=x,f=x.currentTarget,b=q.select("domReferenceElement"),l=q.select("open"),r=I(b,f,x.target);if(Q&&!q8(L.pointerType))return;if(l&&r&&L.handleCloseOptions?.blockPointerEvents){let o=q.select("floatingElement");if(o){let c=L.handleCloseOptions?.getScope?.()??f.ownerDocument.body;pG(L,{scopeElement:c,referenceElement:f,floatingElement:o})}}let h=sA(w.current);if(l&&!r||h===0)return;if(!r&&L.restTimeoutPending&&x.movementX**2+x.movementY**2<2)return;L.restTimeout.clear();function d(){if(L.restTimeoutPending=!1,k())return;let o=q.select("open");if(!L.blockMouseMove&&(!o||r)&&S())q.setOpen(!0,w0(F0.triggerHover,v,f))}if(L.pointerType==="touch")jE.flushSync(()=>{d()});else if(r&&l)d();else L.restTimeoutPending=!0,L.restTimeout.start(h,d)}}},[J,L,k,I,Q,q,w,S])}var i2=P(m(),1);var X50="Escape";function CE($){return B5.engine.webkit&&$.movementX===0&&$.movementY===0}function dG($,Z,J){switch($){case"vertical":return Z;case"horizontal":return J;default:return Z||J}}function cG($,Z){return dG(Z,$===kA||$===QG,$===RB||$===IB)}function DD($,Z,J){return dG(Z,$===QG,J?$===RB:$===IB)||$==="Enter"||$===" "||$===""}function z50($,Z,J){return dG(Z,J?$===RB:$===IB,$===QG)}function G50($,Z,J,H){let B=J?$===IB:$===RB,Q=$===kA;if(Z==="both"||Z==="horizontal"&&H)return $===X50;return dG(Z,B,Q)}function VD($,Z){let{listRef:J,activeIndex:H,onNavigate:B=()=>{},enabled:Q=!0,selectedIndex:X=null,allowEscape:z=!1,loopFocus:G=!1,nested:U=!1,rtl:Y=!1,virtual:F=!1,focusItemOnOpen:K="auto",focusItemOnHover:W=!0,openOnArrowKeyDown:N=!0,disabledIndices:q=void 0,orientation:D="vertical",parentOrientation:A,id:V,resetOnPointerLeave:L=!0,externalTree:O,grid:M}=Z,_=M!=null,w="rootStore"in $?$.rootStore:$,C=w.useState("open"),E=w.useState("floatingElement"),T=w.useState("domReferenceElement"),k=w.context.dataRef,S=vB(E),I=hB(T),j=N5(S),y=x4(),R=G4(O),x=i2.useRef(K),v=i2.useRef(X??-1),f=i2.useRef(null),b=i2.useRef(!0),l=Y0((A0)=>{B(v.current===-1?null:v.current,A0)}),r=i2.useRef(!!E),h=i2.useRef(C),d=i2.useRef(!1),o=i2.useRef(!1),c=i2.useRef(null),i=N5(q),n=N5(C),Z0=N5(X),J0=N5(L),U0=I4(),z0=I4(),X0=Y0(()=>{function A0(e){if(F)R?.events.emit("virtualfocus",e);else c.current=$J(e,{sync:d.current,preventScroll:!0})}let M0=J.current[v.current],g=o.current;if(M0)A0(M0);(d.current?(e)=>e():(e)=>U0.request(e))(()=>{let e=J.current[v.current]||M0;if(!e)return;if(!M0)A0(e);if($0&&(g||!b.current))e.scrollIntoView?.({block:"nearest",inline:"nearest"})})});H0(()=>{k.current.orientation=D},[k,D]),H0(()=>{if(!Q)return;if(C&&E){if(v.current=X??-1,x.current&&X!=null)o.current=!0,l()}else if(r.current)v.current=-1,l()},[Q,C,E,X,l]),H0(()=>{if(!Q)return;if(!C){d.current=!1;return}if(!E)return;if(H==null){if(d.current=!1,Z0.current!=null)return;if(r.current)v.current=-1,X0();if((!h.current||!r.current)&&x.current&&(f.current!=null||x.current===!0&&f.current==null)){let A0=0,M0=()=>{if(J.current[0]==null){if(A0<2)(A0?(p)=>z0.request(p):queueMicrotask)(M0);A0+=1}else v.current=f.current==null||DD(f.current,D,Y)||U?N$(J):oZ(J),f.current=null,l()};M0()}}else if(!E6(J.current,H))v.current=H,X0(),o.current=!1},[Q,C,E,H,Z0,U,J,D,Y,l,X0,z0]),H0(()=>{if(!Q||E||!R||F||!r.current)return;let A0=R.nodesRef.current,M0=A0.find((e)=>e.id===y)?.context?.elements.floating,g=a1(m0(T??M0??null)),p=A0.some((e)=>e.context&&R0(e.context.elements.floating,g));if(M0&&!p&&b.current)M0.focus({preventScroll:!0})},[Q,E,T,R,y,F]),H0(()=>{h.current=C,r.current=!!E}),H0(()=>{if(!C)f.current=null,x.current=K},[C,K]);let N0=H!=null,q0=Y0((A0)=>{if(!n.current)return;let M0=J.current.indexOf(A0.currentTarget);if(M0!==-1&&(v.current!==M0||H!==M0))v.current=M0,l(A0)}),K0=Y0(()=>{return A??R?.nodesRef.current.find((A0)=>A0.id===y)?.context?.dataRef?.current.orientation}),s=Y0(()=>{return N$(J,i.current)}),a=Y0((A0)=>{if(b.current=!1,d.current=!0,A0.which===229)return;if(!n.current&&A0.currentTarget===j.current)return;if(U&&G50(A0.key,D,Y,_)){if(!cG(A0.key,K0()))o4(A0);if(w.setOpen(!1,w0(F0.listNavigation,A0.nativeEvent)),L1(T))if(F)R?.events.emit("virtualfocus",T);else T.focus();return}let M0=v.current,g=N$(J,q),p=oZ(J,q);if(!I){if(A0.key==="Home")o4(A0),v.current=g,l(A0);if(A0.key==="End")o4(A0),v.current=p,l(A0)}if(M!=null){let e=M(A0,v.current,J,D,G,Y,q,g,p);if(e!=null)v.current=e,l(A0);if(D==="both")return}if(cG(A0.key,D)){if(o4(A0),C&&!F&&a1(A0.currentTarget.ownerDocument)===A0.currentTarget){v.current=DD(A0.key,D,Y)?g:p,l(A0);return}if(DD(A0.key,D,Y))if(G)if(M0>=p)if(z&&M0!==J.current.length)v.current=-1;else d.current=!1,v.current=g;else v.current=k8(J.current,{startingIndex:M0,disabledIndices:q});else v.current=Math.min(p,k8(J.current,{startingIndex:M0,disabledIndices:q}));else if(G)if(M0<=g)if(z&&M0!==-1)v.current=J.current.length;else d.current=!1,v.current=p;else v.current=k8(J.current,{startingIndex:M0,decrement:!0,disabledIndices:q});else v.current=Math.max(g,k8(J.current,{startingIndex:M0,decrement:!0,disabledIndices:q}));if(E6(J.current,v.current))v.current=-1;l(A0)}}),$0=i2.useMemo(()=>{return{onFocus(M0){d.current=!0,q0(M0)},onClick:({currentTarget:M0})=>M0.focus({preventScroll:!0}),onMouseMove(M0){if(CE(M0))return;if(d.current=!0,o.current=!1,W)q0(M0)},onPointerLeave(M0){if(!n.current||!b.current||M0.pointerType==="touch")return;d.current=!0;let g=M0.relatedTarget;if(!W||J.current.includes(g))return;if(!J0.current)return;if(c.current?.(),c.current=null,v.current=-1,l(M0),!F){let p=j.current,e=a1(m0(p));if(p&&R0(p,e))p.focus({preventScroll:!0})}}}},[q0,n,j,W,J,l,J0,F]),t=i2.useMemo(()=>{return F&&C&&N0&&{"aria-activedescendant":`${V}-${H}`}},[F,C,N0,V,H]),B0=i2.useMemo(()=>{return{...!I?t:{},onKeyDown(A0){if(A0.key==="Tab"&&A0.shiftKey&&C&&!F){let M0=V1(A0.nativeEvent);if(M0&&!R0(j.current,M0))return;if(o4(A0),w.setOpen(!1,w0(F0.focusOut,A0.nativeEvent)),L1(T))T.focus();return}a(A0)},onPointerMove(A0){if(CE(A0))return;b.current=!0}}},[t,a,j,I,w,C,F,T]),_0=i2.useMemo(()=>{function A0(p){w.setOpen(!0,w0(F0.listNavigation,p.nativeEvent,p.currentTarget))}function M0(p){if(K==="auto"&&rZ(p.nativeEvent))x.current=!F}function g(p){if(x.current=K,K==="auto"&&aZ(p.nativeEvent))x.current=!0}return{onKeyDown(p){let e=w.select("open");b.current=!1;let W0=p.key.startsWith("Arrow"),S0=z50(p.key,K0(),Y),h0=cG(p.key,D),v0=(U?S0:h0)||p.key==="Enter"||p.key.trim()==="";if(F&&e)return a(p);if(!e&&!N&&W0)return;if(v0){let j0=cG(p.key,K0());f.current=U&&j0?null:p.key}if(U){if(S0)if(o4(p),e)v.current=s(),l(p);else A0(p);return}if(h0){if(Z0.current!=null)v.current=Z0.current;if(o4(p),!e&&N)A0(p);else a(p);if(e)l(p)}return},onFocus(p){if(w.select("open")&&!F)v.current=-1,l(p)},onPointerDown:g,onPointerEnter:g,onMouseDown:M0,onClick:M0}},[a,K,s,U,l,w,N,D,K0,Y,Z0,F]),P0=i2.useMemo(()=>{return{...t,..._0}},[t,_0]);return i2.useMemo(()=>Q?{reference:P0,floating:B0,item:$0,trigger:_0}:{},[Q,P0,B0,_0,$0])}var j$=P(m(),1);function LD($,Z){let{listRef:J,elementsRef:H,activeIndex:B,onMatch:Q,disabledIndices:X,onTyping:z,enabled:G=!0,resetMs:U=750,selectedIndex:Y=null}=Z,F="rootStore"in $?$.rootStore:$,K=F.useState("open"),W=s1(),N=j$.useRef(""),q=j$.useRef(Y??B??-1),D=j$.useRef(null),A=Y0((O)=>{function M(j){return H?.current[j]}function _(j){let y=M(j);if(y&&!q$(y)||y?.matches(":disabled"))return!1;return X==null||!f3(Q4,j,X)}function w(j,y,R=0){if(j.length===0)return-1;let x=(R%j.length+j.length)%j.length,v=y.toLowerCase();for(let f=0;f<j.length;f+=1){let b=(x+f)%j.length;if(!j[b]?.toLowerCase().startsWith(v)||!_(b))continue;return b}return-1}let C=J.current;if(N.current.length>0&&O.key===" ")o4(O),z?.(!0);if(N.current.length>0&&N.current[0]!==" "){if(w(C,N.current)===-1&&O.key!==" ")z?.(!1)}if(C==null||O.key.length!==1||O.ctrlKey||O.metaKey||O.altKey)return;if(K&&O.key!==" ")o4(O),z?.(!0);let E=N.current==="";if(E)q.current=Y??B??-1;if(C.every((j,y)=>j&&_(y)?j[0]?.toLowerCase()!==j[1]?.toLowerCase():!0)&&N.current===O.key)N.current="",q.current=D.current;N.current+=O.key,W.start(U,()=>{N.current="",q.current=D.current,z?.(!1)});let S=((E?Y??B??-1:q.current)??0)+1,I=w(C,N.current,S);if(I!==-1)Q?.(I),D.current=I;else if(O.key!==" ")N.current="",z?.(!1)}),V=Y0((O)=>{let M=O.relatedTarget,_=F.select("domReferenceElement"),w=F.select("floatingElement");if(R0(_,M)||R0(w,M))return;W.clear(),N.current="",q.current=D.current,z?.(!1)});H0(()=>{if(!K&&Y!==null)return;if(W.clear(),D.current=null,N.current!=="")N.current=""},[K,Y,W]);let L=j$.useMemo(()=>({onKeyDown:A,onBlur:V}),[A,V]);return j$.useMemo(()=>G?{reference:L,floating:L}:{},[G,L])}var EE=0.1,U50=EE*EE,P5=0.5;function lG($,Z,J,H,B,Q){return H>=Z!==Q>=Z&&$<=(B-J)*(Z-H)/(Q-H)+J}function iG($,Z,J,H,B,Q,X,z,G,U){let Y=!1;if(lG($,Z,J,H,B,Q))Y=!Y;if(lG($,Z,B,Q,X,z))Y=!Y;if(lG($,Z,X,z,G,U))Y=!Y;if(lG($,Z,G,U,J,H))Y=!Y;return Y}function Y50($,Z,J){return $>=J.x&&$<=J.x+J.width&&Z>=J.y&&Z<=J.y+J.height}function rG($,Z,J,H,B,Q){let X=Math.min(J,B),z=Math.max(J,B),G=Math.min(H,Q),U=Math.max(H,Q);return $>=X&&$<=z&&Z>=G&&Z<=U}function q9($={}){let{blockPointerEvents:Z=!1}=$,J=new n5,H=({x:B,y:Q,placement:X,elements:z,onClose:G,nodeId:U,tree:Y})=>{let F=X?.split("-")[0],K=!1,W=null,N=null,q=typeof performance<"u"?performance.now():0;function D(V,L){let O=performance.now(),M=O-q;if(W===null||N===null||M===0)return W=V,N=L,q=O,!1;let _=V-W,w=L-N,C=_*_+w*w,E=M*M*U50;return W=V,N=L,q=O,C<E}function A(){J.clear(),G()}return function(L){J.clear();let{domReference:O,floating:M}=z;if(!O||!M||F==null||B==null||Q==null)return;let{clientX:_,clientY:w}=L,C=V1(L),E=L.type==="mouseleave",T=R0(M,C),k=R0(O,C);if(T){if(K=!0,!E)return}if(k){if(K=!1,!E){K=!0;return}}if(E&&s0(L.relatedTarget)&&R0(M,L.relatedTarget))return;function S(){return Boolean(Y&&R8(Y.nodesRef.current,U).length>0)}function I(){if(!S())A()}if(S())return;let j=O.getBoundingClientRect(),y=M.getBoundingClientRect(),R=B>y.right-y.width/2,x=Q>y.bottom-y.height/2,v=y.width>j.width,f=y.height>j.height,b=(v?j:y).left,l=(v?j:y).right,r=(f?j:y).top,h=(f?j:y).bottom;if(F==="top"&&Q>=j.bottom-1||F==="bottom"&&Q<=j.top+1||F==="left"&&B>=j.right-1||F==="right"&&B<=j.left+1){I();return}let d=!1;switch(F){case"top":d=rG(_,w,b,j.top+1,l,y.bottom-1);break;case"bottom":d=rG(_,w,b,y.top+1,l,j.bottom-1);break;case"left":d=rG(_,w,y.right-1,h,j.left+1,r);break;case"right":d=rG(_,w,j.right-1,h,y.left+1,r);break;default:}if(d)return;if(K&&!Y50(_,w,j)){I();return}if(!E&&D(_,w)){I();return}let o=!1;switch(F){case"top":{let c=v?P5/2:P5*4,i=v?B+c:R?B+c:B-c,n=v?B-c:R?B+c:B-c,Z0=Q+P5+1,J0=R?y.bottom-P5:v?y.bottom-P5:y.top,U0=R?v?y.bottom-P5:y.top:y.bottom-P5;o=iG(_,w,i,Z0,n,Z0,y.left,J0,y.right,U0);break}case"bottom":{let c=v?P5/2:P5*4,i=v?B+c:R?B+c:B-c,n=v?B-c:R?B+c:B-c,Z0=Q-P5,J0=R?y.top+P5:v?y.top+P5:y.bottom,U0=R?v?y.top+P5:y.bottom:y.top+P5;o=iG(_,w,i,Z0,n,Z0,y.left,J0,y.right,U0);break}case"left":{let c=f?P5/2:P5*4,i=f?Q+c:x?Q+c:Q-c,n=f?Q-c:x?Q+c:Q-c,Z0=B+P5+1,J0=x?y.right-P5:f?y.right-P5:y.left,U0=x?f?y.right-P5:y.left:y.right-P5;o=iG(_,w,J0,y.top,U0,y.bottom,Z0,i,Z0,n);break}case"right":{let c=f?P5/2:P5*4,i=f?Q+c:x?Q+c:Q-c,n=f?Q-c:x?Q+c:Q-c,Z0=B-P5,J0=x?y.left+P5:f?y.left+P5:y.right,U0=x?f?y.left+P5:y.right:y.left+P5;o=iG(_,w,Z0,i,Z0,n,J0,y.top,U0,y.bottom);break}default:}if(!o)I();else if(!K)J.start(40,I);return}};return H.__options={...$,blockPointerEvents:Z},H}function bE($,Z,J){let{reference:H,floating:B}=$,Q=n4(Z),X=uB(Z),z=mB(X),G=z4(Z),U=Q==="y",Y=H.x+H.width/2-B.width/2,F=H.y+H.height/2-B.height/2,K=H[z]/2-B[z]/2,W;switch(G){case"top":W={x:Y,y:H.y-B.height};break;case"bottom":W={x:Y,y:H.y+H.height};break;case"right":W={x:H.x+H.width,y:F};break;case"left":W={x:H.x-B.width,y:F};break;default:W={x:H.x,y:H.y}}let N=I8(Z);if(N)W[X]+=K*(N==="end"?1:-1)*(J&&U?-1:1);return W}async function wE($,Z){var J;if(Z===void 0)Z={};let{x:H,y:B,platform:Q,rects:X,elements:z,strategy:G}=$,{boundary:U="clippingAncestors",rootBoundary:Y="viewport",elementContext:F="floating",altBoundary:K=!1,padding:W=0}=l9(Z,$),N=KG(W),D=z[K?F==="floating"?"reference":"floating":F],A=W$(await Q.getClippingRect({element:((J=await(Q.isElement==null?void 0:Q.isElement(D)))!=null?J:!0)?D:D.contextElement||await(Q.getDocumentElement==null?void 0:Q.getDocumentElement(z.floating)),boundary:U,rootBoundary:Y,strategy:G})),V=F==="floating"?{x:H,y:B,width:X.floating.width,height:X.floating.height}:X.reference,L=await(Q.getOffsetParent==null?void 0:Q.getOffsetParent(z.floating)),O=await(Q.isElement==null?void 0:Q.isElement(L))&&await(Q.getScale==null?void 0:Q.getScale(L))||{x:1,y:1},M=W$(Q.convertOffsetParentRelativeRectToViewportRelativeRect?await Q.convertOffsetParentRelativeRectToViewportRelativeRect({elements:z,rect:V,offsetParent:L,strategy:G}):V);return{top:(A.top-M.top+N.top)/O.y,bottom:(M.bottom-A.bottom+N.bottom)/O.y,left:(A.left-M.left+N.left)/O.x,right:(M.right-A.right+N.right)/O.x}}var F50=50,SE=async($,Z,J)=>{let{placement:H="bottom",strategy:B="absolute",middleware:Q=[],platform:X}=J,z=X.detectOverflow?X:{...X,detectOverflow:wE},G=await(X.isRTL==null?void 0:X.isRTL(Z)),U=await X.getElementRects({reference:$,floating:Z,strategy:B}),{x:Y,y:F}=bE(U,H,G),K=H,W=0,N={};for(let q=0;q<Q.length;q++){let D=Q[q];if(!D)continue;let{name:A,fn:V}=D,{x:L,y:O,data:M,reset:_}=await V({x:Y,y:F,initialPlacement:H,placement:K,strategy:B,middlewareData:N,rects:U,platform:z,elements:{reference:$,floating:Z}});if(Y=L!=null?L:Y,F=O!=null?O:F,N[A]={...N[A],...M},_&&W<F50){if(W++,typeof _==="object"){if(_.placement)K=_.placement;if(_.rects)U=_.rects===!0?await X.getElementRects({reference:$,floating:Z,strategy:B}):_.rects;({x:Y,y:F}=bE(U,K,G))}q=-1}}return{x:Y,y:F,placement:K,strategy:B,middlewareData:N}};var RE=function($){if($===void 0)$={};return{name:"flip",options:$,async fn(Z){var J,H;let{placement:B,middlewareData:Q,rects:X,initialPlacement:z,platform:G,elements:U}=Z,{mainAxis:Y=!0,crossAxis:F=!0,fallbackPlacements:K,fallbackStrategy:W="bestFit",fallbackAxisSideDirection:N="none",flipAlignment:q=!0,...D}=l9($,Z);if((J=Q.arrow)!=null&&J.alignmentOffset)return{};let A=z4(B),V=n4(z),L=z4(z)===z,O=await(G.isRTL==null?void 0:G.isRTL(U.floating)),M=K||(L||!q?[fB(z)]:nj(z)),_=N!=="none";if(!K&&_)M.push(...sj(z,q,N,O));let w=[z,...M],C=await G.detectOverflow(Z,D),E=[],T=((H=Q.flip)==null?void 0:H.overflows)||[];if(Y)E.push(C[A]);if(F){let j=oj(B,X,O);E.push(C[j[0]],C[j[1]])}if(T=[...T,{placement:B,overflows:E}],!E.every((j)=>j<=0)){var k,S;let j=(((k=Q.flip)==null?void 0:k.index)||0)+1,y=w[j];if(y){if(!(F==="alignment"?V!==n4(y):!1)||T.every((v)=>n4(v.placement)===V?v.overflows[0]>0:!0))return{data:{index:j,overflows:T},reset:{placement:y}}}let R=(S=T.filter((x)=>x.overflows[0]<=0).sort((x,v)=>x.overflows[1]-v.overflows[1])[0])==null?void 0:S.placement;if(!R)switch(W){case"bestFit":{var I;let x=(I=T.filter((v)=>{if(_){let f=n4(v.placement);return f===V||f==="y"}return!0}).map((v)=>[v.placement,v.overflows.filter((f)=>f>0).reduce((f,b)=>f+b,0)]).sort((v,f)=>v[1]-f[1])[0])==null?void 0:I[0];if(x)R=x;break}case"initialPlacement":R=z;break}if(B!==R)return{reset:{placement:R}}}return{}}}};var IE=new Set(["left","top"]);async function K50($,Z){let{placement:J,platform:H,elements:B}=$,Q=await(H.isRTL==null?void 0:H.isRTL(B.floating)),X=z4(J),z=I8(J),G=n4(J)==="y",U=IE.has(X)?-1:1,Y=Q&&G?-1:1,F=l9(Z,$),{mainAxis:K,crossAxis:W,alignmentAxis:N}=typeof F==="number"?{mainAxis:F,crossAxis:0,alignmentAxis:null}:{mainAxis:F.mainAxis||0,crossAxis:F.crossAxis||0,alignmentAxis:F.alignmentAxis};if(z&&typeof N==="number")W=z==="end"?N*-1:N;return G?{x:W*Y,y:K*U}:{x:K*U,y:W*Y}}var kE=function($){if($===void 0)$=0;return{name:"offset",options:$,async fn(Z){var J,H;let{x:B,y:Q,placement:X,middlewareData:z}=Z,G=await K50(Z,$);if(X===((J=z.offset)==null?void 0:J.placement)&&(H=z.arrow)!=null&&H.alignmentOffset)return{};return{x:B+G.x,y:Q+G.y,data:{...G,placement:X}}}}},yE=function($){if($===void 0)$={};return{name:"shift",options:$,async fn(Z){let{x:J,y:H,placement:B,platform:Q}=Z,{mainAxis:X=!0,crossAxis:z=!1,limiter:G={fn:(V)=>{let{x:L,y:O}=V;return{x:L,y:O}}},...U}=l9($,Z),Y={x:J,y:H},F=await Q.detectOverflow(Z,U),K=n4(B),W=FG(K),N=Y[W],q=Y[K],D=(V,L)=>YG(L+F[V==="y"?"top":"left"],L,L-F[V==="y"?"bottom":"right"]);if(X)N=D(W,N);if(z)q=D(K,q);let A=G.fn({...Z,[W]:N,[K]:q});return{...A,data:{x:A.x-J,y:A.y-H,enabled:{[W]:X,[K]:z}}}}}},xE=function($){if($===void 0)$={};return{options:$,fn(Z){var J,H;let{x:B,y:Q,placement:X,rects:z,middlewareData:G}=Z,{offset:U=0,mainAxis:Y=!0,crossAxis:F=!0}=l9($,Z),K={x:B,y:Q},W=n4(X),N=FG(W),q=K[N],D=K[W],A=l9(U,Z),V=typeof A==="number"?{mainAxis:A,crossAxis:0}:{mainAxis:(J=A.mainAxis)!=null?J:0,crossAxis:(H=A.crossAxis)!=null?H:0};if(Y){let M=N==="y"?"height":"width",_=z.reference[N]-z.floating[M]+V.mainAxis,w=z.reference[N]+z.reference[M]-V.mainAxis;if(q<_)q=_;else if(q>w)q=w}if(F){var L,O;let M=N==="y"?"width":"height",_=IE.has(z4(X)),w=z.reference[W]-z.floating[M]+(_?((L=G.offset)==null?void 0:L[W])||0:0)+(_?0:V.crossAxis),C=z.reference[W]+z.reference[M]+(_?0:((O=G.offset)==null?void 0:O[W])||0)-(_?V.crossAxis:0);if(D<w)D=w;else if(D>C)D=C}return{[N]:q,[W]:D}}}},hE=function($){if($===void 0)$={};return{name:"size",options:$,async fn(Z){let{placement:J,rects:H,platform:B,elements:Q}=Z,{apply:X=()=>{},...z}=l9($,Z),G=await B.detectOverflow(Z,z),U=z4(J),Y=I8(J),F=n4(J)==="y",{width:K,height:W}=H.floating,N,q;if(U==="top"||U==="bottom")N=U,q=Y===(await(B.isRTL==null?void 0:B.isRTL(Q.floating))?"start":"end")?"left":"right";else q=U,N=Y==="end"?"top":"bottom";let D=W-G.top-G.bottom,A=K-G.left-G.right,V=j6(W-G[N],D),L=j6(K-G[q],A),O=Z.middlewareData.shift,M=!O,_=V,w=L;if(O!=null&&O.enabled.x)w=A;if(O!=null&&O.enabled.y)_=D;if(M&&!Y)if(F)w=K-2*z9(G.left,G.right);else _=W-2*z9(G.top,G.bottom);await X({...Z,availableWidth:w,availableHeight:_});let C=await B.getDimensions(Q.floating);if(K!==C.width||W!==C.height)return{reset:{rects:!0}};return{}}}};function uE($){let Z=d2($),J=parseFloat(Z.width)||0,H=parseFloat(Z.height)||0,B=L1($),Q=B?$.offsetWidth:J,X=B?$.offsetHeight:H,z=C6(J)!==Q||C6(H)!==X;if(z)J=Q,H=X;return{width:J,height:H,$:z}}function TD($){return!s0($)?$.contextElement:$}function HJ($){let Z=TD($);if(!L1(Z))return d9(1);let J=Z.getBoundingClientRect(),{width:H,height:B,$:Q}=uE(Z),X=(Q?C6(J.width):J.width)/H,z=(Q?C6(J.height):J.height)/B;if(!X||!Number.isFinite(X))X=1;if(!z||!Number.isFinite(z))z=1;return{x:X,y:z}}var W50=d9(0);function pE($){let Z=k1($);if(!OD()||!Z.visualViewport)return W50;return{x:Z.visualViewport.offsetLeft,y:Z.visualViewport.offsetTop}}function N50($,Z,J){if(Z===void 0)Z=!1;return!!J&&Z&&J===k1($)}function C$($,Z,J,H){if(Z===void 0)Z=!1;if(J===void 0)J=!1;let B=$.getBoundingClientRect(),Q=TD($),X=d9(1);if(Z)if(H){if(s0(H))X=HJ(H)}else X=HJ($);let z=N50(Q,J,H)?pE(Q):d9(0),G=(B.left+z.x)/X.x,U=(B.top+z.y)/X.y,Y=B.width/X.x,F=B.height/X.y;if(Q&&H){let K=k1(Q),W=s0(H)?k1(H):H,N=K,q=PD(N);while(q&&W!==N){let D=HJ(q),A=q.getBoundingClientRect(),V=d2(q),L=A.left+(q.clientLeft+parseFloat(V.paddingLeft))*D.x,O=A.top+(q.clientTop+parseFloat(V.paddingTop))*D.y;G*=D.x,U*=D.y,Y*=D.x,F*=D.y,G+=L,U+=O,N=k1(q),q=PD(N)}}return W$({width:Y,height:F,x:G,y:U})}function oG($,Z){let J=oB($).scrollLeft;if(!Z)return C$(l3($)).left+J;return Z.left+J}function cE($,Z){let J=$.getBoundingClientRect(),H=J.left+Z.scrollLeft-oG($,J),B=J.top+Z.scrollTop;return{x:H,y:B}}function q50($){let{elements:Z,rect:J,offsetParent:H,strategy:B}=$,Q=B==="fixed",X=l3(H),z=Z?aG(Z.floating):!1;if(H===X||z&&Q)return J;let G={scrollLeft:0,scrollTop:0},U=d9(1),Y=d9(0),F=L1(H);if(F||!Q){if(R2(H)!=="body"||aB(X))G=oB(H);if(F){let W=C$(H);U=HJ(H),Y.x=W.x+H.clientLeft,Y.y=W.y+H.clientTop}}let K=X&&!F&&!Q?cE(X,G):d9(0);return{width:J.width*U.x,height:J.height*U.y,x:J.x*U.x-G.scrollLeft*U.x+Y.x+K.x,y:J.y*U.y-G.scrollTop*U.y+Y.y+K.y}}function A50($){return $.getClientRects?Array.from($.getClientRects()):[]}function D50($){let Z=oB($),J=$.ownerDocument.body,H=z9($.scrollWidth,$.clientWidth,J.scrollWidth,J.clientWidth),B=z9($.scrollHeight,$.clientHeight,J.scrollHeight,J.clientHeight),Q=-Z.scrollLeft+oG($),X=-Z.scrollTop;if(d2(J).direction==="rtl")Q+=z9($.clientWidth,J.clientWidth)-H;return{width:H,height:B,x:Q,y:X}}var V50=25;function L50($,Z,J){if(J===void 0)J="viewport";let H=J==="layoutViewport",B=k1($),Q=l3($),X=B.visualViewport,z=Q.clientWidth,G=Q.clientHeight,U=0,Y=0;if(X){let K=!OD()||Z==="fixed";if(H){if(!K)U=-X.offsetLeft,Y=-X.offsetTop}else if(z=X.width,G=X.height,K)U=X.offsetLeft,Y=X.offsetTop}if(oG(Q)<=0){let K=Q.ownerDocument,W=K.body,N=getComputedStyle(W),q=K.compatMode==="CSS1Compat"?parseFloat(N.marginLeft)+parseFloat(N.marginRight)||0:0,D=Math.abs(Q.clientWidth-W.clientWidth-q),A=getComputedStyle(Q).scrollbarGutter==="stable both-edges"?D/2:D;if(A<=V50)z-=A}return{width:z,height:G,x:U,y:Y}}function M50($,Z){let J=C$($,!0,Z==="fixed"),H=J.top+$.clientTop,B=J.left+$.clientLeft,Q=HJ($),X=$.clientWidth*Q.x,z=$.clientHeight*Q.y,G=B*Q.x,U=H*Q.y;return{width:X,height:z,x:G,y:U}}function vE($,Z,J){let H;if(Z==="viewport"||Z==="layoutViewport")H=L50($,J,Z);else if(Z==="document")H=D50(l3($));else if(s0(Z))H=M50(Z,J);else{let B=pE($);H={x:Z.x-B.x,y:Z.y-B.y,width:Z.width,height:Z.height}}return W$(H)}function P50($,Z){let J=Z.get($);if(J)return J;let H=BJ($,[],!1).filter((z)=>s0(z)&&R2(z)!=="body"),B=null,Q=d2($).position==="fixed",X=Q?v8($):$;while(s0(X)&&!h8(X)){let z=d2(X),G=_D(X),U=B?B.position:Q?"fixed":"";if(!G&&(U==="fixed"||U==="absolute"&&z.position==="static"))H=H.filter((F)=>F!==X);else B=z;X=v8(X)}return Z.set($,H),H}function _50($){let{element:Z,boundary:J,rootBoundary:H,strategy:B}=$,X=[...J==="clippingAncestors"?aG(Z)?[]:P50(Z,this._c):[].concat(J),H],z=vE(Z,X[0],B),G=z.top,U=z.right,Y=z.bottom,F=z.left;for(let K=1;K<X.length;K++){let W=vE(Z,X[K],B);G=z9(W.top,G),U=j6(W.right,U),Y=j6(W.bottom,Y),F=z9(W.left,F)}return{width:U-F,height:Y-G,x:F,y:G}}function O50($){let{width:Z,height:J}=uE($);return{width:Z,height:J}}function T50($,Z,J){let H=L1(Z),B=l3(Z),Q=J==="fixed",X=C$($,!0,Q,Z),z={scrollLeft:0,scrollTop:0},G=d9(0);if(H||!Q){if(R2(Z)!=="body"||aB(B))z=oB(Z);if(H){let K=C$(Z,!0,Q,Z);G.x=K.x+Z.clientLeft,G.y=K.y+Z.clientTop}}if(!H&&B)G.x=oG(B);let U=B&&!H&&!Q?cE(B,z):d9(0),Y=X.left+z.scrollLeft-G.x-U.x,F=X.top+z.scrollTop-G.y-U.y;return{x:Y,y:F,width:X.width,height:X.height}}function MD($){return d2($).position==="static"}function fE($,Z){if(!L1($)||d2($).position==="fixed")return null;if(Z)return Z($);let J=$.offsetParent;if(l3($)===J)J=J.ownerDocument.body;return J}function dE($,Z){let J=k1($);if(aG($))return J;if(!L1($)){let B=v8($);while(B&&!h8(B)){if(s0(B)&&!MD(B))return B;B=v8(B)}return J}let H=fE($,Z);while(H&&gE(H)&&MD(H))H=fE(H,Z);if(H&&h8(H)&&MD(H)&&!_D(H))return J;return H||mE($)||J}var j50=async function($){let Z=this.getOffsetParent||dE,J=this.getDimensions,H=await J($.floating);return{reference:T50($.reference,await Z($.floating),$.strategy),floating:{x:0,y:0,width:H.width,height:H.height}}};function C50($){return d2($).direction==="rtl"}var jD={convertOffsetParentRelativeRectToViewportRelativeRect:q50,getDocumentElement:l3,getClippingRect:_50,getOffsetParent:dE,getElementRects:j50,getClientRects:A50,getDimensions:O50,getScale:HJ,isElement:s0,isRTL:C50};function lE($,Z){return $.x===Z.x&&$.y===Z.y&&$.width===Z.width&&$.height===Z.height}function E50($,Z,J){let H=null,B,Q=l3($);function X(){var Y;clearTimeout(B),(Y=H)==null||Y.disconnect(),H=null}function z(Y,F){if(Y===void 0)Y=!1;if(F===void 0)F=1;X();let K=$.getBoundingClientRect(),{left:W,top:N,width:q,height:D}=K;if(!Y)Z();if(!q||!D)return;let A=gB(N),V=gB(Q.clientWidth-(W+q)),L=gB(Q.clientHeight-(N+D)),O=gB(W),_={rootMargin:-A+"px "+-V+"px "+-L+"px "+-O+"px",threshold:z9(0,j6(1,F))||1},w=!0;function C(E){let T=E[0].intersectionRatio;if(!lE(K,$.getBoundingClientRect()))return z();if(T!==F){if(!w)return z();if(!T)B=setTimeout(()=>{z(!1,0.0000001)},1000);else z(!1,T)}w=!1}try{H=new IntersectionObserver(C,{..._,root:Q.ownerDocument})}catch(E){H=new IntersectionObserver(C,_)}H.observe($)}let G=k1($),U=()=>z(J);return G.addEventListener("resize",U),z(!0),()=>{G.removeEventListener("resize",U),X()}}function nB($,Z,J,H){if(H===void 0)H={};let{ancestorScroll:B=!0,ancestorResize:Q=!0,elementResize:X=typeof ResizeObserver==="function",layoutShift:z=typeof IntersectionObserver==="function",animationFrame:G=!1}=H,U=TD($),Y=B||Q?[...U?BJ(U):[],...Z?BJ(Z):[]]:[];Y.forEach((A)=>{B&&A.addEventListener("scroll",J),Q&&A.addEventListener("resize",J)});let F=U&&z?E50(U,J,Q):null,K=-1,W=null;if(X){if(W=new ResizeObserver((A)=>{let[V]=A;if(V&&V.target===U&&W&&Z)W.unobserve(Z),cancelAnimationFrame(K),K=requestAnimationFrame(()=>{var L;(L=W)==null||L.observe(Z)});J()}),U&&!G)W.observe(U);if(Z)W.observe(Z)}let N,q=G?C$($):null;if(G)D();function D(){let A=C$($);if(q&&!lE(q,A))J();q=A,N=requestAnimationFrame(D)}return J(),()=>{var A;if(Y.forEach((V)=>{B&&V.removeEventListener("scroll",J),Q&&V.removeEventListener("resize",J)}),F==null||F(),(A=W)==null||A.disconnect(),W=null,G)cancelAnimationFrame(N)}}var iE=kE;var rE=yE,aE=RE,oE=hE;var nE=xE,nG=($,Z,J)=>{let H=new Map,B=J!=null?J:{},Q={...jD,...B.platform,_c:H};return SE($,Z,{...B,platform:Q})};var F2=P(m(),1),tE=P(m(),1),eE=P(A8(),1),w50=typeof document<"u",S50=function(){},sG=w50?tE.useLayoutEffect:S50;function tG($,Z){if($===Z)return!0;if(typeof $!==typeof Z)return!1;if(typeof $==="function"&&$.toString()===Z.toString())return!0;let J,H,B;if($&&Z&&typeof $==="object"){if(Array.isArray($)){if(J=$.length,J!==Z.length)return!1;for(H=J;H--!==0;)if(!tG($[H],Z[H]))return!1;return!0}if(B=Object.keys($),J=B.length,J!==Object.keys(Z).length)return!1;for(H=J;H--!==0;)if(!{}.hasOwnProperty.call(Z,B[H]))return!1;for(H=J;H--!==0;){let Q=B[H];if(Q==="_owner"&&$.$$typeof)continue;if(!tG($[Q],Z[Q]))return!1}return!0}return $!==$&&Z!==Z}function $b($){if(typeof window>"u")return 1;return($.ownerDocument.defaultView||window).devicePixelRatio||1}function sE($,Z){let J=$b($);return Math.round(Z*J)/J}function CD($){let Z=F2.useRef($);return sG(()=>{Z.current=$}),Z}function Zb($){if($===void 0)$={};let{placement:Z="bottom",strategy:J="absolute",middleware:H=[],platform:B,elements:{reference:Q,floating:X}={},transform:z=!0,whileElementsMounted:G,open:U}=$,[Y,F]=F2.useState({x:0,y:0,strategy:J,placement:Z,middlewareData:{},isPositioned:!1}),[K,W]=F2.useState(H);if(!tG(K,H))W(H);let[N,q]=F2.useState(null),[D,A]=F2.useState(null),V=F2.useCallback((v)=>{if(v!==_.current)_.current=v,q(v)},[]),L=F2.useCallback((v)=>{if(v!==w.current)w.current=v,A(v)},[]),O=Q||N,M=X||D,_=F2.useRef(null),w=F2.useRef(null),C=F2.useRef(Y),E=G!=null,T=CD(G),k=CD(B),S=CD(U),I=F2.useCallback(()=>{if(!_.current||!w.current)return;let v={placement:Z,strategy:J,middleware:K};if(k.current)v.platform=k.current;nG(_.current,w.current,v).then((f)=>{let b={...f,isPositioned:S.current!==!1};if(j.current&&!tG(C.current,b))C.current=b,eE.flushSync(()=>{F(b)})})},[K,Z,J,k,S]);sG(()=>{if(U===!1&&C.current.isPositioned)C.current.isPositioned=!1,F((v)=>({...v,isPositioned:!1}))},[U]);let j=F2.useRef(!1);sG(()=>{return j.current=!0,()=>{j.current=!1}},[]),sG(()=>{if(O)_.current=O;if(M)w.current=M;if(O&&M){if(T.current)return T.current(O,M,I);I()}},[O,M,I,T,E]);let y=F2.useMemo(()=>({reference:_,floating:w,setReference:V,setFloating:L}),[V,L]),R=F2.useMemo(()=>({reference:O,floating:M}),[O,M]),x=F2.useMemo(()=>{let v={position:J,left:0,top:0};if(!R.floating)return v;let f=sE(R.floating,Y.x),b=sE(R.floating,Y.y);if(z)return{...v,transform:"translate("+f+"px, "+b+"px)",...$b(R.floating)>=1.5&&{willChange:"transform"}};return{position:J,left:f,top:b}},[J,z,R.floating,Y.x,Y.y]);return F2.useMemo(()=>({...Y,update:I,refs:y,elements:R,floatingStyles:x}),[Y,I,y,R,x])}var ED=($,Z)=>{let J=iE($);return{name:J.name,fn:J.fn,options:[$,Z]}},bD=($,Z)=>{let J=rE($);return{name:J.name,fn:J.fn,options:[$,Z]}},wD=($,Z)=>{return{fn:nE($).fn,options:[$,Z]}},SD=($,Z)=>{let J=aE($);return{name:J.name,fn:J.fn,options:[$,Z]}},RD=($,Z)=>{let J=oE($);return{name:J.name,fn:J.fn,options:[$,Z]}};var Y4=P(m(),1);function Jb($){return R50($,$.rootContext)}function R50($,Z){let{nodeId:J,externalTree:H}=$,B=Z.useState("referenceElement"),Q=Z.useState("floatingElement"),X=Z.useState("domReferenceElement"),z=Z.useState("open"),G=Z.useState("floatingId"),[U,Y]=Y4.useState(null),[F,K]=Y4.useState(void 0),[W,N]=Y4.useState(void 0),q=Y4.useRef(null),D=G4(H),A=Y4.useMemo(()=>({reference:B,floating:Q,domReference:X}),[B,Q,X]),V=Zb({...$,elements:{...A,...U&&{reference:U}}}),L=s0(F)?F:null,O=W===void 0?Z.state.floatingElement:W;Z.useSyncedValue("referenceElement",F??null),Z.useSyncedValue("domReferenceElement",F===void 0?X:L),Z.useSyncedValue("floatingElement",O);let M=Y4.useCallback((k)=>{let S=s0(k)?{getBoundingClientRect:()=>k.getBoundingClientRect(),getClientRects:()=>k.getClientRects(),contextElement:k}:k;Y(S),V.refs.setReference(S)},[V.refs]),_=Y4.useCallback((k)=>{if(s0(k)||k===null)q.current=k,K(k);if(s0(V.refs.reference.current)||V.refs.reference.current===null||k!==null&&!s0(k))V.refs.setReference(k)},[V.refs,K]),w=Y4.useCallback((k)=>{N(k),V.refs.setFloating(k)},[V.refs]),C=Y4.useMemo(()=>({...V.refs,setReference:_,setFloating:w,setPositionReference:M,domReference:q}),[V.refs,_,w,M]),E=Y4.useMemo(()=>({...V.elements,domReference:X}),[V.elements,X]),T=Y4.useMemo(()=>({...V,dataRef:Z.context.dataRef,open:z,onOpenChange:Z.setOpen,events:Z.context.events,floatingId:G,refs:C,elements:E,nodeId:J,rootStore:Z}),[V,C,E,J,Z,z,G]);return H0(()=>{if(X)q.current=X},[X]),H0(()=>{Z.context.dataRef.current.floatingContext=T;let k=D?.nodesRef.current.find((S)=>S.id===J);if(k)k.context=T}),Y4.useMemo(()=>({...V,context:T,refs:C,elements:E,rootStore:Z}),[V,C,E,T,Z])}var eG=P(m(),1),I50=eG.createContext(void 0);function $8(){return eG.useContext(I50)?.direction??"ltr"}var k50=($)=>({name:"arrow",options:$,async fn(Z){let{x:J,y:H,placement:B,rects:Q,platform:X,elements:z,middlewareData:G}=Z,{element:U,padding:Y=0,offsetParent:F="real"}=l9($,Z)||{};if(U==null)return{};let K=KG(Y),W={x:J,y:H},N=uB(B),q=mB(N),D=await X.getDimensions(U),A=N==="y",V=A?"top":"left",L=A?"bottom":"right",O=A?"clientHeight":"clientWidth",M=Q.reference[q]+Q.reference[N]-W[N]-Q.floating[q],_=W[N]-Q.reference[N],w=F==="real"?await X.getOffsetParent?.(U):z.floating,C=z.floating[O]||Q.floating[q];if(!C||!await X.isElement?.(w))C=z.floating[O]||Q.floating[q];let E=M/2-_/2,T=C/2-D[q]/2-1,k=Math.min(K[V],T),S=Math.min(K[L],T),I=k,j=C-D[q]-S,y=C/2-D[q]/2+E,R=YG(I,y,j),x=!G.arrow&&I8(B)!=null&&y!==R&&Q.reference[q]/2-(y<I?k:S)-D[q]/2<0,v=x?y<I?y-I:y-j:0;return{[N]:W[N]+v,data:{[N]:R,centerOffset:y-R-v,...x&&{alignmentOffset:v}},reset:x}}}),Hb=($,Z)=>{let{name:J,fn:H}=k50($);return{name:J,fn:H,options:[$,Z]}};var Bb={name:"hide",async fn($){let{width:Z,height:J,x:H,y:B}=$.rects.reference,Q=Z===0&&J===0&&H===0&&B===0,X=await $.platform.detectOverflow($,{elementContext:"reference"});return{data:{referenceHidden:X.top-J>=0||X.right-Z>=0||X.bottom-J>=0||X.left-Z>=0||Q}}}};var QJ={sideX:"left",sideY:"top"};var $U="--available-width",ZU="--available-height",Qb="--anchor-width",Xb="--anchor-height",zb="--transform-origin",Gb="--positioner-width",Ub="--positioner-height";var Fb=$U,Kb=ZU;function qb($,Z,J){let H=$==="inline-start"||$==="inline-end";return{top:"top",right:H?J?"inline-start":"inline-end":"right",bottom:"bottom",left:H?J?"inline-end":"inline-start":"left"}[Z]}function Wb($,Z,J){let{rects:H,placement:B}=$;return{side:qb(Z,z4(B),J),align:I8(B)||"center",anchor:{width:H.reference.width,height:H.reference.height},positioner:{width:H.floating.width,height:H.floating.height}}}function H3($){return y50($,Jb)}function y50($,Z){let{anchor:J,positionMethod:H="absolute",side:B="bottom",sideOffset:Q=0,align:X="center",alignOffset:z=0,collisionBoundary:G,collisionPadding:U=5,sticky:Y=!1,arrowPadding:F=5,disableAnchorTracking:K=!1,inline:W,keepMounted:N=!1,floatingRootContext:q,mounted:D,collisionAvoidance:A,shift:V,nodeId:L,adaptiveOrigin:O,lazyFlip:M=!1,externalTree:_}=$,[w,C]=D8.useState(null);if(!D&&w!==null)C(null);let E=A.side||"flip",T=A.align||"flip",k=A.fallbackAxisSide||"end",S=V?.crossAxis??!1,I=V?.rootBoundary,j=typeof J==="function"?J:void 0,y=Y0(j),R=j?y:J,x=N5(J),v=N5(D),b=$8()==="rtl",l=w||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":b?"left":"right","inline-start":b?"right":"left"}[B],r=X==="center"?l:`${l}-${X}`,h=U;if(typeof h==="number")h={top:h,right:h,bottom:h,left:h};else if(h)h={top:h.top||0,right:h.right||0,bottom:h.bottom||0,left:h.left||0};let d=1,o=B==="bottom"?d:0,c=B==="top"?d:0,i=B==="right"?d:0,n=B==="left"?d:0,Z0={boundary:G==="clipping-ancestors"?"clippingAncestors":G,padding:h},J0=D8.useRef(null),U0=N5(Q),z0=N5(z),X0=typeof Q!=="function"?Q:0,N0=typeof z!=="function"?z:0,q0=[];if(W)q0.push(W);q0.push(ED((C0)=>{let p0=Wb(C0,B,b),r0=typeof U0.current==="function"?U0.current(p0):U0.current,n0=typeof z0.current==="function"?z0.current(p0):z0.current;return{mainAxis:r0,crossAxis:n0,alignmentAxis:n0}},[X0,N0,b,B]));let K0=T==="none"&&E!=="shift",s=!K0&&(Y||S||E==="shift"),a=E==="none"?null:SD({...Z0,padding:{top:h.top+d+o,right:h.right+d+n,bottom:h.bottom+d+c,left:h.left+d+i},mainAxis:!S&&E==="flip",crossAxis:T==="flip"?"alignment":!1,fallbackAxisSideDirection:k}),$0=K0?null:bD({...Z0,rootBoundary:I,mainAxis:T!=="none",crossAxis:s,limiter:Y||S?void 0:wD((C0)=>{if(!J0.current)return{};let{width:p0,height:r0}=J0.current.getBoundingClientRect(),n0=n4(z4(C0.placement)),D0=n0==="y"?p0:r0,y0=n0==="y"?h.left+h.right:h.top+h.bottom;return{offset:D0/2+y0/2}})},[Z0,Y,S,I,h,T]);if(E==="shift"||T==="shift"||X==="center")q0.push($0,a);else q0.push(a,$0);q0.push(RD({...Z0,apply({elements:{floating:C0},availableWidth:p0,availableHeight:r0,rects:n0}){if(!v.current)return;let D0=C0.style;D0.setProperty(Fb,`${p0}px`),D0.setProperty(Kb,`${r0}px`);let y0=k1(C0).devicePixelRatio||1,{x:K1,y:I1,width:f0,height:e0}=n0.reference,O1=(Math.round((K1+f0)*y0)-Math.round(K1*y0))/y0,j1=(Math.round((I1+e0)*y0)-Math.round(I1*y0))/y0;D0.setProperty(Qb,`${O1}px`),D0.setProperty(Xb,`${j1}px`)}}),Hb((C0)=>({element:J0.current||m0(C0.elements.floating).createElement("div"),padding:J0.current?F:0,offsetParent:"floating"}),[F]),{name:"transformOrigin",fn(C0){let{elements:{floating:p0},middlewareData:r0,placement:n0,platform:D0,rects:y0,y:K1}=C0,I1=z4(n0),f0=I8(n0),e0=n4(I1)==="y",O1=J0.current,j1=typeof Q==="function"?Q(Wb(C0,B,b)):Q,x0;if(!O1&&f0&&Math.abs(e0?r0.shift?.x||0:r0.shift?.y||0)<=1)x0=f0==="start"===(e0&&D0.isRTL?.(p0)===!0)?"100%":"0%";else{let i0=e0?r0.arrow?.x||0:r0.arrow?.y||0,P1=e0?O1?.clientWidth||0:O1?.clientHeight||0;x0=`${i0+P1/2}px`}let $1=I1==="top"||I1==="left"?`calc(100% + ${j1}px)`:`${-j1}px`;if(s&&e0&&Math.abs(r0.shift?.y||0)>j1)$1=`${y0.reference.y+y0.reference.height/2-K1}px`;return p0.style.setProperty(zb,e0?`${x0} ${$1}`:`${$1} ${x0}`),{}}},Bb,O),H0(()=>{if(!D&&q)q.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[D,q]);let t=D8.useMemo(()=>({ancestorScroll:!K,elementResize:!K&&typeof ResizeObserver<"u",layoutShift:!K&&typeof IntersectionObserver<"u"}),[K]),{refs:B0,elements:_0,x:P0,y:A0,middlewareData:M0,update:g,placement:p,context:e,isPositioned:W0,floatingStyles:S0}=Z({rootContext:q,open:N?D:void 0,placement:r,middleware:q0,strategy:H,whileElementsMounted:N?void 0:(...C0)=>nB(...C0,t),nodeId:L,externalTree:_}),{sideX:h0,sideY:v0}=M0.adaptiveOrigin||QJ,j0=W0?H:"fixed",c0=D8.useMemo(()=>{let C0;if(!W0)C0={position:j0,top:0,left:0};else if(O)C0={position:j0,[h0]:P0,[v0]:A0};else C0={...S0,position:j0};if(C0[Fb]="100vw",C0[Kb]="100vh",!W0)C0.opacity=0;return C0},[O,j0,h0,P0,v0,A0,S0,W0]),z1=D8.useRef(null);H0(()=>{if(!D)return;let C0=x.current,p0=typeof C0==="function"?C0():C0,n0=(Nb(p0)?p0.current:p0)||null||null;if(n0!==z1.current)B0.setPositionReference(n0),z1.current=n0},[D,B0,R,x]),D8.useEffect(()=>{if(!D)return;let C0=x.current;if(typeof C0==="function")return;if(Nb(C0)&&C0.current!==z1.current)B0.setPositionReference(C0.current),z1.current=C0.current},[D,B0,R,x]),D8.useEffect(()=>{if(N&&D&&_0.reference&&_0.floating)return nB(_0.reference,_0.floating,g,t);return},[N,D,_0,g,t]);let A1=z4(p),l0=qb(B,A1,b),k0=I8(p)||"center",R1=Boolean(M0.hide?.referenceHidden);H0(()=>{if(M&&D&&W0&&A1!==l)C(A1)},[M,D,W0,A1,l]);let Y1=D8.useMemo(()=>({position:"absolute",top:M0.arrow?.y,left:M0.arrow?.x}),[M0.arrow]),U5=M0.arrow?.centerOffset!==0;return D8.useMemo(()=>({positionerStyles:c0,arrowStyles:Y1,arrowRef:J0,arrowUncentered:U5,side:l0,align:k0,physicalSide:A1,anchorHidden:R1,refs:B0,context:e,isPositioned:W0,update:g}),[c0,Y1,J0,U5,l0,k0,A1,R1,B0,e,W0,g])}function Nb($){return $!=null&&"current"in $}var JU=P(m(),1),ID=JU.createContext(void 0);function Ab(){let $=JU.useContext(ID);if($===void 0)throw Error(I0(84));return $}function B3($){return $==="starting"?DC:D1}function Q3($,Z,{styles:J,transitionStatus:H,props:B,refs:Q,hidden:X,inert:z=!1}){let G={...J};if(z)G.pointerEvents="none";return G0("div",$,{state:Z,ref:Q,props:[{role:"presentation",hidden:X,style:G},B3(H),B],stateAttributesMapping:N8})}var Db=P(u(),1),Vb=HU.forwardRef(function(Z,J){let{toast:H,...B}=Z,Q=m9(),X=H.positionerProps??D1,{render:z,className:G,anchor:U=X.anchor,positionMethod:Y=X.positionMethod??"absolute",side:F=X.side??"top",align:K=X.align??"center",sideOffset:W=X.sideOffset??0,alignOffset:N=X.alignOffset??0,collisionBoundary:q=X.collisionBoundary??"clipping-ancestors",collisionPadding:D=X.collisionPadding??5,arrowPadding:A=X.arrowPadding??5,sticky:V=X.sticky??!1,disableAnchorTracking:L=X.disableAnchorTracking??!1,collisionAvoidance:O=X.collisionAvoidance??i9,style:M,..._}=B,[w,C]=HU.useState(null),E=Q.useState("toastIndex",H.id),T=Q.useState("toastVisibleIndex",H.id),k=s0(U)?U:null,S=WD({open:!0,onOpenChange:G1,elements:{floating:w,reference:k}}),I=H3({anchor:k,positionMethod:Y,floatingRootContext:S,mounted:!0,side:F,sideOffset:W,align:K,alignOffset:N,collisionBoundary:q,collisionPadding:D,sticky:V,arrowPadding:A,disableAnchorTracking:L,keepMounted:!0,collisionAvoidance:O}),j={side:I.side,align:I.align,anchorHidden:I.anchorHidden},y=Q3(Z,j,{styles:{...I.positionerStyles,[TG]:H.transitionStatus==="ending"?E:T},transitionStatus:H.transitionStatus,props:_,refs:[J,C]});return Db.jsx(ID.Provider,{value:I,children:y})});var Lb=P(m(),1);var Mb=Lb.forwardRef(function(Z,J){let{className:H,render:B,style:Q,...X}=Z,{arrowRef:z,side:G,align:U,arrowUncentered:Y,arrowStyles:F}=Ab();return G0("div",Z,{state:{side:G,align:U,uncentered:Y},ref:[J,z],props:[{style:F,"aria-hidden":!0},X]})});var Pb=P(m(),1);function _b(){let $=m9(),Z=$.useState("toasts");return Pb.useMemo(()=>({toasts:Z,add:$.addToast,close:$.closeToast,update:$.updateToast,promise:$.promiseToast}),[Z,$])}function Ob(){let $=new Set;function Z(J){$.forEach((H)=>H(J))}return{" subscribe":function(H){return $.add(H),()=>{$.delete(H)}},add(J){let H=J.id||HG("toast"),B={...J,id:H,transitionStatus:"starting"};return Z({action:"add",options:B}),H},close(J){Z({action:"close",options:{id:J}})},update(J,H){Z({action:"update",options:{id:J,updates:H}})},promise(J,H){let B=J;return Z({action:"promise",options:{...H,promise:J,setPromise(Q){B=Q}}}),B}}}var Q5=P(u(),1),T1=F4.createToastManager();function x50({...$}){return Q5.jsx(F4.Provider,{...$})}function h50({...$}){return Q5.jsx(F4.Portal,{"data-slot":"toast-portal",...$})}function v50({className:$,...Z}){return Q5.jsx(F4.Viewport,{"data-slot":"toast-viewport",className:Q0("pointer-events-none fixed inset-x-4 bottom-4 z-50 mx-auto w-auto max-w-sm outline-none sm:right-4 sm:left-auto sm:mx-0 sm:w-full",$),...Z})}function f50({className:$,...Z}){return Q5.jsx(F4.Root,{"data-slot":"toast",className:Q0("group/toast pointer-events-auto absolute right-0 bottom-0 z-[calc(1000-var(--toast-index))] w-full origin-bottom rounded-xl bg-popover text-popover-foreground shadow-lg will-change-transform outline-none select-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50","[--gap:0.75rem] [--height:var(--toast-frontmost-height,var(--toast-height))] [--offset-y:calc(var(--toast-offset-y)*-1+calc(var(--toast-index)*var(--gap)*-1)+var(--toast-swipe-movement-y))] [--peek:0.75rem] [--scale:calc(max(0,1-(var(--toast-index)*0.1)))] [--shrink:calc(1-var(--scale))]","h-(--height) [transform:translateX(var(--toast-swipe-movement-x))_translateY(calc(var(--toast-swipe-movement-y)-(var(--toast-index)*var(--peek))-(var(--shrink)*var(--height))))_scale(var(--scale))] [transition:transform_500ms_cubic-bezier(0.22,1,0.36,1),opacity_500ms,height_150ms]","after:absolute after:top-full after:left-0 after:h-[calc(var(--gap)+1px)] after:w-full after:content-['']","data-expanded:h-(--toast-height) data-expanded:[transform:translateX(var(--toast-swipe-movement-x))_translateY(var(--offset-y))]","data-limited:opacity-0 data-starting-style:[transform:translateY(150%)]","[&[data-ending-style]:not([data-limited]):not([data-swipe-direction])]:[transform:translateY(150%)]","data-ending-style:data-[swipe-direction=down]:[transform:translateY(calc(var(--toast-swipe-movement-y)+150%))]","data-ending-style:data-[swipe-direction=left]:[transform:translateX(calc(var(--toast-swipe-movement-x)-150%))_translateY(var(--offset-y))]","data-ending-style:data-[swipe-direction=right]:[transform:translateX(calc(var(--toast-swipe-movement-x)+150%))_translateY(var(--offset-y))]","data-ending-style:data-[swipe-direction=up]:[transform:translateY(calc(var(--toast-swipe-movement-y)-150%))]","data-expanded:data-ending-style:data-[swipe-direction=down]:[transform:translateY(calc(var(--toast-swipe-movement-y)+150%))]","data-expanded:data-ending-style:data-[swipe-direction=left]:[transform:translateX(calc(var(--toast-swipe-movement-x)-150%))_translateY(var(--offset-y))]","data-expanded:data-ending-style:data-[swipe-direction=right]:[transform:translateX(calc(var(--toast-swipe-movement-x)+150%))_translateY(var(--offset-y))]","data-expanded:data-ending-style:data-[swipe-direction=up]:[transform:translateY(calc(var(--toast-swipe-movement-y)-150%))]",$),...Z})}function g50({className:$,...Z}){return Q5.jsx(F4.Content,{"data-slot":"toast-content",className:Q0("flex items-center gap-3 overflow-hidden p-4 transition-opacity duration-250 ease-[cubic-bezier(0.22,1,0.36,1)] data-behind:opacity-0 data-expanded:opacity-100",$),...Z})}function m50({className:$,...Z}){return Q5.jsx(F4.Title,{"data-slot":"toast-title",className:Q0("text-sm font-medium",$),...Z})}function u50({className:$,...Z}){return Q5.jsx(F4.Description,{"data-slot":"toast-description",className:Q0("text-sm text-muted-foreground",$),...Z})}function p50({className:$,render:Z=Q5.jsx(L0,{variant:"outline",size:"sm"}),...J}){return Q5.jsx(F4.Action,{"data-slot":"toast-action",render:Z,className:Q0("shrink-0",$),...J})}function c50({className:$,children:Z,render:J=Q5.jsx(L0,{variant:"ghost",size:"icon-sm"}),...H}){return Q5.jsx(F4.Close,{"data-slot":"toast-close","aria-label":"Close toast",render:J,className:Q0("relative shrink-0 text-muted-foreground after:absolute after:-inset-2 after:content-[''] hover:text-foreground",$),...H,children:Z??Q5.jsx(i5,{"aria-hidden":"true",stroke:1.75})})}function d50({type:$}){let Z=null;if($==="success")Z=Q5.jsx(jb,{"aria-hidden":"true",stroke:1.75});if($==="info")Z=Q5.jsx(Cb,{"aria-hidden":"true",stroke:1.75});if($==="warning")Z=Q5.jsx(BU,{"aria-hidden":"true",stroke:1.75});if($==="error")Z=Q5.jsx(Tb,{className:"text-destructive","aria-hidden":"true",stroke:1.75});if($==="loading")Z=Q5.jsx(Eb,{className:"animate-spin","aria-hidden":"true",stroke:1.75});if(!Z)return null;return Q5.jsx("span",{"data-slot":"toast-icon",className:"shrink-0 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4",children:Z})}function l50(){let{toasts:$}=F4.useToastManager();return $.map((Z)=>Q5.jsx(f50,{toast:Z,children:Q5.jsxs(g50,{children:[Q5.jsx(d50,{type:Z.type}),Q5.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[Q5.jsx(m50,{}),Q5.jsx(u50,{})]}),Q5.jsx(p50,{}),Q5.jsx(c50,{})]})},Z.id))}function bb({children:$,toastManager:Z=T1,...J}){return Q5.jsxs(x50,{toastManager:Z,...J,children:[$,Q5.jsx(h50,{children:Q5.jsx(v50,{children:Q5.jsx(l50,{})})})]})}var cE0=F4.createToastManager,dE0=F4.useToastManager;var i3={};k5(i3,{createHandle:()=>Gw,Viewport:()=>zw,Trigger:()=>gb,Root:()=>yb,Provider:()=>nb,Positioner:()=>db,Portal:()=>pb,Popup:()=>ib,Handle:()=>WU,Arrow:()=>ab});var XJ=P(m(),1);var QU=P(m(),1),kD=QU.createContext(void 0);function f8($){let Z=QU.useContext(kD);if(Z===void 0&&!$)throw Error(I0(72));return Z}var wb=P(m(),1);class A9 extends p2{setState($){}update($){}set($,Z){}notifyAll(){}}var Sb={...$3,disabled:($)=>$.disabled,instantType:($)=>$.instantType,isInstantPhase:($)=>$.isInstantPhase,trackCursorAxis:($)=>$.trackCursorAxis,disableHoverablePopup:($)=>$.disableHoverablePopup,lastOpenChangeReason:($)=>$.openChangeReason,closeOnClick:($)=>$.closeOnClick,closeDelay:($)=>$.closeDelay,adaptiveOrigin:($)=>$.adaptiveOrigin};class yD extends p2{constructor($,Z,J){let H=new y2;super(Ib($,H,Z,J),kb(H),Sb)}setOpen=($,Z)=>{gG(this,$,Z,{extraState:{openChangeReason:Z.reason}})};cancelPendingOpen($){this.state.floatingRootContext.dispatchOpenChange(!1,w0(F0.triggerPress,$))}}function Rb(){let $=new y2,Z=new A9(Object.freeze(Ib(void 0,$)),Object.freeze(kb($)),Sb);return Object.assign(Z,{setOpen:G1,cancelPendingOpen:G1})}function Ib($,Z,J,H=!1){return{...e9(Z,J,H),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:"none",disableHoverablePopup:!1,openChangeReason:null,closeOnClick:!0,closeDelay:0,adaptiveOrigin:void 0,...$}}function kb($){return{popupRef:wb.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:$}}var sB=P(u(),1),yb=X9(function(Z){let{disabled:J=!1,defaultOpen:H=!1,open:B,disableHoverablePopup:Q=!1,trackCursorAxis:X="none",actionsRef:z,onOpenChange:G,onOpenChangeComplete:U,handle:Y,triggerId:F,defaultTriggerId:K=null,children:W}=Z,N=R6((k,S)=>new yD({open:H,openProp:B,activeTriggerId:K,triggerIdProp:F},k,S));N.useControlledProp("openProp",B),N.useControlledProp("triggerIdProp",F),N.useContextCallback("onOpenChange",G),N.useContextCallback("onOpenChangeComplete",U);let q=N.useState("open"),D=!J&&q,A=N.useState("activeTriggerId"),V=N.useState("mounted"),L=N.useState("payload");N.useSyncedValues({trackCursorAxis:X,disableHoverablePopup:Q,disabled:J}),n9(N,{closeOnActiveTriggerUnmount:!0});let{forceUnmount:O,transitionStatus:M}=s9(D,N),_=N.useState("isInstantPhase"),w=N.useState("instantType"),C=N.useState("lastOpenChangeReason"),E=XJ.useRef(null);H0(()=>{if(q&&J)N.setOpen(!1,w0(F0.disabled))},[q,J,N]),H0(()=>{if(M==="ending"&&C===F0.none||M!=="ending"&&_){if(w!=="delay")E.current=w;N.set("instantType","delay")}else if(E.current!==null)N.set("instantType",E.current),E.current=null},[M,_,C,w,N]),H0(()=>{if(D){if(A==null)N.set("payload",void 0)}},[N,A,D]),XJ.useImperativeHandle(z,()=>({unmount:O,close:()=>N.setOpen(!1,w0(F0.imperativeAction))}),[O,N]);let T=D||V||!J&&X!=="none";return sB.jsxs(kD.Provider,{value:N,children:[Y&&sB.jsx(a9,{handle:Y,store:N}),T&&sB.jsx(i50,{store:N,disabled:J,trackCursorAxis:X}),typeof W==="function"?W({payload:L}):W]})});function i50({store:$,disabled:Z,trackCursorAxis:J}){let H=$.useState("floatingRootContext"),B=K9(H,{enabled:!Z,referencePress:()=>$.select("closeOnClick")}),Q=XD(H,{enabled:!Z&&J!=="none",axis:J==="none"?void 0:J}),X=XJ.useMemo(()=>K2(Q.reference,B.reference),[Q.reference,B.reference]);return t9($,{activeTriggerProps:X,inactiveTriggerProps:X,popupProps:B.floating??D1}),null}var zU=P(m(),1);function t0($){return k4($,"base-ui")}var XU=P(m(),1),xD=XU.createContext(void 0);function xb(){return XU.useContext(xD)}var hb=600;var fb="data-base-ui-tooltip-trigger";function vb($){if("composedPath"in $){let J=$.composedPath();for(let H=0;H<J.length;H+=1){let B=J[H];if(s0(B))return B}}let Z=$.target;if(s0(Z))return Z;return null}function r50($){let Z=$;while(Z){let J=Z.closest(`[${fb}]`);if(J)return J;let H=Z.getRootNode();Z="host"in H&&s0(H.host)?H.host:null}return null}var gb=u9(function(Z,J){let{render:H,className:B,style:Q,handle:X,payload:z,disabled:G,delay:U,closeOnClick:Y=!0,closeDelay:F,id:K,...W}=Z,N=f8(!0),D=Z3(X)??N;if(!D)throw Error(I0(82));let A=t0(K),V=D.useState("isTriggerActive",A),L=D.useState("isOpenedByTrigger",A),O=D.useState("floatingRootContext"),M=zU.useRef(null),_=F??0,{registerTrigger:w,isMountedByThisTrigger:C}=o9(A,M,D,{payload:z,closeOnClick:Y,closeDelay:_}),E=xb(),{activeIdRef:T,delayRef:k,isInstantPhase:S,hasProvider:I}=eA(O,{open:L}),j=JJ(O);D.useSyncedValue("isInstantPhase",S);let y=D.useState("disabled"),R=G??y,x=N5(R),v=D.useState("trackCursorAxis"),f=D.useState("disableHoverablePopup"),b=zU.useRef(!1),l=s1(),r=zU.useRef(void 0);function h(){if(I&&T.current!=null)return 0;return U??E??hb}function d(X0){let N0=M.current;if(!N0||!X0)return!1;let q0=r50(X0);return q0!==null&&q0!==N0&&R0(N0,q0)}function o(X0){let N0=d(X0);if(b.current=N0,N0)j.openChangeTimeout.clear(),j.restTimeout.clear(),j.restTimeoutPending=!1,l.clear();return N0}let c=N9(O,{enabled:!R,mouseOnly:!0,move:!1,handleClose:!f&&v!=="both"?q9():null,restMs:h,delay(){if(F==null&&I)return{close:F9(k.current,"close")};return{close:_}},triggerElementRef:M,isActiveTrigger:V,isClosing:()=>D.select("transitionStatus")==="ending",shouldOpen(){return!b.current}}),i=T$(O,{enabled:!R}).reference,n=(X0)=>{let N0=b.current,q0=vb(X0),K0=o(q0),s=M.current,a=s&&q0&&R0(s,q0);if(K0&&D.select("open")&&D.select("lastOpenChangeReason")===F0.triggerHover){D.setOpen(!1,w0(F0.triggerHover,X0));return}if(N0&&!K0&&a&&!x.current&&!D.select("open")&&s&&q8(r.current)){let $0=()=>{if(!b.current&&!x.current&&!D.select("open"))D.setOpen(!0,w0(F0.triggerHover,X0,s))},t=h();if(t===0)l.clear(),$0();else l.start(t,$0)}},Z0=D.useState("triggerProps",C);return G0("button",Z,{state:{open:L},ref:[J,w,M],props:[c,i,C||v!=="none"?Z0:void 0,{onMouseOver(X0){n(X0.nativeEvent)},onFocus(X0){if(d(vb(X0.nativeEvent)))X0.preventBaseUIHandler()},onMouseLeave(){b.current=!1,l.clear(),r.current=void 0},onPointerEnter(X0){r.current=X0.pointerType},onPointerDown(X0){if(r.current=X0.pointerType,D.set("closeOnClick",Y),Y&&!D.select("open"))D.cancelPendingOpen(X0.nativeEvent)},onClick(X0){if(Y&&!D.select("open"))D.cancelPendingOpen(X0.nativeEvent)},id:A,[xB]:R?"":void 0,[fb]:R?void 0:""},W],stateAttributesMapping:p9})});var ub=P(m(),1);var GU=P(m(),1),hD=GU.createContext(void 0);function mb(){let $=GU.useContext(hD);if($===void 0)throw Error(I0(70));return $}var vD=P(u(),1),pb=ub.forwardRef(function(Z,J){let{keepMounted:H=!1,...B}=Z;if(!(f8().useState("mounted")||H))return null;return vD.jsx(hD.Provider,{value:H,children:vD.jsx(eZ,{ref:J,...B})})});var YU=P(m(),1);var UU=P(m(),1),fD=UU.createContext(void 0);function zJ(){let $=UU.useContext(fD);if($===void 0)throw Error(I0(71));return $}var cb=P(u(),1),db=YU.forwardRef(function(Z,J){let{render:H,className:B,anchor:Q,positionMethod:X="absolute",side:z="top",align:G="center",sideOffset:U=0,alignOffset:Y=0,collisionBoundary:F="clipping-ancestors",collisionPadding:K=5,arrowPadding:W=5,sticky:N=!1,disableAnchorTracking:q=!1,collisionAvoidance:D=i9,style:A,...V}=Z,L=f8(),O=mb(),M=L.useState("open"),_=L.useState("mounted"),w=L.useState("trackCursorAxis"),C=L.useState("disableHoverablePopup"),E=L.useState("floatingRootContext"),T=L.useState("instantType"),k=L.useState("transitionStatus"),S=L.useState("adaptiveOrigin"),I=H3({anchor:Q,positionMethod:X,floatingRootContext:E,mounted:_,side:z,sideOffset:U,align:G,alignOffset:Y,collisionBoundary:F,collisionPadding:K,sticky:N,arrowPadding:W,disableAnchorTracking:q,keepMounted:O,collisionAvoidance:D,adaptiveOrigin:S}),j=YU.useMemo(()=>({open:M,side:I.side,align:I.align,anchorHidden:I.anchorHidden,instant:w!=="none"?"tracking-cursor":T}),[M,I.side,I.align,I.anchorHidden,w,T]),y=Q3(Z,j,{styles:I.positionerStyles,transitionStatus:k,props:V,refs:[J,L.useStateSetter("positionerElement")],hidden:!_,inert:!M||w==="both"||C});return cb.jsx(fD.Provider,{value:I,children:y})});var lb=P(m(),1);var ib=lb.forwardRef(function(Z,J){let{render:H,className:B,style:Q,...X}=Z,z=f8(),{side:G,align:U}=zJ(),Y=z.useState("open"),F=z.useState("instantType"),K=z.useState("transitionStatus"),W=z.useState("popupProps"),N=z.useState("floatingRootContext"),q=z.useState("disabled"),D=z.useState("closeDelay");L5({open:Y,ref:z.context.popupRef,onComplete(){if(Y)z.context.onOpenChangeComplete?.(!0)}}),d3(N,{enabled:!q,closeDelay:D});let A=z.useStateSetter("popupElement");return G0("div",Z,{state:{open:Y,side:G,align:U,instant:F,transitionStatus:K},ref:[J,z.context.popupRef,A],props:[r9,W,B3(K),X],stateAttributesMapping:X4})});var rb=P(m(),1);var ab=rb.forwardRef(function(Z,J){let{render:H,className:B,style:Q,...X}=Z,z=f8(),{arrowRef:G,side:U,align:Y,arrowUncentered:F,arrowStyles:K}=zJ(),W=z.useState("open"),N=z.useState("instantType");return G0("div",Z,{state:{open:W,side:U,align:Y,uncentered:F,instant:N},ref:[J,G],props:[{style:K,"aria-hidden":!0},X],stateAttributesMapping:N8})});var ob=P(m(),1);var gD=P(u(),1),nb=function(Z){let{delay:J,closeDelay:H,timeout:B=400}=Z,Q=ob.useMemo(()=>({open:J,close:H}),[J,H]);return gD.jsx(xD.Provider,{value:J,children:gD.jsx(tA,{delay:Q,timeoutMs:B,children:Z.children})})};var Xw=P(m(),1);var r2=P(m(),1),Qw=P(A8(),1);var sb=P(m(),1);function tb($){let[Z,J]=sb.useState({current:$,previous:null});if(!Object.is($,Z.current))J({current:$,previous:Z.current});return Z.previous}var UJ=P(m(),1);function GJ($){let Z=d2($),J=parseFloat(Z.width)||0,H=parseFloat(Z.height)||0,B=L1($),Q=B?$.offsetWidth:J,X=B?$.offsetHeight:H;if(C6(J)!==Q||C6(H)!==X)J=Q,H=X;return{width:J,height:H}}var tB="--popup-width",eB="--popup-height";function Zw($){let{popupElement:Z,positionerElement:J,content:H,mounted:B,onMeasureLayout:Q,onMeasureLayoutComplete:X,side:z,direction:G}=$,U=t4(Z,!0),Y=I4(),F=UJ.useRef(null),K=UJ.useRef(!0),W=UJ.useRef(G1),N=Y0(Q),q=Y0(X),D=UJ.useMemo(()=>a50(z,G),[z,G]);H0(()=>{if(!B){W.current=G1,K.current=!0,F.current=null;return}if(!Z||!J)return;W.current=$w(Z,D),mD(Z,"auto");let A=KU(Z,"position","static"),V=KU(Z,"transform","none"),L=KU(Z,"scale","1"),O=$w(J,{[$U]:"max-content",[ZU]:"max-content"});function M(){A(),V(),O()}function _(){M(),L()}if(N?.(),K.current||F.current===null){FU(J,"max-content");let T=GJ(Z);return F.current=T,FU(J,T),_(),q?.(null,T),K.current=!1,()=>{W.current(),W.current=G1}}FU(J,"max-content");let w=F.current,C=GJ(Z);F.current=C,mD(Z,w),_(),q?.(w,C),FU(J,C);let E=new AbortController;return Y.request(()=>{mD(Z,C),U(()=>{Z.style.setProperty(tB,"auto"),Z.style.setProperty(eB,"auto")},E.signal)}),()=>{E.abort(),Y.cancel(),W.current(),W.current=G1}},[H,Z,J,U,Y,B,N,q,D])}function a50($,Z){let J=$==="top",H=$==="left"||$===(Z==="rtl"?"inline-end":"inline-start");if(!J&&!H)return D1;return{position:"absolute",[J?"bottom":"top"]:"0",[H?"right":"left"]:"0"}}function KU($,Z,J){let H=$.style.getPropertyValue(Z);return $.style.setProperty(Z,J),()=>{$.style.setProperty(Z,H)}}function $w($,Z){let J=[];for(let[H,B]of Object.entries(Z))J.push(KU($,H,B));return J.length?()=>{J.forEach((H)=>H())}:G1}function mD($,Z){let J=Z==="auto"?"auto":`${Z.width}px`,H=Z==="auto"?"auto":`${Z.height}px`;$.style.setProperty(tB,J),$.style.setProperty(eB,H)}function FU($,Z){let J=Z==="max-content"?"max-content":`${Z.width}px`,H=Z==="max-content"?"max-content":`${Z.height}px`;$.style.setProperty(Gb,J),$.style.setProperty(Ub,H)}var Jw={name:"adaptiveOrigin",async fn($){let{x:Z,y:J,rects:{floating:H},elements:{floating:B},platform:Q,strategy:X,placement:z}=$,G=k1(B),U=G.getComputedStyle(B);if(!(U.transitionDuration!=="0s"&&U.transitionDuration!==""))return{x:Z,y:J,data:QJ};let F=await Q.getOffsetParent?.(B),K={width:0,height:0};if(X==="fixed"&&G?.visualViewport)K={width:G.visualViewport.width,height:G.visualViewport.height};else if(F===G){let V=m0(B);K={width:V.documentElement.clientWidth,height:V.documentElement.clientHeight}}else if(await Q.isElement?.(F))K=await Q.getDimensions(F);let W=z4(z),N=Z,q=J;if(W==="left")N=K.width-(Z+H.width);if(W==="top")q=K.height-(J+H.height);let D=W==="left"?"right":QJ.sideX,A=W==="top"?"bottom":QJ.sideY;return{x:N,y:q,data:{sideX:D,sideY:A}}}};var Hw="data-activation-direction";var YJ=P(u(),1),k6={activationDirection:($)=>$?{[Hw]:$}:null};function y6($){let{store:Z,side:J,children:H}=$,B=$8(),Q=Z.useState("activeTriggerElement"),X=Z.useState("activeTriggerId"),z=Z.useState("open"),G=Z.useState("payload"),U=Z.useState("mounted"),Y=Z.useState("popupElement"),F=Z.useState("positionerElement"),K=tb(z?Q:null),W=t50(X,G),N=r2.useRef(null),[q,D]=r2.useState(null),[A,V]=r2.useState(null),L=r2.useRef(null),O=r2.useRef(null),M=t4(L,!0),_=I4(),w=r2.useRef(null),[C,E]=r2.useState(null),[T,k]=r2.useState(!1);H0(()=>{return Z.set("adaptiveOrigin",Jw),()=>{Z.set("adaptiveOrigin",void 0)}},[Z]);let S=Y0(()=>{L.current?.style.setProperty("animation","none"),L.current?.style.setProperty("transition","none"),O.current?.style.setProperty("display","none")}),I=Y0((f)=>{if(L.current?.style.removeProperty("animation"),L.current?.style.removeProperty("transition"),O.current?.style.removeProperty("display"),f)E(f)}),j=Y0(()=>{w.current?.abort();let f=new AbortController;w.current=f,M(()=>{D(null),E(null),N.current=null},f.signal)}),y=r2.useRef(null);H0(()=>{if(!z||!U)y.current=null},[z,U]),H0(()=>{if(Q&&K&&Q!==K&&y.current!==Q&&N.current){D(N.current),k(!0);let f=s50(K,Q);V(f),y.current=Q}},[Q,K]),H0(()=>{if(q==null)return;w.current?.abort(),k(!0),_.request(()=>{Qw.flushSync(()=>{k(!1)}),j()})},[W,q,j,_]),H0(()=>{let f=L.current;if(!f)return;let b=m0(f).createElement("div");for(let l of Array.from(f.childNodes))b.appendChild(l.cloneNode(!0));N.current=b});let R=q!=null,x;if(!R)x=YJ.jsx("div",{"data-current":!0,ref:L,children:H},W);else x=YJ.jsxs(r2.Fragment,{children:[YJ.jsx("div",{"data-previous":!0,inert:x8(!0),ref:O,style:{...C?{[tB]:`${C.width}px`,[eB]:`${C.height}px`}:null,position:"absolute"},"data-ending-style":T?void 0:""},"previous"),YJ.jsx("div",{"data-current":!0,ref:L,"data-starting-style":T?"":void 0,children:H},W)]});H0(()=>{let f=O.current;if(!f||!q)return;f.replaceChildren(...Array.from(q.childNodes))},[q]),Zw({popupElement:Y,positionerElement:F,mounted:U,content:G,onMeasureLayout:S,onMeasureLayoutComplete:I,side:J,direction:B});let v={activationDirection:n50(A),transitioning:R};return{children:x,state:v}}function n50($){if(!$)return;return`${Bw($.horizontal,5,"right","left")} ${Bw($.vertical,5,"down","up")}`}function Bw($,Z,J,H){if($>Z)return J;if($<-Z)return H;return""}function s50($,Z){let J=$.getBoundingClientRect(),H=Z.getBoundingClientRect(),B={x:J.left+J.width/2,y:J.top+J.height/2},Q={x:H.left+H.width/2,y:H.top+H.height/2};return{horizontal:Q.x-B.x,vertical:Q.y-B.y}}function t50($,Z){let[J,H]=r2.useState(0),B=r2.useRef($),Q=r2.useRef(Z),X=r2.useRef(!1);return H0(()=>{let z=B.current,G=Q.current,U=$!==z,Y=Z!==G;if(U)H((F)=>F+1),X.current=!Y;else if(X.current&&Y)H((F)=>F+1),X.current=!1;B.current=$,Q.current=Z},[$,Z]),`${$??"current"}-${J}`}var zw=Xw.forwardRef(function(Z,J){let{render:H,className:B,style:Q,children:X,...z}=Z,G=f8(),U=zJ(),Y=G.useState("instantType"),{children:F,state:K}=y6({store:G,side:U.side,children:X}),W={activationDirection:K.activationDirection,transitioning:K.transitioning,instant:Y};return G0("div",Z,{state:W,ref:J,props:[z,{children:F}],stateAttributesMapping:k6})});class WU extends W9{constructor(){super(Rb(),"Tooltip")}open($){this.openByTrigger($)}close(){this.closePopup()}get isOpen(){return this.attachedStore?.select("open")??!1}}function Gw(){return new WU}var NU=P(m(),1),x6=P(u(),1);function g8({portal:$,children:Z,...J}){let[H,B]=NU.useState(void 0),Q=NU.useCallback((X)=>{if(X)B(X.closest("[data-applet]")?.getAttribute("data-applet")??void 0)},[]);return x6.jsxs(x6.Fragment,{children:[x6.jsx("span",{hidden:!0,ref:Q}),x6.jsx($,{...J,children:x6.jsx("div",{"data-applet":H,className:"contents",children:Z})})]})}var E$=P(u(),1);function qU({delay:$=100,...Z}){return E$.jsx(i3.Provider,{"data-slot":"tooltip-provider",delay:$,...Z})}function t1({...$}){return E$.jsx(i3.Root,{"data-slot":"tooltip",...$})}function e1({...$}){return E$.jsx(i3.Trigger,{"data-slot":"tooltip-trigger",...$})}function $5({className:$,side:Z="top",sideOffset:J=6,align:H="center",alignOffset:B=0,children:Q,...X}){return E$.jsx(g8,{portal:i3.Portal,children:E$.jsx(i3.Positioner,{align:H,alignOffset:B,side:Z,sideOffset:J,className:"isolate z-50",children:E$.jsx(i3.Popup,{"data-slot":"tooltip-content",className:d0("z-50 flex w-fit max-w-xs origin-(--transform-origin) items-center gap-1.5 rounded-lg bg-popover px-2.5 py-1.5 text-xs font-medium text-popover-foreground shadow-md has-data-[slot=kbd]:pr-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-lg data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",$),...X,children:Q})})})}function AU({cooldownMs:$,windowMs:Z,maxPerWindow:J,maxKeys:H=256,now:B=Date.now}){let Q=new Map,X=0,z=0;return{admit(G){let U=B(),Y=Q.get(G);if(Y!==void 0&&U-Y<$)return"cooldown";if(U-X>=Z)X=U,z=0;if(z>=J)return"window";if(z++,Q.set(G,U),Q.size>H)for(let F of[...Q.keys()].slice(0,Math.ceil(H/2)))Q.delete(F);return"ok"}}}var e50=AU({cooldownMs:5000,windowMs:60000,maxPerWindow:30});function V8($,Z){let J=[$,Z.source,Z.kind,Z.name,Z.message].join("\x00");if(e50.admit(J)!=="ok")return;fetch(`/api/workspaces/${$}/applet-log`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({events:[Z]})}).catch(()=>{})}var $20=/\/api\/workspaces\/([^/\s)]+)\/(widgets|views)\/([^/\s)]+)\//;function Uw($){if(!$)return null;let Z=$20.exec($);if(!Z)return null;return{workspaceId:Z[1],kind:Z[2]==="widgets"?"widget":"view",name:Z[3]}}var Yw=!1;function Fw(){if(Yw)return;Yw=!0;let $=(Z,J,H)=>{let B=J instanceof Error?J:null,Q=B?.stack??"",X=Z??Uw(Q);if(!X)return;V8(X.workspaceId,{source:"window",kind:X.kind,name:X.name,message:B?.message||H||String(J),...Q?{stack:Q}:{}})};window.addEventListener("error",(Z)=>$(Uw(Z.filename),Z.error,Z.message)),window.addEventListener("unhandledrejection",(Z)=>$(null,Z.reason))}function FJ($){return`${location.protocol==="https:"?"wss":"ws"}://${location.host}${$}`}function KJ($,Z){return`${$}:${Z}`}function $Q($){return $==="running"}function Nw($){return Object.values($).some($Q)}function WJ($,Z,J){return $Q($[KJ(Z,J)])}function VU($,Z){let J=`${Z}:`;return Object.entries($).some(([H,B])=>H.startsWith(J)&&$Q(B))}function L8($,Z){return KJ($,Z??"new")}function DU($,Z,J){for(let[H,B]of Object.entries($)){if(!H.startsWith(`${Z}:`))continue;let Q=B.find((X)=>X.localId===J);if(Q)return{key:H,attachment:Q}}}var x1=Kw()(($)=>({activity:{},errors:{},previews:{},attachments:{},setActivity:(Z,J,H)=>$((B)=>({activity:{...B.activity,[KJ(Z,J)]:H}})),reconcileActivity:(Z)=>$(()=>({activity:Object.fromEntries(Z.map((J)=>[KJ(J.workspaceId,J.sessionId),J.activity]))})),setError:(Z,J,H)=>$((B)=>({errors:{...B.errors,[KJ(Z,J)]:H}})),setPreview:(Z)=>$((J)=>({previews:{...J.previews,[Z.messageId]:{workspaceId:Z.workspaceId,sessionId:Z.sessionId,parentToolUseId:Z.parentToolUseId,blocks:Z.blocks,updatedAt:Date.now()}}})),clearPreview:(Z)=>$((J)=>{if(!(Z in J.previews))return J;let{[Z]:H,...B}=J.previews;return{previews:B}}),clearPreviewsForSession:(Z,J)=>$((H)=>{let B={},Q=!1;for(let[X,z]of Object.entries(H.previews))if(z.workspaceId===Z&&z.sessionId===J)Q=!0;else B[X]=z;return Q?{previews:B}:H}),clearAllPreviews:()=>$((Z)=>Object.keys(Z.previews).length?{previews:{}}:Z),sweepPreviews:(Z,J)=>$((H)=>{let B={},Q=!1;for(let[X,z]of Object.entries(H.previews))if(J-z.updatedAt>Z)Q=!0;else B[X]=z;return Q?{previews:B}:H}),addAttachments:(Z,J,H)=>$((B)=>{let Q=L8(Z,J);return{attachments:{...B.attachments,[Q]:[...B.attachments[Q]??[],...H]}}}),updateAttachment:(Z,J,H)=>$((B)=>{let Q=DU(B.attachments,Z,J);if(!Q)return{};let{key:X,attachment:z}=Q,G=B.attachments[X];if(z.kind!=="text"&&z.previewUrl&&"previewUrl"in H&&H.previewUrl!==z.previewUrl)URL.revokeObjectURL(z.previewUrl);return{attachments:{...B.attachments,[X]:G.map((U)=>U.localId===J&&U.kind!=="text"?{...U,...H}:U)}}}),removeAttachment:(Z,J)=>$((H)=>{let B=DU(H.attachments,Z,J);if(!B)return{};let{key:Q,attachment:X}=B,z=H.attachments[Q];if(X.kind!=="text"&&X.previewUrl)URL.revokeObjectURL(X.previewUrl);return{attachments:{...H.attachments,[Q]:z.filter((G)=>G.localId!==J)}}}),clearAttachments:(Z,J)=>$((H)=>{let B=L8(Z,J);for(let X of H.attachments[B]??[])if(X.kind!=="text"&&X.previewUrl)URL.revokeObjectURL(X.previewUrl);let Q={...H.attachments};return delete Q[B],{attachments:Q}}),renameSession:(Z,J,H)=>$((B)=>{let Q=L8(Z,J),X=KJ(Z,H);if(Q===X)return B;if(!(Q in B.activity)&&!(Q in B.errors)&&!(Q in B.attachments)&&!Object.values(B.previews).some((K)=>K.workspaceId===Z&&K.sessionId===J))return B;let z={...B.activity},G={...B.errors};if(Q in z)z[X]=z[Q],delete z[Q];if(Q in G)G[X]=G[Q],delete G[Q];let U=B.previews,Y=!1;for(let[K,W]of Object.entries(B.previews))if(W.workspaceId===Z&&W.sessionId===J){if(!Y)U={...B.previews},Y=!0;U[K]={...W,sessionId:H}}let F=B.attachments;if(Q!==X&&F[Q])F={...F,[X]:[...F[X]??[],...F[Q]]},delete F[Q];return{activity:z,errors:G,previews:U,attachments:F}})}));function qw($,Z,J){if(!J)return{root:null,byParent:{}};let H=null,B={};for(let Q of Object.values($)){if(Q.workspaceId!==Z||Q.sessionId!==J)continue;if(Q.parentToolUseId===null){if(!H||Q.updatedAt>H.updatedAt)H=Q}else{let X=B[Q.parentToolUseId];if(!X||Q.updatedAt>X.updatedAt)B[Q.parentToolUseId]=Q}}return{root:H,byParent:B}}function K4($){return Ww(x1,$)}var O0={all:["workspaces"],discover:["workspaces","discover"],creationInfo:["workspaces","creation-info"],previews:["workspaces","previews"],layout:($)=>["workspaces","layout",$],widgets:($)=>["workspaces","widgets",$],appletThumbnails:($)=>["workspaces","applet-thumbnails",$],views:($)=>["workspaces","views",$],sessions:($)=>["workspaces","sessions",$],events:($,Z)=>["workspaces","events",$,Z],session:($,Z)=>["workspaces","session",$,Z],mcp:($)=>["workspaces","mcp",$],agent:($)=>["workspaces","agent",$],skills:($)=>["workspaces","skills",$],env:($)=>["workspaces","env",$]};function ZQ(){return{turns:[],notices:[]}}function LU($,Z){switch(Z.kind){case"snapshot":return{...$,snapshot:Z.snapshot};case"turn":{let J=$.turns.findIndex((B)=>B.id===Z.turn.id);if(J>=0)return{...$,turns:$.turns.map((B,Q)=>Q===J?Z.turn:B)};if(Z.turn.seq===void 0)return{...$,turns:[...$.turns,Z.turn]};let H=$.turns.findIndex((B)=>B.seq!==void 0&&B.seq>Z.turn.seq);if(H<0)return{...$,turns:[...$.turns,Z.turn]};return{...$,turns:[...$.turns.slice(0,H),Z.turn,...$.turns.slice(H)]}}case"notice":{if($.notices.some((J)=>J.id===Z.notice.id))return{...$,notices:$.notices.map((J)=>J.id===Z.notice.id?Z.notice:J)};return{...$,notices:[...$.notices,Z.notice]}}case"result":return{...$,result:Z.result}}}function Aw($){let Z=ZQ(),J=new Map,H=new Map,B=-1/0;for(let Q of $)switch(Q.kind){case"snapshot":Z.snapshot=Q.snapshot;break;case"turn":{let X=Q.turn,z=X.seq,G=J.get(X.id);if(G!==void 0)Z.turns[G]=X;else{let U=z!==void 0&&z<B?Z.turns.findIndex((Y)=>Y.seq!==void 0&&Y.seq>z):-1;if(U<0)J.set(X.id,Z.turns.length),Z.turns.push(X);else{Z.turns.splice(U,0,X);for(let Y=U;Y<Z.turns.length;Y++)J.set(Z.turns[Y].id,Y)}}if(z!==void 0)B=Math.max(B,z);break}case"notice":H.set(Q.notice.id,Q.notice);break;case"result":Z.result=Q.result;break}return Z.notices=[...H.values()],Z}var uD=new WeakMap;function Dw($,Z,J,H){for(let B of uD.get($)??[])if(B.workspaceId===Z&&B.sessionId===J)B.events.push(H)}function Vw($,Z){return M6({queryKey:O0.events($,Z),queryFn:async({client:J,signal:H})=>{let B=uD.get(J)??new Set;uD.set(J,B);let Q={workspaceId:$,sessionId:Z,events:[]};B.add(Q);try{let X=await B1(`/api/workspaces/${$}/sessions/${Z}/events`,{signal:H},"Couldn’t load chat");return Aw([...X,...Q.events])}finally{B.delete(Q)}},staleTime:1/0,gcTime:300000})}var Z8=P(m(),1);function X3($){return $==="overview"||$==="scratchpad"||typeof $==="string"&&/^views\/[a-zA-Z0-9_-]+$/.test($)}function b$($){try{let Z=decodeURIComponent($);return X3(Z)?Z:void 0}catch{return}}var S5=($)=>`views/${$}`,NJ=($)=>$.startsWith("views/")?$.slice(6):void 0;function z3($){return typeof $==="object"&&$!==null&&!Array.isArray($)}var h6={status:"disconnected",connectionId:null,connections:[],users:[],error:null},Z20=[],Lw=($,Z)=>JSON.stringify([$,Z]);class pD{state=h6;usersState=h6;channels=new Map;listeners=new Set;registrations=new Map;location=null;send=()=>{};getSnapshot=()=>this.state;getUsersSnapshot=()=>this.usersState;getPresenceSnapshot=($,Z)=>this.channels.get(Lw($,Z))??Z20;subscribe=($)=>{return this.listeners.add($),()=>{this.listeners.delete($)}};setSender($){this.send=$}connecting(){this.publish({status:"connecting",error:null})}disconnect($){this.publish({...h6,error:$??null})}setLocation($){if(JSON.stringify(this.location)===JSON.stringify($))return;if(this.location=$,this.publish({},!0),this.state.status==="connected")this.send({type:"location",location:$})}getLocation(){return this.location}setPresence($){let Z=this.registrations.get($.registrationId);if(Z&&JSON.stringify(Z)===JSON.stringify($))return;if(this.registrations.set($.registrationId,$),this.state.status==="connected")this.send({type:"presence:set",...$})}deletePresence($){if(this.registrations.delete($),this.state.status==="connected")this.send({type:"presence:delete",registrationId:$})}receive($){switch($.type){case"welcome":this.publish({status:"connected",connectionId:$.connectionId,connections:$.connections,users:$.users,error:null});for(let Z of this.registrations.values())this.send({type:"presence:set",...Z});break;case"connections":this.publish({connections:$.connections,users:$.users});break;case"error":this.publish({error:$.message});break;case"pong":break}}publish($,Z=!1){this.state={...this.state,...$};let J={...this.state,connections:this.state.connections.map((B)=>({...B,presence:[]}))};if(Z||JSON.stringify(J)!==JSON.stringify(this.usersState))this.usersState=J;let H=new Map;if(this.location?.status==="active")for(let B of this.state.connections){if(B.connectionId===this.state.connectionId||B.location?.page!==this.location.page||B.location.status!=="active")continue;for(let Q of B.presence){let X=Lw(Q.appletId,Q.channel),z=H.get(X)??[];z.push({registrationId:Q.registrationId,connectionId:B.connectionId,userId:B.userId,value:Q.value}),H.set(X,z)}}this.channels=new Map([...H].map(([B,Q])=>{let X=this.channels.get(B);return[B,X&&JSON.stringify(X)===JSON.stringify(Q)?X:Q]})),this.listeners.forEach((B)=>B())}}var w$=()=>{},Pw=[],_w={workspaceId:"",enabled:!1,start:()=>w$,getSnapshot:()=>h6,getUsersSnapshot:()=>h6,getPresenceSnapshot:()=>Pw,subscribe:()=>w$,getCurrentUser:v4,subscribeCurrentUser:S$,getDirectory:v6,subscribeDirectory:JQ,getLocation:()=>null,setLocation:w$,setPresence:w$,deletePresence:w$};class cD{workspaceId;enabled;store=new pD;socket=null;retry;heartbeat;unsubscribeCurrentUser;presenceTimer;queuedPresence=new Map;stopped=!0;attempts=0;lastMessageAt=0;userId=v4()?.id;constructor($,Z=!0){this.workspaceId=$;this.enabled=Z;this.store.setSender((J)=>this.send(J))}getSnapshot=()=>this.enabled?this.store.getSnapshot():h6;getUsersSnapshot=()=>this.enabled?this.store.getUsersSnapshot():h6;getPresenceSnapshot=($,Z)=>this.enabled?this.store.getPresenceSnapshot($,Z):Pw;subscribe=($)=>this.enabled?this.store.subscribe($):w$;getCurrentUser=v4;subscribeCurrentUser=S$;getDirectory=v6;subscribeDirectory=JQ;getLocation=()=>this.enabled?this.store.getLocation():null;setLocation=($)=>{this.store.setLocation($)};setPresence=($)=>{if(this.enabled)this.store.setPresence($)};deletePresence=($)=>{if(this.enabled)this.store.deletePresence($)};start(){if(!this.enabled)return w$;if(!this.stopped)return()=>{};return this.stopped=!1,this.userId=v4()?.id,this.unsubscribeCurrentUser=S$(()=>{let $=v4();if($?.id!==this.userId)if(this.userId=$?.id,this.store.disconnect(),clearTimeout(this.retry),this.socket)this.socket.close();else this.connect();else if($)this.send({type:"profile",profile:$})}),this.connect(),()=>this.stop()}wantsConnection(){return!this.stopped&&v4()!==void 0}connect(){if(!this.wantsConnection()){this.store.disconnect();return}if(this.socket)return;clearTimeout(this.retry),this.store.connecting();let $=new WebSocket(FJ(`/api/workspaces/${encodeURIComponent(this.workspaceId)}/collab/ws`));this.socket=$,$.onopen=()=>{if($!==this.socket)return;this.lastMessageAt=Date.now();let Z=v4();if(!Z){$.close();return}this.heartbeat=setInterval(()=>{if(Date.now()-this.lastMessageAt>45000)$.close();else this.rawSend({type:"ping"})},15000),this.rawSend({type:"join",version:Mw,profile:Z,location:this.store.getLocation()})},$.onmessage=(Z)=>{if($!==this.socket)return;this.lastMessageAt=Date.now();try{let J=JSON.parse(String(Z.data));if(J.type==="welcome")this.attempts=0;let H=J.type==="error"&&this.store.getSnapshot().status!=="connected";if(this.store.receive(J),H)$.close()}catch{this.store.disconnect("The collaboration connection returned an invalid message."),$.close()}},$.onerror=()=>$.close(),$.onclose=()=>{if($!==this.socket)return;if(clearInterval(this.heartbeat),clearTimeout(this.presenceTimer),this.presenceTimer=void 0,this.queuedPresence.clear(),this.socket=null,this.store.disconnect(),this.wantsConnection()){let Z=Math.min(500*2**this.attempts++,1e4);this.retry=setTimeout(()=>this.connect(),Z)}}}send($){if(!v4()&&($.type==="location"||$.type==="presence:set"||$.type==="presence:delete"))return;if($.type==="presence:set"){if(this.queuedPresence.set($.registrationId,$),!this.presenceTimer)this.presenceTimer=setTimeout(()=>{this.presenceTimer=void 0;for(let Z of this.queuedPresence.values())this.rawSend(Z);this.queuedPresence.clear()},50);return}if($.type==="presence:delete")this.queuedPresence.delete($.registrationId);this.rawSend($)}rawSend($){if(this.socket?.readyState===WebSocket.OPEN)try{this.socket.send(JSON.stringify($))}catch{this.socket.close()}}stop(){this.stopped=!0,this.unsubscribeCurrentUser?.(),clearTimeout(this.retry),clearTimeout(this.presenceTimer),this.presenceTimer=void 0,clearInterval(this.heartbeat),this.queuedPresence.clear(),this.socket?.close(),this.socket=null,this.store.disconnect()}}var rD=P(u(),1),Ow=Z8.createContext(_w),Tw=Z8.createContext(null);function dD($,Z,J=""){let H=`${J.replace(/\/$/,"")}/workspace/${encodeURIComponent(Z)}/`,B=$.startsWith(H)?$.slice(H.length):"";return b$(B)??(B||"overview")}function lD({workspaceId:$,enabled:Z,children:J}){let H=Z8.useMemo(()=>new cD($,Z),[$,Z]),B=w2(),Q=X$(B),{base:X}=B;return Z8.useEffect(()=>H.start(),[H]),Z8.useEffect(()=>{let z=()=>H.setLocation({page:dD(window.location.pathname,$,X),status:document.visibilityState==="hidden"?"away":"active"});return z(),document.addEventListener("visibilitychange",z),()=>document.removeEventListener("visibilitychange",z)},[X,H,Q,$]),rD.jsx(Ow,{value:H,children:J})}function HQ({appletId:$,active:Z=!0,children:J}){let{enabled:H}=f6(),B=Z8.useMemo(()=>({active:H&&Z,appletId:$}),[H,Z,$]);return rD.jsx(Tw,{value:B,children:J})}function f6(){return Z8.useContext(Ow)}function iD(){return Z8.useContext(Tw)}function a2(){let $=f6(),Z=Z8.useSyncExternalStore($.subscribeCurrentUser,$.getCurrentUser,$.getCurrentUser);return $.enabled&&Z!==void 0}var dU=P(m(),1);var r3={};k5(r3,{createHandle:()=>NS,Viewport:()=>WS,Trigger:()=>vw,Title:()=>zS,Root:()=>Rw,Positioner:()=>ow,Portal:()=>mw,Popup:()=>ZS,Handle:()=>IU,Description:()=>US,Close:()=>FS,Backdrop:()=>QS,Arrow:()=>HS});var BQ=P(m(),1);var MU=P(m(),1),aD=MU.createContext(void 0);function s5($){let Z=MU.useContext(aD);if(Z===void 0&&!$)throw Error(I0(47));return Z}var PU=P(m(),1),jw=P(A8(),1);var Cw={...$3,disabled:($)=>$.disabled,instantType:($)=>$.instantType,openMethod:($)=>$.openMethod,openChangeReason:($)=>$.openChangeReason,modal:($)=>$.modal,focusManagerModal:($)=>$.focusManagerModal,stickIfOpen:($)=>$.stickIfOpen,titleElementId:($)=>$.titleElementId,descriptionElementId:($)=>$.descriptionElementId,openOnHover:($)=>$.openOnHover,closeDelay:($)=>$.closeDelay,adaptiveOrigin:($)=>$.adaptiveOrigin};class oD extends p2{constructor($,Z,J){let H=new y2;super(bw($,H,Z,J),ww(H),Cw)}setOpen=($,Z)=>{let J=Z.reason===F0.triggerHover,H=Z.reason===F0.triggerPress&&Z.event.detail===0,B=!$&&(Z.reason===F0.escapeKey||Z.reason==null),Q=iB(Z),X=this.select("activeTriggerId");if(!$&&Z.reason===F0.closePress&&Z.trigger==null&&X!=null)Z.trigger=this.context.triggerElements.getById(X)??this.select("activeTriggerElement")??void 0;if(this.context.onOpenChange?.($,Z),Z.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange($,Z);let z=()=>{let U=O$(this.state,$,Z.trigger,Q());U.openChangeReason=Z.reason,this.update(U)};if(J)this.set("stickIfOpen",!0),this.context.stickIfOpenTimeout.start(MG,()=>{this.set("stickIfOpen",!1)}),jw.flushSync(z);else z();let G;if(H)G="click";else if(B)G="dismiss";else if(Z.reason===F0.focusOut)G="focus";this.set("instantType",G)}}function Ew(){let $=new y2,Z=new A9(Object.freeze(bw(void 0,$)),Object.freeze(ww($)),Cw);return Object.assign(Z,{setOpen:G1})}function bw($,Z,J,H=!1){let B={...e9(Z,J,H),disabled:!1,modal:!1,focusManagerModal:!1,instantType:void 0,openMethod:null,openChangeReason:null,titleElementId:void 0,descriptionElementId:void 0,stickIfOpen:!0,openOnHover:!1,closeDelay:0,adaptiveOrigin:void 0,...$};if(B.open&&$?.mounted===void 0)B.mounted=!0;return B}function ww($){return{popupRef:PU.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:PU.createRef(),beforeContentFocusGuardRef:PU.createRef(),stickIfOpenTimeout:new n5,triggerElements:$}}var g6=P(u(),1),Sw=X9(function({props:Z}){let{children:J,open:H,defaultOpen:B=!1,onOpenChange:Q,onOpenChangeComplete:X,modal:z=!1,handle:G,triggerId:U,defaultTriggerId:Y=null}=Z,F=J20(G,{modal:z,open:B,openProp:H,activeTriggerId:Y,triggerIdProp:U});F.useControlledProp("openProp",H),F.useControlledProp("triggerIdProp",U);let K=F.useState("open"),W=F.useState("mounted"),N=F.useState("payload");F.useContextCallback("onOpenChange",Q),F.useContextCallback("onOpenChangeComplete",X),mG(F,K),n9(F);let{forceUnmount:q}=s9(K,F,()=>{F.update({stickIfOpen:!0,openChangeReason:null})});F.useSyncedValues({modal:z}),BQ.useEffect(()=>{if(!K)F.context.stickIfOpenTimeout.clear()},[F,K]),BQ.useImperativeHandle(Z.actionsRef,()=>({unmount:q,close:()=>F.setOpen(!1,w0(F0.imperativeAction))}),[q,F]);let D=K||W;return g6.jsxs(aD.Provider,{value:F,children:[G&&g6.jsx(a9,{handle:G,store:F}),D&&g6.jsx(H20,{store:F,modal:z}),typeof J==="function"?J({payload:N}):J]})});function Rw($){if(s5(!0))return g6.jsx(Sw,{props:$});return g6.jsx(M$,{children:g6.jsx(Sw,{props:$})})}function J20($,Z){let J=R6((H,B)=>new oD(Z,H,B));return BQ.useEffect(()=>J.context.stickIfOpenTimeout.disposeEffect(),[J]),J}function H20({store:$,modal:Z}){let J=$.useState("floatingRootContext"),H=K9(J,{outsidePressEvent:{mouse:Z==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}}),B=H.reference,Q=H.floating;return t9($,{activeTriggerProps:B,inactiveTriggerProps:B,popupProps:Q}),null}var GQ=P(m(),1);var Iw=300;var kw=P(m(),1),nD=P(A8(),1);function _U($,Z){let J=kw.useRef(null);function H(Q){nD.flushSync(()=>{$.setOpen(!1,w0(F0.focusOut,Q.nativeEvent,Q.currentTarget))}),zC(J.current)?.focus()}function B(Q){let X=$.select("positionerElement");if(X&&g3(Q,X))$.context.beforeContentFocusGuardRef.current?.focus();else{nD.flushSync(()=>{$.setOpen(!1,w0(F0.focusOut,Q.nativeEvent,Q.currentTarget))});let z=XC($.context.triggerFocusTargetRef.current||Z.current);while(z!==null&&R0(X,z)){let G=z;if(z=sZ(z),z===G)break}z?.focus()}}return{preFocusGuardRef:J,handlePreFocusGuardFocus:H,handleFocusTargetFocus:B}}var XQ=P(m(),1);var QQ=P(m(),1);function yw($){let Z=QQ.useRef(""),J=QQ.useCallback((B)=>{if(B.defaultPrevented)return;Z.current=B.pointerType,$(B,B.pointerType)},[$]);return{onClick:QQ.useCallback((B)=>{if(B.detail===0){$(B,"keyboard");return}if("pointerType"in B)$(B,B.pointerType);else $(B,Z.current);Z.current=""},[$]),onPointerDown:J}}var xw=P(m(),1);function G3($,Z){let J=xw.useRef($),H=Y0(Z);H0(()=>{if(J.current!==$)H(J.current);J.current=$},[$,H])}function zQ($,Z){let J=Y0((Q,X)=>{if(!(typeof $==="function"?$():$))Z(X||(B5.os.ios?"touch":""))}),{onClick:H,onPointerDown:B}=yw(J);return XQ.useMemo(()=>({onClick:H,onPointerDown:B}),[H,B])}function hw($){let[Z,J]=XQ.useState(null),H=zQ($,J);return G3($,(B)=>{if(B&&!$)J(null)}),XQ.useMemo(()=>({openMethod:Z,triggerProps:H}),[Z,H])}var qJ=P(u(),1),vw=u9(function(Z,J){let{render:H,className:B,style:Q,disabled:X=!1,nativeButton:z=!0,handle:G,payload:U,openOnHover:Y=!1,delay:F=Iw,closeDelay:K=0,id:W,...N}=Z,q=s5(!0),A=Z3(G)??q;if(!A)throw Error(I0(74));let V=t0(W),L=A.useState("isTriggerActive",V),O=A.useState("floatingRootContext"),M=A.useState("isOpenedByTrigger",V),_=A.useState("triggerPopupId",V),w=GQ.useRef(null),{registerTrigger:C,isMountedByThisTrigger:E}=o9(V,w,A,{payload:U,disabled:X,openOnHover:Y,closeDelay:K}),T=A.useState("openChangeReason"),k=A.useState("stickIfOpen"),S=A.useState("openMethod"),I=A.useState("focusManagerModal"),j=N9(O,{enabled:!X&&Y&&(S!=="touch"||T!==F0.triggerPress),mouseOnly:!0,move:!1,handleClose:q9(),restMs:F,delay:{close:K},triggerElementRef:w,isActiveTrigger:L,isClosing:()=>A.select("transitionStatus")==="ending"}),y=c3(O,{stickIfOpen:k}),R=zQ(()=>A.select("open"),(i)=>{A.set("openMethod",i)}),x=A.useState("triggerProps",E),{getButtonProps:v,buttonRef:f}=w5({disabled:X,native:z}),b={open(i){if(i&&T===F0.triggerPress)return yB.open(i);return p9.open(i)}},{preFocusGuardRef:l,handlePreFocusGuardFocus:r,handleFocusTargetFocus:h}=_U(A,w),o=G0("button",Z,{state:{disabled:X,open:M},ref:[f,J,C,w],props:[y.reference,j,x,R,{[tZ]:"",id:V,"aria-haspopup":"dialog","aria-expanded":M,"aria-controls":_},N,v],stateAttributesMapping:b}),c=qJ.jsx(GQ.Fragment,{children:o},V);if(E&&!I)return qJ.jsxs(GQ.Fragment,{children:[qJ.jsx(s4,{ref:l,onFocus:r}),c,qJ.jsx(s4,{ref:A.context.triggerFocusTargetRef,onFocus:h})]});return c});var gw=P(m(),1);var OU=P(m(),1),sD=OU.createContext(void 0);function fw(){let $=OU.useContext(sD);if($===void 0)throw Error(I0(45));return $}var tD=P(u(),1),mw=gw.forwardRef(function(Z,J){let{keepMounted:H=!1,...B}=Z;if(!(s5().useState("mounted")||H))return null;return tD.jsx(sD.Provider,{value:H,children:tD.jsx(D$,{ref:J,...B})})});var bU=P(m(),1);var TU=P(m(),1),eD=TU.createContext(void 0);function AJ(){let $=TU.useContext(eD);if(!$)throw Error(I0(46));return $}var uw=P(m(),1),pw=P(u(),1),DJ=uw.forwardRef(function(Z,J){let{cutout:H,...B}=Z,Q;if(H){let X=H.getBoundingClientRect();Q=`polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${X.left}px ${X.top}px,${X.left}px ${X.bottom}px,${X.right}px ${X.bottom}px,${X.right}px ${X.top}px,${X.left}px ${X.top}px)`}return pw.jsx("div",{ref:J,role:"presentation","data-base-ui-inert":"",...B,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:Q}})});var aw=P(m(),1);var cw={},dw={},lw="";function jU($,Z){return aB($)?$:Z}function iw($,Z,J){return/hidden|clip/.test($.getComputedStyle(jU(Z,J)).overflowY)}function B20($){if(typeof document>"u")return!1;let Z=m0($);return k1(Z).innerWidth-Z.documentElement.clientWidth>0}function Q20($){if(!(typeof CSS<"u"&&CSS.supports&&CSS.supports("scrollbar-gutter","stable"))||typeof document>"u")return!1;let J=m0($),H=J.documentElement,B=J.body,Q=jU(H,B),X=Q.style.overflowY,z=H.style.scrollbarGutter;H.style.scrollbarGutter="stable",Q.style.overflowY="scroll";let G=Q.offsetWidth;Q.style.overflowY="hidden";let U=Q.offsetWidth;return Q.style.overflowY=X,H.style.scrollbarGutter=z,G===U}function X20($){let Z=m0($),J=Z.documentElement,H=Z.body,B=jU(J,H),Q={overflowY:B.style.overflowY,overflowX:B.style.overflowX};return Object.assign(B.style,{overflowY:"hidden",overflowX:"hidden"}),()=>{Object.assign(B.style,Q)}}function z20($){let Z=m0($),J=Z.documentElement,H=Z.body,B=k1(J),Q=0,X=0,z=!1,G=c2.create();if(B5.engine.webkit&&(B.visualViewport?.scale??1)!==1)return()=>{};function U(){let W=B.getComputedStyle(J),N=B.getComputedStyle(H),A=(W.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";Q=J.scrollTop,X=J.scrollLeft,cw={scrollbarGutter:J.style.scrollbarGutter,overflowY:J.style.overflowY,overflowX:J.style.overflowX},lw=J.style.scrollBehavior,dw={position:H.style.position,height:H.style.height,width:H.style.width,boxSizing:H.style.boxSizing,overflowY:H.style.overflowY,overflowX:H.style.overflowX,scrollBehavior:H.style.scrollBehavior};let V=J.scrollHeight>J.clientHeight,L=J.scrollWidth>J.clientWidth,O=W.overflowY==="scroll"||N.overflowY==="scroll",M=W.overflowX==="scroll"||N.overflowX==="scroll",_=Math.max(0,B.innerWidth-H.clientWidth),w=Math.max(0,B.innerHeight-H.clientHeight),C=parseFloat(N.marginTop)+parseFloat(N.marginBottom),E=parseFloat(N.marginLeft)+parseFloat(N.marginRight),T=jU(J,H);if(z=Q20($),z){J.style.scrollbarGutter=A,T.style.overflowY="hidden",T.style.overflowX="hidden";return}if(Object.assign(J.style,{scrollbarGutter:A,overflowY:"hidden",overflowX:"hidden"}),V||O)J.style.overflowY="scroll";if(L||M)J.style.overflowX="scroll";Object.assign(H.style,{position:"relative",height:C||w?`calc(100dvh - ${C+w}px)`:"100dvh",width:E||_?`calc(100vw - ${E+_}px)`:"100vw",boxSizing:"border-box",overflowY:"hidden",overflowX:"hidden",scrollBehavior:"unset"}),H.scrollTop=Q,H.scrollLeft=X,J.setAttribute("data-base-ui-scroll-locked",""),J.style.scrollBehavior="unset"}function Y(){if(Object.assign(J.style,cw),Object.assign(H.style,dw),!z)J.scrollTop=Q,J.scrollLeft=X,J.removeAttribute("data-base-ui-scroll-locked"),J.style.scrollBehavior=lw}function F(){Y(),G.request(U)}U();let K=o0(B,"resize",F);return()=>{if(G.cancel(),Y(),typeof B.removeEventListener==="function")K()}}class rw{lockCount=0;restore=null;timeoutLock=n5.create();timeoutUnlock=n5.create();acquire($){if(this.lockCount+=1,this.lockCount===1&&this.restore===null)this.timeoutLock.start(0,()=>this.lock($));return this.release}release=()=>{if(this.lockCount-=1,this.lockCount===0&&this.restore)this.timeoutUnlock.start(0,this.unlock)};unlock=()=>{if(this.lockCount===0&&this.restore)this.restore?.(),this.restore=null};lock($){if(this.lockCount===0||this.restore!==null)return;let Z=m0($),J=Z.documentElement,H=Z.body,B=k1(J);if(iw(B,J,H)){let X=new B.MutationObserver(()=>{if(iw(B,J,H))return;X.disconnect(),this.restore=null,this.lock($)}),z={attributes:!0};X.observe(J,z),X.observe(H,z),this.restore=()=>X.disconnect();return}let Q=B5.os.ios||!B20($);this.restore=Q?X20($):z20($)}}var G20=new rw;function CU($=!0,Z=null){H0(()=>{if(!$)return;return G20.acquire(Z)},[$,Z])}var U20=20;function EU($,Z,J,H){let[B,Q]=aw.useState(!1);H0(()=>{if(!$||!Z||J==null){Q(!1);return}let X=m0(J).documentElement.clientWidth,z=J.offsetWidth;Q(X>0&&z>0&&z>=X-U20)},[$,Z,J]),CU($&&(!Z||B),H)}var UQ=P(u(),1),ow=bU.forwardRef(function(Z,J){let{render:H,className:B,style:Q,anchor:X,positionMethod:z,side:G,align:U,sideOffset:Y,alignOffset:F,collisionBoundary:K="clipping-ancestors",collisionPadding:W,arrowPadding:N,sticky:q,disableAnchorTracking:D=!1,collisionAvoidance:A=i9,...V}=Z,L=s5(),O=fw(),M=p3(),_=L.useState("floatingRootContext"),w=L.useState("mounted"),C=L.useState("open"),E=L.useState("openChangeReason"),T=L.useState("activeTriggerElement"),k=L.useState("modal"),S=L.useState("openMethod"),I=L.useState("positionerElement"),j=L.useState("instantType"),y=L.useState("transitionStatus"),R=L.useState("adaptiveOrigin"),x=bU.useRef(null),v=t4(I),f=H3({anchor:X,floatingRootContext:_,positionMethod:z,mounted:w,side:G,sideOffset:Y,align:U,alignOffset:F,arrowPadding:N,collisionBoundary:K,collisionPadding:W,sticky:q,disableAnchorTracking:D,keepMounted:O,nodeId:M,collisionAvoidance:A,adaptiveOrigin:R}),b=_.useState("domReferenceElement");H0(()=>{let o=b,c=x.current;if(o)x.current=o;if(c&&o&&o!==c){L.set("instantType",void 0);let i=new AbortController;return v(()=>{L.set("instantType","trigger-change")},i.signal),()=>{i.abort()}}return},[b,v,L]);let l=k===!0&&E!==F0.triggerHover;EU(C&&l,S==="touch",I,T);let r=L.useStateSetter("positionerElement"),h={open:C,side:f.side,align:f.align,anchorHidden:f.anchorHidden,instant:j},d=Q3(Z,h,{styles:f.positionerStyles,transitionStatus:y,props:V,refs:[J,r],hidden:!w,inert:!C});return UQ.jsxs(eD.Provider,{value:f,children:[w&&l&&UQ.jsx(DJ,{inert:x8(!C),cutout:T}),UQ.jsx(L$,{id:M,children:d})]})});var $S=P(m(),1);var VJ="ArrowUp",LJ="ArrowDown",MJ="ArrowLeft",PJ="ArrowRight",_J="Home",OJ="End",$V="PageUp",ZV="PageDown",D9=new Set([VJ,LJ,MJ,PJ,_J,OJ]),Y20="Shift",sw=[Y20,"Control","Alt","Meta"];function F20($){return L1($)&&$.tagName==="INPUT"}function JV($){if(F20($)&&$.selectionStart!=null)return!0;if(L1($)&&$.tagName==="TEXTAREA")return!0;return!1}function HV($,Z,J,H){if(!$||!Z||!Z.scrollTo)return;let{scrollLeft:B,scrollTop:Q}=$,X=$.clientWidth<$.scrollWidth,z=$.clientHeight<$.scrollHeight;if(X&&H!=="vertical"){let G=nw($,Z,"left"),U=wU($),Y=wU(Z);if(J==="ltr"){if(G+Z.offsetWidth+Y.scrollMarginRight>$.scrollLeft+$.clientWidth-U.scrollPaddingRight)B=G+Z.offsetWidth+Y.scrollMarginRight-$.clientWidth+U.scrollPaddingRight;else if(G-Y.scrollMarginLeft<$.scrollLeft+U.scrollPaddingLeft)B=G-Y.scrollMarginLeft-U.scrollPaddingLeft}if(J==="rtl"){if(G-Y.scrollMarginLeft<$.scrollLeft+U.scrollPaddingLeft)B=G-Y.scrollMarginLeft-U.scrollPaddingLeft;else if(G+Z.offsetWidth+Y.scrollMarginRight>$.scrollLeft+$.clientWidth-U.scrollPaddingRight)B=G+Z.offsetWidth+Y.scrollMarginRight-$.clientWidth+U.scrollPaddingRight}}if(z&&H!=="horizontal"){let G=nw($,Z,"top"),U=wU($),Y=wU(Z);if(G-Y.scrollMarginTop<$.scrollTop+U.scrollPaddingTop)Q=G-Y.scrollMarginTop-U.scrollPaddingTop;else if(G+Z.offsetHeight+Y.scrollMarginBottom>$.scrollTop+$.clientHeight-U.scrollPaddingBottom)Q=G+Z.offsetHeight+Y.scrollMarginBottom-$.clientHeight+U.scrollPaddingBottom}$.scrollTo({left:B,top:Q,behavior:"auto"})}function nw($,Z,J){let H=J==="left"?"offsetLeft":"offsetTop",B=0;while(Z.offsetParent){if(B+=Z[H],Z.offsetParent===$)break;Z=Z.offsetParent}return B}function wU($){let Z=getComputedStyle($);return{scrollMarginTop:parseFloat(Z.scrollMarginTop)||0,scrollMarginRight:parseFloat(Z.scrollMarginRight)||0,scrollMarginBottom:parseFloat(Z.scrollMarginBottom)||0,scrollMarginLeft:parseFloat(Z.scrollMarginLeft)||0,scrollPaddingTop:parseFloat(Z.scrollPaddingTop)||0,scrollPaddingRight:parseFloat(Z.scrollPaddingRight)||0,scrollPaddingBottom:parseFloat(Z.scrollPaddingBottom)||0,scrollPaddingLeft:parseFloat(Z.scrollPaddingLeft)||0}}var SU=P(m(),1),K20=SU.createContext(void 0);function RU($){let Z=SU.useContext(K20);if(Z===void 0&&!$)throw Error(I0(69));return Z}var m6=P(m(),1);var BV=m6.createContext(void 0);function tw(){let[$,Z]=m6.useState(0),J=Y0(()=>{return Z((B)=>B+1),()=>{Z((B)=>Math.max(0,B-1))}});return{context:m6.useMemo(()=>({register:J}),[J]),hasClosePart:$>0}}function ew(){let $=m6.useContext(BV);H0(()=>{return $?.register()},[$])}var QV=P(u(),1),ZS=$S.forwardRef(function(Z,J){let{render:H,className:B,style:Q,initialFocus:X,finalFocus:z,...G}=Z,U=s5(),Y=AJ(),F=RU(!0)!=null,{context:K,hasClosePart:W}=tw(),N=U.useState("open"),q=U.useState("openMethod"),D=U.useState("instantType"),A=U.useState("transitionStatus"),V=U.useState("popupProps"),L=U.useState("titleElementId"),O=U.useState("descriptionElementId"),M=U.useState("modal"),_=U.useState("mounted"),w=U.useState("openChangeReason"),C=U.useState("activeTriggerElement"),E=U.useState("floatingRootContext"),T=E.useState("floatingId"),k=U.useState("disabled"),S=U.useState("openOnHover"),I=U.useState("closeDelay");L5({open:N,ref:U.context.popupRef,onComplete(){if(N)U.context.onOpenChangeComplete?.(!0)}}),d3(E,{enabled:S&&!k,closeDelay:I});let j=X===void 0?fG(U.context.popupRef):X,y=M!==!1&&W;U.useSyncedValue("focusManagerModal",y);let R=U.useStateSetter("popupElement"),x={open:N,side:Y.side,align:Y.align,instant:D,transitionStatus:A},v=G0("div",Z,{state:x,ref:[J,U.context.popupRef,R],props:[V,{id:T,role:"dialog",...r9,"aria-labelledby":L,"aria-describedby":O,onKeyDown(f){if(F&&D9.has(f.key))f.stopPropagation()}},B3(A),G],stateAttributesMapping:X4});return QV.jsx(P$,{context:E,openInteractionType:q,modal:y,disabled:!_||w===F0.triggerHover,initialFocus:j,returnFocus:z,restoreFocus:"popup",previousFocusableElement:L1(C)?C:void 0,nextFocusableElement:U.context.triggerFocusTargetRef,beforeContentFocusGuardRef:U.context.beforeContentFocusGuardRef,children:QV.jsx(BV.Provider,{value:K,children:v})})});var JS=P(m(),1);var HS=JS.forwardRef(function(Z,J){let{render:H,className:B,style:Q,...X}=Z,G=s5().useState("open"),{arrowRef:U,side:Y,align:F,arrowUncentered:K,arrowStyles:W}=AJ();return G0("div",Z,{state:{open:G,side:Y,align:F,uncentered:K},ref:[J,U],props:[{style:W,"aria-hidden":!0},X],stateAttributesMapping:N8})});var BS=P(m(),1);var QS=BS.forwardRef(function(Z,J){let{render:H,className:B,style:Q,...X}=Z,z=s5(),G=z.useState("open"),U=z.useState("mounted"),Y=z.useState("transitionStatus"),F=z.useState("openChangeReason");return G0("div",Z,{state:{open:G,transitionStatus:Y},ref:J,props:[{role:"presentation",hidden:!U,style:{pointerEvents:F===F0.triggerHover?"none":void 0,userSelect:"none",WebkitUserSelect:"none"}},X],stateAttributesMapping:X4})});var XS=P(m(),1);var zS=XS.forwardRef(function(Z,J){let{render:H,className:B,style:Q,...X}=Z,z=s5(),G=t0(X.id);return z.useSyncedValueWithCleanup("titleElementId",G),G0("h2",Z,{ref:J,props:[{id:G},X]})});var GS=P(m(),1);var US=GS.forwardRef(function(Z,J){let{render:H,className:B,style:Q,...X}=Z,z=s5(),G=t0(X.id);return z.useSyncedValueWithCleanup("descriptionElementId",G),G0("p",Z,{ref:J,props:[{id:G},X]})});var YS=P(m(),1);var FS=YS.forwardRef(function(Z,J){let{render:H,className:B,style:Q,disabled:X=!1,nativeButton:z=!0,...G}=Z,{buttonRef:U,getButtonProps:Y}=w5({disabled:X,focusableWhenDisabled:!1,native:z}),F=s5();return ew(),G0("button",Z,{ref:[J,U],props:[{onClick(W){F.setOpen(!1,w0(F0.closePress,W.nativeEvent))}},G,Y]})});var KS=P(m(),1);var WS=KS.forwardRef(function(Z,J){let{render:H,className:B,style:Q,children:X,...z}=Z,G=s5(),{side:U}=AJ(),Y=G.useState("instantType"),{children:F,state:K}=y6({store:G,side:U,children:X}),W={activationDirection:K.activationDirection,transitioning:K.transitioning,instant:Y};return G0("div",Z,{state:W,ref:J,props:[z,{children:F}],stateAttributesMapping:k6})});class IU extends W9{constructor(){super(Ew(),"Popover")}open($){this.openByTrigger($)}close(){this.closePopup()}get isOpen(){return this.attachedStore?.select("open")??!1}}function NS(){return new IU}var u6=P(u(),1);function p6({...$}){return u6.jsx(r3.Root,{"data-slot":"popover",...$})}function c6({...$}){return u6.jsx(r3.Trigger,{"data-slot":"popover-trigger",...$})}function d6({className:$,align:Z="center",alignOffset:J=0,side:H="bottom",sideOffset:B=4,keepMounted:Q,...X}){return u6.jsx(g8,{portal:r3.Portal,keepMounted:Q,children:u6.jsx(r3.Positioner,{align:Z,alignOffset:J,side:H,sideOffset:B,className:"isolate z-50",children:u6.jsx(r3.Popup,{"data-slot":"popover-content",className:d0("z-50 flex w-72 origin-(--transform-origin) flex-col gap-2.5 rounded-lg bg-popover p-3 text-sm text-popover-foreground shadow-md outline-hidden duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",$),...X})})})}function qS({className:$,...Z}){return u6.jsx("div",{"data-slot":"popover-header",className:d0("flex flex-col gap-0.5 text-sm",$),...Z})}function AS({className:$,...Z}){return u6.jsx(r3.Title,{"data-slot":"popover-title",className:d0("font-medium",$),...Z})}var yU=P(m(),1),R$=P(u(),1),W20=($,Z)=>`mo-root${$==="always"?" mo-always":""}${Z?" mo-expr":""}`;function N20($){let Z=Math.round($.num("motion.blink",3500,6500)),J=Math.round($.num("motion.saccade",4200,7600)),H=$.num("motion.lookX",1,2.2),B=$.num("motion.lookY",0.8,1.7),Q=(X)=>Math.round(X*100)/100;return{phase:Math.round($.num("motion.phase",0,2800)),bob:Math.round($.num("motion.bob",0,3400)),blink:Z,blinkPhase:Math.round($.num("motion.blinkPhase",0,Z)),saccade:J,saccadePhase:Math.round($.num("motion.saccadePhase",0,J)),lookX:Q(H)*($.bool("motion.lookXFlip")?-1:1),lookY:Q(B)*($.bool("motion.lookYFlip")?-1:1),lookMX:Q(H),lookMY:Q(B)}}function q20($){let Z=(H)=>`${-H}ms`,J=N20($);return{"--mo-phase":Z(J.phase),"--mo-bob-phase":Z(J.bob),"--mo-blink":`${J.blink}ms`,"--mo-blink-phase":Z(J.blinkPhase),"--mo-look-x":String(J.lookX),"--mo-look-mx":String(J.lookMX),"--mo-look-y":String(J.lookY),"--mo-look-my":String(J.lookMY),"--mo-saccade":`${J.saccade}ms`,"--mo-saccade-phase":Z(J.saccadePhase)}}function XV({l:$,c:Z,h:J}){let H=J*Math.PI/180,B=Z*Math.cos(H),Q=Z*Math.sin(H),X=$+0.3963377774*B+0.2158037573*Q,z=$-0.1055613458*B-0.0638541728*Q,G=$-0.0894841775*B-1.291485548*Q,U=X*X*X,Y=z*z*z,F=G*G*G;return[4.0767416621*U-3.3077115913*Y+0.2309699292*F,-1.2684380046*U+2.6097574011*Y-0.3413193965*F,-0.0041960863*U-0.7034186147*Y+1.707614701*F]}var DS=($)=>$.every((Z)=>Z>=-0.0001&&Z<=1.0001);function PS($){let Z=XV($);if(!DS(Z)){let J=0,H=$.c;for(let B=0;B<12;B++){let Q=(J+H)/2;if(DS(XV({...$,c:Q})))J=Q;else H=Q}Z=XV({...$,c:J})}return Z.map((J)=>Math.min(1,Math.max(0,J)))}function VS($){let[Z,J,H]=PS($);return 0.2126*Z+0.7152*J+0.0722*H}function kU($,Z){let J=VS($),H=VS(Z);return(Math.max(J,H)+0.05)/(Math.min(J,H)+0.05)}function _S($,Z,J){if(kU($,Z)>=J)return $;let H=$.l>=Z.l?1:-1;for(let X of[H,-H]){let z={...$};for(let G=0;G<60;G++){if(z.l=Math.min(1,Math.max(0,z.l+X*0.02)),kU(z,Z)>=J)return z;if(z.l===0||z.l===1)break}}let B={...$,l:0,c:0},Q={...$,l:1,c:0};return kU(B,Z)>=kU(Q,Z)?B:Q}function A20($){return"#"+PS($).map((Z)=>{let J=Z<=0.0031308?12.92*Z:1.055*Math.pow(Z,0.4166666666666667)-0.055;return Math.round(J*255).toString(16).padStart(2,"0")}).join("")}var LS=[[0.2,{l:0.86,c:0.085}],[0.36,{l:0.9,c:0.028}],[0.62,{l:0.73,c:0.135}],[0.8,{l:0.62,c:0.165}],[0.93,{l:0.87,c:0.16}],[1,{l:0.34,c:0.035}]],D20=($)=>LS.find(([Z])=>$<Z)?.[1]??LS[0][1],V20={l:0.145,c:0,h:0},L20=1.5,M20=($,Z)=>{let J=D20(Z),H=_S({l:J.l,c:J.c,h:$},V20,L20);return{bg:{l:0.965,c:0.01,h:$},head:H,eye:H.l>=0.5?{l:0.17,c:0.02,h:$}:{l:0.97,c:0.012,h:$}}},P20=[["head","bg",1.25],["eye","head",4.5]];function _20($,Z=!0,J=0){let H=M20($,J);if(Z)for(let[B,Q,X]of P20)H[B]=_S(H[B],H[Q],X);return H}function O20($,Z=!0,J=0){let H=_20($,Z,J),B={};for(let Q in H)B[Q]=A20(H[Q]);return B}var _5=($)=>{let Z=Math.round($*100)/100;return Object.is(Z,-0)?"0":String(Z)};function zV({cx:$,cy:Z,rx:J,ry:H,n:B=4,rot:Q=0}){let X=Math.min(1,(8*Math.pow(2,-1/B)-4)/3),z=J,G=H,U=z*X,Y=G*X,F=[[z,0],[z,Y],[U,G],[0,G],[-U,G],[-z,Y],[-z,0],[-z,-Y],[-U,-G],[0,-G],[U,-G],[z,-Y],[z,0]],K=Q*Math.PI/180,W=Math.cos(K),N=Math.sin(K),q=(A)=>{let[V,L]=F[A];return`${_5($+V*W-L*N)} ${_5(Z+V*N+L*W)}`},D=`M${q(0)}`;for(let A=1;A<13;A+=3)D+=`C${q(A)} ${q(A+1)} ${q(A+2)}`;return D+"Z"}function T20($,Z,J,H,B,Q=0){let X=B.length,z=Q*Math.PI/180,G=B.map((F,K)=>{let W=z+2*Math.PI*K/X;return[$+J*F*Math.cos(W),Z+H*F*Math.sin(W)]}),U=(F)=>G[(F%X+X)%X],Y=`M${_5(U(0)[0])} ${_5(U(0)[1])}`;for(let F=0;F<X;F++){let[K,W]=U(F-1),[N,q]=U(F),[D,A]=U(F+1),[V,L]=U(F+2);Y+=`C${_5(N+(D-K)/6)} ${_5(q+(A-W)/6)} ${_5(D-(V-N)/6)} ${_5(A-(L-q)/6)} ${_5(D)} ${_5(A)}`}return Y+"Z"}function j20({cx:$,cy:Z,rx:J,ry:H,sides:B,round:Q=0.3,rot:X=0}){let z=Q>0?Q<1?Q/2:0.5:0,G=X*Math.PI/180-Math.PI/2,U=Array.from({length:B},(W,N)=>{let q=G+2*Math.PI*N/B;return[$+J*Math.cos(q),Z+H*Math.sin(q)]}),Y=(W)=>U[(W%B+B)%B],F=(W,N)=>{let[q,D]=Y(W),[A,V]=Y(N);return`${_5(q+(A-q)*z)} ${_5(D+(V-D)*z)}`},K=`M${F(0,-1)}`;for(let W=0;W<B;W++){let[N,q]=Y(W);if(K+=`Q${_5(N)} ${_5(q)} ${F(W,W+1)}`,z<0.5)K+=`L${F(W+1,W)}`}return K+"Z"}function C20($,Z,J,H){let B=_5($-J),Q=_5($+J);return`M${B} ${_5(Z-H)}H${Q}V${_5(Z+H)}H${B}Z`}function E20($,Z,J,H,B){let Q=Math.max(1.05,B),X=J*Math.sqrt(1-1/(Q*Q)),z=Z-H/Q,G=Z-Q*H,U=X*0.14,Y=z+0.86*(G-z);return`M${_5($-X)} ${_5(z)}L${_5($-U)} ${_5(Y)}Q${_5($)} ${_5(G)} ${_5($+U)} ${_5(Y)}L${_5($+X)} ${_5(z)}Z`}function GV($,Z){for(let J=0;J<Z.length;J++)$=Math.imul($^Z[J],3432918353),$=$<<13|$>>>19;return $}function b20($){return $=Math.imul($^$>>>16,2246822507),$=Math.imul($^$>>>13,3266489909),($^$>>>16)>>>0}var OS=new TextEncoder;function w20($){return $.normalize("NFC").trim().toLowerCase()}function S20($,Z=!0){let J=Z?w20($):$;return GV(1779033703^J.length,OS.encode(J))}function MS($,Z){return b20(GV(GV($,Uint8Array.of(255)),OS.encode(Z)))/4294967296}function R20($,Z=!0,J){let H=S20($,Z),B=(Q)=>{let X=J?.[Q],z=Array.isArray(X)?X[Math.floor(MS(H,Q)*X.length)]:X;return z===void 0?MS(H,Q):z>0?z<1?z:0.999999:0};return B.num=(Q,X,z)=>X+B(Q)*(z-X),B.int=(Q,X,z)=>X+Math.floor(B(Q)*(z-X+1)),B.pick=(Q,X)=>X[Math.floor(B(Q)*X.length)],B.bool=(Q,X=0.5)=>B(Q)<X,B.jitter=(Q,X)=>(B(Q)*2-1)*X,B}function TS($,Z,J){let H=Z.expression;if(J||!H)return{l:$,wrap:""};return H.bake($,H.p)}var I20=($,Z)=>Z?.tint?Z.tint($,Z.p):$,jS=($,Z)=>Z?`<g transform="${Z}">${$}</g>`:$,k20=($)=>$.replace(/[&<>]/g,(Z)=>Z==="&"?"&":Z==="<"?"<":">");function CS($,Z){let J=R20($,Z.normalize??!0,Z.traits);return{t:J,palette:{...O20(Z.hue??J.num("hue",0,360),Z.contrast??!0,Z.tone??J("tone")),...Z.palette}}}var y20=($)=>$.title?`<title>${k20($.title)}</title>`:"";function ES($,Z,J){let H=Z.background??$.background;if(H===!1)return;return{d:H==="square"?"M0 0H100V100H0Z":zV({cx:50,cy:50,rx:50,ry:50,n:H==="circle"?2:6}),fill:J.bg}}var x20=($)=>$?`<path d="${$.d}" fill="${$.fill}"/>`:"";function h20($){return(Z,J={})=>{let{t:H,palette:B}=CS(Z,J),Q=I20(B,J.expression),X=J.size?` width="${J.size}" height="${J.size}"`:"",z=TS($.layout(H),J),G=y20(J)+x20(ES($,J,Q))+jS($.render(z.l,Q),z.wrap);return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"${X}>${G}</svg>`}}function v20($){return(Z,J={},H)=>{let{t:B,palette:Q}=CS(Z,J),X=H?.(B,Q),z=TS($.layout(B),J,X);return{cls:X?.cls,bg:ES($,J,Q),inner:jS($.render(z.l,Q,!!X),z.wrap),vars:X?.vars}}}var f20=($,Z,J)=>{let H=Z.rx,B=$.num("eye.rx",0.075,0.105)*H,Q=$.num("eye.ratio",1.9,3.2),X=$.num("eye.scale",0.78,1.24),z=$.num("eye.stretch",0.85,1.18),G=$.num("eye.gap",0.1,0.24)*H,U=B*Math.max(1,X),Y=B*Q*Math.max(1,X*z),F=U+H*0.03+G,K=$.jitter("gaze.x",0.09)*J.rx,W=$.num("gaze.y",-0.2,0.08)*J.ry,N=$.jitter("eye.dy",0.04)*J.ry,q=Math.hypot(U,Y),D=Math.hypot((Math.abs(K)+F+q)/J.rx,(Math.abs(W)+Math.abs(N)+q)/J.ry),A=D>0.9?0.9/D:1,V=B*A,L=V*Q,O=F*A,M=Math.max(0,Math.min(1,G/Y)),_=Math.min(12,Math.asin(M)*180/Math.PI),w=$.num("eye.lean",-1,1)*_,C=Math.max(-12,Math.min(12,w+$.jitter("eye.lean2",3.5))),E=J.cx+K*A,T=J.cy+W*A;return[{cx:E-O,cy:T,rx:V,ry:L,n:$.num("eye.n",3.5,6),rot:w},{cx:E+O,cy:T+N*A,rx:V*X,ry:L*X*z,n:$.num("eye.n",3.5,6),rot:C}]};function g20($,Z){let J=(Q)=>($.find(([,X])=>Q<X)??$[$.length-1])[0];function H(Q){let X=J(Q("shape")),z=Q.num("body.r",31,38)*X.core,G={cx:50+Q.jitter("body.x",1.5),cy:50+Q.jitter("body.y",1.5),rx:z,ry:z*Q.num("body.ratio",0.92,1.08),n:Q.num("body.n",1.9,2.5),rot:0,radii:Array.from({length:Q.int("body.pts",6,8)},(F,K)=>1+Q.jitter(`body.r${K}`,0.16))};X.body?.(Q,G);let U=X.face?.(G)??G,Y={petals:[],extra:[]};return X.decorate?.(Q,G,Y),{shape:X.name,draw:X.path,body:G,face:U,petals:Y.petals,extra:Y.extra,eyes:Z(Q,G,U)}}function B(Q,X,z){let G=(F)=>Math.round(F*100)/100,U=(F,K)=>{let W=`<path d="${zV(F)}"/>`;return z?`<g class="mo-eye" style="--mo-wrap:${K?1:-1};--mo-lean:${G(F.rot)};transform-origin:${G(F.cx)}px ${G(F.cy)}px">${W}</g>`:W},Y=`<g fill="${X.head}">`+Q.petals.map((F)=>`<circle cx="${G(F.cx)}" cy="${G(F.cy)}" r="${G(F.r)}"/>`).join("")+Q.extra.map((F)=>`<path d="${F}"/>`).join("")+`<path d="${Q.draw?Q.draw(Q.body):zV(Q.body)}"/></g><g fill="${X.eye}"${z?' class="mo-eyes"':""}>`+Q.eyes.map(U).join("")+"</g>";return z?`<g class="mo-breathe"><g class="mo-bob">${Y}</g></g>`:Y}return{layout:H,render:B,background:!1}}var bS=($)=>j20($),wS=($)=>T20($.cx,$.cy,$.rx,$.ry,$.radii,$.rot),UV=($)=>(Z)=>({cx:Z.cx,cy:Z.cy,rx:Z.rx*$,ry:Z.ry*$}),SS=($)=>UV(Math.min(...$.radii)*0.95)($),m20=($)=>UV(0.84)($),u20={name:"round",core:1},p20={name:"organic",core:0.98,path:wS,face:SS},c20={name:"boxy",core:0.86,body:($,Z)=>{Z.n=$.num("body.n",3.4,6),Z.rot=$.num("body.rot",-20,20)}},d20={name:"capsule",core:1.02,body:($,Z)=>{Z.ry*=$.num("capsule.squat",0.55,0.68)},face:UV(0.94),decorate:($,Z,J)=>{for(let H of[-1,1])J.petals.push({cx:Z.cx+H*(Z.rx-Z.ry),cy:Z.cy,r:Z.ry})},path:($)=>C20($.cx,$.cy,$.rx-$.ry,$.ry)},l20={name:"nub",core:0.88,decorate:($,Z,J)=>{let H=$.int("nub.n",1,2);for(let B=0;B<H;B++){let Q=$.num(`nub.a${B}`,0,2*Math.PI);J.petals.push({cx:Z.cx+Math.cos(Q)*Z.rx*0.88,cy:Z.cy+Math.sin(Q)*Z.rx*0.88,r:Z.rx*$.num(`nub.r${B}`,0.24,0.4)})}}},i20={name:"cloud",core:0.78,face:SS,path:wS,decorate:($,Z,J)=>{let H=$.int("cloud.n",4,6);for(let B=0;B<H;B++){let Q=Math.PI+Math.PI*(B+0.5)/H;J.petals.push({cx:Z.cx+Math.cos(Q)*Z.rx*0.8,cy:Z.cy+Math.sin(Q)*Z.rx*0.5,r:Z.rx*$.num(`cloud.r${B}`,0.44,0.62)})}}},r20={name:"droplet",core:0.78,body:($,Z)=>{Z.cy+=0.22*Z.ry,Z.n=2},face:($)=>({cx:$.cx,cy:$.cy+$.ry*0.05,rx:$.rx*0.88,ry:$.ry*0.88}),decorate:($,Z,J)=>{J.extra.push(E20(Z.cx,Z.cy,Z.rx,Z.ry,$.num("droplet.tip",1.4,1.65)))}},a20={name:"hexagon",core:1.05,path:bS,face:m20,body:($,Z)=>{Z.sides=6,Z.rot=$.num("body.rot",-12,12),Z.round=$.num("poly.round",0.24,0.5)}},o20={name:"sun",core:0.7,decorate:($,Z,J)=>{let H=$.int("sun.n",6,9),B=Z.rx*$.num("sun.dist",1,1.08),Q=Z.rx*$.num("sun.r",0.2,0.26),X=$.num("sun.rot",0,2*Math.PI);for(let z=0;z<H;z++){let G=X+2*Math.PI*z/H;J.petals.push({cx:Z.cx+Math.cos(G)*B,cy:Z.cy+Math.sin(G)*B,r:Q})}}},n20={name:"triangle",core:1.15,path:bS,body:($,Z)=>{Z.sides=3,Z.rot=$.num("body.rot",-5,5),Z.round=$.num("poly.round",0.24,0.5)},face:($)=>({cx:$.cx,cy:$.cy+$.ry*0.1,rx:$.rx*0.54,ry:$.ry*0.36})},s20=[[u20,0.22],[p20,0.48],[c20,0.6],[d20,0.7],[l20,0.79],[i20,0.86],[r20,0.915],[a20,0.95],[o20,0.98],[n20,1]],RS=g20(s20,f20),t20=h20(RS),e20=($,Z)=>(J,H)=>{let B=Z?Z.vars(Z.p):{},Q=Z?.tint?Z.tint(H,Z.p):H;return{cls:W20($,!!Object.keys(B).length||!!Z?.tint),vars:{...q20(J),"--mo-head":Q.head,"--mo-eye":Q.eye,...B}}};function $40($,Z={}){return v20(RS)($,Z,Z.animate&&e20(Z.animate,Z.expression))}function Z40($,Z){return"data:image/svg+xml,"+t20($,Z).replace(/"/g,"'").replace(/[%#<>{}|\\^[\]`]/g,(J)=>"%"+J.charCodeAt(0).toString(16).toUpperCase()).replace(/\s+/g," ")}function IS({name:$,size:Z,background:J,palette:H,hue:B,tone:Q,normalize:X,contrast:z,title:G,animate:U,expression:Y,traits:F,...K}){let W={size:Z,background:J,palette:H,hue:B,tone:Q,normalize:X,contrast:z,title:G,expression:Y,traits:F},N=JSON.stringify([$,W,U]),q=yU.useMemo(()=>U?"":Z40($,W),[N]),D=yU.useMemo(()=>U?$40($,{...W,animate:U}):null,[N]),A=yU.useMemo(()=>({__html:D?.inner??""}),[D?.inner]);if(D){let{style:O,...M}=K;return R$.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 100 100",width:Z,height:Z,role:G?"img":void 0,"aria-hidden":G?void 0:!0,style:{...D.vars,...O},...M,children:[G?R$.jsx("title",{children:G}):null,D.bg?R$.jsx("path",{d:D.bg.d,fill:D.bg.fill}):null,R$.jsx("g",{className:D.cls,dangerouslySetInnerHTML:A})]})}let{alt:V,...L}=K;return R$.jsx("img",{src:q,width:Z,height:Z,alt:V??G??"",...L})}var xU=IS;var EJ={};k5(EJ,{Root:()=>yS,Image:()=>vS,Fallback:()=>fS});var jJ=P(m(),1);var hU=P(m(),1),YV=hU.createContext(void 0);function vU(){let $=hU.useContext(YV);if($===void 0)throw Error(I0(13));return $}var TJ={imageLoadingStatus:()=>null};var kS=P(u(),1),yS=jJ.forwardRef(function(Z,J){let{className:H,render:B,style:Q,...X}=Z,[z,G]=jJ.useState("idle"),U={imageLoadingStatus:z},Y=jJ.useMemo(()=>({imageLoadingStatus:z,setImageLoadingStatus:G}),[z,G]),F=G0("span",Z,{state:U,ref:J,props:X,stateAttributesMapping:TJ});return kS.jsx(YV.Provider,{value:Y,children:F})});var YQ=P(m(),1);var xS=P(m(),1);function hS($,{referrerPolicy:Z,crossOrigin:J,sizes:H,srcSet:B},Q){let X=xS.useState("idle"),z=X[1];return H0(()=>{if(!Q)return G1;if(!$&&!B)return z("error"),G1;let G=!0,U=new window.Image,Y=(F)=>()=>{if(!G)return;z(F)};if(z("loading"),U.onload=Y("loaded"),U.onerror=Y("error"),Z)U.referrerPolicy=Z;if(U.crossOrigin=J??null,H)U.sizes=H;if(B)U.srcset=B;if($)U.src=$;if(U.complete)z(U.naturalWidth>0?"loaded":"error");return()=>{G=!1}},[Q,$,B,H,J,Z,z]),X}var J40={...TJ,...Y2},vS=YQ.forwardRef(function(Z,J){let{className:H,render:B,onLoadingStatusChange:Q,keepMounted:X=!1,style:z,sizes:G,srcSet:U,src:Y,...F}=Z,{setImageLoadingStatus:K}=vU(),[W,N]=hS(Y,Z,!X),q=W==="loaded",{mounted:D,transitionStatus:A,setMounted:V}=k2(q),L=YQ.useRef(null),O=YQ.useRef(!0);H0(()=>{if(!X)return;let k=O.current;O.current=!1;let S=L.current;if(!S)return;if(!S.complete){N("loading");return}let I=S.naturalWidth>0?"loaded":"error";if(N(I),I==="loaded"&&k)V(!0)},[X,Y,U,G,F.crossOrigin,F.referrerPolicy,B,N,V]);let M=X?{"data-loading":W==="loading"?"":void 0,"data-error":W==="error"?"":void 0,"aria-hidden":W!=="loaded"||void 0,onLoad(){N("loaded")},onError(){N("error")}}:void 0,_=Y0((k)=>{Q?.(k),K(k)});H0(()=>{if(W!=="idle")_(W)},[W,_]),H0(()=>{return()=>K("idle")},[K]),L5({enabled:!q,open:q,ref:L,onComplete(){if(!q)V(!1)}});let w={imageLoadingStatus:W,transitionStatus:X&&A==="ending"?void 0:A},C=X||D,E={};if(G!==void 0)E.sizes=G;if(U!==void 0)E.srcSet=U;if(Y!==void 0)E.src=Y;let T=G0("img",Z,{state:w,ref:[J,L],props:[M,F,E],stateAttributesMapping:J40,enabled:C});if(!C)return null;return T});var CJ=P(m(),1);var fS=CJ.forwardRef(function(Z,J){let{className:H,render:B,delay:Q=0,style:X,...z}=Z,{imageLoadingStatus:G}=vU(),[U,Y]=CJ.useState(Q===0),F=s1();return CJ.useEffect(()=>{if(Q>0)F.start(Q,()=>Y(!0));else Y(!0);return F.clear},[F,Q]),G0("span",Z,{state:{imageLoadingStatus:G},ref:J,props:z,stateAttributesMapping:TJ,enabled:G!=="loaded"&&(Q===0||U)})});var I$=P(u(),1);function gS({className:$,size:Z="default",...J}){return I$.jsx(EJ.Root,{"data-slot":"avatar","data-size":Z,className:d0("group/avatar relative isolate flex shrink-0 rounded-full select-none after:absolute after:inset-0 after:rounded-full after:border after:border-border after:mix-blend-darken data-[size=default]:size-8 data-[size=lg]:size-10 data-[size=sm]:size-6 data-[size=xs]:size-5 dark:after:mix-blend-lighten","[--avatar-badge-size:--spacing(2.5)] data-[size=sm]:[--avatar-badge-size:--spacing(2)] data-[size=xs]:[--avatar-badge-size:--spacing(1.5)]","has-[>[data-slot=avatar-badge]]:[&::after,&>:where([data-slot=avatar-image],[data-slot=avatar-fallback])]:mask-[radial-gradient(circle_at_calc(100%_-_var(--avatar-badge-size)/2)_calc(100%_-_var(--avatar-badge-size)/2),transparent_calc(var(--avatar-badge-size)/2_+_2px),black_calc(var(--avatar-badge-size)/2_+_2.5px))]",$),...J})}function mS({className:$,...Z}){return I$.jsx(EJ.Image,{"data-slot":"avatar-image",className:d0("aspect-square size-full rounded-full object-cover",$),...Z})}function uS({className:$,...Z}){return I$.jsx(EJ.Fallback,{"data-slot":"avatar-fallback",className:d0("flex size-full items-center justify-center overflow-hidden rounded-full bg-muted text-sm text-muted-foreground group-data-[size=sm]/avatar:text-xs group-data-[size=xs]/avatar:text-xs",$),...Z})}function pS({className:$,...Z}){return I$.jsx("span",{"data-slot":"avatar-badge",className:d0("absolute right-0 bottom-0 size-(--avatar-badge-size) rounded-full bg-primary select-none",$),...Z})}function cS({className:$,...Z}){return I$.jsx("div",{"data-slot":"avatar-group",className:d0("group/avatar-group flex items-center -space-x-2 [--avatar-radius:--spacing(4)]","*:data-[size=lg]:[--avatar-radius:--spacing(5)] *:data-[size=sm]:[--avatar-radius:--spacing(3)] *:data-[size=xs]:[--avatar-radius:--spacing(2.5)]","[&>[data-slot=avatar]:not(:last-child)]:mask-[radial-gradient(circle_at_calc(100%_+_var(--avatar-radius)_-_--spacing(2))_50%,transparent_calc(var(--avatar-radius)_+_2px),black_calc(var(--avatar-radius)_+_2.5px))]",$),...Z})}function dS({className:$,size:Z="default",...J}){return I$.jsx("div",{"data-slot":"avatar-group-count","data-size":Z,className:d0("relative flex shrink-0 items-center justify-center rounded-full bg-accent text-sm text-muted-foreground [&>svg]:size-4","data-[size=default]:size-8 data-[size=lg]:size-10 data-[size=sm]:size-6 data-[size=xs]:size-5","data-[size=sm]:text-[11px] data-[size=xs]:text-[11px]","data-[size=lg]:[&>svg]:size-5 data-[size=sm]:[&>svg]:size-3 data-[size=xs]:[&>svg]:size-3",$),...J})}function l6($){return $.name?.trim()||$.email?.trim()||$.id}var f5=P(m(),1);function lS($,Z){let J=$.filter((H)=>H.userId===Z);return J.some((H)=>H.location?.status==="active")?"active":J.length?"away":"offline"}function iS($,Z,J){if(J!==void 0)return J;let H=new Map($.map((B)=>[B.id,B]));if(Z)H.set(Z.id,Z);return[...H.values()]}function bJ($,Z){let J=$.users.find((H)=>H.id===Z);return J?{...J,status:lS($.connections,Z)}:void 0}function rS($,Z,J,{scope:H="page",status:B}={}){let Q=[],X=new Set($.connections.filter((z)=>z.userId!==Z&&(H==="workspace"||J!==null&&z.location?.page===J.page)).map((z)=>z.userId));for(let z of X){let G=bJ($,z);if(G&&(!B||G.status===B))Q.push(G)}return Q}function aS($,Z){return[...Z.users].sort((H,B)=>Number(B.id===Z.currentUser?.id)-Number(H.id===Z.currentUser?.id)).map((H)=>{let B=new Set;for(let X of $){if(X.userId!==H.id||X.connectionId===Z.connectionId)continue;if(X.location)B.add(X.location.page)}let Q=H.id===Z.currentUser?.id;if(Q&&Z.page)B.add(Z.page);return{profile:H,self:Q,pages:[...B],status:lS($,H.id)}})}function oS($,Z,J=()=>!0){let H=!1,B=()=>{if(!H)return;H=!1,$.deletePresence(Z.registrationId)};return{publish(Q,X){if(!X||!J(Q)){B();return}H=!0,$.setPresence({...Z,value:Q})},clear:B}}function FV(){let $=f6();return f5.useSyncExternalStore($.subscribe,$.getUsersSnapshot,$.getUsersSnapshot)}function wJ(){let $=f6(),Z=FV(),J=f5.useSyncExternalStore($.subscribeCurrentUser,$.getCurrentUser,$.getCurrentUser),H=f5.useSyncExternalStore($.subscribeDirectory,$.getDirectory,$.getDirectory),B=f5.useMemo(()=>iS(Z.users,J,H),[Z.users,J,H]);return{state:Z,self:J,users:B,engine:$}}function SJ($){let{state:Z,users:J}=wJ();return f5.useMemo(()=>bJ({...Z,users:J},$),[Z,J,$])}function i6($){let{state:Z,users:J}=wJ();return $.map((H)=>bJ({...Z,users:J},H))}function fU({status:$}={}){let{state:Z,users:J}=wJ();return f5.useMemo(()=>J.map((H)=>bJ({...Z,users:J},H.id)).filter((H)=>!$||H.status===$),[Z,J,$])}function gU(){let{state:$,self:Z,users:J}=wJ();return f5.useMemo(()=>Z?bJ({...$,users:J},Z.id):void 0,[$,Z,J])}function nS($={}){let{state:Z,self:J,users:H,engine:B}=wJ(),{scope:Q,status:X}=$;return f5.useMemo(()=>rS({...Z,users:H},J?.id,B.getLocation(),{scope:Q,status:X}),[Z,J,H,B,Q,X])}var RJ={custom:($)=>`custom:${$}`,cursor:($)=>`cursor:${$}`,target:($)=>`field:${$}`};function sS($){return FQ(RJ.custom($))}function FQ($){let{users:Z,engine:J}=wJ(),H=iD(),B=H?.appletId??"",Q=f5.useCallback(()=>J.getPresenceSnapshot(B,$),[J,B,$]),X=f5.useSyncExternalStore(J.subscribe,Q,Q);return f5.useMemo(()=>{if(!H?.active)return[];let z=new Set(Z.map((G)=>G.id));return X.filter((G)=>z.has(G.userId)).map((G)=>({connectionId:G.connectionId,userId:G.userId,value:G.value}))},[X,Z,H])}function KQ($,Z,J){let H=f6(),B=iD(),[Q]=f5.useState(()=>crypto.randomUUID()),X=f5.useRef(Z),z=f5.useRef(!1),G=B?.appletId??"",U=f5.useMemo(()=>oS(H,{registrationId:Q,appletId:G,channel:$},J),[H,Q,G,$,J]),Y=f5.useCallback(()=>{U.publish(X.current,B?.active===!0&&document.visibilityState!=="hidden")},[B,U]);return f5.useLayoutEffect(()=>{if(!B?.active)return;return z.current=!0,Y(),document.addEventListener("visibilitychange",Y),()=>{z.current=!1,document.removeEventListener("visibilitychange",Y),U.clear()}},[B,Y,U]),f5.useCallback((F)=>{if(X.current=F,z.current)Y()},[Y])}function H40($,Z,J){let H=KQ($,Z,J);f5.useLayoutEffect(()=>H(Z),[H,Z])}function tS($,Z){H40(RJ.custom($),Z)}var a3=P(u(),1);function eS({id:$,size:Z,showStatusBadge:J,className:H}){let B=SJ($);return a3.jsx(o3,{profile:B,size:Z,active:J&&B?.status==="active",className:H})}function o3({profile:$,size:Z="default",className:J,active:H}){let B=$?l6($):"Unknown user";return a3.jsxs(gS,{size:Z,"aria-label":B,"data-collab-color":$?.color??"unknown",className:Q0("after:border-0",J),children:[$?.avatar&&a3.jsx(mS,{src:$.avatar,alt:""}),a3.jsx(uS,{children:$?a3.jsx(xU,{className:"scale-150",name:$.id,animate:"hover",background:"circle",traits:{"eye.rx":1},palette:{bg:"var(--collab)",head:"var(--collab)",eye:"var(--collab-foreground)"}}):a3.jsx(mU,{size:Z==="xs"||Z==="sm"?12:16,stroke:1.75})}),H&&a3.jsx(pS,{className:"bg-success"})]})}var V9=P(u(),1);function uU({id:$,showStatusBadge:Z,showYouLabel:J,...H}){let B=SJ($),Q=gU();return V9.jsx(IJ,{...H,profile:B,active:Z&&B?.status==="active",showYouLabel:J&&B!==void 0&&B.id===Q?.id})}function IJ({profile:$,size:Z="default",active:J,showYouLabel:H,description:B,className:Q}){let X=$?l6($):"Unknown user";return V9.jsxs("span",{className:Q0("flex min-w-0 items-center gap-2",Q),children:[V9.jsx(o3,{profile:$,size:Z,active:J}),V9.jsxs("span",{className:Q0("flex min-w-0 flex-1 text-sm",Z==="xs"?"items-baseline":"flex-col"),children:[V9.jsxs("span",{className:"flex min-w-0 items-baseline gap-1",children:[V9.jsx("span",{className:Q0("truncate",!$&&"text-muted-foreground"),children:X}),H&&V9.jsx("span",{className:"shrink-0 text-muted-foreground",children:"(You)"})]}),B&&V9.jsxs("span",{className:Q0("truncate text-muted-foreground",Z==="sm"&&"text-xs leading-tight"),children:[Z==="xs"&&V9.jsx("span",{"aria-hidden":"true",className:"whitespace-pre",children:" · "}),B]})]})]})}var kJ=P(u(),1);function pU({ids:$,...Z}){let J=i6([...new Set($)]);return kJ.jsx(B40,{users:J,...Z})}function B40({users:$,max:Z=3,size:J="sm",className:H}){let B=$.slice(0,Z),Q=$.length-B.length;return kJ.jsxs(cS,{className:H,"aria-label":`${$.length} users`,children:[B.map((X,z)=>kJ.jsx(o3,{profile:X,size:J},X?.id??z)),Q>0&&kJ.jsxs(dS,{size:J,"aria-label":`${Q} more`,children:["+",Q]})]})}var W2=P(u(),1),$R={active:0,away:1,offline:2};function KV({workspaceId:$,describeTab:Z,onOpenTab:J}){let H=a2(),B=f6(),Q=FV(),X=fU(),z=dU.useSyncExternalStore(B.subscribeCurrentUser,B.getCurrentUser,B.getCurrentUser),G=w2(),U=dD(X$(G),$,G.base),Y=aS(Q.connections,{currentUser:z,connectionId:Q.connectionId,users:X,page:U}),F=Y.filter((N)=>N.self||N.status!=="offline").map((N)=>N.profile.id),[K,W]=dU.useState(!1);if(!H)return null;return W2.jsxs(p6,{open:K,onOpenChange:W,children:[W2.jsxs(c6,{render:W2.jsx(L0,{variant:"ghost",size:"sm","aria-label":"Users in this workspace",className:"gap-0.5 rounded-full pr-1 pl-1 data-popup-open:bg-accent"}),children:[W2.jsx(pU,{ids:F,size:"xs",max:4}),W2.jsx(cU,{stroke:2.5,className:"size-3! text-muted-foreground"})]}),W2.jsxs(d6,{align:"end",className:"max-w-64 p-1",children:[W2.jsx(AS,{className:"sr-only",children:"Users in this workspace"}),W2.jsx(Q40,{users:Y,page:U,describeTab:Z,onOpenTab:(N)=>{W(!1),J(N)}}),Y.length===0&&W2.jsx("p",{className:"px-2 py-1 text-xs text-muted-foreground",children:"No workspace users to show."})]})]})}function Q40({users:$,page:Z,describeTab:J,onOpenTab:H}){let B=$.toSorted((Q,X)=>$R[Q.status]-$R[X.status]||Number(X.self)-Number(Q.self));return W2.jsx("ul",{className:"flex max-h-80 scroll-fade flex-col overflow-y-auto",children:B.map((Q)=>W2.jsx(X40,{user:Q,page:Z,describeTab:J,onOpenTab:H},Q.profile.id))})}function X40({user:$,page:Z,describeTab:J,onOpenTab:H}){let B=$.pages.map((K)=>{let W=b$(K);return{tab:W,info:W?J(W):null}}),Q=$.self||$.status==="offline"?void 0:B.find(({tab:K,info:W})=>K!==null&&W!==null&&K!==Z),X=Q?.tab,z=[...new Set(B.map(({tab:K,info:W})=>W?.label??K??"Another tab"))].join(", "),G=$.status==="offline"?"Offline":$.status==="away"?z?`${z} · Away`:"Away":z||"Another tab",U=$.status==="offline"?void 0:B[0]?.info?.Icon,Y=W2.jsx(uU,{id:$.profile.id,className:"flex-1",size:"sm",showYouLabel:!0,description:W2.jsxs("span",{className:"flex items-center gap-1 text-xs",children:[U&&W2.jsx(U,{size:12,stroke:1.75,className:"shrink-0"}),W2.jsx("span",{className:"truncate",children:G})]})}),F="flex w-full items-center gap-2.5 rounded-md px-2 py-1 text-left";return W2.jsx("li",{children:X?W2.jsx("button",{type:"button",title:`Go to ${Q?.info?.label}`,className:Q0("flex w-full items-center gap-2.5 rounded-md px-2 py-1 text-left","cursor-pointer outline-none hover:bg-accent focus-visible:ring-3 focus-visible:ring-ring/50"),onClick:()=>H(X),children:Y}):W2.jsx("div",{className:"flex w-full items-center gap-2.5 rounded-md px-2 py-1 text-left",children:Y})})}var k$=P(m(),1);function ZR($){return G0($.defaultTagName??"div",$,$)}var z40=r6("group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-sm border border-transparent px-1.5 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",secondary:"bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",destructive:"bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20",outline:"border-border text-foreground [a]:hover:bg-accent [a]:hover:text-accent-foreground",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"}},defaultVariants:{variant:"default"}});function lU({className:$,variant:Z="default",render:J,...H}){return ZR({defaultTagName:"span",props:K2({className:d0(z40({variant:Z}),$)},H),render:J,state:{slot:"badge",variant:Z}})}var a6=P(m(),1);function iU(...$){if(!$.length||$.some((Z)=>typeof Z!=="string"||!Z.trim()))throw Error("PresenceGroup, PresenceFrame, and PresenceAvatars require a nonempty id.");return $.map((Z)=>encodeURIComponent(Z)).join("/")}var WV=($)=>$!==!1&&$!==null,yJ=a6.createContext([]);function rU($){return iU(...a6.useContext(yJ),$)}function aU($,Z){let J=Z===void 0,H=a6.useRef(null),B=RJ.target($),Q=FQ(B),X=KQ(B,!1,WV),z=(U,Y)=>Y!==null&&U instanceof Element&&U.closest("[data-presence-target]")===Y;a6.useLayoutEffect(()=>{X(Z??z(document.activeElement,H.current))},[$,Z,X]);let G=new Map;for(let U of Q)if(U.value===!0&&!G.has(U.userId))G.set(U.userId,{id:U.userId,connectionId:U.connectionId});return{users:[...G.values()],props:{ref:H,"data-collab-target":$,"data-presence-target":J?$:void 0,onFocusCapture:J?(U)=>X(z(U.target,U.currentTarget)):void 0,onBlurCapture:J?(U)=>X(z(U.relatedTarget,U.currentTarget)):void 0}}}var m8=P(u(),1);function G40($){if(!$||typeof $!=="object"||Array.isArray($))return null;if(typeof $.x!=="number"||typeof $.y!=="number")return null;if(!Number.isFinite($.x)||!Number.isFinite($.y))return null;return{x:$.x,y:$.y,...typeof $.target==="string"?{target:$.target}:{},...typeof $.targetX==="number"&&Number.isFinite($.targetX)?{targetX:$.targetX}:{},...typeof $.targetY==="number"&&Number.isFinite($.targetY)?{targetY:$.targetY}:{}}}function HR({id:$="default",...Z}){let J=RJ.cursor($),H=FQ(J),B=KQ(J,null,WV),Q=new Map;for(let{connectionId:G,userId:U,value:Y}of H){let F=G40(Y);if(F)Q.set(G,{id:U,point:F})}let X=[...Q],z=i6(X.map(([,G])=>G.id));return m8.jsx(U40,{...Z,id:$,onPositionChange:B,cursors:X.map(([G,{point:U}],Y)=>({connectionId:G,point:U,profile:z[Y]}))})}function U40({id:$="default",children:Z,className:J,cursors:H,onPositionChange:B}){let Q=k$.useRef(null),X=k$.useRef(null);k$.useLayoutEffect(()=>{let G=Q.current,U=X.current;if(!G||!U)return;let Y=()=>{U.style.transform=`translate(${G.scrollLeft}px, ${G.scrollTop}px)`};return Y(),G.addEventListener("scroll",Y),()=>G.removeEventListener("scroll",Y)},[]);let z=(G)=>{if(G.pointerType==="touch")return;let U=Q.current;if(!U||!(G.target instanceof Element)||G.target.closest("[data-collab-cursors]")!==U)return;let Y=U.getBoundingClientRect(),F=G.target instanceof Element?G.target.closest("[data-collab-target]"):null,K=F&&U.contains(F)?F:null,W=K?.getBoundingClientRect();B?.({x:G.clientX-Y.left-U.clientLeft+U.scrollLeft,y:G.clientY-Y.top-U.clientTop+U.scrollTop,...K&&W?{target:K.dataset.collabTarget??"",targetX:W.width?(G.clientX-W.left)/W.width:0,targetY:W.height?(G.clientY-W.top)/W.height:0}:{}})};return m8.jsxs("div",{ref:Q,"data-collab-cursors":$,className:Q0("relative",J),onPointerEnter:z,onPointerMove:z,onPointerLeave:(G)=>{if(G.target instanceof Element&&G.target.closest("[data-collab-cursors]")===G.currentTarget)B?.(null)},children:[Z,m8.jsx("div",{ref:X,className:"pointer-events-none absolute inset-0 overflow-hidden","aria-hidden":"true",children:H.map(({connectionId:G,point:U,profile:Y})=>m8.jsx(Y40,{root:Q,point:U,profile:Y},G))})]})}function Y40({root:$,point:Z,profile:J}){let H=k$.useRef(null);return k$.useLayoutEffect(()=>{let B=$.current,Q=H.current;if(!B||!Q)return;let X=(Y=!1)=>{let F=Z.x-B.scrollLeft,K=Z.y-B.scrollTop;if(Z.target){let N=[...B.querySelectorAll("[data-collab-target]")].find((A)=>A.dataset.collabTarget===Z.target);if(!N){Q.hidden=!0;return}let q=B.getBoundingClientRect(),D=N.getBoundingClientRect();F=D.left-q.left-B.clientLeft+D.width*(Z.targetX??0),K=D.top-q.top-B.clientTop+D.height*(Z.targetY??0)}let W=`translate(${F}px, ${K}px)`;if(Q.hidden||Q.style.transform!==W)Q.dataset.moving=Y&&!Q.hidden?"true":"false",Q.style.transform=W;Q.hidden=!1};X(!0);let z=()=>X(),G=new ResizeObserver(z);G.observe(B);let U=new MutationObserver(z);return U.observe(B,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["data-collab-target"]}),B.addEventListener("scroll",z,!0),window.addEventListener("resize",z),()=>{G.disconnect(),U.disconnect(),B.removeEventListener("scroll",z,!0),window.removeEventListener("resize",z)}},[$,Z]),m8.jsx(F40,{ref:H,profile:J})}function F40({profile:$,ref:Z}){return m8.jsx("span",{ref:Z,hidden:!0,"aria-hidden":"true","data-collab-color":$?.color??"unknown",className:"pointer-events-none absolute top-0 left-0 transition-transform duration-100 ease-linear data-[moving=false]:transition-none motion-reduce:transition-none",children:m8.jsxs("span",{className:"relative block animate-in duration-200 zoom-in-75 fade-in",children:[m8.jsx(JR,{size:24,stroke:1.5,className:"-translate-x-0.5 -translate-y-0.5 fill-collab stroke-white drop-shadow-xs"}),m8.jsx(lU,{className:"absolute top-3.5 left-3.5 bg-collab text-collab-foreground",children:m8.jsx("span",{className:"truncate",children:$?l6($):"Someone"})})]})})}var oU=P(m(),1);var o6=P(u(),1);function BR({id:$,present:Z,align:J,children:H,className:B}){let Q=rU($),X=aU(Q,Z),z=i6(X.users.map((G)=>G.id)).filter((G)=>G!==void 0);return o6.jsx(K40,{...X.props,users:z,align:J,className:B,children:H})}function K40({users:$,align:Z,children:J,className:H,...B}){return o6.jsxs("div",{className:Q0("relative",H),...B,children:[o6.jsx(q40,{names:$.map(l6).join(", "),color:$[0]?.color,align:Z}),J]})}var WQ=4,W40=6,N40=["borderTopLeftRadius","borderTopRightRadius","borderBottomRightRadius","borderBottomLeftRadius"];function q40({names:$,color:Z,align:J="end"}){let H=oU.useRef(null);return oU.useLayoutEffect(()=>{let B=H.current,Q=B?.parentElement;if(!$||!B||!Q)return;let X=()=>{let G=[...Q.children].filter((A)=>{if(A===B)return!1;let{display:V,position:L}=getComputedStyle(A);return V!=="none"&&L!=="absolute"&&L!=="fixed"}),U=[...Q.childNodes].some((A)=>A.nodeType===Node.TEXT_NODE&&A.textContent?.trim()),Y=G.length===1&&!U?G[0]:null,F=Y instanceof HTMLElement?Y:null,W=(F??Q).getBoundingClientRect(),N=Q.getBoundingClientRect(),q=B.style;q.left=`${W.left-N.left-Q.clientLeft+Q.scrollLeft-WQ}px`,q.top=`${W.top-N.top-Q.clientTop+Q.scrollTop-WQ}px`,q.width=`${W.width+WQ*2}px`,q.height=`${W.height+WQ*2}px`,q.setProperty("--presence-target-width",`${W.width}px`);let D=F?getComputedStyle(F):null;for(let A of N40)q[A]=D?`calc(${D[A]} + ${WQ}px)`:`${W40}px`};X();let z=new ResizeObserver(X);z.observe(Q);for(let G of Q.children)if(G!==B)z.observe(G);return()=>z.disconnect()}),o6.jsx("div",{ref:H,hidden:!$,"data-align":J,"data-collab-color":Z??"unknown",className:"group/frame pointer-events-none absolute m-0! animate-in ring-2 ring-collab duration-150 fade-in",children:o6.jsx(lU,{className:"absolute bottom-full mb-1.5 max-w-[min(var(--presence-target-width),10rem)] bg-collab text-collab-foreground group-data-[align=end]/frame:-right-0.5 group-data-[align=start]/frame:-left-0.5",children:o6.jsx("span",{className:"truncate",children:$})})})}var xJ=P(m(),1);var NQ=P(u(),1);function XR({id:$,children:Z}){let J=xJ.useContext(yJ),H=xJ.useMemo(()=>{return iU($),[...J,$]},[J,$]);return NQ.jsx(A40,{children:NQ.jsx(yJ,{value:H,children:Z})})}function A40({children:$}){let Z=xJ.useId();return NQ.jsx(QR,{reducedMotion:"user",children:NQ.jsx(nU,{id:Z,children:$})})}var zR=P(m(),1);var y$=P(u(),1);function GR({id:$,present:Z,align:J,children:H,className:B}){let Q=rU($),X=aU(Q,Z),z=i6(X.users.map((U)=>U.id)),G=zR.useContext(yJ).length>0;return y$.jsx(D40,{...X.props,users:X.users.map((U,Y)=>({...U,profile:z[Y]})),animate:G&&Z===void 0,align:J,className:B,children:H})}function D40({users:$,children:Z,animate:J=!1,align:H="center",className:B,...Q}){return y$.jsxs("div",{className:Q0("relative pl-8",B),...Q,children:[Z,y$.jsx("div",{"data-align":H,className:"pointer-events-none absolute inset-y-0 left-0 flex items-center -space-x-3 data-[align=end]:items-end data-[align=start]:items-start","aria-hidden":"true",children:$.map(({id:X,connectionId:z,profile:G})=>y$.jsx(K5.span,{layoutId:J?`presence:${z}`:void 0,children:y$.jsx(o3,{profile:G,size:"sm",className:"animate-in duration-200 zoom-in-75 fade-in"})},X))})]})}var NV={Cursors:HR,User:uU,UserAvatar:eS,UserAvatarGroup:pU,PresenceFrame:BR,PresenceAvatars:GR,PresenceGroup:XR,useMe:gU,usePeers:nS,useUser:SJ,useWorkspaceUsers:fU,usePresence:sS,usePublishPresence:tS};var UR=($)=>`moi:collab:${$}:session`,sU=()=>({selected:{},pinned:null});function n6($){try{let Z=sessionStorage.getItem(UR($));if(!Z)return sU();if(!Z.startsWith("{"))return{selected:{overview:Z},pinned:null};let J=JSON.parse(Z);if(!J||typeof J!=="object"||!("selected"in J))return sU();let H=J.selected;if(!H||typeof H!=="object"||Array.isArray(H))return sU();return{selected:Object.fromEntries(Object.entries(H).filter(([,B])=>typeof B==="string"||B===null)),pinned:null}}catch{return sU()}}function s6($,Z){try{sessionStorage.setItem(UR($),JSON.stringify({selected:Z.selected}))}catch{}}var hJ=P(m(),1);function N2($){return`draft:${$}`}function M2($,Z){return JSON.stringify([$,Z])}var V40=($)=>YR()(KR((Z)=>({discoveredWorkspacesOpen:!0,hasSentMessageFromMoi:!1,workspaceIdsPendingAnalysis:[],composerDrafts:{},dockedChatWidth:360,popupChatWidth:440,setDiscoveredWorkspacesOpen:(J)=>Z({discoveredWorkspacesOpen:J}),markWorkspacePendingAnalysis:(J)=>Z((H)=>{let B=H.workspaceIdsPendingAnalysis??[];return{workspaceIdsPendingAnalysis:B.includes(J)?B:[...B,J]}}),markMessageSentFromMoi:(J)=>Z((H)=>({hasSentMessageFromMoi:!0,workspaceIdsPendingAnalysis:(H.workspaceIdsPendingAnalysis??[]).filter((B)=>B!==J)})),setComposerDraft:(J,H)=>Z((B)=>{if(H===null?!(J in B.composerDrafts):B.composerDrafts[J]===H)return B;let Q={...B.composerDrafts};if(H===null)delete Q[J];else Q[J]=H;return{composerDrafts:Q}}),moveComposerDraft:(J,H)=>Z((B)=>{if(J===H||!(J in B.composerDrafts))return B;let Q={...B.composerDrafts};return Q[H]??=Q[J],delete Q[J],{composerDrafts:Q}}),setDockedChatWidth:(J)=>Z({dockedChatWidth:J}),setPopupChatWidth:(J)=>Z({popupChatWidth:J})}),{name:"moi:ui",...$?{storage:FR(()=>$)}:{}})),C1=V40();var n3={all:["app-ui"],sessionSelection:($)=>["app-ui","session-selection",$]};function o2($,Z="shared"){let J=n3.sessionSelection($);return Z==="browser-tab"?[...J,"browser-tab"]:J}function AQ($,Z="shared"){return{queryKey:o2($,Z),queryFn:()=>Z==="browser-tab"?Promise.resolve(n6($)):B1(`/api/workspaces/${$}/selected-session`),staleTime:1/0,gcTime:0,refetchOnMount:!1,refetchOnWindowFocus:!1}}function L40($,Z){return[...o2($,Z),"save"]}function qQ($,Z,J,H,B="shared"){let Q=o2(Z,B),X=$.getQueryData(Q),z=X?.selected[H]??null;if(X&&z===J&&(B==="shared"||(H in X.selected)))return null;let G={...X?.selected};if(J===null&&B==="shared")delete G[H];else G[H]=J;if($.setQueryData(Q,{selected:G,pinned:X?.pinned??null}),B==="browser-tab")s6(Z,{selected:G,pinned:null});return{sessionId:J,previousSessionId:z,tabId:H,scope:B}}function M40($,Z,J,H){let B=o2(Z,H.scope),Q=$.getQueryData(B),X=Q?.selected[H.tabId]??null;if(J.sessionId!==H.sessionId&&X!==J.sessionId)return"conflict";if(X!==H.sessionId&&X!==H.previousSessionId)return"ignored";let z={...Q?.selected};if(J.sessionId===null&&H.scope==="shared")delete z[H.tabId];else z[H.tabId]=J.sessionId;return $.setQueryData(B,{selected:z,pinned:Q?.pinned??null}),"applied"}function P40($,Z,J){if(J)return;$.invalidateQueries({queryKey:n3.sessionSelection(Z),exact:!0})}function tU($,Z,J,H){C1.getState().moveComposerDraft(M2(Z,J),M2(Z,H));for(let Q of["shared","browser-tab"])$.setQueryData(o2(Z,Q),(X)=>X?{selected:Object.fromEntries(Object.entries(X.selected).map(([z,G])=>[z,G===J?H:G])),pinned:X.pinned===J?H:X.pinned}:X);let B=n6(Z);s6(Z,{selected:Object.fromEntries(Object.entries(B.selected).map(([Q,X])=>[Q,X===J?H:X])),pinned:null})}function s3(){let $=qA()["*"];return X3($)?$:"overview"}function qV($,Z,J){if(!$)return;if($.pinned)return $.pinned;if(J&&Z in J.selected)return J.selected[Z]??null;return $.selected[Z]??null}function t3($){let Z=s3(),J=$??Z,H=d1(),Q=a2()?"browser-tab":"shared",X=a0(),z=hJ.useMemo(()=>o2(H,Q),[H,Q]),G=hJ.useMemo(()=>L40(H,Q),[H,Q]),U=CB({mutationKey:G,exact:!0}),Y=m1(AQ(H,Q)),F=WR().data,{mutate:K,mutateAsync:W}=r1({mutationKey:G,scope:{id:`selected-session:${H}`},mutationFn:(A)=>{if(A.scope==="browser-tab")return s6(H,X.getQueryData(z)??n6(H)),Promise.resolve({sessionId:A.sessionId});return B1(`/api/workspaces/${H}/selected-session`,Z5("PUT",A),"Couldn’t save selected chat")},onSuccess:(A,V)=>{if(M40(X,H,A,V)!=="conflict")return;T1.add({title:"Couldn’t save selected chat",type:"error"}),X.invalidateQueries({queryKey:z,exact:!0})},onError:(A,V)=>{if((X.getQueryData(z)?.selected[V.tabId]??null)!==V.sessionId)return;T1.add({title:"Couldn’t save selected chat",type:"error"}),X.invalidateQueries({queryKey:z,exact:!0})},onSettled:()=>{if(Q==="shared"&&X.isMutating({mutationKey:G,exact:!0})===1)X.invalidateQueries({queryKey:z,exact:!0})}}),N=hJ.useCallback((A)=>{if(X.getQueryData(o2(H))?.pinned)return;let V=qQ(X,H,A,J,Q);if(V)K(V)},[X,K,H,J,Q]),q=hJ.useCallback(async(A,V)=>{let L=qQ(X,H,A,V,Q);if(!L)return;if((await W(L)).sessionId!==A||X.getQueryData(z)?.selected[V]!==A)throw Error("Couldn’t save selected chat")},[X,z,W,Q,H]);return P2((A)=>{if(A.type!=="selected-session:updated"||A.workspaceId!==H)return;P40(X,H,Q==="shared"&&U>0)}),[Y.data===void 0||F===void 0?void 0:qV(F,J,Q==="browser-tab"?Y.data:void 0),N,q]}function WR(){let $=d1();return m1(AQ($))}function t6(){let $=d1(),Z=a0(),{data:J}=WR(),H=r1({scope:{id:`pinned-session:${$}`},mutationFn:(B)=>B1(`/api/workspaces/${$}/pinned-session`,Z5("PUT",{sessionId:B})),onMutate:(B)=>{let Q=n3.sessionSelection($),X=Z.getQueryData(Q)?.pinned??null;return Z.setQueryData(Q,(z)=>({selected:z?.selected??{},pinned:B})),X},onError:(B,Q,X)=>{Z.setQueryData(n3.sessionSelection($),(z)=>z?.pinned===Q?{...z,pinned:X??null}:z),T1.add({title:"Couldn’t pin chat",type:"error"})},onSettled:()=>{Z.invalidateQueries({queryKey:n3.sessionSelection($),exact:!0})}});return{pinnedSessionId:J?.pinned??null,loaded:J!==void 0,pin:H.mutate,pinAsync:H.mutateAsync}}var NR=P(m(),1);var M8={staleTime:0,gcTime:300000,refetchOnMount:!0,refetchOnWindowFocus:!0};function qR($){return{queryKey:O0.sessions($),queryFn:()=>B1(`/api/workspaces/${$}/sessions`),...M8}}function vJ($){return m1(qR($))}function AR(){let $=d1(),Z=a0(),J=a2(),[,,H]=t3(),{pinAsync:B}=t6(),Q=q5({collabEnabled:J,selectSessionForTab:H,pinAsync:B});return NR.useCallback(async(X,z,G)=>{let{collabEnabled:U,selectSessionForTab:Y,pinAsync:F}=Q.current;G.throwIfAborted();let K=Z.getQueryData(O0.sessions($))??[];if(!K.some((N)=>N.sessionId===X))K=await Z.fetchQuery(qR($));if(G.throwIfAborted(),!K.some((N)=>N.sessionId===X))return!1;if(await Z.ensureQueryData(AQ($)),U)await Z.ensureQueryData(AQ($,"browser-tab"));G.throwIfAborted();let W=Z.getQueryData(o2($))?.pinned;if(W&&W!==X)await F(null),G.throwIfAborted();if(W!==X)await Y(X,z),G.throwIfAborted();return!0},[Z,Q,$])}function _40($,Z){return $?.filter((J)=>J.sessionId!==Z)}function AV($,Z,J){let H=O0.sessions(Z);$.cancelQueries({queryKey:H}),$.setQueryData(H,(B)=>_40(B,J)),$.removeQueries({queryKey:O0.events(Z,J)}),$.removeQueries({queryKey:O0.session(Z,J)});for(let B of["shared","browser-tab"]){let Q=o2(Z,B),X=$.getQueryData(Q)??(B==="browser-tab"?n6(Z):void 0);if(!X)continue;let z=X.pinned===J,G=Object.fromEntries(Object.entries(X.selected));for(let[Y,F]of Object.entries(G)){if(F!==J)continue;if(z=!0,B==="browser-tab")G[Y]=null;else delete G[Y]}if(!z)continue;let U={selected:G,pinned:X.pinned===J?null:X.pinned};if($.setQueryData(Q,U),B==="browser-tab")s6(Z,U)}$.invalidateQueries({queryKey:o2(Z),exact:!0})}function DR($){let Z=a0();return r1({mutationFn:(J)=>W4(`/api/workspaces/${$}/sessions/${J}/archive`,{method:"POST"},"Couldn’t archive chat"),onSuccess:(J,H)=>{AV(Z,$,H),Z.invalidateQueries({queryKey:O0.previews})}})}function VR($,Z){return m1({...Vw($,Z??""),enabled:Boolean(Z)})}function eU($,Z){return m1({queryKey:O0.session($,Z??""),queryFn:()=>B1(`/api/workspaces/${$}/sessions/${Z}`),enabled:Boolean(Z),staleTime:1/0,gcTime:300000,refetchOnMount:!1,refetchOnWindowFocus:!1})}function LR($){let Z=a0();return r1({mutationFn:({patch:J,sessionId:H})=>B1(`/api/workspaces/${$}/sessions/${H}/config`,Z5("PUT",J),"Failed to save chat settings"),onSuccess:(J,{sessionId:H})=>{Z.setQueryData(O0.session($,H),J)}})}function PR($,Z){let{queryClient:J,sendMessage:H,onWorkspaceSwitch:B}=Z,Q=x1.getState();if($.type==="status_snapshot"){Q.reconcileActivity($.sessions??[]);return}if($.type==="status"){let{workspaceId:U,sessionId:Y,activity:F}=$;if(Q.setActivity(U,Y,F),F!=="running")Q.clearPreviewsForSession(U,Y);return}if($.type==="preview"){let U=$,Y=O0.events(U.workspaceId,U.sessionId);if(J?.getQueryData(Y)===void 0)return;Q.setPreview({workspaceId:U.workspaceId,sessionId:U.sessionId,messageId:U.messageId,parentToolUseId:U.parentToolUseId,blocks:U.blocks});return}if($.type==="session_renamed"){let{workspaceId:U,from:Y,to:F}=$,K=O0.sessions(U),N=J?.getQueryData(K)?.find((A)=>A.sessionId===Y||A.sessionId===F);if(N)J?.cancelQueries({queryKey:K});if(Q.renameSession(U,Y,F),J)tU(J,U,Y,F);if(N)J?.setQueryData(K,(A)=>[{...N,sessionId:F},...(A??[]).filter((V)=>V.sessionId!==Y&&V.sessionId!==F)]);let q=J?.getQueryData(O0.events(U,Y));if(q!==void 0)J?.setQueryData(O0.events(U,F),q),J?.removeQueries({queryKey:O0.events(U,Y)});let D=J?.getQueryData(O0.session(U,Y));if(D!==void 0)J?.setQueryData(O0.session(U,F),D),J?.removeQueries({queryKey:O0.session(U,Y)});if(!N)J?.invalidateQueries({queryKey:K});J?.invalidateQueries({queryKey:O0.previews});return}if($.type==="sessions_changed"||$.type==="session_archived"){let U=$.workspaceId;if(J&&$.type==="session_archived"&&typeof $.sessionId==="string")AV(J,U,$.sessionId);let Y=O0.sessions(U);if(J?.invalidateQueries({queryKey:Y}),J?.invalidateQueries({queryKey:O0.previews}),typeof $.sessionId==="string")J?.invalidateQueries({queryKey:O0.session(U,$.sessionId)});return}if($.type==="workspace:switch"){B?.($.workspaceId);return}if($.type==="scratchpad:op"){let U=MR($.workspaceId);if(!U)return;let Y=$.opId;U($.op).then((F)=>H({type:"scratchpad:op-result",opId:Y,result:F}),(F)=>H({type:"scratchpad:op-result",opId:Y,error:F instanceof Error?F.message:String(F)}));return}let{workspaceId:X,sessionId:z}=$;if(!X||!z)return;let G=$.kind;if(G==="snapshot"||G==="turn"||G==="notice"||G==="result"){if(O40(J,X,z,$),G==="turn"){let U=$.turn?.meta?.apiMessageId;if(U)Q.clearPreview(U)}if(G==="result")Q.clearPreviewsForSession(X,z)}if(G==="error"&&typeof $.content==="string"){if(Q.setError(X,z,$.content),$.terminal!==!1)Q.setActivity(X,z,"idle"),Q.clearPreviewsForSession(X,z)}if(G==="stopped")Q.setActivity(X,z,"idle"),Q.clearPreviewsForSession(X,z)}function O40($,Z,J,H){if(!$)return;Dw($,Z,J,H);let B=O0.events(Z,J),Q=$.getQueryData(B);if(Q===void 0)return;$.setQueryData(B,LU(Q,H))}var VV=null,fJ=null,$Y=0,ZY=null,DV=[],OR=null,_R=null,T40=15000;function TR($){if(VV=$,!_R)_R=setInterval(()=>x1.getState().sweepPreviews(T40,Date.now()),5000);if(fJ)return;jR()}function jR(){let $=++$Y;if(ZY)clearTimeout(ZY),ZY=null;let Z=new WebSocket(FJ("/ws"));fJ=Z,Z.onopen=()=>{if($Y!==$){Z.close();return}for(let J of DV)Z.send(JSON.stringify(J));DV.length=0,VV?.invalidateQueries({queryKey:["workspaces","events"]}),x1.getState().clearAllPreviews()},Z.onmessage=(J)=>{if($Y!==$)return;let H;try{H=JSON.parse(J.data)}catch{return}j40(H)},Z.onclose=()=>{if($Y!==$)return;fJ=null,ZY=setTimeout(jR,1000)},Z.onerror=()=>Z.close()}function j40($){PR($,{queryClient:VV,sendMessage:JY,onWorkspaceSwitch:OR})}function JY($){if(fJ&&fJ.readyState===WebSocket.OPEN)fJ.send(JSON.stringify($));else DV.push($)}function LV($){OR=$}var u8=P(m(),1);var _2={all:["account"],session:["account","session"],team:["account","team"]};class h$ extends Error{status;constructor($,Z){super($);this.status=Z}}async function v$($,Z){let J=await fetch(`/cloud/api/auth/${$}`,{...Z,credentials:"same-origin"});if(!J.ok){let H=await J.json().catch(()=>{return}),B=x$(H)?[H.error,H.message].find((Q)=>typeof Q==="string"&&Q.trim().length>0):void 0;throw new h$(B??"Couldn’t complete this request. Try again.",J.status)}return J}function MV($,Z,J){return typeof $==="string"&&$===$.trim()&&typeof Z==="string"&&typeof J==="string"&&CR({id:$,name:Z.trim()||void 0,email:J,color:"blue"})}function C40($){if($===null)return null;if(!x$($)||!x$($.user)||!MV($.user.id,$.user.name,$.user.email)||typeof $.user.isAnonymous!=="boolean")throw Error("Invalid account response");return $}function E40($){if(!x$($)||typeof $.id!=="string"||typeof $.name!=="string"||typeof $.role!=="string"||!Array.isArray($.members)||!Array.isArray($.invitations)||!$.members.every((J)=>x$(J)&&typeof J.id==="string"&&MV(J.userId,J.name,J.email)&&typeof J.role==="string"&&typeof J.me==="boolean")||!$.invitations.every((J)=>x$(J)&&MV(J.id,"",J.email)&&typeof J.role==="string"&&typeof J.expiresAt==="string"&&Number.isFinite(Date.parse(J.expiresAt))))throw Error("Invalid users response");let Z=$;if(new Set(Z.members.map((J)=>J.userId)).size!==Z.members.length||new Set(Z.members.map((J)=>J.id)).size!==Z.members.length||new Set(Z.invitations.map((J)=>J.id)).size!==Z.invitations.length)throw Error("Invalid users response");return Z}var ER=M6({queryKey:_2.session,queryFn:async({signal:$})=>{let Z=await v$("get-session",{signal:$});return C40(await Z.json())},retry:!1,staleTime:30000}),bR=($)=>M6({queryKey:[..._2.team,$],queryFn:async({signal:Z})=>{let J=await v$("organization",{signal:Z});return E40(await J.json())},retry:!1,staleTime:30000}),wR=($)=>v$("profile",Z5("POST",{name:$})),SR=()=>v$("sign-out",Z5("POST")),RR=($)=>v$("invite",Z5("POST",{email:$})),IR=($)=>v$(`invitation/${encodeURIComponent($)}/cancel`,Z5("POST")),kR=($)=>v$("members/remove",Z5("POST",{memberId:$}));function PV($,Z){if(!$||$.user.isAnonymous){DQ({users:[]});return}let{id:J,name:H,email:B}=$.user,Q=v4()?.id===J,X=new Map((v6()??[]).map((U)=>[U.id,U])),z=Z?.members.map((U)=>({...X.get(U.userId),id:U.userId,name:U.name,email:U.email}))??(Q?[...X.values()]:[]),G={...X.get(J),id:J,name:H,email:B};DQ({me:J,users:[...z.filter((U)=>U.id!==J),G]})}var vR=P(u(),1);function b40(){let{environment:$,demo:Z}=N4(),J=$==="cloud",H=u8.useSyncExternalStore(S$,v4,v4),B=u8.useSyncExternalStore(S$,HY,HY),Q=a0(),X=m1({...ER,enabled:J&&!Z}),z=J&&!Z&&!!X.data&&!X.data.user.isAnonymous,G=m1({...bR(X.data?.user.id),enabled:z}),[U,Y]=u8.useState([]),F=r1({mutationFn:SR,onSuccess:async()=>{await Q.cancelQueries({queryKey:_2.all}),DQ({users:[]}),Q.setQueryData(_2.session,null),Q.removeQueries({queryKey:_2.team}),window.location.assign("/cloud/login")}});u8.useEffect(()=>{if(!J||Z||!X.isSuccess||F.isPending||F.isSuccess)return;PV(X.data,z?G.data:void 0)},[J,Z,X.data,X.isSuccess,z,G.data,F.isPending,F.isSuccess]),u8.useEffect(()=>{if(G.error instanceof h$&&G.error.status===401)Q.invalidateQueries({queryKey:_2.session})},[G.error,Q]);async function K(N){let q=N.trim();if(!q||q.length>80)throw Error("Enter a name of up to 80 characters");if(J){if(!z)throw Error("Sign in to change your name");await Q.cancelQueries({queryKey:_2.session}),await wR(q).catch((L)=>{if(L instanceof h$&&L.status===401)Q.invalidateQueries({queryKey:_2.session});throw L});let A=Q.getQueryData(_2.session);if(!A||A.user.id!==X.data.user.id||A.user.isAnonymous)throw Error("Your account changed. Reload Moi to try again.");let V={user:{...A.user,name:q}};return Q.setQueryData(_2.session,V),PV(V,G.data),Q.invalidateQueries({queryKey:_2.team}),q}let D=v4();if(HY()!=="local"||!D||D.id!==H?.id)throw Error("This profile is managed by your sign-in provider");return yR({...D,name:q}),q}function W(){if(Z)return"signed-out";if(!J)return H?"ready":"error";if(X.isPending)return"loading";if(X.isError)return"error";if(!z)return"signed-out";if(H?.id===X.data?.user.id&&B==="external")return"ready";return"loading"}return{cloud:J,demo:Z||J&&X.data?.user.isAnonymous===!0,profile:H,status:W(),email:z?X.data?.user.email:void 0,canEdit:J?z:B==="local",registered:z,team:G,removingMemberIds:U,setRemovingMemberIds:Y,saveName:K,signOut:F,retry:()=>{if(!J){window.location.reload();return}if(X.refetch(),z)G.refetch()}}}var xR=u8.createContext(void 0);function hR({children:$}){let Z=b40();return vR.jsx(xR,{value:Z,children:$})}function U3(){let $=u8.useContext(xR);if(!$)throw Error("AccountProvider is required");return $}var BY=P(m(),1);class _V{url;listeners=new Set;baseDelayMs;maxDelayMs;socket;closed=!0;reconnectAttempt=0;reconnectTimer;shownWorkspace;constructor($,Z={}){this.url=$;this.baseDelayMs=Z.reconnectBaseDelayMs??1000,this.maxDelayMs=Z.reconnectMaxDelayMs??30000}connect(){this.closed=!1,this.open()}close(){this.closed=!0,clearTimeout(this.reconnectTimer);let $=this.socket;this.socket=void 0,$?.close()}subscribe($){return this.listeners.add($),()=>{this.listeners.delete($)}}send($){if(this.socket?.readyState!==WebSocket.OPEN)return;this.socket.send(JSON.stringify($))}get navigationWorkspace(){return this.shownWorkspace}setNavigationWorkspace($){this.shownWorkspace=$,this.sendNavigationPresence()}sendNavigationPresence(){this.send({type:"navigation:presence",workspaceId:this.shownWorkspace??null,focused:document.visibilityState==="visible"&&document.hasFocus()})}open(){if(this.closed||this.socket)return;let $=new WebSocket(this.url);this.socket=$,$.onopen=()=>{this.reconnectAttempt=0,this.sendNavigationPresence()},$.onmessage=(Z)=>{try{let J=JSON.parse(Z.data);for(let H of this.listeners)H(J)}catch{}},$.onclose=()=>{if(this.socket!==$)return;if(this.socket=void 0,!this.closed)this.scheduleReconnect()},$.onerror=()=>{$.close()}}scheduleReconnect(){let $=Math.min(this.baseDelayMs*2**this.reconnectAttempt,this.maxDelayMs);this.reconnectAttempt++,this.reconnectTimer=setTimeout(()=>this.open(),$)}}var mR=P(u(),1);function gR({children:$}){let[Z]=BY.useState(()=>({events:new _V(FJ("/api/workspaces/ws"))}));return BY.useEffect(()=>{return Z.events.connect(),()=>Z.events.close()},[Z]),mR.jsx(fR,{value:Z,children:$})}var sq=P(m(),1);function QY(){return m1({queryKey:O0.all,queryFn:()=>B1("/api/workspaces"),staleTime:300000})}var pR=M6({queryKey:O0.previews,queryFn:()=>B1("/api/workspaces/previews"),staleTime:60000});function cR(){return m1(pR)}function XY($){return m1({...pR,select:(Z)=>Z[$]})}function dR(){return m1({queryKey:O0.discover,queryFn:()=>B1("/api/workspaces/discover")})}var uR=["workspaces-reorder"];function lR(){let $=a0();return r1({mutationKey:uR,mutationFn:(Z)=>B1("/api/workspaces/order",Z5("PUT",{ids:Z,origin:Y3}),"Failed to reorder spaces"),onMutate:async(Z)=>{await $.cancelQueries({queryKey:O0.all,exact:!0});let J=$.getQueryData(O0.all);if(J){let H=new Map(J.map((Q)=>[Q.id,Q])),B=Z.map((Q)=>H.get(Q)).filter((Q)=>Boolean(Q));if(B.length===J.length)$.setQueryData(O0.all,B)}return{previous:J}},onError:(Z,J,H)=>{if(H?.previous)$.setQueryData(O0.all,H.previous);$.invalidateQueries({queryKey:O0.all,exact:!0})},onSuccess:(Z)=>{if($.isMutating({mutationKey:uR})>1)return;$.setQueryData(O0.all,Z)}})}function zY(){let $=a0();return r1({mutationFn:(Z)=>W4(`/api/workspaces/${Z}`,{method:"DELETE"},"Failed to remove workspace"),onSuccess:(Z,J)=>{$.setQueryData(O0.all,(H)=>(H??[]).filter((B)=>B.id!==J)),$.invalidateQueries({queryKey:O0.discover})}})}var sR=P(m(),1);var iR=P(u(),1);function n2({className:$,...Z}){return iR.jsx(r5,{"data-slot":"spinner",role:"status","aria-label":"Loading",className:d0("size-4 animate-spin",$),stroke:1.75,...Z})}var OV="Wait for active agents to finish, or stop them before updating Moi";var w40=["update"],rR=300000,S40=1000;function aR($){return m1({queryKey:w40,queryFn:()=>B1("/api/update"),staleTime:rR,refetchInterval:$?S40:rR,refetchOnWindowFocus:!0,retry:!1})}function oR(){return r1({mutationFn:()=>B1("/api/update",{method:"POST"},"Could not update Moi")})}var e3=P(u(),1);function R40($,Z){return!!Z&&$?.runningVersion===Z}function I40($,Z,J){let H=Z||J,B=$&&!H;return{busy:H,blocked:B,label:Z?"Updating":J?"Restarting":B?OV:"Update"}}function tR(){let $=oR(),Z=aR($.isSuccess),J=K4((z)=>Nw(z.activity)),H=Z.data,B=$.data?.installedVersion??null;if(sR.useEffect(()=>{if(R40(H,B))window.location.reload()},[B,H]),Z.isPending)return{status:"loading"};if(!H?.availableVersion&&!$.isSuccess)return{status:"unavailable"};let Q=$.isSuccess;return{status:"available",button:{...I40(J,$.isPending,Q),errorMessage:$.error?.message??null,onClick:()=>$.mutate()}}}function eR({busy:$,blocked:Z,label:J,errorMessage:H,onClick:B}){return e3.jsxs(t1,{children:[e3.jsx(e1,{render:e3.jsx("div",{children:e3.jsx(L0,{type:"button",size:"icon-sm",variant:$?"ghost":"default","aria-label":J,disabled:Z||$,onClick:B,children:$?e3.jsx(n2,{stroke:1.5}):e3.jsx(nR,{stroke:1.5})})})}),e3.jsx($5,{side:"right",className:Z?"max-w-56":void 0,children:Z?OV:H??J})]})}var uQ=P(m(),1);function $I($,Z){let J=$??[],H=J.findIndex((B)=>B.id===Z.id||B.path===Z.path);if(H===-1)return[Z,...J];return J.map((B,Q)=>Q===H?{...B,...Z}:B)}function ZI(){let $=a0();return r1({mutationFn:(Z)=>B1("/api/workspaces",Z5("POST",Z),"Failed to add workspace"),onSuccess:(Z,J)=>{C1.getState().markWorkspacePendingAnalysis(Z.id),$.setQueryData(O0.all,(H)=>$I(H,Z)),$.setQueryData(O0.discover,(H)=>(H??[]).filter((B)=>B.path!==J.path))}})}function GY(){return m1({queryKey:O0.creationInfo,queryFn:()=>B1("/api/workspaces/create"),staleTime:30000,refetchOnMount:"always"})}function JI(){let $=a0();return r1({mutationFn:(Z)=>B1("/api/workspaces/create",Z5("POST",Z),"Failed to create workspace"),onSuccess:(Z)=>{$.setQueryData(O0.all,(J)=>$I(J,Z))}})}var L9={};k5(L9,{createHandle:()=>PI,Viewport:()=>MY,Trigger:()=>_Y,Title:()=>PY,Root:()=>DI,Portal:()=>DY,Popup:()=>AY,Handle:()=>gJ,Description:()=>KY,Close:()=>FY,Backdrop:()=>YY});var HI=P(m(),1);var UY=P(m(),1),TV=UY.createContext(void 0);function x2($){let Z=UY.useContext(TV);if(!$&&Z===void 0)throw Error(I0(27));return Z}var YY=HI.forwardRef(function(Z,J){let{render:H,className:B,style:Q,forceRender:X=!1,...z}=Z,G=x2(),U=G.useState("open"),Y=G.useState("nested"),F=G.useState("mounted"),K=G.useState("transitionStatus");return G0("div",Z,{state:{open:U,transitionStatus:K},ref:[G.context.backdropRef,J],stateAttributesMapping:X4,props:[{role:"presentation",hidden:!F,style:{userSelect:"none",WebkitUserSelect:"none"}},z],enabled:X||!Y})});var BI=P(m(),1);var FY=BI.forwardRef(function(Z,J){let{render:H,className:B,style:Q,disabled:X=!1,nativeButton:z=!0,...G}=Z,U=x2(),Y=U.useState("open"),{getButtonProps:F,buttonRef:K}=w5({disabled:X,native:z}),W={disabled:X};function N(q){if(Y)U.setOpen(!1,w0(F0.closePress,q.nativeEvent))}return G0("button",Z,{state:W,ref:[J,K],props:[{onClick:N},G,F]})});var QI=P(m(),1);var KY=QI.forwardRef(function(Z,J){let{render:H,className:B,style:Q,id:X,...z}=Z,G=x2(),U=t0(X);return G.useSyncedValueWithCleanup("descriptionElementId",U),G0("p",Z,{ref:J,props:[{id:U},z]})});var GI=P(m(),1);var WY=P(m(),1),jV=WY.createContext(void 0);function NY(){let $=WY.useContext(jV);if($===void 0)throw Error(I0(26));return $}var XI="--nested-dialogs";var ov0=F$.open,nv0=F$.closed,sv0=F$.startingStyle,tv0=F$.endingStyle;var zI="data-nested-dialog-open";var qY={...N8,...Y2,nestedDialogOpen($){return $?{[zI]:""}:null}};var UI=P(u(),1),AY=GI.forwardRef(function(Z,J){let{render:H,className:B,style:Q,finalFocus:X,initialFocus:z,...G}=Z,U=x2(),Y=U.useState("descriptionElementId"),F=U.useState("disablePointerDismissal"),K=U.useState("floatingRootContext"),W=U.useState("popupProps"),N=U.useState("modal"),q=U.useState("mounted"),D=U.useState("nested"),A=U.useState("nestedOpenDialogCount"),V=U.useState("open"),L=U.useState("openMethod"),O=U.useState("titleElementId"),M=U.useState("transitionStatus"),_=U.useState("role"),w=K.useState("floatingId");NY(),L5({open:V,ref:U.context.popupRef,onComplete(){if(V)U.context.onOpenChangeComplete?.(!0)}});let C=z===void 0?fG(U.context.popupRef):z,E=A>0,T=U.useStateSetter("popupElement"),S=G0("div",Z,{state:{open:V,nested:D,transitionStatus:M,nestedDialogOpen:E},props:[W,{id:w,"aria-labelledby":O,"aria-describedby":Y,role:_,...r9,hidden:!q,onKeyDown(I){if(D9.has(I.key))I.stopPropagation()},style:{[XI]:A}},G],ref:[J,U.context.popupRef,T],stateAttributesMapping:qY});return UI.jsx(P$,{context:K,openInteractionType:L,disabled:!q,closeOnFocusOut:!F,initialFocus:C,returnFocus:X,modal:N!==!1,restoreFocus:"popup",children:S})});var YI=P(m(),1);var VQ=P(u(),1),DY=YI.forwardRef(function(Z,J){let{keepMounted:H=!1,...B}=Z,Q=x2(),X=Q.useState("mounted"),z=Q.useState("modal"),G=Q.useState("open");if(!(X||H))return null;return VQ.jsx(jV.Provider,{value:H,children:VQ.jsxs(D$,{ref:J,...B,children:[X&&z===!0&&VQ.jsx(DJ,{ref:Q.context.internalBackdropRef,inert:x8(!G)}),Z.children]})})});var AI=P(m(),1);var CV=P(m(),1);function FI({store:$,parentContext:Z,isDrawer:J}){let H=$.useState("open"),B=$.useState("disablePointerDismissal"),Q=$.useState("modal"),X=$.useState("popupElement"),z=$.useState("floatingRootContext"),[G,U]=CV.useState(0),[Y,F]=CV.useState(0),K=G===0,W=K9(z,{outsidePressEvent(){if($.context.internalBackdropRef.current||$.context.backdropRef.current)return"intentional";return{mouse:Q==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}},outsidePress(N){if(!$.context.outsidePressEnabledRef.current)return!1;if("button"in N&&N.button!==0)return!1;if("touches"in N){if(N.type==="touchend"){if(N.changedTouches.length!==1||N.touches.length!==0)return!1}else if(N.touches.length!==1)return!1}let q=V1(N);if(K&&!B){if(Q){let D=$.context.internalBackdropRef.current,A=$.context.backdropRef.current;return D||A?D===q||A===q||R0(q,X)&&!q?.hasAttribute("data-base-ui-portal"):!0}return!0}return!1},escapeKey:K});return CU(H&&Q===!0,X),$.useContextCallback("onNestedDialogOpen",(N,q)=>{U(N),F(q)}),H0(()=>{if(Z?.onNestedDialogOpen)if(H)Z.onNestedDialogOpen(G+1,Y+(J?1:0));else Z.onNestedDialogOpen(0,0);return()=>{if(Z?.onNestedDialogOpen&&H)Z.onNestedDialogOpen(0,0)}},[J,H,G,Y,Z]),t9($,{activeTriggerProps:W.reference,inactiveTriggerProps:W.trigger,popupProps:W.floating,nestedOpenDialogCount:G,nestedOpenDrawerCount:Y}),null}var VY=P(m(),1);var KI={...$3,modal:($)=>$.modal,nested:($)=>$.nested,nestedOpenDialogCount:($)=>$.nestedOpenDialogCount,nestedOpenDrawerCount:($)=>$.nestedOpenDrawerCount,disablePointerDismissal:($)=>$.disablePointerDismissal,openMethod:($)=>$.openMethod,descriptionElementId:($)=>$.descriptionElementId,titleElementId:($)=>$.titleElementId,viewportElement:($)=>$.viewportElement,role:($)=>$.role};class EV extends p2{constructor($,Z,J){let H=new y2,B=NI($,H,Z,J);super(B,qI(H),KI)}setOpen=($,Z)=>{if(Z.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},!$&&Z.trigger==null&&this.state.activeTriggerId!=null)Z.trigger=this.state.activeTriggerElement??void 0;if(this.context.onOpenChange?.($,Z),Z.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange($,Z),this.update(O$(this.state,$,Z.trigger))}}function WI(){let $=new y2;return new A9(Object.freeze(NI(void 0,$)),Object.freeze(qI($)),KI)}function NI($,Z,J,H=!1){return{...e9(Z,J,H),modal:!0,disablePointerDismissal:!1,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,nestedOpenDrawerCount:0,role:"dialog",...$}}function qI($){return{popupRef:VY.createRef(),backdropRef:VY.createRef(),internalBackdropRef:VY.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:$,onOpenChange:void 0,onOpenChangeComplete:void 0}}var LQ=P(u(),1);function LY($,Z){let{children:J,open:H,defaultOpen:B=!1,onOpenChange:Q,onOpenChangeComplete:X,disablePointerDismissal:z=!1,modal:G=!0,actionsRef:U,handle:Y,triggerId:F,defaultTriggerId:K=null}=Z,W=$==="drawer",N=$==="alert-dialog",q=N?!0:G,D=N||z,A=N?"alertdialog":"dialog",V=x2(!0),L=V!=null,O={modal:q,disablePointerDismissal:D,nested:L,role:A},M=R6((k,S)=>new EV({open:B,openProp:H,activeTriggerId:K,triggerIdProp:F,...O},k,S),!0);M.useControlledProp("openProp",H),M.useControlledProp("triggerIdProp",F),M.useSyncedValues(O),M.useContextCallback("onOpenChange",Q),M.useContextCallback("onOpenChangeComplete",X);let _=M.useState("open"),w=M.useState("mounted"),C=M.useState("payload");mG(M,_),n9(M);let{forceUnmount:E}=s9(_,M);AI.useImperativeHandle(U,()=>({unmount:E,close:()=>M.setOpen(!1,w0(F0.imperativeAction))}),[E,M]);let T=_||w;return LQ.jsxs(TV.Provider,{value:M,children:[Y&&LQ.jsx(a9,{handle:Y,store:M}),T&&LQ.jsx(FI,{store:M,parentContext:V?.context,isDrawer:W}),typeof J==="function"?J({payload:C}):J]})}var DI=X9(function(Z){return LY("dialog",Z)});var VI=P(m(),1);var MY=VI.forwardRef(function(Z,J){let{render:H,className:B,style:Q,children:X,...z}=Z,G=NY(),U=x2(),Y=U.useState("open"),F=U.useState("nested"),K=U.useState("transitionStatus"),W=U.useState("nestedOpenDialogCount"),N=U.useState("mounted"),q=U.useStateSetter("viewportElement"),D=W>0;return G0("div",Z,{enabled:G||N,state:{open:Y,nested:F,transitionStatus:K,nestedDialogOpen:D},ref:[J,q],stateAttributesMapping:qY,props:[{role:"presentation",hidden:!N,style:{pointerEvents:!Y?"none":void 0},children:X},z]})});var LI=P(m(),1);var PY=LI.forwardRef(function(Z,J){let{render:H,className:B,style:Q,id:X,...z}=Z,G=x2(),U=t0(X);return G.useSyncedValueWithCleanup("titleElementId",U),G0("h2",Z,{ref:J,props:[{id:U},z]})});var MI=P(m(),1);var _Y=u9(function(Z,J){let{render:H,className:B,style:Q,disabled:X=!1,nativeButton:z=!0,id:G,payload:U,handle:Y,...F}=Z,K=x2(!0),N=Z3(Y)??K;if(!N)throw Error(I0(79));let q=t0(G),D=N.useState("floatingRootContext"),A=N.useState("isOpenedByTrigger",q),V=N.useState("triggerPopupId",q),L=MI.useRef(null),{registerTrigger:O,isMountedByThisTrigger:M}=o9(q,L,N,{payload:U}),{getButtonProps:_,buttonRef:w}=w5({disabled:X,native:z}),C=c3(D),E=zQ(()=>N.select("open"),(S)=>{N.set("openMethod",S)}),T={disabled:X,open:A},k=N.useState("triggerProps",M);return G0("button",Z,{state:T,ref:[w,J,O,L],props:[C.reference,k,E,{[tZ]:"",id:q,"aria-haspopup":"dialog","aria-expanded":A,"aria-controls":V},F,_],stateAttributesMapping:p9})});class gJ extends W9{constructor(){super(WI(),"Dialog",!1)}open($){this.openByTrigger($)}openWithPayload($){let Z=this.attachedStore;if(Z===null)return;Z.set("payload",$),Z.setOpen(!0,w0(F0.imperativeAction))}close(){this.closePopup()}get isOpen(){return this.attachedStore?.select("open")??!1}}function PI(){return new gJ}var q4=P(u(),1);function e6({...$}){return q4.jsx(L9.Root,{"data-slot":"dialog",...$})}function $6({...$}){return q4.jsx(L9.Trigger,{"data-slot":"dialog-trigger",...$})}function x40({...$}){return q4.jsx(g8,{portal:L9.Portal,"data-slot":"dialog-portal",...$})}function MQ({...$}){return q4.jsx(L9.Close,{"data-slot":"dialog-close",...$})}function h40({className:$,...Z}){return q4.jsx(L9.Backdrop,{"data-slot":"dialog-overlay",className:d0("fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",$),...Z})}function mJ({className:$,children:Z,showCloseButton:J=!0,...H}){return q4.jsxs(x40,{children:[q4.jsx(h40,{}),q4.jsxs(L9.Popup,{"data-slot":"dialog-content",className:d0("fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-6 text-sm text-popover-foreground shadow-xl duration-100 outline-none sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",$),...H,children:[Z,J&&q4.jsxs(MQ,{render:q4.jsx(L0,{variant:"ghost",size:"icon-sm",className:"absolute top-4 right-4"}),children:[q4.jsx(i5,{stroke:1.75}),q4.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function $7({className:$,...Z}){return q4.jsx(L9.Title,{"data-slot":"dialog-title",className:d0("text-lg font-semibold",$),...Z})}function uJ({className:$,...Z}){return q4.jsx(L9.Description,{"data-slot":"dialog-description",className:d0("text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",$),...Z})}var uI=P(m(),1);var xY={};k5(xY,{Validity:()=>gI,Root:()=>RI,Label:()=>kI,Item:()=>mI,Error:()=>yI,Description:()=>hI,Control:()=>vI});var v2=P(m(),1);var OY=P(m(),1);var _I="data-valid",OI="data-invalid";var f$={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},f40={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},TI={disabled:!1,...f40},h2={valid($){if($===null)return null;if($)return{[_I]:""};return{[OI]:""}}};var g40={invalid:void 0,name:void 0,validityData:{state:f$,errors:[],error:"",value:"",initialValue:null},setValidityData:G1,disabled:void 0,setTouched:G1,setDirty:G1,setFilled:G1,setFocused:G1,validationMode:"onSubmit",shouldValidateOnChange:()=>!1,state:TI,registerFieldControl:G1,validation:{getValidationProps:($,Z=D1)=>Z,inputRef:{current:null},registeredInputs:new Map,registerInput:G1,getInputControl:()=>null,commit:async()=>{},change:G1}},bV=OY.createContext(g40);function t5($=!0){let Z=OY.useContext(bV);if(Z.setValidityData===G1&&!$)throw Error(I0(28));return Z}var TY=P(m(),1),m40=TY.createContext(void 0);function jI($=!1){let Z=TY.useContext(m40);if(!Z&&!$)throw Error(I0(86));return Z}var jY=P(m(),1);var u40=jY.createContext({elementRef:{current:null},formRef:{current:{fields:new Map}},errors:{},clearErrors:G1,validationMode:"onSubmit",submitCountRef:{current:0}});function A4(){return jY.useContext(u40)}var Z7=P(m(),1);var CY=P(m(),1);var wV=CY.createContext({controlId:void 0,registerControlId:G1,resetControlId:G1,labelId:void 0,setLabelId:G1,messageIds:[],setMessageIds:G1,getDescriptionProps:($)=>$});function e5(){return CY.useContext(wV)}var CI=P(u(),1),EY=function(Z){let J=t0(),[H,B]=Z7.useState(J),[Q,X]=Z7.useState(),[z,G]=Z7.useState([]),U=H===void 0?J:H,Y=H5(()=>new Map),{messageIds:F}=e5(),K=Y0((D,A)=>{let V=Y.current;if(A===void 0)V.delete(D);else V.set(D,A);B((L)=>{if(V.size===0)return L;let O;for(let M of V.values()){if(M===L)return L;if(O===void 0)O=M}return O})}),W=Y0(()=>{if(Y.current.size===0)B(J)}),N=Z7.useCallback((D)=>{let A=D["aria-describedby"]?D["aria-describedby"].split(" "):[];return A.push(...F,...z),{...D,"aria-describedby":Array.from(new Set(A)).join(" ")||void 0}},[F,z]),q=Z7.useMemo(()=>({controlId:U,registerControlId:K,resetControlId:W,labelId:Q,setLabelId:X,messageIds:z,setMessageIds:G,getDescriptionProps:N}),[U,K,W,Q,X,z,G,N]);return CI.jsx(wV.Provider,{value:q,children:Z.children})};var Z6=P(m(),1);function g$($,Z){return{...$,state:{...$.state,valid:!Z&&$.state.valid}}}var SV=Object.keys(f$);function p40($,Z){if($.matches(":disabled"))return!1;if(!Z||$.form===Z)return!0;return $.form===null&&!$.hasAttribute("form")}function EI($,Z){let J=null;for(let H of $.keys()){if(!p40(H,Z))continue;if(!H.validity.valid)return H;J??=H}return J}function bI($){return{...f$,valid:!$,customError:$}}function RV($){return $&&$.validationMessage?[$.validationMessage]:[]}function wI($){let{elementRef:Z,formRef:J}=A4(),{setValidityData:H,validate:B,validityData:Q,validationDebounceTime:X,invalid:z,markedDirtyRef:G,state:U,shouldValidateOnChange:Y,validationMode:F,registeredFieldIdRef:K}=$,{controlId:W,getDescriptionProps:N}=e5(),q=s1(),D=Z6.useRef(null),A=H5(()=>new Map).current,V=Z6.useRef(0),L=Z6.useRef(null),O=Z6.useCallback((E,T)=>{return A.set(E,T),()=>{A.delete(E)}},[A]),M=Y0(()=>{let E=EI(A,Z.current);return E&&A.get(E)?.controlRef.current||null}),_=Y0(async(E,T=!1)=>{V.current+=1;let k=V.current;function S(d,o=z){let c=K.current??W;if(c==null)return;let i=J.current.fields.get(c);if(!i)return;let n=g$(d,o);J.current.fields.set(c,{...i,validityData:n})}function I(d,o){let c=d.valid===!1?o:[];return{value:E,state:d,error:c[0]??"",errors:c,initialValue:Q.initialValue}}function j(d,o){let c=d.validity.customError?d.validationMessage:"",i=o.replace(/\r\n?/g,`
|
|
10
|
+
`);d.setCustomValidity(i),L.current=[d,i,c]}function y(){let d=L.current;if(L.current=null,d&&(!d[0].willValidate||d[0].validationMessage===d[1]))d[0].setCustomValidity(d[2])}function R(d,o,c){let i=I(d,o);S(i,c),H(i)}function x(d){let o=SV.reduce((i,n)=>{return i[n]=d.validity[n],i},{}),c=!1;for(let i of SV){if(i==="valid")continue;if(i==="valueMissing"&&o[i])c=!0;else if(o[i])return o}if(c&&!G.current)o.valid=!0,o.valueMissing=!1;return o}function v(){return A.size>0?EI(A,Z.current):D.current}let f=v();function b(){return f=v(),f?.willValidate?x(f):bI(!1)}if(T){if(U.valid!==!1||!f)return;if(!f.validity.valueMissing){y();let d=v(),o=d?.validity.customError?RV(d):[];R(bI(o.length>0),o,!1);return}for(let d of SV)if(d!=="valid"&&d!=="valueMissing"&&d!=="customError"&&f.validity[d])return}q.clear(),y();let l=b(),r=RV(f),h=Y();if(r.length===0||h){let d=Array.from(J.current.fields.values()).reduce((i,n)=>{if(n.name)i[n.name]=n.getValue();return i},{}),o=B(E,d),c;if(typeof o==="object"&&o!==null&&"then"in o){if(l.valid===!1)R(l,r);else if(F==="onSubmit"||!Q.state.customError)l.valid=null,R(l,r);if(c=await o,k!==V.current)return;l=b()}else c=o;if(r=c?[].concat(c).filter(Boolean):[],r.length>0){if(l.valid=!1,l.customError=!0,f?.willValidate)j(f,r.join(`
|
|
11
|
+
`))}else r=RV(f)}R(l,r)}),w=Y0((E,T=!1)=>{if(q.clear(),V.current+=1,T)return;let k=Y();if(k&&E!==""&&X)q.start(X,()=>{_(E)});else _(E,!k)}),C=Z6.useCallback((E,T={})=>K2(N(T),U.valid===!1&&!U.disabled&&!E?{"aria-invalid":!0}:D1),[N,U.disabled,U.valid]);return Z6.useMemo(()=>({getValidationProps:C,inputRef:D,registeredInputs:A,registerInput:O,getInputControl:M,commit:_,change:w}),[C,A,O,M,_,w])}var bY=P(m(),1);function SI($){let{change:Z,commit:J,invalid:H,markedDirtyRef:B,name:Q,setRegisteredFieldName:X,registeredFieldIdRef:z,setValidityData:G,validityData:U}=$,{formRef:Y}=A4(),F=bY.useRef(null),K=bY.useRef(null),W=bY.useRef(!1),N=Y0(()=>{let M=K.current;if(!M)return;if(M.getValue)return M.getValue();return M.value});function q(M){return M.value===void 0?N():M.value}let D=Y0(()=>{let M=K.current;if(B.current=!0,!M){J(U.value);return}J(q(M))});function A(){let M=K.current;if(!M||!M.id)return;Y.current.fields.set(M.id,{getValue:N,name:Q??M.name,controlRef:M.controlRef,validityData:g$(U,H),validate:D})}function V(M=K.current?.id){if(M)Y.current.fields.delete(M)}function L(M){if(W.current)return;W.current=!0;let _=q(M);G((w)=>w.initialValue===_?w:{...w,initialValue:_})}H0(()=>{let M=K.current;if(!M||!M.id)return;X(Q?void 0:M.name),Y.current.fields.set(M.id,{getValue:N,name:Q??M.name,controlRef:M.controlRef,validityData:g$(U,H),validate:D})},[Y,N,H,Q,X,D,U]),H0(()=>{let M=Y.current.fields;return()=>{let _=K.current?.id;if(_)M.delete(_)}},[Y]);let O=Y0((M,_)=>{if(!_){if(F.current===M)F.current=null,Z(void 0,!0),V(),K.current=null,X(void 0),z.current=void 0;return}let w=K.current?.id,C=F.current;if(C&&C!==M)Z(void 0,!0);if(F.current=M,K.current=_,!Q)X(_.name);if(z.current=_.id,w&&w!==_.id)V(w);L(_),A()});return[D,O]}var wY=P(u(),1),c40=v2.forwardRef(function(Z,J){let{errors:H,validationMode:B,submitCountRef:Q}=A4(),{render:X,className:z,validate:G,validationDebounceTime:U=0,validationMode:Y=B,name:F,disabled:K=!1,invalid:W,dirty:N,touched:q,actionsRef:D,style:A,...V}=Z,L=jI(!0)?.disabled,O=Y0(G||(()=>null)),M=L||K,[_,w]=v2.useState(!1),[C,E]=v2.useState(!1),[T,k]=v2.useState(!1),[S,I]=v2.useState(!1),j=N??C,y=q??_,R=v2.useRef(j),x=v2.useRef(void 0),[v,f]=v2.useState(),b=F??v;H0(()=>{if(N!==void 0)R.current=N},[N]);let l=Y0((K0)=>{if(N!==void 0)return;if(K0)R.current=!0;E(K0)}),r=Y0((K0)=>{if(q!==void 0)return;w(K0)}),h=Y0(()=>Y==="onChange"||Y==="onSubmit"&&Q.current>0),d=b&&Object.hasOwn(H,b)?H[b]:null,o=!!(Array.isArray(d)?d.length:d),c=W===!0||o,[i,n]=v2.useState({state:f$,error:"",errors:[],value:null,initialValue:null}),Z0=!c&&(M?null:i.state.valid),J0=v2.useMemo(()=>({disabled:M,touched:y,dirty:j,valid:Z0,filled:T,focused:S}),[M,y,j,Z0,T,S]),U0=wI({setValidityData:n,validate:O,validityData:i,validationDebounceTime:U,invalid:c,markedDirtyRef:R,state:J0,shouldValidateOnChange:h,validationMode:Y,registeredFieldIdRef:x}),[z0,X0]=SI({change:U0.change,commit:U0.commit,invalid:c,markedDirtyRef:R,name:F,setRegisteredFieldName:f,registeredFieldIdRef:x,setValidityData:n,validityData:i});v2.useImperativeHandle(D,()=>({validate:z0}),[z0]);let N0=v2.useMemo(()=>({invalid:c,name:b,validityData:i,setValidityData:n,disabled:M,setTouched:r,setDirty:l,setFilled:k,setFocused:I,validationMode:Y,shouldValidateOnChange:h,state:J0,registerFieldControl:X0,validation:U0}),[c,b,i,M,r,l,k,I,Y,h,J0,X0,U0]),q0=G0("div",Z,{ref:J,state:J0,props:V,stateAttributesMapping:h2});return wY.jsx(bV.Provider,{value:N0,children:q0})}),RI=v2.forwardRef(function(Z,J){return wY.jsx(EY,{children:wY.jsx(c40,{...Z,ref:J})})});var PQ=P(m(),1);function II($,Z){let J=t0($);return H0(()=>{return Z(J),()=>{Z((H)=>H===J?void 0:H)}},[J,Z]),J}function SY($={}){let{id:Z,fallbackControlId:J,native:H=!1,setLabelId:B,focusControl:Q}=$,{controlId:X,setLabelId:z}=e5(),G=Y0((W)=>{z(W),B?.(W)}),U=II(Z,G),Y=X??J;function F(W){if(Q){Q(W,Y);return}if(!Y)return;let N=m0(W.currentTarget).getElementById(Y);if(L1(N))RY(N)}function K(W){if(V1(W.nativeEvent)?.closest("button,input,select,textarea"))return;if(!W.defaultPrevented&&W.detail>1)W.preventDefault();if(H)return;F(W)}return H?{id:U,htmlFor:Y,onMouseDown:K}:{id:U,onClick:K,onPointerDown(W){W.preventDefault()}}}function RY($){$.focus({focusVisible:!0})}var IY=P(m(),1),IV=IY.createContext({disabled:!1});function pJ(){return IY.useContext(IV)}var kI=PQ.forwardRef(function(Z,J){let{render:H,className:B,style:Q,id:X,nativeLabel:z=!0,...G}=Z,U=t5(!1),Y=pJ(),{labelId:F}=e5(),K={...U.state,disabled:U.disabled||Y.disabled},W=PQ.useRef(null),N=SY({id:F??X,native:z});return G0("label",Z,{ref:[J,W],state:K,props:[N,G],stateAttributesMapping:h2})});var m$=P(m(),1);var kV=P(u(),1),d40={...h2,...Y2},yI=m$.forwardRef(function(Z,J){let{render:H,id:B,className:Q,match:X,style:z,...G}=Z,U=t0(B),{validityData:Y,state:F,name:K}=t5(!1),{setMessageIds:W}=e5(),{errors:N}=A4(),q=K&&Object.hasOwn(N,K)?N[K]:null,D=!!(Array.isArray(q)?q.length:q),A=typeof X==="string",V=!1;if(X===!0)V=!0;else if(F.disabled)V=!1;else if(A)V=Boolean(Y.state[X]);else V=D||Y.state.valid===!1;let{mounted:L,transitionStatus:O,setMounted:M}=k2(V);H0(()=>{if(!V||!U)return;return W((R)=>R.concat(U)),()=>{W((R)=>R.filter((x)=>x!==U))}},[V,U,W]);let _=m$.useRef(null),[w,C]=m$.useState(null),[E,T]=m$.useState(null),k=Y.error;if(!A&&D)k=q;else if(Y.errors.length>1)k=Y.errors;let S=k;if(Array.isArray(k))S=k.length>1?kV.jsx("ul",{children:k.map((R)=>kV.jsx("li",{children:R},R))}):k[0];let I=Array.isArray(k)?JSON.stringify(k):k;if(V&&I!==E)T(I),C(S);L5({open:V,ref:_,onComplete(){if(!V)M(!1)}});let j={...F,transitionStatus:O},y=G0("div",Z,{ref:[J,_],state:j,props:[{id:U,children:V?S:w},G],stateAttributesMapping:d40,enabled:L});if(!L)return null;return y});var xI=P(m(),1);var hI=xI.forwardRef(function(Z,J){let{render:H,id:B,className:Q,style:X,...z}=Z,G=t0(B),U=t5(!1),Y=pJ(),{setMessageIds:F}=e5(),K={...U.state,disabled:U.disabled||Y.disabled};return H0(()=>{if(!G)return;return F((N)=>N.concat(G)),()=>{F((N)=>N.filter((q)=>q!==G))}},[G,F]),G0("p",Z,{ref:J,state:K,props:[{id:G},z],stateAttributesMapping:h2})});var kY=P(m(),1);var u$=P(m(),1);function D4({controlled:$,default:Z,name:J,state:H="value"}){let{current:B}=u$.useRef($!==void 0),[Q,X]=u$.useState(Z),z=B&&$!==void 0?$:Q,G=u$.useCallback((U)=>{if(!B)X(U)},[]);return[z,G]}function J7($,Z,J,H,B=!0,Q){let{registerFieldControl:X}=t5(),z=H5(()=>Symbol());H0(()=>{let G=z.current;if(!B){X(G,void 0);return}X(G,{controlRef:$,getValue:H,id:Z,name:Q,value:J})},[$,B,H,Z,Q,X,z,J]),H0(()=>{let G=z.current;return()=>{X(G,void 0)}},[X,z])}var yV=P(m(),1);function H7($={}){let{id:Z,enabled:J=!0}=$,{controlId:H,registerControlId:B,resetControlId:Q}=e5(),X=t0(),z=H5(()=>Symbol()),G=yV.useRef(!1),U=yV.useRef(!1),Y=Y0(()=>{if(!G.current||B===G1)return;G.current=!1,B(z.current,void 0)});return H0(()=>{if(!J||B===G1){Y();return}let F;if(Z!==void 0)U.current=!0,F=Z;else if(U.current)F=X;else{Q();return}if(F===void 0){Y();return}G.current=!0,B(z.current,F);return},[Z,J,B,Q,X,z,Y]),H0(()=>{return Y},[Y]),(J?H:void 0)??Z??X}var vI=kY.forwardRef(function(Z,J){let{render:H,className:B,id:Q,name:X,value:z,disabled:G=!1,onValueChange:U,defaultValue:Y,autoFocus:F=!1,style:K,...W}=Z,{state:N,name:q,disabled:D,setTouched:A,setDirty:V,validityData:L,setFocused:O,setFilled:M,validationMode:_,validation:w}=t5(),{clearErrors:C,elementRef:E,submitCountRef:T}=A4(),k=D||G,S=q??X,I={...N,disabled:k},{labelId:j}=e5(),y=H7({id:Q}),[R]=D4({controlled:z,default:Y,name:"FieldControl",state:"value"}),x=z!==void 0,v=x?R:void 0,f=v==null?void 0:String(v),b=Y0(()=>w.inputRef.current?.value);J7(w.inputRef,y,f,b,!k,X),H0(()=>{let d=f??w.inputRef.current?.value;if(d!==void 0)M(d!=="")},[f,w.inputRef,M]),G3(f,()=>{if(f===void 0)return;C(S),V(f!==(L.initialValue??"")),w.change(f)});let l=kY.useRef(null),r=s1();return H0(()=>{if(F&&l.current===a1(m0(l.current)))O(!0)},[F,O]),G0("input",Z,{ref:[J,l],state:I,props:[{id:y,disabled:k,name:S,ref:w.inputRef,"aria-labelledby":j,autoFocus:F,...x?{value:v}:{defaultValue:Y},onChange(d){let o=d.currentTarget.value,c=w0(F0.none,d.nativeEvent);if(U?.(o,c),x)return;if(V(o!==(L.initialValue??"")),M(o!==""),!d.nativeEvent.defaultPrevented&&!c.isCanceled)C(S),w.change(o)},onFocus(){O(!0)},onBlur(d){if(A(!0),O(!1),_==="onBlur"){let o=d.currentTarget.value;if(w.commit(o),x)queueMicrotask(()=>{let c=w.inputRef.current?.value;if(c!==void 0&&c!==o&&c!==(L.initialValue??""))w.commit(c)})}},onKeyDown(d){if(d.currentTarget.tagName==="INPUT"&&d.key==="Enter"){A(!0);let o=d.currentTarget.value,c=d.currentTarget.form;if(c&&c===E.current&&!d.defaultPrevented){let i=d.currentTarget,n=T.current;r.start(0,()=>{if(T.current===n)w.commit(i.value)})}else w.commit(o)}}},W,(d)=>w.getValidationProps(k,d)],stateAttributesMapping:h2})});var _Q=P(m(),1);var fI=P(u(),1),gI=function(Z){let{children:J}=Z,{validityData:H,invalid:B}=t5(!1),Q=_Q.useMemo(()=>g$(H,B),[H,B]),X=Q.state.valid===!1,{transitionStatus:z}=k2(X),G=_Q.useMemo(()=>{return{...Q,validity:Q.state,transitionStatus:z}},[Q,z]);return fI.jsx(_Q.Fragment,{children:J(G)})};var yY=P(m(),1);var xV=P(u(),1),mI=yY.forwardRef(function(Z,J){let{render:H,className:B,style:Q,disabled:X=!1,...z}=Z,{state:G,disabled:U}=t5(!1),Y=U||X,F={...G,disabled:Y},K=yY.useMemo(()=>({disabled:Y}),[Y]),W=G0("div",Z,{ref:J,state:F,props:z,stateAttributesMapping:h2});return xV.jsx(EY,{children:xV.jsx(IV.Provider,{value:K,children:W})})});var pI=P(u(),1),OQ=uI.forwardRef(function(Z,J){return pI.jsx(xY.Control,{ref:J,...Z})});var cI=P(u(),1);function p8({className:$,type:Z,...J}){return cI.jsx(OQ,{type:Z,"data-slot":"input",className:d0("h-8 w-full min-w-0 rounded-lg border bg-transparent px-2.5 py-1 text-base transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",$),...J})}function dI($){if(!$)return"Folder name is required";if($.length>64)return"Folder name is too long (max 64 characters)";if(!/^[A-Za-z0-9][A-Za-z0-9._ -]*$/.test($))return"Use letters, numbers, dots, dashes, underscores and spaces, starting with a letter or number";if($.endsWith(".")||$.endsWith(" "))return"Folder name cannot end with a dot or space";return null}var cJ=["claude-code","codex","openclaw","hermes"];var oI=P(m(),1);var hY="/claude-z2xnay0d.svg";var lI="/floppy-disk-wmjs0n85.webp";var vY="/openai-ep9ht2pq.svg";var E1=P(u(),1);function dJ({trigger:$,open:Z,onOpenChange:J}){return E1.jsxs(e6,{open:Z,onOpenChange:J,children:[$&&E1.jsx($6,{render:$}),E1.jsx(o40,{})]})}var iI=2;function a40({demoInstallUrl:$}){let Z=oI.useRef(null);return E1.jsx("div",{className:"relative min-h-56 overflow-hidden md:min-h-full",onMouseMove:(B)=>{if(!Z.current)return;let Q=B.currentTarget.getBoundingClientRect(),X=(B.clientX-Q.left)/Q.width-0.5,z=(B.clientY-Q.top)/Q.height-0.5;Z.current.style.setProperty("--floppy-x",`${X*-2*iI}px`),Z.current.style.setProperty("--floppy-y",`${z*-2*iI}px`)},onMouseLeave:()=>{Z.current?.style.removeProperty("--floppy-x"),Z.current?.style.removeProperty("--floppy-y")},children:E1.jsxs("a",{ref:Z,href:$,target:"_blank",rel:"noreferrer",className:"group absolute top-1/2 left-1/2 w-40 -translate-x-1/2 -translate-y-1/2 rotate-4 [transform:translate3d(var(--floppy-x,0px),var(--floppy-y,0px),0)] rounded-lg transition-transform duration-150 ease-out will-change-transform outline-none focus-visible:ring-3 focus-visible:ring-ring/50 motion-reduce:transform-none motion-reduce:transition-none md:w-36",children:[E1.jsx("img",{src:lI,alt:"",className:"w-full drop-shadow-xl"}),E1.jsxs("div",{className:M9({variant:"outline",className:"absolute -right-3 -bottom-2 -rotate-8"}),children:["About Moi",E1.jsx(rI,{"data-icon":"inline-end",stroke:1.5})]})]})})}function o40(){let{demoInstallUrl:$}=N4();return E1.jsxs(mJ,{"data-vivid":!0,showCloseButton:!1,className:"block w-full max-w-md overflow-hidden rounded-2xl bg-primary texture-checker-16 p-2 text-primary-foreground sm:max-w-md md:max-w-2xl",children:[E1.jsx("div",{className:"absolute inset-0 bg-[linear-gradient(to_right,color-mix(in_oklch,var(--background)_14%,transparent),color-mix(in_oklch,var(--background)_6%,transparent))]"}),E1.jsxs("svg",{className:"pointer-events-none absolute inset-0 size-full opacity-30 mix-blend-soft-light","aria-hidden":"true",children:[E1.jsx("filter",{id:"floppy-grain",children:E1.jsx("feTurbulence",{type:"fractalNoise",baseFrequency:"0.8",numOctaves:"2",stitchTiles:"stitch"})}),E1.jsx("rect",{width:"100%",height:"100%",filter:"url(#floppy-grain)"})]}),E1.jsxs("div",{className:"relative grid max-h-[calc(100dvh-2rem)] overflow-y-auto md:grid-cols-[3fr_2fr] md:overflow-visible",children:[E1.jsxs("div",{className:"rounded-xl bg-background p-6 text-foreground shadow-sm md:p-8",children:[E1.jsxs("div",{className:"flex flex-col gap-0.5",children:[E1.jsx($7,{children:"Set up your personal Moi"}),E1.jsx(uJ,{className:"mt-1",children:"This is a demo workspace. Sign in and connect your agent to unlock all features."})]}),E1.jsxs("ul",{className:"mt-4 flex flex-col gap-3",children:[E1.jsxs("li",{className:"flex items-center gap-3",children:[E1.jsx(gY,{stroke:0.75,className:"mt-0.5 size-8 shrink-0 text-muted-foreground"}),E1.jsx("span",{className:"text-sm text-foreground",children:"Create as many workspaces, views, and widgets as you want"})]}),E1.jsxs("li",{className:"flex items-center gap-3",children:[E1.jsx(aI,{stroke:0.75,className:"mt-0.5 size-8 shrink-0 text-muted-foreground"}),E1.jsxs("span",{className:"text-sm text-foreground",children:["Build with"," ",E1.jsxs("span",{className:"inline-flex items-baseline gap-1",children:[E1.jsx("img",{src:hY,alt:"",className:"size-3.5 self-center object-contain"}),E1.jsx("strong",{className:"font-medium",children:"Claude"})]})," ","or"," ",E1.jsxs("span",{className:"inline-flex items-baseline gap-1",children:[E1.jsx("img",{src:vY,alt:"",className:"size-3.5 self-center object-contain"}),E1.jsx("strong",{className:"font-medium",children:"ChatGPT"})]})," ","using your subscription and app connectors"]})]})]}),E1.jsxs(L0,{render:E1.jsx("a",{href:"/cloud/login"}),className:"mt-6",children:["Sign in",E1.jsx(fY,{"data-icon":"inline-end",stroke:1.5})]})]}),E1.jsx(a40,{demoInstallUrl:$})]}),E1.jsx(MQ,{render:E1.jsx(L0,{variant:"outline",size:"icon","aria-label":"Close",className:"absolute top-4 right-4",children:E1.jsx(i5,{stroke:1.5})})})]})}var A7=P(m(),1);var Dx=P(m(),1);var nI="/hermes-pznd63x9.png";var sI="/openclaw-a2pyfhpn.svg";var TQ=["rocket","sparkles","bolt","flame","star","heart","diamond","trophy","target","bulb","brain","robot","wand","atom","flask","cpu","code","terminal","api","database","cube","hexagon","plug","tool","settings","dots","bug","activity","chart","briefcase","folder","file","book","message","mail","bell","paperclip","key","shield","user","home","globe","world","planet","compass","map","calendar","cloud","sun","moon","snowflake","leaf","mountain","feather","ghost","music","piano","camera","photo","palette","gamepad","gift","cart","chef"],t40=new Set(TQ);function tI($){return t40.has($)}var Zy={rocket:pk,sparkles:ik,bolt:jQ,flame:Pk,star:rk,heart:Ek,diamond:Lk,trophy:tk,target:ok,bulb:zk,brain:Bk,robot:uk,wand:ek,atom:Zk,flask:_k,cpu:qk,code:Wk,terminal:nk,api:$k,database:Dk,cube:Ak,hexagon:bk,plug:mk,tool:sk,settings:F3,dots:mY,bug:Xk,activity:eI,chart:Yk,briefcase:Qk,folder:Ok,file:lJ,book:Hk,message:kk,mail:Rk,bell:Jk,paperclip:pY,key:uY,shield:ck,user:mU,home:wk,globe:Ck,world:$y,planet:gk,compass:Nk,map:Ik,calendar:Gk,cloud:Kk,sun:ak,moon:yk,snowflake:lk,leaf:Sk,mountain:xk,feather:Mk,ghost:Tk,music:hk,piano:cY,camera:Uk,photo:fk,palette:vk,gamepad:Vk,gift:jk,cart:dk,chef:Fk},Jy=TQ.map(($)=>({id:$,Icon:Zy[$]}));function dY($){return $&&tI($)?Zy[$]:null}var e40=($,Z)=>{if(typeof $!=="number")return;if(Z===3)return{mode:"rgb",r:($>>8&15|$>>4&240)/255,g:($>>4&15|$&240)/255,b:($&15|$<<4&240)/255};if(Z===4)return{mode:"rgb",r:($>>12&15|$>>8&240)/255,g:($>>8&15|$>>4&240)/255,b:($>>4&15|$&240)/255,alpha:($&15|$<<4&240)/255};if(Z===6)return{mode:"rgb",r:($>>16&255)/255,g:($>>8&255)/255,b:($&255)/255};if(Z===8)return{mode:"rgb",r:($>>24&255)/255,g:($>>16&255)/255,b:($>>8&255)/255,alpha:($&255)/255}},lY=e40;var $80={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},Hy=$80;var Z80=($)=>{return lY(Hy[$.toLowerCase()],6)},By=Z80;var J80=/^#?([0-9a-f]{8}|[0-9a-f]{6}|[0-9a-f]{4}|[0-9a-f]{3})$/i,H80=($)=>{let Z;return(Z=$.match(J80))?lY(parseInt(Z[1],16),Z[1].length):void 0},Qy=H80;var iY="([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)";var p$="([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%";var CQ="(?:([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%|([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?))";var Xy="(?:([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)(deg|grad|rad|turn)|([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?))";var B7="\\s*,\\s*";var wp0=new RegExp("^(?:([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%|([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)|none)$");var B80=new RegExp(`^rgba?\\(\\s*${iY}${B7}${iY}${B7}${iY}\\s*(?:,\\s*${CQ}\\s*)?\\)$`),Q80=new RegExp(`^rgba?\\(\\s*${p$}${B7}${p$}${B7}${p$}\\s*(?:,\\s*${CQ}\\s*)?\\)$`),X80=($)=>{let Z={mode:"rgb"},J;if(J=$.match(B80)){if(J[1]!==void 0)Z.r=J[1]/255;if(J[2]!==void 0)Z.g=J[2]/255;if(J[3]!==void 0)Z.b=J[3]/255}else if(J=$.match(Q80)){if(J[1]!==void 0)Z.r=J[1]/100;if(J[2]!==void 0)Z.g=J[2]/100;if(J[3]!==void 0)Z.b=J[3]/100}else return;if(J[4]!==void 0)Z.alpha=Math.max(0,Math.min(1,J[4]/100));else if(J[5]!==void 0)Z.alpha=Math.max(0,Math.min(1,+J[5]));return Z},zy=X80;var z80=($,Z)=>$===void 0?void 0:typeof $!=="object"?Uy($):$.mode!==void 0?$:Z?{...$,mode:Z}:void 0,Gy=z80;var G80=($="rgb")=>(Z)=>(Z=Gy(Z,$))!==void 0?Z.mode===$?Z:P9[Z.mode][$]?P9[Z.mode][$](Z):$==="rgb"?P9[Z.mode].rgb(Z):P9.rgb[$](P9[Z.mode].rgb(Z)):void 0,rY=G80;var P9={},Yy={},EQ=[],hV={},U80=($)=>$,F5=($)=>{if(P9[$.mode]={...P9[$.mode],...$.toMode},Object.keys($.fromMode||{}).forEach((Z)=>{if(!P9[Z])P9[Z]={};P9[Z][$.mode]=$.fromMode[Z]}),!$.ranges)$.ranges={};if(!$.difference)$.difference={};return $.channels.forEach((Z)=>{if($.ranges[Z]===void 0)$.ranges[Z]=[0,1];if(!$.interpolate[Z])throw Error(`Missing interpolator for: ${Z}`);if(typeof $.interpolate[Z]==="function")$.interpolate[Z]={use:$.interpolate[Z]};if(!$.interpolate[Z].fixup)$.interpolate[Z].fixup=U80}),Yy[$.mode]=$,($.parse||[]).forEach((Z)=>{Y80(Z,$.mode)}),rY($.mode)},Fy=($)=>Yy[$],Y80=($,Z)=>{if(typeof $==="string"){if(!Z)throw Error("'mode' required when 'parser' is a string");hV[$]=Z}else if(typeof $==="function"){if(EQ.indexOf($)<0)EQ.push($)}};var vV=/[^\x00-\x7F]|[a-zA-Z_]/,F80=/[^\x00-\x7F]|[-\w]/,T0={Function:"function",Ident:"ident",Number:"number",Percentage:"percentage",ParenClose:")",None:"none",Hue:"hue",Alpha:"alpha"},U1=0;function aY($){let Z=$[U1],J=$[U1+1];if(Z==="-"||Z==="+")return/\d/.test(J)||J==="."&&/\d/.test($[U1+2]);if(Z===".")return/\d/.test(J);return/\d/.test(Z)}function fV($){if(U1>=$.length)return!1;let Z=$[U1];if(vV.test(Z))return!0;if(Z==="-"){if($.length-U1<2)return!1;let J=$[U1+1];if(J==="-"||vV.test(J))return!0;return!1}return!1}var K80={deg:1,rad:180/Math.PI,grad:0.9,turn:360};function bQ($){let Z="";if($[U1]==="-"||$[U1]==="+")Z+=$[U1++];if(Z+=oY($),$[U1]==="."&&/\d/.test($[U1+1]))Z+=$[U1++]+oY($);if($[U1]==="e"||$[U1]==="E"){if(($[U1+1]==="-"||$[U1+1]==="+")&&/\d/.test($[U1+2]))Z+=$[U1++]+$[U1++]+oY($);else if(/\d/.test($[U1+1]))Z+=$[U1++]+oY($)}if(fV($)){let J=nY($);if(J==="deg"||J==="rad"||J==="turn"||J==="grad")return{type:T0.Hue,value:Z*K80[J]};return}if($[U1]==="%")return U1++,{type:T0.Percentage,value:+Z};return{type:T0.Number,value:+Z}}function oY($){let Z="";while(/\d/.test($[U1]))Z+=$[U1++];return Z}function nY($){let Z="";while(U1<$.length&&F80.test($[U1]))Z+=$[U1++];return Z}function W80($){let Z=nY($);if($[U1]==="(")return U1++,{type:T0.Function,value:Z};if(Z==="none")return{type:T0.None,value:void 0};return{type:T0.Ident,value:Z}}function N80($=""){let Z=$.trim(),J=[],H;U1=0;while(U1<Z.length){if(H=Z[U1++],H===`
|
|
12
|
+
`||H==="\t"||H===" "){while(U1<Z.length&&(Z[U1]===`
|
|
13
|
+
`||Z[U1]==="\t"||Z[U1]===" "))U1++;continue}if(H===",")return;if(H===")"){J.push({type:T0.ParenClose});continue}if(H==="+"){if(U1--,aY(Z)){J.push(bQ(Z));continue}return}if(H==="-"){if(U1--,aY(Z)){J.push(bQ(Z));continue}if(fV(Z)){J.push({type:T0.Ident,value:nY(Z)});continue}return}if(H==="."){if(U1--,aY(Z)){J.push(bQ(Z));continue}return}if(H==="/"){while(U1<Z.length&&(Z[U1]===`
|
|
14
|
+
`||Z[U1]==="\t"||Z[U1]===" "))U1++;let B;if(aY(Z)){if(B=bQ(Z),B.type!==T0.Hue){J.push({type:T0.Alpha,value:B});continue}}if(fV(Z)){if(nY(Z)==="none"){J.push({type:T0.Alpha,value:{type:T0.None,value:void 0}});continue}}return}if(/\d/.test(H)){U1--,J.push(bQ(Z));continue}if(vV.test(H)){U1--,J.push(W80(Z));continue}return}return J}function q80($){$._i=0;let Z=$[$._i++];if(!Z||Z.type!==T0.Function||Z.value!=="color")return;if(Z=$[$._i++],Z.type!==T0.Ident)return;let J=hV[Z.value];if(!J)return;let H={mode:J},B=Ky($,!1);if(!B)return;let Q=Fy(J).channels;for(let X=0,z,G;X<Q.length;X++)if(z=B[X],G=Q[X],z.type!==T0.None){if(H[G]=z.type===T0.Number?z.value:z.value/100,G==="alpha")H[G]=Math.max(0,Math.min(1,H[G]))}return H}function Ky($,Z){let J=[],H;while($._i<$.length){if(H=$[$._i++],H.type===T0.None||H.type===T0.Number||H.type===T0.Alpha||H.type===T0.Percentage||Z&&H.type===T0.Hue){J.push(H);continue}if(H.type===T0.ParenClose){if($._i<$.length)return;continue}return}if(J.length<3||J.length>4)return;if(J.length===4){if(J[3].type!==T0.Alpha)return;J[3]=J[3].value}if(J.length===3)J.push({type:T0.None,value:void 0});return J.every((B)=>B.type!==T0.Alpha)?J:void 0}function A80($,Z){$._i=0;let J=$[$._i++];if(!J||J.type!==T0.Function)return;let H=Ky($,Z);if(!H)return;return H.unshift(J.value),H}var D80=($)=>{if(typeof $!=="string")return;let Z=N80($),J=Z?A80(Z,!0):void 0,H=void 0,B=0,Q=EQ.length;while(B<Q)if((H=EQ[B++]($,J))!==void 0)return H;return Z?q80(Z):void 0},Uy=D80;function V80($,Z){if(!Z||Z[0]!=="rgb"&&Z[0]!=="rgba")return;let J={mode:"rgb"},[,H,B,Q,X]=Z;if(H.type===T0.Hue||B.type===T0.Hue||Q.type===T0.Hue)return;if(H.type!==T0.None)J.r=H.type===T0.Number?H.value/255:H.value/100;if(B.type!==T0.None)J.g=B.type===T0.Number?B.value/255:B.value/100;if(Q.type!==T0.None)J.b=Q.type===T0.Number?Q.value/255:Q.value/100;if(X.type!==T0.None)J.alpha=Math.min(1,Math.max(0,X.type===T0.Number?X.value:X.value/100));return J}var Wy=V80;var L80=($)=>$==="transparent"?{mode:"rgb",r:0,g:0,b:0,alpha:0}:void 0,Ny=L80;var qy=($,Z,J)=>$+J*(Z-$);var M80=($)=>{let Z=[];for(let J=0;J<$.length-1;J++){let H=$[J],B=$[J+1];if(H===void 0&&B===void 0)Z.push(void 0);else if(H!==void 0&&B!==void 0)Z.push([H,B]);else Z.push(H!==void 0?[H,H]:[B,B])}return Z},Ay=($)=>(Z)=>{let J=M80(Z);return(H)=>{let B=H*J.length,Q=H>=1?J.length-1:Math.max(Math.floor(B),0),X=J[Q];return X===void 0?void 0:$(X[0],X[1],B-Q)}};var E0=Ay(qy);var h1=($)=>{let Z=!1,J=$.map((H)=>{if(H!==void 0)return Z=!0,H;return 1});return Z?J:$};var P80={mode:"rgb",channels:["r","g","b","alpha"],parse:[Wy,Qy,zy,By,Ny,"srgb"],serialize:"srgb",interpolate:{r:E0,g:E0,b:E0,alpha:{use:E0,fixup:h1}},gamut:!0,white:{r:1,g:1,b:1},black:{r:0,g:0,b:0}},c8=P80;var gV=($=0)=>Math.pow(Math.abs($),2.19921875)*Math.sign($),_80=($)=>{let Z=gV($.r),J=gV($.g),H=gV($.b),B={mode:"xyz65",x:0.5766690429101305*Z+0.1855582379065463*J+0.1882286462349947*H,y:0.297344975250536*Z+0.6273635662554661*J+0.0752914584939979*H,z:0.0270313613864123*Z+0.0706888525358272*J+0.9913375368376386*H};if($.alpha!==void 0)B.alpha=$.alpha;return B},mV=_80;var uV=($)=>Math.pow(Math.abs($),0.4547069271758437)*Math.sign($),O80=({x:$,y:Z,z:J,alpha:H})=>{if($===void 0)$=0;if(Z===void 0)Z=0;if(J===void 0)J=0;let B={mode:"a98",r:uV($*2.0415879038107465-Z*0.5650069742788597-0.3447313507783297*J),g:uV($*-0.9692436362808798+Z*1.8759675015077206+0.0415550574071756*J),b:uV($*0.0134442806320312-Z*0.1183623922310184+1.0151749943912058*J)};if(H!==void 0)B.alpha=H;return B},pV=O80;var cV=($=0)=>{let Z=Math.abs($);if(Z<=0.04045)return $/12.92;return(Math.sign($)||1)*Math.pow((Z+0.055)/1.055,2.4)},T80=({r:$,g:Z,b:J,alpha:H})=>{let B={mode:"lrgb",r:cV($),g:cV(Z),b:cV(J)};if(H!==void 0)B.alpha=H;return B},d8=T80;var j80=($)=>{let{r:Z,g:J,b:H,alpha:B}=d8($),Q={mode:"xyz65",x:0.4123907992659593*Z+0.357584339383878*J+0.1804807884018343*H,y:0.2126390058715102*Z+0.715168678767756*J+0.0721923153607337*H,z:0.0193308187155918*Z+0.119194779794626*J+0.9505321522496607*H};if(B!==void 0)Q.alpha=B;return Q},J8=j80;var dV=($=0)=>{let Z=Math.abs($);if(Z>0.0031308)return(Math.sign($)||1)*(1.055*Math.pow(Z,0.4166666666666667)-0.055);return $*12.92},C80=({r:$,g:Z,b:J,alpha:H},B="rgb")=>{let Q={mode:B,r:dV($),g:dV(Z),b:dV(J)};if(H!==void 0)Q.alpha=H;return Q},l8=C80;var E80=({x:$,y:Z,z:J,alpha:H})=>{if($===void 0)$=0;if(Z===void 0)Z=0;if(J===void 0)J=0;let B=l8({r:$*3.2409699419045226-Z*1.537383177570094-0.4986107602930034*J,g:$*-0.9692436362808796+Z*1.8759675015077204+0.0415550574071756*J,b:$*0.0556300796969936-Z*0.2039769588889765+1.0569715142428784*J});if(H!==void 0)B.alpha=H;return B},H8=E80;var b80={...c8,mode:"a98",parse:["a98-rgb"],serialize:"a98-rgb",fromMode:{rgb:($)=>pV(J8($)),xyz65:pV},toMode:{rgb:($)=>H8(mV($)),xyz65:mV}},Dy=b80;var w80=($)=>($=$%360)<0?$+360:$,O5=w80;var S80=($,Z)=>{return $.map((J,H,B)=>{if(J===void 0)return J;let Q=O5(J);if(H===0||$[H-1]===void 0)return Q;return Z(Q-O5(B[H-1]))}).reduce((J,H)=>{if(!J.length||H===void 0||J[J.length-1]===void 0)return J.push(H),J;return J.push(H+J[J.length-1]),J},[])},f2=($)=>S80($,(Z)=>Math.abs(Z)<=180?Z:Z-360*Math.sign(Z));var q2=[-0.14861,1.78277,-0.29227,-0.90649,1.97294,0],Vy=Math.PI/180,Ly=180/Math.PI;var My=q2[3]*q2[4],Py=q2[1]*q2[4],_y=q2[1]*q2[2]-q2[0]*q2[3],R80=({r:$,g:Z,b:J,alpha:H})=>{if($===void 0)$=0;if(Z===void 0)Z=0;if(J===void 0)J=0;let B=(_y*J+$*My-Z*Py)/(_y+My-Py),Q=J-B,X=(q2[4]*(Z-B)-q2[2]*Q)/q2[3],z={mode:"cubehelix",l:B,s:B===0||B===1?void 0:Math.sqrt(Q*Q+X*X)/(q2[4]*B*(1-B))};if(z.s)z.h=Math.atan2(X,Q)*Ly-120;if(H!==void 0)z.alpha=H;return z},Oy=R80;var I80=({h:$,s:Z,l:J,alpha:H})=>{let B={mode:"rgb"};if($=($===void 0?0:$+120)*Vy,J===void 0)J=0;let Q=Z===void 0?0:Z*J*(1-J),X=Math.cos($),z=Math.sin($);if(B.r=J+Q*(q2[0]*X+q2[1]*z),B.g=J+Q*(q2[2]*X+q2[3]*z),B.b=J+Q*(q2[4]*X+q2[5]*z),H!==void 0)B.alpha=H;return B},Ty=I80;var Q7=($,Z)=>{if($.h===void 0||Z.h===void 0||!$.s||!Z.s)return 0;let J=O5($.h),H=O5(Z.h),B=Math.sin((H-J+360)/2*Math.PI/180);return 2*Math.sqrt($.s*Z.s)*B},jy=($,Z)=>{if($.h===void 0||Z.h===void 0)return 0;let J=O5($.h),H=O5(Z.h);if(Math.abs(H-J)>180)return J-(H-360*Math.sign(H-J));return H-J},X7=($,Z)=>{if($.h===void 0||Z.h===void 0||!$.c||!Z.c)return 0;let J=O5($.h),H=O5(Z.h),B=Math.sin((H-J+360)/2*Math.PI/180);return 2*Math.sqrt($.c*Z.c)*B};var g2=($)=>{let Z=$.reduce((H,B)=>{if(B!==void 0){let Q=B*Math.PI/180;H.sin+=Math.sin(Q),H.cos+=Math.cos(Q)}return H},{sin:0,cos:0}),J=Math.atan2(Z.sin,Z.cos)*180/Math.PI;return J<0?360+J:J};var k80={mode:"cubehelix",channels:["h","s","l","alpha"],parse:["--cubehelix"],serialize:"--cubehelix",ranges:{h:[0,360],s:[0,4.614],l:[0,1]},fromMode:{rgb:Oy},toMode:{rgb:Ty},interpolate:{h:{use:E0,fixup:f2},s:E0,l:E0,alpha:{use:E0,fixup:h1}},difference:{h:Q7},average:{h:g2}},Cy=k80;var y80=({l:$,a:Z,b:J,alpha:H},B="lch")=>{if(Z===void 0)Z=0;if(J===void 0)J=0;let Q=Math.sqrt(Z*Z+J*J),X={mode:B,l:$,c:Q};if(Q)X.h=O5(Math.atan2(J,Z)*180/Math.PI);if(H!==void 0)X.alpha=H;return X},P8=y80;var x80=({l:$,c:Z,h:J,alpha:H},B="lab")=>{if(J===void 0)J=0;let Q={mode:B,l:$,a:Z?Z*Math.cos(J/180*Math.PI):0,b:Z?Z*Math.sin(J/180*Math.PI):0};if(H!==void 0)Q.alpha=H;return Q},_8=x80;var sY=Math.pow(29,3)/Math.pow(3,3),tY=Math.pow(6,3)/Math.pow(29,3);var c5={X:0.9642956764295677,Y:1,Z:0.8251046025104602},z7={X:0.9504559270516716,Y:1,Z:1.0890577507598784},pc0=Math.pow(29,3)/Math.pow(3,3),cc0=Math.pow(6,3)/Math.pow(29,3);var lV=($)=>Math.pow($,3)>tY?Math.pow($,3):(116*$-16)/sY,h80=({l:$,a:Z,b:J,alpha:H})=>{if($===void 0)$=0;if(Z===void 0)Z=0;if(J===void 0)J=0;let B=($+16)/116,Q=Z/500+B,X=B-J/200,z={mode:"xyz65",x:lV(Q)*z7.X,y:lV(B)*z7.Y,z:lV(X)*z7.Z};if(H!==void 0)z.alpha=H;return z},eY=h80;var v80=($)=>H8(eY($)),G7=v80;var iV=($)=>$>tY?Math.cbrt($):(sY*$+16)/116,f80=({x:$,y:Z,z:J,alpha:H})=>{if($===void 0)$=0;if(Z===void 0)Z=0;if(J===void 0)J=0;let B=iV($/z7.X),Q=iV(Z/z7.Y),X=iV(J/z7.Z),z={mode:"lab65",l:116*Q-16,a:500*(B-Q),b:200*(Q-X)};if(H!==void 0)z.alpha=H;return z},$F=f80;var g80=($)=>{let Z=$F(J8($));if($.r===$.b&&$.b===$.g)Z.a=Z.b=0;return Z},U7=g80;var iJ=1,ZF=1,c$=0.14444444444444443*Math.PI,rJ=Math.cos(c$),aJ=Math.sin(c$),JF=100/Math.log(1.39);var m80=({l:$,c:Z,h:J,alpha:H})=>{if($===void 0)$=0;if(Z===void 0)Z=0;if(J===void 0)J=0;let B={mode:"lab65",l:(Math.exp($*iJ/JF)-1)/0.0039},Q=(Math.exp(0.0435*Z*ZF*iJ)-1)/0.075,X=Q*Math.cos(J/180*Math.PI-c$),z=Q*Math.sin(J/180*Math.PI-c$);if(B.a=X*rJ-z/0.83*aJ,B.b=X*aJ+z/0.83*rJ,H!==void 0)B.alpha=H;return B},wQ=m80;var u80=({l:$,a:Z,b:J,alpha:H})=>{if($===void 0)$=0;if(Z===void 0)Z=0;if(J===void 0)J=0;let B=Z*rJ+J*aJ,Q=0.83*(J*rJ-Z*aJ),X=Math.sqrt(B*B+Q*Q),z={mode:"dlch",l:JF/iJ*Math.log(1+0.0039*$),c:Math.log(1+0.075*X)/(0.0435*ZF*iJ)};if(z.c)z.h=O5((Math.atan2(Q,B)+c$)/Math.PI*180);if(H!==void 0)z.alpha=H;return z},SQ=u80;var Ey=($)=>wQ(P8($,"dlch")),by=($)=>_8(SQ($),"dlab"),p80={mode:"dlab",parse:["--din99o-lab"],serialize:"--din99o-lab",toMode:{lab65:Ey,rgb:($)=>G7(Ey($))},fromMode:{lab65:by,rgb:($)=>by(U7($))},channels:["l","a","b","alpha"],ranges:{l:[0,100],a:[-40.09,45.501],b:[-40.469,44.344]},interpolate:{l:E0,a:E0,b:E0,alpha:{use:E0,fixup:h1}}},wy=p80;var c80={mode:"dlch",parse:["--din99o-lch"],serialize:"--din99o-lch",toMode:{lab65:wQ,dlab:($)=>_8($,"dlab"),rgb:($)=>G7(wQ($))},fromMode:{lab65:SQ,dlab:($)=>P8($,"dlch"),rgb:($)=>SQ(U7($))},channels:["l","c","h","alpha"],ranges:{l:[0,100],c:[0,51.484],h:[0,360]},interpolate:{l:E0,c:E0,h:{use:E0,fixup:f2},alpha:{use:E0,fixup:h1}},difference:{h:X7},average:{h:g2}},Sy=c80;function rV({h:$,s:Z,i:J,alpha:H}){if($=O5($!==void 0?$:0),Z===void 0)Z=0;if(J===void 0)J=0;let B=Math.abs($/60%2-1),Q;switch(Math.floor($/60)){case 0:Q={r:J*(1+Z*(3/(2-B)-1)),g:J*(1+Z*(3*(1-B)/(2-B)-1)),b:J*(1-Z)};break;case 1:Q={r:J*(1+Z*(3*(1-B)/(2-B)-1)),g:J*(1+Z*(3/(2-B)-1)),b:J*(1-Z)};break;case 2:Q={r:J*(1-Z),g:J*(1+Z*(3/(2-B)-1)),b:J*(1+Z*(3*(1-B)/(2-B)-1))};break;case 3:Q={r:J*(1-Z),g:J*(1+Z*(3*(1-B)/(2-B)-1)),b:J*(1+Z*(3/(2-B)-1))};break;case 4:Q={r:J*(1+Z*(3*(1-B)/(2-B)-1)),g:J*(1-Z),b:J*(1+Z*(3/(2-B)-1))};break;case 5:Q={r:J*(1+Z*(3/(2-B)-1)),g:J*(1-Z),b:J*(1+Z*(3*(1-B)/(2-B)-1))};break;default:Q={r:J*(1-Z),g:J*(1-Z),b:J*(1-Z)}}if(Q.mode="rgb",H!==void 0)Q.alpha=H;return Q}function aV({r:$,g:Z,b:J,alpha:H}){if($===void 0)$=0;if(Z===void 0)Z=0;if(J===void 0)J=0;let B=Math.max($,Z,J),Q=Math.min($,Z,J),X={mode:"hsi",s:$+Z+J===0?0:1-3*Q/($+Z+J),i:($+Z+J)/3};if(B-Q!==0)X.h=(B===$?(Z-J)/(B-Q)+(Z<J)*6:B===Z?(J-$)/(B-Q)+2:($-Z)/(B-Q)+4)*60;if(H!==void 0)X.alpha=H;return X}var d80={mode:"hsi",toMode:{rgb:rV},parse:["--hsi"],serialize:"--hsi",fromMode:{rgb:aV},channels:["h","s","i","alpha"],ranges:{h:[0,360]},gamut:"rgb",interpolate:{h:{use:E0,fixup:f2},s:E0,i:E0,alpha:{use:E0,fixup:h1}},difference:{h:Q7},average:{h:g2}},Ry=d80;function oV({h:$,s:Z,l:J,alpha:H}){if($=O5($!==void 0?$:0),Z===void 0)Z=0;if(J===void 0)J=0;let B=J+Z*(J<0.5?J:1-J),Q=B-(B-J)*2*Math.abs($/60%2-1),X;switch(Math.floor($/60)){case 0:X={r:B,g:Q,b:2*J-B};break;case 1:X={r:Q,g:B,b:2*J-B};break;case 2:X={r:2*J-B,g:B,b:Q};break;case 3:X={r:2*J-B,g:Q,b:B};break;case 4:X={r:Q,g:2*J-B,b:B};break;case 5:X={r:B,g:2*J-B,b:Q};break;default:X={r:2*J-B,g:2*J-B,b:2*J-B}}if(X.mode="rgb",H!==void 0)X.alpha=H;return X}function nV({r:$,g:Z,b:J,alpha:H}){if($===void 0)$=0;if(Z===void 0)Z=0;if(J===void 0)J=0;let B=Math.max($,Z,J),Q=Math.min($,Z,J),X={mode:"hsl",s:B===Q?0:(B-Q)/(1-Math.abs(B+Q-1)),l:0.5*(B+Q)};if(B-Q!==0)X.h=(B===$?(Z-J)/(B-Q)+(Z<J)*6:B===Z?(J-$)/(B-Q)+2:($-Z)/(B-Q)+4)*60;if(H!==void 0)X.alpha=H;return X}var l80=($,Z)=>{switch(Z){case"deg":return+$;case"rad":return $/Math.PI*180;case"grad":return $/10*9;case"turn":return $*360}},Iy=l80;var i80=new RegExp(`^hsla?\\(\\s*${Xy}${B7}${p$}${B7}${p$}\\s*(?:,\\s*${CQ}\\s*)?\\)$`),r80=($)=>{let Z=$.match(i80);if(!Z)return;let J={mode:"hsl"};if(Z[3]!==void 0)J.h=+Z[3];else if(Z[1]!==void 0&&Z[2]!==void 0)J.h=Iy(Z[1],Z[2]);if(Z[4]!==void 0)J.s=Math.min(Math.max(0,Z[4]/100),1);if(Z[5]!==void 0)J.l=Math.min(Math.max(0,Z[5]/100),1);if(Z[6]!==void 0)J.alpha=Math.max(0,Math.min(1,Z[6]/100));else if(Z[7]!==void 0)J.alpha=Math.max(0,Math.min(1,+Z[7]));return J},ky=r80;function a80($,Z){if(!Z||Z[0]!=="hsl"&&Z[0]!=="hsla")return;let J={mode:"hsl"},[,H,B,Q,X]=Z;if(H.type!==T0.None){if(H.type===T0.Percentage)return;J.h=H.value}if(B.type!==T0.None){if(B.type===T0.Hue)return;J.s=B.value/100}if(Q.type!==T0.None){if(Q.type===T0.Hue)return;J.l=Q.value/100}if(X.type!==T0.None)J.alpha=Math.min(1,Math.max(0,X.type===T0.Number?X.value:X.value/100));return J}var yy=a80;var o80={mode:"hsl",toMode:{rgb:oV},fromMode:{rgb:nV},channels:["h","s","l","alpha"],ranges:{h:[0,360]},gamut:"rgb",parse:[yy,ky],serialize:($)=>`hsl(${$.h!==void 0?$.h:"none"} ${$.s!==void 0?$.s*100+"%":"none"} ${$.l!==void 0?$.l*100+"%":"none"}${$.alpha<1?` / ${$.alpha}`:""})`,interpolate:{h:{use:E0,fixup:f2},s:E0,l:E0,alpha:{use:E0,fixup:h1}},difference:{h:Q7},average:{h:g2}},HF=o80;function RQ({h:$,s:Z,v:J,alpha:H}){if($=O5($!==void 0?$:0),Z===void 0)Z=0;if(J===void 0)J=0;let B=Math.abs($/60%2-1),Q;switch(Math.floor($/60)){case 0:Q={r:J,g:J*(1-Z*B),b:J*(1-Z)};break;case 1:Q={r:J*(1-Z*B),g:J,b:J*(1-Z)};break;case 2:Q={r:J*(1-Z),g:J,b:J*(1-Z*B)};break;case 3:Q={r:J*(1-Z),g:J*(1-Z*B),b:J};break;case 4:Q={r:J*(1-Z*B),g:J*(1-Z),b:J};break;case 5:Q={r:J,g:J*(1-Z),b:J*(1-Z*B)};break;default:Q={r:J*(1-Z),g:J*(1-Z),b:J*(1-Z)}}if(Q.mode="rgb",H!==void 0)Q.alpha=H;return Q}function IQ({r:$,g:Z,b:J,alpha:H}){if($===void 0)$=0;if(Z===void 0)Z=0;if(J===void 0)J=0;let B=Math.max($,Z,J),Q=Math.min($,Z,J),X={mode:"hsv",s:B===0?0:1-Q/B,v:B};if(B-Q!==0)X.h=(B===$?(Z-J)/(B-Q)+(Z<J)*6:B===Z?(J-$)/(B-Q)+2:($-Z)/(B-Q)+4)*60;if(H!==void 0)X.alpha=H;return X}var n80={mode:"hsv",toMode:{rgb:RQ},parse:["--hsv"],serialize:"--hsv",fromMode:{rgb:IQ},channels:["h","s","v","alpha"],ranges:{h:[0,360]},gamut:"rgb",interpolate:{h:{use:E0,fixup:f2},s:E0,v:E0,alpha:{use:E0,fixup:h1}},difference:{h:Q7},average:{h:g2}},BF=n80;function sV({h:$,w:Z,b:J,alpha:H}){if(Z===void 0)Z=0;if(J===void 0)J=0;if(Z+J>1){let B=Z+J;Z/=B,J/=B}return RQ({h:$,s:J===1?1:1-Z/(1-J),v:1-J,alpha:H})}function tV($){let Z=IQ($);if(Z===void 0)return;let J=Z.s!==void 0?Z.s:0,H=Z.v!==void 0?Z.v:0,B={mode:"hwb",w:(1-J)*H,b:1-H};if(Z.h!==void 0)B.h=Z.h;if(Z.alpha!==void 0)B.alpha=Z.alpha;return B}function s80($,Z){if(!Z||Z[0]!=="hwb")return;let J={mode:"hwb"},[,H,B,Q,X]=Z;if(H.type!==T0.None){if(H.type===T0.Percentage)return;J.h=H.value}if(B.type!==T0.None){if(B.type===T0.Hue)return;J.w=B.value/100}if(Q.type!==T0.None){if(Q.type===T0.Hue)return;J.b=Q.value/100}if(X.type!==T0.None)J.alpha=Math.min(1,Math.max(0,X.type===T0.Number?X.value:X.value/100));return J}var xy=s80;var t80={mode:"hwb",toMode:{rgb:sV},fromMode:{rgb:tV},channels:["h","w","b","alpha"],ranges:{h:[0,360]},gamut:"rgb",parse:[xy],serialize:($)=>`hwb(${$.h!==void 0?$.h:"none"} ${$.w!==void 0?$.w*100+"%":"none"} ${$.b!==void 0?$.b*100+"%":"none"}${$.alpha<1?` / ${$.alpha}`:""})`,interpolate:{h:{use:E0,fixup:f2},w:E0,b:E0,alpha:{use:E0,fixup:h1}},difference:{h:jy},average:{h:g2}},hy=t80;var QF=203;var XF=0.1593017578125;var zF=0.8359375,GF=18.8515625,UF=18.6875;function YF($){if($<0)return 0;let Z=Math.pow($,0.012683313515655966);return 1e4*Math.pow(Math.max(0,Z-0.8359375)/(18.8515625-18.6875*Z),6.277394636015326)}function FF($){if($<0)return 0;let Z=Math.pow($/1e4,0.1593017578125);return Math.pow((0.8359375+18.8515625*Z)/(1+18.6875*Z),78.84375)}var eV=($)=>Math.max($/QF,0),e80=({i:$,t:Z,p:J,alpha:H})=>{if($===void 0)$=0;if(Z===void 0)Z=0;if(J===void 0)J=0;let B=YF($+0.008609037037932761*Z+0.11102962500302593*J),Q=YF($-0.00860903703793275*Z-0.11102962500302599*J),X=YF($+0.5600313357106791*Z-0.32062717498731885*J),z={mode:"xyz65",x:eV(2.070152218389422*B-1.3263473389671556*Q+0.2066510476294051*X),y:eV(0.3647385209748074*B+0.680566024947227*Q-0.0453045459220346*X),z:eV(-0.049747207535812*B-0.0492609666966138*Q+1.1880659249923042*X)};if(H!==void 0)z.alpha=H;return z},$L=e80;var ZL=($=0)=>Math.max($*QF,0),$90=({x:$,y:Z,z:J,alpha:H})=>{let B=ZL($),Q=ZL(Z),X=ZL(J),z=FF(0.3592832590121217*B+0.6976051147779502*Q-0.0358915932320289*X),G=FF(-0.1920808463704995*B+1.1004767970374323*Q+0.0753748658519118*X),U=FF(0.0070797844607477*B+0.0748396662186366*Q+0.8433265453898765*X),Y=0.5*z+0.5*G,F=1.61376953125*z-3.323486328125*G+1.709716796875*U,K=4.378173828125*z-4.24560546875*G-0.132568359375*U,W={mode:"itp",i:Y,t:F,p:K};if(H!==void 0)W.alpha=H;return W},JL=$90;var Z90={mode:"itp",channels:["i","t","p","alpha"],parse:["--ictcp"],serialize:"--ictcp",toMode:{xyz65:$L,rgb:($)=>H8($L($))},fromMode:{xyz65:JL,rgb:($)=>JL(J8($))},ranges:{i:[0,0.581],t:[-0.369,0.272],p:[-0.164,0.331]},interpolate:{i:E0,t:E0,p:E0,alpha:{use:E0,fixup:h1}}},vy=Z90;var J90=134.03437499999998,H90=0.000000000016295499532821565,HL=($)=>{if($<0)return 0;let Z=Math.pow($/1e4,XF);return Math.pow((zF+GF*Z)/(1+UF*Z),J90)},BL=($=0)=>Math.max($*203,0),B90=({x:$,y:Z,z:J,alpha:H})=>{$=BL($),Z=BL(Z),J=BL(J);let B=1.15*$-0.15*J,Q=0.66*Z+0.34*$,X=HL(0.41478972*B+0.579999*Q+0.014648*J),z=HL(-0.20151*B+1.120649*Q+0.0531008*J),G=HL(-0.0166008*B+0.2648*Q+0.6684799*J),U=(X+z)/2,Y={mode:"jab",j:0.44*U/(1-0.56*U)-H90,a:3.524*X-4.066708*z+0.542708*G,b:0.199076*X+1.096799*z-1.295875*G};if(H!==void 0)Y.alpha=H;return Y},KF=B90;var Q90=134.03437499999998,fy=0.000000000016295499532821565,QL=($)=>{if($<0)return 0;let Z=Math.pow($,1/Q90);return 1e4*Math.pow((zF-Z)/(UF*Z-GF),1/XF)},XL=($)=>$/203,X90=({j:$,a:Z,b:J,alpha:H})=>{if($===void 0)$=0;if(Z===void 0)Z=0;if(J===void 0)J=0;let B=($+fy)/(0.44+0.56*($+fy)),Q=QL(B+0.13860504*Z+0.058047316*J),X=QL(B-0.13860504*Z-0.058047316*J),z=QL(B-0.096019242*Z-0.8118919*J),G={mode:"xyz65",x:XL(1.661373024652174*Q-0.914523081304348*X+0.23136208173913045*z),y:XL(-0.3250758611844533*Q+1.571847026732543*X-0.21825383453227928*z),z:XL(-0.090982811*Q-0.31272829*X+1.5227666*z)};if(H!==void 0)G.alpha=H;return G},WF=X90;var z90=($)=>{let Z=KF(J8($));if($.r===$.b&&$.b===$.g)Z.a=Z.b=0;return Z},NF=z90;var G90=($)=>H8(WF($)),qF=G90;var U90={mode:"jab",channels:["j","a","b","alpha"],parse:["--jzazbz"],serialize:"--jzazbz",fromMode:{rgb:NF,xyz65:KF},toMode:{rgb:qF,xyz65:WF},ranges:{j:[0,0.222],a:[-0.109,0.129],b:[-0.185,0.134]},interpolate:{j:E0,a:E0,b:E0,alpha:{use:E0,fixup:h1}}},gy=U90;var Y90=({j:$,a:Z,b:J,alpha:H})=>{if(Z===void 0)Z=0;if(J===void 0)J=0;let B=Math.sqrt(Z*Z+J*J),Q={mode:"jch",j:$,c:B};if(B)Q.h=O5(Math.atan2(J,Z)*180/Math.PI);if(H!==void 0)Q.alpha=H;return Q},zL=Y90;var F90=({j:$,c:Z,h:J,alpha:H})=>{if(J===void 0)J=0;let B={mode:"jab",j:$,a:Z?Z*Math.cos(J/180*Math.PI):0,b:Z?Z*Math.sin(J/180*Math.PI):0};if(H!==void 0)B.alpha=H;return B},GL=F90;var K90={mode:"jch",parse:["--jzczhz"],serialize:"--jzczhz",toMode:{jab:GL,rgb:($)=>qF(GL($))},fromMode:{rgb:($)=>zL(NF($)),jab:zL},channels:["j","c","h","alpha"],ranges:{j:[0,0.221],c:[0,0.19],h:[0,360]},interpolate:{h:{use:E0,fixup:f2},c:E0,j:E0,alpha:{use:E0,fixup:h1}},difference:{h:X7},average:{h:g2}},my=K90;var Y7=Math.pow(29,3)/Math.pow(3,3),oJ=Math.pow(6,3)/Math.pow(29,3);var UL=($)=>Math.pow($,3)>oJ?Math.pow($,3):(116*$-16)/Y7,W90=({l:$,a:Z,b:J,alpha:H})=>{if($===void 0)$=0;if(Z===void 0)Z=0;if(J===void 0)J=0;let B=($+16)/116,Q=Z/500+B,X=B-J/200,z={mode:"xyz50",x:UL(Q)*c5.X,y:UL(B)*c5.Y,z:UL(X)*c5.Z};if(H!==void 0)z.alpha=H;return z},nJ=W90;var N90=({x:$,y:Z,z:J,alpha:H})=>{if($===void 0)$=0;if(Z===void 0)Z=0;if(J===void 0)J=0;let B=l8({r:$*3.1341359569958707-Z*1.6173863321612538-0.4906619460083532*J,g:$*-0.978795502912089+Z*1.916254567259524+0.03344273116131949*J,b:$*0.07195537988411677-Z*0.2289768264158322+1.405386058324125*J});if(H!==void 0)B.alpha=H;return B},K3=N90;var q90=($)=>K3(nJ($)),AF=q90;var A90=($)=>{let{r:Z,g:J,b:H,alpha:B}=d8($),Q={mode:"xyz50",x:0.436065742824811*Z+0.3851514688337912*J+0.14307845442264197*H,y:0.22249319175623702*Z+0.7168870538238823*J+0.06061979053616537*H,z:0.013923904500943465*Z+0.09708128566574634*J+0.7140993584005155*H};if(B!==void 0)Q.alpha=B;return Q},W3=A90;var YL=($)=>$>oJ?Math.cbrt($):(Y7*$+16)/116,D90=({x:$,y:Z,z:J,alpha:H})=>{if($===void 0)$=0;if(Z===void 0)Z=0;if(J===void 0)J=0;let B=YL($/c5.X),Q=YL(Z/c5.Y),X=YL(J/c5.Z),z={mode:"lab",l:116*Q-16,a:500*(B-Q),b:200*(Q-X)};if(H!==void 0)z.alpha=H;return z},sJ=D90;var V90=($)=>{let Z=sJ(W3($));if($.r===$.b&&$.b===$.g)Z.a=Z.b=0;return Z},DF=V90;function L90($,Z){if(!Z||Z[0]!=="lab")return;let J={mode:"lab"},[,H,B,Q,X]=Z;if(H.type===T0.Hue||B.type===T0.Hue||Q.type===T0.Hue)return;if(H.type!==T0.None)J.l=Math.min(Math.max(0,H.value),100);if(B.type!==T0.None)J.a=B.type===T0.Number?B.value:B.value*125/100;if(Q.type!==T0.None)J.b=Q.type===T0.Number?Q.value:Q.value*125/100;if(X.type!==T0.None)J.alpha=Math.min(1,Math.max(0,X.type===T0.Number?X.value:X.value/100));return J}var uy=L90;var M90={mode:"lab",toMode:{xyz50:nJ,rgb:AF},fromMode:{xyz50:sJ,rgb:DF},channels:["l","a","b","alpha"],ranges:{l:[0,100],a:[-125,125],b:[-125,125]},parse:[uy],serialize:($)=>`lab(${$.l!==void 0?$.l:"none"} ${$.a!==void 0?$.a:"none"} ${$.b!==void 0?$.b:"none"}${$.alpha<1?` / ${$.alpha}`:""})`,interpolate:{l:E0,a:E0,b:E0,alpha:{use:E0,fixup:h1}}},tJ=M90;var P90={...tJ,mode:"lab65",parse:["--lab-d65"],serialize:"--lab-d65",toMode:{xyz65:eY,rgb:G7},fromMode:{xyz65:$F,rgb:U7},ranges:{l:[0,100],a:[-125,125],b:[-125,125]}},py=P90;function _90($,Z){if(!Z||Z[0]!=="lch")return;let J={mode:"lch"},[,H,B,Q,X]=Z;if(H.type!==T0.None){if(H.type===T0.Hue)return;J.l=Math.min(Math.max(0,H.value),100)}if(B.type!==T0.None)J.c=Math.max(0,B.type===T0.Number?B.value:B.value*150/100);if(Q.type!==T0.None){if(Q.type===T0.Percentage)return;J.h=Q.value}if(X.type!==T0.None)J.alpha=Math.min(1,Math.max(0,X.type===T0.Number?X.value:X.value/100));return J}var cy=_90;var O90={mode:"lch",toMode:{lab:_8,rgb:($)=>AF(_8($))},fromMode:{rgb:($)=>P8(DF($)),lab:P8},channels:["l","c","h","alpha"],ranges:{l:[0,100],c:[0,150],h:[0,360]},parse:[cy],serialize:($)=>`lch(${$.l!==void 0?$.l:"none"} ${$.c!==void 0?$.c:"none"} ${$.h!==void 0?$.h:"none"}${$.alpha<1?` / ${$.alpha}`:""})`,interpolate:{h:{use:E0,fixup:f2},c:E0,l:E0,alpha:{use:E0,fixup:h1}},difference:{h:X7},average:{h:g2}},eJ=O90;var T90={...eJ,mode:"lch65",parse:["--lch-d65"],serialize:"--lch-d65",toMode:{lab65:($)=>_8($,"lab65"),rgb:($)=>G7(_8($,"lab65"))},fromMode:{rgb:($)=>P8(U7($),"lch65"),lab65:($)=>P8($,"lch65")},ranges:{l:[0,100],c:[0,150],h:[0,360]}},dy=T90;var j90=({l:$,u:Z,v:J,alpha:H})=>{if(Z===void 0)Z=0;if(J===void 0)J=0;let B=Math.sqrt(Z*Z+J*J),Q={mode:"lchuv",l:$,c:B};if(B)Q.h=O5(Math.atan2(J,Z)*180/Math.PI);if(H!==void 0)Q.alpha=H;return Q},FL=j90;var C90=({l:$,c:Z,h:J,alpha:H})=>{if(J===void 0)J=0;let B={mode:"luv",l:$,u:Z?Z*Math.cos(J/180*Math.PI):0,v:Z?Z*Math.sin(J/180*Math.PI):0};if(H!==void 0)B.alpha=H;return B},KL=C90;var ly=($,Z,J)=>4*$/($+15*Z+3*J),iy=($,Z,J)=>9*Z/($+15*Z+3*J),E90=ly(c5.X,c5.Y,c5.Z),b90=iy(c5.X,c5.Y,c5.Z),w90=($)=>$<=oJ?Y7*$:116*Math.cbrt($)-16,S90=({x:$,y:Z,z:J,alpha:H})=>{if($===void 0)$=0;if(Z===void 0)Z=0;if(J===void 0)J=0;let B=w90(Z/c5.Y),Q=ly($,Z,J),X=iy($,Z,J);if(!isFinite(Q)||!isFinite(X))B=Q=X=0;else Q=13*B*(Q-E90),X=13*B*(X-b90);let z={mode:"luv",l:B,u:Q,v:X};if(H!==void 0)z.alpha=H;return z},kQ=S90;var R90=($,Z,J)=>4*$/($+15*Z+3*J),I90=($,Z,J)=>9*Z/($+15*Z+3*J),k90=R90(c5.X,c5.Y,c5.Z),y90=I90(c5.X,c5.Y,c5.Z),x90=({l:$,u:Z,v:J,alpha:H})=>{if($===void 0)$=0;if($===0)return{mode:"xyz50",x:0,y:0,z:0};if(Z===void 0)Z=0;if(J===void 0)J=0;let B=Z/(13*$)+k90,Q=J/(13*$)+y90,X=c5.Y*($<=8?$/Y7:Math.pow(($+16)/116,3)),z=X*(9*B)/(4*Q),G=X*(12-3*B-20*Q)/(4*Q),U={mode:"xyz50",x:z,y:X,z:G};if(H!==void 0)U.alpha=H;return U},yQ=x90;var h90=($)=>FL(kQ(W3($))),v90=($)=>K3(yQ(KL($))),f90={mode:"lchuv",toMode:{luv:KL,rgb:v90},fromMode:{rgb:h90,luv:FL},channels:["l","c","h","alpha"],parse:["--lchuv"],serialize:"--lchuv",ranges:{l:[0,100],c:[0,176.956],h:[0,360]},interpolate:{h:{use:E0,fixup:f2},c:E0,l:E0,alpha:{use:E0,fixup:h1}},difference:{h:X7},average:{h:g2}},ry=f90;var g90={...c8,mode:"lrgb",toMode:{rgb:l8},fromMode:{rgb:d8},parse:["srgb-linear"],serialize:"srgb-linear"},ay=g90;var m90={mode:"luv",toMode:{xyz50:yQ,rgb:($)=>K3(yQ($))},fromMode:{xyz50:kQ,rgb:($)=>kQ(W3($))},channels:["l","u","v","alpha"],parse:["--luv"],serialize:"--luv",ranges:{l:[0,100],u:[-84.936,175.042],v:[-125.882,87.243]},interpolate:{l:E0,u:E0,v:E0,alpha:{use:E0,fixup:h1}}},oy=m90;var u90=({r:$,g:Z,b:J,alpha:H})=>{if($===void 0)$=0;if(Z===void 0)Z=0;if(J===void 0)J=0;let B=Math.cbrt(0.412221469470763*$+0.5363325372617348*Z+0.0514459932675022*J),Q=Math.cbrt(0.2119034958178252*$+0.6806995506452344*Z+0.1073969535369406*J),X=Math.cbrt(0.0883024591900564*$+0.2817188391361215*Z+0.6299787016738222*J),z={mode:"oklab",l:0.210454268309314*B+0.7936177747023054*Q-0.0040720430116193*X,a:1.9779985324311684*B-2.42859224204858*Q+0.450593709617411*X,b:0.0259040424655478*B+0.7827717124575296*Q-0.8086757549230774*X};if(H!==void 0)z.alpha=H;return z},VF=u90;var p90=($)=>{let Z=VF(d8($));if($.r===$.b&&$.b===$.g)Z.a=Z.b=0;return Z},F7=p90;var c90=({l:$,a:Z,b:J,alpha:H})=>{if($===void 0)$=0;if(Z===void 0)Z=0;if(J===void 0)J=0;let B=Math.pow($+0.3963377773761749*Z+0.2158037573099136*J,3),Q=Math.pow($-0.1055613458156586*Z-0.0638541728258133*J,3),X=Math.pow($-0.0894841775298119*Z-1.2914855480194092*J,3),z={mode:"lrgb",r:4.076741636075957*B-3.3077115392580616*Q+0.2309699031821044*X,g:-1.2684379732850317*B+2.6097573492876887*Q-0.3413193760026573*X,b:-0.0041960761386756*B-0.7034186179359362*Q+1.7076146940746117*X};if(H!==void 0)z.alpha=H;return z},N3=c90;var d90=($)=>l8(N3($)),K7=d90;function xQ($){return 0.5*(1.170873786407767*$-0.206+Math.sqrt((1.170873786407767*$-0.206)*(1.170873786407767*$-0.206)+0.14050485436893204*$))}function d$($){return($*$+0.206*$)/(1.170873786407767*($+0.03))}function l90($,Z){let J,H,B,Q,X,z,G,U;if(-1.88170328*$-0.80936493*Z>1)J=1.19086277,H=1.76576728,B=0.59662641,Q=0.75515197,X=0.56771245,z=4.0767416621,G=-3.3077115913,U=0.2309699292;else if(1.81444104*$-1.19445276*Z>1)J=0.73956515,H=-0.45954404,B=0.08285427,Q=0.1254107,X=0.14503204,z=-1.2684380046,G=2.6097574011,U=-0.3413193965;else J=1.35733652,H=-0.00915799,B=-1.1513021,Q=-0.50559606,X=0.00692167,z=-0.0041960863,G=-0.7034186147,U=1.707614701;let Y=J+H*$+B*Z+Q*$*$+X*$*Z,F=0.3963377774*$+0.2158037573*Z,K=-0.1055613458*$-0.0638541728*Z,W=-0.0894841775*$-1.291485548*Z;{let N=1+Y*F,q=1+Y*K,D=1+Y*W,A=N*N*N,V=q*q*q,L=D*D*D,O=3*F*N*N,M=3*K*q*q,_=3*W*D*D,w=6*F*F*N,C=6*K*K*q,E=6*W*W*D,T=z*A+G*V+U*L,k=z*O+G*M+U*_,S=z*w+G*C+U*E;Y=Y-T*k/(k*k-0.5*T*S)}return Y}function WL($,Z){let J=l90($,Z),H=N3({l:1,a:J*$,b:J*Z}),B=Math.cbrt(1/Math.max(H.r,H.g,H.b)),Q=B*J;return[B,Q]}function i90($,Z,J,H,B,Q=null){if(!Q)Q=WL($,Z);let X;if((J-B)*Q[1]-(Q[0]-B)*H<=0)X=Q[1]*B/(H*Q[0]+Q[1]*(B-J));else{X=Q[1]*(B-1)/(H*(Q[0]-1)+Q[1]*(B-J));{let z=J-B,G=H,U=0.3963377774*$+0.2158037573*Z,Y=-0.1055613458*$-0.0638541728*Z,F=-0.0894841775*$-1.291485548*Z,K=z+G*U,W=z+G*Y,N=z+G*F;{let q=B*(1-X)+X*J,D=X*H,A=q+D*U,V=q+D*Y,L=q+D*F,O=A*A*A,M=V*V*V,_=L*L*L,w=3*K*A*A,C=3*W*V*V,E=3*N*L*L,T=6*K*K*A,k=6*W*W*V,S=6*N*N*L,I=4.0767416621*O-3.3077115913*M+0.2309699292*_-1,j=4.0767416621*w-3.3077115913*C+0.2309699292*E,y=4.0767416621*T-3.3077115913*k+0.2309699292*S,R=j/(j*j-0.5*I*y),x=-I*R,v=-1.2684380046*O+2.6097574011*M-0.3413193965*_-1,f=-1.2684380046*w+2.6097574011*C-0.3413193965*E,b=-1.2684380046*T+2.6097574011*k-0.3413193965*S,l=f/(f*f-0.5*v*b),r=-v*l,h=-0.0041960863*O-0.7034186147*M+1.707614701*_-1,d=-0.0041960863*w-0.7034186147*C+1.707614701*E,o=-0.0041960863*T-0.7034186147*k+1.707614701*S,c=d/(d*d-0.5*h*o),i=-h*c;x=R>=0?x:1e6,r=l>=0?r:1e6,i=c>=0?i:1e6,X+=Math.min(x,Math.min(r,i))}}}return X}function hQ($,Z,J=null){if(!J)J=WL($,Z);let H=J[0],B=J[1];return[B/H,B/(1-H)]}function LF($,Z,J){let H=WL(Z,J),B=i90(Z,J,$,1,$,H),Q=hQ(Z,J,H),X=0.11516993+1/(7.4477897+4.1590124*J+Z*(-2.19557347+1.75198401*J+Z*(-2.13704948-10.02301043*J+Z*(-4.24894561+5.38770819*J+4.69891013*Z)))),z=0.11239642+1/(1.6132032-0.68124379*J+Z*(0.40370612+0.90148123*J+Z*(-0.27087943+0.6122399*J+Z*(0.00299215-0.45399568*J-0.14661872*Z)))),G=B/Math.min($*Q[0],(1-$)*Q[1]),U=$*X,Y=(1-$)*z,F=0.9*G*Math.sqrt(Math.sqrt(1/(1/(U*U*U*U)+1/(Y*Y*Y*Y))));return U=$*0.4,Y=(1-$)*0.8,[Math.sqrt(1/(1/(U*U)+1/(Y*Y))),F,B]}function MF($){let Z=$.l!==void 0?$.l:0,J=$.a!==void 0?$.a:0,H=$.b!==void 0?$.b:0,B={mode:"okhsl",l:xQ(Z)};if($.alpha!==void 0)B.alpha=$.alpha;let Q=Math.sqrt(J*J+H*H);if(!Q)return B.s=0,B;let[X,z,G]=LF(Z,J/Q,H/Q),U;if(Q<z){let Y=0,F=0.8*X,K=1-F/z;U=(Q-Y)/(F+K*(Q-Y))*0.8}else{let Y=z,F=0.2*z*z*1.25*1.25/X,K=1-F/(G-z);U=0.8+0.2*((Q-Y)/(F+K*(Q-Y)))}if(U)B.s=U,B.h=O5(Math.atan2(H,J)*180/Math.PI);return B}function PF($){let Z=$.h!==void 0?$.h:0,J=$.s!==void 0?$.s:0,H=$.l!==void 0?$.l:0,B={mode:"oklab",l:d$(H)};if($.alpha!==void 0)B.alpha=$.alpha;if(!J||H===1)return B.a=B.b=0,B;let Q=Math.cos(Z/180*Math.PI),X=Math.sin(Z/180*Math.PI),[z,G,U]=LF(B.l,Q,X),Y,F,K,W;if(J<0.8)Y=1.25*J,F=0,K=0.8*z,W=1-K/G;else Y=5*(J-0.8),F=G,K=0.2*G*G*1.25*1.25/z,W=1-K/(U-G);let N=F+Y*K/(1-W*Y);return B.a=N*Q,B.b=N*X,B}var r90={...HF,mode:"okhsl",channels:["h","s","l","alpha"],parse:["--okhsl"],serialize:"--okhsl",fromMode:{oklab:MF,rgb:($)=>MF(F7($))},toMode:{oklab:PF,rgb:($)=>K7(PF($))}},ny=r90;function _F($){let Z=$.l!==void 0?$.l:0,J=$.a!==void 0?$.a:0,H=$.b!==void 0?$.b:0,B=Math.sqrt(J*J+H*H),Q=B?J/B:1,X=B?H/B:1,[z,G]=hQ(Q,X),U=0.5,Y=1-U/z,F=G/(B+Z*G),K=F*Z,W=F*B,N=d$(K),q=W*N/K,D=N3({l:N,a:Q*q,b:X*q}),A=Math.cbrt(1/Math.max(D.r,D.g,D.b,0));Z=Z/A,B=B/A*xQ(Z)/Z,Z=xQ(Z);let V={mode:"okhsv",s:B?(U+G)*W/(G*U+G*Y*W):0,v:Z?Z/K:0};if(V.s)V.h=O5(Math.atan2(H,J)*180/Math.PI);if($.alpha!==void 0)V.alpha=$.alpha;return V}function OF($){let Z={mode:"oklab"};if($.alpha!==void 0)Z.alpha=$.alpha;let J=$.h!==void 0?$.h:0,H=$.s!==void 0?$.s:0,B=$.v!==void 0?$.v:0,Q=Math.cos(J/180*Math.PI),X=Math.sin(J/180*Math.PI),[z,G]=hQ(Q,X),U=0.5,Y=1-U/z,F=1-H*U/(U+G-G*Y*H),K=H*G*U/(U+G-G*Y*H),W=d$(F),N=K*W/F,q=N3({l:W,a:Q*N,b:X*N}),D=Math.cbrt(1/Math.max(q.r,q.g,q.b,0)),A=d$(B*F),V=K*A/F;return Z.l=A*D,Z.a=V*Q*D,Z.b=V*X*D,Z}var a90={...BF,mode:"okhsv",channels:["h","s","v","alpha"],parse:["--okhsv"],serialize:"--okhsv",fromMode:{oklab:_F,rgb:($)=>_F(F7($))},toMode:{oklab:OF,rgb:($)=>K7(OF($))}},sy=a90;function o90($,Z){if(!Z||Z[0]!=="oklab")return;let J={mode:"oklab"},[,H,B,Q,X]=Z;if(H.type===T0.Hue||B.type===T0.Hue||Q.type===T0.Hue)return;if(H.type!==T0.None)J.l=Math.min(Math.max(0,H.type===T0.Number?H.value:H.value/100),1);if(B.type!==T0.None)J.a=B.type===T0.Number?B.value:B.value*0.4/100;if(Q.type!==T0.None)J.b=Q.type===T0.Number?Q.value:Q.value*0.4/100;if(X.type!==T0.None)J.alpha=Math.min(1,Math.max(0,X.type===T0.Number?X.value:X.value/100));return J}var ty=o90;var n90={...tJ,mode:"oklab",toMode:{lrgb:N3,rgb:K7},fromMode:{lrgb:VF,rgb:F7},ranges:{l:[0,1],a:[-0.4,0.4],b:[-0.4,0.4]},parse:[ty],serialize:($)=>`oklab(${$.l!==void 0?$.l:"none"} ${$.a!==void 0?$.a:"none"} ${$.b!==void 0?$.b:"none"}${$.alpha<1?` / ${$.alpha}`:""})`},ey=n90;function s90($,Z){if(!Z||Z[0]!=="oklch")return;let J={mode:"oklch"},[,H,B,Q,X]=Z;if(H.type!==T0.None){if(H.type===T0.Hue)return;J.l=Math.min(Math.max(0,H.type===T0.Number?H.value:H.value/100),1)}if(B.type!==T0.None)J.c=Math.max(0,B.type===T0.Number?B.value:B.value*0.4/100);if(Q.type!==T0.None){if(Q.type===T0.Percentage)return;J.h=Q.value}if(X.type!==T0.None)J.alpha=Math.min(1,Math.max(0,X.type===T0.Number?X.value:X.value/100));return J}var $x=s90;var t90={...eJ,mode:"oklch",toMode:{oklab:($)=>_8($,"oklab"),rgb:($)=>K7(_8($,"oklab"))},fromMode:{rgb:($)=>P8(F7($),"oklch"),oklab:($)=>P8($,"oklch")},parse:[$x],serialize:($)=>`oklch(${$.l!==void 0?$.l:"none"} ${$.c!==void 0?$.c:"none"} ${$.h!==void 0?$.h:"none"}${$.alpha<1?` / ${$.alpha}`:""})`,ranges:{l:[0,1],c:[0,0.4],h:[0,360]}},Zx=t90;var e90=($)=>{let{r:Z,g:J,b:H,alpha:B}=d8($),Q={mode:"xyz65",x:0.486570948648216*Z+0.265667693169093*J+0.1982172852343625*H,y:0.2289745640697487*Z+0.6917385218365062*J+0.079286914093745*H,z:0*Z+0.0451133818589026*J+1.043944368900976*H};if(B!==void 0)Q.alpha=B;return Q},NL=e90;var $30=({x:$,y:Z,z:J,alpha:H})=>{if($===void 0)$=0;if(Z===void 0)Z=0;if(J===void 0)J=0;let B=l8({r:$*2.4934969119414263-Z*0.9313836179191242-0.402710784450717*J,g:$*-0.8294889695615749+Z*1.7626640603183465+0.0236246858419436*J,b:$*0.0358458302437845-Z*0.0761723892680418+0.9568845240076871*J},"p3");if(H!==void 0)B.alpha=H;return B},qL=$30;var Z30={...c8,mode:"p3",parse:["display-p3"],serialize:"display-p3",fromMode:{rgb:($)=>qL(J8($)),xyz65:qL},toMode:{rgb:($)=>H8(NL($)),xyz65:NL}},Jx=Z30;var AL=($)=>{let Z=Math.abs($);if(Z>=0.001953125)return Math.sign($)*Math.pow(Z,0.5555555555555556);return 16*$},J30=({x:$,y:Z,z:J,alpha:H})=>{if($===void 0)$=0;if(Z===void 0)Z=0;if(J===void 0)J=0;let B={mode:"prophoto",r:AL($*1.3457868816471585-Z*0.2555720873797946-0.0511018649755453*J),g:AL($*-0.5446307051249019+Z*1.5082477428451466+0.0205274474364214*J),b:AL($*0+Z*0+1.2119675456389452*J)};if(H!==void 0)B.alpha=H;return B},DL=J30;var VL=($=0)=>{let Z=Math.abs($);if(Z>=0.03125)return Math.sign($)*Math.pow(Z,1.8);return $/16},H30=($)=>{let Z=VL($.r),J=VL($.g),H=VL($.b),B={mode:"xyz50",x:0.7977666449006423*Z+0.1351812974005331*J+0.0313477341283922*H,y:0.2880748288194013*Z+0.7118352342418731*J+0.0000899369387256*H,z:0*Z+0*J+0.8251046025104602*H};if($.alpha!==void 0)B.alpha=$.alpha;return B},LL=H30;var B30={...c8,mode:"prophoto",parse:["prophoto-rgb"],serialize:"prophoto-rgb",fromMode:{xyz50:DL,rgb:($)=>DL(W3($))},toMode:{xyz50:LL,rgb:($)=>K3(LL($))}},Hx=B30;var ML=($)=>{let Z=Math.abs($);if(Z>0.018053968510807)return(Math.sign($)||1)*(1.09929682680944*Math.pow(Z,0.45)-0.09929682680944008);return 4.5*$},Q30=({x:$,y:Z,z:J,alpha:H})=>{if($===void 0)$=0;if(Z===void 0)Z=0;if(J===void 0)J=0;let B={mode:"rec2020",r:ML($*1.7166511879712683-Z*0.3556707837763925-0.2533662813736599*J),g:ML($*-0.6666843518324893+Z*1.6164812366349395+0.0157685458139111*J),b:ML($*0.0176398574453108-Z*0.0427706132578085+0.9421031212354739*J)};if(H!==void 0)B.alpha=H;return B},PL=Q30;var _L=($=0)=>{let Z=Math.abs($);if(Z<0.08124285829863151)return $/4.5;return(Math.sign($)||1)*Math.pow((Z+1.09929682680944-1)/1.09929682680944,2.2222222222222223)},X30=($)=>{let Z=_L($.r),J=_L($.g),H=_L($.b),B={mode:"xyz65",x:0.6369580483012911*Z+0.1446169035862083*J+0.1688809751641721*H,y:0.262700212011267*Z+0.6779980715188708*J+0.059301716469862*H,z:0*Z+0.0280726930490874*J+1.0609850577107909*H};if($.alpha!==void 0)B.alpha=$.alpha;return B},OL=X30;var z30={...c8,mode:"rec2020",fromMode:{xyz65:PL,rgb:($)=>PL(J8($))},toMode:{xyz65:OL,rgb:($)=>H8(OL($))},parse:["rec2020"],serialize:"rec2020"},Bx=z30;var W7=0.0037930732552754493,TF=Math.cbrt(0.0037930732552754493);var TL=($)=>Math.cbrt($)-TF,G30=($)=>{let{r:Z,g:J,b:H,alpha:B}=d8($),Q=TL(0.3*Z+0.622*J+0.078*H+W7),X=TL(0.23*Z+0.692*J+0.078*H+W7),z=TL(0.2434226892454782*Z+0.2047674442449682*J+0.5518098665095535*H+W7),G={mode:"xyb",x:(Q-X)/2,y:(Q+X)/2,b:z-(Q+X)/2};if(B!==void 0)G.alpha=B;return G},Qx=G30;var jL=($)=>Math.pow($+TF,3),U30=({x:$,y:Z,b:J,alpha:H})=>{if($===void 0)$=0;if(Z===void 0)Z=0;if(J===void 0)J=0;let B=jL($+Z)-W7,Q=jL(Z-$)-W7,X=jL(J+Z)-W7,z=l8({r:11.031566904639861*B-9.866943908131562*Q-0.16462299650829934*X,g:-3.2541473810744237*B+4.418770377582723*Q-0.16462299650829934*X,b:-3.6588512867136815*B+2.7129230459360922*Q+1.9459282407775895*X});if(H!==void 0)z.alpha=H;return z},Xx=U30;var Y30={mode:"xyb",channels:["x","y","b","alpha"],parse:["--xyb"],serialize:"--xyb",toMode:{rgb:Xx},fromMode:{rgb:Qx},ranges:{x:[-0.0154,0.0281],y:[0,0.8453],b:[-0.2778,0.388]},interpolate:{x:E0,y:E0,b:E0,alpha:{use:E0,fixup:h1}}},zx=Y30;var F30={mode:"xyz50",parse:["xyz-d50"],serialize:"xyz-d50",toMode:{rgb:K3,lab:sJ},fromMode:{rgb:W3,lab:nJ},channels:["x","y","z","alpha"],ranges:{x:[0,0.964],y:[0,0.999],z:[0,0.825]},interpolate:{x:E0,y:E0,z:E0,alpha:{use:E0,fixup:h1}}},Gx=F30;var K30=($)=>{let{x:Z,y:J,z:H,alpha:B}=$;if(Z===void 0)Z=0;if(J===void 0)J=0;if(H===void 0)H=0;let Q={mode:"xyz50",x:1.0479298208405488*Z+0.0229467933410191*J-0.0501922295431356*H,y:0.0296278156881593*Z+0.990434484573249*J-0.0170738250293851*H,z:-0.0092430581525912*Z+0.0150551448965779*J+0.7518742899580008*H};if(B!==void 0)Q.alpha=B;return Q},Ux=K30;var W30=($)=>{let{x:Z,y:J,z:H,alpha:B}=$;if(Z===void 0)Z=0;if(J===void 0)J=0;if(H===void 0)H=0;let Q={mode:"xyz65",x:0.9554734527042182*Z-0.0230985368742614*J+0.0632593086610217*H,y:-0.0283697069632081*Z+1.0099954580058226*J+0.021041398966943*H,z:0.0123140016883199*Z-0.0205076964334779*J+1.3303659366080753*H};if(B!==void 0)Q.alpha=B;return Q},Yx=W30;var N30={mode:"xyz65",toMode:{rgb:H8,xyz50:Ux},fromMode:{rgb:J8,xyz50:Yx},ranges:{x:[0,0.95],y:[0,1],z:[0,1.088]},channels:["x","y","z","alpha"],parse:["xyz","xyz-d65"],serialize:"xyz-d65",interpolate:{x:E0,y:E0,z:E0,alpha:{use:E0,fixup:h1}}},Fx=N30;var q30=({r:$,g:Z,b:J,alpha:H})=>{if($===void 0)$=0;if(Z===void 0)Z=0;if(J===void 0)J=0;let B={mode:"yiq",y:0.29889531*$+0.58662247*Z+0.11448223*J,i:0.59597799*$-0.2741761*Z-0.32180189*J,q:0.21147017*$-0.52261711*Z+0.31114694*J};if(H!==void 0)B.alpha=H;return B},Kx=q30;var A30=({y:$,i:Z,q:J,alpha:H})=>{if($===void 0)$=0;if(Z===void 0)Z=0;if(J===void 0)J=0;let B={mode:"rgb",r:$+0.95608445*Z+0.6208885*J,g:$-0.27137664*Z-0.6486059*J,b:$-1.10561724*Z+1.70250126*J};if(H!==void 0)B.alpha=H;return B},Wx=A30;var D30={mode:"yiq",toMode:{rgb:Wx},fromMode:{rgb:Kx},channels:["y","i","q","alpha"],parse:["--yiq"],serialize:"--yiq",ranges:{i:[-0.595,0.595],q:[-0.522,0.522]},interpolate:{y:E0,i:E0,q:E0,alpha:{use:E0,fixup:h1}}},Nx=D30;function CL($){let Z=rY("lrgb")($);return 0.2126*Z.r+0.7152*Z.g+0.0722*Z.b}var fn0=F5(Dy),gn0=F5(Cy),mn0=F5(wy),un0=F5(Sy),pn0=F5(Ry),cn0=F5(HF),dn0=F5(BF),ln0=F5(hy),in0=F5(vy),rn0=F5(gy),an0=F5(my),on0=F5(tJ),nn0=F5(py),sn0=F5(eJ),tn0=F5(dy),en0=F5(ry),$s0=F5(ay),Zs0=F5(oy),Js0=F5(ny),Hs0=F5(sy),Bs0=F5(ey),Qs0=F5(Zx),Xs0=F5(Jx),zs0=F5(Hx),Gs0=F5(Bx),Us0=F5(c8),Ys0=F5(zx),Fs0=F5(Gx),Ks0=F5(Fx),Ws0=F5(Nx);var N7={sans:{label:"Sans",sans:"system-ui",mono:"Geist Mono",googleFontsQuery:"Geist+Mono:wght@400;500"},serif:{label:"Serif",sans:"Literata",mono:"Geist Mono",googleFontsQuery:"Literata:wght@400;600;700&family=Geist+Mono:wght@400;500"},mono:{label:"Mono",sans:"Geist Mono",mono:"Geist Mono",googleFontsQuery:"Geist+Mono:wght@400;500;600"},geometric:{label:"Geometric",sans:"Manrope",mono:"Geist Mono",googleFontsQuery:"Manrope:wght@400;500;600&family=Geist+Mono:wght@400;500"},rounded:{label:"Rounded",sans:"SN Pro",mono:"Geist Mono",googleFontsQuery:"SN+Pro:wght@400;500;600&family=Geist+Mono:wght@400;500"},blobby:{label:"Blobby",sans:"Sour Gummy",mono:"Azeret Mono",googleFontsQuery:"Sour+Gummy:wght@400;500;600&family=Azeret+Mono:wght@400;500"},awkward:{label:"Awkward",sans:"Averia Sans Libre",mono:"Azeret Mono",googleFontsQuery:"Averia+Sans+Libre:wght@400;500;600&family=Azeret+Mono:wght@400;500"},comic:{label:"Comic",sans:"Comic Sans MS, Comic Sans, cursive",mono:"Geist Mono",googleFontsQuery:"Geist+Mono:wght@400;500"}},vQ={squishy:{label:"Squishy",radius:"0.875rem"},soft:{label:"Soft",radius:"0.625rem"},subtle:{label:"Subtle",radius:"0.375rem"},square:{label:"Square",radius:"0"}},fQ={blob:{label:"Blob",traits:{shape:0.11,"body.r":0.5,"body.ratio":0,"body.n":0.5}},boxy:{label:"Boxy",traits:{shape:0.54,"body.r":1,"body.ratio":0}},pill:{label:"Pill",traits:{shape:0.65,"body.r":1}},dorito:{label:"Dorito",traits:{shape:0.99,"body.r":1,"body.ratio":0,"body.rot":0}}},EL="oklch(0.205 0 0)";function qx($){return CL($)>0.3?"oklch(0 0 0)":"oklch(1 0 0)"}var Ax={workspace:{primary:($)=>$,primaryForeground:($)=>qx($),background:()=>"color-mix(in srgb, var(--primary) 2%, oklch(1 0 0) 98%)",foreground:()=>"color-mix(in srgb, var(--primary) 20%, oklch(0 0 0) 80%)",muted:()=>"color-mix(in srgb, var(--background) 95%, var(--foreground) 5%)",mutedForeground:()=>"color-mix(in srgb, var(--background) 50%, var(--foreground) 50%)",accent:()=>"color-mix(in srgb, var(--primary) 3%, var(--foreground) 4%)",accentForeground:()=>"var(--foreground)",border:()=>"color-mix(in srgb, var(--foreground) 7%, transparent)",ring:()=>"color-mix(in srgb, var(--background) 50%, var(--primary) 50%)"},widget:{background:($)=>$,foreground:($)=>qx($),primary:()=>"color-mix(in srgb, var(--background) 2%, oklch(1 0 0) 98%)",primaryForeground:()=>"color-mix(in srgb, var(--background) 20%, oklch(0 0 0) 80%)",muted:()=>"color-mix(in srgb, var(--background) 95%, var(--foreground) 5%)",mutedForeground:()=>"color-mix(in srgb, var(--background) 50%, var(--foreground) 50%)",accent:()=>"color-mix(in srgb, var(--primary) 3%, var(--foreground) 4%)",accentForeground:()=>"var(--foreground)",border:()=>"color-mix(in srgb, var(--foreground) 15%, transparent)",ring:()=>"color-mix(in srgb, var(--background) 50%, var(--primary) 50%)"}},bL=Object.keys(Ax.workspace);function wL($,Z="workspace"){let J={},H=Ax[Z];for(let B of bL)J[B]=H[B]($);return J}var CF={default:{label:"Default"},paper:{label:"Paper",primary:"oklch(0.4328 0.0351 66.67)"},rose:{label:"Rose",primary:"oklch(0.6322 0.2171 26.02)"},tangerine:{label:"Tangerine",primary:"oklch(0.6886 0.22 37.15)"},sand:{label:"Sand",primary:"oklch(0.8334 0.1271 67.80)"},mint:{label:"Tropics",primary:"oklch(0.5774 0.1399 156.06)"},sky:{label:"Sky",primary:"oklch(0.5824 0.1830 253.59)"},lavender:{label:"Lavender",primary:"oklch(0.6025 0.2426 294.58)"}},q3={font:"sans",color:"default",radius:"soft",agent:"boxy"};function jF($,Z,J){return typeof $==="string"&&Object.hasOwn(Z,$)?$:J}function _9($){return{font:jF($?.font,N7,q3.font),color:jF($?.color,CF,q3.color),radius:jF($?.radius,vQ,q3.radius),agent:jF($?.agent,fQ,q3.agent)}}function EF($,Z="workspace"){let J=_9($),B=CF[J.color].primary??(Z==="widget"?EL:void 0);return B?wL(B,Z):void 0}var gQ=P(u(),1),A3={"claude-code":hY,openclaw:sI,codex:vY,hermes:nI};function V30($,Z,J){switch($?.type){case"emoji":return gQ.jsx("span",{"aria-hidden":"true",className:Q0("flex size-full translate-y-[2cqi] items-center justify-center font-[Apple_Color_Emoji,Segoe_UI_Emoji,Noto_Color_Emoji,sans-serif] leading-none",Z?"text-[60cqi]":"text-[85cqi]"),children:$.value});case"upload":return gQ.jsx("img",{src:$.value,alt:"",className:"size-full"});case"glyph":{let H=dY($.value);if(H)return Dx.createElement(H,{"aria-hidden":!0,stroke:1.75,className:Z?"size-[70%]":"size-[95%] text-foreground"})}default:return gQ.jsx("img",{src:J,alt:"",className:"size-[95%]"})}}function q7({className:$,icon:Z,workspaceType:J,workspaceTheme:H}){let B=Z?.type!=="upload"&&Z?.background==="theme",Q=B?EF(H)??wL(EL):void 0,X=A3[J??"claude-code"];return gQ.jsx("span",{className:Q0("@container inline-flex shrink-0 items-center justify-center overflow-hidden",B&&"shadow-[inset_0_0_1rem_rgba(255,255,255,0.3)]",$),style:Q?{backgroundColor:Q.primary,color:Q.primaryForeground}:void 0,children:V30(Z,B,X)})}var Vx=P(m(),1);var Lx=P(u(),1);function bF({className:$,onBlur:Z,onFocus:J,onKeyDown:H,onValueChange:B,onValueCommit:Q,selectOnFocus:X,...z}){let G=Vx.useRef(null);function U(K){let W=G.current!==null;if(G.current=null,Z?.(K),!K.defaultPrevented&&W)Q?.(K.currentTarget.value)}function Y(K){if(G.current=K.currentTarget.value,X){let W=K.currentTarget;W.select(),requestAnimationFrame(()=>{W.scrollLeft=0})}J?.(K)}function F(K){if(H?.(K),K.defaultPrevented)return;if(K.key==="Enter")K.preventDefault(),K.currentTarget.blur();else if(K.key==="Escape"){K.preventDefault();let W=G.current??K.currentTarget.value;G.current=null,K.currentTarget.value=W,B?.(W),K.currentTarget.blur()}}return Lx.jsx(OQ,{"data-slot":"inline-input",className:Q0("-ml-2 [field-sizing:content] w-auto max-w-full min-w-0 rounded-md bg-transparent px-2 py-0.5 text-sm shadow-none outline-none focus:[field-sizing:fixed] focus:w-full focus-visible:border-ring focus-visible:bg-accent disabled:pointer-events-none",$),onBlur:U,onChange:(K)=>B?.(K.target.value),onFocus:Y,onKeyDown:F,...z})}var mQ=P(u(),1);function wF({name:$="Workspace",onNameChange:Z,onNameCommit:J,renderIcon:H,...B}){let Q=mQ.jsx(q7,{...B,className:"size-10 rounded-lg"});return mQ.jsxs("div",{className:"flex max-w-full min-w-0 flex-1 items-center gap-4",children:[H?H(Q):Q,mQ.jsx(bF,{"aria-label":"Workspace name",value:$,onValueChange:Z,onValueCommit:J,readOnly:!Z,tabIndex:Z?void 0:-1,className:Q0("min-w-0 truncate text-3xl font-semibold md:text-3xl",!Z&&"pointer-events-none")})]})}var $H=P(u(),1),Mx=["Welcome to","This is","Make yourself at home in","A fresh start in","Good to see you in"],SF;function Px($){SF=$}function _x($){let[Z,J]=A7.useState(()=>SF===$);return A7.useEffect(()=>{if(SF===$)SF=void 0;if(!Z)return;let H=setTimeout(()=>J(!1),3000);return()=>clearTimeout(H)},[$,Z]),Z}function Ox({name:$="Workspace",icon:Z,...J}){let[H]=A7.useState(()=>Mx[Math.floor(Math.random()*Mx.length)]),[B]=A7.useState(()=>{let z=[...TQ];return Array.from({length:4},()=>z.splice(Math.floor(Math.random()*z.length),1)[0])}),[Q,X]=A7.useState(()=>typeof window<"u"&&window.matchMedia?.("(prefers-reduced-motion: reduce)").matches?4:0);return A7.useEffect(()=>{if(window.matchMedia?.("(prefers-reduced-motion: reduce)").matches)return;let z=[500,1000,1500,2000].map((G,U)=>setTimeout(()=>X(U+1),G));return()=>z.forEach(clearTimeout)},[]),$H.jsx("div",{"aria-label":"Workspace welcome",className:"flex flex-1 items-center justify-center p-6 text-center",children:$H.jsxs("div",{className:"flex min-w-0 flex-col items-center gap-1",children:[$H.jsx("p",{className:"text-sm text-muted-foreground",children:H}),$H.jsx(wF,{...J,name:$,icon:Q<4?{type:"glyph",value:B[Q]}:Z})]})})}var Sx=P(m(),1);var Tx=P(u(),1);function V4({className:$,...Z}){return Tx.jsx("div",{"data-slot":"skeleton",className:d0("animate-pulse rounded-lg bg-accent",$),...Z})}var SL=P(u(),1),l$={"claude-code":"Claude",openclaw:"OpenClaw",codex:"ChatGPT",hermes:"Hermes"},jx={"claude-code":"Anthropic",codex:"OpenAI",openclaw:"Open-source",hermes:"Nous Research"};function Cx({types:$}){let Z=$.map((J)=>l$[J]).join(", ");return SL.jsx("span",{role:"img","aria-label":Z,className:"inline-flex shrink-0 items-center -space-x-0.5",children:$.map((J)=>SL.jsx("img",{src:A3[J],alt:"",className:"size-4 shrink-0 rounded-full bg-muted ring-2 ring-muted"},J))})}function i$($){if("types"in $)return $.path.split("/").pop()||$.path;if($.name)return $.name;if($.type==="openclaw")return $.agentId??"OpenClaw agent";if($.type==="hermes")return $.agentId??"Hermes agent";return $.path.split("/").pop()||$.path}var Ex={"claude-code":{reason:"Run in terminal to install Claude:",command:"curl -fsSL https://claude.ai/install.sh | sh"},codex:{reason:"Run in terminal to install ChatGPT:",command:"curl -fsSL https://chatgpt.com/codex/install.sh | sh"},openclaw:{reason:"Run in terminal to connect OpenClaw:",command:"moi openclaw init"},hermes:{reason:"Run in terminal to connect Hermes:",command:"moi hermes init"}};var bx={"claude-code":{importOnly:!1},codex:{importOnly:!1},openclaw:{importOnly:!0},hermes:{importOnly:!0}};function RF($,Z=[]){if(!$)return[];return cJ.filter((J)=>$[J]||!bx[J].importOnly).map((J)=>{let H=bx[J],B=Ex[J],Q=!$[J]||H.importOnly&&!Z.includes(J);return{type:J,description:jx[J],disabled:Q,disabledReason:Q?B.reason:void 0,disabledCommand:Q?B.command:void 0}})}function wx($,Z){let J=$.find((H)=>H.type===Z);if(J&&!J.disabled)return J.type;return $.find((H)=>!H.disabled)?.type}var o1=P(u(),1),L30="Choose which agent Moi will use to build your workspace";function kF({title:$,selectedType:Z,options:J,isLoading:H=!1,isPending:B,errorMessage:Q,emptyMessage:X,secondaryAction:z,primaryLabel:G,pendingLabel:U,onTypeChange:Y,onSubmit:F}){let K=C1((D)=>D.hasSentMessageFromMoi),W=wx(J,Z),N=W!==Z,q=W==="claude-code"?"Tip: you can use your existing Claude subscription in Moi":W==="codex"?"Tip: you can use your existing ChatGPT subscription in Moi":void 0;return Sx.useEffect(()=>{if(!B&&W&&N)Y(W)},[B,Y,W,N]),o1.jsxs("div",{className:"flex min-w-[min(22rem,calc(100vw-5rem))] flex-col gap-5",children:[o1.jsxs("div",{className:"flex w-0 min-w-full flex-col gap-0.5 pr-8",children:[o1.jsx($7,{children:$}),o1.jsx(uJ,{children:L30})]}),o1.jsxs("div",{className:"flex flex-col gap-4",children:[H?o1.jsxs("div",{className:"flex flex-wrap justify-center gap-2",role:"status","aria-label":"Checking installed agents",children:[o1.jsx(V4,{className:"h-32 min-w-32 flex-1"}),o1.jsx(V4,{className:"h-32 min-w-32 flex-1"})]}):o1.jsx(M30,{disabled:B,options:J,selectedType:N?void 0:Z,onTypeChange:Y}),!K&&q&&o1.jsx("p",{className:"w-0 min-w-full text-sm text-muted-foreground",children:q})]}),Q&&o1.jsx("p",{role:"alert",className:"w-0 min-w-full text-xs text-destructive",children:Q}),X&&!W&&!B&&!Q&&o1.jsx("p",{className:"w-0 min-w-full text-sm text-muted-foreground",children:X}),o1.jsxs("div",{className:"flex items-center justify-end gap-2",children:[z,o1.jsx(L0,{onClick:F,disabled:B||N,children:B&&U?U:G})]})]})}function M30({disabled:$,options:Z,selectedType:J,onTypeChange:H}){return o1.jsx("fieldset",{disabled:$,"aria-label":"Agent",className:"flex min-w-0 flex-wrap justify-center gap-2",children:Z.map((B)=>o1.jsx(P30,{option:B,selected:J===B.type,onSelect:H},B.type))})}function P30({option:$,selected:Z,onSelect:J}){let H=Boolean($.disabledReason),B=o1.jsxs("button",{type:"button",disabled:$.disabled&&!H,"aria-disabled":$.disabled||void 0,"aria-pressed":Z,onClick:(Q)=>{if($.disabled){Q.preventDefault();return}J($.type)},className:Q0("relative flex h-32 min-w-32 flex-1 flex-col items-start justify-between gap-6 rounded-xl bg-card p-4 text-left ring-1 ring-border transition-opacity outline-none focus-visible:ring-3 focus-visible:ring-ring/50",!Z&&"opacity-70",!Z&&!$.disabled&&"cursor-pointer hover:opacity-100",$.disabled&&"cursor-not-allowed"),children:[o1.jsxs("span",{className:"relative inline-flex",children:[o1.jsx(_30,{type:$.type}),Z&&o1.jsx(IF,{size:16,stroke:1.75,"aria-hidden":"true",className:"absolute -top-1.5 -right-1.5"})]}),o1.jsxs("span",{className:"flex min-w-0 flex-col gap-0.5",children:[o1.jsx("span",{className:"text-sm font-medium text-foreground",children:l$[$.type]}),o1.jsx("span",{className:"text-xs leading-4 text-muted-foreground",children:$.description})]})]});if(!H)return B;return o1.jsxs(t1,{children:[o1.jsx(e1,{render:B}),o1.jsx($5,{className:"max-w-[calc(100vw-2rem)] leading-5 sm:max-w-96",children:o1.jsxs("span",{className:"text-center",children:[$.disabledReason,$.disabledCommand&&o1.jsxs(o1.Fragment,{children:[o1.jsx("br",{}),o1.jsx("code",{className:"rounded-xs bg-accent px-1 py-0.5 font-mono wrap-anywhere",children:$.disabledCommand})]})]})})]})}function _30({type:$}){return o1.jsx("img",{src:A3[$],alt:"",className:"size-8 shrink-0"})}var Rx=P(u(),1);function yF({children:$,showCloseButton:Z=!0}){return Rx.jsx(mJ,{showCloseButton:Z,className:"block max-h-[calc(100dvh-2rem)] w-max max-w-[calc(100vw-2rem)] overflow-y-auto p-6 sm:max-w-[calc(100vw-2rem)]",children:$})}var y5=P(u(),1),Ix=cJ[0];function pQ({trigger:$}){let[,Z]=a4(),J=N4(),H=GY(),B=JI(),[Q,X]=uQ.useState(!1),[z,G]=uQ.useState("name"),[U,Y]=uQ.useState(Ix),[F,K]=uQ.useState(""),W=F.trim(),N=W?dI(W):null,q=B.isPending,D=H.isPending||H.isFetching,A=H.isError?void 0:H.data?.installed,V=RF(A),L=V.some((T)=>T.type===U&&!T.disabled),O=!D&&!A?"Could not check installed agents.":void 0,M=!D&&!O&&L;if(J.demo)return y5.jsx(dJ,{trigger:$});function _(T){Px(T),X(!1),Z(`/workspace/${T}`)}function w(){G("name"),Y(Ix),K(""),B.reset()}function C(){if(!W||N)return;B.reset(),G("agent")}function E(){if(!W||N||q||!M)return;B.reset(),B.mutate({name:W,type:U},{onSuccess:(T)=>_(T.id)})}return y5.jsxs(e6,{open:Q,onOpenChange:(T)=>{if(!T&&q)return;if(X(T),T)H.refetch({cancelRefetch:!1})},onOpenChangeComplete:(T)=>{if(!T)w()},children:[y5.jsx($6,{render:$}),y5.jsx(yF,{showCloseButton:!q,children:z==="name"?y5.jsx(O30,{name:F,showExistingFolder:J.environment==="local",validationError:N,onNameChange:K,onSubmit:C}):y5.jsx(kF,{title:"Create new workspace",selectedType:U,options:V,isLoading:D&&!A,errorMessage:O??B.error?.message,emptyMessage:"Install at least one agent to create a new workspace",isPending:q||D||Boolean(O),secondaryAction:y5.jsx(L0,{variant:"secondary",disabled:q,onClick:()=>G("name"),children:"Back"}),primaryLabel:"Create workspace",pendingLabel:q?"Creating…":void 0,onTypeChange:Y,onSubmit:E})})]})}function O30({name:$,showExistingFolder:Z,validationError:J,onNameChange:H,onSubmit:B}){function Q(X){X.preventDefault(),B()}return y5.jsxs("form",{className:"flex min-w-[min(22rem,calc(100vw-5rem))] flex-col gap-5",onSubmit:Q,children:[y5.jsxs("div",{className:"flex flex-col gap-0.5 pr-8",children:[y5.jsx($7,{children:"Create new workspace"}),y5.jsx(uJ,{children:"Give it a short and recognizable name"})]}),y5.jsxs("div",{className:"flex flex-col gap-2",children:[y5.jsx("label",{htmlFor:"workspace-name",className:"sr-only",children:"Workspace name"}),y5.jsx(p8,{id:"workspace-name",value:$,onChange:(X)=>H(X.target.value),placeholder:"Workspace name",autoFocus:!0,"aria-invalid":Boolean(J),"aria-describedby":J?"workspace-name-error":void 0,autoComplete:"off",spellCheck:!1}),J&&y5.jsx("p",{id:"workspace-name-error",role:"alert",className:"text-xs text-destructive",children:J})]}),y5.jsxs("div",{className:"flex items-center justify-end gap-2",children:[Z&&y5.jsx(T30,{}),y5.jsx(L0,{type:"submit",disabled:!$.trim()||Boolean(J),children:"Continue"})]})]})}function T30(){return y5.jsxs(t1,{children:[y5.jsx(e1,{render:y5.jsx(L0,{variant:"secondary","aria-disabled":!0,onClick:(Z)=>Z.preventDefault(),className:"cursor-not-allowed bg-accent text-muted-foreground hover:bg-accent",children:"Use existing folder"})}),y5.jsx($5,{className:"max-w-64",children:y5.jsxs("span",{className:"text-center",children:["Not supported yet — run"," ",y5.jsx("code",{className:"rounded-xs bg-accent px-1 py-0.5 font-mono whitespace-nowrap",children:"moi init"})," ","in the folder from your console to add it"]})})]})}var f4={};k5(f4,{createHandle:()=>Sh,Viewport:()=>jh,Trigger:()=>Oh,SubmenuTrigger:()=>wh,SubmenuRoot:()=>Vh,Separator:()=>Eh,Root:()=>JK,RadioItemIndicator:()=>Kh,RadioItem:()=>Fh,RadioGroup:()=>Gh,Positioner:()=>Xh,Portal:()=>Hh,Popup:()=>$h,LinkItem:()=>tx,Item:()=>sx,Handle:()=>XK,GroupLabel:()=>ox,Group:()=>rx,CheckboxItemIndicator:()=>dx,CheckboxItem:()=>cx,Backdrop:()=>hx,Arrow:()=>yx});var kx=P(m(),1);var xF=P(m(),1),RL=xF.createContext(void 0);function L4($){let Z=xF.useContext(RL);if(Z===void 0&&!$)throw Error(I0(33));return Z}var hF=P(m(),1),IL=hF.createContext(void 0);function T5($){let Z=hF.useContext(IL);if(Z===void 0&&!$)throw Error(I0(36));return Z}var yx=kx.forwardRef(function(Z,J){let{render:H,className:B,style:Q,...X}=Z,{store:z}=T5(),{arrowRef:G,side:U,align:Y,arrowUncentered:F,arrowStyles:K}=L4(),N={open:z.useState("open"),side:U,align:Y,uncentered:F};return G0("div",Z,{ref:[G,J],stateAttributesMapping:N8,state:N,props:{style:K,"aria-hidden":!0,...X}})});var xx=P(m(),1);var vF=P(m(),1),j30=vF.createContext(void 0);function D7($=!0){let Z=vF.useContext(j30);if(Z===void 0&&!$)throw Error(I0(25));return Z}var hx=xx.forwardRef(function(Z,J){let{render:H,className:B,style:Q,...X}=Z,{store:z}=T5(),G=z.useState("open"),U=z.useState("mounted"),Y=z.useState("transitionStatus"),F=z.useState("lastOpenChangeReason"),K=D7(),W={open:G,transitionStatus:Y};return G0("div",Z,{ref:K?.backdropRef?[J,K.backdropRef]:J,state:W,stateAttributesMapping:X4,props:[{role:"presentation",hidden:!U,style:{pointerEvents:F===F0.triggerHover?"none":void 0,userSelect:"none",WebkitUserSelect:"none"}},X]})});var uF=P(m(),1);var fF=P(m(),1),kL=fF.createContext(void 0);function vx(){let $=fF.useContext(kL);if($===void 0)throw Error(I0(30));return $}var JH=P(m(),1);var fx=P(m(),1);function gF($){let{closeOnClick:Z,highlighted:J,id:H,nodeId:B,store:Q,typingRef:X,itemRef:z,itemMetadata:G}=$,{events:U}=Q.useState("floatingTreeRoot"),Y=Q.useState("open"),F=D7(!0),K=F!==void 0;return fx.useMemo(()=>({id:H,role:"menuitem",tabIndex:Y&&J?0:-1,onKeyDown(W){if(W.key===" "&&X?.current)W.preventDefault()},onMouseMove(W){if(!B)return;U.emit("itemhover",{nodeId:B,target:W.currentTarget})},onClick(W){if(Z)U.emit("close",{domEvent:W,reason:F0.itemPress})},onMouseUp(W){if(F){let N=F.initialCursorPointRef.current;if(F.initialCursorPointRef.current=null,K&&N&&Math.abs(W.clientX-N.x)<=1&&Math.abs(W.clientY-N.y)<=1)return;if(K&&!B5.os.mac&&W.button===2)return}if(z.current&&Q.context.allowMouseUpTriggerRef.current&&(!K||W.button===2)){if(G.type==="regular-item")ZH(z.current,W,{detail:1})}}}),[Z,J,H,U,B,Y,Q,X,z,F,K,G])}var V7={type:"regular-item"};function L7($){let{closeOnClick:Z,disabled:J,highlighted:H,id:B,store:Q,typingRef:X=Q.context.typingRef,nativeButton:z,itemMetadata:G,nodeId:U}=$,Y=JH.useRef(null),{getButtonProps:F,buttonRef:K}=w5({disabled:J,focusableWhenDisabled:!0,native:z,composite:!0}),W=gF({closeOnClick:Z,highlighted:H,id:B,nodeId:U,store:Q,typingRef:X,itemRef:Y,itemMetadata:G}),N=JH.useCallback((D)=>{return K2(W,{onMouseEnter(){if(G.type!=="submenu-trigger")return;G.setActive()}},D,F)},[W,F,G]),q=l2(Y,K);return JH.useMemo(()=>({getItemProps:N,itemRef:q}),[N,q])}var r$=P(m(),1);var mF=P(m(),1),yL=mF.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},nextIndexRef:{current:0}});function gx(){return mF.useContext(yL)}function M4($={}){let{guess:Z,label:J,metadata:H,textRef:B,index:Q}=$,{register:X,unregister:z,subscribeMapChange:G,nextIndexRef:U}=gx(),Y=r$.useRef(-1),[F,K]=r$.useState(Q==null&&Z?()=>{if(Y.current===-1){let D=U.current;U.current+=1,Y.current=D}return Y.current}:-1),W=Q??F,N=r$.useRef(null),q=r$.useCallback((D)=>{let A=N.current;if(A)z(A);if(N.current=D,D)X(D,{metadata:H??null,index:Q??null,label:J,textRef:B})},[Q,X,z,H,J,B]);return H0(()=>{if(Q!=null)return;return G((D)=>{let A=N.current?D.get(N.current)?.index:null;if(A!=null)K(A)})},[Q,G]),{ref:q,index:W}}var mx="data-checked",ux="data-unchecked";var M7={checked($){if($)return{[mx]:""};return{[ux]:""}},...Y2};var px=P(u(),1),cx=uF.forwardRef(function(Z,J){let{render:H,className:B,id:Q,label:X,nativeButton:z=!1,disabled:G=!1,closeOnClick:U=!1,checked:Y,defaultChecked:F,onCheckedChange:K,style:W,...N}=Z,q=M4({guess:!0,label:X}),D=L4(!0),A=t0(Q),{store:V}=T5(),L=V.useState("disabled"),O=G||L,M=V.useState("isActive",q.index),_=V.useState("itemProps"),[w,C]=D4({controlled:Y,default:F??!1,name:"MenuCheckboxItem",state:"checked"}),{getItemProps:E,itemRef:T}=L7({closeOnClick:U,disabled:O,highlighted:M,id:A,store:V,nativeButton:z,nodeId:D?.context.nodeId,itemMetadata:V7}),k=uF.useMemo(()=>({disabled:O,highlighted:M,checked:w}),[O,M,w]);function S(j){let y=w0(F0.itemPress,j.nativeEvent,void 0,{preventUnmountOnClose:G1});if(K?.(!w,y),y.isCanceled)return;C((R)=>!R)}let I=G0("div",Z,{state:k,stateAttributesMapping:M7,props:[_,{role:"menuitemcheckbox","aria-checked":w,onClick:S},N,E],ref:[T,J,q.ref]});return px.jsx(kL.Provider,{value:k,children:I})});var pF=P(m(),1);var dx=pF.forwardRef(function(Z,J){let{render:H,className:B,style:Q,keepMounted:X=!1,...z}=Z,G=vx(),U=pF.useRef(null),{transitionStatus:Y,mounted:F,setMounted:K}=k2(G.checked);L5({batch:!0,enabled:!G.checked,open:G.checked,ref:U,onComplete(){if(!G.checked)K(!1)}});let W={checked:G.checked,disabled:G.disabled,highlighted:G.highlighted,transitionStatus:Y};return G0("span",Z,{state:W,ref:[J,U],stateAttributesMapping:M7,props:{"aria-hidden":!0,...z},enabled:X||F})});var dF=P(m(),1);var cF=P(m(),1),cQ=cF.createContext(void 0);function lx(){let $=cF.useContext(cQ);if($===void 0)throw Error(I0(31));return $}var ix=P(u(),1),rx=dF.forwardRef(function(Z,J){let{render:H,className:B,style:Q,...X}=Z,[z,G]=dF.useState(void 0),U=G0("div",Z,{ref:J,props:{role:"group","aria-labelledby":z,...X}});return ix.jsx(cQ.Provider,{value:G,children:U})});var ax=P(m(),1);var ox=ax.forwardRef(function(Z,J){let{render:H,className:B,style:Q,id:X,...z}=Z,G=t0(X),U=lx();return H0(()=>{return U(G),()=>{U((Y)=>Y===G?void 0:Y)}},[U,G]),G0("div",Z,{ref:J,props:{id:G,"aria-hidden":!0,...z}})});var nx=P(m(),1);var sx=nx.forwardRef(function(Z,J){let{render:H,className:B,id:Q,label:X,nativeButton:z=!1,disabled:G=!1,closeOnClick:U=!0,style:Y,...F}=Z,K=M4({guess:!0,label:X}),W=L4(!0),N=t0(Q),{store:q}=T5(),D=q.useState("disabled"),A=G||D,V=q.useState("isActive",K.index),L=q.useState("itemProps"),{getItemProps:O,itemRef:M}=L7({closeOnClick:U,disabled:A,highlighted:V,id:N,store:q,nativeButton:z,nodeId:W?.context.nodeId,itemMetadata:V7});return G0("div",Z,{state:{disabled:A,highlighted:V},props:[L,F,O],ref:[M,J,K.ref]})});var lF=P(m(),1);var tx=lF.forwardRef(function(Z,J){let{render:H,className:B,id:Q,label:X,closeOnClick:z=!1,style:G,...U}=Z,Y=lF.useRef(null),F=M4({guess:!0,label:X}),W=L4(!0)?.context.nodeId,N=t0(Q),{store:q}=T5(),D=q.useState("isActive",F.index),A=q.useState("itemProps"),V=q.context.typingRef,{getButtonProps:L,buttonRef:O}=w5({native:!1,composite:!0}),M=gF({closeOnClick:z,highlighted:D,id:N,nodeId:W,store:q,typingRef:V,itemRef:Y,itemMetadata:V7});function _(C){return K2(M,C,L)}return G0("a",Z,{state:{highlighted:D},props:[A,U,_],ref:[Y,O,J,F.ref]})});var iF=P(m(),1);var ex=P(u(),1),$h=iF.forwardRef(function(Z,J){let{render:H,className:B,style:Q,finalFocus:X,...z}=Z,{store:G}=T5(),{side:U,align:Y}=L4(),F=RU(!0)!=null,K=G.useState("open"),W=G.useState("transitionStatus"),N=G.useState("popupProps"),q=G.useState("mounted"),D=G.useState("instantType"),A=G.useState("activeTriggerElement"),V=G.useState("parent"),L=G.useState("lastOpenChangeReason"),O=G.useState("rootId"),M=G.useState("floatingRootContext"),_=G.useState("floatingTreeRoot"),w=G.useState("closeDelay"),C=G.useState("hoverEnabled"),E=G.useState("disabled"),T=G.useState("openMethod"),k=V.type==="context-menu";L5({open:K,ref:G.context.popupRef,onComplete(){if(K)G.context.onOpenChangeComplete?.(!0)}}),iF.useEffect(()=>{function R(x){G.setOpen(!1,w0(x.reason,x.domEvent))}return _.events.on("close",R),()=>{_.events.off("close",R)}},[_.events,G]),d3(M,{enabled:C&&!E&&!k&&V.type!=="menubar",closeDelay:w});let S=G.useStateSetter("popupElement"),I={transitionStatus:W,side:U,align:Y,open:K,nested:V.type==="menu",instant:D},j=G0("div",Z,{state:I,ref:[J,G.context.popupRef,S],stateAttributesMapping:X4,props:[N,{onKeyDown(R){if(F&&D9.has(R.key))R.stopPropagation()}},B3(W),z,{"data-rootownerid":O}]}),y=V.type===void 0||k;if(A||V.type==="menubar"&&L!==F0.outsidePress)y=!0;return ex.jsx(P$,{context:M,openInteractionType:T,modal:k,disabled:!q,returnFocus:X===void 0?y:X,initialFocus:V.type!=="menu",restoreFocus:!0,externalTree:V.type!=="menubar"?_:void 0,previousFocusableElement:A,nextFocusableElement:V.type===void 0?G.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:V.type===void 0?G.context.beforeContentFocusGuardRef:void 0,children:j})});var Jh=P(m(),1);var rF=P(m(),1),xL=rF.createContext(void 0);function Zh(){let $=rF.useContext(xL);if($===void 0)throw Error(I0(32));return $}var hL=P(u(),1),Hh=Jh.forwardRef(function(Z,J){let{keepMounted:H=!1,...B}=Z,{store:Q,parent:X}=T5();if(!(Q.useState("mounted")||H))return null;let U=X.type==="menu"||X.type==="menubar"?"group":void 0;return hL.jsx(xL.Provider,{value:H,children:hL.jsx(D$,{ref:J,...B,portalOwnerRole:U})})});var D3=P(m(),1);var J6=P(m(),1);var Bh=P(u(),1);function P7($){let{children:Z,elementsRef:J,labelsRef:H,onMapChange:B}=$,Q=Y0(B),[,X]=J6.useState(!1),z=H5(b30).current,G=H5(E30).current,U=J6.useRef(0),Y=J6.useRef(!0),F=J6.useRef(null),K=J6.useRef(null),W=Y0(()=>{if(Y.current)return;Y.current=!0,X((M)=>!M)}),N=Y0((M,_)=>{G.set(M,_),W()}),q=Y0((M)=>{G.delete(M),W()}),D=Y0((M)=>{let _=new Map;if(J.current.length=0,H)H.current.length=0;return M.forEach((w)=>{if(_.set(w.element,{...w.registration.metadata??{},index:w.index}),J.current[w.index]=w.element,H)H.current[w.index]=w.registration.label!==void 0?w.registration.label:w.registration.textRef?.current?.textContent??w.element.textContent}),U.current=J.current.length,_});function A(M){if(K.current?.disconnect(),K.current=null,typeof MutationObserver!=="function"||M.length<2)return;let _=new MutationObserver((C)=>{if(!R30(C))return;let E=null;for(let T of M){if(!T.isConnected)continue;if(E&&Qh(E,T)>0){_.disconnect(),W();return}E=T}});K.current=_;let w=new Set;for(let C=1;C<M.length;C+=1){let E=S30(M[C-1],M[C]);if(E)w.add(E)}w.forEach((C)=>_.observe(C,{childList:!0}))}let V=Y0(()=>{let[M,_]=w30(G),w=D(M),C=F.current,E=!C||C.length!==M.length||M.some((T,k)=>{let S=C[k];return T.index!==S.index||T.element!==S.element||T.registration.index!==S.registration.index||T.registration.metadata!==S.registration.metadata});if(A(_),F.current=M,Y.current=!1,!E)return;z.forEach((T)=>T(w)),Q(w)});H0(()=>{if(!Y.current&&F.current)D(F.current);return()=>{if(J.current=[],H)H.current=[]}},[J,H,D]),H0(()=>{if(Y.current)V()}),H0(()=>{return()=>{K.current?.disconnect(),Y.current=!0}},[]);let L=Y0((M)=>{return z.add(M),()=>{z.delete(M)}}),O=J6.useMemo(()=>({register:N,unregister:q,subscribeMapChange:L,nextIndexRef:U}),[N,q,L,U]);return Bh.jsx(yL.Provider,{value:O,children:Z})}function E30(){return new Map}function b30(){return new Set}function w30($){let Z=new Set,J=[],H=[];$.forEach((Q,X)=>{if(!X.isConnected)return;let z=Q.index,G={index:z??-1,element:X,registration:Q};if(z===null)H.push(G);else if(z>=0)Z.add(z),J.push(G)});let B=0;if(H.sort((Q,X)=>Qh(Q.element,X.element)),H.forEach((Q)=>{while(Z.has(B))B+=1;Q.index=B,J.push(Q),B+=1}),Z.size>0)J.sort((Q,X)=>Q.index-X.index);return[J,H.map((Q)=>Q.element)]}function S30($,Z){let J=$.parentElement;while(J&&!J.contains(Z))J=J.parentElement;return J}function R30($){for(let Z of $)for(let J=0;J<Z.removedNodes.length;J+=1)if(Z.removedNodes[J].isConnected)return!0;return!1}function Qh($,Z){return $.compareDocumentPosition(Z)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}var HH=P(u(),1),Xh=D3.forwardRef(function(Z,J){let{anchor:H,positionMethod:B="absolute",className:Q,render:X,side:z,align:G,sideOffset:U=0,alignOffset:Y=0,collisionBoundary:F="clipping-ancestors",collisionPadding:K=5,arrowPadding:W=5,sticky:N=!1,disableAnchorTracking:q=!1,collisionAvoidance:D=MC,style:A,...V}=Z,{store:L}=T5(),O=Zh(),M=D7(!0),_=L.useState("parent"),w=L.useState("floatingRootContext"),C=L.useState("floatingTreeRoot"),E=L.useState("mounted"),T=L.useState("open"),k=L.useState("modal"),S=L.useState("openMethod"),I=L.useState("activeTriggerElement"),j=L.useState("transitionStatus"),y=L.useState("positionerElement"),R=L.useState("instantType"),x=L.useState("adaptiveOrigin"),v=L.useState("lastOpenChangeReason"),f=L.useState("floatingNodeId"),b=L.useState("floatingParentNodeId"),l=w.useState("domReferenceElement"),r=D3.useRef(null),h=t4(y),d=H,o=U,c=Y,i=G,n=D;if(_.type==="context-menu"){if(d=H??_.context?.anchor,i=i??"start",!z&&i!=="center")c=Z.alignOffset??2,o=Z.sideOffset??-5}let Z0=z,J0=i;if(_.type==="menu")Z0=Z0??"inline-end",J0=J0??"start",n=Z.collisionAvoidance??i9;else if(_.type==="menubar")Z0=Z0??(_.context.orientation==="vertical"?"inline-end":"bottom"),J0=J0??"start";let U0=_.type==="context-menu",z0=H3({anchor:d,floatingRootContext:w,positionMethod:M?"fixed":B,mounted:E,side:Z0,sideOffset:o,align:J0,alignOffset:c,arrowPadding:U0?0:W,collisionBoundary:F,collisionPadding:K,sticky:N,nodeId:f,keepMounted:O,disableAnchorTracking:q,collisionAvoidance:n,shift:U0?{crossAxis:!(("side"in n)&&n.side==="flip"),rootBoundary:"layoutViewport"}:void 0,externalTree:C,adaptiveOrigin:x});D3.useEffect(()=>{function t(B0){if(B0.open){if(B0.parentNodeId===f)L.set("hoverEnabled",!1);if(B0.nodeId!==f&&B0.parentNodeId===L.select("floatingParentNodeId"))L.setOpen(!1,w0(F0.siblingOpen))}}return C.events.on("menuopenchange",t),()=>{C.events.off("menuopenchange",t)}},[L,C.events,f]),D3.useEffect(()=>{if(L.select("floatingParentNodeId")==null)return;function t(B0){if(B0.open||B0.nodeId!==L.select("floatingParentNodeId"))return;let _0=B0.reason??F0.siblingOpen;L.setOpen(!1,w0(_0))}return C.events.on("menuopenchange",t),()=>{C.events.off("menuopenchange",t)}},[C.events,L]);let X0=s1();D3.useEffect(()=>{if(!T)X0.clear()},[T,X0]),D3.useEffect(()=>{function t(B0){if(!T||B0.nodeId!==L.select("floatingParentNodeId"))return;if(B0.target&&I&&I!==B0.target){let _0=L.select("closeDelay");if(_0>0){if(!X0.isStarted())X0.start(_0,()=>{L.setOpen(!1,w0(F0.siblingOpen))})}else L.setOpen(!1,w0(F0.siblingOpen))}else X0.clear()}return C.events.on("itemhover",t),()=>{C.events.off("itemhover",t)}},[C.events,T,I,L,X0]),D3.useEffect(()=>{let t={open:T,nodeId:f,parentNodeId:b,reason:L.select("lastOpenChangeReason")};C.events.emit("menuopenchange",t)},[C.events,T,L,f,b]),H0(()=>{let t=l,B0=r.current;if(t)r.current=t;if(B0&&t&&t!==B0){L.set("instantType",void 0);let _0=new AbortController;return h(()=>{L.set("instantType","trigger-change")},_0.signal),()=>{_0.abort()}}return},[l,h,L]);let N0={open:T,side:z0.side,align:z0.align,anchorHidden:z0.anchorHidden,nested:_.type==="menu",instant:R},q0=_.type==="menubar"&&_.context.modal,K0=k&&v!==F0.triggerHover;EU(T&&(q0||K0),S==="touch",y,I);let s=Q3(Z,N0,{styles:z0.positionerStyles,transitionStatus:j,props:V,refs:[J,L.useStateSetter("positionerElement")],hidden:!E,inert:!T}),a=E&&_.type!=="menu"&&(_.type!=="menubar"&&k&&v!==F0.triggerHover||_.type==="menubar"&&_.context.modal),$0=null;if(_.type==="menubar")$0=_.context.contentElement;else if(_.type===void 0)$0=I;return HH.jsxs(RL.Provider,{value:z0,children:[a&&HH.jsx(DJ,{ref:_.type==="context-menu"||_.type==="nested-context-menu"?_.context.internalBackdropRef:null,inert:x8(!T),cutout:$0}),HH.jsx(L$,{id:f,children:HH.jsx(P7,{elementsRef:L.context.itemDomElements,labelsRef:L.context.itemLabels,children:s})})]})});var _7=P(m(),1);var aF=P(m(),1),vL=aF.createContext(void 0);function zh(){let $=aF.useContext(vL);if($===void 0)throw Error(I0(34));return $}var fL=P(u(),1),Gh=_7.memo(_7.forwardRef(function(Z,J){let{render:H,className:B,value:Q,defaultValue:X,onValueChange:z,disabled:G=!1,style:U,"aria-labelledby":Y,...F}=Z,[K,W]=_7.useState(void 0),[N,q]=D4({controlled:Q,default:X,name:"MenuRadioGroup"}),D=Y0((O,M)=>{if(z?.(O,M),M.isCanceled)return;q(O)}),V=G0("div",Z,{state:{disabled:G},ref:J,props:{role:"group","aria-labelledby":Y??K,"aria-disabled":G||void 0,...F}}),L=_7.useMemo(()=>({value:N,setValue:D,disabled:G}),[N,D,G]);return fL.jsx(cQ.Provider,{value:W,children:fL.jsx(vL.Provider,{value:L,children:V})})}));var nF=P(m(),1);var oF=P(m(),1),gL=oF.createContext(void 0);function Uh(){let $=oF.useContext(gL);if($===void 0)throw Error(I0(35));return $}var Yh=P(u(),1),Fh=nF.forwardRef(function(Z,J){let{render:H,className:B,id:Q,label:X,nativeButton:z=!1,disabled:G=!1,closeOnClick:U=!1,value:Y,style:F,...K}=Z,W=M4({guess:!0,label:X}),N=L4(!0),q=t0(Q),{store:D}=T5(),A=D.useState("isActive",W.index),V=D.useState("itemProps"),{value:L,setValue:O,disabled:M}=zh(),_=D.useState("disabled"),w=G||M||_,C=L===Y,{getItemProps:E,itemRef:T}=L7({closeOnClick:U,disabled:w,highlighted:A,id:q,store:D,nativeButton:z,nodeId:N?.context.nodeId,itemMetadata:V7}),k=nF.useMemo(()=>({disabled:w,highlighted:A,checked:C}),[w,A,C]);function S(j){let y=w0(F0.itemPress,j.nativeEvent,void 0,{preventUnmountOnClose:G1});O(Y,y)}let I=G0("div",Z,{state:k,stateAttributesMapping:M7,props:[V,{role:"menuitemradio","aria-checked":C,onClick:S},K,E],ref:[T,J,W.ref]});return Yh.jsx(gL.Provider,{value:k,children:I})});var sF=P(m(),1);var Kh=sF.forwardRef(function(Z,J){let{render:H,className:B,style:Q,keepMounted:X=!1,...z}=Z,G=Uh(),U=sF.useRef(null),{transitionStatus:Y,mounted:F,setMounted:K}=k2(G.checked);L5({batch:!0,enabled:!G.checked,open:G.checked,ref:U,onComplete(){if(!G.checked)K(!1)}});let W={checked:G.checked,disabled:G.disabled,highlighted:G.highlighted,transitionStatus:Y};return G0("span",Z,{state:W,stateAttributesMapping:M7,ref:[J,U],props:{"aria-hidden":!0,...z},enabled:X||F})});var J2=P(m(),1);var tF=P(m(),1),I30=tF.createContext(null);function eF($){let Z=tF.useContext(I30);if(Z===null&&!$)throw Error(I0(5));return Z}var dQ=P(m(),1);var Wh={...$3,disabled:($)=>$.parent.type==="menubar"?$.parent.context.disabled||$.disabled:$.disabled,modal:($)=>($.parent.type===void 0||$.parent.type==="context-menu")&&($.modal??!0),openMethod:($)=>$.openMethod,allowMouseEnter:($)=>$.allowMouseEnter,highlightItemOnHover:($)=>$.highlightItemOnHover,parent:($)=>$.parent,rootId:($)=>{if($.parent.type==="menu")return $.parent.store.select("rootId");return $.parent.type!==void 0?$.parent.context.rootId:$.rootId},activeIndex:($)=>$.activeIndex,isActive:($,Z)=>$.activeIndex===Z,hoverEnabled:($)=>$.hoverEnabled,instantType:($)=>$.instantType,lastOpenChangeReason:($)=>$.openChangeReason,floatingTreeRoot:($)=>{if($.parent.type==="menu")return $.parent.store.select("floatingTreeRoot");return $.floatingTreeRoot},floatingNodeId:($)=>$.floatingNodeId,floatingParentNodeId:($)=>$.floatingParentNodeId,itemProps:($)=>$.itemProps,closeDelay:($)=>$.closeDelay,adaptiveOrigin:($)=>$.adaptiveOrigin,keyboardEventRelay:($)=>{if($.keyboardEventRelay)return $.keyboardEventRelay;if($.parent.type==="menu")return $.parent.store.select("keyboardEventRelay");return}};class mL extends p2{constructor($,Z,J=!1){let H=new y2,B=Ah(H,Z,J,$);super(B,qh(H),Wh);this.unsubscribeParentListener=this.observe("parent",(Q)=>{if(this.unsubscribeParentListener?.(),Q.type==="menu"){let X=Q.store.select("rootId"),z=Q.store.select("floatingTreeRoot"),G=Q.store.select("keyboardEventRelay");this.unsubscribeParentListener=Q.store.subscribe(()=>{let U=Q.store.select("rootId"),Y=Q.store.select("floatingTreeRoot"),F=Q.store.select("keyboardEventRelay");if(X===U&&z===Y&&G===F)return;X=U,z=Y,G=F,this.notifyAll()}),this.context.allowMouseUpTriggerRef=Q.store.context.allowMouseUpTriggerRef;return}if(Q.type!==void 0)this.context.allowMouseUpTriggerRef=Q.context.allowMouseUpTriggerRef;this.unsubscribeParentListener=null})}setOpen($,Z){this.state.floatingRootContext.context.events.emit("setOpen",{open:$,eventDetails:Z})}unsubscribeParentListener=null}function Nh(){let $=new y2,Z=new A9(Object.freeze(Ah($)),Object.freeze(qh($)),Wh);return Object.assign(Z,{setOpen:G1})}function qh($){return{positionerRef:dQ.createRef(),popupRef:dQ.createRef(),typingRef:{current:!1},itemDomElements:{current:[]},itemLabels:{current:[]},allowMouseUpTriggerRef:{current:!1},triggerFocusTargetRef:dQ.createRef(),beforeContentFocusGuardRef:dQ.createRef(),onOpenChangeComplete:void 0,triggerElements:$}}function Ah($,Z,J=!1,H){return{...e9($,Z,J),disabled:!1,modal:!0,openMethod:null,allowMouseEnter:!1,highlightItemOnHover:!0,parent:{type:void 0},rootId:void 0,activeIndex:null,hoverEnabled:!0,instantType:void 0,openChangeReason:null,floatingTreeRoot:new V$,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:D1,keyboardEventRelay:void 0,closeDelay:0,adaptiveOrigin:void 0,...H}}var $K=P(m(),1),uL=$K.createContext(void 0);function ZK(){return $K.useContext(uL)}var lQ=P(u(),1),JK=X9(function(Z){let{children:J,open:H,onOpenChange:B,onOpenChangeComplete:Q,defaultOpen:X=!1,disabled:z=!1,modal:G,loopFocus:U=!0,orientation:Y="vertical",actionsRef:F,closeParentOnEsc:K=!1,handle:W,triggerId:N,defaultTriggerId:q=null,highlightItemOnHover:D=!0}=Z,A=D7(!0),V=T5(!0),L=eF(!0),O=ZK(),M=J2.useMemo(()=>{if(O&&V)return{type:"menu",store:V.store};if(L)return{type:"menubar",context:L};if(A&&!V)return{type:"context-menu",context:A};return{type:void 0}},[A,V,L,O]),_=k4(),w=k4(),C=x4(),E=M.type==="menu"?M.store:void 0,T=(H??X)&&E?.state.transitionStatus==="starting",k=H5(()=>T?E?.state.instantType:void 0).current,S=k30({open:X,openProp:H,activeTriggerId:q,triggerIdProp:N,parent:M,disabled:z,highlightItemOnHover:D,modal:M.type===void 0?G:void 0,rootId:_,instantType:k},w,C!=null);S.useControlledProp("openProp",H),S.useControlledProp("triggerIdProp",N),S.useContextCallback("onOpenChangeComplete",Q);let I=S.useState("floatingTreeRoot"),j=p3(I),y=S.useState("open"),R=S.useState("activeTriggerElement"),x=S.useState("positionerElement"),v=S.useState("hoverEnabled"),f=S.useState("disabled"),b=S.useState("lastOpenChangeReason"),l=S.useState("parent"),r=S.useState("activeIndex"),h=S.useState("payload"),d=S.useState("floatingParentNodeId"),o=J2.useRef(null),c=J2.useRef(l.type!=="context-menu"),i=s1(),n=J2.useRef(!0),Z0=s1(),J0=d!=null,{openMethod:U0,triggerProps:z0}=hw(y);S.useSyncedValues({disabled:z,highlightItemOnHover:D,modal:l.type===void 0?G:void 0,openMethod:U0,rootId:_}),n9(S);let{forceUnmount:X0,transitionStatus:N0}=s9(y,S,()=>{S.set("allowMouseEnter",!1)},T),q0=t4(S.context.popupRef);J2.useEffect(()=>{if(k===void 0)return;let j0=()=>{if(S.state.instantType===k)S.set("instantType",void 0)};if(!y){j0();return}if(N0!==void 0)return;if(S.context.popupRef.current==null){j0();return}let c0=new AbortController;return q0(j0,c0.signal),()=>{c0.abort()}},[k,y,N0,q0,S]),H0(()=>{if(A&&!V)S.update({parent:{type:"context-menu",context:A},floatingNodeId:j,floatingParentNodeId:C});else if(V)S.update({floatingNodeId:j,floatingParentNodeId:C})},[A,V,j,C,S]),J2.useEffect(()=>{if(!y)o.current=null;if(l.type!=="context-menu")return;if(!y){i.clear(),c.current=!1;return}i.start(500,()=>{c.current=!0})},[i,y,l.type]),H0(()=>{if(!y&&!v)S.set("hoverEnabled",!0)},[y,v,S]);let K0=Y0((j0,c0)=>{let z1=c0.reason;if(!j0&&!S.select("open"))return;if(y===j0&&c0.trigger===R&&b===z1)return;let A1=iB(c0);if(!j0&&c0.trigger==null)c0.trigger=R??void 0;if(B?.(j0,c0),c0.isCanceled)return;S.state.floatingRootContext.dispatchOpenChange(j0,c0);let l0=c0.event;if(j0===!1&&l0?.type==="click"&&l0.pointerType==="touch"&&!n.current)return;if(j0&&z1===F0.triggerFocus)n.current=!1,Z0.start(300,()=>{n.current=!0});else n.current=!0,Z0.clear();let k0=(z1===F0.triggerPress||z1===F0.itemPress)&&l0.detail===0,R1=!j0&&(z1===F0.escapeKey||z1==null);o.current=c0.event;let Y1=O$(S.state,j0,c0.trigger,A1());if(Y1.openChangeReason=z1,l.type==="menubar"&&(z1===F0.triggerFocus||z1===F0.focusOut||z1===F0.triggerHover||z1===F0.listNavigation||z1===F0.siblingOpen))Y1.instantType="group";else if(k0||R1)Y1.instantType=k0?"click":"dismiss";else Y1.instantType=void 0;S.update(Y1)}),s=lB({popupStore:S,floatingRootContext:S.state.floatingRootContext,floatingId:w,nested:C!=null,onOpenChange:K0}),a=s.context.events;H0(()=>{let j0=({open:c0,eventDetails:z1})=>K0(c0,z1);return a.on("setOpen",j0),()=>{a?.off("setOpen",j0)}},[a,K0]);let $0=J2.useCallback(()=>{S.setOpen(!1,w0(F0.imperativeAction))},[S]);J2.useImperativeHandle(F,()=>({unmount:X0,close:$0}),[X0,$0]);let t;if(l.type==="context-menu")t=l.context;J2.useImperativeHandle(t?.positionerRef,()=>x,[x]),J2.useImperativeHandle(t?.actionsRef,()=>({setOpen:K0}),[K0]);let B0=K9(s,{enabled:!f,bubbles:{escapeKey:K&&l.type==="menu"},outsidePress(){if(l.type!=="context-menu"||o.current?.type==="contextmenu")return!0;return c.current},externalTree:J0?I:void 0}),_0=$8(),P0=J2.useCallback((j0)=>{if(S.select("activeIndex")===j0)return;S.set("activeIndex",j0)},[S]),A0=VD(s,{enabled:!f,listRef:S.context.itemDomElements,activeIndex:r,nested:l.type!==void 0,loopFocus:U,orientation:Y,parentOrientation:l.type==="menubar"?l.context.orientation:void 0,rtl:_0==="rtl",disabledIndices:Q4,onNavigate:P0,openOnArrowKeyDown:l.type!=="context-menu",externalTree:J0?I:void 0,focusItemOnHover:D}),M0=J2.useCallback((j0)=>{S.context.typingRef.current=j0},[S]),g=LD(s,{enabled:!f,listRef:S.context.itemLabels,elementsRef:S.context.itemDomElements,activeIndex:r,resetMs:AC,onMatch:(j0)=>{if(y&&j0!==r)S.set("activeIndex",j0)},onTyping:M0}),p=J2.useMemo(()=>{let j0=K2(g.reference,A0.reference,B0.reference,{onMouseMove(){S.set("allowMouseEnter",!0)}},z0);return j0["aria-haspopup"]="menu",j0["aria-expanded"]=y,j0},[S,g.reference,A0.reference,B0.reference,z0,y]),e=J2.useMemo(()=>{let j0=K2(A0.trigger,B0.trigger,z0);return j0["aria-haspopup"]="menu",j0["aria-expanded"]=!1,j0},[A0.trigger,B0.trigger,z0]);H5(()=>{return S.update({inactiveTriggerProps:e}),null});let W0=J2.useMemo(()=>K2(r9,{id:w,role:"menu","aria-orientation":Y==="horizontal"?"horizontal":void 0,"aria-labelledby":R?.id,onMouseMove(){if(S.set("allowMouseEnter",!0),l.type==="menu")S.set("hoverEnabled",!1)},onClick(){if(S.select("hoverEnabled"))S.set("hoverEnabled",!1)},onKeyDown(j0){let c0=S.select("keyboardEventRelay");if(c0&&!j0.isPropagationStopped())c0(j0)}},g.floating,A0.floating,B0.floating),[R,w,Y,l.type,S,g.floating,A0.floating,B0.floating]),S0=A0.item??D1;t9(S,{floatingRootContext:s,activeTriggerProps:p,inactiveTriggerProps:e,popupProps:W0,itemProps:S0});let h0=J2.useMemo(()=>({store:S,parent:M}),[S,M]),v0=lQ.jsxs(IL.Provider,{value:h0,children:[W&&lQ.jsx(a9,{handle:W,store:S}),typeof J==="function"?J({payload:h}):J]});if(l.type===void 0||l.type==="context-menu")return lQ.jsx(M$,{externalTree:I,children:v0});return v0});function k30($,Z,J){return H5(()=>new mL($,Z,J)).current}var Dh=P(m(),1);var pL=P(u(),1);function Vh($){let Z=T5().store,J=Dh.useMemo(()=>({parentMenu:Z}),[Z]);return pL.jsx(uL.Provider,{value:J,children:pL.jsx(JK,{...$})})}var P4=P(m(),1);var HK=5;function Lh($,Z){let J=y30(Z);return $.clientX>=J.left-HK&&$.clientX<=J.right+HK&&$.clientY>=J.top-HK&&$.clientY<=J.bottom+HK}function y30($){let Z=$.getBoundingClientRect(),J=k1($);if(B5.env.jsdom)return Z;let H=J.getComputedStyle($,"::before"),B=J.getComputedStyle($,"::after");if(!(H.content!=="none"||B.content!=="none"))return Z;let X=parseFloat(H.width)||0,z=parseFloat(H.height)||0,G=parseFloat(B.width)||0,U=parseFloat(B.height)||0,Y=Math.max(Z.width,X,G),F=Math.max(Z.height,z,U),K=Y-Z.width,W=F-Z.height;return{left:Z.left-K/2,right:Z.right+K/2,top:Z.top-W/2,bottom:Z.bottom+W/2}}var Mh=P(m(),1);function BK($={}){let{highlightItemOnHover:Z,highlightedIndex:J,onHighlightedIndexChange:H}=BH(),{ref:B,index:Q}=M4($),X=J===Q,z=Mh.useRef(null),G=l2(B,z);return{compositeProps:{tabIndex:X?0:-1,onFocus(){H(Q)},onMouseMove(){let Y=z.current;if(!Z||!Y)return;let F=Y.hasAttribute("disabled")||Y.ariaDisabled==="true";if(!X&&!F)Y.focus()}},compositeRef:G,index:Q}}function Ph($){let{render:Z,className:J,style:H,state:B=D1,props:Q=Q4,refs:X=Q4,metadata:z,stateAttributesMapping:G,tag:U="div",...Y}=$,{compositeProps:F,compositeRef:K}=BK({metadata:z});return G0(U,$,{state:B,ref:[K,...X],props:[F,...Q,Y],stateAttributesMapping:G})}function cL($){if(L1($)&&$.hasAttribute("data-rootownerid"))return $.getAttribute("data-rootownerid");if(h8($))return;return cL(v8($))}var QK=P(m(),1);function _h($){let{enabled:Z=!0,mouseDownAction:J,open:H}=$,B=QK.useRef(!1);return QK.useMemo(()=>{if(!Z)return D1;return{onMouseDown:(Q)=>{if(J==="open"&&!H||J==="close"&&H)B.current=!0,m0(Q.currentTarget).addEventListener("click",()=>{B.current=!1},{once:!0})},onClick:(Q)=>{if(B.current)B.current=!1,Q.preventBaseUIHandler()}}},[Z,J,H])}var O7=P(u(),1),Oh=u9(function(Z,J){let{render:H,className:B,style:Q,disabled:X=!1,nativeButton:z=!0,id:G,openOnHover:U,delay:Y=100,closeDelay:F=0,handle:K,payload:W,...N}=Z,q=T5(!0),A=Z3(K)??q?.store;if(!A)throw Error(I0(85));let V=t0(G),L=A.useState("isTriggerActive",V),O=A.useState("floatingRootContext"),M=A.useState("isOpenedByTrigger",V),_=A.useState("triggerPopupId",V),w=P4.useRef(null),C=h30(),E=BH(!0),T=G4(),k=P4.useMemo(()=>{return T??new V$},[T]),S=p3(k),I=x4(),{registerTrigger:j,isMountedByThisTrigger:y}=o9(V,w,A,{payload:W,closeDelay:F,parent:C,floatingTreeRoot:k,floatingNodeId:S,floatingParentNodeId:I,keyboardEventRelay:E?.relayKeyboardEvent}),R=C.type==="menubar",x=A.useState("disabled"),v=X||x||R&&C.context.disabled,{getButtonProps:f,buttonRef:b}=w5({disabled:v,native:z});P4.useEffect(()=>{if(!M&&C.type===void 0)A.context.allowMouseUpTriggerRef.current=!1},[A,M,C.type]);let l=P4.useRef(null),r=s1(),h=Y0((t)=>{if(!l.current)return;r.clear(),A.context.allowMouseUpTriggerRef.current=!1;let B0=t.target;if(R0(l.current,B0)||R0(A.select("positionerElement"),B0)||B0===l.current)return;if(B0!=null&&cL(B0)===A.select("rootId"))return;if(Lh(t,l.current))return;k.events.emit("close",{domEvent:t,reason:F0.cancelOpen})});P4.useEffect(()=>{if(M&&A.select("lastOpenChangeReason")===F0.triggerHover)m0(l.current).addEventListener("mouseup",h,{once:!0})},[M,h,A]);let d=R&&C.context.hasSubmenuOpen,c=N9(O,{enabled:(U??d)&&!v&&(!R||d&&!y),handleClose:q9({blockPointerEvents:!R}),mouseOnly:!0,move:!1,restMs:C.type===void 0?Y:void 0,delay:{close:F},triggerElementRef:w,externalTree:k,isActiveTrigger:L,isClosing:()=>A.select("transitionStatus")==="ending"}),i=x30(M,A.select("lastOpenChangeReason")),n=c3(O,{enabled:!v,event:M&&R?"click":"mousedown",toggle:!0,ignoreMouse:!1,stickIfOpen:C.type===void 0?i:!1}),Z0=T$(O,{enabled:!v&&d}),J0=_h({open:M,enabled:R,mouseDownAction:"open"}),U0=P4.useMemo(()=>K2(Z0.reference,n.reference),[Z0.reference,n.reference]),z0=A.useState("triggerProps",y),{preFocusGuardRef:X0,handlePreFocusGuardFocus:N0,handleFocusTargetFocus:q0}=_U(A,w),K0={disabled:v,open:M},s=[l,J,b,j,w],a=[U0,c??D1,z0,{"aria-haspopup":"menu","aria-controls":_,id:V,onMouseDown:(t)=>{if(A.select("open"))return;r.start(200,()=>{A.context.allowMouseUpTriggerRef.current=!0}),m0(t.currentTarget).addEventListener("mouseup",h,{once:!0})}},R?{role:"menuitem"}:{},J0,N,f],$0=G0("button",Z,{enabled:!R,stateAttributesMapping:yB,state:K0,ref:s,props:a});if(R)return O7.jsx(Ph,{tag:"button",render:H,className:B,style:Q,state:K0,refs:s,props:a,stateAttributesMapping:yB});if(M)return O7.jsxs(P4.Fragment,{children:[O7.jsx(s4,{ref:X0,onFocus:N0},`${V}-pre-focus-guard`),O7.jsx(P4.Fragment,{children:$0},V),O7.jsx(s4,{ref:A.context.triggerFocusTargetRef,onFocus:q0},`${V}-post-focus-guard`)]});return O7.jsx(P4.Fragment,{children:$0},V)});function x30($,Z){let J=s1(),[H,B]=P4.useState(!1);return H0(()=>{if($&&Z===F0.triggerHover)B(!0),J.start(MG,()=>{B(!1)});else if(!$)J.clear(),B(!1)},[$,Z,J]),H}function h30(){let $=eF(!0);return P4.useMemo(()=>{if($)return{type:"menubar",context:$};return{type:void 0}},[$])}var Th=P(m(),1);var jh=Th.forwardRef(function(Z,J){let{render:H,className:B,style:Q,children:X,...z}=Z,{store:G}=T5(),{side:U}=L4(),Y=G.useState("instantType"),{children:F,state:K}=y6({store:G,side:U,children:X}),W={activationDirection:K.activationDirection,transitioning:K.transitioning,instant:Y};return G0("div",Z,{state:W,ref:J,props:[z,{children:F}],stateAttributesMapping:k6})});var Ch=P(m(),1);var Eh=Ch.forwardRef(function(Z,J){let{className:H,render:B,orientation:Q="horizontal",style:X,...z}=Z;return G0("div",Z,{state:{orientation:Q},ref:J,props:[{role:"separator","aria-orientation":Q},z]})});var H6=P(m(),1);function bh($){return $==null||$.hasAttribute("disabled")||$.getAttribute("aria-disabled")==="true"}var v30={"aria-expanded":void 0},wh=H6.forwardRef(function(Z,J){let{render:H,className:B,style:Q,label:X,id:z,nativeButton:G=!1,openOnHover:U=!0,delay:Y=100,closeDelay:F=0,disabled:K=!1,...W}=Z,N=ZK();if(!N?.parentMenu)throw Error(I0(37));let q=M4({guess:!0,label:X}),D=L4(),{store:A}=T5(),V=t0(z),L=A.useState("open"),O=A.useState("floatingRootContext"),M=A.useState("floatingTreeRoot"),_=A.useState("triggerPopupId",V),w=YD(V,A),C=Y0((U0)=>{if(w(U0),U0!==null&&A.select("open")&&A.select("activeTriggerId")==null)A.update({activeTriggerId:V??null,activeTriggerElement:U0,closeDelay:F})}),E=H6.useRef(null),T=H6.useCallback((U0)=>{E.current=U0,A.set("activeTriggerElement",U0)},[A]);H0(()=>{return C(E.current),()=>C(null)},[C,V,A]),A.useSyncedValue("closeDelay",F);let k=N.parentMenu,S=A.useState("disabled"),I=k.useState("disabled"),j=K||S||I,y=k.useState("itemProps"),R=k.useState("isActive",q.index),x=H6.useMemo(()=>({type:"submenu-trigger",setActive(){if(k.select("highlightItemOnHover"))k.set("activeIndex",q.index)}}),[k,q.index]),{getItemProps:v,itemRef:f}=L7({closeOnClick:!1,disabled:j,highlighted:R,id:V,store:A,typingRef:k.context.typingRef,nativeButton:G,itemMetadata:x,nodeId:D?.context.nodeId}),b=A.useState("hoverEnabled"),l=N9(O,{enabled:b&&U&&!j,handleClose:q9({blockPointerEvents:!0}),mouseOnly:!0,move:!0,restMs:Y,delay:{open:Y,close:F},shouldOpen:Y>0?()=>k.select("allowMouseEnter"):void 0,triggerElementRef:E,externalTree:M,isClosing:()=>A.select("transitionStatus")==="ending",guardStaleOpen:!0}),h=c3(O,{enabled:!j,event:"mousedown",toggle:!U,ignoreMouse:U,stickIfOpen:!1}).reference??D1,d=A.useState("triggerProps",!0);delete d.id;let o={disabled:j,highlighted:R,open:L},c=A.useState("openMethod"),n=A.useState("lastOpenChangeReason")===F0.listNavigation||c==="keyboard",Z0=L&&n&&B5.screenReader.voiceOver;return G0("div",Z,{state:o,stateAttributesMapping:p9,props:[h,l,d,y,Z0?v30:void 0,{"aria-controls":_,tabIndex:L||R?0:-1,onBlur(){if(R)k.set("activeIndex",null)}},W,v],ref:[J,q.ref,f,C,T]})});class XK extends W9{constructor(){super(Nh(),"Menu")}open($){this.openByTrigger($)}close(){this.closePopup()}get isOpen(){return this.attachedStore?.select("open")??!1}}function Sh(){return new XK}var s2=P(u(),1);function r8({...$}){return s2.jsx(f4.Root,{"data-slot":"dropdown-menu",...$})}function f30({...$}){return s2.jsx(g8,{portal:f4.Portal,"data-slot":"dropdown-menu-portal",...$})}function a8({...$}){return s2.jsx(f4.Trigger,{"data-slot":"dropdown-menu-trigger",...$})}function o8({align:$="start",alignOffset:Z=0,side:J="bottom",sideOffset:H=4,className:B,...Q}){return s2.jsx(f30,{children:s2.jsx(f4.Positioner,{className:"isolate z-50 outline-none",align:$,alignOffset:Z,side:J,sideOffset:H,children:s2.jsx(f4.Popup,{"data-slot":"dropdown-menu-content",className:d0("z-50 max-h-(--available-height) w-(--anchor-width) min-w-32 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-md duration-100 outline-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 rtl:data-[side=inline-end]:slide-in-from-right-2 rtl:data-[side=inline-start]:slide-in-from-left-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:overflow-hidden data-closed:fade-out-0 data-closed:zoom-out-95",B),...Q})})})}function O9({...$}){return s2.jsx(f4.Group,{"data-slot":"dropdown-menu-group",...$})}function zK({className:$,inset:Z,...J}){return s2.jsx(f4.GroupLabel,{"data-slot":"dropdown-menu-label","data-inset":Z,className:d0("px-2 pt-1.5 pb-0.5 text-xs text-muted-foreground data-inset:ps-7",$),...J})}function B8({className:$,inset:Z,variant:J="default",...H}){return s2.jsx(f4.Item,{"data-slot":"dropdown-menu-item","data-inset":Z,"data-variant":J,className:d0("group/dropdown-menu-item relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:ps-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive",$),...H})}function Rh({...$}){return s2.jsx(f4.RadioGroup,{"data-slot":"dropdown-menu-radio-group",...$})}function Ih({className:$,children:Z,inset:J,...H}){return s2.jsxs(f4.RadioItem,{"data-slot":"dropdown-menu-radio-item","data-inset":J,className:d0("relative flex cursor-default items-center gap-2 rounded-md py-1 ps-2 pe-8 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:ps-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",$),...H,children:[s2.jsx("span",{className:"pointer-events-none absolute end-2 flex items-center justify-center","data-slot":"dropdown-menu-radio-item-indicator",children:s2.jsx(f4.RadioItemIndicator,{children:s2.jsx(i8,{stroke:1.75})})}),Z]})}function dL({className:$,...Z}){return s2.jsx(f4.Separator,{"data-slot":"dropdown-menu-separator",className:d0("mx-2 my-1 h-px bg-border",$),...Z})}var x5=P(u(),1),g30="https://mlfrg.notion.site/3c678a44b6788042b734d775dd2e935e?pvs=105";function xh(){let $=U3();if($.status==="loading")return x5.jsx("div",{className:"flex size-10 items-center justify-center",children:x5.jsx(V4,{className:"size-8 rounded-full","aria-label":"Loading account"})});if($.status==="error")return null;if($.status==="signed-out"||!$.profile)return null;return x5.jsxs(r8,{children:[x5.jsx(a8,{render:x5.jsx(L0,{variant:"ghost",size:"icon-lg","aria-label":"User menu"}),children:x5.jsx(o3,{profile:$.profile,size:"sm"})}),x5.jsxs(o8,{side:"right",align:"end",sideOffset:8,className:"w-52",children:[x5.jsx("div",{className:"px-2 py-1",children:x5.jsx(IJ,{profile:$.profile,size:"sm",description:$.cloud?$.profile.name?.trim()?$.email:void 0:"This computer"})}),x5.jsx(dL,{}),x5.jsxs(O9,{children:[x5.jsxs(B8,{render:x5.jsx("a",{href:g30,target:"_blank",rel:"noreferrer"}),children:[x5.jsx(yh,{stroke:1.75}),"Leave feedback"]}),x5.jsxs(B8,{render:x5.jsx(v3,{href:"/settings"}),children:[x5.jsx(F3,{stroke:1.75}),"Settings"]})]}),$.registered&&x5.jsxs(x5.Fragment,{children:[x5.jsx(dL,{}),x5.jsx(O9,{children:x5.jsxs(B8,{disabled:$.signOut.isPending,onClick:()=>$.signOut.mutate(void 0,{onError:(Z)=>T1.add({title:"Couldn’t sign out",description:Z.message,type:"error"})}),children:[x5.jsx(kh,{stroke:1.75}),"Sign out"]})})]})]})]})}var j7=P(m(),1);var V0=P(m(),1),t$=P(A8(),1);var A2=P(m(),1);var iQ=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function a$($){let Z=Object.prototype.toString.call($);return Z==="[object Window]"||Z==="[object global]"}function GK($){return"nodeType"in $}function _4($){var Z,J;if(!$)return window;if(a$($))return $;if(!GK($))return window;return(Z=(J=$.ownerDocument)==null?void 0:J.defaultView)!=null?Z:window}function UK($){let{Document:Z}=_4($);return $ instanceof Z}function XH($){if(a$($))return!1;return $ instanceof _4($).HTMLElement}function iL($){return $ instanceof _4($).SVGElement}function o$($){if(!$)return document;if(a$($))return $.document;if(!GK($))return document;if(UK($))return $;if(XH($)||iL($))return $.ownerDocument;return document}var V3=iQ?A2.useLayoutEffect:A2.useEffect;function rQ($){let Z=A2.useRef($);return V3(()=>{Z.current=$}),A2.useCallback(function(){for(var J=arguments.length,H=Array(J),B=0;B<J;B++)H[B]=arguments[B];return Z.current==null?void 0:Z.current(...H)},[])}function vh(){let $=A2.useRef(null),Z=A2.useCallback((H,B)=>{$.current=setInterval(H,B)},[]),J=A2.useCallback(()=>{if($.current!==null)clearInterval($.current),$.current=null},[]);return[Z,J]}function zH($,Z){if(Z===void 0)Z=[$];let J=A2.useRef($);return V3(()=>{if(J.current!==$)J.current=$},Z),J}function GH($,Z){let J=A2.useRef();return A2.useMemo(()=>{let H=$(J.current);return J.current=H,H},[...Z])}function aQ($){let Z=rQ($),J=A2.useRef(null),H=A2.useCallback((B)=>{if(B!==J.current)Z==null||Z(B,J.current);J.current=B},[]);return[J,H]}function oQ($){let Z=A2.useRef();return A2.useEffect(()=>{Z.current=$},[$]),Z.current}var lL={};function nQ($,Z){return A2.useMemo(()=>{if(Z)return Z;let J=lL[$]==null?0:lL[$]+1;return lL[$]=J,$+"-"+J},[$,Z])}function fh($){return function(Z){for(var J=arguments.length,H=Array(J>1?J-1:0),B=1;B<J;B++)H[B-1]=arguments[B];return H.reduce((Q,X)=>{let z=Object.entries(X);for(let[G,U]of z){let Y=Q[G];if(Y!=null)Q[G]=Y+$*U}return Q},{...Z})}}var n$=fh(1),sQ=fh(-1);function m30($){return"clientX"in $&&"clientY"in $}function YK($){if(!$)return!1;let{KeyboardEvent:Z}=_4($.target);return Z&&$ instanceof Z}function u30($){if(!$)return!1;let{TouchEvent:Z}=_4($.target);return Z&&$ instanceof Z}function tQ($){if(u30($)){if($.touches&&$.touches.length){let{clientX:Z,clientY:J}=$.touches[0];return{x:Z,y:J}}else if($.changedTouches&&$.changedTouches.length){let{clientX:Z,clientY:J}=$.changedTouches[0];return{x:Z,y:J}}}if(m30($))return{x:$.clientX,y:$.clientY};return null}var QH=Object.freeze({Translate:{toString($){if(!$)return;let{x:Z,y:J}=$;return"translate3d("+(Z?Math.round(Z):0)+"px, "+(J?Math.round(J):0)+"px, 0)"}},Scale:{toString($){if(!$)return;let{scaleX:Z,scaleY:J}=$;return"scaleX("+Z+") scaleY("+J+")"}},Transform:{toString($){if(!$)return;return[QH.Translate.toString($),QH.Scale.toString($)].join(" ")}},Transition:{toString($){let{property:Z,duration:J,easing:H}=$;return Z+" "+J+"ms "+H}}}),hh="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function gh($){if($.matches(hh))return $;return $.querySelector(hh)}var s$=P(m(),1),p30={display:"none"};function mh($){let{id:Z,value:J}=$;return s$.default.createElement("div",{id:Z,style:p30},J)}function uh($){let{id:Z,announcement:J,ariaLiveType:H="assertive"}=$,B={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return s$.default.createElement("div",{id:Z,style:B,role:"status","aria-live":H,"aria-atomic":!0},J)}function ph(){let[$,Z]=s$.useState("");return{announce:s$.useCallback((H)=>{if(H!=null)Z(H)},[]),announcement:$}}var Zv=V0.createContext(null);function c30($){let Z=V0.useContext(Zv);V0.useEffect(()=>{if(!Z)throw Error("useDndMonitor must be used within a children of <DndContext>");return Z($)},[$,Z])}function d30(){let[$]=V0.useState(()=>new Set),Z=V0.useCallback((H)=>{return $.add(H),()=>$.delete(H)},[$]);return[V0.useCallback((H)=>{let{type:B,event:Q}=H;$.forEach((X)=>{var z;return(z=X[B])==null?void 0:z.call(X,Q)})},[$]),Z]}var l30={draggable:`
|
|
15
|
+
To pick up a draggable item, press the space bar.
|
|
16
|
+
While dragging, use the arrow keys to move the item.
|
|
17
|
+
Press space again to drop the item in its new position, or press escape to cancel.
|
|
18
|
+
`},i30={onDragStart($){let{active:Z}=$;return"Picked up draggable item "+Z.id+"."},onDragOver($){let{active:Z,over:J}=$;if(J)return"Draggable item "+Z.id+" was moved over droppable area "+J.id+".";return"Draggable item "+Z.id+" is no longer over a droppable area."},onDragEnd($){let{active:Z,over:J}=$;if(J)return"Draggable item "+Z.id+" was dropped over droppable area "+J.id;return"Draggable item "+Z.id+" was dropped."},onDragCancel($){let{active:Z}=$;return"Dragging was cancelled. Draggable item "+Z.id+" was dropped."}};function r30($){let{announcements:Z=i30,container:J,hiddenTextDescribedById:H,screenReaderInstructions:B=l30}=$,{announce:Q,announcement:X}=ph(),z=nQ("DndLiveRegion"),[G,U]=V0.useState(!1);if(V0.useEffect(()=>{U(!0)},[]),c30(V0.useMemo(()=>({onDragStart(F){let{active:K}=F;Q(Z.onDragStart({active:K}))},onDragMove(F){let{active:K,over:W}=F;if(Z.onDragMove)Q(Z.onDragMove({active:K,over:W}))},onDragOver(F){let{active:K,over:W}=F;Q(Z.onDragOver({active:K,over:W}))},onDragEnd(F){let{active:K,over:W}=F;Q(Z.onDragEnd({active:K,over:W}))},onDragCancel(F){let{active:K,over:W}=F;Q(Z.onDragCancel({active:K,over:W}))}}),[Q,Z])),!G)return null;let Y=V0.default.createElement(V0.default.Fragment,null,V0.default.createElement(mh,{id:H,value:B.draggable}),V0.default.createElement(uh,{id:z,announcement:X}));return J?t$.createPortal(Y,J):Y}var O2;(function($){$.DragStart="dragStart",$.DragMove="dragMove",$.DragEnd="dragEnd",$.DragCancel="dragCancel",$.DragOver="dragOver",$.RegisterDroppable="registerDroppable",$.SetDroppableDisabled="setDroppableDisabled",$.UnregisterDroppable="unregisterDroppable"})(O2||(O2={}));function KK(){}function eL($,Z){return V0.useMemo(()=>({sensor:$,options:Z!=null?Z:{}}),[$,Z])}function Jv(){for(var $=arguments.length,Z=Array($),J=0;J<$;J++)Z[J]=arguments[J];return V0.useMemo(()=>[...Z].filter((H)=>H!=null),[...Z])}var T9=Object.freeze({x:0,y:0});function a30($,Z){return Math.sqrt(Math.pow($.x-Z.x,2)+Math.pow($.y-Z.y,2))}function o30($,Z){let J=tQ($);if(!J)return"0 0";let H={x:(J.x-Z.left)/Z.width*100,y:(J.y-Z.top)/Z.height*100};return H.x+"% "+H.y+"%"}function n30($,Z){let{data:{value:J}}=$,{data:{value:H}}=Z;return J-H}function s30($,Z){let{data:{value:J}}=$,{data:{value:H}}=Z;return H-J}function t30($,Z){if(!$||$.length===0)return null;let[J]=$;return Z?J[Z]:J}function ch($,Z,J){if(Z===void 0)Z=$.left;if(J===void 0)J=$.top;return{x:Z+$.width*0.5,y:J+$.height*0.5}}var Hv=($)=>{let{collisionRect:Z,droppableRects:J,droppableContainers:H}=$,B=ch(Z,Z.left,Z.top),Q=[];for(let X of H){let{id:z}=X,G=J.get(z);if(G){let U=a30(ch(G),B);Q.push({id:z,data:{droppableContainer:X,value:U}})}}return Q.sort(n30)};function e30($,Z){let J=Math.max(Z.top,$.top),H=Math.max(Z.left,$.left),B=Math.min(Z.left+Z.width,$.left+$.width),Q=Math.min(Z.top+Z.height,$.top+$.height),X=B-H,z=Q-J;if(H<B&&J<Q){let G=Z.width*Z.height,U=$.width*$.height,Y=X*z,F=Y/(G+U-Y);return Number(F.toFixed(4))}return 0}var $60=($)=>{let{collisionRect:Z,droppableRects:J,droppableContainers:H}=$,B=[];for(let Q of H){let{id:X}=Q,z=J.get(X);if(z){let G=e30(z,Z);if(G>0)B.push({id:X,data:{droppableContainer:Q,value:G}})}}return B.sort(s30)};function Z60($,Z,J){return{...$,scaleX:Z&&J?Z.width/J.width:1,scaleY:Z&&J?Z.height/J.height:1}}function Bv($,Z){return $&&Z?{x:$.left-Z.left,y:$.top-Z.top}:T9}function J60($){return function(J){for(var H=arguments.length,B=Array(H>1?H-1:0),Q=1;Q<H;Q++)B[Q-1]=arguments[Q];return B.reduce((X,z)=>({...X,top:X.top+$*z.y,bottom:X.bottom+$*z.y,left:X.left+$*z.x,right:X.right+$*z.x}),{...J})}}var H60=J60(1);function Qv($){if($.startsWith("matrix3d(")){let Z=$.slice(9,-1).split(/, /);return{x:+Z[12],y:+Z[13],scaleX:+Z[0],scaleY:+Z[5]}}else if($.startsWith("matrix(")){let Z=$.slice(7,-1).split(/, /);return{x:+Z[4],y:+Z[5],scaleX:+Z[0],scaleY:+Z[3]}}return null}function B60($,Z,J){let H=Qv(Z);if(!H)return $;let{scaleX:B,scaleY:Q,x:X,y:z}=H,G=$.left-X-(1-B)*parseFloat(J),U=$.top-z-(1-Q)*parseFloat(J.slice(J.indexOf(" ")+1)),Y=B?$.width/B:$.width,F=Q?$.height/Q:$.height;return{width:Y,height:F,top:U,right:G+Y,bottom:U+F,left:G}}var Q60={ignoreTransform:!1};function ZX($,Z){if(Z===void 0)Z=Q60;let J=$.getBoundingClientRect();if(Z.ignoreTransform){let{transform:U,transformOrigin:Y}=_4($).getComputedStyle($);if(U)J=B60(J,U,Y)}let{top:H,left:B,width:Q,height:X,bottom:z,right:G}=J;return{top:H,left:B,width:Q,height:X,bottom:z,right:G}}function dh($){return ZX($,{ignoreTransform:!0})}function X60($){let{innerWidth:Z,innerHeight:J}=$;return{top:0,left:0,right:Z,bottom:J,width:Z,height:J}}function z60($,Z){if(Z===void 0)Z=_4($).getComputedStyle($);return Z.position==="fixed"}function G60($,Z){if(Z===void 0)Z=_4($).getComputedStyle($);let J=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some((B)=>{let Q=Z[B];return typeof Q==="string"?J.test(Q):!1})}function $M($,Z){let J=[];function H(B){if(Z!=null&&J.length>=Z)return J;if(!B)return J;if(UK(B)&&B.scrollingElement!=null&&!J.includes(B.scrollingElement))return J.push(B.scrollingElement),J;if(!XH(B)||iL(B))return J;if(J.includes(B))return J;let Q=_4($).getComputedStyle(B);if(B!==$){if(G60(B,Q))J.push(B)}if(z60(B,Q))return J;return H(B.parentNode)}if(!$)return J;return H($)}function Xv($){let[Z]=$M($,1);return Z!=null?Z:null}function rL($){if(!iQ||!$)return null;if(a$($))return $;if(!GK($))return null;if(UK($)||$===o$($).scrollingElement)return window;if(XH($))return $;return null}function zv($){if(a$($))return $.scrollX;return $.scrollLeft}function Gv($){if(a$($))return $.scrollY;return $.scrollTop}function nL($){return{x:zv($),y:Gv($)}}var m2;(function($){$[$.Forward=1]="Forward",$[$.Backward=-1]="Backward"})(m2||(m2={}));function Uv($){if(!iQ||!$)return!1;return $===document.scrollingElement}function Yv($){let Z={x:0,y:0},J=Uv($)?{height:window.innerHeight,width:window.innerWidth}:{height:$.clientHeight,width:$.clientWidth},H={x:$.scrollWidth-J.width,y:$.scrollHeight-J.height},B=$.scrollTop<=Z.y,Q=$.scrollLeft<=Z.x,X=$.scrollTop>=H.y,z=$.scrollLeft>=H.x;return{isTop:B,isLeft:Q,isBottom:X,isRight:z,maxScroll:H,minScroll:Z}}var U60={x:0.2,y:0.2};function Y60($,Z,J,H,B){let{top:Q,left:X,right:z,bottom:G}=J;if(H===void 0)H=10;if(B===void 0)B=U60;let{isTop:U,isBottom:Y,isLeft:F,isRight:K}=Yv($),W={x:0,y:0},N={x:0,y:0},q={height:Z.height*B.y,width:Z.width*B.x};if(!U&&Q<=Z.top+q.height)W.y=m2.Backward,N.y=H*Math.abs((Z.top+q.height-Q)/q.height);else if(!Y&&G>=Z.bottom-q.height)W.y=m2.Forward,N.y=H*Math.abs((Z.bottom-q.height-G)/q.height);if(!K&&z>=Z.right-q.width)W.x=m2.Forward,N.x=H*Math.abs((Z.right-q.width-z)/q.width);else if(!F&&X<=Z.left+q.width)W.x=m2.Backward,N.x=H*Math.abs((Z.left+q.width-X)/q.width);return{direction:W,speed:N}}function F60($){if($===document.scrollingElement){let{innerWidth:Q,innerHeight:X}=window;return{top:0,left:0,right:Q,bottom:X,width:Q,height:X}}let{top:Z,left:J,right:H,bottom:B}=$.getBoundingClientRect();return{top:Z,left:J,right:H,bottom:B,width:$.clientWidth,height:$.clientHeight}}function Fv($){return $.reduce((Z,J)=>{return n$(Z,nL(J))},T9)}function K60($){return $.reduce((Z,J)=>{return Z+zv(J)},0)}function W60($){return $.reduce((Z,J)=>{return Z+Gv(J)},0)}function Kv($,Z){if(Z===void 0)Z=ZX;if(!$)return;let{top:J,left:H,bottom:B,right:Q}=Z($);if(!Xv($))return;if(B<=0||Q<=0||J>=window.innerHeight||H>=window.innerWidth)$.scrollIntoView({block:"center",inline:"center"})}var N60=[["x",["left","right"],K60],["y",["top","bottom"],W60]];class NK{constructor($,Z){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;let J=$M(Z),H=Fv(J);this.rect={...$},this.width=$.width,this.height=$.height;for(let[B,Q,X]of N60)for(let z of Q)Object.defineProperty(this,z,{get:()=>{let G=X(J),U=H[B]-G;return this.rect[z]+U},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class UH{constructor($){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach((Z)=>{var J;return(J=this.target)==null?void 0:J.removeEventListener(...Z)})},this.target=$}add($,Z,J){var H;(H=this.target)==null||H.addEventListener($,Z,J),this.listeners.push([$,Z,J])}}function q60($){let{EventTarget:Z}=_4($);return $ instanceof Z?$:o$($)}function aL($,Z){let J=Math.abs($.x),H=Math.abs($.y);if(typeof Z==="number")return Math.sqrt(J**2+H**2)>Z;if("x"in Z&&"y"in Z)return J>Z.x&&H>Z.y;if("x"in Z)return J>Z.x;if("y"in Z)return H>Z.y;return!1}var n8;(function($){$.Click="click",$.DragStart="dragstart",$.Keydown="keydown",$.ContextMenu="contextmenu",$.Resize="resize",$.SelectionChange="selectionchange",$.VisibilityChange="visibilitychange"})(n8||(n8={}));function lh($){$.preventDefault()}function A60($){$.stopPropagation()}var X5;(function($){$.Space="Space",$.Down="ArrowDown",$.Right="ArrowRight",$.Left="ArrowLeft",$.Up="ArrowUp",$.Esc="Escape",$.Enter="Enter",$.Tab="Tab"})(X5||(X5={}));var Wv={start:[X5.Space,X5.Enter],cancel:[X5.Esc],end:[X5.Space,X5.Enter,X5.Tab]},D60=($,Z)=>{let{currentCoordinates:J}=Z;switch($.code){case X5.Right:return{...J,x:J.x+25};case X5.Left:return{...J,x:J.x-25};case X5.Down:return{...J,y:J.y+25};case X5.Up:return{...J,y:J.y-25}}return};class JX{constructor($){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=$;let{event:{target:Z}}=$;this.props=$,this.listeners=new UH(o$(Z)),this.windowListeners=new UH(_4(Z)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(n8.Resize,this.handleCancel),this.windowListeners.add(n8.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(n8.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:$,onStart:Z}=this.props,J=$.node.current;if(J)Kv(J);Z(T9)}handleKeyDown($){if(YK($)){let{active:Z,context:J,options:H}=this.props,{keyboardCodes:B=Wv,coordinateGetter:Q=D60,scrollBehavior:X="smooth"}=H,{code:z}=$;if(B.end.includes(z)){this.handleEnd($);return}if(B.cancel.includes(z)){this.handleCancel($);return}let{collisionRect:G}=J.current,U=G?{x:G.left,y:G.top}:T9;if(!this.referenceCoordinates)this.referenceCoordinates=U;let Y=Q($,{active:Z,context:J.current,currentCoordinates:U});if(Y){let F=sQ(Y,U),K={x:0,y:0},{scrollableAncestors:W}=J.current;for(let N of W){let q=$.code,{isTop:D,isRight:A,isLeft:V,isBottom:L,maxScroll:O,minScroll:M}=Yv(N),_=F60(N),w={x:Math.min(q===X5.Right?_.right-_.width/2:_.right,Math.max(q===X5.Right?_.left:_.left+_.width/2,Y.x)),y:Math.min(q===X5.Down?_.bottom-_.height/2:_.bottom,Math.max(q===X5.Down?_.top:_.top+_.height/2,Y.y))},C=q===X5.Right&&!A||q===X5.Left&&!V,E=q===X5.Down&&!L||q===X5.Up&&!D;if(C&&w.x!==Y.x){let T=N.scrollLeft+F.x,k=q===X5.Right&&T<=O.x||q===X5.Left&&T>=M.x;if(k&&!F.y){N.scrollTo({left:T,behavior:X});return}if(k)K.x=N.scrollLeft-T;else K.x=q===X5.Right?N.scrollLeft-O.x:N.scrollLeft-M.x;if(K.x)N.scrollBy({left:-K.x,behavior:X});break}else if(E&&w.y!==Y.y){let T=N.scrollTop+F.y,k=q===X5.Down&&T<=O.y||q===X5.Up&&T>=M.y;if(k&&!F.x){N.scrollTo({top:T,behavior:X});return}if(k)K.y=N.scrollTop-T;else K.y=q===X5.Down?N.scrollTop-O.y:N.scrollTop-M.y;if(K.y)N.scrollBy({top:-K.y,behavior:X});break}}this.handleMove($,n$(sQ(Y,this.referenceCoordinates),K))}}}handleMove($,Z){let{onMove:J}=this.props;$.preventDefault(),J(Z)}handleEnd($){let{onEnd:Z}=this.props;$.preventDefault(),this.detach(),Z()}handleCancel($){let{onCancel:Z}=this.props;$.preventDefault(),this.detach(),Z()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}JX.activators=[{eventName:"onKeyDown",handler:($,Z,J)=>{let{keyboardCodes:H=Wv,onActivation:B}=Z,{active:Q}=J,{code:X}=$.nativeEvent;if(H.start.includes(X)){let z=Q.activatorNode.current;if(z&&$.target!==z)return!1;return $.preventDefault(),B==null||B({event:$.nativeEvent}),!0}return!1}}];function ih($){return Boolean($&&"distance"in $)}function rh($){return Boolean($&&"delay"in $)}class qK{constructor($,Z,J){var H;if(J===void 0)J=q60($.event.target);this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=$,this.events=Z;let{event:B}=$,{target:Q}=B;this.props=$,this.events=Z,this.document=o$(Q),this.documentListeners=new UH(this.document),this.listeners=new UH(J),this.windowListeners=new UH(_4(Q)),this.initialCoordinates=(H=tQ(B))!=null?H:T9,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){let{events:$,props:{options:{activationConstraint:Z,bypassActivationConstraint:J}}}=this;if(this.listeners.add($.move.name,this.handleMove,{passive:!1}),this.listeners.add($.end.name,this.handleEnd),$.cancel)this.listeners.add($.cancel.name,this.handleCancel);if(this.windowListeners.add(n8.Resize,this.handleCancel),this.windowListeners.add(n8.DragStart,lh),this.windowListeners.add(n8.VisibilityChange,this.handleCancel),this.windowListeners.add(n8.ContextMenu,lh),this.documentListeners.add(n8.Keydown,this.handleKeydown),Z){if(J!=null&&J({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(rh(Z)){this.timeoutId=setTimeout(this.handleStart,Z.delay),this.handlePending(Z);return}if(ih(Z)){this.handlePending(Z);return}}this.handleStart()}detach(){if(this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null)clearTimeout(this.timeoutId),this.timeoutId=null}handlePending($,Z){let{active:J,onPending:H}=this.props;H(J,$,this.initialCoordinates,Z)}handleStart(){let{initialCoordinates:$}=this,{onStart:Z}=this.props;if($)this.activated=!0,this.documentListeners.add(n8.Click,A60,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(n8.SelectionChange,this.removeTextSelection),Z($)}handleMove($){var Z;let{activated:J,initialCoordinates:H,props:B}=this,{onMove:Q,options:{activationConstraint:X}}=B;if(!H)return;let z=(Z=tQ($))!=null?Z:T9,G=sQ(H,z);if(!J&&X){if(ih(X)){if(X.tolerance!=null&&aL(G,X.tolerance))return this.handleCancel();if(aL(G,X.distance))return this.handleStart()}if(rh(X)){if(aL(G,X.tolerance))return this.handleCancel()}this.handlePending(X,G);return}if($.cancelable)$.preventDefault();Q(z)}handleEnd(){let{onAbort:$,onEnd:Z}=this.props;if(this.detach(),!this.activated)$(this.props.active);Z()}handleCancel(){let{onAbort:$,onCancel:Z}=this.props;if(this.detach(),!this.activated)$(this.props.active);Z()}handleKeydown($){if($.code===X5.Esc)this.handleCancel()}removeTextSelection(){var $;($=this.document.getSelection())==null||$.removeAllRanges()}}var V60={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class HX extends qK{constructor($){let{event:Z}=$,J=o$(Z.target);super($,V60,J)}}HX.activators=[{eventName:"onPointerDown",handler:($,Z)=>{let{nativeEvent:J}=$,{onActivation:H}=Z;if(!J.isPrimary||J.button!==0)return!1;return H==null||H({event:J}),!0}}];var L60={move:{name:"mousemove"},end:{name:"mouseup"}},sL;(function($){$[$.RightClick=2]="RightClick"})(sL||(sL={}));class Nv extends qK{constructor($){super($,L60,o$($.event.target))}}Nv.activators=[{eventName:"onMouseDown",handler:($,Z)=>{let{nativeEvent:J}=$,{onActivation:H}=Z;if(J.button===sL.RightClick)return!1;return H==null||H({event:J}),!0}}];var oL={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class qv extends qK{constructor($){super($,oL)}static setup(){return window.addEventListener(oL.move.name,$,{capture:!1,passive:!1}),function(){window.removeEventListener(oL.move.name,$)};function $(){}}}qv.activators=[{eventName:"onTouchStart",handler:($,Z)=>{let{nativeEvent:J}=$,{onActivation:H}=Z,{touches:B}=J;if(B.length>1)return!1;return H==null||H({event:J}),!0}}];var eQ;(function($){$[$.Pointer=0]="Pointer",$[$.DraggableRect=1]="DraggableRect"})(eQ||(eQ={}));var WK;(function($){$[$.TreeOrder=0]="TreeOrder",$[$.ReversedTreeOrder=1]="ReversedTreeOrder"})(WK||(WK={}));function M60($){let{acceleration:Z,activator:J=eQ.Pointer,canScroll:H,draggingRect:B,enabled:Q,interval:X=5,order:z=WK.TreeOrder,pointerCoordinates:G,scrollableAncestors:U,scrollableAncestorRects:Y,delta:F,threshold:K}=$,W=_60({delta:F,disabled:!Q}),[N,q]=vh(),D=V0.useRef({x:0,y:0}),A=V0.useRef({x:0,y:0}),V=V0.useMemo(()=>{switch(J){case eQ.Pointer:return G?{top:G.y,bottom:G.y,left:G.x,right:G.x}:null;case eQ.DraggableRect:return B}},[J,B,G]),L=V0.useRef(null),O=V0.useCallback(()=>{let _=L.current;if(!_)return;let w=D.current.x*A.current.x,C=D.current.y*A.current.y;_.scrollBy(w,C)},[]),M=V0.useMemo(()=>z===WK.TreeOrder?[...U].reverse():U,[z,U]);V0.useEffect(()=>{if(!Q||!U.length||!V){q();return}for(let _ of M){if((H==null?void 0:H(_))===!1)continue;let w=U.indexOf(_),C=Y[w];if(!C)continue;let{direction:E,speed:T}=Y60(_,C,V,Z,K);for(let k of["x","y"])if(!W[k][E[k]])T[k]=0,E[k]=0;if(T.x>0||T.y>0){q(),L.current=_,N(O,X),D.current=T,A.current=E;return}}D.current={x:0,y:0},A.current={x:0,y:0},q()},[Z,O,H,q,Q,X,JSON.stringify(V),JSON.stringify(W),N,U,M,Y,JSON.stringify(K)])}var P60={x:{[m2.Backward]:!1,[m2.Forward]:!1},y:{[m2.Backward]:!1,[m2.Forward]:!1}};function _60($){let{delta:Z,disabled:J}=$,H=oQ(Z);return GH((B)=>{if(J||!H||!B)return P60;let Q={x:Math.sign(Z.x-H.x),y:Math.sign(Z.y-H.y)};return{x:{[m2.Backward]:B.x[m2.Backward]||Q.x===-1,[m2.Forward]:B.x[m2.Forward]||Q.x===1},y:{[m2.Backward]:B.y[m2.Backward]||Q.y===-1,[m2.Forward]:B.y[m2.Forward]||Q.y===1}}},[J,Z,H])}function O60($,Z){let J=Z!=null?$.get(Z):void 0,H=J?J.node.current:null;return GH((B)=>{var Q;if(Z==null)return null;return(Q=H!=null?H:B)!=null?Q:null},[H,Z])}function T60($,Z){return V0.useMemo(()=>$.reduce((J,H)=>{let{sensor:B}=H,Q=B.activators.map((X)=>({eventName:X.eventName,handler:Z(X.handler,H)}));return[...J,...Q]},[]),[$,Z])}var $X;(function($){$[$.Always=0]="Always",$[$.BeforeDragging=1]="BeforeDragging",$[$.WhileDragging=2]="WhileDragging"})($X||($X={}));var tL;(function($){$.Optimized="optimized"})(tL||(tL={}));var ah=new Map;function j60($,Z){let{dragging:J,dependencies:H,config:B}=Z,[Q,X]=V0.useState(null),{frequency:z,measure:G,strategy:U}=B,Y=V0.useRef($),F=D(),K=zH(F),W=V0.useCallback(function(A){if(A===void 0)A=[];if(K.current)return;X((V)=>{if(V===null)return A;return V.concat(A.filter((L)=>!V.includes(L)))})},[K]),N=V0.useRef(null),q=GH((A)=>{if(F&&!J)return ah;if(!A||A===ah||Y.current!==$||Q!=null){let V=new Map;for(let L of $){if(!L)continue;if(Q&&Q.length>0&&!Q.includes(L.id)&&L.rect.current){V.set(L.id,L.rect.current);continue}let O=L.node.current,M=O?new NK(G(O),O):null;if(L.rect.current=M,M)V.set(L.id,M)}return V}return A},[$,Q,J,F,G]);return V0.useEffect(()=>{Y.current=$},[$]),V0.useEffect(()=>{if(F)return;W()},[J,F]),V0.useEffect(()=>{if(Q&&Q.length>0)X(null)},[JSON.stringify(Q)]),V0.useEffect(()=>{if(F||typeof z!=="number"||N.current!==null)return;N.current=setTimeout(()=>{W(),N.current=null},z)},[z,F,W,...H]),{droppableRects:q,measureDroppableContainers:W,measuringScheduled:Q!=null};function D(){switch(U){case $X.Always:return!1;case $X.BeforeDragging:return J;default:return!J}}}function ZM($,Z){return GH((J)=>{if(!$)return null;if(J)return J;return typeof Z==="function"?Z($):$},[Z,$])}function C60($,Z){return ZM($,Z)}function E60($){let{callback:Z,disabled:J}=$,H=rQ(Z),B=V0.useMemo(()=>{if(J||typeof window>"u"||typeof window.MutationObserver>"u")return;let{MutationObserver:Q}=window;return new Q(H)},[H,J]);return V0.useEffect(()=>{return()=>B==null?void 0:B.disconnect()},[B]),B}function AK($){let{callback:Z,disabled:J}=$,H=rQ(Z),B=V0.useMemo(()=>{if(J||typeof window>"u"||typeof window.ResizeObserver>"u")return;let{ResizeObserver:Q}=window;return new Q(H)},[J]);return V0.useEffect(()=>{return()=>B==null?void 0:B.disconnect()},[B]),B}function b60($){return new NK(ZX($),$)}function oh($,Z,J){if(Z===void 0)Z=b60;let[H,B]=V0.useState(null);function Q(){B((G)=>{if(!$)return null;if($.isConnected===!1){var U;return(U=G!=null?G:J)!=null?U:null}let Y=Z($);if(JSON.stringify(G)===JSON.stringify(Y))return G;return Y})}let X=E60({callback(G){if(!$)return;for(let U of G){let{type:Y,target:F}=U;if(Y==="childList"&&F instanceof HTMLElement&&F.contains($)){Q();break}}}}),z=AK({callback:Q});return V3(()=>{if(Q(),$)z==null||z.observe($),X==null||X.observe(document.body,{childList:!0,subtree:!0});else z==null||z.disconnect(),X==null||X.disconnect()},[$]),H}function w60($){let Z=ZM($);return Bv($,Z)}var nh=[];function S60($){let Z=V0.useRef($),J=GH((H)=>{if(!$)return nh;if(H&&H!==nh&&$&&Z.current&&$.parentNode===Z.current.parentNode)return H;return $M($)},[$]);return V0.useEffect(()=>{Z.current=$},[$]),J}function R60($){let[Z,J]=V0.useState(null),H=V0.useRef($),B=V0.useCallback((Q)=>{let X=rL(Q.target);if(!X)return;J((z)=>{if(!z)return null;return z.set(X,nL(X)),new Map(z)})},[]);return V0.useEffect(()=>{let Q=H.current;if($!==Q){X(Q);let z=$.map((G)=>{let U=rL(G);if(U)return U.addEventListener("scroll",B,{passive:!0}),[U,nL(U)];return null}).filter((G)=>G!=null);J(z.length?new Map(z):null),H.current=$}return()=>{X($),X(Q)};function X(z){z.forEach((G)=>{let U=rL(G);U==null||U.removeEventListener("scroll",B)})}},[B,$]),V0.useMemo(()=>{if($.length)return Z?Array.from(Z.values()).reduce((Q,X)=>n$(Q,X),T9):Fv($);return T9},[$,Z])}function sh($,Z){if(Z===void 0)Z=[];let J=V0.useRef(null);return V0.useEffect(()=>{J.current=null},Z),V0.useEffect(()=>{let H=$!==T9;if(H&&!J.current)J.current=$;if(!H&&J.current)J.current=null},[$]),J.current?sQ($,J.current):T9}function I60($){V0.useEffect(()=>{if(!iQ)return;let Z=$.map((J)=>{let{sensor:H}=J;return H.setup==null?void 0:H.setup()});return()=>{for(let J of Z)J==null||J()}},$.map((Z)=>{let{sensor:J}=Z;return J}))}function k60($,Z){return V0.useMemo(()=>{return $.reduce((J,H)=>{let{eventName:B,handler:Q}=H;return J[B]=(X)=>{Q(X,Z)},J},{})},[$,Z])}function Av($){return V0.useMemo(()=>$?X60($):null,[$])}var th=[];function y60($,Z){if(Z===void 0)Z=ZX;let[J]=$,H=Av(J?_4(J):null),[B,Q]=V0.useState(th);function X(){Q(()=>{if(!$.length)return th;return $.map((G)=>Uv(G)?H:new NK(Z(G),G))})}let z=AK({callback:X});return V3(()=>{z==null||z.disconnect(),X(),$.forEach((G)=>z==null?void 0:z.observe(G))},[$]),B}function Dv($){if(!$)return null;if($.children.length>1)return $;let Z=$.children[0];return XH(Z)?Z:$}function x60($){let{measure:Z}=$,[J,H]=V0.useState(null),B=V0.useCallback((U)=>{for(let{target:Y}of U)if(XH(Y)){H((F)=>{let K=Z(Y);return F?{...F,width:K.width,height:K.height}:K});break}},[Z]),Q=AK({callback:B}),X=V0.useCallback((U)=>{let Y=Dv(U);if(Q==null||Q.disconnect(),Y)Q==null||Q.observe(Y);H(Y?Z(Y):null)},[Z,Q]),[z,G]=aQ(X);return V0.useMemo(()=>({nodeRef:z,rect:J,setRef:G}),[J,z,G])}var h60=[{sensor:HX,options:{}},{sensor:JX,options:{}}],v60={current:{}},FK={draggable:{measure:dh},droppable:{measure:dh,strategy:$X.WhileDragging,frequency:tL.Optimized},dragOverlay:{measure:ZX}};class YH extends Map{get($){var Z;return $!=null?(Z=super.get($))!=null?Z:void 0:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(($)=>{let{disabled:Z}=$;return!Z})}getNodeFor($){var Z,J;return(Z=(J=this.get($))==null?void 0:J.node.current)!=null?Z:void 0}}var f60={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new YH,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:KK},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:FK,measureDroppableContainers:KK,windowRect:null,measuringScheduled:!1},Vv={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:KK,draggableNodes:new Map,over:null,measureDroppableContainers:KK},BX=V0.createContext(Vv),Lv=V0.createContext(f60);function g60(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new YH}}}function m60($,Z){switch(Z.type){case O2.DragStart:return{...$,draggable:{...$.draggable,initialCoordinates:Z.initialCoordinates,active:Z.active}};case O2.DragMove:if($.draggable.active==null)return $;return{...$,draggable:{...$.draggable,translate:{x:Z.coordinates.x-$.draggable.initialCoordinates.x,y:Z.coordinates.y-$.draggable.initialCoordinates.y}}};case O2.DragEnd:case O2.DragCancel:return{...$,draggable:{...$.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case O2.RegisterDroppable:{let{element:J}=Z,{id:H}=J,B=new YH($.droppable.containers);return B.set(H,J),{...$,droppable:{...$.droppable,containers:B}}}case O2.SetDroppableDisabled:{let{id:J,key:H,disabled:B}=Z,Q=$.droppable.containers.get(J);if(!Q||H!==Q.key)return $;let X=new YH($.droppable.containers);return X.set(J,{...Q,disabled:B}),{...$,droppable:{...$.droppable,containers:X}}}case O2.UnregisterDroppable:{let{id:J,key:H}=Z,B=$.droppable.containers.get(J);if(!B||H!==B.key)return $;let Q=new YH($.droppable.containers);return Q.delete(J),{...$,droppable:{...$.droppable,containers:Q}}}default:return $}}function u60($){let{disabled:Z}=$,{active:J,activatorEvent:H,draggableNodes:B}=V0.useContext(BX),Q=oQ(H),X=oQ(J==null?void 0:J.id);return V0.useEffect(()=>{if(Z)return;if(!H&&Q&&X!=null){if(!YK(Q))return;if(document.activeElement===Q.target)return;let z=B.get(X);if(!z)return;let{activatorNode:G,node:U}=z;if(!G.current&&!U.current)return;requestAnimationFrame(()=>{for(let Y of[G.current,U.current]){if(!Y)continue;let F=gh(Y);if(F){F.focus();break}}})}},[H,Z,B,X,Q]),null}function Mv($,Z){let{transform:J,...H}=Z;return $!=null&&$.length?$.reduce((B,Q)=>{return Q({transform:B,...H})},J):J}function p60($){return V0.useMemo(()=>({draggable:{...FK.draggable,...$==null?void 0:$.draggable},droppable:{...FK.droppable,...$==null?void 0:$.droppable},dragOverlay:{...FK.dragOverlay,...$==null?void 0:$.dragOverlay}}),[$==null?void 0:$.draggable,$==null?void 0:$.droppable,$==null?void 0:$.dragOverlay])}function c60($){let{activeNode:Z,measure:J,initialRect:H,config:B=!0}=$,Q=V0.useRef(!1),{x:X,y:z}=typeof B==="boolean"?{x:B,y:B}:B;V3(()=>{if(!X&&!z||!Z){Q.current=!1;return}if(Q.current||!H)return;let U=Z==null?void 0:Z.node.current;if(!U||U.isConnected===!1)return;let Y=J(U),F=Bv(Y,H);if(!X)F.x=0;if(!z)F.y=0;if(Q.current=!0,Math.abs(F.x)>0||Math.abs(F.y)>0){let K=Xv(U);if(K)K.scrollBy({top:F.y,left:F.x})}},[Z,X,z,H,J])}var DK=V0.createContext({...T9,scaleX:1,scaleY:1}),T7;(function($){$[$.Uninitialized=0]="Uninitialized",$[$.Initializing=1]="Initializing",$[$.Initialized=2]="Initialized"})(T7||(T7={}));var Pv=V0.memo(function(Z){var J,H,B,Q;let{id:X,accessibility:z,autoScroll:G=!0,children:U,sensors:Y=h60,collisionDetection:F=$60,measuring:K,modifiers:W,...N}=Z,q=V0.useReducer(m60,void 0,g60),[D,A]=q,[V,L]=d30(),[O,M]=V0.useState(T7.Uninitialized),_=O===T7.Initialized,{draggable:{active:w,nodes:C,translate:E},droppable:{containers:T}}=D,k=w!=null?C.get(w):null,S=V0.useRef({initial:null,translated:null}),I=V0.useMemo(()=>{var C0;return w!=null?{id:w,data:(C0=k==null?void 0:k.data)!=null?C0:v60,rect:S}:null},[w,k]),j=V0.useRef(null),[y,R]=V0.useState(null),[x,v]=V0.useState(null),f=zH(N,Object.values(N)),b=nQ("DndDescribedBy",X),l=V0.useMemo(()=>T.getEnabled(),[T]),r=p60(K),{droppableRects:h,measureDroppableContainers:d,measuringScheduled:o}=j60(l,{dragging:_,dependencies:[E.x,E.y],config:r.droppable}),c=O60(C,w),i=V0.useMemo(()=>x?tQ(x):null,[x]),n=U5(),Z0=C60(c,r.draggable.measure);c60({activeNode:w!=null?C.get(w):null,config:n.layoutShiftCompensation,initialRect:Z0,measure:r.draggable.measure});let J0=oh(c,r.draggable.measure,Z0),U0=oh(c?c.parentElement:null),z0=V0.useRef({activatorEvent:null,active:null,activeNode:c,collisionRect:null,collisions:null,droppableRects:h,draggableNodes:C,draggingNode:null,draggingNodeRect:null,droppableContainers:T,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),X0=T.getNodeFor((J=z0.current.over)==null?void 0:J.id),N0=x60({measure:r.dragOverlay.measure}),q0=(H=N0.nodeRef.current)!=null?H:c,K0=_?(B=N0.rect)!=null?B:J0:null,s=Boolean(N0.nodeRef.current&&N0.rect),a=w60(s?null:J0),$0=Av(q0?_4(q0):null),t=S60(_?X0!=null?X0:c:null),B0=y60(t),_0=Mv(W,{transform:{x:E.x-a.x,y:E.y-a.y,scaleX:1,scaleY:1},activatorEvent:x,active:I,activeNodeRect:J0,containerNodeRect:U0,draggingNodeRect:K0,over:z0.current.over,overlayNodeRect:N0.rect,scrollableAncestors:t,scrollableAncestorRects:B0,windowRect:$0}),P0=i?n$(i,E):null,A0=R60(t),M0=sh(A0),g=sh(A0,[J0]),p=n$(_0,M0),e=K0?H60(K0,_0):null,W0=I&&e?F({active:I,collisionRect:e,droppableRects:h,droppableContainers:l,pointerCoordinates:P0}):null,S0=t30(W0,"id"),[h0,v0]=V0.useState(null),j0=s?_0:n$(_0,g),c0=Z60(j0,(Q=h0==null?void 0:h0.rect)!=null?Q:null,J0),z1=V0.useRef(null),A1=V0.useCallback((C0,p0)=>{let{sensor:r0,options:n0}=p0;if(j.current==null)return;let D0=C.get(j.current);if(!D0)return;let y0=C0.nativeEvent,K1=new r0({active:j.current,activeNode:D0,event:y0,options:n0,context:z0,onAbort(f0){if(!C.get(f0))return;let{onDragAbort:O1}=f.current,j1={id:f0};O1==null||O1(j1),V({type:"onDragAbort",event:j1})},onPending(f0,e0,O1,j1){if(!C.get(f0))return;let{onDragPending:$1}=f.current,i0={id:f0,constraint:e0,initialCoordinates:O1,offset:j1};$1==null||$1(i0),V({type:"onDragPending",event:i0})},onStart(f0){let e0=j.current;if(e0==null)return;let O1=C.get(e0);if(!O1)return;let{onDragStart:j1}=f.current,x0={activatorEvent:y0,active:{id:e0,data:O1.data,rect:S}};t$.unstable_batchedUpdates(()=>{j1==null||j1(x0),M(T7.Initializing),A({type:O2.DragStart,initialCoordinates:f0,active:e0}),V({type:"onDragStart",event:x0}),R(z1.current),v(y0)})},onMove(f0){A({type:O2.DragMove,coordinates:f0})},onEnd:I1(O2.DragEnd),onCancel:I1(O2.DragCancel)});z1.current=K1;function I1(f0){return async function(){let{active:O1,collisions:j1,over:x0,scrollAdjustedTranslate:$1}=z0.current,i0=null;if(O1&&$1){let{cancelDrop:P1}=f.current;if(i0={activatorEvent:y0,active:O1,collisions:j1,delta:$1,over:x0},f0===O2.DragEnd&&typeof P1==="function"){if(await Promise.resolve(P1(i0)))f0=O2.DragCancel}}j.current=null,t$.unstable_batchedUpdates(()=>{A({type:f0}),M(T7.Uninitialized),v0(null),R(null),v(null),z1.current=null;let P1=f0===O2.DragEnd?"onDragEnd":"onDragCancel";if(i0){let p1=f.current[P1];p1==null||p1(i0),V({type:P1,event:i0})}})}}},[C]),l0=V0.useCallback((C0,p0)=>{return(r0,n0)=>{let D0=r0.nativeEvent,y0=C.get(n0);if(j.current!==null||!y0||D0.dndKit||D0.defaultPrevented)return;let K1={active:y0};if(C0(r0,p0.options,K1)===!0)D0.dndKit={capturedBy:p0.sensor},j.current=n0,A1(r0,p0)}},[C,A1]),k0=T60(Y,l0);I60(Y),V3(()=>{if(J0&&O===T7.Initializing)M(T7.Initialized)},[J0,O]),V0.useEffect(()=>{let{onDragMove:C0}=f.current,{active:p0,activatorEvent:r0,collisions:n0,over:D0}=z0.current;if(!p0||!r0)return;let y0={active:p0,activatorEvent:r0,collisions:n0,delta:{x:p.x,y:p.y},over:D0};t$.unstable_batchedUpdates(()=>{C0==null||C0(y0),V({type:"onDragMove",event:y0})})},[p.x,p.y]),V0.useEffect(()=>{let{active:C0,activatorEvent:p0,collisions:r0,droppableContainers:n0,scrollAdjustedTranslate:D0}=z0.current;if(!C0||j.current==null||!p0||!D0)return;let{onDragOver:y0}=f.current,K1=n0.get(S0),I1=K1&&K1.rect.current?{id:K1.id,rect:K1.rect.current,data:K1.data,disabled:K1.disabled}:null,f0={active:C0,activatorEvent:p0,collisions:r0,delta:{x:D0.x,y:D0.y},over:I1};t$.unstable_batchedUpdates(()=>{v0(I1),y0==null||y0(f0),V({type:"onDragOver",event:f0})})},[S0]),V3(()=>{z0.current={activatorEvent:x,active:I,activeNode:c,collisionRect:e,collisions:W0,droppableRects:h,draggableNodes:C,draggingNode:q0,draggingNodeRect:K0,droppableContainers:T,over:h0,scrollableAncestors:t,scrollAdjustedTranslate:p},S.current={initial:K0,translated:e}},[I,c,W0,e,C,q0,K0,h,T,h0,t,p]),M60({...n,delta:E,draggingRect:e,pointerCoordinates:P0,scrollableAncestors:t,scrollableAncestorRects:B0});let R1=V0.useMemo(()=>{return{active:I,activeNode:c,activeNodeRect:J0,activatorEvent:x,collisions:W0,containerNodeRect:U0,dragOverlay:N0,draggableNodes:C,droppableContainers:T,droppableRects:h,over:h0,measureDroppableContainers:d,scrollableAncestors:t,scrollableAncestorRects:B0,measuringConfiguration:r,measuringScheduled:o,windowRect:$0}},[I,c,J0,x,W0,U0,N0,C,T,h,h0,d,t,B0,r,o,$0]),Y1=V0.useMemo(()=>{return{activatorEvent:x,activators:k0,active:I,activeNodeRect:J0,ariaDescribedById:{draggable:b},dispatch:A,draggableNodes:C,over:h0,measureDroppableContainers:d}},[x,k0,I,J0,A,b,C,h0,d]);return V0.default.createElement(Zv.Provider,{value:L},V0.default.createElement(BX.Provider,{value:Y1},V0.default.createElement(Lv.Provider,{value:R1},V0.default.createElement(DK.Provider,{value:c0},U)),V0.default.createElement(u60,{disabled:(z==null?void 0:z.restoreFocus)===!1})),V0.default.createElement(r30,{...z,hiddenTextDescribedById:b}));function U5(){let C0=(y==null?void 0:y.autoScrollEnabled)===!1,p0=typeof G==="object"?G.enabled===!1:G===!1,r0=_&&!C0&&!p0;if(typeof G==="object")return{...G,enabled:r0};return{enabled:r0}}}),d60=V0.createContext(null),eh="button",l60="Draggable";function _v($){let{id:Z,data:J,disabled:H=!1,attributes:B}=$,Q=nQ(l60),{activators:X,activatorEvent:z,active:G,activeNodeRect:U,ariaDescribedById:Y,draggableNodes:F,over:K}=V0.useContext(BX),{role:W=eh,roleDescription:N="draggable",tabIndex:q=0}=B!=null?B:{},D=(G==null?void 0:G.id)===Z,A=V0.useContext(D?DK:d60),[V,L]=aQ(),[O,M]=aQ(),_=k60(X,Z),w=zH(J);V3(()=>{return F.set(Z,{id:Z,key:Q,node:V,activatorNode:O,data:w}),()=>{let E=F.get(Z);if(E&&E.key===Q)F.delete(Z)}},[F,Z]);let C=V0.useMemo(()=>({role:W,tabIndex:q,"aria-disabled":H,"aria-pressed":D&&W===eh?!0:void 0,"aria-roledescription":N,"aria-describedby":Y.draggable}),[H,W,q,D,N,Y.draggable]);return{active:G,activatorEvent:z,activeNodeRect:U,attributes:C,isDragging:D,listeners:H?void 0:_,node:V,over:K,setNodeRef:L,setActivatorNodeRef:M,transform:A}}function i60(){return V0.useContext(Lv)}var r60="Droppable",a60={timeout:25};function Ov($){let{data:Z,disabled:J=!1,id:H,resizeObserverConfig:B}=$,Q=nQ(r60),{active:X,dispatch:z,over:G,measureDroppableContainers:U}=V0.useContext(BX),Y=V0.useRef({disabled:J}),F=V0.useRef(!1),K=V0.useRef(null),W=V0.useRef(null),{disabled:N,updateMeasurementsFor:q,timeout:D}={...a60,...B},A=zH(q!=null?q:H),V=V0.useCallback(()=>{if(!F.current){F.current=!0;return}if(W.current!=null)clearTimeout(W.current);W.current=setTimeout(()=>{U(Array.isArray(A.current)?A.current:[A.current]),W.current=null},D)},[D]),L=AK({callback:V,disabled:N||!X}),O=V0.useCallback((C,E)=>{if(!L)return;if(E)L.unobserve(E),F.current=!1;if(C)L.observe(C)},[L]),[M,_]=aQ(O),w=zH(Z);return V0.useEffect(()=>{if(!L||!M.current)return;L.disconnect(),F.current=!1,L.observe(M.current)},[M,L]),V0.useEffect(()=>{return z({type:O2.RegisterDroppable,element:{id:H,key:Q,disabled:J,node:M,rect:K,data:w}}),()=>z({type:O2.UnregisterDroppable,key:Q,id:H})},[H]),V0.useEffect(()=>{if(J!==Y.current.disabled)z({type:O2.SetDroppableDisabled,id:H,key:Q,disabled:J}),Y.current.disabled=J},[H,Q,J,z]),{active:X,rect:K,isOver:(G==null?void 0:G.id)===H,node:M,over:G,setNodeRef:_}}function o60($){let{animation:Z,children:J}=$,[H,B]=V0.useState(null),[Q,X]=V0.useState(null),z=oQ(J);if(!J&&!H&&z)B(z);return V3(()=>{if(!Q)return;let G=H==null?void 0:H.key,U=H==null?void 0:H.props.id;if(G==null||U==null){B(null);return}Promise.resolve(Z(U,Q)).then(()=>{B(null)})},[Z,H,Q]),V0.default.createElement(V0.default.Fragment,null,J,H?V0.cloneElement(H,{ref:X}):null)}var n60={x:0,y:0,scaleX:1,scaleY:1};function s60($){let{children:Z}=$;return V0.default.createElement(BX.Provider,{value:Vv},V0.default.createElement(DK.Provider,{value:n60},Z))}var t60={position:"fixed",touchAction:"none"},e60=($)=>{return YK($)?"transform 250ms ease":void 0},$70=V0.forwardRef(($,Z)=>{let{as:J,activatorEvent:H,adjustScale:B,children:Q,className:X,rect:z,style:G,transform:U,transition:Y=e60}=$;if(!z)return null;let F=B?U:{...U,scaleX:1,scaleY:1},K={...t60,width:z.width,height:z.height,top:z.top,left:z.left,transform:QH.Transform.toString(F),transformOrigin:B&&H?o30(H,z):void 0,transition:typeof Y==="function"?Y(H):Y,...G};return V0.default.createElement(J,{className:X,style:K,ref:Z},Q)}),Z70=($)=>(Z)=>{let{active:J,dragOverlay:H}=Z,B={},{styles:Q,className:X}=$;if(Q!=null&&Q.active)for(let[z,G]of Object.entries(Q.active)){if(G===void 0)continue;B[z]=J.node.style.getPropertyValue(z),J.node.style.setProperty(z,G)}if(Q!=null&&Q.dragOverlay)for(let[z,G]of Object.entries(Q.dragOverlay)){if(G===void 0)continue;H.node.style.setProperty(z,G)}if(X!=null&&X.active)J.node.classList.add(X.active);if(X!=null&&X.dragOverlay)H.node.classList.add(X.dragOverlay);return function(){for(let[G,U]of Object.entries(B))J.node.style.setProperty(G,U);if(X!=null&&X.active)J.node.classList.remove(X.active)}},J70=($)=>{let{transform:{initial:Z,final:J}}=$;return[{transform:QH.Transform.toString(Z)},{transform:QH.Transform.toString(J)}]},H70={duration:250,easing:"ease",keyframes:J70,sideEffects:Z70({styles:{active:{opacity:"0"}}})};function B70($){let{config:Z,draggableNodes:J,droppableContainers:H,measuringConfiguration:B}=$;return rQ((Q,X)=>{if(Z===null)return;let z=J.get(Q);if(!z)return;let G=z.node.current;if(!G)return;let U=Dv(X);if(!U)return;let{transform:Y}=_4(X).getComputedStyle(X),F=Qv(Y);if(!F)return;let K=typeof Z==="function"?Z:Q70(Z);return Kv(G,B.draggable.measure),K({active:{id:Q,data:z.data,node:G,rect:B.draggable.measure(G)},draggableNodes:J,dragOverlay:{node:X,rect:B.dragOverlay.measure(U)},droppableContainers:H,measuringConfiguration:B,transform:F})})}function Q70($){let{duration:Z,easing:J,sideEffects:H,keyframes:B}={...H70,...$};return(Q)=>{let{active:X,dragOverlay:z,transform:G,...U}=Q;if(!Z)return;let Y={x:z.rect.left-X.rect.left,y:z.rect.top-X.rect.top},F={scaleX:G.scaleX!==1?X.rect.width*G.scaleX/z.rect.width:1,scaleY:G.scaleY!==1?X.rect.height*G.scaleY/z.rect.height:1},K={x:G.x-Y.x,y:G.y-Y.y,...F},W=B({...U,active:X,dragOverlay:z,transform:{initial:G,final:K}}),[N]=W,q=W[W.length-1];if(JSON.stringify(N)===JSON.stringify(q))return;let D=H==null?void 0:H({active:X,dragOverlay:z,...U}),A=z.node.animate(W,{duration:Z,easing:J,fill:"forwards"});return new Promise((V)=>{A.onfinish=()=>{D==null||D(),V()}})}}var $v=0;function X70($){return V0.useMemo(()=>{if($==null)return;return $v++,$v},[$])}var Tv=V0.default.memo(($)=>{let{adjustScale:Z=!1,children:J,dropAnimation:H,style:B,transition:Q,modifiers:X,wrapperElement:z="div",className:G,zIndex:U=999}=$,{activatorEvent:Y,active:F,activeNodeRect:K,containerNodeRect:W,draggableNodes:N,droppableContainers:q,dragOverlay:D,over:A,measuringConfiguration:V,scrollableAncestors:L,scrollableAncestorRects:O,windowRect:M}=i60(),_=V0.useContext(DK),w=X70(F==null?void 0:F.id),C=Mv(X,{activatorEvent:Y,active:F,activeNodeRect:K,containerNodeRect:W,draggingNodeRect:D.rect,over:A,overlayNodeRect:D.rect,scrollableAncestors:L,scrollableAncestorRects:O,transform:_,windowRect:M}),E=ZM(K),T=B70({config:H,draggableNodes:N,droppableContainers:q,measuringConfiguration:V}),k=E?D.setRef:void 0;return V0.default.createElement(s60,null,V0.default.createElement(o60,{animation:T},F&&w?V0.default.createElement($70,{key:w,id:F.id,ref:k,as:z,activatorEvent:Y,adjustScale:Z,className:G,transition:Q,rect:E,style:{zIndex:U,...B},transform:C},J):null))});var e$=P(u(),1),z70={start:[X5.Space],cancel:[X5.Esc],end:[X5.Space,X5.Tab]};function G70($,Z,J){let H=$.indexOf(Z),B=$.indexOf(J);if(H<0||B<0||H===B)return $;let Q=[...$],[X]=Q.splice(H,1);return Q.splice(B,0,X),Q}function VK({items:$,getId:Z,className:J,itemClassName:H,dragDisabled:B=!1,isItemDragDisabled:Q,onReorder:X,renderItem:z,renderPlaceholder:G,renderOverlay:U}){let Y=Jv(eL(HX,{activationConstraint:{distance:4}}),eL(JX,{keyboardCodes:z70})),[F,K]=j7.useState(null),[W,N]=j7.useState(null),q=j7.useRef(null),D=j7.useMemo(()=>$.map(Z),[$,Z]),A=j7.useMemo(()=>new Map($.map((E)=>[Z(E),E])),[$,Z]),L=(F&&W?W:D).map((E)=>A.get(E)).filter((E)=>Boolean(E)),O=F?A.get(F):void 0,M=Q?$.filter((E)=>!Q(E)).length:$.length,_=B||M<2;return e$.jsxs(Pv,{sensors:Y,collisionDetection:Hv,onDragStart:(E)=>{let T=$.map(Z);K(String(E.active.id)),q.current=T,N(T)},onDragOver:(E)=>{let T=String(E.active.id),k=E.over?String(E.over.id):void 0,S=q.current;if(!k||k===T||!S)return;let I=G70(S,T,k);if(I===S)return;q.current=I,N(I)},onDragCancel:()=>{q.current=null,K(null),N(null)},onDragEnd:(E)=>{let T=String(E.active.id),k=q.current;if(q.current=null,K(null),N(null),!k||k.join("|")===D.join("|"))return;if(!k.includes(T))return;X(k)},children:[e$.jsx("div",{className:J,children:L.map((E)=>e$.jsx(U70,{id:Z(E),item:E,disabled:_||Q?.(E)===!0,itemClassName:H,renderItem:z,renderPlaceholder:G},Z(E)))}),e$.jsx(Tv,{dropAnimation:null,children:O&&U?U(O):null})]})}function U70({id:$,item:Z,disabled:J,itemClassName:H,renderItem:B,renderPlaceholder:Q}){let{setNodeRef:X,isOver:z}=Ov({id:$,disabled:J}),{attributes:G,listeners:U,setNodeRef:Y,isDragging:F}=_v({id:$,disabled:J,attributes:{roleDescription:"sortable item"}}),K=(N)=>{X(N),Y(N)},W={isDragging:F,isOver:z,dragDisabled:J,dragHandleProps:J?{}:{...G,...U}};return e$.jsxs(K5.div,{layout:!0,ref:K,className:Q0("relative",H?.(Z,W)),transition:{type:"spring",duration:0.25,bounce:0},children:[F&&Q?.(Z),B(Z,W)]})}var W1=P(u(),1);function Y70($){return Q0(M9({variant:"ghost",size:"icon-lg"}),$&&"bg-accent text-accent-foreground")}function FH({children:$,showWorkspaces:Z=!0}){let{data:J}=QY(),H=a0();return P2((B)=>{if(B.type==="workspace:updated"||B.type==="theme:updated"||B.type==="workspaces-list:updated"){if(B.type!=="theme:updated"&&B.origin===Y3)return;H.invalidateQueries({queryKey:O0.all,exact:!0})}}),W1.jsxs("div",{className:"flex h-dvh bg-muted transition-colors duration-100 ease-out motion-reduce:transition-none",children:[W1.jsx(F70,{workspaces:Z?J??[]:[]}),W1.jsx("main",{className:"flex min-w-0 flex-1 flex-col",children:$})]})}function F70({workspaces:$}){let{environment:Z}=N4(),{demo:J}=U3(),H=lR();return W1.jsx(qU,{delay:500,children:W1.jsxs("aside",{className:"flex h-full shrink-0 flex-col items-center gap-4 px-2 py-5 [font-family:var(--default-sans)]",children:[W1.jsxs(t1,{children:[W1.jsx(e1,{render:W1.jsx(v3,{href:"/","aria-label":"Home",className:Y70,children:W1.jsx(Ev,{stroke:1.5})})}),W1.jsx($5,{side:"right",children:"Home"})]}),W1.jsx("nav",{className:"flex max-h-full min-h-0 w-14 flex-1 flex-col items-center justify-center gap-4",children:$.length>0&&W1.jsxs(W1.Fragment,{children:[W1.jsx("div",{className:"no-scrollbar min-h-0 scroll-fade overflow-y-auto [--scroll-fade-reveal:16px]",children:W1.jsx(VK,{items:$,getId:(B)=>B.id,className:"flex flex-col gap-4",onReorder:(B)=>H.mutate(B),renderPlaceholder:()=>W1.jsx("div",{className:"pointer-events-none absolute top-0 left-1 size-12 rounded-xl bg-accent"}),renderOverlay:(B)=>W1.jsx(jv,{workspace:B,dragOverlay:!0}),renderItem:(B,Q)=>W1.jsx(jv,{workspace:B,dragState:Q})})}),W1.jsx("div",{className:"shrink-0",children:W1.jsxs(t1,{children:[W1.jsx(pQ,{trigger:W1.jsx(e1,{render:W1.jsx(L0,{type:"button",variant:"ghost",size:"icon-lg","aria-label":"Create new workspace",className:"text-muted-foreground hover:text-foreground",children:W1.jsx(t2,{"data-icon":"inline-start",stroke:1.5})})})}),W1.jsx($5,{side:"right",children:"Create new workspace"})]})})]})}),W1.jsxs("div",{className:"flex shrink-0 flex-col items-center gap-4",children:[Z==="local"&&W1.jsx(K70,{}),J?W1.jsxs(t1,{children:[W1.jsx(dJ,{trigger:W1.jsx(e1,{render:W1.jsx(L0,{size:"icon","aria-label":"Set up Moi",children:W1.jsx(Cv,{stroke:1.5})})})}),W1.jsx($5,{side:"right",children:"Set up Moi"})]}):W1.jsx(xh,{})]})]})})}function K70(){let $=tR();return $.status==="available"?W1.jsx(eR,{...$.button}):null}function jv({workspace:$,dragOverlay:Z=!1,dragState:J}){let[H]=a4(),B=`/workspace/${$.id}`,Q=i$($),X=H===B||H.startsWith(`${B}/`),z=W1.jsx("div",{className:Q0(M9({variant:"ghost",size:"icon-lg"}),"pointer-events-none size-12 transition-[border-radius,background-color,color] duration-100 ease-out motion-reduce:transition-none",Z?"bg-background shadow-lg":"group-hover:bg-accent group-hover:text-accent-foreground group-focus-visible:ring-3 group-focus-visible:ring-ring/50",X&&!Z&&"bg-accent text-accent-foreground"),children:W1.jsx(q7,{icon:$.icon,workspaceType:$.type,workspaceTheme:$.theme,className:"size-7 shrink-0 rounded-md transition-[border-radius] duration-100 ease-out motion-reduce:transition-none"})}),G=W1.jsx("span",{className:"mt-0.5 line-clamp-2 w-full text-center text-[11px] leading-snug font-medium text-ellipsis text-foreground",children:Q});if(Z)return W1.jsxs("span",{className:"flex w-14 flex-col items-center",children:[z,G]});return W1.jsxs(v3,{href:B,"aria-label":Q,onClick:(U)=>{if(J?.isDragging)U.preventDefault()},className:Q0("group flex w-14 flex-col items-center rounded-xl outline-none",J?.isDragging&&"invisible"),...J?.dragHandleProps,children:[z,W1.jsxs(t1,{children:[W1.jsx(e1,{render:G}),W1.jsx($5,{side:"right",children:Q})]})]})}var yv=P(m(),1);var WH=P(m(),1);var N70=P(m(),1);var wv=P(u(),1);function bv({className:$,...Z}){return wv.jsx("label",{"data-slot":"label",className:d0("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",$),...Z})}var W70=P(u(),1);var zX=P(u(),1);function Sv({className:$,...Z}){return zX.jsx("div",{"data-slot":"field-group",className:d0("group/field-group @container/field-group flex w-full flex-col gap-5 data-[slot=checkbox-group]:gap-3 *:data-[slot=field-group]:gap-4",$),...Z})}var q70=r6("group/field flex w-full gap-2 data-[invalid=true]:text-destructive",{variants:{orientation:{vertical:"flex-col *:w-full [&>.sr-only]:w-auto",horizontal:"flex-row items-center has-[>[data-slot=field-content]]:items-start *:data-[slot=field-label]:flex-auto has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px",responsive:"flex-col *:w-full @md/field-group:flex-row @md/field-group:items-center @md/field-group:*:w-auto @md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:*:data-[slot=field-label]:flex-auto [&>.sr-only]:w-auto @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px"}},defaultVariants:{orientation:"vertical"}});function QX({className:$,orientation:Z="vertical",...J}){return zX.jsx("div",{role:"group","data-slot":"field","data-orientation":Z,className:d0(q70({orientation:Z}),$),...J})}function XX({className:$,...Z}){return zX.jsx(bv,{"data-slot":"field-label",className:d0("group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50 has-data-checked:border-accent has-data-checked:bg-accent has-[>[data-slot=field]]:rounded-lg has-[>[data-slot=field]]:border has-[>[data-slot=field]]:not-has-[:disabled,[data-disabled]]:hover:bg-accent has-[>[data-slot=field]]:has-[:focus-visible]:border-ring has-[>[data-slot=field]]:has-[:focus-visible]:ring-3 has-[>[data-slot=field]]:has-[:focus-visible]:ring-ring/50 *:data-[slot=field]:p-2.5","has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col",$),...Z})}var Rv=P(m(),1),$Z=P(u(),1);function KH({title:$,description:Z,children:J}){let H=Rv.useId();return $Z.jsxs("section",{"aria-labelledby":H,className:"-mx-6 flex min-w-0 flex-col rounded-2xl bg-background p-6 shadow-xs",children:[$Z.jsxs("header",{className:"mb-6 flex flex-col gap-1",children:[$Z.jsx("h2",{id:H,className:"text-lg font-medium",children:$}),Z&&$Z.jsx("p",{className:"text-sm text-muted-foreground",children:Z})]}),$Z.jsx("div",{className:"flex min-w-0 flex-col gap-6",children:J})]})}var j9=P(u(),1);function Iv(){let $=U3();if(!$.profile)return null;return j9.jsx(KH,{title:"Profile",children:j9.jsxs(Sv,{children:[j9.jsx(A70,{name:$.profile.name??"",readOnly:!$.canEdit,onSave:$.saveName},$.profile.id),$.email&&j9.jsxs(QX,{children:[j9.jsx(XX,{htmlFor:"profile-email",children:"Email"}),j9.jsx(p8,{id:"profile-email",value:$.email,readOnly:!0,type:"email"})]})]})})}function A70({name:$,readOnly:Z,onSave:J}){let H=WH.useId(),[B,Q]=WH.useState(),X=r1({mutationFn:J,onSuccess:()=>Q(void 0),onError:(Y)=>T1.add({title:"Couldn’t save name",description:Y.message,type:"error"})}),z=X.isPending,G=WH.useRef(!1);function U(){if(Z||z)return;let Y=(B??$).trim();if(!Y||Y.length>80||Y===$){Q(void 0);return}Q(Y),X.mutate(Y)}return j9.jsxs(QX,{children:[j9.jsx(XX,{htmlFor:H,children:"Name"}),j9.jsx(p8,{id:H,value:B??$,autoComplete:"name",maxLength:80,readOnly:Z,disabled:z,onChange:(Y)=>Q(Y.target.value),onBlur:()=>{if(G.current){G.current=!1;return}U()},onKeyDown:(Y)=>{if(Y.nativeEvent.isComposing)return;if(Y.key==="Enter")Y.preventDefault(),Y.currentTarget.blur();if(Y.key==="Escape")Y.preventDefault(),G.current=!0,Q(void 0),Y.currentTarget.blur()}})]})}var LK=P(m(),1);var R5=P(u(),1);function kv(){let{team:$,removingMemberIds:Z,setRemovingMemberIds:J}=U3(),H=LK.useSyncExternalStore(JQ,v6,v6),B=a0(),[Q,X]=LK.useState(""),z=r1({mutationKey:_2.team,mutationFn:(q)=>q(),onSuccess:()=>B.invalidateQueries({queryKey:_2.team}),onError:(q)=>{if(T1.add({title:"Couldn’t update users",description:q.message,type:"error"}),q instanceof h$&&q.status===401)B.invalidateQueries({queryKey:_2.session})}}),G=CB({mutationKey:_2.team})>0;function U(q){if(!G)z.mutate(q)}function Y(q){let D=B.getQueryData(_2.session)?.user.id,A=()=>J((O)=>O.filter((M)=>M!==q.id)),V=!1;J((O)=>[...O,q.id]);let L=T1.add({title:`${q.name.trim()||q.email} removed`,timeout:5000,onClose:()=>{if(V||B.getQueryData(_2.session)?.user.id!==D){A();return}z.mutateAsync(()=>kR(q.id)).then(A,A)},actionProps:{children:"Undo",onClick:()=>{V=!0,T1.close(L)}}})}if($.isPending)return R5.jsx(KH,{title:"Users",children:R5.jsxs("div",{className:"flex flex-col gap-4","aria-label":"Loading users",children:[R5.jsx(V4,{className:"h-6 w-32"}),R5.jsx(V4,{className:"h-24 w-full"})]})});if($.isError)return R5.jsx(KH,{title:"Users",children:R5.jsxs("div",{className:"flex flex-col items-start gap-3",children:[R5.jsx("p",{role:"alert",children:$.error.message}),R5.jsx(L0,{variant:"outline",onClick:()=>void $.refetch(),children:"Try again"})]})});let{members:F,invitations:K,role:W}=$.data,N=W==="owner";return R5.jsxs(KH,{title:"Users",children:[R5.jsxs("ul",{className:"flex flex-col gap-4",children:[F.filter((q)=>!Z.includes(q.id)).map((q)=>R5.jsxs("li",{className:"flex items-center gap-3",children:[R5.jsx(IJ,{profile:JM({...H?.find((D)=>D.id===q.userId),id:q.userId,name:q.name,email:q.email}),size:"sm",showYouLabel:q.me,description:q.name?.trim()?q.email:void 0,className:"flex-1"}),R5.jsx("span",{className:"text-xs text-muted-foreground",children:q.role==="owner"?"Owner":"Member"}),N&&!q.me&&R5.jsx(L0,{variant:"ghost",size:"sm",disabled:G,"aria-label":`Remove ${q.email}`,onClick:()=>Y(q),children:"Remove"})]},q.id)),N&&K.map((q)=>R5.jsxs("li",{className:"group/invitation flex items-center gap-3",tabIndex:0,children:[R5.jsx(IJ,{profile:JM({id:q.id,email:q.email}),size:"sm",description:`Invitation expires ${new Date(q.expiresAt).toLocaleDateString()}`,className:"flex-1 text-muted-foreground [&_[data-slot=avatar]]:opacity-50"}),R5.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[R5.jsx("span",{className:"text-xs text-muted-foreground [@media(hover:hover)]:group-focus-within/invitation:hidden [@media(hover:hover)]:group-hover/invitation:hidden",children:"Pending invite"}),R5.jsx(L0,{variant:"ghost",size:"icon-sm",className:"text-muted-foreground transition-none group-focus-within/invitation:inline-flex group-hover/invitation:inline-flex [@media(hover:hover)]:hidden",disabled:G,"aria-label":`Cancel invitation for ${q.email}`,onClick:()=>U(()=>IR(q.id)),children:R5.jsx(i5,{stroke:1.75})})]})]},`invitation-${q.id}`))]}),N&&R5.jsxs("form",{className:"flex items-end gap-2",onSubmit:(q)=>{q.preventDefault();let D=Q.trim();if(!D)return;U(async()=>{await RR(D),X("")})},children:[R5.jsxs(QX,{className:"min-w-0 flex-1",children:[R5.jsx(XX,{htmlFor:"invite-email",children:"Invite someone"}),R5.jsx(p8,{id:"invite-email",type:"email",required:!0,autoComplete:"off",placeholder:"Email",value:Q,disabled:G,onChange:(q)=>X(q.target.value)})]}),R5.jsx(L0,{type:"submit",disabled:G,children:"Invite"})]})]})}var O4=P(u(),1);function xv(){let $=U3();if(yv.useEffect(()=>{if($.cloud&&!$.demo&&$.status==="signed-out")window.location.replace("/cloud/login")},[$.cloud,$.demo,$.status,$.registered]),$.demo)return O4.jsx(nz,{to:"/",replace:!0});if($.status==="signed-out")return null;return O4.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:O4.jsxs("div",{className:"mx-auto flex w-full max-w-3xl flex-col gap-6 px-6 py-8 sm:px-10 sm:py-12",children:[O4.jsx("h1",{className:"text-xl font-medium",children:"Settings"}),$.status==="loading"?O4.jsxs("div",{className:"flex flex-col gap-4","aria-label":"Loading settings",children:[O4.jsx(V4,{className:"h-7 w-32"}),O4.jsx(V4,{className:"h-10 w-full max-w-md"}),O4.jsx(V4,{className:"h-10 w-full max-w-md"})]}):$.status==="error"?O4.jsxs("div",{className:"flex flex-col items-start gap-3",children:[O4.jsx("p",{role:"alert",children:"Couldn’t load your account"}),O4.jsx(L0,{variant:"outline",onClick:$.retry,children:"Try again"})]}):O4.jsxs("div",{className:"flex w-full max-w-xl min-w-0 flex-col gap-4",children:[O4.jsx(Iv,{}),$.registered&&O4.jsx(kv,{})]})]})})}var HM=P(u(),1);function hv(){return HM.jsx(FH,{showWorkspaces:!1,children:HM.jsx(xv,{})})}var xf=P(m(),1);var vv=P(m(),1);var NH=P(u(),1);function fv({choice:$,isPending:Z,errorMessage:J,onTypeChange:H,onSubmit:B,onReset:Q}){let[X,z]=vv.useState(!0),G=GY(),U=G.isPending||G.isFetching,Y=G.isError?void 0:G.data?.installed,F=RF(Y,$.workspace.types),K=!U&&!Y?"Could not check installed agents.":void 0,W=!Z&&!U&&!K&&F.some((D)=>D.type===$.selectedType&&!D.disabled);function N(D){if(!D&&Z)return;z(D)}function q(D){if(!D)Q()}return NH.jsx(e6,{open:X,onOpenChange:N,onOpenChangeComplete:q,children:NH.jsx(yF,{showCloseButton:!Z,children:NH.jsx(kF,{title:`Import ${i$($.workspace)}`,selectedType:$.selectedType,options:F,isLoading:U&&!Y,isPending:Z||U||Boolean(K),errorMessage:K??J,secondaryAction:NH.jsx(MQ,{render:NH.jsx(L0,{variant:"secondary"}),disabled:Z,children:"Cancel"}),primaryLabel:"Add workspace",pendingLabel:Z?"Adding…":void 0,onTypeChange:H,onSubmit:()=>{if(W)B()}})})})}var gv=P(m(),1);function D70($){return $.types[0]??cJ[0]}function mv({onSuccess:$}){let Z=ZI(),[J,H]=gv.useState(null);function B(G){Z.reset(),H({workspace:G,selectedType:D70(G)})}function Q(G){H((U)=>U?{...U,selectedType:G}:U)}function X(){if(!J||Z.isPending)return;Z.mutate({path:J.workspace.path,type:J.selectedType},{onSuccess:$})}function z(){H(null),Z.reset()}return{choice:J,isPending:Z.isPending,error:Z.error,startImport:B,selectType:Q,submit:X,reset:z}}var UX=P(m(),1);var YX=P(u(),1),V70=[["OOOOO","O.O.O","O.O.O"],["OOO","O.O","OOO"],["O","O","O"]],C7=10,MK=3,L70=2.5,M70={O:1,o:0.5,".":0},P70=3000,_70=2,uv=3,E7=3,pv=0.001,ZZ={courantSquared:0.14,damping:0.976,driveAmplitude:1.4,driveFrequency:0.027,gain:0.65,fadeIn:0.36,fadeOut:0.1};function O70($){let Z=Math.max(...$.map((Q)=>Q.length)),J=Z*C7+(Z-1)*MK,H=$.length*C7+($.length-1)*MK,B=[];return $.forEach((Q,X)=>{Array.from(Q).forEach((z,G)=>{let U=M70[z];if(U===void 0)return;let Y=G*(C7+MK),F=X*(C7+MK);B.push({x:Y,y:F,centerX:Y+C7/2,centerY:F+C7/2,targetOpacity:U})})}),{width:J,height:H,fieldColumns:Math.round(J/E7)+1,fieldRows:Math.round(H/E7)+1,pixels:B}}var T70=V70.map(O70);function GX($,Z,J){return $<Z?Z:$>J?J:$}function j70($){return $<0.5?2*$*$:1-(-2*$+2)**2/2}class cv{rects;svg;geometry;animationFrame=0;running=!1;intro=!0;introStartedAt=-1;field;previousField;nextField;pointerActive=!1;pointerX=0;pointerY=0;activation=0;constructor($,Z,J){this.rects=$,this.svg=Z,this.geometry=J;let H=J.fieldColumns*J.fieldRows;this.field=new Float32Array(H),this.previousField=new Float32Array(H),this.nextField=new Float32Array(H)}start(){this.seedImpulse(),this.activation=1,this.resume()}stop(){cancelAnimationFrame(this.animationFrame),this.running=!1}handlePointerMove=($)=>{let Z=this.svg.getBoundingClientRect();if(!Z.width||!Z.height)return;if(this.pointerActive=$.clientX>=Z.left&&$.clientX<=Z.right&&$.clientY>=Z.top&&$.clientY<=Z.bottom,this.pointerActive)this.pointerX=($.clientX-Z.left)/Z.width*this.geometry.width,this.pointerY=($.clientY-Z.top)/Z.height*this.geometry.height,this.resume()};seedImpulse(){let $=Math.round(this.geometry.width/2/E7),Z=Math.round(this.geometry.height/2/E7),J=2*uv*uv;for(let H=0;H<this.geometry.fieldRows;H++)for(let B=0;B<this.geometry.fieldColumns;B++){let Q=(B-$)**2+(H-Z)**2,X=_70*Math.exp(-Q/J),z=H*this.geometry.fieldColumns+B;this.field[z]=X,this.previousField[z]=X}}resume(){if(this.running)return;this.running=!0,this.animationFrame=requestAnimationFrame(this.animate)}animate=($)=>{if(this.stepWave(),this.pointerActive)this.driveWave($);if(this.intro&&!this.pointerActive){if(this.introStartedAt<0)this.introStartedAt=$;let J=($-this.introStartedAt)/P70;if(this.activation=1-j70(Math.min(1,J)),J>=1)this.intro=!1}else{this.intro=!1;let J=this.pointerActive?1:0,H=this.pointerActive?ZZ.fadeIn:ZZ.fadeOut;this.activation+=(J-this.activation)*H}let Z=this.renderWave();if(this.intro||this.pointerActive||this.activation>pv||Z>pv){this.animationFrame=requestAnimationFrame(this.animate);return}this.running=!1,this.activation=0,this.renderTargets()};stepWave(){let{fieldColumns:$,fieldRows:Z}=this.geometry;for(let H=1;H<Z-1;H++)for(let B=1;B<$-1;B++){let Q=H*$+B,X=this.field[Q-1]+this.field[Q+1]+this.field[Q-$]+this.field[Q+$]-4*this.field[Q];this.nextField[Q]=(2*this.field[Q]-this.previousField[Q]+ZZ.courantSquared*X)*ZZ.damping}let J=this.previousField;this.previousField=this.field,this.field=this.nextField,this.nextField=J}driveWave($){let Z=GX(Math.round(this.pointerX/E7),1,this.geometry.fieldColumns-2),J=GX(Math.round(this.pointerY/E7),1,this.geometry.fieldRows-2);this.field[J*this.geometry.fieldColumns+Z]=ZZ.driveAmplitude*Math.sin($*ZZ.driveFrequency)}sampleField($,Z){let J=GX($/E7,0,this.geometry.fieldColumns-1),H=GX(Z/E7,0,this.geometry.fieldRows-1),B=Math.floor(J),Q=Math.floor(H),X=Math.min(B+1,this.geometry.fieldColumns-1),z=Math.min(Q+1,this.geometry.fieldRows-1),G=J-B,U=H-Q,{fieldColumns:Y}=this.geometry,F=this.field[Q*Y+B],K=this.field[Q*Y+X],W=this.field[z*Y+B],N=this.field[z*Y+X];return(F*(1-G)+K*G)*(1-U)+(W*(1-G)+N*G)*U}renderWave(){let $=0;return this.geometry.pixels.forEach((Z,J)=>{let H=this.rects[J];if(!H)return;let B=this.sampleField(Z.centerX,Z.centerY);$=Math.max($,Math.abs(B));let Q=GX(0.5+B*ZZ.gain,0,1),X=Z.targetOpacity*(1-this.activation)+Q*this.activation;H.setAttribute("opacity",X.toFixed(3))}),$}renderTargets(){this.geometry.pixels.forEach(($,Z)=>{this.rects[Z]?.setAttribute("opacity",String($.targetOpacity))})}}function C70({geometry:$}){let Z=UX.useRef([]),J=UX.useRef(null);return UX.useEffect(()=>{let H=J.current;if(!H||window.matchMedia("(prefers-reduced-motion: reduce)").matches)return;let B=new cv(Z.current,H,$);return B.start(),window.addEventListener("pointermove",B.handlePointerMove),()=>{B.stop(),window.removeEventListener("pointermove",B.handlePointerMove)}},[$]),YX.jsx("svg",{ref:J,className:"h-8 w-auto",viewBox:`0 0 ${$.width} ${$.height}`,fill:"currentColor","aria-hidden":"true",children:$.pixels.map((H,B)=>YX.jsx("rect",{ref:(Q)=>{Z.current[B]=Q},x:H.x,y:H.y,width:C7,height:C7,rx:L70,opacity:H.targetOpacity},`${H.x}-${H.y}`))})}function dv({className:$}){return YX.jsx("div",{role:"img","aria-label":"Moi",className:Q0("flex items-center gap-2 text-accent",$),children:T70.map((Z,J)=>YX.jsx(C70,{geometry:Z},J))})}function BM({l:$,c:Z,h:J}){let H=J*Math.PI/180,B=Z*Math.cos(H),Q=Z*Math.sin(H),X=$+0.3963377774*B+0.2158037573*Q,z=$-0.1055613458*B-0.0638541728*Q,G=$-0.0894841775*B-1.291485548*Q,U=X*X*X,Y=z*z*z,F=G*G*G;return[4.0767416621*U-3.3077115913*Y+0.2309699292*F,-1.2684380046*U+2.6097574011*Y-0.3413193965*F,-0.0041960863*U-0.7034186147*Y+1.707614701*F]}var lv=($)=>$.every((Z)=>Z>=-0.0001&&Z<=1.0001);function ov($){let Z=BM($);if(!lv(Z)){let J=0,H=$.c;for(let B=0;B<12;B++){let Q=(J+H)/2;if(lv(BM({...$,c:Q})))J=Q;else H=Q}Z=BM({...$,c:J})}return Z.map((J)=>Math.min(1,Math.max(0,J)))}function iv($){let[Z,J,H]=ov($);return 0.2126*Z+0.7152*J+0.0722*H}function FX($,Z){let J=iv($),H=iv(Z);return(Math.max(J,H)+0.05)/(Math.min(J,H)+0.05)}function rv($,Z,J){if(FX($,Z)>=J)return $;let H=$.l>=Z.l?1:-1;for(let X of[H,-H]){let z={...$};for(let G=0;G<60;G++){if(z.l=Math.min(1,Math.max(0,z.l+X*0.02)),FX(z,Z)>=J)return z;if(z.l===0||z.l===1)break}}let B={...$,l:0,c:0},Q={...$,l:1,c:0};return FX(B,Z)>=FX(Q,Z)?B:Q}function PK($){return"#"+ov($).map((Z)=>{let J=Z<=0.0031308?12.92*Z:1.055*Math.pow(Z,0.4166666666666667)-0.055;return Math.round(J*255).toString(16).padStart(2,"0")}).join("")}function qH($){let Z=parseInt($.slice(1),16),[J,H,B]=[Z>>16&255,Z>>8&255,Z&255].map((Y)=>{let F=Y/255;return F<=0.04045?F/12.92:Math.pow((F+0.055)/1.055,2.4)}),Q=Math.cbrt(0.4122214708*J+0.5363325363*H+0.0514459929*B),X=Math.cbrt(0.2119034982*J+0.6806995451*H+0.1073969566*B),z=Math.cbrt(0.0883024619*J+0.2817188376*H+0.6299787005*B),G=1.9779984951*Q-2.428592205*X+0.4505937099*z,U=0.0259040371*Q+0.7827717662*X-0.808675766*z;return{l:0.2104542553*Q+0.793617785*X-0.0040720468*z,c:Math.hypot(G,U),h:Math.atan2(U,G)*180/Math.PI}}function E70($,Z,J){let H=(Y)=>Y*Math.PI/180,B=$.c*Math.cos(H($.h)),Q=$.c*Math.sin(H($.h)),X=Z.c*Math.cos(H(Z.h)),z=Z.c*Math.sin(H(Z.h)),G=B+(X-B)*J,U=Q+(z-Q)*J;return{l:$.l+(Z.l-$.l)*J,c:Math.hypot(G,U),h:Math.atan2(U,G)*180/Math.PI}}var _K=($,Z,J)=>PK(E70(qH($),qH(Z),J));var b70={h:12,l:0.84,pull:0.4,c:0.1};var av=4.55;function w70($,Z,J){let H=qH($),B=qH(Z),Q={l:H.l+(J.l-H.l)*J.pull,c:Math.max(H.c,J.c),h:J.h};Q=rv(Q,S70,R70);let X=rv(B,Q,av),z=X.l>=Q.l?1:-1,G=PK(Q);for(let U=0;U<40;U++){let Y=PK(X),F=1/0;for(let W=0;W<=10;W++){let N=W/10;F=Math.min(F,FX(qH(_K(Z,Y,N)),qH(_K($,G,N))))}if(F>=av)return[G,Y];let K=Math.min(1,Math.max(0,X.l+z*0.02));if(K===X.l)return[G,Y];X={...X,l:K}}return[G,PK(X)]}var S70={l:0.145,c:0,h:0},R70=1.5;var QM={esx:1,esy:1,tilt:0,edy:0,edx:0,esx2:0,esy2:0,tilt2:0,edy2:0,lock:0,heat:0,shake:0,rock:0,bdy:0},nv=($)=>String(Math.round($*1000)/1000);function L3($,Z){return{l:{...$,eyes:$.eyes.map((J,H)=>({...J,cx:J.cx+Z.edx*(H?1:-1),cy:J.cy+Z.edy+(H?Z.edy2:0),rx:J.rx*(Z.esx+(H?Z.esx2:0)),ry:J.ry*(Z.esy+(H?Z.esy2:0)),rot:J.rot*(1-Z.lock)+(Z.tilt+(H?Z.tilt2:0))*(H?1:-1)}))},wrap:Z.bdy!==0?`translate(0 ${nv(Z.bdy)})`:""}}function M3($){let Z={};for(let J in QM){if(J==="heat")continue;let H=$[J];if(H!==QM[J])Z["--mo-"+J]=nv(H)}return Z}function I70($,Z,J){let[H,B]=w70($.head,$.eye,J);return{...$,head:_K($.head,H,Z.heat),eye:_K($.eye,B,Z.heat)}}var sv={p:QM,vars:M3,bake:L3},tv={p:{esx:1.72,esy:0.3,tilt:8,edy:-1.5,edx:1.5,esx2:0.08,esy2:0.05,tilt2:-16,edy2:0,lock:1,heat:0,shake:0,rock:0,bdy:-2.2},vars:M3,bake:L3},ev={p:{esx:0.6,esy:0.56,tilt:26,edy:3.6,edx:1.9,esx2:-0.05,esy2:-0.07,tilt2:-7,edy2:0,lock:1,heat:0,shake:0,rock:0,bdy:2.6},vars:M3,bake:L3};var $f={p:{esx:1.34,esy:1.2,tilt:-6,edy:-1.05,edx:0.5,esx2:0.05,esy2:0.07,tilt2:3,edy2:0,lock:1,heat:0,shake:0,rock:0,bdy:-1.4},vars:M3,bake:L3},Zf={p:{esx:1.32,esy:0.76,tilt:5,edy:-0.6,edx:0.8,esx2:0.26,esy2:-0.56,tilt2:-11,edy2:0,lock:1,heat:0,shake:0,rock:0,bdy:-1.1},vars:M3,bake:L3},Jf={p:{esx:1.14,esy:0.22,tilt:0,edy:2.4,edx:0.3,esx2:-0.04,esy2:0.03,tilt2:4,edy2:0,lock:1,heat:0,shake:0,rock:0,bdy:1.2},vars:M3,bake:L3},Hf={p:{esx:1.3,esy:0.42,tilt:18,edy:-0.5,edx:0.5,esx2:0.06,esy2:-0.06,tilt2:-36,edy2:0,lock:1,heat:0,shake:0,rock:0,bdy:-1},vars:M3,bake:L3},Bf={p:{esx:0.95,esy:1.02,tilt:4,edy:-0.2,edx:0.3,esx2:0.24,esy2:-0.44,tilt2:-18,edy2:0,lock:1,heat:0,shake:0,rock:0,bdy:0},vars:M3,bake:L3};var Qf={p:{esx:0.62,esy:0.5,tilt:10,edy:1.4,edx:-0.2,esx2:-0.05,esy2:-0.04,tilt2:-8,edy2:0,lock:1,heat:0.55,shake:0,rock:0,bdy:0.9},vars:M3,bake:L3,tint:($,Z)=>I70($,Z,b70)};var Xf={p:{esx:1.15,esy:0.62,tilt:0,edy:4.2,edx:0.4,esx2:0.02,esy2:0.06,tilt2:0,edy2:-8.4,lock:1,heat:0,shake:0,rock:0.8,bdy:-0.4},vars:M3,bake:L3};var zf=P(u(),1),k70="moi-agent",y70={default:{head:"var(--foreground)",eye:"var(--background)"},primary:{head:"var(--primary)",eye:"var(--primary-foreground)"},secondary:{head:"var(--accent)",eye:"var(--accent-foreground)"}},x70={idle:sv,happy:tv,sad:ev,surprised:$f,wink:Zf,sleepy:Jf,smug:Hf,unsure:Bf,shy:Qf,thinking:Xf};function P3({size:$=56,preset:Z=q3.agent,animated:J=!1,color:H="default",expression:B="idle",className:Q}){return zf.jsx(xU,{name:k70,size:$,animate:J?"always":"hover",palette:y70[H],expression:B?x70[B]:void 0,className:Q0("shrink-0",Q),traits:fQ[Z].traits})}var DH={};k5(DH,{Trigger:()=>Lf,Root:()=>Df,Panel:()=>jf});var KX=P(m(),1);var OK=P(m(),1);function Gf($){let{open:Z,defaultOpen:J=!1,onOpenChange:H,disabled:B}=$,[Q,X]=D4({controlled:Z,default:J,name:"Collapsible",state:"open"}),{mounted:z,setMounted:G,transitionStatus:U}=k2(Q,!0,!0),Y=t0(),[F,K]=OK.useState(),W=F===null?void 0:F??Y,N=Y0((q)=>{let D=!Q,A=w0(F0.triggerPress,q.nativeEvent);if(H(D,A),A.isCanceled)return;X(D)});return OK.useMemo(()=>({defaultPanelId:Y,disabled:B,handleTrigger:N,mounted:z,open:Q,panelId:W,setMounted:G,setOpen:X,setPanelIdState:K,transitionStatus:U}),[Y,B,N,z,Q,W,G,X,K,U])}var TK=P(m(),1),XM=TK.createContext(void 0);function jK(){let $=TK.useContext(XM);if($===void 0)throw Error(I0(15));return $}var Uf="data-open",Yf="data-closed",Ff=W8.startingStyle,g81=W8.endingStyle;var Wf="data-panel-open";var v70={[Uf]:""},f70={[Yf]:""},Nf={open($){if($)return{[Wf]:""};return null}},qf={open($){if($)return v70;return f70}};var CK={...qf,...Y2};var Af=P(u(),1),Df=KX.forwardRef(function(Z,J){let{render:H,className:B,defaultOpen:Q=!1,disabled:X=!1,onOpenChange:z,open:G,style:U,...Y}=Z,F=Y0(z),K=Gf({open:G,defaultOpen:Q,onOpenChange:F,disabled:X}),W=KX.useMemo(()=>({open:K.open,disabled:K.disabled,transitionStatus:K.transitionStatus}),[K.open,K.disabled,K.transitionStatus]),N=KX.useMemo(()=>({...K,onOpenChange:F,state:W}),[K,F,W]),q=G0("div",Z,{state:W,ref:J,props:Y,stateAttributesMapping:CK});return Af.jsx(XM.Provider,{value:N,children:q})});var Vf=P(m(),1);var g70={...Nf,...Y2},Lf=Vf.forwardRef(function(Z,J){let{panelId:H,open:B,handleTrigger:Q,state:X,disabled:z}=jK(),{className:G,disabled:U=z,render:Y,nativeButton:F=!0,style:K,...W}=Z,{getButtonProps:N,buttonRef:q}=w5({disabled:U,focusableWhenDisabled:!0,native:F});return G0("button",Z,{state:X,ref:[J,q],props:[{"aria-controls":B?H:void 0,"aria-expanded":B,onClick:Q},W,N],stateAttributesMapping:g70})});var zM=P(m(),1);var g4=P(m(),1);var WX={height:void 0,width:void 0};function Pf($){let{externalRef:Z,hiddenUntilFound:J,id:H,keepMounted:B,mounted:Q,onOpenChange:X,open:z,setMounted:G,setOpen:U,transitionStatus:Y}=$,F=g4.useRef(null),K=g4.useRef(null),[W,N]=g4.useState(WX),q=g4.useRef(WX),D=g4.useRef(!1),A=g4.useRef(z),V=g4.useRef(!1),[L,O]=g4.useState(!1),M=g4.useRef(null),_=l2(Z,F),w=N5(z),C=t4(F),E=!z&&!Q,T=L?"idle":Y,k=z&&(A.current||V.current),S=!z&&Q&&K.current==="css-animation"&&W.height===void 0&&W.width===void 0?q.current:W,I=J&&E&&K.current!=="css-animation",j=Y0((f,b=!0)=>{if(b)q.current=f;N(f)}),y=Y0(()=>{M.current?.(),M.current=null}),R=Y0((f)=>{y(),M.current=()=>{M.current=null,f()}}),x=Y0(()=>{if(z&&Q&&K.current==="css-animation")V.current=!0});H0(()=>{if(!L||Y==="starting")return;O(!1)},[L,Y]),g4.useEffect(()=>{return()=>{x(),y()}},[x,y]),H0(()=>{let f=F.current;if(!f)return;if(!z&&M.current)y();let b=m70(f,k);if(K.current=b,z&&Y==="idle"&&A.current&&b==="css-animation"){q.current=AH(f);return}if(z&&Y==="starting"){let h=D.current;if(D.current=!1,b==="none"){j(AH(f)),O(!0);return}if(b==="css-transition"){let c=u70(f);if(j(AH(f)),!h)return c;let i=EK(f,"transition-duration","0s");return R(i),O(!0),c}j(AH(f));let d=EK(f,"animation-name","none");if(!h){d();return}let o=EK(f,"animation-duration","0s");d(),R(o),O(!0);return}if(!z&&Q&&(Y==="idle"||Y==="starting")){if(A.current=!1,V.current=!1,b==="none"){j(WX,!1),G(!1);return}j(AH(f));return}if(Y!=="ending")return;if(b==="none"){G(!1);return}let l=AH(f);if(!(l.height>0||l.width>0)){G(!1);return}if(j(l),b==="css-animation")EK(f,"animation-name","none")();return},[Q,z,y,j,G,R,k,Y]),L5({enabled:z&&Q&&T==="idle",open:!0,ref:F,onComplete(){if(!z)return;j(WX,!1)}}),g4.useEffect(()=>{if(z||!Q||T!=="ending")return;if(!F.current)return;let b=new AbortController,l=-1;function r(){if(w.current)return;G(!1),j(WX,!1)}return l=c2.request(()=>{C(r,b.signal)}),()=>{c2.cancel(l),b.abort()}},[w,Q,z,T,C,j,G]),H0(()=>{let f=F.current;if(!f||!J||!E)return;f.setAttribute("hidden","until-found")},[E,J]),g4.useEffect(function(){let b=F.current;if(!b)return;function l(r){let h=w0(F0.none,r);if(X(!0,h),h.isCanceled)return;D.current=!0,U(!0)}return o0(b,"beforematch",l)},[X,U]);let v=B||J||Q||z;return{height:S.height,props:{...I?{[Ff]:""}:void 0,hidden:E,id:H},ref:_,shouldPreventOpenAnimation:k,shouldRender:v,transitionStatus:T,width:S.width}}function AH($){return{height:$.scrollHeight,width:$.scrollWidth}}function m70($,Z){let J=k1($).getComputedStyle($),H=(J.animationName.split(",").map((Q)=>Q.trim()).some((Q)=>Q!==""&&Q!=="none")||Z)&&Mf(J.animationDuration),B=Mf(J.transitionDuration);if(H&&B)return"css-transition";if(B)return"css-transition";if(H)return"css-animation";return"none"}function Mf($){return $.split(",").map((Z)=>Z.trim()).some((Z)=>Z!==""&&Number.parseFloat(Z)>0)}function EK($,Z,J){let H=$.style.getPropertyValue(Z),B=$.style.getPropertyPriority(Z);return $.style.setProperty(Z,J),()=>{if(H===""){$.style.removeProperty(Z);return}$.style.setProperty(Z,H,B)}}function u70($){let Z={"justify-content":$.style.justifyContent,"align-items":$.style.alignItems,"align-content":$.style.alignContent,"justify-items":$.style.justifyItems};Object.keys(Z).forEach((B)=>{$.style.setProperty(B,"initial","important")});function J(){Object.entries(Z).forEach(([B,Q])=>{if(Q===""){$.style.removeProperty(B);return}$.style.setProperty(B,Q)})}let H=c2.request(J);return()=>{c2.cancel(H),J()}}var _f="--collapsible-panel-height",Of="--collapsible-panel-width";var jf=zM.forwardRef(function(Z,J){let{className:H,hiddenUntilFound:B,keepMounted:Q,render:X,id:z,style:G,...U}=Z,{defaultPanelId:Y,mounted:F,onOpenChange:K,open:W,setMounted:N,setPanelIdState:q,setOpen:D,state:A,transitionStatus:V}=jK(),L=B??!1,O=Q??!1,M=z||void 0,_=M??Y;H0(()=>{return q((x)=>M??(x===null?void 0:x)),()=>{q((x)=>x===M?null:x)}},[M,q]);let{height:w,props:C,ref:E,shouldPreventOpenAnimation:T,shouldRender:k,transitionStatus:S,width:I}=Pf({externalRef:J,hiddenUntilFound:L,id:_,keepMounted:O,mounted:F,onOpenChange:K,open:W,setMounted:N,setOpen:D,transitionStatus:V}),j={...A,transitionStatus:S},y=Tf(G,j),R=G0("div",{...Z,style:void 0},{state:j,ref:E,props:[C,{style:{[_f]:w===void 0?"auto":`${w}px`,[Of]:I===void 0?"auto":`${I}px`}},U,y?{style:y}:void 0,T?{style:{animationName:"none"}}:void 0],stateAttributesMapping:CK});if(!k)return null;return R});var RK=P(u(),1);function bK({...$}){return RK.jsx(DH.Root,{"data-slot":"collapsible",...$})}function wK({...$}){return RK.jsx(DH.Trigger,{"data-slot":"collapsible-trigger",...$})}function SK({...$}){return RK.jsx(DH.Panel,{"data-slot":"collapsible-content",...$})}var IK=P(m(),1);var GM="moi-fonts",Cf="moi-font-previews",c70=Object.values(N7).map(($)=>$.googleFontsQuery).filter(Boolean).join("&family="),bf=[["sans","--sans"],["mono","--mono"]],wf=bL.map(($)=>[$,d70($)]),Sf="--radius",Ef=[...bf.map(([,$])=>$),...wf.map(([,$])=>$),Sf];function d70($){return`--${$.replace(/[A-Z]/g,(J)=>`-${J.toLowerCase()}`)}`}function l70($){let Z={},J=_9($),H=J.font===q3.font?void 0:N7[J.font];for(let[B,Q]of bf)Z[Q]=H?.[B];return Z}function UM($,Z="workspace"){let J={},H=EF($,Z);for(let[B,Q]of wf)J[Q]=H?.[B];return J}function i70($){let Z={},J=_9($),H=J.radius===q3.radius?void 0:vQ[J.radius];return Z[Sf]=H?.radius,Z}function C9($,Z="workspace"){return{...l70($),...UM($,Z),...i70($)}}function kK(){IK.useEffect(()=>{if(document.getElementById(Cf))return;let $=document.createElement("link");return $.id=Cf,$.rel="stylesheet",$.crossOrigin="anonymous",$.href=`https://fonts.googleapis.com/css2?family=${c70}&display=swap`,document.head.appendChild($),()=>{$.remove()}},[])}function r70($){IK.useEffect(()=>{let Z=document.documentElement,J=C9($);for(let H of Ef){let B=J[H];if(B)Z.style.setProperty(H,B);else Z.style.removeProperty(H)}return()=>{for(let H of Ef)Z.style.removeProperty(H)}},[$])}function Rf($){let{font:Z}=_9($);r70($),IK.useEffect(()=>{let J=N7[Z]??N7[q3.font],H=document.getElementById(GM);if(!J.googleFontsQuery)H?.remove();else{let B=`https://fonts.googleapis.com/css2?family=${J.googleFontsQuery}&display=swap`;if(H)H.href=B;else{let Q=document.createElement("link");Q.id=GM,Q.rel="stylesheet",Q.crossOrigin="anonymous",Q.href=B,document.head.appendChild(Q)}}return()=>{document.getElementById(GM)?.remove()}},[Z])}function O8($,{workspaceId:Z,base:J="",apiBase:H}={}){if(typeof $!=="string")throw Error("A URL is required");if(!$.startsWith("moi:")){let N=new URL($);if(N.protocol!=="https:"&&N.protocol!=="http:")throw Error("Unsupported URL");return N.href}if(!$.startsWith("moi:/")||$.startsWith("moi://"))throw Error("Expected a workspace address such as moi:/views/events?eventId=123");let B=$.slice(5),Q=B.search(/[?#]/),X=Q<0?B:B.slice(0,Q),z=Q<0?"":B.slice(Q),G=X.split("/").map(decodeURIComponent);if(G.some((N)=>!N||N==="."||N===".."||/[/\\\0]/.test(N)))throw Error("Invalid workspace address");let U=Z===void 0?void 0:encodeURIComponent(Z);if(G[0]==="files"){if(G.length<2)throw Error("Invalid workspace file path");return`${H??(U===void 0?"moi:":`/api/workspaces/${U}`)}/files/${G.slice(1).map(encodeURIComponent).join("/")}${z}`}let Y=G.join("/");if($.includes("#")||/\s/.test(Y))throw Error("Invalid workspace address");if(Y!=="chat"&&!X3(Y)&&!(G[0]==="chats"&&G.length===2))throw Error(`Unsupported workspace destination: ${Y}`);let F=new URLSearchParams(z);F.sort();let K=F.toString();return`${U===void 0?"moi:":`${J.replace(/\/$/,"")}/workspace/${U}`}/${G.map(encodeURIComponent).join("/")}${K?`?${K}`:""}`}var VH=P(m(),1);var T2=P(u(),1),NX={width:320,height:180,radius:32,topLeftRadius:18,bodyTop:24,tabEnd:124,shoulder:{width:48,roundness:20}};function a70($){let{width:Z,height:J,radius:H,topLeftRadius:B,bodyTop:Q,tabEnd:X,shoulder:z}=NX,G=Math.min(Z/2,H*$),U=Math.min(Z/2,B*$),Y=Math.max(0,z.width),F=X+Y,K=Math.max(0,Math.min(z.roundness,Y/2));return[`M ${U} 0`,`H ${X}`,`C ${X+K} 0 ${F-K} ${Q} ${F} ${Q}`,`H ${Z-G}`,`Q ${Z} ${Q} ${Z} ${Q+H}`,`V ${J-H}`,`Q ${Z} ${J} ${Z-G} ${J}`,`H ${G}`,`Q 0 ${J} 0 ${J-H}`,`V ${B}`,`Q 0 0 ${U} 0`,"Z"].join(" ")}function o70(){let $=VH.useRef(null),[Z,J]=VH.useState(1);return VH.useLayoutEffect(()=>{let H=$.current;if(!H)return;let B=(z,G)=>{if(z<=0||G<=0)return;let U=z/NX.width,F=G/NX.height/U;J((K)=>Math.abs(K-F)<0.001?K:F)},Q=H.getBoundingClientRect();B(Q.width,Q.height);let X=new ResizeObserver(([z])=>{if(z)B(z.contentRect.width,z.contentRect.height)});return X.observe(H),()=>X.disconnect()},[]),{ref:$,horizontalRadiusScale:Z}}var If=[{frame:Q0("-translate-x-3 translate-y-3 -rotate-6","group-focus-within:translate-y-2 group-hover:translate-y-2"),img:"opacity-40"},{frame:Q0("translate-x-3 translate-y-2 rotate-5","group-focus-within:translate-y-1 group-hover:translate-y-1"),img:"opacity-50"},{frame:Q0("-translate-x-1 translate-y-1 -rotate-2","group-focus-within:-translate-y-2 group-hover:-translate-y-2"),img:"opacity-100"}];function kf({workspaceId:$}){let Z=XY($),J=Z.data?[...Z.data.thumbnails].reverse():[],H=If.slice(If.length-J.length),B=Z.data?.firstUserMessage,Q=Z.data?.theme,{ref:X,horizontalRadiusScale:z}=o70(),G=a70(z),U=`folder-noise-${$}`,Y=C9(Q),F=UM(Q);return T2.jsxs("div",{ref:X,style:F,className:"relative h-45 w-full",children:[T2.jsxs("svg",{viewBox:`0 0 ${NX.width} ${NX.height}`,preserveAspectRatio:"none","aria-hidden":"true",className:"absolute inset-0 h-full w-full overflow-visible",children:[T2.jsx("defs",{children:T2.jsxs("filter",{id:U,x:"0%",y:"0%",width:"100%",height:"100%",colorInterpolationFilters:"sRGB",children:[T2.jsx("feTurbulence",{type:"fractalNoise",baseFrequency:"0.5",numOctaves:"3",seed:"7",result:"noise"}),T2.jsx("feColorMatrix",{in:"noise",type:"saturate",values:"0",result:"monochromeNoise"}),T2.jsx("feComponentTransfer",{in:"monochromeNoise",result:"faintNoise",children:T2.jsx("feFuncA",{type:"linear",slope:"0.24"})}),T2.jsx("feComposite",{in:"faintNoise",in2:"SourceAlpha",operator:"in",result:"clippedNoise"}),T2.jsx("feBlend",{in:"SourceGraphic",in2:"clippedNoise",mode:"soft-light"})]})}),T2.jsx("path",{d:G,filter:`url(#${U})`,className:"fill-accent"})]}),J.map((K,W)=>T2.jsx("div",{className:Q0("absolute top-[12%] left-[14%] w-fit max-w-[72%] overflow-hidden rounded-[calc(var(--radius-2xl)*0.4)] bg-background shadow-xs squircle","animate-in duration-300 ease-out fade-in",H[W].frame),children:T2.jsx("img",{src:K,alt:"",loading:"lazy",className:Q0("block h-auto max-h-32 w-auto max-w-full object-contain",H[W].img)})},K)),J.length===0&&B&&T2.jsx("div",{className:"absolute inset-x-[12%] top-[22%] flex justify-end",children:T2.jsx("div",{"aria-hidden":"true",style:Y,className:Q0("w-max max-w-40 origin-center rounded-lg bg-card px-3 py-2 font-sans shadow-xs","animate-in transition-transform duration-300 ease-out fade-in","-translate-x-1 translate-y-1 -rotate-2","group-focus-within:translate-y-0.5 group-hover:translate-y-0.5"),children:T2.jsx("p",{className:"line-clamp-3 text-sm leading-normal whitespace-normal",children:B})})}),T2.jsx("div",{className:Q0("absolute inset-x-2 top-[40%] bottom-2 rounded-3xl bg-[color-mix(in_oklch,var(--accent),var(--foreground)_5%)]","mask-[linear-gradient(to_bottom,rgba(0,0,0,0.9)_0%,black_50%)] backdrop-blur-lg","inset-shadow-[0_0_12px_color-mix(in_oklab,var(--background)_20%,transparent)]")})]})}var Q1=P(u(),1);function hf(){kK();let[,$]=a4(),Z=QY();cR();let J=dR(),H=mv({onSuccess:(W)=>$(`/workspace/${W.id}`)}),B=N4(),[Q,X]=xf.useState(!1),z=C1((W)=>W.discoveredWorkspacesOpen),G=C1((W)=>W.setDiscoveredWorkspacesOpen);if(Z.isPending||J.isPending)return Q1.jsx("div",{className:"flex min-h-[50vh] items-center justify-center",children:Q1.jsx(r5,{size:20,stroke:1.5,className:"animate-spin text-muted-foreground"})});if(Z.isError||J.isError)return Q1.jsx("div",{className:"flex min-h-[50vh] items-center justify-center",children:Q1.jsx("p",{className:"text-sm text-muted-foreground",children:"Could not load spaces."})});let U=Z.data,Y=J.data,F=U.length;function K(W){if(B.demo){X(!0);return}H.startImport(W)}return Q1.jsxs("div",{className:"mx-auto w-full max-w-3xl px-8 pt-14 pb-16",children:[Q1.jsx(dv,{className:"mb-10"}),F>0?Q1.jsxs("section",{className:"mb-12",children:[Q1.jsxs("div",{className:"mb-4 flex items-center justify-between gap-2",children:[Q1.jsx("h1",{className:"text-sm font-medium text-foreground",children:"My workspaces"}),Q1.jsx(pQ,{trigger:Q1.jsxs(L0,{variant:"outline",size:"sm",children:[Q1.jsx(t2,{"data-icon":"inline-start",stroke:1.75}),"New"]})})]}),Q1.jsx("div",{className:"grid grid-cols-1 gap-x-4 gap-y-8 sm:grid-cols-2 md:grid-cols-3",children:U.map((W)=>Q1.jsx(n70,{workspace:W},W.id))})]}):Q1.jsxs("div",{className:"mb-10 flex flex-col items-center gap-4 px-8 pt-8 pb-16 text-center",children:[Q1.jsx(yf,{size:32,stroke:1.5,className:"text-muted-foreground"}),Q1.jsxs("div",{className:"flex flex-col gap-1.5",children:[Q1.jsx("h2",{className:"font-medium",children:"Let’s start with creating your first workspace"}),Q1.jsx("p",{className:"mx-auto max-w-sm text-sm text-muted-foreground",children:"Workspace is a place for all the chats, widgets, and views that share the same context. Create a new one or import an existing folder you’ve worked in before."})]}),Q1.jsx(pQ,{trigger:Q1.jsx(L0,{children:"Create workspace"})})]}),Y.length>0&&Q1.jsx("section",{children:Q1.jsxs(bK,{open:z,onOpenChange:G,className:"group",children:[Q1.jsxs(wK,{className:Q0("group/trigger","flex w-full items-center gap-1 pb-4 text-left outline-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring","text-muted-foreground group-data-open:text-foreground hover:text-foreground"),children:[Q1.jsx("span",{className:"text-sm font-medium",children:"Import from this computer"}),Q1.jsx(B6,{size:16,stroke:2,className:Q0("opacity-0 transition-[opacity,transform]","group-hover/trigger:opacity-100 group-focus-visible/trigger:opacity-100 group-data-open:rotate-90")})]}),Q1.jsx(SK,{children:Q1.jsx("ul",{className:"border-t border-border",children:Y.map((W)=>Q1.jsx(s70,{suggestion:W,onAdd:K},W.path))})})]})}),H.choice&&Q1.jsx(fv,{choice:H.choice,isPending:H.isPending,errorMessage:H.error?.message,onTypeChange:H.selectType,onSubmit:H.submit,onReset:H.reset}),Q1.jsx(dJ,{open:Q,onOpenChange:X})]})}function n70({workspace:$}){let Z=i$($),J=XY($.id),H=$.theme??J.data?.theme,B=_9(H).agent,Q=K4((G)=>VU(G.activity,$.id)),X=J.data?.updatedAt??new Date($.addedAt).getTime(),z=`/workspace/${$.id}`;return Q1.jsxs("div",{className:"group flex min-w-0 flex-col gap-3",children:[Q1.jsxs("div",{className:"relative",children:[Q1.jsx(kf,{workspaceId:$.id}),Q1.jsx(v3,{href:z,"aria-label":`Open ${Z}`,className:"absolute inset-0 rounded-2xl outline-none focus-visible:ring-3 focus-visible:ring-ring/50"}),J.data&&Q1.jsxs(t1,{children:[Q1.jsx(e1,{render:Q1.jsx(v3,{href:O8("moi:/chat",{workspaceId:$.id}),"aria-label":`Chat in ${Z}`,style:C9(H),className:"absolute right-3 bottom-3 rounded-lg outline-none focus-visible:ring-3 focus-visible:ring-ring/50",children:Q1.jsx(P3,{preset:B,color:"primary",animated:Q,expression:Q?"thinking":void 0,size:48,className:"drop-shadow-sm drop-shadow-primary/20"})})}),Q1.jsx($5,{children:"Chat"})]})]}),Q1.jsxs(v3,{href:z,className:"flex min-w-0 flex-col gap-2 rounded-lg px-2 outline-none focus-visible:ring-3 focus-visible:ring-ring/50",children:[Q1.jsxs("div",{className:"flex min-w-0 items-center gap-1.5 font-sans",style:C9(H),children:[Q1.jsx(q7,{icon:$.icon,workspaceType:$.type,workspaceTheme:H,className:"size-4 shrink-0 rounded-xs"}),Q1.jsx("span",{className:"truncate text-sm font-medium text-foreground",children:Z})]}),Q1.jsx("span",{className:"text-xs text-muted-foreground",children:t70(X)})]})]})}function s70({suggestion:$,onAdd:Z}){let{path:J,types:H}=$,B=i$($);return Q1.jsxs("li",{className:"flex items-center gap-2 border-b border-border px-1 py-3",children:[Q1.jsx(Cx,{types:H}),Q1.jsx("span",{className:"shrink-0 text-sm font-medium text-foreground",children:B}),Q1.jsx("span",{title:J,className:"min-w-0 flex-1 truncate text-xs text-muted-foreground",children:$.displayPath??J}),Q1.jsxs(L0,{variant:"outline",size:"sm",onClick:()=>Z($),children:[Q1.jsx(t2,{stroke:1.75}),"Add"]})]})}function t70($){let Z=Date.now()-$,J=Math.floor(Z/60000);if(J<1)return"Updated just now";if(J<60)return`Updated ${J} min${J===1?"":"s"} ago`;let H=Math.floor(J/60);if(H<24)return`Updated ${H} hour${H===1?"":"s"} ago`;let B=Math.floor(H/24);if(B<30)return`Updated ${B} day${B===1?"":"s"} ago`;return`Updated ${new Date($).toLocaleDateString()}`}var yK=P(u(),1);function vf(){return yK.jsx(FH,{showWorkspaces:!1,children:yK.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:yK.jsx(hf,{})})})}var MH=P(m(),1);var xK=5000,hK=120;var e70="</moi-attachments>";function YM($){if(!z3($)||typeof $.label!=="string")return null;let Z=$.label.trim();if(!Z||Z.length>hK||typeof $.text!=="string"||!$.text.trim()||$.text.length>xK)return null;return{label:Z,text:$.text}}function ff($){return Array.isArray($)&&$.every((Z)=>z3(Z)&&Z.purpose===void 0&&(Z.source===void 0||typeof Z.source==="string"&&Z.source.length>0)&&YM(Z)!==null)}function gf($){return $==="annotation"||$==="sketch"}function $$0($){return Array.isArray($)&&$.every((Z)=>{if(!z3(Z))return!1;if(Z.type==="text")return ff([Z]);if(Z.type!=="file"&&Z.type!=="image")return!1;if(Z.source!==void 0&&(typeof Z.source!=="string"||!Z.source))return!1;if(typeof Z.mediaType!=="string"||!Z.mediaType)return!1;if(Z.purpose!==void 0&&(!gf(Z.purpose)||!Z.mediaType.startsWith("image/")))return!1;let J=typeof Z.path==="string"&&/^(\/|[A-Za-z]:[\\/])/.test(Z.path)&&!Z.path.includes("\x00");if(Z.type==="file")return J&&Z.label===void 0;return Z.path===void 0&&Z.mediaType.startsWith("image/")&&typeof Z.label==="string"&&Boolean(Z.label.trim())})}function FM($){let Z=[],J=!1,H=$.replace(/<moi-attachments>([^<]*)<\/moi-attachments>/g,(B,Q)=>{try{let X=JSON.parse(Q),z=z3(X)&&X.version===1&&Array.isArray(X.attachments)?X.attachments.map((G)=>z3(G)?{type:"text",source:G.source,label:G.label,text:G.text}:G):X;if(!$$0(z))return B;return Z.push(...z),J=!0,""}catch{return B}});return{text:J?H.trim():$,attachments:Z}}function KM($){return $.type==="file"?$.path.split(/[\\/]/).at(-1):$.label}function mf($,Z){let{source:J}=$,H=KM($);if($.type==="text")return{type:"text-attachment",source:$.source,label:H,text:$.text};return{type:"file-attachment",label:H,mediaType:$.mediaType,source:J,...$.purpose?{purpose:$.purpose}:{},previewUrl:Z,path:$.type==="file"?$.path:void 0}}function Z$0($){return FM($).text}function uf($){let Z=Z$0($),J=Z.search(/<moi-attachments>\s*(?:\[|\{"version":1,"attachments":\[)/);return(J<0||Z.includes(e70,J)?Z:Z.slice(0,J)).trimEnd()}var qX=10;function vK($){return $.length>qX?`A message can have at most ${qX} attachments.`:null}var pf=33554432;function cf($){return typeof $==="string"&&$.length>0&&!/[\\:\0]/.test($)&&$.split("/").every((Z)=>Z.length>0&&!Z.startsWith("."))}var af=P(m(),1);var df=()=>({emit($,...Z){for(let J=this.events[$]||[],H=0,B=J.length;H<B;H++)J[H](...Z)},events:{},on($,Z){return(this.events[$]||=[]).push(Z),()=>{this.events[$]=this.events[$]?.filter((J)=>Z!==J)}}});var J$0=({kind:$,name:Z})=>`${$}:${Z}`,H$0=1000,WM={cooldownMs:2000,windowMs:60000,maxPerWindow:10,maxKeys:64};function B$0($){let Z=df(),J=AU(WM),H=(X,z)=>{V8($,{source:"runtime",kind:X.kind,name:X.name,message:z})},B=(X,z,G,U,Y)=>{let F=X.admit(G);if(F==="ok")return!0;return H(z,F==="cooldown"?U:Y),!1},Q=(X,z,G)=>{return B(J,X,`${z}\x00${G}`,`sendChatMessage() for "${G}" was dropped: the same message was already sent less than ${WM.cooldownMs/1000}s ago. Call it from an event handler, not during render.`,`sendChatMessage() for "${G}" was dropped: more than ${WM.maxPerWindow} messages in a minute from this workspace. Each one starts an agent run, so send only on a real user action.`)};return{on(X,z){return Z.on(X,z)},connect(X,z=""){let G=!0,U=J$0(X);return{bridge:{get collab(){return G?NV:void 0},addChatAttachment(F){if(!G)return;try{let K=lf(F,U);Z.emit("addChatAttachment",K)}catch(K){let W=NM(K);T1.add({title:"Couldn’t add attachment",description:W,type:"error"}),H(X,`addChatAttachment() was dropped: ${W}`)}},navigate(F){if(!G)return;try{Z.emit("navigate",O8(F))}catch(K){H(X,`navigate() was dropped: ${NM(K)}`)}},resolveUrl(F){if(!G)return"";return O8(F,{workspaceId:$,base:z})},sendChatMessage(F,K){if(!G)return;try{if(typeof F==="string")F={message:F,attachments:K===void 0?[]:[{type:"text",label:"Context",text:JSON.stringify(K)}]};if(!z3(F)||typeof F.message!=="string")throw Error("This message uses an unsupported format");if("context"in F)throw Error("This message uses an outdated format");let W=F.message.trim();if(!W)throw Error("The message is empty");if(W.length>H$0)throw Error("Messages can be up to 1,000 characters");if(F.attachments!==void 0&&!Array.isArray(F.attachments))throw Error("The attachments use an unsupported format");let N=Array.from(F.attachments??[],(q)=>lf(q,U));if(!Q(X,U,W))return;Z.emit("sendChatMessage",{message:W,applet:{kind:X.kind,id:X.name},attachments:N})}catch(W){let N=NM(W);T1.add({title:"Couldn’t send message",description:N,type:"error"}),H(X,`sendChatMessage() was dropped: ${N}`)}}},dispose:()=>{G=!1}}}}}function lf($,Z){if(!z3($))throw Error("This attachment isn’t supported");if($.type==="text"){let J=YM($);if(J)return{type:"text",...J,source:Z};if(typeof $.label!=="string"||!$.label.trim())throw Error("Add a label to this text attachment");if($.label.trim().length>hK)throw Error(`Attachment labels can be up to ${hK} characters`);if(typeof $.text!=="string"||!$.text.trim())throw Error("Add some text to this attachment");if($.text.length>xK)throw Error(`Text attachments can be up to ${xK.toLocaleString("en-US")} characters`)}else if($.type==="file"){if($.file instanceof File&&$.path===void 0){if($.file.size>pf)throw Error("Files can be up to 32 MB");return{type:"file",file:$.file,source:Z}}if(typeof $.path==="string"&&$.file===void 0){if(!cf($.path))throw Error("Choose a file from this workspace");return{type:"file",path:$.path,source:Z}}}throw Error("This attachment isn’t supported")}function NM($){return $ instanceof Error?$.message:String($)}var rf=new Map;function gK($){let Z=rf.get($);if(!Z)Z=B$0($),rf.set($,Z);return Z}function mK($,Z,J){let H=q5(J);af.useEffect(()=>{let B=(...Q)=>H.current(...Q);return gK($).on(Z,B)},[$,Z,H])}var fK=new Map;function of($,Z,J,H,B=""){let Q=$.__attachBridge;if(typeof Q!=="function")return;fK.get(J)?.();let{bridge:X,dispose:z}=gK(Z).connect(H,B);fK.set(J,z),Q(X)}function qM($){let Z=fK.get($);if(!Z)return;fK.delete($),Z()}function uK($,Z,J){return`${$}/${Z}/${J}`}var LH=new Map,AX=new Map;function Q$0($,Z,J){return LH.get(uK($,Z,J))??0}var X$0="module";function nf($,Z,J){return`/api/workspaces/${Z}/${$}/${J}/${X$0}?v=${Q$0($,Z,J)}`}function pK($,Z,J){return`/api/workspaces/${Z}/${$}/${J}`}function b7($,Z){return`${$}/${Z}`}function sf($){return AX.get($)}function tf($,Z){AX.set($,Z)}function cK($,Z,J){let H=uK($,Z,J);AX.delete(H),LH.set(H,(LH.get(H)??0)+1),qM(H)}function AM($){let Z=`${$}/`;for(let J of new Set([...AX.keys(),...LH.keys()]))if(J.startsWith(Z))AX.delete(J),LH.set(J,(LH.get(J)??0)+1),qM(J)}var z$0={kind:"widget",segment:"widgets",shouldReload:($,Z)=>$.type==="widget:updated"&&$.name===Z||$.type==="applets:refresh"&&$.only!=="views"},G$0={kind:"view",segment:"views",shouldReload:($,Z)=>$.type==="view:updated"&&$.name===Z||$.type==="applets:refresh"&&$.only!=="widgets"};function U$0($,Z,J,H){let{segment:B}=$,Q=uK(B,Z,J),X=sf(Q);if(X)return X;let z=import(nf(B,Z,J)).then((G)=>{if(!G.default)throw Error(`"${J}" has no default export`);return of(G,Z,Q,{kind:$.kind,name:J},H),G.default});return tf(Q,z),z}function ef($,Z){let J=d1(),{base:H}=w2(),[B,Q]=MH.useState({status:"loading",version:0}),X=MH.useCallback(()=>{Q((z)=>({status:"loading",version:z.version})),U$0($,J,Z,H).then((z)=>Q((G)=>({status:"ready",Component:z,version:G.version+1}))).catch((z)=>{V8(J,{source:"load",kind:$.kind,name:Z,message:String(z),...z instanceof Error&&z.stack?{stack:z.stack}:{}}),Q((G)=>({status:"error",error:String(z),version:G.version+1}))})},[H,$,J,Z]);return MH.useEffect(()=>{X()},[X]),P2((z)=>{if($.shouldReload(z,Z))cK($.segment,J,Z),X()}),B}function $g($){return ef(z$0,$)}function Zg($){return ef(G$0,$)}function Jg(){let $=d1();P2((Z)=>{if(Z.type==="view:updated")cK("views",$,Z.name);else if(Z.type==="widget:updated")cK("widgets",$,Z.name);else if(Z.type==="applets:refresh"){if(Z.only!=="views")AM("widgets");if(Z.only!=="widgets")AM("views")}})}var t8=P(m(),1);function Hg($){return m1({queryKey:O0.layout($),queryFn:()=>B1(`/api/workspaces/${$}`),...M8})}function s8($){let Z=a0();return P2((J)=>{if(J.type==="harness:updated"&&J.workspaceId===$)Z.setQueryData(O0.agent($),(H)=>H?{...H,availability:J.availability}:H);if(J.type==="env:updated"&&J.workspaceId===$)Z.invalidateQueries({queryKey:O0.agent($)})}),m1({queryKey:O0.agent($),queryFn:async({signal:J})=>{let H=O0.agent($),B=Z.getQueryData(H),Q=B!==void 0&&B.availability.status!=="available",X=await B1(`/api/workspaces/${$}/agent${Q?"?refresh=true":""}`,{signal:J}),z=Z.getQueryData(H);return z&&z!==B?{...X,availability:z.availability}:X},staleTime:30000,refetchOnMount:(J)=>J.state.data?.availability.status==="available"?!0:"always",refetchOnWindowFocus:!0})}function Bg($){return m1({queryKey:O0.skills($),queryFn:()=>B1(`/api/workspaces/${$}/skills`),...M8})}async function Y$0($){let Z=await fetch(`/api/workspaces/${$}/skills/update`,{method:"POST"}),J=await Z.text(),H=null;try{H=JSON.parse(J)}catch{}if(!Z.ok){let B=H&&"error"in H?H.error:J,Q=Error(B||"Failed to update workspace skill");if(H?.skills)Q.status={skills:H.skills,updateAvailable:H.updateAvailable};throw Q}if(!H)throw Error("Invalid workspace skill update response");return H}function Qg($){let Z=a0();return r1({mutationFn:()=>Y$0($),onSuccess:(J)=>{Z.setQueryData(O0.skills($),J)},onError:(J)=>{if(J.status)Z.setQueryData(O0.skills($),J.status)}})}function Xg($){let Z=a0();return r1({mutationFn:(J)=>W4(`/api/workspaces/${$}`,Z5("PUT",{...J,origin:Y3}),"Failed to save layout"),onSuccess:()=>{Z.invalidateQueries({queryKey:O0.previews})}})}var DM={id:"_moi_views",config:{colSpan:4,rowSpan:1},defaultPosition:{x:0,y:0}},VM=[DM],F$0=new Set(VM.map(($)=>$.id));function _3($){return F$0.has($)}function zg($){return[...VM,...$]}function Gg(){return VM.map(($)=>({i:$.id,...$.defaultPosition}))}function dK(){return{open:["overview","scratchpad"],active:"overview"}}function lK($){let Z=dK();if(!$||typeof $!=="object")return Z;let J=$,H=Array.isArray(J.open)?J.open.filter(X3).filter((X,z,G)=>G.indexOf(X)===z):[];if(H.length===0)return Z;let B=["overview",...H.filter((X)=>X!=="overview")],Q=X3(J.active)&&B.includes(J.active)?J.active:"overview";return{open:B,active:Q}}function Ug(){return{version:1,widgetGrid:Gg(),layoutMode:"split",tabs:dK()}}function Yg($,Z,J){let{tabs:H,...B}=$,Q=Z.tabs??J?.tabs;return Q===void 0?B:{...B,tabs:Q}}var Ng=P(u(),1),LM=t8.createContext(null);function w1(){let $=t8.useContext(LM);if(!$)throw Error("useWorkspaceLayoutCtx must be used within <WorkspaceLayoutProvider>");return $}function Kg(){return t8.useContext(LM)?.layout.theme}function Fg($){let{cwd:Z,name:J,provider:H,agentId:B,...Q}=$;return Q}function Wg({id:$,children:Z}){let J=a0(),H=Hg($),B=Xg($),Q=q5(B.mutate),X=t8.useRef(null),z=t8.useRef(null),G=t8.useCallback((Y)=>{let F=O0.layout($),K=J.getQueryData(F);if(!K)return;J.cancelQueries({queryKey:F});let W={...K,...Y};if(J.setQueryData(F,W),z.current=Yg(Fg(W),Y,z.current),X.current)clearTimeout(X.current);X.current=setTimeout(()=>{X.current=null;let N=z.current;if(z.current=null,N)Q.current(N)},600)},[$,J,Q]),U=t8.useMemo(()=>({layout:H.data?Fg(H.data):Ug(),setLayout:G,name:H.data?.name??null,cwd:H.data?.cwd??null,provider:H.data?.provider??null,workspaceId:$,isLoading:H.isLoading}),[H.data,H.isLoading,G,$]);return Ng.jsx(LM,{value:U,children:Z})}var H4=P(m(),1);var rK=P(u(),1);function iK({visible:$,editing:Z,canvasRef:J,width:H,height:B,pointerProps:Q,onKeyDown:X,children:z}){if(!$)return null;return rK.jsxs("div",{className:"absolute inset-0 animate-in duration-100 fade-in",onKeyDown:X,children:[rK.jsx("canvas",{ref:J,...Q,width:H,height:B,"aria-label":"Drawing area",tabIndex:0,className:"absolute inset-0 size-full cursor-pencil touch-none outline-none"}),Z&&z]})}var Z1=P(m(),1);function PM($,Z,J){let H=Math.max($,Z);if(H<=0)return 1;return Math.min(Math.max(J,1),1568/H)}function K$0($){return new Promise((Z,J)=>{setTimeout(()=>J(Error("Annotation capture timed out")),$)})}function W$0($){if(!($ instanceof HTMLElement))return;let{overflowX:Z,overflowY:J}=$.style;if(J==="auto"||J==="scroll")$.style.overflowY="hidden";if(Z==="auto"||Z==="scroll")$.style.overflowX="hidden"}async function qg($){let Z=$.getBoundingClientRect();if(Z.width<=0||Z.height<=0)throw Error("Annotation target is not visible");let{createContext:J,destroyContext:H,domToCanvas:B}=await import("/chunk-j39y2aky.js"),Q=async()=>{let X=await J($,{width:Math.round(Z.width),height:Math.round(Z.height),scale:PM(Z.width,Z.height,window.devicePixelRatio),type:"image/png",backgroundColor:getComputedStyle($).backgroundColor,timeout:1000,features:{restoreScrollPosition:!0},style:{overflow:"hidden"},onCloneEachNode:W$0});try{return await B(X)}finally{H(X)}};return Promise.race([Q(),K$0(1e4)])}var _M={past:[],present:[],future:[]};function N$0($,Z){if(Z.type==="commit")return{past:[...$.past,$.present],present:[...$.present,Z.stroke],future:[]};if(Z.type==="undo"){let J=$.past.at(-1);if(!J)return $;return{past:$.past.slice(0,-1),present:J,future:[$.present,...$.future]}}if(Z.type==="redo"){let J=$.future[0];if(!J)return $;return{past:[...$.past,$.present],present:J,future:$.future.slice(1)}}if($.present.length===0)return $;return{past:[...$.past,$.present],present:[],future:[]}}function Vg($,Z,J){let H=$.getBoundingClientRect();return{x:(Z-H.left)/H.width*$.width,y:(J-H.top)/H.height*$.height}}function Ag($,Z){let J=Z.getCoalescedEvents?.()??[];return(J.length>0?J:[Z]).map((B)=>Vg($,B.clientX,B.clientY))}var q$0={canUndo:!1,canRedo:!1,hasStrokes:!1};function DX($){return Z1.useSyncExternalStore($.subscribeHistory,$.getHistoryState,$.getHistoryState)}function Dg($,Z,J,H){let B=Z.points[0];if(!B)return;$.beginPath(),$.lineCap="round",$.lineJoin="round",$.lineWidth=H,$.strokeStyle=J,$.moveTo(B.x,B.y);for(let Q=1;Q<Z.points.length;Q++){let X=Z.points[Q];$.lineTo(X.x,X.y)}if(Z.points.length===1)$.lineTo(B.x+0.01,B.y+0.01);$.stroke()}function Lg($,Z,J,H,B,Q=null){let X=Math.max(3,Math.min(Z,J)*0.005),z=X+Math.max(2,X*0.75),G=Q?[...B,Q]:B;for(let U of G)Dg($,U,H.haloColor,z);for(let U of G)Dg($,U,H.strokeColor,X)}function A$0($,Z,J,H=null){let B=$.getContext("2d");if(!B)return;B.clearRect(0,0,$.width,$.height),Lg(B,$.width,$.height,Z,J,H)}function D$0($,Z,J){let H=$.getContext("2d");if(!H)return;H.clearRect(0,0,$.width,$.height),H.drawImage(Z.snapshot,0,0,$.width,$.height),Lg(H,$.width,$.height,Z,J)}function V$0($){return new Promise((Z,J)=>{$.toBlob((H)=>{if(H)Z(H);else J(Error("Could not export drawing"))},"image/png")})}function L$0($,Z,J){let H=$.getBoundingClientRect();if(H.width<=0||H.height<=0)return null;let B=getComputedStyle($),Q=PM(H.width,H.height,window.devicePixelRatio),X=Math.max(1,Math.round(H.width*Q)),z=Math.max(1,Math.round(H.height*Q)),G=document.createElement("canvas");G.width=X,G.height=z;let U=B.getPropertyValue("--background").trim()||"#ffffff",Y=G.getContext("2d");if(Y)Y.fillStyle=U,Y.fillRect(0,0,X,z);return Z.width=X,Z.height=z,{id:J,snapshot:G,strokeColor:B.getPropertyValue("--primary").trim()||"#2563eb",haloColor:U,targetWidth:H.width,targetHeight:H.height}}function M$0($){return $ instanceof HTMLInputElement||$ instanceof HTMLTextAreaElement||$ instanceof HTMLElement&&$.isContentEditable}function aK({mode:$="annotation",onChange:Z,onEditingStart:J,onFinish:H}={}){let B=Z1.useRef(null),Q=Z1.useRef(null),[X,z]=Z1.useState(null),G=Z1.useRef(X),[U,Y]=Z1.useState(!1),F=Z1.useRef(!1),K=Z1.useRef(_M),W=Z1.useRef(q$0),N=Z1.useRef(new Set),q=Z1.useRef(0),D=Z1.useRef(null),A=Z1.useRef(null),V=Z1.useRef(0),L=Z1.useRef(0),O=Z1.useRef(null),M=Z1.useRef(null),[_,w]=Z1.useState(!1),C=Z1.useRef(!1),[E,T]=Z1.useState(!1),k=Z1.useRef(!1),S=q5(Z),I=q5(J),j=q5(H),y=Z1.useCallback(()=>{let s=K.current,a=W.current,$0={canUndo:s.past.length>0,canRedo:s.future.length>0,hasStrokes:s.present.length>0};if($0.canUndo===a.canUndo&&$0.canRedo===a.canRedo&&$0.hasStrokes===a.hasStrokes)return;W.current=$0;for(let t of N.current)t()},[]),R=Z1.useCallback((s)=>{return N.current.add(s),()=>{N.current.delete(s)}},[]),x=Z1.useCallback(()=>W.current,[]),v=Z1.useCallback((s,a=null)=>{if(V.current)cancelAnimationFrame(V.current),V.current=0;let $0=Q.current,t=G.current;if($0&&t)A$0($0,t,s,a)},[]),f=Z1.useCallback(()=>{if(V.current)return;V.current=requestAnimationFrame(()=>{V.current=0,v(K.current.present,D.current)})},[v]),b=Z1.useCallback((s,a,$0)=>{let t=O.current;if(t?.sessionId===s.id&&t.historyVersion===$0)return Promise.resolve(t.blob);let B0=M.current;if(B0?.sessionId===s.id&&B0.historyVersion===$0)return B0.promise;if(a.length===0)return O.current={sessionId:s.id,historyVersion:$0,blob:null},S.current?.(null),Promise.resolve(null);let _0=document.createElement("canvas");_0.width=s.snapshot.width,_0.height=s.snapshot.height,D$0(_0,s,a);let P0=V$0(_0).then((A0)=>{if(G.current?.id!==s.id||q.current!==$0)return A0;return O.current={sessionId:s.id,historyVersion:$0,blob:A0},S.current?.(A0),A0}).catch(()=>{if(G.current?.id===s.id&&q.current===$0)T1.add({title:"Couldn’t export the drawing",type:"error"});return null}).finally(()=>{if(M.current?.promise===P0)M.current=null});return M.current={sessionId:s.id,historyVersion:$0,promise:P0},P0},[S]),l=Z1.useCallback(()=>{if(!D.current)return;let s=Q.current,a=A.current;if(s&&a!==null&&s.hasPointerCapture(a))s.releasePointerCapture(a);D.current=null,A.current=null,v(K.current.present)},[v]),r=Z1.useCallback((s)=>{let a=G.current;if(!a||k.current)return;let $0=N$0(K.current,s);if($0===K.current)return;K.current=$0,y(),D.current=null;let t=++q.current;v($0.present),b(a,$0.present,t)},[b,y,v]),h=Z1.useCallback((s)=>{K.current=_M,q.current=0,O.current=null,M.current=null,D.current=null,A.current=null,y(),G.current=s,z(s)},[y]),d=Z1.useCallback(()=>{if(F.current)return;F.current=!0,Y(!0),I.current?.()},[I]),o=Z1.useCallback(async()=>{let s=B.current;if(!s||G.current||C.current)return!1;let a=++L.current;C.current=!0,w(!0);try{let $0=await qg(s);if(a!==L.current||B.current!==s)return!1;let t=s.getBoundingClientRect(),B0=getComputedStyle(s),_0={id:a,snapshot:$0,strokeColor:B0.getPropertyValue("--primary").trim()||"#2563eb",haloColor:B0.getPropertyValue("--background").trim()||"#ffffff",targetWidth:t.width,targetHeight:t.height};return h(_0),d(),!0}finally{if(a===L.current)C.current=!1,w(!1)}},[d,h]),c=Z1.useCallback(()=>{let s=G.current;L.current+=1,C.current=!1,k.current=!1,w(!1),T(!1),F.current=!1,Y(!1),l(),z(null),K.current=_M,y();let a=M.current;if(!s||a?.sessionId!==s.id)return G.current=null,Promise.resolve();return a.promise.then(()=>{if(G.current?.id===s.id)G.current=null})},[l,y]),i=Z1.useCallback(async()=>{let s=G.current;if(!s)return null;return l(),b(s,K.current.present,q.current)},[l,b]),n=Z1.useCallback(async()=>{return F.current=!1,Y(!1),i()},[i]),Z0=Z1.useCallback(async()=>{let s=G.current;if(!s||k.current)return null;k.current=!0,T(!0),l();let a=q.current,$0=K.current.present,t=null;if($0.length>0||a>0)t=await b(s,$0,a);if(G.current?.id!==s.id)return t;try{await j.current?.(t)}finally{if(G.current?.id===s.id)L.current+=1,F.current=!1,Y(!1),G.current=null,z(null),k.current=!1,T(!1)}return t},[l,b,j]),J0=Z1.useCallback(()=>r({type:"undo"}),[r]),U0=Z1.useCallback(()=>r({type:"redo"}),[r]),z0=Z1.useCallback(()=>r({type:"clear"}),[r]),X0=Z1.useMemo(()=>({onPointerDown:(s)=>{if(k.current||!s.isPrimary||s.pointerType==="mouse"&&s.button!==0)return;if(!G.current&&$==="sketch"){let a=B.current;if(!a)return;let $0=L$0(a,s.currentTarget,++L.current);if(!$0)return;h($0)}if(!G.current)return;d(),A.current=s.pointerId,s.currentTarget.setPointerCapture(s.pointerId),D.current={points:[Vg(s.currentTarget,s.clientX,s.clientY)]},v(K.current.present,D.current)},onPointerMove:(s)=>{if(s.pointerId!==A.current||!D.current)return;D.current.points.push(...Ag(s.currentTarget,s.nativeEvent)),f()},onPointerUp:(s)=>{if(s.pointerId!==A.current||!D.current)return;let a=D.current;if(a.points.push(...Ag(s.currentTarget,s.nativeEvent)),D.current=null,A.current=null,s.currentTarget.hasPointerCapture(s.pointerId))s.currentTarget.releasePointerCapture(s.pointerId);r({type:"commit",stroke:a})},onPointerCancel:(s)=>{if(s.pointerId===A.current)l()}}),[r,d,l,h,$,v,f]),N0=Z1.useCallback((s)=>{if(M$0(s.target))return;if(s.key==="Escape"&&$==="annotation"){s.preventDefault(),Z0();return}if(!(s.metaKey||s.ctrlKey)||s.key.toLowerCase()!=="z")return;if(s.preventDefault(),s.shiftKey)U0();else J0()},[Z0,$,U0,J0]);Z1.useLayoutEffect(()=>{if(!X)return;if(v(K.current.present,D.current),U)Q.current?.focus()},[U,v,X]),Z1.useEffect(()=>{if(!X||$==="sketch")return;let s=B.current;if(!s){c();return}let a=new ResizeObserver(($0)=>{let t=$0[0]?.contentRect;if(!t)return;if(Math.abs(t.width-X.targetWidth)>1||Math.abs(t.height-X.targetHeight)>1)c()});return a.observe(s),()=>a.disconnect()},[c,$,X]),Z1.useEffect(()=>()=>{if(L.current+=1,F.current=!1,G.current=null,V.current)cancelAnimationFrame(V.current)},[]);let q0=Z1.useMemo(()=>({active:U,visible:$==="sketch"||X!==null,starting:_,finishing:E,open:o,undo:J0,redo:U0,clear:z0,flush:i,deactivate:n,finish:Z0,cancel:c,subscribeHistory:R,getHistoryState:x}),[U,$,X,_,E,o,J0,U0,z0,i,n,Z0,c,R,x]),K0=Z1.useMemo(()=>({visible:q0.visible,editing:q0.active,canvasRef:Q,width:X?.snapshot.width??1,height:X?.snapshot.height??1,pointerProps:X0,onKeyDown:N0}),[q0.active,q0.visible,X,X0,N0]);return Z1.useMemo(()=>({targetRef:B,controls:q0,layerProps:K0}),[q0,K0])}var H2=P(u(),1);function nK({controls:$,title:Z,busy:J,onComplete:H}){let{canUndo:B,canRedo:Q,hasStrokes:X}=DX($);return H2.jsxs("div",{className:"absolute bottom-3 left-1/2 flex -translate-x-1/2 items-center gap-2 rounded-lg bg-popover p-1.5 shadow-md",children:[H2.jsx("span",{className:"mr-2 ml-2 text-sm font-medium",children:Z}),H2.jsxs("div",{className:"flex gap-1",children:[H2.jsxs(t1,{children:[H2.jsx(e1,{render:H2.jsx(L0,{type:"button",variant:"outline",size:"icon-sm",onClick:$.undo,disabled:J||!B,"aria-label":"Undo",children:H2.jsx(oK,{stroke:1.75})})}),H2.jsx($5,{children:"Undo"})]}),H2.jsxs(t1,{children:[H2.jsx(e1,{render:H2.jsx(L0,{type:"button",variant:"outline",size:"icon-sm",onClick:$.redo,disabled:J||!Q,"aria-label":"Redo",children:H2.jsx(Mg,{stroke:1.75})})}),H2.jsx($5,{children:"Redo"})]}),H2.jsx(L0,{type:"button",variant:"outline",size:"sm",onClick:$.clear,disabled:J||!X,children:"Clear"})]}),H2.jsx(m4,{mode:"popLayout",initial:!1,children:H2.jsx(K5.div,{variants:{from:{opacity:0,scale:0.8,filter:"blur(4px)"},to:{opacity:1,scale:1,filter:"blur(0px)"}},initial:"from",animate:"to",exit:"from",transition:{type:"spring",duration:0.1,bounce:0},children:H2.jsx(L0,{type:"button",variant:X?"default":"ghost",size:"icon-sm",onClick:H,disabled:J,"aria-label":"Complete",className:Q0(!X&&"text-muted-foreground"),children:X?H2.jsx(i8,{stroke:1.75}):H2.jsx(i5,{stroke:1.75})})},X?"complete":"cancel")})]})}var B2=P(m(),1);async function VX($,Z){let J=`/api/workspaces/${$}/uploads`;if(typeof Z==="string")return B1(`${J}/from-path`,Z5("POST",{path:Z}),"The file couldn’t be uploaded");let H=new FormData;H.append("files",Z);let[B]=await B1(J,{method:"POST",body:H},"The file couldn’t be uploaded");if(!B)throw Error("The upload didn’t finish");return B}function OM({workspaceId:$,sessionId:Z}){if((x1.getState().attachments[L8($,Z)]??[]).length<qX)return!0;return T1.add({id:"draft-attachment-limit",title:"Attachment limit reached",description:`You can attach up to ${qX} items. Remove one to add another.`,type:"error"}),!1}function Pg($,Z){for(let J of Z)_g($,J)}async function _g({workspaceId:$,sessionId:Z},J,H,B){if(!OM({workspaceId:$,sessionId:Z}))return;let Q=typeof J==="string"?null:J,X=typeof J==="string"?J.split("/").at(-1):J.name||"file",z=crypto.randomUUID();x1.getState().addAttachments($,Z,[{kind:"file",source:B,localId:z,label:X,mediaType:Q?.type||"application/octet-stream",previewUrl:Q?.type.startsWith("image/")?URL.createObjectURL(Q):void 0,status:"uploading"}]);try{let G=await VX($,J);x1.getState().updateAttachment($,z,{status:"ready",upload:G,label:G.filename,mediaType:G.mediaType,...G.kind==="image"&&!Q?.type.startsWith("image/")?{previewUrl:`/api/workspaces/${$}/uploads/${G.id}`}:{}})}catch(G){let U=G instanceof Error?G.message:"The file couldn’t be uploaded";x1.getState().removeAttachment($,z),T1.add({title:`Couldn’t add ${X}`,description:U,type:"error"}),H?.(U)}}function Og($,Z){if(Z.type==="text"){let{source:J,label:H,text:B}=Z;return P$0($,{source:J,label:H,text:B}),Promise.resolve()}return _g($,Z.file??Z.path,(J)=>{V8($.workspaceId,{source:"runtime",message:`addChatAttachment() from ${Z.source}: ${J}`})},Z.source)}function LX({workspaceId:$,sessionId:Z,localId:J,purpose:H,source:B,blob:Q}){let X=H==="sketch"?"Sketch":"Annotation",z=x1.getState(),G=DU(z.attachments,$,J);if(!G&&!OM({workspaceId:$,sessionId:Z}))return!1;let U=URL.createObjectURL(Q);if(G)z.updateAttachment($,J,{previewUrl:U,status:"draft",upload:void 0});else z.addAttachments($,Z,[{kind:"drawing",purpose:H,localId:J,source:B,label:`${X}.png`,mediaType:"image/png",previewUrl:U,status:"draft"}]);return!0}async function sK($){let{workspaceId:Z,localId:J,purpose:H,blob:B,isCurrent:Q}=$,X=H==="sketch"?"Sketch":"Annotation";if(!LX($))return;x1.getState().updateAttachment(Z,J,{status:"uploading"});try{let z=await VX(Z,new File([B],`${X}.png`,{type:"image/png"}));if(!Q())return;x1.getState().updateAttachment(Z,J,{status:"ready",upload:z,mediaType:z.mediaType})}catch{if(!Q())return;x1.getState().removeAttachment(Z,J)}}function P$0({workspaceId:$,sessionId:Z},J){if(!OM({workspaceId:$,sessionId:Z}))return;x1.getState().addAttachments($,Z,[{kind:"text",localId:crypto.randomUUID(),...J}])}function Tg({workspaceId:$,sessionId:Z,activeTab:J,mode:H,available:B,closePopup:Q,openPopup:X}){let z=B2.useRef(null),G=B2.useRef(new Map),U=q5(Q),Y=q5(X),F=B2.useCallback((j)=>{let y=z.current;if(!y)return;if(!j){x1.getState().removeAttachment(y.workspaceId,y.attachmentId);return}LX({workspaceId:y.workspaceId,sessionId:y.sourceSessionId,localId:y.attachmentId,purpose:"annotation",source:y.source,blob:j})},[]),K=B2.useCallback(async(j)=>{let y=z.current;if(!y)return;z.current=null;let R=(G.current.get(y.attachmentId)??0)+1;G.current.set(y.attachmentId,R);let x=()=>G.current.get(y.attachmentId)===R,v=await j;if(!v||!x())return;await sK({workspaceId:y.workspaceId,sessionId:y.sourceSessionId,localId:y.attachmentId,purpose:"annotation",source:y.source,blob:v,isCurrent:x})},[]),W=B2.useCallback(async(j)=>{let y=z.current;if(await K(j),y?.origin==="popup")Y.current()},[Y,K]),N=aK({onChange:F,onFinish:W}),{controls:q}=N,{active:D,starting:A,open:V,finish:L,flush:O,cancel:M}=q;B2.useLayoutEffect(()=>()=>{if(z.current)K(O())},[O,K]);let _=B2.useCallback(async(j)=>{if(!B||D||A)return;let y={workspaceId:$,sourceSessionId:Z,source:J,origin:j,attachmentId:crypto.randomUUID()};z.current=y;try{if(!await V()){if(z.current===y)z.current=null;return}if(j==="popup")U.current()}catch{if(z.current!==y)return;z.current=null,T1.add({title:"Couldn’t capture this page",type:"error"})}},[D,J,B,U,V,Z,A,$]),w=B2.useCallback(async()=>{let j=z.current?K(O()):void 0;await M(),await j},[M,O,K]),C=B2.useCallback((j)=>{let y=(G.current.get(j)??0)+1;if(G.current.set(j,y),x1.getState().removeAttachment($,j),z.current?.attachmentId===j)z.current=null,M()},[M,$]),E=B2.useCallback(async()=>{if(A){await w();return}await L()},[w,L,A]),T=B2.useCallback(()=>{if(D||A)E();else _("docked")},[D,E,_,A]),k=B2.useCallback(()=>{if(D||A)E();else _("popup")},[D,E,_,A]);B2.useEffect(()=>{let j=z.current;if(!j)return;let y=j.origin==="docked"?"split":"fullscreen";if(j.workspaceId!==$||j.sourceSessionId!==Z||j.source!==J||H!==y||!B)w()},[J,B,w,H,Z,$]);let S=B2.useMemo(()=>B?{active:D||A,finish:E,onRemove:C,onToggle:T}:void 0,[B,D,A,E,C,T]),I=B2.useMemo(()=>B?{active:D||A,finish:E,onRemove:C,onToggle:k}:void 0,[B,D,A,E,C,k]);return B2.useMemo(()=>({...N,docked:S,popup:I}),[N,S,I])}var z8=P(m(),1);var e8=P(u(),1);function TM($){if(!$)return;$.focus();let Z=$.value.length;$.setSelectionRange(Z,Z)}function Cg({composerRef:$,className:Z,onMouseDown:J,children:H,...B}){return e8.jsx("form",{...B,onMouseDown:(Q)=>{if(J?.(Q),Q.defaultPrevented)return;if(Q.target instanceof Element&&Q.target.closest('button, input, textarea, select, a, [contenteditable="true"]'))return;TM($.current)},className:Q0("group/composer flex w-full cursor-text flex-col gap-1 rounded-xl bg-card p-2 text-card-foreground shadow-xs transition-[color,box-shadow] outline-none focus-within:shadow-sm",Z),children:H})}function Eg({textareaRef:$,className:Z,...J}){return e8.jsx("textarea",{...J,ref:$,className:Q0("field-sizing-content max-h-40 w-full resize-none bg-transparent px-2 py-1 text-sm leading-relaxed outline-none placeholder:text-muted-foreground disabled:opacity-50",Z)})}function bg({className:$,children:Z,...J}){return e8.jsx("div",{...J,className:Q0("flex items-center justify-end gap-3",$),children:Z})}function _$0($){if($.status==="checking")return"Checking agent status…";return}function MX($,Z,J){return $&&!Z&&J.status==="available"}function wg({label:$,hasContent:Z,busy:J=!1,loading:H=!1,availability:B}){let Q=MX(Z,J||H,B),X=_$0(B),z=e8.jsx(L0,{type:"submit",size:"icon",disabled:!Q,"aria-label":$,children:H?e8.jsx(n2,{}):e8.jsx(jg,{stroke:1.5})});if(H||!X)return z;return e8.jsxs(t1,{children:[e8.jsx(e1,{render:e8.jsx("span",{className:"inline-flex",children:z})}),e8.jsx($5,{className:"max-w-64 text-center",children:X})]})}var T8=P(m(),1),O$0=48;function Sg($,Z){let J=T8.useRef(!0),[H,B]=T8.useState(!0),Q=T8.useCallback((G)=>{J.current=G,B((U)=>U===G?U:G)},[]),X=T8.useCallback((G="auto")=>{let U=$.current;if(!U)return;Q(!0),U.scrollTo({top:U.scrollHeight,behavior:G})},[$,Q]),z=T8.useCallback(()=>{let G=$.current;if(!G)return;Q(!1),G.scrollTo({top:0,behavior:"auto"})},[$,Q]);return T8.useEffect(()=>{let G=$.current;if(!G)return;let U=()=>{let Y=G.scrollHeight-G.scrollTop-G.clientHeight;Q(Y<=O$0)};return G.addEventListener("scroll",U,{passive:!0}),()=>G.removeEventListener("scroll",U)},[$,Q]),T8.useEffect(()=>{let G=$.current;if(!G)return;let U=G.firstElementChild??G,Y=new ResizeObserver(()=>{if(J.current)G.scrollTop=G.scrollHeight});return Y.observe(U),()=>Y.disconnect()},[$]),T8.useLayoutEffect(()=>{X("auto")},[Z,X]),{atBottom:H,scrollToBottom:X,scrollToTop:z}}function T$0($){return $.origin.kind!=="replay"&&$.origin.kind!=="synthetic"&&$.origin.kind!=="subagent-prompt"}function Rg($,Z){let J=$.meta||Z.meta?{...$.meta,...Z.meta}:void 0;return{...$,parts:[...$.parts,...Z.parts],timestamp:Z.timestamp??$.timestamp,meta:J}}function Ig($,Z){if(!Z)return $;let J=$.at(-1);if(J?.role==="assistant")return[...$.slice(0,-1),Rg(J,Z)];return[...$,Z]}function kg($){let Z=[];for(let J of $){if(!T$0(J))continue;if(J.role!=="assistant"){Z.push(J);continue}let H=Z.length>0?Z[Z.length-1]:null;if(H?.role==="assistant")Z[Z.length-1]=Rg(H,J);else Z.push(J)}return Z.map((J,H)=>{let B=Z[H-1];if(J.role!=="assistant"||J.meta?.durationMs!==void 0||B?.role!=="user"||B.origin.kind!=="user-input"||!B.timestamp||!J.timestamp)return J;let Q=Date.parse(B.timestamp),X=Date.parse(J.timestamp);if(!Number.isFinite(Q)||!Number.isFinite(X)||X<Q)return J;return{...J,meta:{...J.meta,durationMs:X-Q}}})}function jM($){switch($.kind){case"warning":return $.message;case"compact":return"Context compacted";case"model-change":return $.prev?`Model changed to ${$.model} (was ${$.prev})`:`Model changed to ${$.model}`;case"api-retry":return $.error?`Retrying: ${$.error}`:"Retrying the connection";case"rate-limit":case"hook":case"session-state":case"files-persisted":case"elicitation":default:return null}}function yg($){if(!$)return;let Z=Date.parse($);return Number.isNaN(Z)?void 0:Z}function xg($,Z){let J=Z.filter((G)=>jM(G)!==null);if(J.length===0)return $.map((G)=>({kind:"turn",turn:G}));let H=[],B=[];for(let G of J){let U=yg(G.at);if(U===void 0)B.push(G);else H.push({notice:G,time:U})}H.sort((G,U)=>G.time-U.time);let Q=[],X=0,z=Number.NEGATIVE_INFINITY;for(let G of $){z=Math.max(z,yg(G.timestamp)??z);while(X<H.length&&H[X].time<=z)Q.push({kind:"notice",notice:H[X].notice}),X+=1;Q.push({kind:"turn",turn:G})}for(;X<H.length;X+=1)Q.push({kind:"notice",notice:H[X].notice});for(let G of B)Q.push({kind:"notice",notice:G});return Q}var Q2=P(u(),1);function PH({label:$,icon:Z,onRemove:J,previewUrl:H,loading:B,className:Q,children:X,...z}){return Q2.jsxs("div",{...z,className:Q0("group relative flex max-w-full min-w-0 cursor-default items-center rounded-md bg-background text-sm whitespace-nowrap text-foreground ring-1 ring-border outline-none focus-visible:ring-3 focus-visible:ring-ring/50",H?"size-14 overflow-hidden":"h-7 pr-2 pl-0.5",Q),children:[B&&Q2.jsx("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center bg-background/70",children:Q2.jsx(r5,{size:16,stroke:1.75,className:"animate-spin text-muted-foreground"})}),H?Q2.jsx(C$0,{label:$,previewUrl:H,onRemove:J}):Q2.jsx(j$0,{label:$,icon:Z,onRemove:J}),X]})}function j$0({label:$,icon:Z,onRemove:J}){return Q2.jsxs(Q2.Fragment,{children:[J?Q2.jsxs(L0,{type:"button",variant:"ghost",size:"icon-sm",onClick:J,"aria-label":`Remove ${$}`,className:"size-6 shrink-0 hover:bg-transparent hover:text-current",children:[Q2.jsx(Z,{stroke:1.75,className:"group-focus-within:hidden group-hover:hidden"}),Q2.jsx(i5,{stroke:1.75,className:"hidden group-focus-within:block group-hover:block"})]}):Q2.jsx("span",{className:"flex size-6 shrink-0 items-center justify-center",children:Q2.jsx(Z,{size:16,stroke:1.75})}),Q2.jsx("span",{className:"truncate",children:$})]})}function C$0({label:$,previewUrl:Z,onRemove:J}){return Q2.jsxs(Q2.Fragment,{children:[Q2.jsx("img",{src:Z,alt:$,className:"size-full object-cover"}),J&&Q2.jsx(L0,{type:"button",variant:"outline",size:"icon-sm",onClick:J,"aria-label":`Remove ${$}`,className:"absolute top-1 right-1 size-4 rounded-xs border-0 opacity-0 shadow-xs transition-opacity group-focus-within:opacity-100 group-hover:opacity-100 [&_svg]:size-3",children:Q2.jsx(i5,{stroke:1.75})})]})}var vg=P(u(),1);function PX({label:$,onRemove:Z}){return vg.jsx(PH,{label:$,icon:hg,onRemove:Z})}var S7={};k5(S7,{createHandle:()=>Gm,Viewport:()=>zm,Trigger:()=>sg,Root:()=>ig,Positioner:()=>eg,Portal:()=>og,Popup:()=>Zm,Handle:()=>JW,Backdrop:()=>Qm,Arrow:()=>Hm});var lg=P(m(),1);var tK=P(m(),1),CM=tK.createContext(void 0);function T4($){let Z=tK.useContext(CM);if(Z===void 0&&!$)throw Error(I0(50));return Z}var gg=P(m(),1);var fg=600,eK=300;var mg={...$3,instantType:($)=>$.instantType,adaptiveOrigin:($)=>$.adaptiveOrigin,closeDelay:($)=>$.closeDelay};class EM extends p2{constructor($,Z,J){let H=new y2;super(pg($,H,Z,J),cg(H),mg)}setOpen=($,Z)=>{let{inlineRectCoordsRef:J}=this.context;gG(this,$,Z,{onBeforeDispatch(){let H=Z.event;if($&&Z.reason===F0.triggerHover&&Z.trigger&&"clientX"in H&&"clientY"in H&&J.current?.element!==Z.trigger)zD(J,Z.trigger,H.clientX,H.clientY)}})}}function ug(){let $=new y2;return new A9(Object.freeze(pg(void 0,$)),Object.freeze(cg($)),mg)}function pg($,Z,J,H=!1){return{...e9(Z,J,H),instantType:void 0,adaptiveOrigin:void 0,closeDelay:eK,...$}}function cg($){return{popupRef:gg.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:$,inlineRectCoordsRef:{current:void 0}}}var w7=P(u(),1);function dg($){let{open:Z,defaultOpen:J=!1,onOpenChange:H,onOpenChangeComplete:B,actionsRef:Q,handle:X,triggerId:z,defaultTriggerId:G=null,children:U}=$,Y=R6((A,V)=>new EM({open:J,openProp:Z,activeTriggerId:G,triggerIdProp:z},A,V));Y.useControlledProp("openProp",Z),Y.useControlledProp("triggerIdProp",z),Y.useContextCallback("onOpenChange",H),Y.useContextCallback("onOpenChangeComplete",B);let F=Y.useState("open"),K=Y.useState("activeTriggerId"),W=Y.useState("mounted"),N=Y.useState("payload");n9(Y,{closeOnActiveTriggerUnmount:!0});let{forceUnmount:q}=s9(F,Y,()=>{Y.context.inlineRectCoordsRef.current=void 0});H0(()=>{if(F){if(K==null)Y.set("payload",void 0)}},[Y,K,F]),lg.useImperativeHandle(Q,()=>({unmount:q,close:()=>Y.setOpen(!1,w0(F0.imperativeAction))}),[q,Y]);let D=F||W;return w7.jsxs(CM.Provider,{value:Y,children:[X&&w7.jsx(a9,{handle:X,store:Y}),D&&w7.jsx(E$0,{store:Y}),typeof U==="function"?U({payload:N}):U]})}function E$0({store:$}){let Z=$.useState("floatingRootContext"),J=K9(Z);return t9($,{activeTriggerProps:J.reference,inactiveTriggerProps:J.trigger,popupProps:J.floating}),null}var ig=X9(function(Z){if(T4(!0))return w7.jsx(dg,{...Z});return w7.jsx(M$,{children:w7.jsx(dg,{...Z})})});var ag=P(m(),1);var $W=P(m(),1),bM=$W.createContext(void 0);function rg(){let $=$W.useContext(bM);if($===void 0)throw Error(I0(48));return $}var wM=P(u(),1),og=ag.forwardRef(function(Z,J){let{keepMounted:H=!1,...B}=Z;if(!(T4().useState("mounted")||H))return null;return wM.jsx(bM.Provider,{value:H,children:wM.jsx(eZ,{ref:J,...B})})});var ng=P(m(),1);var sg=u9(function(Z,J){let{render:H,className:B,delay:Q,closeDelay:X,id:z,payload:G,handle:U,style:Y,...F}=Z,K=T4(!0),N=Z3(U)??K;if(!N)throw Error(I0(89));let q=t0(z),D=N.useState("isTriggerActive",q),A=N.useState("isOpenedByTrigger",q),V=N.useState("floatingRootContext"),L=N.context.inlineRectCoordsRef,O=ng.useRef(null),M=Q??fg,_=X??eK,{registerTrigger:w,isMountedByThisTrigger:C}=o9(q,O,N,{payload:G,closeDelay:_}),E=N9(V,{mouseOnly:!0,move:!1,handleClose:q9(),delay:()=>({open:M,close:_}),triggerElementRef:O,isActiveTrigger:D,isClosing:()=>N.select("transitionStatus")==="ending"}),T=T$(V,{delay:M}),k={open:A},S=N.useState("triggerProps",C),I=DE(L,A);return G0("a",Z,{state:k,ref:[J,w,O],props:[E,T.reference,S,I,{id:q},F],stateAttributesMapping:p9})});var tg=P(m(),1);var ZW=P(m(),1),SM=ZW.createContext(void 0);function _H(){let $=ZW.useContext(SM);if($===void 0)throw Error(I0(49));return $}var RM=P(u(),1),eg=tg.forwardRef(function(Z,J){let{render:H,className:B,anchor:Q,positionMethod:X="absolute",side:z="bottom",align:G="center",sideOffset:U=0,alignOffset:Y=0,collisionBoundary:F="clipping-ancestors",collisionPadding:K=5,arrowPadding:W=5,sticky:N=!1,disableAnchorTracking:q=!1,collisionAvoidance:D=i9,style:A,...V}=Z,L=T4(),O=rg(),M=p3(),_=L.useState("open"),w=L.useState("mounted"),C=L.useState("floatingRootContext"),E=L.useState("instantType"),T=L.useState("transitionStatus"),k=L.useState("adaptiveOrigin"),S=L.context.inlineRectCoordsRef,I=H3({anchor:Q,floatingRootContext:C,positionMethod:X,mounted:w,side:z,sideOffset:U,align:G,alignOffset:Y,arrowPadding:W,collisionBoundary:F,collisionPadding:K,sticky:N,disableAnchorTracking:q,keepMounted:O,nodeId:M,collisionAvoidance:D,adaptiveOrigin:k,inline:VE(S)}),j=I.update;H0(()=>{if(_&&w)j()},[_,w,j]);let y={open:_,side:I.side,align:I.align,anchorHidden:I.anchorHidden,instant:E},R=Q3(Z,y,{styles:I.positionerStyles,transitionStatus:T,props:V,refs:[J,L.useStateSetter("positionerElement")],hidden:!w,inert:!_});return RM.jsx(SM.Provider,{value:I,children:RM.jsx(L$,{id:M,children:R})})});var $m=P(m(),1);var Zm=$m.forwardRef(function(Z,J){let{className:H,render:B,style:Q,...X}=Z,z=T4(),{side:G,align:U}=_H(),Y=z.useState("open"),F=z.useState("instantType"),K=z.useState("transitionStatus"),W=z.useState("popupProps"),N=z.useState("floatingRootContext"),q=z.useState("closeDelay");return L5({open:Y,ref:z.context.popupRef,onComplete(){if(Y)z.context.onOpenChangeComplete?.(!0)}}),d3(N,{closeDelay:q}),G0("div",Z,{state:{open:Y,side:G,align:U,instant:F,transitionStatus:K},ref:[J,z.context.popupRef,z.useStateSetter("popupElement")],props:[r9,W,B3(K),X],stateAttributesMapping:X4})});var Jm=P(m(),1);var Hm=Jm.forwardRef(function(Z,J){let{render:H,className:B,style:Q,...X}=Z,z=T4(),{arrowRef:G,side:U,align:Y,arrowUncentered:F,arrowStyles:K}=_H(),N={open:z.useState("open"),side:U,align:Y,uncentered:F};return G0("div",Z,{state:N,ref:[G,J],props:[{style:K,"aria-hidden":!0},X],stateAttributesMapping:N8})});var Bm=P(m(),1);var Qm=Bm.forwardRef(function(Z,J){let{render:H,className:B,style:Q,...X}=Z,z=T4(),G=z.useState("open"),U=z.useState("mounted"),Y=z.useState("transitionStatus");return G0("div",Z,{state:{open:G,transitionStatus:Y},ref:[J],props:[{role:"presentation",hidden:!U,style:{pointerEvents:"none",userSelect:"none",WebkitUserSelect:"none"}},X],stateAttributesMapping:X4})});var Xm=P(m(),1);var zm=Xm.forwardRef(function(Z,J){let{render:H,className:B,style:Q,children:X,...z}=Z,G=T4(),U=_H(),Y=G.useState("instantType"),{children:F,state:K}=y6({store:G,side:U.side,children:X}),W={activationDirection:K.activationDirection,transitioning:K.transitioning,instant:Y};return G0("div",Z,{state:W,ref:J,props:[z,{children:F}],stateAttributesMapping:k6})});class JW extends W9{constructor(){super(ug(),"PreviewCard")}open($){this.openByTrigger($)}close(){this.closePopup()}get isOpen(){return this.attachedStore?.select("open")??!1}}function Gm(){return new JW}var OH=P(u(),1);function Um({...$}){return OH.jsx(S7.Root,{"data-slot":"hover-card",...$})}function Ym({...$}){return OH.jsx(S7.Trigger,{"data-slot":"hover-card-trigger",...$})}function Fm({className:$,side:Z="bottom",sideOffset:J=4,align:H="center",alignOffset:B=0,...Q}){return OH.jsx(g8,{portal:S7.Portal,"data-slot":"hover-card-portal",children:OH.jsx(S7.Positioner,{align:H,alignOffset:B,side:Z,sideOffset:J,className:"isolate z-50",children:OH.jsx(S7.Popup,{"data-slot":"hover-card-content",className:d0("z-50 w-64 origin-(--transform-origin) rounded-lg bg-popover p-3 text-sm text-popover-foreground shadow-md outline-hidden duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",$),...Q})})})}var JZ=P(u(),1);function Km({attachment:$,onRemove:Z}){let{previewUrl:J,purpose:H}=$,B=H==="sketch"?"Sketch":"Annotation";return JZ.jsxs(Um,{children:[JZ.jsx(Ym,{render:JZ.jsx(PH,{tabIndex:0,label:B,icon:TH,onRemove:Z})}),J&&JZ.jsx(Fm,{side:"top",align:"start",className:"w-60 max-w-[calc(100vw-2rem)] rounded-xl",children:JZ.jsx("img",{src:J,alt:`${B} preview`,className:"max-h-72 w-full rounded-md object-contain"})})]})}var Nm=P(u(),1);function Wm({attachment:$,onRemove:Z}){return Nm.jsx(PH,{label:$.label,icon:lJ,onRemove:Z,previewUrl:$.previewUrl,loading:$.status==="uploading",title:$.label,className:"max-w-52"})}var BZ=P(m(),1);var wH=P(m(),1);var b$0=["fable","opus","sonnet","haiku"];function HW($,Z,J=$.find((H)=>H.value==="default")?.resolvedModel){let H=$.filter((B)=>B.value!=="default");return H.find((B)=>B.value===Z)??H.find((B)=>(B.resolvedModel??B.value)===J)??H[0]}function qm($){let Z=$.resolvedModel??$.value,J=b$0.findIndex((H)=>Z===H||Z.startsWith(`${H}[`)||Z.includes(`-${H}-`));return J===-1?void 0:J}function w$0($,Z){if($===void 0&&Z===void 0)return 0;if($===void 0)return-1;if(Z===void 0)return 1;return $-Z}function S$0($,Z){return w$0(qm($),qm(Z))}var R$0={"claude-code":S$0};function I$0($,Z){return $.map((J,H)=>({model:J,index:H})).sort((J,H)=>Z(J.model,H.model)||J.index-H.index).map(({model:J})=>J)}function IM($,Z,J){if(Z&&$.includes(Z))return Z;if(J&&$.includes(J))return J;if($.includes("high"))return"high";return $[$.length-1]}function Am($,Z,J){let H=IM($,Z,J);return H?$.indexOf(H):-1}function Dm($){return $.length>1}function Vm($,Z){if($.supportsFastMode!==!0)return!1;return Z??$.defaultFastMode??!1}function Lm($,Z){let J=R$0[Z];return J?I$0($,J):$}function Mm($,Z){let J=[];for(let H of $){let B=H.group??Z,Q=J.find((X)=>X.label===B);if(Q)Q.models.push(H);else J.push({label:B,models:[H]})}return J}var NW=P(m(),1);var R7={};k5(R7,{Value:()=>Em,Track:()=>Rm,Thumb:()=>vm,Root:()=>Om,Label:()=>jm,Indicator:()=>gm,Control:()=>wm});var X2=P(m(),1);function kM($,Z,J=Object.is){let{length:H}=$;if(H!==Z.length)return!1;for(let B=0;B<H;B+=1)if(!J($[B],Z[B]))return!1;return!0}function Pm($){return $==null?void 0:`${$}-label`}function _m($,Z){return $??Z}function BW($,Z){return $-Z}function QW($,Z,J,H,B,Q){let X=I2($,J,H);if(!B)return X;let z=Q.slice();return z[Z]=I2(X,Q[Z-1]??-1/0,Q[Z+1]??1/0),z.sort(BW)}function XW($,Z,J){if(!Array.isArray($))return!0;let H=Z*J;for(let B=0;B<$.length-1;B+=1)if(!(Math.abs($[B]-$[B+1])>=H))return!1;return!0}var jH=()=>null,Q8={activeThumbIndex:jH,max:jH,min:jH,minStepsBetweenValues:jH,step:jH,values:jH,...h2};var zW=P(m(),1),yM=zW.createContext(void 0);function $9(){let $=zW.useContext(yM);if($===void 0)throw Error(I0(62));return $}var xM=P(u(),1);function k$0($,Z){return $===Z||Array.isArray($)&&Array.isArray(Z)&&kM($,Z)}var Om=X2.forwardRef(function(Z,J){let{"aria-labelledby":H,className:B,defaultValue:Q,disabled:X=!1,id:z,format:G,largeStep:U=10,locale:Y,render:F,max:K=100,min:W=0,minStepsBetweenValues:N=0,form:q,name:D,onValueChange:A,onValueCommitted:V,orientation:L="horizontal",step:O=1,thumbCollisionBehavior:M="push",thumbAlignment:_="center",value:w,style:C,...E}=Z,T=t0(z),k=Pm(T),S=Y0(A),I=Y0(V),{clearErrors:j}=A4(),{state:y,disabled:R,name:x,setTouched:v,setDirty:f,validityData:b,validation:l}=t5(),{labelId:r}=e5(),[h,d]=X2.useState(),o=H??_m(r,h),c=R||X,i=x??D,[n,Z0]=D4({controlled:w,default:Q??W,name:"Slider"}),J0=X2.useRef(null),U0=X2.useRef(null),z0=X2.useRef([]),X0=X2.useRef(null),N0=X2.useRef(-1),q0=X2.useRef(null),K0=X2.useRef(F0.none),[s,a]=X2.useState(-1),[$0,t]=X2.useState(-1),[B0,_0]=X2.useState(!1),[P0,A0]=X2.useState(()=>new Map),[M0,g]=X2.useState([void 0,void 0]),p=Y0((l0)=>{if(a(l0),l0!==-1)t(l0)}),e=Y0((l0)=>{if(l0)U0.current=l0}),W0=Array.isArray(n),S0=X2.useMemo(()=>{if(!W0)return[I2(n,W,K)];return n.map((l0)=>I2(l0,W,K)).sort(BW)},[K,W,W0,n]),h0=W0?S0:S0[0];J7(l.inputRef,T,h0,void 0,!c,D),G3(h0,()=>{j(i),l.change(h0);let l0=b.initialValue,k0;if(Array.isArray(h0)&&Array.isArray(l0))k0=!kM(h0,l0);else k0=h0!==l0;f(k0)});let v0=Y0((l0,k0)=>{if(Number.isNaN(l0)||k$0(l0,n))return!1;let R1=k0.event,U5=new R1.constructor(R1.type,R1);if(Object.defineProperty(U5,"target",{writable:!0,value:{value:l0,name:i}}),k0.event=U5,S(l0,k0),k0.isCanceled)return!1;return K0.current=k0.reason,Z0(l0),!0}),j0=Y0((l0,k0,R1)=>{let Y1=QW(l0,k0,W,K,W0,S0);if(XW(Y1,O,N)){let U5="key"in R1?F0.keyboard:F0.inputChange,C0=v0(Y1,w0(U5,R1.nativeEvent,void 0,{activeThumbIndex:k0}));if(v(!0),C0)I(Y1,RG(U5,R1.nativeEvent))}});H0(()=>{if(!c)return;let l0=a1(m0(J0.current));if(R0(J0.current,l0))l0.blur();if(s!==-1)p(-1)},[s,c,p]);let c0=X2.useMemo(()=>({...y,activeThumbIndex:s,disabled:c,dragging:B0,orientation:L,max:K,min:W,minStepsBetweenValues:N,step:O,values:S0}),[y,s,c,B0,K,W,N,L,O,S0]),z1=X2.useMemo(()=>({active:s,controlRef:U0,disabled:c,dragging:B0,validation:l,format:G,handleInputChange:j0,indicatorPosition:M0,inset:_!=="center",labelId:o,rootLabelId:k,largeStep:U,lastUsedThumbIndex:$0,lastChangeReasonRef:K0,form:q,locale:Y,max:K,min:W,minStepsBetweenValues:N,name:i,onValueCommitted:I,orientation:L,pressedThumbCenterOffsetRef:X0,pressedThumbIndexRef:N0,pressedValuesRef:q0,registerFieldControlRef:e,renderBeforeHydration:_==="edge",setActive:p,setDragging:_0,setIndicatorPosition:g,setLabelId:d,setValue:v0,state:c0,step:O,thumbCollisionBehavior:M,thumbMap:P0,thumbRefs:z0,values:S0}),[s,o,k,c,B0,l,G,j0,M0,U,$0,q,Y,K,W,N,i,I,L,e,p,v0,c0,O,M,_,P0,S0]),A1=G0("div",Z,{state:c0,ref:[J,J0],props:[{"aria-labelledby":o,id:T,role:"group"},E,(l0)=>l.getValidationProps(c,l0)],stateAttributesMapping:Q8});return xM.jsx(yM.Provider,{value:z1,children:xM.jsx(P7,{elementsRef:z0,onMapChange:A0,children:A1})})});var Tm=P(m(),1);var jm=Tm.forwardRef(function(Z,J){let{render:H,className:B,style:Q,...X}=Z,z=X;delete z.id;let{state:G,setLabelId:U,controlRef:Y,rootLabelId:F}=$9();function K(N,q){if(q){let V=m0(N.currentTarget).getElementById(q);if(L1(V)){RY(V);return}}let D=Y.current?.querySelectorAll('input[type="range"]'),A=D?.length===1?D[0]:null;if(L1(A))RY(A)}let W=SY({id:F,setLabelId:U,focusControl:K});return G0("div",Z,{ref:J,state:G,props:[W,X],stateAttributesMapping:Q8})});var GW=P(m(),1);function hM($){if(Array.isArray($))return $.map((Z)=>hM(Z)).join(",");if($==null)return"";return String($)}var Cm=new Map;function y$0($,Z){let J=JSON.stringify({locale:hM($),options:Z}),H=Cm.get(J);if(H)return H;let B=new Intl.NumberFormat($,Z);return Cm.set(J,B),B}function CH($,Z,J){if($==null)return"";return y$0(Z,J).format($)}var Em=GW.forwardRef(function(Z,J){let{"aria-live":H="off",render:B,className:Q,children:X,style:z,...G}=Z,{thumbMap:U,state:Y,values:F,format:K,locale:W}=$9(),N=Array.from(U.values(),({inputId:V})=>V).join(" ").trim()||void 0,q=GW.useMemo(()=>F.map((V)=>CH(V,W,K)),[K,W,F]),D=q.join(" – ");return G0("output",Z,{state:Y,ref:J,props:[{"aria-live":H,children:typeof X==="function"?X(q,F):D,htmlFor:N},G],stateAttributesMapping:Q8})});var Z9=P(m(),1);function UW($,Z){let J=$.getBoundingClientRect();return Z?(J.top+J.bottom)/2:(J.left+J.right)/2}function EH($){if($===0)return 0;if(Math.abs($)<1){let J=$.toExponential().split("e-"),H=J[0].split(".")[1];return(H?H.length:0)+parseInt(J[1],10)}let Z=$.toString().split(".")[1];return Z?Z.length:0}function YW($,Z,J){let H=Math.round(($-J)/Z)*Z+J;return Number(H.toFixed(Math.max(EH(Z),EH(J))))}function vM($,Z,J,H,B,Q,X,z){let G=$.slice(),U=Q*X,Y=G.length-1,F=z??$,K=H+Z*U,W=B-(Y-Z)*U;G[Z]=I2(J,K,W);for(let N=Z+1;N<=Y;N+=1){let q=G[N-1]+U,D=B-(Y-N)*U,A=F[N],V=Math.max(G[N],q);if(A<V)V=Math.max(A,q);G[N]=I2(V,q,D)}for(let N=Z-1;N>=0;N-=1){let q=G[N+1]-U,D=H+N*U,A=F[N],V=Math.min(G[N],q);if(A>V)V=Math.min(A,q);G[N]=I2(V,D,q)}for(let N=0;N<=Y;N+=1)G[N]=Number(G[N].toFixed(12));return G}function bm($,Z,J,H,B,Q,X,z,G,U){let Y=J??Z,F=H??Z;if(!(Y.length>1))return{value:Q,thumbIndex:0,didSwap:!1};let W=G*U;if($==="push")return{value:vM(Y,B,Q,X,z,G,U),thumbIndex:B,didSwap:!1};let N=Y.slice(),q=N[B-1],D=N[B+1],A=q!=null?q+W:X,V=D!=null?D-W:z,L=Number(I2(Q,A,V).toFixed(12));switch(N[B]=L,$){case"swap":{let O=Y[B],M=0.0000001,_=Q>O,w=Q<O,C=_&&D!=null&&Q>=D-0.0000001,E=w&&q!=null&&Q<=q+0.0000001;if(!C&&!E)return{value:N,thumbIndex:B,didSwap:!1};let T=C?B+1:B-1,k=N.map((b,l)=>{if(l===B)return L;let r=F[l];if(r!=null)return r;return Y[l]}),S=Q;if(C)S=Math.max(Q,N[T]);else S=Math.min(Q,N[T]);let I=vM(N,T,S,X,z,G,U,k),j=C?T-1:T+1,y=I[j-1],R=I[j+1],x=y!=null?y+W:X;x=Math.max(x,X+j*W);let v=R!=null?R-W:z;v=Math.min(v,z-(I.length-1-j)*W);let f=I2(L,x,v);return I[j]=Number(f.toFixed(12)),{value:I,thumbIndex:T,didSwap:!0}}case"none":default:return{value:N,thumbIndex:B,didSwap:!1}}}var x$0=2;function h$0($,Z){if(!$)return{start:0,end:0};function J(Q){let X=Q!=null?parseFloat(Q):0;return Number.isNaN(X)?0:X}let H=!Z?"InlineStart":"Top",B=!Z?"InlineEnd":"Bottom";return{start:J($[`border${H}Width`])+J($[`padding${H}`]),end:J($[`border${B}Width`])+J($[`padding${B}`])}}function v$0($,Z){if(Z.current!=null&&$.changedTouches){let J=$;for(let H=0;H<J.changedTouches.length;H+=1){let B=J.changedTouches[H];if(B.identifier===Z.current)return{x:B.clientX,y:B.clientY}}return null}return{x:$.clientX,y:$.clientY}}var wm=Z9.forwardRef(function(Z,J){let{render:H,className:B,style:Q,...X}=Z,{disabled:z,dragging:G,inset:U,lastChangeReasonRef:Y,max:F,min:K,minStepsBetweenValues:W,onValueCommitted:N,orientation:q,pressedThumbCenterOffsetRef:D,pressedThumbIndexRef:A,pressedValuesRef:V,registerFieldControlRef:L,renderBeforeHydration:O,setActive:M,setDragging:_,setValue:w,state:C,step:E,thumbCollisionBehavior:T,thumbRefs:k,values:S}=$9(),I=$8(),j=S.length>1,y=q==="vertical",R=Z9.useRef(null),x=Z9.useRef(null),v=Y0((a)=>{if(a&&x.current==null)x.current=k1(a).getComputedStyle(a)}),f=Z9.useRef(null),b=Z9.useRef(0),l=Z9.useRef(0),r=Z9.useRef(null),h=N5(S);function d(a){return a?.querySelector('input[type="range"]')}function o(a){if(A.current=a,!k.current[a])D.current=null}function c(){A.current=-1,D.current=null}function i(a){if(!s0(a))return!1;return k.current.some(($0)=>{if(!s0($0)||!R0($0,a))return!1;return d($0)?.disabled===!0})}function n(a){let $0=R.current,t=A.current;if(!$0||t<0||t>=S.length){if(t>=S.length)r.current=null;return null}let{width:B0,height:_0,bottom:P0,left:A0,right:M0}=$0.getBoundingClientRect(),g=h$0(x.current,y),p=l.current,e=(y?_0:B0)-g.start-g.end-p*2,W0=D.current??0,S0=a.x-W0,h0=a.y-W0,v0=y?P0-h0-g.end:(I==="rtl"?M0-S0:S0-A0)-g.start,j0=I2((v0-p)/e,0,1),c0=(F-K)*j0+K;if(c0=YW(c0,E,K),c0=I2(c0,K,F),!j)return{value:c0,thumbIndex:t,didSwap:!1};return bm(T,S,h.current,V.current,t,c0,K,F,E,W)}function Z0(a){V.current=j?S.slice():null,r.current=null,h.current=S;let $0=A.current,t=$0;if($0>-1&&$0<S.length){if(S[$0]===F){let B0=$0;while(B0>0&&S[B0-1]===F)B0-=1;t=B0}}else{let B0=!y?"x":"y",_0;t=-1;for(let P0=0;P0<k.current.length;P0+=1){let A0=k.current[P0];if(s0(A0)&&!d(A0)?.disabled){let M0=UW(A0,y),g=Math.abs(a[B0]-M0);if(_0===void 0||g<=_0)t=P0,_0=g}}}if(t>-1&&t!==$0)o(t);if(U){let B0=k.current[t];if(s0(B0)){let _0=B0.getBoundingClientRect(),P0=!y?"width":"height";l.current=_0[P0]/2}}}function J0(a){let $0=d(k.current?.[a]);if(!$0)return;$0.focus({preventScroll:!0,focusVisible:!1})}function U0(a,$0,t){let B0=w(a.value,w0($0,t,void 0,{activeThumbIndex:a.thumbIndex}));if(B0){if(r.current=a.value,h.current=Array.isArray(a.value)?a.value:[a.value],a.didSwap)o(a.thumbIndex),J0(a.thumbIndex)}return B0}let z0=Y0((a)=>{let $0=v$0(a,f);if($0==null)return;if(b.current+=1,a.type==="pointermove"&&a.buttons===0){X0(a);return}let t=n($0);if(t==null)return;if(XW(t.value,E,W)){if(!G&&b.current>x$0)_(!0);U0(t,F0.drag,a)}}),X0=Y0((a)=>{M(-1),_(!1),D.current=null;let $0=r.current;if(Array.isArray($0)&&$0.length!==S.length)r.current=null;if(r.current!=null){let t=Y.current;N(r.current,RG(t,a))}if("pointerType"in a&&R.current?.hasPointerCapture(a.pointerId))R.current?.releasePointerCapture(a.pointerId);A.current=-1,f.current=null,q0()}),N0=Y0((a)=>{if(z)return;if(i(V1(a))){c();return}let $0=a.changedTouches[0];if($0==null)return;f.current=$0.identifier;let t={x:$0.clientX,y:$0.clientY};Z0(t);let B0=n(t);if(B0==null)return;J0(B0.thumbIndex),U0(B0,F0.trackPress,a),b.current=0;let _0=m0(R.current);_0.addEventListener("touchmove",z0,{passive:!0}),_0.addEventListener("touchend",X0,{passive:!0})}),q0=Y0(()=>{let a=m0(R.current);a.removeEventListener("pointermove",z0),a.removeEventListener("pointerup",X0),a.removeEventListener("touchmove",z0),a.removeEventListener("touchend",X0),V.current=null,r.current=null}),K0=I4();return Z9.useEffect(()=>{let a=R.current;if(!a)return()=>q0();let $0=o0(a,"touchstart",N0,{passive:!0});return()=>{$0(),K0.cancel(),q0()}},[q0,N0,R,K0]),Z9.useEffect(()=>{if(z)q0()},[z,q0]),G0("div",Z,{state:C,ref:[J,L,R,v],props:[{["data-base-ui-slider-control"]:O?"":void 0,onPointerDown(a){let $0=R.current,t=V1(a.nativeEvent);if(!$0||z||a.defaultPrevented||!s0(t)||a.button!==0)return;if(i(t)){c();return}let B0={x:a.clientX,y:a.clientY};Z0(B0);let _0=n(B0);if(_0==null)return;if(R0(k.current[_0.thumbIndex],a1(m0($0))))a.preventDefault();else K0.request(()=>{J0(_0.thumbIndex)});if(_(!0),D.current==null)U0(_0,F0.trackPress,a.nativeEvent);if(a.nativeEvent.pointerId)$0.setPointerCapture(a.nativeEvent.pointerId);b.current=0;let M0=m0($0);M0.addEventListener("pointermove",z0,{passive:!0}),M0.addEventListener("pointerup",X0,{once:!0})}},X],stateAttributesMapping:Q8})});var Sm=P(m(),1);var Rm=Sm.forwardRef(function(Z,J){let{render:H,className:B,style:Q,...X}=Z,{state:z}=$9();return G0("div",Z,{state:z,ref:J,props:[{style:{position:"relative"}},X],stateAttributesMapping:Q8})});var J9=P(m(),1);var FW="";var Im=P(iZ(),1);function f$0(){return G1}function g$0(){return!1}function m$0(){return!0}function bH(){return Im.useSyncExternalStore(f$0,g$0,m$0)}function _X($,Z,J){return($-Z)*100/(J-Z)}var qJ1=P(m(),1);var KW=P(m(),1),u$0=KW.createContext(void 0),p$0={disableStyleElements:!1};function km(){return KW.useContext(u$0)??p$0}var ym=P(u(),1);function WW($){let{script:Z}=$,{nonce:J}=km();if(!bH())return null;return ym.jsx("script",{nonce:J,dangerouslySetInnerHTML:{__html:Z},suppressHydrationWarning:!0})}var xm="data-index";var OX=P(u(),1),hm,d$0=new Set([...D9,$V,ZV]);function l$0($,Z,J,H){if(Z<0)return;if($.length===2)return`${CH($[Z],H,J)} ${Z===0?"start":"end"} range`;return J?CH($[Z],H,J):void 0}function i$0($,Z,J,H,B){let Q=$+Z*J,X=Number(Q.toFixed(Math.max(EH($),EH(Z),EH(H))));return I2(X,H,B)}var vm=J9.forwardRef(function(Z,J){let{render:H,children:B,className:Q,"aria-describedby":X,"aria-label":z,"aria-labelledby":G,"aria-valuetext":U,disabled:Y=!1,getAriaLabel:F,getAriaValueText:K,id:W,index:N,inputRef:q,onBlur:D,onFocus:A,onKeyDown:V,tabIndex:L,style:O,...M}=Z,_=t0(W),{active:w,lastUsedThumbIndex:C,controlRef:E,disabled:T,validation:k,format:S,handleInputChange:I,inset:j,labelId:y,largeStep:R,locale:x,max:v,min:f,minStepsBetweenValues:b,form:l,name:r,orientation:h,pressedThumbCenterOffsetRef:d,pressedThumbIndexRef:o,renderBeforeHydration:c,setActive:i,setIndicatorPosition:n,state:Z0,step:J0,thumbRefs:U0,values:z0}=$9(),X0=$8(),N0=Y||T,q0=z0.length>1,K0=h==="vertical",s=X0==="rtl",{setTouched:a,setFocused:$0,validationMode:t}=t5(),B0=J9.useRef(null),_0=J9.useRef(null),P0=J9.useRef(!1),A0=Y0((f0)=>{if(P0.current)return;A?.(f0)}),M0=Y0((f0)=>{if(P0.current)return;D?.(f0)}),g=t0(),p=H7(),e=q0?g:p,W0=J9.useMemo(()=>({inputId:e}),[e]),{ref:S0,index:h0}=M4({metadata:W0}),v0=!q0?0:N??h0,j0=v0===z0.length-1,c0=z0[v0],z1=_X(c0,f,v),[A1,l0]=J9.useState(),k0=bH(),R1=C>=0&&C<z0.length?C:-1,Y1=Y0(()=>{let f0=E.current,e0=B0.current;if(!f0||!e0)return;let O1=e0.getBoundingClientRect(),j1=f0.getBoundingClientRect(),x0=K0?"height":"width",$1=j1[x0]-O1[x0],P1=(O1[x0]/2+$1*z1/100)/j1[x0]*100,p1=Number.isFinite(P1)?P1:void 0;if(l0(p1),v0===0)n((i1)=>[p1,i1[1]]);else if(j0)n((i1)=>[i1[0],p1])});H0(()=>{if(j)queueMicrotask(Y1)},[Y1,j]),H0(()=>{if(j)Y1()},[Y1,j,z1]),H0(()=>{if(!j)return;let f0=E.current,e0=B0.current;if(!f0||!e0)return;let O1=k1(f0).ResizeObserver;if(typeof O1!=="function")return;let j1=new O1(Y1);return j1.observe(f0),j1.observe(e0),()=>{j1.disconnect()}},[E,Y1,j]);let U5=K0?"bottom":"insetInlineStart",C0=K0?"left":"top",p0;if(q0){if(w===v0)p0=2;else if(R1===v0)p0=1}else if(w===v0)p0=1;let r0;if(!j&&!Number.isFinite(z1))r0=U9;else r0={position:"absolute",[U5]:j?"var(--position)":`${z1}%`,[C0]:"50%",translate:`${(K0||!s?-1:1)*50}% ${(K0?1:-1)*50}%`,zIndex:p0,...j&&{["--position"]:`${A1??0}%`,visibility:c&&k0||A1===void 0?"hidden":void 0}};let n0;if(K0)n0=s?"vertical-rl":"vertical-lr";let D0=typeof F==="function"?F(v0):z,y0=K2({"aria-label":D0,"aria-labelledby":G??(D0==null?y:void 0),"aria-describedby":X,"aria-orientation":h,"aria-valuenow":c0,"aria-valuetext":typeof K==="function"?K(CH(c0,x,S),c0,v0):U??l$0(z0,v0,S,x),disabled:N0,form:l,id:e,max:v,min:f,name:r,onChange(f0){I(f0.currentTarget.valueAsNumber,v0,f0)},onFocus(f0){let e0=P0.current;if(P0.current=!1,i(v0),$0(!0),e0)f0.stopPropagation()},onBlur(f0){if(P0.current){f0.stopPropagation();return}if(i(-1),U0.current.some((e0)=>R0(e0,f0.relatedTarget)))return;if(a(!0),$0(!1),t==="onBlur")k.commit(QW(c0,v0,f,v,q0,z0))},onKeyDown(f0){if(f0.defaultPrevented)return;if(!d$0.has(f0.key))return;if(D9.has(f0.key))f0.stopPropagation();let e0=null,O1=0,j1=f0.shiftKey?R:J0,x0=YW(c0,J0,f);switch(f0.key){case VJ:O1=1;break;case PJ:O1=s?-1:1;break;case LJ:O1=-1;break;case MJ:O1=s?1:-1;break;case $V:j1=R,O1=1;break;case ZV:j1=R,O1=-1;break;case OJ:e0=q0&&Number.isFinite(z0[v0+1])?z0[v0+1]-J0*b:v;break;case _J:e0=q0&&Number.isFinite(z0[v0-1])?z0[v0-1]+J0*b:f;break;default:break}if(O1!==0)e0=i$0(x0,j1,O1,f,v);if(e0!==null){let $1=f0.currentTarget;if(!c9($1))P0.current=!0,$1.blur(),$1.focus({preventScroll:!0,focusVisible:!0});I(e0,v0,f0),f0.preventDefault()}},step:J0,style:{...U9,width:"100%",height:"100%",writingMode:n0},tabIndex:L,type:"range",value:c0??""},(f0)=>k.getValidationProps(N0,f0),{onFocus:A0,onBlur:M0,onKeyDown:V}),K1=l2(_0,k.inputRef,q);return G0("div",Z,{state:Z0,ref:[J,S0,B0],props:[{[xm]:v0,children:OX.jsxs(J9.Fragment,{children:[B,OX.jsx("input",{ref:K1,...y0,suppressHydrationWarning:!0}),j&&j0&&c&&(hm||(hm=OX.jsx(WW,{script:FW})))]}),id:_,onPointerDown(f0){if(N0)return;o.current=v0;let e0=UW(f0.currentTarget,K0);d.current=(K0?f0.clientY:f0.clientX)-e0},style:r0,suppressHydrationWarning:c||void 0},M],stateAttributesMapping:Q8})});var fm=P(m(),1);function r$0($,Z,J,H,B,Q){let X={visibility:Q||J&&(H===void 0||Z&&B===void 0)?"hidden":void 0,position:$?"absolute":"relative",[$?"width":"height"]:"inherit"},z=`${H??0}%`,G=`${(B??0)-(H??0)}%`;if(J){if(X["--start-position"]=z,z="var(--start-position)",Z)X["--relative-size"]=G,G="var(--relative-size)"}return X[$?"bottom":"insetInlineStart"]=Z?z:0,X[$?"height":"width"]=Z?G:z,X}var gm=fm.forwardRef(function(Z,J){let{render:H,className:B,style:Q,...X}=Z,{indicatorPosition:z,inset:G,max:U,min:Y,orientation:F,renderBeforeHydration:K,state:W,values:N}=$9(),q=bH(),D=F==="vertical",A=N.length>1,V=r$0(D,A,G,G?z[0]:_X(N[0],Y,U),G?z[1]:_X(N[N.length-1],Y,U),G&&K&&q);return G0("div",Z,{state:W,ref:J,props:[{["data-base-ui-slider-indicator"]:K?"":void 0,style:V,suppressHydrationWarning:K||void 0},X],stateAttributesMapping:Q8})});var HZ=P(u(),1);function mm({animate:$=!1,children:Z,className:J,defaultValue:H,value:B,min:Q=0,max:X=100,...z}){let[G,U]=NW.useState(!1),Y=Array.isArray(B)?B:Array.isArray(H)?H:[Q];return NW.useEffect(()=>{let F=requestAnimationFrame(()=>U(!0));return()=>cancelAnimationFrame(F)},[]),HZ.jsx(R7.Root,{className:d0("data-horizontal:w-full data-vertical:h-full",J),"data-slot":"slider",defaultValue:H,value:B,min:Q,max:X,thumbAlignment:"edge",...z,children:HZ.jsxs(R7.Control,{className:"relative flex w-full touch-none items-center select-none data-disabled:opacity-50 data-vertical:h-full data-vertical:min-h-40 data-vertical:w-auto data-vertical:flex-col",children:[HZ.jsx(R7.Track,{"data-slot":"slider-track",className:"relative grow overflow-hidden rounded-full bg-accent select-none data-horizontal:h-1 data-horizontal:w-full data-vertical:h-full data-vertical:w-1",children:HZ.jsx(R7.Indicator,{"data-slot":"slider-range",className:d0("bg-primary select-none data-horizontal:h-full data-vertical:w-full",$&&G&&"transition-[width,height,inset-inline-start,bottom] duration-100 ease-in-out")})}),Z,Array.from({length:Y.length},(F,K)=>HZ.jsx(R7.Thumb,{"data-slot":"slider-thumb",className:d0("relative block size-3 shrink-0 rounded-xs bg-white shadow-xs ring-ring/50 select-none after:absolute after:-inset-2 hover:ring-3 focus-visible:ring-3 focus-visible:outline-hidden active:ring-3 disabled:pointer-events-none disabled:opacity-50 data-horizontal:cursor-ew-resize data-vertical:cursor-ns-resize",$&&G&&"transition-[inset-inline-start,bottom,color,box-shadow] duration-100 ease-in-out")},K))]})})}var M1=P(u(),1);function a$0($){return $.charAt(0).toUpperCase()+$.slice(1)}function o$0($){return $==="xhigh"?"Extra":a$0($)}function um($){return typeof $==="number"?$:$[0]??0}var pm={from:{opacity:0,filter:"blur(4px)"},to:{opacity:1,filter:"blur(0px)"}},cm={type:"spring",duration:0.3,delay:0.1,bounce:0};function lm({label:$,leadingIcon:Z,className:J,...H}){return M1.jsxs(L0,{...H,variant:"ghost",className:Q0("group/picker max-w-56 min-w-0 px-2 text-muted-foreground hover:text-muted-foreground",J),children:[Z,M1.jsx("span",{className:"truncate font-normal",children:$})]})}function n$0({current:$,model:Z,models:J,onValueChange:H}){let B=Z.displayName,Q=Mm(J,"Models");return M1.jsxs(r8,{children:[M1.jsx(a8,{render:M1.jsx(lm,{label:B,className:"shrink","aria-label":`Model: ${B}`})}),M1.jsx(o8,{align:"end",side:"top",className:"w-max max-w-64 min-w-40",children:M1.jsx(Rh,{value:$,onValueChange:H,children:Q.map((X)=>M1.jsxs(O9,{children:[M1.jsx(zK,{children:X.label}),X.models.map((z)=>M1.jsx(Ih,{value:z.value,closeOnClick:!0,children:z.displayName},z.value))]},X.label))})})]})}function im({fastMode:$,onChange:Z}){return M1.jsxs(t1,{children:[M1.jsx(e1,{render:M1.jsx(L0,{type:"button",variant:"ghost",size:"icon-sm","aria-label":$?"Turn off fast mode":"Turn on fast mode","aria-pressed":$,onClick:()=>Z(!$),className:"-my-1 -mr-1",children:$?M1.jsx(dm,{className:"text-primary",stroke:1.75}):M1.jsx(jQ,{className:"text-muted-foreground",stroke:1.75})})}),M1.jsxs($5,{align:"center",className:"flex-col gap-0",children:[M1.jsx("span",{children:"Fast mode"}),M1.jsx("span",{className:"font-normal text-muted-foreground",children:"More usage"})]})]})}function s$0({currentEffort:$,effortLevels:Z,fastMode:J,showFastMode:H,onFastModeChange:B,onValueChange:Q}){let X=Am(Z,$),[z,G]=wH.useState(!1),[U,Y]=wH.useState(X),[F,K]=wH.useState(!1),N=Z[z?U:X]??$,q=o$0(N),D=(V)=>{if(V)Y(X);else K(!1);G(V)},A=(V)=>{let L=Z[V];if(L&&L!==$)Q(L)};return M1.jsxs(p6,{open:z,onOpenChange:D,children:[M1.jsx(c6,{render:M1.jsx(lm,{label:q,leadingIcon:J?M1.jsx(jQ,{stroke:1.5}):void 0,"aria-label":`Effort: ${q}`})}),M1.jsxs(d6,{align:"end",side:"top",className:"w-64",children:[M1.jsx(qS,{className:"relative h-5 flex-row items-center",children:M1.jsx(m4,{mode:"popLayout",initial:!1,children:F?M1.jsxs(K5.div,{className:"flex h-5 w-full items-center justify-between text-sm text-muted-foreground","aria-hidden":"true",variants:pm,initial:"from",animate:"to",exit:"from",transition:cm,children:[M1.jsx("span",{children:"Faster"}),M1.jsx("span",{children:"Smarter"})]},"range"):M1.jsxs(K5.div,{className:"flex h-5 w-full items-center justify-between gap-2",variants:pm,initial:"from",animate:"to",exit:"from",transition:cm,children:[M1.jsxs("div",{className:"flex items-center gap-1",children:[M1.jsx("span",{className:"text-muted-foreground",children:"Effort"}),M1.jsx("output",{"aria-live":"polite",children:q})]}),H&&M1.jsx(im,{fastMode:J,onChange:B})]},"effort")})}),M1.jsxs("label",{className:"block",children:[M1.jsx("span",{className:"sr-only",children:"Reasoning effort"}),M1.jsx(mm,{value:[U],min:0,max:Z.length-1,step:1,onPointerDown:(V)=>{if(V.button===0)K(!0)},onPointerCancel:()=>K(!1),onValueChange:(V)=>Y(um(V)),onValueCommitted:(V)=>{K(!1),A(um(V))},className:Q0("**:data-[slot=slider-track]:h-6 **:data-[slot=slider-track]:rounded-sm","**:data-[slot=slider-thumb]:h-6 **:data-[slot=slider-thumb]:w-5 **:data-[slot=slider-thumb]:rounded-sm **:data-[slot=slider-thumb]:ring-0"),animate:!0,children:M1.jsx("span",{"data-slot":"slider-marks","aria-hidden":"true",className:"absolute inset-x-2 flex items-center justify-between",children:Array.from({length:Z.length},(V,L)=>M1.jsx("span",{className:Q0("size-1 rounded-full",L<=U?"bg-primary-foreground/30":"bg-foreground/30")},L))})})]})]})]})}var rm=wH.memo(function({sessionId:Z}){let{workspaceId:J,layout:H,setLayout:B}=w1(),{data:Q}=s8(J),X=Q?.models??[],z=X.find((_)=>_.value==="default"),G=Q?Lm(X.filter((_)=>_.value!=="default"),Q.provider):[],U=eU(J,Z).data?.config,Y=LR(J),F=(Z?U?.model:void 0)??H.selectedModel,K=(Z?U?.effort:void 0)??H.selectedEffort,W=(Z?U?.fastMode:void 0)??H.selectedFastMode,N=(_)=>{if(Z)Y.mutate({sessionId:Z,patch:{model:_}});else B({selectedModel:_})},q=(_)=>{if(Z)Y.mutate({sessionId:Z,patch:{effort:_}});else B({selectedEffort:_})},D=(_)=>{if(Z)Y.mutate({sessionId:Z,patch:{fastMode:_}});else B({selectedFastMode:_})},A=HW(G,F,z?.resolvedModel);if(!A)return null;let V=A.supportsEffort?A.supportedEffortLevels??[]:[],L=IM(V,K,A.defaultEffort),O=Dm(V)&&L!==void 0,M=Vm(A,W);return M1.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[M1.jsx(n$0,{current:A.value,model:A,models:G,onValueChange:N}),!O&&A.supportsFastMode&&M1.jsx(im,{fastMode:M,onChange:D}),O&&M1.jsx(s$0,{currentEffort:L,effortLevels:V,fastMode:M,showFastMode:A.supportsFastMode===!0,onFastModeChange:D,onValueChange:q},A.value)]})});var j5=P(u(),1);function nm({composerRef:$,onSend:Z,onStop:J,processing:H,sessionId:B,modelSessionId:Q,availability:X,chatReady:z,annotation:G,onRemoveDrawing:U,allowFiles:Y=!0,placeholder:F}){let K=BZ.useRef(null),W=d1(),N=s3(),q=M2(W,B??N2(N)),D=C1((j)=>j.composerDrafts[q]??"");BZ.useEffect(()=>{if(N==="overview")C1.getState().moveComposerDraft(W,q)},[N,W,q]);let A=q5(D),V=K4((j)=>j.attachments[L8(W,B)]??t$0),[L,O]=BZ.useState(!1),M=V.some((j)=>j.kind!=="text"&&j.status==="uploading"),_=V.some((j)=>j.kind==="text"||j.status==="ready"||j.status==="draft"),w=D.trim().length>0||_,C=z&&MX(w,M,X),E=(j)=>{A.current=j,C1.getState().setComposerDraft(q,j)},T=(j)=>{if(Y)Pg({workspaceId:W,sessionId:B},j)},k=BZ.useRef(!1),S=(j)=>{if(j.kind==="drawing"&&U){U(j.localId);return}x1.getState().removeAttachment(W,j.localId)},I=async()=>{if(!C||k.current)return;k.current=!0;try{await G?.finish(),await Z(A.current),A.current="",C1.getState().setComposerDraft(q,null)}catch(j){T1.add({title:j instanceof Error?j.message:"Couldn’t send message",type:"error"})}finally{k.current=!1}};return j5.jsxs(Cg,{composerRef:$,onSubmit:(j)=>{j.preventDefault(),I()},onDragOver:(j)=>{if(!j.dataTransfer.types.includes("Files"))return;if(j.preventDefault(),Y)O(!0)},onDragLeave:(j)=>{if(!Y)return;if(j.currentTarget.contains(j.relatedTarget))return;O(!1)},onDrop:(j)=>{if(!j.dataTransfer.types.includes("Files"))return;j.preventDefault(),O(!1),T(Array.from(j.dataTransfer.files))},className:Q0(L&&"ring-2 ring-ring/60"),children:[V.length>0&&j5.jsx("div",{className:"flex flex-wrap gap-2 px-1 pt-1 pb-1",children:V.toSorted((j,y)=>am[j.kind]-am[y.kind]).map((j)=>j.kind==="text"?j5.jsx(PX,{label:j.label,onRemove:()=>S(j)},j.localId):j.kind==="drawing"?j5.jsx(Km,{attachment:j,onRemove:()=>S(j)},j.localId):j5.jsx(Wm,{attachment:j,onRemove:()=>S(j)},j.localId))}),j5.jsx(Eg,{textareaRef:$,disabled:X.status!=="available",id:"chat-input",name:"message",value:D,onChange:(j)=>E(j.target.value),onKeyDown:(j)=>{if(j.key==="Enter"&&!j.shiftKey)j.preventDefault(),I()},onPaste:(j)=>{let y=Array.from(j.clipboardData?.files??[]);if(y.length===0)return;j.preventDefault(),T(y)},placeholder:H?"Queue a follow-up":F??"Do anything",rows:1}),j5.jsxs(bg,{children:[Y&&j5.jsx("input",{ref:K,type:"file",multiple:!0,hidden:!0,onChange:(j)=>{T(Array.from(j.target.files??[])),j.target.value=""}}),j5.jsxs("div",{className:"mr-auto flex shrink-0 items-center gap-0.5",children:[Y&&j5.jsxs(t1,{children:[j5.jsx(e1,{render:j5.jsx(L0,{type:"button",variant:"ghost",size:"icon",onClick:()=>K.current?.click(),"aria-label":"Attach files",children:j5.jsx(pY,{stroke:1.6,className:"size-4.5!"})})}),j5.jsx($5,{children:"Attach files"})]}),G&&j5.jsxs(t1,{children:[j5.jsx(e1,{render:j5.jsx(L0,{type:"button",variant:"ghost",size:"icon",onClick:G.onToggle,className:Q0(G.active&&"bg-accent"),"aria-label":"Draw annotation","aria-pressed":G.active,children:j5.jsx(TH,{stroke:1.5})})}),j5.jsx($5,{children:"Draw annotation"})]})]}),j5.jsx(rm,{sessionId:Q}),H?j5.jsxs(t1,{children:[j5.jsx(e1,{render:j5.jsx(L0,{type:"button",size:"icon",onClick:J,"aria-label":"Stop agent",children:j5.jsx(om,{})})}),j5.jsx($5,{children:"Stop answering"})]}):j5.jsx(wg,{label:"Send message",hasContent:w,busy:M||!z,availability:X})]})]})}var t$0=[],am={file:0,drawing:1,text:2};var QZ=P(u(),1);function fM({className:$,prompt:Z,disabled:J=!1,onSelect:H}){let B=Z.icon;return QZ.jsxs(L0,{type:"button",size:"sm",disabled:J,onClick:()=>H(Z),className:Q0("h-auto items-start justify-start gap-2 rounded-lg p-2 px-3 text-left leading-snug whitespace-normal",$),children:[QZ.jsx(B,{stroke:2,"aria-hidden":!0,className:"mt-0.5"}),QZ.jsx("span",{children:Z.label})]})}function sm({prompts:$,disabled:Z=!1,onSelect:J}){return QZ.jsx("div",{className:"row-gap-2 grid w-full grid-cols-1 gap-x-3 gap-y-2 @md:grid-cols-3",children:$.map((H,B)=>{return QZ.jsx(fM,{prompt:H,disabled:Z,onSelect:J,className:Q0("h-full w-fit @md:w-full",B===0&&"@md:translate-y-3 @md:rotate-3 @md:hover:translate-y-2.5",B===1&&"@md:-rotate-1",B===2&&"@md:translate-y-3 @md:-rotate-4 @md:hover:translate-y-2.5")},H.prompt)})})}var z5=P(u(),1),gM="Keep the final reply brief and user-facing. Do not include file or storage links, file paths, or bundle, test, and runtime-log summaries.",e$0=[{label:"Check the weather",prompt:"Build me a set of weather widgets that surface current conditions, today's hourly forecast, and a simple weekly outlook at a glance",context:["Build this onboarding example immediately without asking follow-up questions.","Create three separate widgets: current conditions, today's hourly forecast, and a seven-day outlook.","Use one shared Open-Meteo server function with no API key and use Berlin as the default location.","Give each widget an appropriate grid size and a compact, visually distinct layout with loading, error, and last-updated states.","Bundle all three widgets, smoke-test the shared weather function, and check runtime logs before finishing.",gM],icon:tm},{label:"Track my finances",prompt:"Build me a personal finance view for tracking income, expenses, monthly budgets, spending trends, and savings, with an agent action that can add sample transactions",context:["Build this onboarding example immediately without asking follow-up questions, and don't use external services or bank connections.","Create a responsive View with a month selector, income, spending, and savings summaries, an income-versus-spending trend, category breakdowns, budget progress, and recent transactions.","Support adding, editing, and deleting income and expense transactions, categories, and monthly category budgets.","Persist transactions, categories, and budgets in a workspace-local SQLite database accessed through server functions. Store monetary amounts as integer cents and seed realistic sample data only when the database is empty.","Add an “Add with agent” action that imports `sendChatMessage` from `moi` and sends a concise request for the agent to generate and insert a realistic batch of sample transactions into the same database.","Provide a small documented workspace script the agent can use to validate and append transactions safely, then refresh the View data after the agent updates the database.","Include loading, empty, and error states, then bundle the View and smoke-test its SQLite persistence and transaction mutations before finishing.",gM],icon:em},{label:"Build a playful synthesizer",prompt:"Build me a view with a simple, playful synthesizer featuring a keyboard, five sound controls, and the ability to record, save, and load music files from the workspace",context:["Build this onboarding example immediately without asking follow-up questions, and don't use external services.","Create a responsive View that uses the browser's audio capabilities, with an onscreen piano and computer-keyboard controls.","Include five clearly labeled sound controls for waveform, attack, release, filter cutoff, and volume.","Let the user record timed note events, play and stop recordings, give them names, and save and load them as JSON music files in a workspace music folder.","Include clear empty and error states, then bundle the View and check runtime logs before finishing.",gM],icon:cY}],$Z0={label:"Explore the workspace",prompt:"Explore this workspace and suggest what Moi can build based on its content",context:["Explore the existing workspace files before making suggestions.","Briefly explain what the workspace appears to be for and which content informed your ideas.","Propose a focused set of useful widgets or views that fit the work already here.","Wait for me to choose before building anything."],icon:AW};function $u({tabId:$,isViewDraft:Z,hasSentMessageFromMoi:J,isWorkspacePendingAnalysis:H}){if(Z)return"view-draft";if(!J)return"welcome";if(H)return"explore-workspace";return $==="overview"?"overview-empty":"tab-empty"}function Zu({agent:$,kind:Z,hasWorkspaceApplets:J,disabled:H=!1,onSelectPrompt:B,onNavigate:Q}){switch(Z){case"view-draft":return z5.jsx(ZZ0,{agent:$});case"welcome":return z5.jsx(JZ0,{agent:$,disabled:H,showExamples:!J,onSelectPrompt:B,onNavigate:Q});case"explore-workspace":return z5.jsx(HZ0,{agent:$,disabled:H,onSelectPrompt:B});case"overview-empty":return z5.jsx(BZ0,{agent:$});case"tab-empty":return z5.jsx(QZ0,{agent:$})}}function jX({agent:$,children:Z,className:J}){return z5.jsxs("div",{className:Q0("flex flex-1 flex-col items-center justify-center self-center",J),children:[z5.jsx(P3,{preset:$,color:"secondary",expression:"idle",className:"mb-2",animated:!0}),Z]})}function ZZ0({agent:$}){return z5.jsx(jX,{agent:$,className:"text-center text-muted-foreground",children:z5.jsx("p",{className:"mx-auto max-w-xs px-8 text-sm",children:"Describe the content, data, and key actions you need in the view"})})}function JZ0({agent:$,disabled:Z=!1,showExamples:J=!0,onSelectPrompt:H,onNavigate:B}){return z5.jsx(jX,{agent:$,className:"@container w-full max-w-md min-w-0",children:z5.jsxs("div",{className:"mt-2 flex flex-col gap-4",children:[z5.jsxs("div",{className:"prose prose-sm min-w-0 wrap-anywhere prose-inherit",children:[z5.jsx("p",{children:"Moi is the personal workspace built for you by your agent. It grows and adapts to your needs."}),z5.jsxs("p",{children:["Ask the agent to build widgets on the"," ",z5.jsx(mM,{Icon:DW,destination:"overview",onNavigate:B,children:"Overview"})," ","page, or more complex tools as separate"," ",z5.jsx(mM,{Icon:qW,destination:"views",onNavigate:B,children:"Views"}),". Use"," ",z5.jsx(mM,{Icon:TX,destination:"scratchpad",onNavigate:B,children:"Scratchpad"})," ","for exploring and shaping ideas with your agent."]}),J&&z5.jsx("p",{children:"Try an example:"})]}),J&&z5.jsx(sm,{prompts:e$0,disabled:Z,onSelect:H})]})})}function HZ0({agent:$,disabled:Z=!1,onSelectPrompt:J}){return z5.jsx(jX,{agent:$,children:z5.jsxs("div",{className:"flex flex-col items-center gap-4",children:[z5.jsx("div",{className:"prose prose-sm max-w-xs min-w-0 text-center wrap-anywhere prose-inherit",children:z5.jsx("p",{children:"Your agent can explore this workspace and suggest useful widgets and views based on what’s already here"})}),z5.jsx(fM,{prompt:$Z0,disabled:Z,onSelect:J})]})})}function BZ0({agent:$}){return z5.jsx(jX,{agent:$,className:"text-center text-muted-foreground",children:z5.jsx("p",{className:"mx-auto max-w-sm px-8 text-sm",children:"Chat with your agent, create widgets and views, and manage your workspace context from here"})})}function QZ0({agent:$}){return z5.jsx(jX,{agent:$,className:"text-center text-muted-foreground",children:z5.jsx("p",{className:"mx-auto max-w-sm px-8 text-sm",children:"Chat with your agent and manage the view from here"})})}function mM({Icon:$,children:Z,destination:J,onNavigate:H}){return z5.jsxs("button",{type:"button","data-welcome-destination":J,onClick:()=>H(J),className:"inline-flex cursor-pointer items-center gap-0.5 align-bottom font-medium text-foreground",children:[z5.jsx($,{size:16,stroke:1.75,"aria-hidden":!0}),Z]})}var CX=P(m(),1);var F1=P(u(),1);function XZ0($){if($.flavor==="cron"||$.flavor==="subagent")return $.flavor;let Z=$.origin?.provider.trim().toLowerCase();return Z?Z:null}function zZ0({active:$,canArchive:Z,confirmingArchive:J,onArchive:H,onRequestArchive:B,onSelect:Q,session:X,workspaceId:z}){let G=CX.useRef(!1),[U,Y]=CX.useState(!1),F=K4((q)=>WJ(q.activity,z,X.sessionId)),K=XZ0(X);function W(){B(X.sessionId)}async function N(){if(G.current)return;G.current=!0,Y(!0);try{await H(X.sessionId)}catch{T1.add({title:"Couldn’t archive chat",type:"error"})}finally{G.current=!1,Y(!1)}}return F1.jsxs("div",{className:"group/chat relative",children:[F1.jsx(B8,{className:Q0("font-medium group-hover/chat:bg-accent group-hover/chat:text-accent-foreground",$&&"bg-accent text-accent-foreground"),onClick:()=>Q(X.sessionId),children:F1.jsx("div",{className:Q0("flex min-w-0 flex-1 overflow-hidden",(F||U)&&"mr-4 mask-r-from-[calc(100%-16px)]",Z&&!J&&"group-focus-within/chat:mr-4 group-focus-within/chat:mask-r-from-[calc(100%-16px)] group-hover/chat:mr-4 group-hover/chat:mask-r-from-[calc(100%-16px)] [@media(hover:none)]:mr-4 [@media(hover:none)]:mask-r-from-[calc(100%-16px)]",J&&"mr-14 mask-r-from-[calc(100%-16px)]"),children:F1.jsxs("span",{className:Q0("flex min-w-0 items-baseline gap-1.5",(F||U)&&"-mr-4",J?"-mr-14":Z&&"group-focus-within/chat:-mr-4 group-hover/chat:-mr-4 [@media(hover:none)]:-mr-4"),children:[F1.jsx("span",{className:"min-w-0 truncate",children:X.summary}),K&&F1.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:K})]})})}),F&&F1.jsx(n2,{className:Q0("pointer-events-none absolute top-1/2 right-1.5 -translate-y-1/2 text-muted-foreground",Z&&"group-focus-within/chat:hidden group-hover/chat:hidden [@media(hover:none)]:hidden",(J||U)&&"hidden")}),Z&&F1.jsx("div",{className:Q0("absolute top-1/2 right-0 flex -translate-y-1/2 items-center opacity-100 transition-none",!J&&"group-focus-within/chat:opacity-100 group-hover/chat:opacity-100 [@media(hover:hover)]:opacity-0",U&&"opacity-100!"),children:J?F1.jsx(L0,{type:"button",variant:"secondary",size:"sm","aria-label":`Confirm archive ${X.summary}`,tabIndex:-1,className:"mr-1 h-5 rounded-sm px-1.5 text-xs hover:bg-accent",disabled:U,onClick:N,onPointerDown:(q)=>q.stopPropagation(),children:"Confirm"}):F1.jsxs(t1,{children:[F1.jsx(e1,{render:F1.jsx(L0,{type:"button",variant:"ghost",size:"icon-sm","aria-label":`Archive ${X.summary}`,tabIndex:-1,className:"text-muted-foreground hover:bg-transparent hover:text-foreground",disabled:U,onClick:W,onPointerDown:(q)=>q.stopPropagation(),children:F1.jsx(Hu,{stroke:1.75})})}),F1.jsx($5,{side:"right",children:"Archive chat"})]})})]})}function GZ0($){return`${$.getFullYear()}-${$.getMonth()}-${$.getDate()}`}function Ju($){return Date.UTC($.getFullYear(),$.getMonth(),$.getDate())/86400000}function UZ0($,Z){let J=Ju(Z)-Ju($);if(J===0)return"Today";if(J===1)return"Yesterday";if(J>=2&&J<=5)return`${J} days ago`;return $.toLocaleDateString([],{month:"short",day:"numeric",...$.getFullYear()===Z.getFullYear()?{}:{year:"numeric"}})}function YZ0($,Z=new Date){let J=new Map;for(let H of $.slice().sort((B,Q)=>Q.lastModified-B.lastModified)){let B=new Date(H.lastModified),Q=GZ0(B),X=J.get(Q);if(X){X.sessions.push(H);continue}J.set(Q,{key:Q,label:UZ0(B,Z),sessions:[H]})}return[...J.values()]}function FZ0($,Z,J=new Date){return YZ0($.filter((H)=>Z==="overview"?!H.tabId?.startsWith("views/"):H.tabId===Z),J)}function zu({className:$}){let Z=d1(),{pinnedSessionId:J,loaded:H,pin:B}=t6(),[Q]=t3(),{data:X=[]}=vJ(Z);if(!H)return null;if(J){let z=X.find((G)=>G.sessionId===J)?.summary;if(!z)return null;return F1.jsxs("div",{className:Q0("-my-0.5 -ml-0.5 box-content h-7 max-w-64 rounded-lg py-0.5 pr-0.5 pl-3","flex min-w-0 items-center gap-1 bg-accent text-sm font-medium"),children:[F1.jsx("span",{className:"min-w-0 flex-1 truncate",children:z}),F1.jsxs(t1,{children:[F1.jsx(e1,{render:F1.jsx(L0,{variant:"ghost",size:"icon-sm",className:$,onClick:()=>B(null),"aria-label":"Unpin chat","aria-pressed":!0,children:F1.jsx(Xu,{stroke:1.75})})}),F1.jsx($5,{children:"Unpin chat"})]},"unpin")]})}return F1.jsxs("div",{className:"flex w-full min-w-0 items-center justify-between gap-1",children:[F1.jsx(KZ0,{className:$,sessions:X}),Q&&F1.jsxs(t1,{children:[F1.jsx(e1,{render:F1.jsx(L0,{variant:"ghost",size:"icon-sm",className:$,onClick:()=>B(Q),"aria-label":"Pin chat to workspace","aria-pressed":!1,children:F1.jsx(Qu,{stroke:1.75})})}),F1.jsx($5,{children:"Pin chat to workspace"})]},"pin")]})}function KZ0({className:$,sessions:Z}){let J=d1(),H=s3(),[B,Q]=t3(),[X,z]=CX.useState(null),G=s8(J).data?.supportsArchiving===!0,U=DR(J),Y=FZ0(Z,H);if(Y.length===0&&!B)return null;function F(W){if(!W)z(null)}async function K(W){z(null),await U.mutateAsync(W);let N=x1.getState();if(N.clearAttachments(J,W),N.clearPreviewsForSession(J,W),B===W)Q(null)}return B?F1.jsxs(t1,{children:[F1.jsx(e1,{render:F1.jsx(L0,{variant:"ghost",size:"icon-sm","aria-label":"New chat",onClick:()=>Q(null),className:$,children:F1.jsx(VW,{stroke:1.75})})}),F1.jsx($5,{children:"New chat"})]}):F1.jsxs(r8,{onOpenChange:F,children:[F1.jsxs(t1,{children:[F1.jsx(a8,{render:F1.jsx(e1,{render:F1.jsx(L0,{variant:"ghost",size:"icon-sm","aria-label":"History",className:$,children:F1.jsx(Bu,{stroke:1.75})})})}),F1.jsx($5,{children:"History"})]}),F1.jsx(o8,{align:"start",className:"flex max-h-100 w-max max-w-72 min-w-40 flex-col overflow-hidden",children:F1.jsx("div",{className:"no-scrollbar flex min-h-0 flex-1 scroll-fade flex-col gap-1 overflow-y-auto overscroll-contain [--scroll-fade-reveal:8px]",children:Y.map((W)=>F1.jsxs(O9,{children:[F1.jsx(zK,{children:W.label}),W.sessions.map((N)=>F1.jsx(zZ0,{session:N,active:B===N.sessionId,canArchive:G,confirmingArchive:X===N.sessionId,onSelect:Q,onArchive:K,onRequestArchive:z,workspaceId:J},N.sessionId))]},W.key))})})]})}var Er=P(m(),1);function G5(){}function LW(){}function Gu($,Z){let J=Z||{};return($[$.length-1]===""?[...$,""]:$).join((J.padRight?" ":"")+","+(J.padLeft===!1?"":" ")).trim()}var WZ0=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,NZ0=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,qZ0={};function MW($,Z){return((Z||qZ0).jsx?NZ0:WZ0).test($)}var AZ0=/[ \t\n\f\r]/g;function uM($){return typeof $==="object"?$.type==="text"?Uu($.value):!1:Uu($)}function Uu($){return $.replace(AZ0,"")===""}class I7{constructor($,Z,J){if(this.normal=Z,this.property=$,J)this.space=J}}I7.prototype.normal={};I7.prototype.property={};I7.prototype.space=void 0;function pM($,Z){let J={},H={};for(let B of $)Object.assign(J,B.property),Object.assign(H,B.normal);return new I7(J,H,Z)}function EX($){return $.toLowerCase()}class e2{constructor($,Z){this.attribute=Z,this.property=$}}e2.prototype.attribute="";e2.prototype.booleanish=!1;e2.prototype.boolean=!1;e2.prototype.commaOrSpaceSeparated=!1;e2.prototype.commaSeparated=!1;e2.prototype.defined=!1;e2.prototype.mustUseProperty=!1;e2.prototype.number=!1;e2.prototype.overloadedBoolean=!1;e2.prototype.property="";e2.prototype.spaceSeparated=!1;e2.prototype.space=void 0;var bX={};k5(bX,{spaceSeparated:()=>A5,overloadedBoolean:()=>PW,number:()=>b0,commaSeparated:()=>k7,commaOrSpaceSeparated:()=>X8,booleanish:()=>$2,boolean:()=>_1});var DZ0=0,_1=XZ(),$2=XZ(),PW=XZ(),b0=XZ(),A5=XZ(),k7=XZ(),X8=XZ();function XZ(){return 2**++DZ0}var cM=Object.keys(bX);class SH extends e2{constructor($,Z,J,H){let B=-1;super($,Z);if(Yu(this,"space",H),typeof J==="number")while(++B<cM.length){let Q=cM[B];Yu(this,cM[B],(J&bX[Q])===bX[Q])}}}SH.prototype.defined=!0;function Yu($,Z,J){if(J)$[Z]=J}function H9($){let Z={},J={};for(let[H,B]of Object.entries($.properties)){let Q=new SH(H,$.transform($.attributes||{},H),B,$.space);if($.mustUseProperty&&$.mustUseProperty.includes(H))Q.mustUseProperty=!0;Z[H]=Q,J[EX(H)]=H,J[EX(Q.attribute)]=H}return new I7(Z,J,$.space)}var dM=H9({properties:{ariaActiveDescendant:null,ariaAtomic:$2,ariaAutoComplete:null,ariaBusy:$2,ariaChecked:$2,ariaColCount:b0,ariaColIndex:b0,ariaColSpan:b0,ariaControls:A5,ariaCurrent:null,ariaDescribedBy:A5,ariaDetails:null,ariaDisabled:$2,ariaDropEffect:A5,ariaErrorMessage:null,ariaExpanded:$2,ariaFlowTo:A5,ariaGrabbed:$2,ariaHasPopup:null,ariaHidden:$2,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:A5,ariaLevel:b0,ariaLive:null,ariaModal:$2,ariaMultiLine:$2,ariaMultiSelectable:$2,ariaOrientation:null,ariaOwns:A5,ariaPlaceholder:null,ariaPosInSet:b0,ariaPressed:$2,ariaReadOnly:$2,ariaRelevant:null,ariaRequired:$2,ariaRoleDescription:A5,ariaRowCount:b0,ariaRowIndex:b0,ariaRowSpan:b0,ariaSelected:$2,ariaSetSize:b0,ariaSort:null,ariaValueMax:b0,ariaValueMin:b0,ariaValueNow:b0,ariaValueText:null,role:null},transform($,Z){return Z==="role"?Z:"aria-"+Z.slice(4).toLowerCase()}});function _W($,Z){return Z in $?$[Z]:Z}function OW($,Z){return _W($,Z.toLowerCase())}var Fu=H9({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:k7,acceptCharset:A5,accessKey:A5,action:null,allow:null,allowFullScreen:_1,allowPaymentRequest:_1,allowUserMedia:_1,alt:null,as:null,async:_1,autoCapitalize:null,autoComplete:A5,autoFocus:_1,autoPlay:_1,blocking:A5,capture:null,charSet:null,checked:_1,cite:null,className:A5,cols:b0,colSpan:null,content:null,contentEditable:$2,controls:_1,controlsList:A5,coords:b0|k7,crossOrigin:null,data:null,dateTime:null,decoding:null,default:_1,defer:_1,dir:null,dirName:null,disabled:_1,download:PW,draggable:$2,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:_1,formTarget:null,headers:A5,height:b0,hidden:PW,high:b0,href:null,hrefLang:null,htmlFor:A5,httpEquiv:A5,id:null,imageSizes:null,imageSrcSet:null,inert:_1,inputMode:null,integrity:null,is:null,isMap:_1,itemId:null,itemProp:A5,itemRef:A5,itemScope:_1,itemType:A5,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:_1,low:b0,manifest:null,max:null,maxLength:b0,media:null,method:null,min:null,minLength:b0,multiple:_1,muted:_1,name:null,nonce:null,noModule:_1,noValidate:_1,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:_1,optimum:b0,pattern:null,ping:A5,placeholder:null,playsInline:_1,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:_1,referrerPolicy:null,rel:A5,required:_1,reversed:_1,rows:b0,rowSpan:b0,sandbox:A5,scope:null,scoped:_1,seamless:_1,selected:_1,shadowRootClonable:_1,shadowRootDelegatesFocus:_1,shadowRootMode:null,shape:null,size:b0,sizes:null,slot:null,span:b0,spellCheck:$2,src:null,srcDoc:null,srcLang:null,srcSet:null,start:b0,step:null,style:null,tabIndex:b0,target:null,title:null,translate:null,type:null,typeMustMatch:_1,useMap:null,value:$2,width:b0,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:A5,axis:null,background:null,bgColor:null,border:b0,borderColor:null,bottomMargin:b0,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:_1,declare:_1,event:null,face:null,frame:null,frameBorder:null,hSpace:b0,leftMargin:b0,link:null,longDesc:null,lowSrc:null,marginHeight:b0,marginWidth:b0,noResize:_1,noHref:_1,noShade:_1,noWrap:_1,object:null,profile:null,prompt:null,rev:null,rightMargin:b0,rules:null,scheme:null,scrolling:$2,standby:null,summary:null,text:null,topMargin:b0,valueType:null,version:null,vAlign:null,vLink:null,vSpace:b0,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:_1,disableRemotePlayback:_1,prefix:null,property:null,results:b0,security:null,unselectable:null},space:"html",transform:OW});var Ku=H9({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:X8,accentHeight:b0,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:b0,amplitude:b0,arabicForm:null,ascent:b0,attributeName:null,attributeType:null,azimuth:b0,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:b0,by:null,calcMode:null,capHeight:b0,className:A5,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:b0,diffuseConstant:b0,direction:null,display:null,dur:null,divisor:b0,dominantBaseline:null,download:_1,dx:null,dy:null,edgeMode:null,editable:null,elevation:b0,enableBackground:null,end:null,event:null,exponent:b0,externalResourcesRequired:null,fill:null,fillOpacity:b0,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:k7,g2:k7,glyphName:k7,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:b0,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:b0,horizOriginX:b0,horizOriginY:b0,id:null,ideographic:b0,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:b0,k:b0,k1:b0,k2:b0,k3:b0,k4:b0,kernelMatrix:X8,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:b0,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:b0,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:b0,overlineThickness:b0,paintOrder:null,panose1:null,path:null,pathLength:b0,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:A5,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:b0,pointsAtY:b0,pointsAtZ:b0,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:X8,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:X8,rev:X8,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:X8,requiredFeatures:X8,requiredFonts:X8,requiredFormats:X8,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:b0,specularExponent:b0,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:b0,strikethroughThickness:b0,string:null,stroke:null,strokeDashArray:X8,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:b0,strokeOpacity:b0,strokeWidth:null,style:null,surfaceScale:b0,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:X8,tabIndex:b0,tableValues:null,target:null,targetX:b0,targetY:b0,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:X8,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:b0,underlineThickness:b0,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:b0,values:null,vAlphabetic:b0,vMathematical:b0,vectorEffect:null,vHanging:b0,vIdeographic:b0,version:null,vertAdvY:b0,vertOriginX:b0,vertOriginY:b0,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:b0,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:_W});var lM=H9({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform($,Z){return"xlink:"+Z.slice(5).toLowerCase()}});var iM=H9({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:OW});var rM=H9({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform($,Z){return"xml:"+Z.slice(3).toLowerCase()}});var aM={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"};var VZ0=/[A-Z]/g,Wu=/-[a-z]/g,LZ0=/^data[-\w.:]+$/i;function oM($,Z){let J=EX(Z),H=Z,B=e2;if(J in $.normal)return $.property[$.normal[J]];if(J.length>4&&J.slice(0,4)==="data"&&LZ0.test(Z)){if(Z.charAt(4)==="-"){let Q=Z.slice(5).replace(Wu,PZ0);H="data"+Q.charAt(0).toUpperCase()+Q.slice(1)}else{let Q=Z.slice(4);if(!Wu.test(Q)){let X=Q.replace(VZ0,MZ0);if(X.charAt(0)!=="-")X="-"+X;Z="data"+X}}B=SH}return new B(H,Z)}function MZ0($){return"-"+$.toLowerCase()}function PZ0($){return $.charAt(1).toUpperCase()}var Nu=pM([dM,Fu,lM,iM,rM],"html"),TW=pM([dM,Ku,lM,iM,rM],"svg");function qu($){return $.join(" ").trim()}var Iu=P(bu(),1);var jW=wu("end"),RH=wu("start");function wu($){return Z;function Z(J){let H=J&&J.position&&J.position[$]||{};if(typeof H.line==="number"&&H.line>0&&typeof H.column==="number"&&H.column>0)return{line:H.line,column:H.column,offset:typeof H.offset==="number"&&H.offset>-1?H.offset:void 0}}}function tM($){let Z=RH($),J=jW($);if(Z&&J)return{start:Z,end:J}}function y7($){if(!$||typeof $!=="object")return"";if("position"in $||"type"in $)return Su($.position);if("start"in $||"end"in $)return Su($);if("line"in $||"column"in $)return eM($);return""}function eM($){return Ru($&&$.line)+":"+Ru($&&$.column)}function Su($){return eM($&&$.start)+"-"+eM($&&$.end)}function Ru($){return $&&typeof $==="number"?$:1}class D2 extends Error{constructor($,Z,J){super();if(typeof Z==="string")J=Z,Z=void 0;let H="",B={},Q=!1;if(Z)if("line"in Z&&"column"in Z)B={place:Z};else if("start"in Z&&"end"in Z)B={place:Z};else if("type"in Z)B={ancestors:[Z],place:Z.position};else B={...Z};if(typeof $==="string")H=$;else if(!B.cause&&$)Q=!0,H=$.message,B.cause=$;if(!B.ruleId&&!B.source&&typeof J==="string"){let z=J.indexOf(":");if(z===-1)B.ruleId=J;else B.source=J.slice(0,z),B.ruleId=J.slice(z+1)}if(!B.place&&B.ancestors&&B.ancestors){let z=B.ancestors[B.ancestors.length-1];if(z)B.place=z.position}let X=B.place&&"start"in B.place?B.place.start:B.place;this.ancestors=B.ancestors||void 0,this.cause=B.cause||void 0,this.column=X?X.column:void 0,this.fatal=void 0,this.file="",this.message=H,this.line=X?X.line:void 0,this.name=y7(B.place)||"1:1",this.place=B.place||void 0,this.reason=this.message,this.ruleId=B.ruleId||void 0,this.source=B.source||void 0,this.stack=Q&&B.cause&&typeof B.cause.stack==="string"?B.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}D2.prototype.file="";D2.prototype.name="";D2.prototype.reason="";D2.prototype.message="";D2.prototype.stack="";D2.prototype.column=void 0;D2.prototype.line=void 0;D2.prototype.ancestors=void 0;D2.prototype.cause=void 0;D2.prototype.fatal=void 0;D2.prototype.place=void 0;D2.prototype.ruleId=void 0;D2.prototype.source=void 0;var $P={}.hasOwnProperty,rZ0=new Map,aZ0=/[A-Z]/g,oZ0=new Set(["table","tbody","thead","tfoot","tr"]),nZ0=new Set(["td","th"]),ku="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function ZP($,Z){if(!Z||Z.Fragment===void 0)throw TypeError("Expected `Fragment` in options");let J=Z.filePath||void 0,H;if(Z.development){if(typeof Z.jsxDEV!=="function")throw TypeError("Expected `jsxDEV` in options when `development: true`");H=BJ0(J,Z.jsxDEV)}else{if(typeof Z.jsx!=="function")throw TypeError("Expected `jsx` in production options");if(typeof Z.jsxs!=="function")throw TypeError("Expected `jsxs` in production options");H=HJ0(J,Z.jsx,Z.jsxs)}let B={Fragment:Z.Fragment,ancestors:[],components:Z.components||{},create:H,elementAttributeNameCase:Z.elementAttributeNameCase||"react",evaluater:Z.createEvaluater?Z.createEvaluater():void 0,filePath:J,ignoreInvalidStyle:Z.ignoreInvalidStyle||!1,passKeys:Z.passKeys!==!1,passNode:Z.passNode||!1,schema:Z.space==="svg"?TW:Nu,stylePropertyNameCase:Z.stylePropertyNameCase||"dom",tableCellAlignToStyle:Z.tableCellAlignToStyle!==!1},Q=yu(B,$,void 0);if(Q&&typeof Q!=="string")return Q;return B.create($,B.Fragment,{children:Q||void 0},void 0)}function yu($,Z,J){if(Z.type==="element")return sZ0($,Z,J);if(Z.type==="mdxFlowExpression"||Z.type==="mdxTextExpression")return tZ0($,Z);if(Z.type==="mdxJsxFlowElement"||Z.type==="mdxJsxTextElement")return $J0($,Z,J);if(Z.type==="mdxjsEsm")return eZ0($,Z);if(Z.type==="root")return ZJ0($,Z,J);if(Z.type==="text")return JJ0($,Z)}function sZ0($,Z,J){let H=$.schema,B=H;if(Z.tagName.toLowerCase()==="svg"&&H.space==="html")B=TW,$.schema=B;$.ancestors.push(Z);let Q=hu($,Z.tagName,!1),X=QJ0($,Z),z=HP($,Z);if(oZ0.has(Z.tagName))z=z.filter(function(G){return typeof G==="string"?!uM(G):!0});return xu($,X,Q,Z),JP(X,z),$.ancestors.pop(),$.schema=H,$.create(Z,Q,X,J)}function tZ0($,Z){if(Z.data&&Z.data.estree&&$.evaluater){let H=Z.data.estree.body[0];return G5(H.type==="ExpressionStatement"),$.evaluater.evaluateExpression(H.expression)}SX($,Z.position)}function eZ0($,Z){if(Z.data&&Z.data.estree&&$.evaluater)return $.evaluater.evaluateProgram(Z.data.estree);SX($,Z.position)}function $J0($,Z,J){let H=$.schema,B=H;if(Z.name==="svg"&&H.space==="html")B=TW,$.schema=B;$.ancestors.push(Z);let Q=Z.name===null?$.Fragment:hu($,Z.name,!0),X=XJ0($,Z),z=HP($,Z);return xu($,X,Q,Z),JP(X,z),$.ancestors.pop(),$.schema=H,$.create(Z,Q,X,J)}function ZJ0($,Z,J){let H={};return JP(H,HP($,Z)),$.create(Z,$.Fragment,H,J)}function JJ0($,Z){return Z.value}function xu($,Z,J,H){if(typeof J!=="string"&&J!==$.Fragment&&$.passNode)Z.node=H}function JP($,Z){if(Z.length>0){let J=Z.length>1?Z:Z[0];if(J)$.children=J}}function HJ0($,Z,J){return H;function H(B,Q,X,z){let U=Array.isArray(X.children)?J:Z;return z?U(Q,X,z):U(Q,X)}}function BJ0($,Z){return J;function J(H,B,Q,X){let z=Array.isArray(Q.children),G=RH(H);return Z(B,Q,X,z,{columnNumber:G?G.column-1:void 0,fileName:$,lineNumber:G?G.line:void 0},void 0)}}function QJ0($,Z){let J={},H,B;for(B in Z.properties)if(B!=="children"&&$P.call(Z.properties,B)){let Q=zJ0($,B,Z.properties[B]);if(Q){let[X,z]=Q;if($.tableCellAlignToStyle&&X==="align"&&typeof z==="string"&&nZ0.has(Z.tagName))H=z;else J[X]=z}}if(H){let Q=J.style||(J.style={});Q[$.stylePropertyNameCase==="css"?"text-align":"textAlign"]=H}return J}function XJ0($,Z){let J={};for(let H of Z.attributes)if(H.type==="mdxJsxExpressionAttribute")if(H.data&&H.data.estree&&$.evaluater){let Q=H.data.estree.body[0];G5(Q.type==="ExpressionStatement");let X=Q.expression;G5(X.type==="ObjectExpression");let z=X.properties[0];G5(z.type==="SpreadElement"),Object.assign(J,$.evaluater.evaluateExpression(z.argument))}else SX($,Z.position);else{let B=H.name,Q;if(H.value&&typeof H.value==="object")if(H.value.data&&H.value.data.estree&&$.evaluater){let z=H.value.data.estree.body[0];G5(z.type==="ExpressionStatement"),Q=$.evaluater.evaluateExpression(z.expression)}else SX($,Z.position);else Q=H.value===null?!0:H.value;J[B]=Q}return J}function HP($,Z){let J=[],H=-1,B=$.passKeys?new Map:rZ0;while(++H<Z.children.length){let Q=Z.children[H],X;if($.passKeys){let G=Q.type==="element"?Q.tagName:Q.type==="mdxJsxFlowElement"||Q.type==="mdxJsxTextElement"?Q.name:void 0;if(G){let U=B.get(G)||0;X=G+"-"+U,B.set(G,U+1)}}let z=yu($,Q,X);if(z!==void 0)J.push(z)}return J}function zJ0($,Z,J){let H=oM($.schema,Z);if(J===null||J===void 0||typeof J==="number"&&Number.isNaN(J))return;if(Array.isArray(J))J=H.commaSeparated?Gu(J):qu(J);if(H.property==="style"){let B=typeof J==="object"?J:GJ0($,String(J));if($.stylePropertyNameCase==="css")B=UJ0(B);return["style",B]}return[$.elementAttributeNameCase==="react"&&H.space?aM[H.property]||H.property:H.attribute,J]}function GJ0($,Z){try{return Iu.default(Z,{reactCompat:!0})}catch(J){if($.ignoreInvalidStyle)return{};let H=J,B=new D2("Cannot parse `style` attribute",{ancestors:$.ancestors,cause:H,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw B.file=$.filePath||void 0,B.url=ku+"#cannot-parse-style-attribute",B}}function hu($,Z,J){let H;if(!J)H={type:"Literal",value:Z};else if(Z.includes(".")){let B=Z.split("."),Q=-1,X;while(++Q<B.length){let z=MW(B[Q])?{type:"Identifier",name:B[Q]}:{type:"Literal",value:B[Q]};X=X?{type:"MemberExpression",object:X,property:z,computed:Boolean(Q&&z.type==="Literal"),optional:!1}:z}G5(X,"always a result"),H=X}else H=MW(Z)&&!/^[a-z]/.test(Z)?{type:"Identifier",name:Z}:{type:"Literal",value:Z};if(H.type==="Literal"){let B=H.value;return $P.call($.components,B)?$.components[B]:B}if($.evaluater)return $.evaluater.evaluateExpression(H);SX($)}function SX($,Z){let J=new D2("Cannot handle MDX estrees without `createEvaluater`",{ancestors:$.ancestors,place:Z,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw J.file=$.filePath||void 0,J.url=ku+"#cannot-handle-mdx-estrees-without-createevaluater",J}function UJ0($){let Z={},J;for(J in $)if($P.call($,J))Z[YJ0(J)]=$[J];return Z}function YJ0($){let Z=$.replace(aZ0,FJ0);if(Z.slice(0,3)==="ms-")Z="-"+Z;return Z}function FJ0($){return"-"+$.toLowerCase()}var RX={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"]};var gH=P(u(),1),Qc=P(m(),1);var KJ0={};function GZ($,Z){let J=Z||KJ0,H=typeof J.includeImageAlt==="boolean"?J.includeImageAlt:!0,B=typeof J.includeHtml==="boolean"?J.includeHtml:!0;return fu($,H,B)}function fu($,Z,J){if(WJ0($)){if("value"in $)return $.type==="html"&&!J?"":$.value;if(Z&&"alt"in $&&$.alt)return $.alt;if("children"in $)return vu($.children,Z,J)}if(Array.isArray($))return vu($,Z,J);return""}function vu($,Z,J){let H=[],B=-1;while(++B<$.length)H[B]=fu($[B],Z,J);return H.join("")}function WJ0($){return Boolean($&&typeof $==="object")}var gu=document.createElement("i");function IH($){let Z="&"+$+";";gu.innerHTML=Z;let J=gu.textContent;if(J.charCodeAt(J.length-1)===59&&$!=="semi")return!1;return J===Z?!1:J}function z2($,Z,J,H){let B=$.length,Q=0,X;if(Z<0)Z=-Z>B?0:B+Z;else Z=Z>B?B:Z;if(J=J>0?J:0,H.length<1e4)X=Array.from(H),X.unshift(Z,J),$.splice(...X);else{if(J)$.splice(Z,J);while(Q<H.length)X=H.slice(Q,Q+1e4),X.unshift(Z,0),$.splice(...X),Q+=1e4,Z+=1e4}}function u4($,Z){if($.length>0)return z2($,$.length,0,Z),$;return Z}var mu={}.hasOwnProperty;function CW($){let Z={},J=-1;while(++J<$.length)NJ0(Z,$[J]);return Z}function NJ0($,Z){let J;for(J in Z){let B=(mu.call($,J)?$[J]:void 0)||($[J]={}),Q=Z[J],X;if(Q)for(X in Q){if(!mu.call(B,X))B[X]=[];let z=Q[X];qJ0(B[X],Array.isArray(z)?z:z?[z]:[])}}}function qJ0($,Z){let J=-1,H=[];while(++J<Z.length)(Z[J].add==="after"?$:H).push(Z[J]);z2($,0,0,H)}function EW($,Z){let J=Number.parseInt($,Z);if(J<9||J===11||J>13&&J<32||J>126&&J<160||J>55295&&J<57344||J>64975&&J<65008||(J&65535)===65535||(J&65535)===65534||J>1114111)return"�";return String.fromCodePoint(J)}function j4($){return $.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}var j2=x7(/[A-Za-z]/),Z2=x7(/[\dA-Za-z]/),uu=x7(/[#-'*+\--9=?A-Z^-~]/);function UZ($){return $!==null&&($<32||$===127)}var IX=x7(/\d/),pu=x7(/[\dA-Fa-f]/),cu=x7(/[!-/:-@[-`{-~]/);function u0($){return $!==null&&$<-2}function v1($){return $!==null&&($<0||$===32)}function X1($){return $===-2||$===-1||$===32}var YZ=x7(/\p{P}|\p{S}/u),O3=x7(/\s/);function x7($){return Z;function Z(J){return J!==null&&J>-1&&$.test(String.fromCharCode(J))}}function B9($){let Z=[],J=-1,H=0,B=0;while(++J<$.length){let Q=$.charCodeAt(J),X="";if(Q===37&&Z2($.charCodeAt(J+1))&&Z2($.charCodeAt(J+2)))B=2;else if(Q<128){if(!/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(Q)))X=String.fromCharCode(Q)}else if(Q>55295&&Q<57344){let z=$.charCodeAt(J+1);if(Q<56320&&z>56319&&z<57344)X=String.fromCharCode(Q,z),B=1;else X="�"}else X=String.fromCharCode(Q);if(X)Z.push($.slice(H,J),encodeURIComponent(X)),H=J+B+1,X="";if(B)J+=B,B=0}return Z.join("")+$.slice(H)}function J1($,Z,J,H){let B=H?H-1:Number.POSITIVE_INFINITY,Q=0;return X;function X(G){if(X1(G))return $.enter(J),z(G);return Z(G)}function z(G){if(X1(G)&&Q++<B)return $.consume(G),z;return $.exit(J),Z(G)}}var du={tokenize:AJ0};function AJ0($){let Z=$.attempt(this.parser.constructs.contentInitial,H,B),J;return Z;function H(z){if(z===null){$.consume(z);return}return $.enter("lineEnding"),$.consume(z),$.exit("lineEnding"),J1($,Z,"linePrefix")}function B(z){return $.enter("paragraph"),Q(z)}function Q(z){let G=$.enter("chunkText",{contentType:"text",previous:J});if(J)J.next=G;return J=G,X(z)}function X(z){if(z===null){$.exit("chunkText"),$.exit("paragraph"),$.consume(z);return}if(u0(z))return $.consume(z),$.exit("chunkText"),Q;return $.consume(z),X}}var iu={tokenize:DJ0},lu={tokenize:VJ0};function DJ0($){let Z=this,J=[],H=0,B,Q,X;return z;function z(L){if(H<J.length){let O=J[H];return Z.containerState=O[1],$.attempt(O[0].continuation,G,U)(L)}return U(L)}function G(L){if(H++,Z.containerState._closeFlow){if(Z.containerState._closeFlow=void 0,B)V();let O=Z.events.length,M=O,_;while(M--)if(Z.events[M][0]==="exit"&&Z.events[M][1].type==="chunkFlow"){_=Z.events[M][1].end;break}A(H);let w=O;while(w<Z.events.length)Z.events[w][1].end={..._},w++;return z2(Z.events,M+1,0,Z.events.slice(O)),Z.events.length=w,U(L)}return z(L)}function U(L){if(H===J.length){if(!B)return K(L);if(B.currentConstruct&&B.currentConstruct.concrete)return N(L);Z.interrupt=Boolean(B.currentConstruct&&!B._gfmTableDynamicInterruptHack)}return Z.containerState={},$.check(lu,Y,F)(L)}function Y(L){if(B)V();return A(H),K(L)}function F(L){return Z.parser.lazy[Z.now().line]=H!==J.length,X=Z.now().offset,N(L)}function K(L){return Z.containerState={},$.attempt(lu,W,N)(L)}function W(L){return H++,J.push([Z.currentConstruct,Z.containerState]),K(L)}function N(L){if(L===null){if(B)V();A(0),$.consume(L);return}return B=B||Z.parser.flow(Z.now()),$.enter("chunkFlow",{_tokenizer:B,contentType:"flow",previous:Q}),q(L)}function q(L){if(L===null){D($.exit("chunkFlow"),!0),A(0),$.consume(L);return}if(u0(L))return $.consume(L),D($.exit("chunkFlow")),H=0,Z.interrupt=void 0,z;return $.consume(L),q}function D(L,O){let M=Z.sliceStream(L);if(O)M.push(null);if(L.previous=Q,Q)Q.next=L;if(Q=L,B.defineSkip(L.start),B.write(M),Z.parser.lazy[L.start.line]){let _=B.events.length;while(_--)if(B.events[_][1].start.offset<X&&(!B.events[_][1].end||B.events[_][1].end.offset>X))return;let w=Z.events.length,C=w,E,T;while(C--)if(Z.events[C][0]==="exit"&&Z.events[C][1].type==="chunkFlow"){if(E){T=Z.events[C][1].end;break}E=!0}A(H),_=w;while(_<Z.events.length)Z.events[_][1].end={...T},_++;z2(Z.events,C+1,0,Z.events.slice(w)),Z.events.length=_}}function A(L){let O=J.length;while(O-- >L){let M=J[O];Z.containerState=M[1],M[0].exit.call(Z,$)}J.length=L}function V(){B.write([null]),Q=void 0,B=void 0,Z.containerState._closeFlow=void 0}}function VJ0($,Z,J){return J1($,$.attempt(this.parser.constructs.document,Z,J),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Q6($){if($===null||v1($)||O3($))return 1;if(YZ($))return 2}function h7($,Z,J){let H=[],B=-1;while(++B<$.length){let Q=$[B].resolveAll;if(Q&&!H.includes(Q))Z=Q(Z,J),H.push(Q)}return Z}var kX={name:"attention",resolveAll:LJ0,tokenize:MJ0};function LJ0($,Z){let J=-1,H,B,Q,X,z,G,U,Y;while(++J<$.length)if($[J][0]==="enter"&&$[J][1].type==="attentionSequence"&&$[J][1]._close){H=J;while(H--)if($[H][0]==="exit"&&$[H][1].type==="attentionSequence"&&$[H][1]._open&&Z.sliceSerialize($[H][1]).charCodeAt(0)===Z.sliceSerialize($[J][1]).charCodeAt(0)){if(($[H][1]._close||$[J][1]._open)&&($[J][1].end.offset-$[J][1].start.offset)%3&&!(($[H][1].end.offset-$[H][1].start.offset+$[J][1].end.offset-$[J][1].start.offset)%3))continue;G=$[H][1].end.offset-$[H][1].start.offset>1&&$[J][1].end.offset-$[J][1].start.offset>1?2:1;let F={...$[H][1].end},K={...$[J][1].start};if(ru(F,-G),ru(K,G),X={type:G>1?"strongSequence":"emphasisSequence",start:F,end:{...$[H][1].end}},z={type:G>1?"strongSequence":"emphasisSequence",start:{...$[J][1].start},end:K},Q={type:G>1?"strongText":"emphasisText",start:{...$[H][1].end},end:{...$[J][1].start}},B={type:G>1?"strong":"emphasis",start:{...X.start},end:{...z.end}},$[H][1].end={...X.start},$[J][1].start={...z.end},U=[],$[H][1].end.offset-$[H][1].start.offset)U=u4(U,[["enter",$[H][1],Z],["exit",$[H][1],Z]]);if(U=u4(U,[["enter",B,Z],["enter",X,Z],["exit",X,Z],["enter",Q,Z]]),U=u4(U,h7(Z.parser.constructs.insideSpan.null,$.slice(H+1,J),Z)),U=u4(U,[["exit",Q,Z],["enter",z,Z],["exit",z,Z],["exit",B,Z]]),$[J][1].end.offset-$[J][1].start.offset)Y=2,U=u4(U,[["enter",$[J][1],Z],["exit",$[J][1],Z]]);else Y=0;z2($,H-1,J-H+3,U),J=H+U.length-Y-2;break}}J=-1;while(++J<$.length)if($[J][1].type==="attentionSequence")$[J][1].type="data";return $}function MJ0($,Z){let J=this.parser.constructs.attentionMarkers.null,H=this.previous,B=Q6(H),Q;return X;function X(G){return Q=G,$.enter("attentionSequence"),z(G)}function z(G){if(G===Q)return $.consume(G),z;let U=$.exit("attentionSequence"),Y=Q6(G),F=!Y||Y===2&&B||J.includes(G),K=!B||B===2&&Y||J.includes(H);return U._open=Boolean(Q===42?F:F&&(B||!K)),U._close=Boolean(Q===42?K:K&&(Y||!F)),Z(G)}}function ru($,Z){$.column+=Z,$.offset+=Z,$._bufferIndex+=Z}var BP={name:"autolink",tokenize:PJ0};function PJ0($,Z,J){let H=0;return B;function B(W){return $.enter("autolink"),$.enter("autolinkMarker"),$.consume(W),$.exit("autolinkMarker"),$.enter("autolinkProtocol"),Q}function Q(W){if(j2(W))return $.consume(W),X;if(W===64)return J(W);return U(W)}function X(W){if(W===43||W===45||W===46||Z2(W))return H=1,z(W);return U(W)}function z(W){if(W===58)return $.consume(W),H=0,G;if((W===43||W===45||W===46||Z2(W))&&H++<32)return $.consume(W),z;return H=0,U(W)}function G(W){if(W===62)return $.exit("autolinkProtocol"),$.enter("autolinkMarker"),$.consume(W),$.exit("autolinkMarker"),$.exit("autolink"),Z;if(W===null||W===32||W===60||UZ(W))return J(W);return $.consume(W),G}function U(W){if(W===64)return $.consume(W),Y;if(uu(W))return $.consume(W),U;return J(W)}function Y(W){return Z2(W)?F(W):J(W)}function F(W){if(W===46)return $.consume(W),H=0,Y;if(W===62)return $.exit("autolinkProtocol").type="autolinkEmail",$.enter("autolinkMarker"),$.consume(W),$.exit("autolinkMarker"),$.exit("autolink"),Z;return K(W)}function K(W){if((W===45||Z2(W))&&H++<63){let N=W===45?K:F;return $.consume(W),N}return J(W)}}var T3={partial:!0,tokenize:_J0};function _J0($,Z,J){return H;function H(Q){return X1(Q)?J1($,B,"linePrefix")(Q):B(Q)}function B(Q){return Q===null||u0(Q)?Z(Q):J(Q)}}var bW={continuation:{tokenize:TJ0},exit:jJ0,name:"blockQuote",tokenize:OJ0};function OJ0($,Z,J){let H=this;return B;function B(X){if(X===62){let z=H.containerState;if(!z.open)$.enter("blockQuote",{_container:!0}),z.open=!0;return $.enter("blockQuotePrefix"),$.enter("blockQuoteMarker"),$.consume(X),$.exit("blockQuoteMarker"),Q}return J(X)}function Q(X){if(X1(X))return $.enter("blockQuotePrefixWhitespace"),$.consume(X),$.exit("blockQuotePrefixWhitespace"),$.exit("blockQuotePrefix"),Z;return $.exit("blockQuotePrefix"),Z(X)}}function TJ0($,Z,J){let H=this;return B;function B(X){if(X1(X))return J1($,Q,"linePrefix",H.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(X);return Q(X)}function Q(X){return $.attempt(bW,Z,J)(X)}}function jJ0($){$.exit("blockQuote")}var wW={name:"characterEscape",tokenize:CJ0};function CJ0($,Z,J){return H;function H(Q){return $.enter("characterEscape"),$.enter("escapeMarker"),$.consume(Q),$.exit("escapeMarker"),B}function B(Q){if(cu(Q))return $.enter("characterEscapeValue"),$.consume(Q),$.exit("characterEscapeValue"),$.exit("characterEscape"),Z;return J(Q)}}var SW={name:"characterReference",tokenize:EJ0};function EJ0($,Z,J){let H=this,B=0,Q,X;return z;function z(F){return $.enter("characterReference"),$.enter("characterReferenceMarker"),$.consume(F),$.exit("characterReferenceMarker"),G}function G(F){if(F===35)return $.enter("characterReferenceMarkerNumeric"),$.consume(F),$.exit("characterReferenceMarkerNumeric"),U;return $.enter("characterReferenceValue"),Q=31,X=Z2,Y(F)}function U(F){if(F===88||F===120)return $.enter("characterReferenceMarkerHexadecimal"),$.consume(F),$.exit("characterReferenceMarkerHexadecimal"),$.enter("characterReferenceValue"),Q=6,X=pu,Y;return $.enter("characterReferenceValue"),Q=7,X=IX,Y(F)}function Y(F){if(F===59&&B){let K=$.exit("characterReferenceValue");if(X===Z2&&!IH(H.sliceSerialize(K)))return J(F);return $.enter("characterReferenceMarker"),$.consume(F),$.exit("characterReferenceMarker"),$.exit("characterReference"),Z}if(X(F)&&B++<Q)return $.consume(F),Y;return J(F)}}var au={partial:!0,tokenize:wJ0},RW={concrete:!0,name:"codeFenced",tokenize:bJ0};function bJ0($,Z,J){let H=this,B={partial:!0,tokenize:M},Q=0,X=0,z;return G;function G(_){return U(_)}function U(_){let w=H.events[H.events.length-1];return Q=w&&w[1].type==="linePrefix"?w[2].sliceSerialize(w[1],!0).length:0,z=_,$.enter("codeFenced"),$.enter("codeFencedFence"),$.enter("codeFencedFenceSequence"),Y(_)}function Y(_){if(_===z)return X++,$.consume(_),Y;if(X<3)return J(_);return $.exit("codeFencedFenceSequence"),X1(_)?J1($,F,"whitespace")(_):F(_)}function F(_){if(_===null||u0(_))return $.exit("codeFencedFence"),H.interrupt?Z(_):$.check(au,q,O)(_);return $.enter("codeFencedFenceInfo"),$.enter("chunkString",{contentType:"string"}),K(_)}function K(_){if(_===null||u0(_))return $.exit("chunkString"),$.exit("codeFencedFenceInfo"),F(_);if(X1(_))return $.exit("chunkString"),$.exit("codeFencedFenceInfo"),J1($,W,"whitespace")(_);if(_===96&&_===z)return J(_);return $.consume(_),K}function W(_){if(_===null||u0(_))return F(_);return $.enter("codeFencedFenceMeta"),$.enter("chunkString",{contentType:"string"}),N(_)}function N(_){if(_===null||u0(_))return $.exit("chunkString"),$.exit("codeFencedFenceMeta"),F(_);if(_===96&&_===z)return J(_);return $.consume(_),N}function q(_){return $.attempt(B,O,D)(_)}function D(_){return $.enter("lineEnding"),$.consume(_),$.exit("lineEnding"),A}function A(_){return Q>0&&X1(_)?J1($,V,"linePrefix",Q+1)(_):V(_)}function V(_){if(_===null||u0(_))return $.check(au,q,O)(_);return $.enter("codeFlowValue"),L(_)}function L(_){if(_===null||u0(_))return $.exit("codeFlowValue"),V(_);return $.consume(_),L}function O(_){return $.exit("codeFenced"),Z(_)}function M(_,w,C){let E=0;return T;function T(y){return _.enter("lineEnding"),_.consume(y),_.exit("lineEnding"),k}function k(y){return _.enter("codeFencedFence"),X1(y)?J1(_,S,"linePrefix",H.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(y):S(y)}function S(y){if(y===z)return _.enter("codeFencedFenceSequence"),I(y);return C(y)}function I(y){if(y===z)return E++,_.consume(y),I;if(E>=X)return _.exit("codeFencedFenceSequence"),X1(y)?J1(_,j,"whitespace")(y):j(y);return C(y)}function j(y){if(y===null||u0(y))return _.exit("codeFencedFence"),w(y);return C(y)}}}function wJ0($,Z,J){let H=this;return B;function B(X){if(X===null)return J(X);return $.enter("lineEnding"),$.consume(X),$.exit("lineEnding"),Q}function Q(X){return H.parser.lazy[H.now().line]?J(X):Z(X)}}var yX={name:"codeIndented",tokenize:RJ0},SJ0={partial:!0,tokenize:IJ0};function RJ0($,Z,J){let H=this;return B;function B(U){return $.enter("codeIndented"),J1($,Q,"linePrefix",5)(U)}function Q(U){let Y=H.events[H.events.length-1];return Y&&Y[1].type==="linePrefix"&&Y[2].sliceSerialize(Y[1],!0).length>=4?X(U):J(U)}function X(U){if(U===null)return G(U);if(u0(U))return $.attempt(SJ0,X,G)(U);return $.enter("codeFlowValue"),z(U)}function z(U){if(U===null||u0(U))return $.exit("codeFlowValue"),X(U);return $.consume(U),z}function G(U){return $.exit("codeIndented"),Z(U)}}function IJ0($,Z,J){let H=this;return B;function B(X){if(H.parser.lazy[H.now().line])return J(X);if(u0(X))return $.enter("lineEnding"),$.consume(X),$.exit("lineEnding"),B;return J1($,Q,"linePrefix",5)(X)}function Q(X){let z=H.events[H.events.length-1];return z&&z[1].type==="linePrefix"&&z[2].sliceSerialize(z[1],!0).length>=4?Z(X):u0(X)?B(X):J(X)}}var QP={name:"codeText",previous:yJ0,resolve:kJ0,tokenize:xJ0};function kJ0($){let Z=$.length-4,J=3,H,B;if(($[J][1].type==="lineEnding"||$[J][1].type==="space")&&($[Z][1].type==="lineEnding"||$[Z][1].type==="space")){H=J;while(++H<Z)if($[H][1].type==="codeTextData"){$[J][1].type="codeTextPadding",$[Z][1].type="codeTextPadding",J+=2,Z-=2;break}}H=J-1,Z++;while(++H<=Z)if(B===void 0){if(H!==Z&&$[H][1].type!=="lineEnding")B=H}else if(H===Z||$[H][1].type==="lineEnding"){if($[B][1].type="codeTextData",H!==B+2)$[B][1].end=$[H-1][1].end,$.splice(B+2,H-B-2),Z-=H-B-2,H=B+2;B=void 0}return $}function yJ0($){return $!==96||this.events[this.events.length-1][1].type==="characterEscape"}function xJ0($,Z,J){let H=this,B=0,Q,X;return z;function z(K){return $.enter("codeText"),$.enter("codeTextSequence"),G(K)}function G(K){if(K===96)return $.consume(K),B++,G;return $.exit("codeTextSequence"),U(K)}function U(K){if(K===null)return J(K);if(K===32)return $.enter("space"),$.consume(K),$.exit("space"),U;if(K===96)return X=$.enter("codeTextSequence"),Q=0,F(K);if(u0(K))return $.enter("lineEnding"),$.consume(K),$.exit("lineEnding"),U;return $.enter("codeTextData"),Y(K)}function Y(K){if(K===null||K===32||K===96||u0(K))return $.exit("codeTextData"),U(K);return $.consume(K),Y}function F(K){if(K===96)return $.consume(K),Q++,F;if(Q===B)return $.exit("codeTextSequence"),$.exit("codeText"),Z(K);return X.type="codeTextData",Y(K)}}class XP{constructor($){this.left=$?[...$]:[],this.right=[]}get($){if($<0||$>=this.left.length+this.right.length)throw RangeError("Cannot access index `"+$+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");if($<this.left.length)return this.left[$];return this.right[this.right.length-$+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice($,Z){let J=Z===null||Z===void 0?Number.POSITIVE_INFINITY:Z;if(J<this.left.length)return this.left.slice($,J);if($>this.left.length)return this.right.slice(this.right.length-J+this.left.length,this.right.length-$+this.left.length).reverse();return this.left.slice($).concat(this.right.slice(this.right.length-J+this.left.length).reverse())}splice($,Z,J){let H=Z||0;this.setCursor(Math.trunc($));let B=this.right.splice(this.right.length-H,Number.POSITIVE_INFINITY);if(J)xX(this.left,J);return B.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push($){this.setCursor(Number.POSITIVE_INFINITY),this.left.push($)}pushMany($){this.setCursor(Number.POSITIVE_INFINITY),xX(this.left,$)}unshift($){this.setCursor(0),this.right.push($)}unshiftMany($){this.setCursor(0),xX(this.right,$.reverse())}setCursor($){if($===this.left.length||$>this.left.length&&this.right.length===0||$<0&&this.left.length===0)return;if($<this.left.length){let Z=this.left.splice($,Number.POSITIVE_INFINITY);xX(this.right,Z.reverse())}else{let Z=this.right.splice(this.left.length+this.right.length-$,Number.POSITIVE_INFINITY);xX(this.left,Z.reverse())}}}function xX($,Z){let J=0;if(Z.length<1e4)$.push(...Z);else while(J<Z.length)$.push(...Z.slice(J,J+1e4)),J+=1e4}function IW($){let Z={},J=-1,H,B,Q,X,z,G,U,Y=new XP($);while(++J<Y.length){while(J in Z)J=Z[J];if(H=Y.get(J),J&&H[1].type==="chunkFlow"&&Y.get(J-1)[1].type==="listItemPrefix"){if(G=H[1]._tokenizer.events,Q=0,Q<G.length&&G[Q][1].type==="lineEndingBlank")Q+=2;if(Q<G.length&&G[Q][1].type==="content")while(++Q<G.length){if(G[Q][1].type==="content")break;if(G[Q][1].type==="chunkText")G[Q][1]._isInFirstContentOfListItem=!0,Q++}}if(H[0]==="enter"){if(H[1].contentType)Object.assign(Z,hJ0(Y,J)),J=Z[J],U=!0}else if(H[1]._container){Q=J,B=void 0;while(Q--)if(X=Y.get(Q),X[1].type==="lineEnding"||X[1].type==="lineEndingBlank"){if(X[0]==="enter"){if(B)Y.get(B)[1].type="lineEndingBlank";X[1].type="lineEnding",B=Q}}else if(X[1].type==="linePrefix"||X[1].type==="listItemIndent");else break;if(B)H[1].end={...Y.get(B)[1].start},z=Y.slice(B,J),z.unshift(H),Y.splice(B,J-B+1,z)}}return z2($,0,Number.POSITIVE_INFINITY,Y.slice(0)),!U}function hJ0($,Z){let J=$.get(Z)[1],H=$.get(Z)[2],B=Z-1,Q=[],X=J._tokenizer;if(!X){if(X=H.parser[J.contentType](J.start),J._contentTypeTextTrailing)X._contentTypeTextTrailing=!0}let z=X.events,G=[],U={},Y,F,K=-1,W=J,N=0,q=0,D=[q];while(W){while($.get(++B)[1]!==W);if(Q.push(B),!W._tokenizer){if(Y=H.sliceStream(W),!W.next)Y.push(null);if(F)X.defineSkip(W.start);if(W._isInFirstContentOfListItem)X._gfmTasklistFirstContentOfListItem=!0;if(X.write(Y),W._isInFirstContentOfListItem)X._gfmTasklistFirstContentOfListItem=void 0}F=W,W=W.next}W=J;while(++K<z.length)if(z[K][0]==="exit"&&z[K-1][0]==="enter"&&z[K][1].type===z[K-1][1].type&&z[K][1].start.line!==z[K][1].end.line)q=K+1,D.push(q),W._tokenizer=void 0,W.previous=void 0,W=W.next;if(X.events=[],W)W._tokenizer=void 0,W.previous=void 0;else D.pop();K=D.length;while(K--){let A=z.slice(D[K],D[K+1]),V=Q.pop();G.push([V,V+A.length-1]),$.splice(V,2,A)}G.reverse(),K=-1;while(++K<G.length)U[N+G[K][0]]=N+G[K][1],N+=G[K][1]-G[K][0]-1;return U}var zP={resolve:fJ0,tokenize:gJ0},vJ0={partial:!0,tokenize:mJ0};function fJ0($){return IW($),$}function gJ0($,Z){let J;return H;function H(z){return $.enter("content"),J=$.enter("chunkContent",{contentType:"content"}),B(z)}function B(z){if(z===null)return Q(z);if(u0(z))return $.check(vJ0,X,Q)(z);return $.consume(z),B}function Q(z){return $.exit("chunkContent"),$.exit("content"),Z(z)}function X(z){return $.consume(z),$.exit("chunkContent"),J.next=$.enter("chunkContent",{contentType:"content",previous:J}),J=J.next,B}}function mJ0($,Z,J){let H=this;return B;function B(X){return $.exit("chunkContent"),$.enter("lineEnding"),$.consume(X),$.exit("lineEnding"),J1($,Q,"linePrefix")}function Q(X){if(X===null||u0(X))return J(X);let z=H.events[H.events.length-1];if(!H.parser.constructs.disable.null.includes("codeIndented")&&z&&z[1].type==="linePrefix"&&z[2].sliceSerialize(z[1],!0).length>=4)return Z(X);return $.interrupt(H.parser.constructs.flow,J,Z)(X)}}function kW($,Z,J,H,B,Q,X,z,G){let U=G||Number.POSITIVE_INFINITY,Y=0;return F;function F(A){if(A===60)return $.enter(H),$.enter(B),$.enter(Q),$.consume(A),$.exit(Q),K;if(A===null||A===32||A===41||UZ(A))return J(A);return $.enter(H),$.enter(X),$.enter(z),$.enter("chunkString",{contentType:"string"}),q(A)}function K(A){if(A===62)return $.enter(Q),$.consume(A),$.exit(Q),$.exit(B),$.exit(H),Z;return $.enter(z),$.enter("chunkString",{contentType:"string"}),W(A)}function W(A){if(A===62)return $.exit("chunkString"),$.exit(z),K(A);if(A===null||A===60||u0(A))return J(A);return $.consume(A),A===92?N:W}function N(A){if(A===60||A===62||A===92)return $.consume(A),W;return W(A)}function q(A){if(!Y&&(A===null||A===41||v1(A)))return $.exit("chunkString"),$.exit(z),$.exit(X),$.exit(H),Z(A);if(Y<U&&A===40)return $.consume(A),Y++,q;if(A===41)return $.consume(A),Y--,q;if(A===null||A===32||A===40||UZ(A))return J(A);return $.consume(A),A===92?D:q}function D(A){if(A===40||A===41||A===92)return $.consume(A),q;return q(A)}}function yW($,Z,J,H,B,Q){let X=this,z=0,G;return U;function U(W){return $.enter(H),$.enter(B),$.consume(W),$.exit(B),$.enter(Q),Y}function Y(W){if(z>999||W===null||W===91||W===93&&!G||W===94&&!z&&"_hiddenFootnoteSupport"in X.parser.constructs)return J(W);if(W===93)return $.exit(Q),$.enter(B),$.consume(W),$.exit(B),$.exit(H),Z;if(u0(W))return $.enter("lineEnding"),$.consume(W),$.exit("lineEnding"),Y;return $.enter("chunkString",{contentType:"string"}),F(W)}function F(W){if(W===null||W===91||W===93||u0(W)||z++>999)return $.exit("chunkString"),Y(W);if($.consume(W),!G)G=!X1(W);return W===92?K:F}function K(W){if(W===91||W===92||W===93)return $.consume(W),z++,F;return F(W)}}function xW($,Z,J,H,B,Q){let X;return z;function z(K){if(K===34||K===39||K===40)return $.enter(H),$.enter(B),$.consume(K),$.exit(B),X=K===40?41:K,G;return J(K)}function G(K){if(K===X)return $.enter(B),$.consume(K),$.exit(B),$.exit(H),Z;return $.enter(Q),U(K)}function U(K){if(K===X)return $.exit(Q),G(X);if(K===null)return J(K);if(u0(K))return $.enter("lineEnding"),$.consume(K),$.exit("lineEnding"),J1($,U,"linePrefix");return $.enter("chunkString",{contentType:"string"}),Y(K)}function Y(K){if(K===X||K===null||u0(K))return $.exit("chunkString"),U(K);return $.consume(K),K===92?F:Y}function F(K){if(K===X||K===92)return $.consume(K),Y;return Y(K)}}function FZ($,Z){let J;return H;function H(B){if(u0(B))return $.enter("lineEnding"),$.consume(B),$.exit("lineEnding"),J=!0,H;if(X1(B))return J1($,H,J?"linePrefix":"lineSuffix")(B);return Z(B)}}var GP={name:"definition",tokenize:pJ0},uJ0={partial:!0,tokenize:cJ0};function pJ0($,Z,J){let H=this,B;return Q;function Q(W){return $.enter("definition"),X(W)}function X(W){return yW.call(H,$,z,J,"definitionLabel","definitionLabelMarker","definitionLabelString")(W)}function z(W){if(B=j4(H.sliceSerialize(H.events[H.events.length-1][1]).slice(1,-1)),W===58)return $.enter("definitionMarker"),$.consume(W),$.exit("definitionMarker"),G;return J(W)}function G(W){return v1(W)?FZ($,U)(W):U(W)}function U(W){return kW($,Y,J,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(W)}function Y(W){return $.attempt(uJ0,F,F)(W)}function F(W){return X1(W)?J1($,K,"whitespace")(W):K(W)}function K(W){if(W===null||u0(W))return $.exit("definition"),H.parser.defined.push(B),Z(W);return J(W)}}function cJ0($,Z,J){return H;function H(z){return v1(z)?FZ($,B)(z):J(z)}function B(z){return xW($,Q,J,"definitionTitle","definitionTitleMarker","definitionTitleString")(z)}function Q(z){return X1(z)?J1($,X,"whitespace")(z):X(z)}function X(z){return z===null||u0(z)?Z(z):J(z)}}var UP={name:"hardBreakEscape",tokenize:dJ0};function dJ0($,Z,J){return H;function H(Q){return $.enter("hardBreakEscape"),$.consume(Q),B}function B(Q){if(u0(Q))return $.exit("hardBreakEscape"),Z(Q);return J(Q)}}var YP={name:"headingAtx",resolve:lJ0,tokenize:iJ0};function lJ0($,Z){let J=$.length-2,H=3,B,Q;if($[H][1].type==="whitespace")H+=2;if(J-2>H&&$[J][1].type==="whitespace")J-=2;if($[J][1].type==="atxHeadingSequence"&&(H===J-1||J-4>H&&$[J-2][1].type==="whitespace"))J-=H+1===J?2:4;if(J>H)B={type:"atxHeadingText",start:$[H][1].start,end:$[J][1].end},Q={type:"chunkText",start:$[H][1].start,end:$[J][1].end,contentType:"text"},z2($,H,J-H+1,[["enter",B,Z],["enter",Q,Z],["exit",Q,Z],["exit",B,Z]]);return $}function iJ0($,Z,J){let H=0;return B;function B(Y){return $.enter("atxHeading"),Q(Y)}function Q(Y){return $.enter("atxHeadingSequence"),X(Y)}function X(Y){if(Y===35&&H++<6)return $.consume(Y),X;if(Y===null||v1(Y))return $.exit("atxHeadingSequence"),z(Y);return J(Y)}function z(Y){if(Y===35)return $.enter("atxHeadingSequence"),G(Y);if(Y===null||u0(Y))return $.exit("atxHeading"),Z(Y);if(X1(Y))return J1($,z,"whitespace")(Y);return $.enter("atxHeadingText"),U(Y)}function G(Y){if(Y===35)return $.consume(Y),G;return $.exit("atxHeadingSequence"),z(Y)}function U(Y){if(Y===null||Y===35||v1(Y))return $.exit("atxHeadingText"),z(Y);return $.consume(Y),U}}var ou=["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"],FP=["pre","script","style","textarea"];var KP={concrete:!0,name:"htmlFlow",resolveTo:oJ0,tokenize:nJ0},rJ0={partial:!0,tokenize:tJ0},aJ0={partial:!0,tokenize:sJ0};function oJ0($){let Z=$.length;while(Z--)if($[Z][0]==="enter"&&$[Z][1].type==="htmlFlow")break;if(Z>1&&$[Z-2][1].type==="linePrefix")$[Z][1].start=$[Z-2][1].start,$[Z+1][1].start=$[Z-2][1].start,$.splice(Z-2,2);return $}function nJ0($,Z,J){let H=this,B,Q,X,z,G;return U;function U(h){return Y(h)}function Y(h){return $.enter("htmlFlow"),$.enter("htmlFlowData"),$.consume(h),F}function F(h){if(h===33)return $.consume(h),K;if(h===47)return $.consume(h),Q=!0,q;if(h===63)return $.consume(h),B=3,H.interrupt?Z:b;if(j2(h))return $.consume(h),X=String.fromCharCode(h),D;return J(h)}function K(h){if(h===45)return $.consume(h),B=2,W;if(h===91)return $.consume(h),B=5,z=0,N;if(j2(h))return $.consume(h),B=4,H.interrupt?Z:b;return J(h)}function W(h){if(h===45)return $.consume(h),H.interrupt?Z:b;return J(h)}function N(h){if(h==="CDATA[".charCodeAt(z++)){if($.consume(h),z===6)return H.interrupt?Z:S;return N}return J(h)}function q(h){if(j2(h))return $.consume(h),X=String.fromCharCode(h),D;return J(h)}function D(h){if(h===null||h===47||h===62||v1(h)){let d=h===47,o=X.toLowerCase();if(!d&&!Q&&FP.includes(o))return B=1,H.interrupt?Z(h):S(h);if(ou.includes(X.toLowerCase())){if(B=6,d)return $.consume(h),A;return H.interrupt?Z(h):S(h)}return B=7,H.interrupt&&!H.parser.lazy[H.now().line]?J(h):Q?V(h):L(h)}if(h===45||Z2(h))return $.consume(h),X+=String.fromCharCode(h),D;return J(h)}function A(h){if(h===62)return $.consume(h),H.interrupt?Z:S;return J(h)}function V(h){if(X1(h))return $.consume(h),V;return T(h)}function L(h){if(h===47)return $.consume(h),T;if(h===58||h===95||j2(h))return $.consume(h),O;if(X1(h))return $.consume(h),L;return T(h)}function O(h){if(h===45||h===46||h===58||h===95||Z2(h))return $.consume(h),O;return M(h)}function M(h){if(h===61)return $.consume(h),_;if(X1(h))return $.consume(h),M;return L(h)}function _(h){if(h===null||h===60||h===61||h===62||h===96)return J(h);if(h===34||h===39)return $.consume(h),G=h,w;if(X1(h))return $.consume(h),_;return C(h)}function w(h){if(h===G)return $.consume(h),G=null,E;if(h===null||u0(h))return J(h);return $.consume(h),w}function C(h){if(h===null||h===34||h===39||h===47||h===60||h===61||h===62||h===96||v1(h))return M(h);return $.consume(h),C}function E(h){if(h===47||h===62||X1(h))return L(h);return J(h)}function T(h){if(h===62)return $.consume(h),k;return J(h)}function k(h){if(h===null||u0(h))return S(h);if(X1(h))return $.consume(h),k;return J(h)}function S(h){if(h===45&&B===2)return $.consume(h),R;if(h===60&&B===1)return $.consume(h),x;if(h===62&&B===4)return $.consume(h),l;if(h===63&&B===3)return $.consume(h),b;if(h===93&&B===5)return $.consume(h),f;if(u0(h)&&(B===6||B===7))return $.exit("htmlFlowData"),$.check(rJ0,r,I)(h);if(h===null||u0(h))return $.exit("htmlFlowData"),I(h);return $.consume(h),S}function I(h){return $.check(aJ0,j,r)(h)}function j(h){return $.enter("lineEnding"),$.consume(h),$.exit("lineEnding"),y}function y(h){if(h===null||u0(h))return I(h);return $.enter("htmlFlowData"),S(h)}function R(h){if(h===45)return $.consume(h),b;return S(h)}function x(h){if(h===47)return $.consume(h),X="",v;return S(h)}function v(h){if(h===62){let d=X.toLowerCase();if(FP.includes(d))return $.consume(h),l;return S(h)}if(j2(h)&&X.length<8)return $.consume(h),X+=String.fromCharCode(h),v;return S(h)}function f(h){if(h===93)return $.consume(h),b;return S(h)}function b(h){if(h===62)return $.consume(h),l;if(h===45&&B===2)return $.consume(h),b;return S(h)}function l(h){if(h===null||u0(h))return $.exit("htmlFlowData"),r(h);return $.consume(h),l}function r(h){return $.exit("htmlFlow"),Z(h)}}function sJ0($,Z,J){let H=this;return B;function B(X){if(u0(X))return $.enter("lineEnding"),$.consume(X),$.exit("lineEnding"),Q;return J(X)}function Q(X){return H.parser.lazy[H.now().line]?J(X):Z(X)}}function tJ0($,Z,J){return H;function H(B){return $.enter("lineEnding"),$.consume(B),$.exit("lineEnding"),$.attempt(T3,Z,J)}}var WP={name:"htmlText",tokenize:eJ0};function eJ0($,Z,J){let H=this,B,Q,X;return z;function z(b){return $.enter("htmlText"),$.enter("htmlTextData"),$.consume(b),G}function G(b){if(b===33)return $.consume(b),U;if(b===47)return $.consume(b),M;if(b===63)return $.consume(b),L;if(j2(b))return $.consume(b),C;return J(b)}function U(b){if(b===45)return $.consume(b),Y;if(b===91)return $.consume(b),Q=0,N;if(j2(b))return $.consume(b),V;return J(b)}function Y(b){if(b===45)return $.consume(b),W;return J(b)}function F(b){if(b===null)return J(b);if(b===45)return $.consume(b),K;if(u0(b))return X=F,x(b);return $.consume(b),F}function K(b){if(b===45)return $.consume(b),W;return F(b)}function W(b){return b===62?R(b):b===45?K(b):F(b)}function N(b){if(b==="CDATA[".charCodeAt(Q++))return $.consume(b),Q===6?q:N;return J(b)}function q(b){if(b===null)return J(b);if(b===93)return $.consume(b),D;if(u0(b))return X=q,x(b);return $.consume(b),q}function D(b){if(b===93)return $.consume(b),A;return q(b)}function A(b){if(b===62)return R(b);if(b===93)return $.consume(b),A;return q(b)}function V(b){if(b===null||b===62)return R(b);if(u0(b))return X=V,x(b);return $.consume(b),V}function L(b){if(b===null)return J(b);if(b===63)return $.consume(b),O;if(u0(b))return X=L,x(b);return $.consume(b),L}function O(b){return b===62?R(b):L(b)}function M(b){if(j2(b))return $.consume(b),_;return J(b)}function _(b){if(b===45||Z2(b))return $.consume(b),_;return w(b)}function w(b){if(u0(b))return X=w,x(b);if(X1(b))return $.consume(b),w;return R(b)}function C(b){if(b===45||Z2(b))return $.consume(b),C;if(b===47||b===62||v1(b))return E(b);return J(b)}function E(b){if(b===47)return $.consume(b),R;if(b===58||b===95||j2(b))return $.consume(b),T;if(u0(b))return X=E,x(b);if(X1(b))return $.consume(b),E;return R(b)}function T(b){if(b===45||b===46||b===58||b===95||Z2(b))return $.consume(b),T;return k(b)}function k(b){if(b===61)return $.consume(b),S;if(u0(b))return X=k,x(b);if(X1(b))return $.consume(b),k;return E(b)}function S(b){if(b===null||b===60||b===61||b===62||b===96)return J(b);if(b===34||b===39)return $.consume(b),B=b,I;if(u0(b))return X=S,x(b);if(X1(b))return $.consume(b),S;return $.consume(b),j}function I(b){if(b===B)return $.consume(b),B=void 0,y;if(b===null)return J(b);if(u0(b))return X=I,x(b);return $.consume(b),I}function j(b){if(b===null||b===34||b===39||b===60||b===61||b===96)return J(b);if(b===47||b===62||v1(b))return E(b);return $.consume(b),j}function y(b){if(b===47||b===62||v1(b))return E(b);return J(b)}function R(b){if(b===62)return $.consume(b),$.exit("htmlTextData"),$.exit("htmlText"),Z;return J(b)}function x(b){return $.exit("htmlTextData"),$.enter("lineEnding"),$.consume(b),$.exit("lineEnding"),v}function v(b){return X1(b)?J1($,f,"linePrefix",H.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(b):f(b)}function f(b){return $.enter("htmlTextData"),X(b)}}var KZ={name:"labelEnd",resolveAll:HH0,resolveTo:BH0,tokenize:QH0},$H0={tokenize:XH0},ZH0={tokenize:zH0},JH0={tokenize:GH0};function HH0($){let Z=-1,J=[];while(++Z<$.length){let H=$[Z][1];if(J.push($[Z]),H.type==="labelImage"||H.type==="labelLink"||H.type==="labelEnd"){let B=H.type==="labelImage"?4:2;H.type="data",Z+=B}}if($.length!==J.length)z2($,0,$.length,J);return $}function BH0($,Z){let J=$.length,H=0,B,Q,X,z;while(J--)if(B=$[J][1],Q){if(B.type==="link"||B.type==="labelLink"&&B._inactive)break;if($[J][0]==="enter"&&B.type==="labelLink")B._inactive=!0}else if(X){if($[J][0]==="enter"&&(B.type==="labelImage"||B.type==="labelLink")&&!B._balanced){if(Q=J,B.type!=="labelLink"){H=2;break}}}else if(B.type==="labelEnd")X=J;let G={type:$[Q][1].type==="labelLink"?"link":"image",start:{...$[Q][1].start},end:{...$[$.length-1][1].end}},U={type:"label",start:{...$[Q][1].start},end:{...$[X][1].end}},Y={type:"labelText",start:{...$[Q+H+2][1].end},end:{...$[X-2][1].start}};return z=[["enter",G,Z],["enter",U,Z]],z=u4(z,$.slice(Q+1,Q+H+3)),z=u4(z,[["enter",Y,Z]]),z=u4(z,h7(Z.parser.constructs.insideSpan.null,$.slice(Q+H+4,X-3),Z)),z=u4(z,[["exit",Y,Z],$[X-2],$[X-1],["exit",U,Z]]),z=u4(z,$.slice(X+1)),z=u4(z,[["exit",G,Z]]),z2($,Q,$.length,z),$}function QH0($,Z,J){let H=this,B=H.events.length,Q,X;while(B--)if((H.events[B][1].type==="labelImage"||H.events[B][1].type==="labelLink")&&!H.events[B][1]._balanced){Q=H.events[B][1];break}return z;function z(K){if(!Q)return J(K);if(Q._inactive)return F(K);return X=H.parser.defined.includes(j4(H.sliceSerialize({start:Q.end,end:H.now()}))),$.enter("labelEnd"),$.enter("labelMarker"),$.consume(K),$.exit("labelMarker"),$.exit("labelEnd"),G}function G(K){if(K===40)return $.attempt($H0,Y,X?Y:F)(K);if(K===91)return $.attempt(ZH0,Y,X?U:F)(K);return X?Y(K):F(K)}function U(K){return $.attempt(JH0,Y,F)(K)}function Y(K){return Z(K)}function F(K){return Q._balanced=!0,J(K)}}function XH0($,Z,J){return H;function H(F){return $.enter("resource"),$.enter("resourceMarker"),$.consume(F),$.exit("resourceMarker"),B}function B(F){return v1(F)?FZ($,Q)(F):Q(F)}function Q(F){if(F===41)return Y(F);return kW($,X,z,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(F)}function X(F){return v1(F)?FZ($,G)(F):Y(F)}function z(F){return J(F)}function G(F){if(F===34||F===39||F===40)return xW($,U,J,"resourceTitle","resourceTitleMarker","resourceTitleString")(F);return Y(F)}function U(F){return v1(F)?FZ($,Y)(F):Y(F)}function Y(F){if(F===41)return $.enter("resourceMarker"),$.consume(F),$.exit("resourceMarker"),$.exit("resource"),Z;return J(F)}}function zH0($,Z,J){let H=this;return B;function B(z){return yW.call(H,$,Q,X,"reference","referenceMarker","referenceString")(z)}function Q(z){return H.parser.defined.includes(j4(H.sliceSerialize(H.events[H.events.length-1][1]).slice(1,-1)))?Z(z):J(z)}function X(z){return J(z)}}function GH0($,Z,J){return H;function H(Q){return $.enter("reference"),$.enter("referenceMarker"),$.consume(Q),$.exit("referenceMarker"),B}function B(Q){if(Q===93)return $.enter("referenceMarker"),$.consume(Q),$.exit("referenceMarker"),$.exit("reference"),Z;return J(Q)}}var NP={name:"labelStartImage",resolveAll:KZ.resolveAll,tokenize:UH0};function UH0($,Z,J){let H=this;return B;function B(z){return $.enter("labelImage"),$.enter("labelImageMarker"),$.consume(z),$.exit("labelImageMarker"),Q}function Q(z){if(z===91)return $.enter("labelMarker"),$.consume(z),$.exit("labelMarker"),$.exit("labelImage"),X;return J(z)}function X(z){return z===94&&"_hiddenFootnoteSupport"in H.parser.constructs?J(z):Z(z)}}var qP={name:"labelStartLink",resolveAll:KZ.resolveAll,tokenize:YH0};function YH0($,Z,J){let H=this;return B;function B(X){return $.enter("labelLink"),$.enter("labelMarker"),$.consume(X),$.exit("labelMarker"),$.exit("labelLink"),Q}function Q(X){return X===94&&"_hiddenFootnoteSupport"in H.parser.constructs?J(X):Z(X)}}var hX={name:"lineEnding",tokenize:FH0};function FH0($,Z){return J;function J(H){return $.enter("lineEnding"),$.consume(H),$.exit("lineEnding"),J1($,Z,"linePrefix")}}var WZ={name:"thematicBreak",tokenize:KH0};function KH0($,Z,J){let H=0,B;return Q;function Q(U){return $.enter("thematicBreak"),X(U)}function X(U){return B=U,z(U)}function z(U){if(U===B)return $.enter("thematicBreakSequence"),G(U);if(H>=3&&(U===null||u0(U)))return $.exit("thematicBreak"),Z(U);return J(U)}function G(U){if(U===B)return $.consume(U),H++,G;return $.exit("thematicBreakSequence"),X1(U)?J1($,z,"whitespace")(U):z(U)}}var C4={continuation:{tokenize:AH0},exit:VH0,name:"list",tokenize:qH0},WH0={partial:!0,tokenize:LH0},NH0={partial:!0,tokenize:DH0};function qH0($,Z,J){let H=this,B=H.events[H.events.length-1],Q=B&&B[1].type==="linePrefix"?B[2].sliceSerialize(B[1],!0).length:0,X=0;return z;function z(W){let N=H.containerState.type||(W===42||W===43||W===45?"listUnordered":"listOrdered");if(N==="listUnordered"?!H.containerState.marker||W===H.containerState.marker:IX(W)){if(!H.containerState.type)H.containerState.type=N,$.enter(N,{_container:!0});if(N==="listUnordered")return $.enter("listItemPrefix"),W===42||W===45?$.check(WZ,J,U)(W):U(W);if(!H.interrupt||W===49)return $.enter("listItemPrefix"),$.enter("listItemValue"),G(W)}return J(W)}function G(W){if(IX(W)&&++X<10)return $.consume(W),G;if((!H.interrupt||X<2)&&(H.containerState.marker?W===H.containerState.marker:W===41||W===46))return $.exit("listItemValue"),U(W);return J(W)}function U(W){return $.enter("listItemMarker"),$.consume(W),$.exit("listItemMarker"),H.containerState.marker=H.containerState.marker||W,$.check(T3,H.interrupt?J:Y,$.attempt(WH0,K,F))}function Y(W){return H.containerState.initialBlankLine=!0,Q++,K(W)}function F(W){if(X1(W))return $.enter("listItemPrefixWhitespace"),$.consume(W),$.exit("listItemPrefixWhitespace"),K;return J(W)}function K(W){return H.containerState.size=Q+H.sliceSerialize($.exit("listItemPrefix"),!0).length,Z(W)}}function AH0($,Z,J){let H=this;return H.containerState._closeFlow=void 0,$.check(T3,B,Q);function B(z){return H.containerState.furtherBlankLines=H.containerState.furtherBlankLines||H.containerState.initialBlankLine,J1($,Z,"listItemIndent",H.containerState.size+1)(z)}function Q(z){if(H.containerState.furtherBlankLines||!X1(z))return H.containerState.furtherBlankLines=void 0,H.containerState.initialBlankLine=void 0,X(z);return H.containerState.furtherBlankLines=void 0,H.containerState.initialBlankLine=void 0,$.attempt(NH0,Z,X)(z)}function X(z){return H.containerState._closeFlow=!0,H.interrupt=void 0,J1($,$.attempt(C4,Z,J),"linePrefix",H.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(z)}}function DH0($,Z,J){let H=this;return J1($,B,"listItemIndent",H.containerState.size+1);function B(Q){let X=H.events[H.events.length-1];return X&&X[1].type==="listItemIndent"&&X[2].sliceSerialize(X[1],!0).length===H.containerState.size?Z(Q):J(Q)}}function VH0($){$.exit(this.containerState.type)}function LH0($,Z,J){let H=this;return J1($,B,"listItemPrefixWhitespace",H.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function B(Q){let X=H.events[H.events.length-1];return!X1(Q)&&X&&X[1].type==="listItemPrefixWhitespace"?Z(Q):J(Q)}}var hW={name:"setextUnderline",resolveTo:MH0,tokenize:PH0};function MH0($,Z){let J=$.length,H,B,Q;while(J--)if($[J][0]==="enter"){if($[J][1].type==="content"){H=J;break}if($[J][1].type==="paragraph")B=J}else{if($[J][1].type==="content")$.splice(J,1);if(!Q&&$[J][1].type==="definition")Q=J}let X={type:"setextHeading",start:{...$[H][1].start},end:{...$[$.length-1][1].end}};if($[B][1].type="setextHeadingText",Q)$.splice(B,0,["enter",X,Z]),$.splice(Q+1,0,["exit",$[H][1],Z]),$[H][1].end={...$[Q][1].end};else $[H][1]=X;return $.push(["exit",X,Z]),$}function PH0($,Z,J){let H=this,B;return Q;function Q(U){let Y=H.events.length,F;while(Y--)if(H.events[Y][1].type!=="lineEnding"&&H.events[Y][1].type!=="linePrefix"&&H.events[Y][1].type!=="content"){F=H.events[Y][1].type==="paragraph";break}if(!H.parser.lazy[H.now().line]&&(H.interrupt||F))return $.enter("setextHeadingLine"),B=U,X(U);return J(U)}function X(U){return $.enter("setextHeadingLineSequence"),z(U)}function z(U){if(U===B)return $.consume(U),z;return $.exit("setextHeadingLineSequence"),X1(U)?J1($,G,"lineSuffix")(U):G(U)}function G(U){if(U===null||u0(U))return $.exit("setextHeadingLine"),Z(U);return J(U)}}var nu={tokenize:_H0};function _H0($){let Z=this,J=$.attempt(T3,H,$.attempt(this.parser.constructs.flowInitial,B,J1($,$.attempt(this.parser.constructs.flow,B,$.attempt(zP,B)),"linePrefix")));return J;function H(Q){if(Q===null){$.consume(Q);return}return $.enter("lineEndingBlank"),$.consume(Q),$.exit("lineEndingBlank"),Z.currentConstruct=void 0,J}function B(Q){if(Q===null){$.consume(Q);return}return $.enter("lineEnding"),$.consume(Q),$.exit("lineEnding"),Z.currentConstruct=void 0,J}}var su={resolveAll:Zp()},tu=$p("string"),eu=$p("text");function $p($){return{resolveAll:Zp($==="text"?OH0:void 0),tokenize:Z};function Z(J){let H=this,B=this.parser.constructs[$],Q=J.attempt(B,X,z);return X;function X(Y){return U(Y)?Q(Y):z(Y)}function z(Y){if(Y===null){J.consume(Y);return}return J.enter("data"),J.consume(Y),G}function G(Y){if(U(Y))return J.exit("data"),Q(Y);return J.consume(Y),G}function U(Y){if(Y===null)return!0;let F=B[Y],K=-1;if(F)while(++K<F.length){let W=F[K];if(!W.previous||W.previous.call(H,H.previous))return!0}return!1}}}function Zp($){return Z;function Z(J,H){let B=-1,Q;while(++B<=J.length)if(Q===void 0){if(J[B]&&J[B][1].type==="data")Q=B,B++}else if(!J[B]||J[B][1].type!=="data"){if(B!==Q+2)J[Q][1].end=J[B-1][1].end,J.splice(Q+2,B-Q-2),B=Q+2;Q=void 0}return $?$(J,H):J}}function OH0($,Z){let J=0;while(++J<=$.length)if((J===$.length||$[J][1].type==="lineEnding")&&$[J-1][1].type==="data"){let H=$[J-1][1],B=Z.sliceStream(H),Q=B.length,X=-1,z=0,G;while(Q--){let U=B[Q];if(typeof U==="string"){X=U.length;while(U.charCodeAt(X-1)===32)z++,X--;if(X)break;X=-1}else if(U===-2)G=!0,z++;else if(U===-1);else{Q++;break}}if(Z._contentTypeTextTrailing&&J===$.length)z=0;if(z){let U={type:J===$.length||G||z<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:Q?X:H.start._bufferIndex+X,_index:H.start._index+Q,line:H.end.line,column:H.end.column-z,offset:H.end.offset-z},end:{...H.end}};if(H.end={...U.start},H.start.offset===H.end.offset)Object.assign(H,U);else $.splice(J,0,["enter",U,Z],["exit",U,Z]),J+=2}J++}return $}var AP={};k5(AP,{text:()=>wH0,string:()=>bH0,insideSpan:()=>SH0,flowInitial:()=>CH0,flow:()=>EH0,document:()=>TH0,disable:()=>IH0,contentInitial:()=>jH0,attentionMarkers:()=>RH0});var TH0={[42]:C4,[43]:C4,[45]:C4,[48]:C4,[49]:C4,[50]:C4,[51]:C4,[52]:C4,[53]:C4,[54]:C4,[55]:C4,[56]:C4,[57]:C4,[62]:bW},jH0={[91]:GP},CH0={[-2]:yX,[-1]:yX,[32]:yX},EH0={[35]:YP,[42]:WZ,[45]:[hW,WZ],[60]:KP,[61]:hW,[95]:WZ,[96]:RW,[126]:RW},bH0={[38]:SW,[92]:wW},wH0={[-5]:hX,[-4]:hX,[-3]:hX,[33]:NP,[38]:SW,[42]:kX,[60]:[BP,WP],[91]:qP,[92]:[UP,wW],[93]:KZ,[95]:kX,[96]:QP},SH0={null:[kX,su]},RH0={null:[42,95]},IH0={null:[]};function Jp($,Z,J){let H={_bufferIndex:-1,_index:0,line:J&&J.line||1,column:J&&J.column||1,offset:J&&J.offset||0},B={},Q=[],X=[],z=[],G=!0,U={attempt:E(w),check:E(C),consume:O,enter:M,exit:_,interrupt:E(C,{interrupt:!0})},Y={code:null,containerState:{},defineSkip:A,events:[],now:D,parser:$,previous:null,sliceSerialize:N,sliceStream:q,write:W},F=Z.tokenize.call(Y,U),K;if(Z.resolveAll)Q.push(Z);return Y;function W(I){if(X=u4(X,I),V(),X[X.length-1]!==null)return[];return T(Z,0),Y.events=h7(Q,Y.events,Y),Y.events}function N(I,j){return yH0(q(I),j)}function q(I){return kH0(X,I)}function D(){let{_bufferIndex:I,_index:j,line:y,column:R,offset:x}=H;return{_bufferIndex:I,_index:j,line:y,column:R,offset:x}}function A(I){B[I.line]=I.column,S()}function V(){let I;while(H._index<X.length){let j=X[H._index];if(typeof j==="string"){if(I=H._index,H._bufferIndex<0)H._bufferIndex=0;while(H._index===I&&H._bufferIndex<j.length)L(j.charCodeAt(H._bufferIndex))}else L(j)}}function L(I){G=void 0,K=I,F=F(I)}function O(I){if(u0(I))H.line++,H.column=1,H.offset+=I===-3?2:1,S();else if(I!==-1)H.column++,H.offset++;if(H._bufferIndex<0)H._index++;else if(H._bufferIndex++,H._bufferIndex===X[H._index].length)H._bufferIndex=-1,H._index++;Y.previous=I,G=!0}function M(I,j){let y=j||{};return y.type=I,y.start=D(),Y.events.push(["enter",y,Y]),z.push(y),y}function _(I){let j=z.pop();return j.end=D(),Y.events.push(["exit",j,Y]),j}function w(I,j){T(I,j.from)}function C(I,j){j.restore()}function E(I,j){return y;function y(R,x,v){let f,b,l,r;return Array.isArray(R)?d(R):("tokenize"in R)?d([R]):h(R);function h(n){return Z0;function Z0(J0){let U0=J0!==null&&n[J0],z0=J0!==null&&n.null,X0=[...Array.isArray(U0)?U0:U0?[U0]:[],...Array.isArray(z0)?z0:z0?[z0]:[]];return d(X0)(J0)}}function d(n){if(f=n,b=0,n.length===0)return v;return o(n[b])}function o(n){return Z0;function Z0(J0){if(r=k(),l=n,!n.partial)Y.currentConstruct=n;if(n.name&&Y.parser.constructs.disable.null.includes(n.name))return i(J0);return n.tokenize.call(j?Object.assign(Object.create(Y),j):Y,U,c,i)(J0)}}function c(n){return G=!0,I(l,r),x}function i(n){if(G=!0,r.restore(),++b<f.length)return o(f[b]);return v}}}function T(I,j){if(I.resolveAll&&!Q.includes(I))Q.push(I);if(I.resolve)z2(Y.events,j,Y.events.length-j,I.resolve(Y.events.slice(j),Y));if(I.resolveTo)Y.events=I.resolveTo(Y.events,Y)}function k(){let I=D(),j=Y.previous,y=Y.currentConstruct,R=Y.events.length,x=Array.from(z);return{from:R,restore:v};function v(){H=I,Y.previous=j,Y.currentConstruct=y,Y.events.length=R,z=x,S()}}function S(){if(H.line in B&&H.column<2)H.column=B[H.line],H.offset+=B[H.line]-1}}function kH0($,Z){let J=Z.start._index,H=Z.start._bufferIndex,B=Z.end._index,Q=Z.end._bufferIndex,X;if(J===B)X=[$[J].slice(H,Q)];else{if(X=$.slice(J,B),H>-1){let z=X[0];if(typeof z==="string")X[0]=z.slice(H);else X.shift()}if(Q>0)X.push($[B].slice(0,Q))}return X}function yH0($,Z){let J=-1,H=[],B;while(++J<$.length){let Q=$[J],X;if(typeof Q==="string")X=Q;else switch(Q){case-5:{X="\r";break}case-4:{X=`
|
|
19
|
+
`;break}case-3:{X=`\r
|
|
20
|
+
`;break}case-2:{X=Z?" ":"\t";break}case-1:{if(!Z&&B)continue;X=" ";break}default:X=String.fromCharCode(Q)}B=Q===-2,H.push(X)}return H.join("")}function DP($){let H={constructs:CW([AP,...($||{}).extensions||[]]),content:B(du),defined:[],document:B(iu),flow:B(nu),lazy:{},string:B(tu),text:B(eu)};return H;function B(Q){return X;function X(z){return Jp(H,Q,z)}}}function VP($){while(!IW($));return $}var Hp=/[\0\t\n\r]/g;function LP(){let $=1,Z="",J=!0,H;return B;function B(Q,X,z){let G=[],U,Y,F,K,W;if(Q=Z+(typeof Q==="string"?Q.toString():new TextDecoder(X||void 0).decode(Q)),F=0,Z="",J){if(Q.charCodeAt(0)===65279)F++;J=void 0}while(F<Q.length){if(Hp.lastIndex=F,U=Hp.exec(Q),K=U&&U.index!==void 0?U.index:Q.length,W=Q.charCodeAt(K),!U){Z=Q.slice(F);break}if(W===10&&F===K&&H)G.push(-3),H=void 0;else{if(H)G.push(-5),H=void 0;if(F<K)G.push(Q.slice(F,K)),$+=K-F;switch(W){case 0:{G.push(65533),$++;break}case 9:{Y=Math.ceil($/4)*4,G.push(-2);while($++<Y)G.push(-1);break}case 10:{G.push(-4),$=1;break}default:H=!0,$=1}}F=K+1}if(z){if(H)G.push(-5);if(Z)G.push(Z);G.push(null)}return G}}var xH0=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Bp($){return $.replace(xH0,hH0)}function hH0($,Z,J){if(Z)return Z;if(J.charCodeAt(0)===35){let B=J.charCodeAt(1),Q=B===120||B===88;return EW(J.slice(Q?2:1),Q?16:10)}return IH(J)||$}var Xp={}.hasOwnProperty;function MP($,Z,J){if(Z&&typeof Z==="object")J=Z,Z=void 0;return vH0(J)(VP(DP(J).document().write(LP()($,Z,!0))))}function vH0($){let Z={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:Q($0),autolinkProtocol:E,autolinkEmail:E,atxHeading:Q(q0),blockQuote:Q(J0),characterEscape:E,characterReference:E,codeFenced:Q(U0),codeFencedFenceInfo:X,codeFencedFenceMeta:X,codeIndented:Q(U0,X),codeText:Q(z0,X),codeTextData:E,data:E,codeFlowValue:E,definition:Q(X0),definitionDestinationString:X,definitionLabelString:X,definitionTitleString:X,emphasis:Q(N0),hardBreakEscape:Q(K0),hardBreakTrailing:Q(K0),htmlFlow:Q(s,X),htmlFlowData:E,htmlText:Q(s,X),htmlTextData:E,image:Q(a),label:X,link:Q($0),listItem:Q(B0),listItemValue:K,listOrdered:Q(t,F),listUnordered:Q(t),paragraph:Q(_0),reference:h,referenceString:X,resourceDestinationString:X,resourceTitleString:X,setextHeading:Q(q0),strong:Q(P0),thematicBreak:Q(M0)},exit:{atxHeading:G(),atxHeadingSequence:M,autolink:G(),autolinkEmail:Z0,autolinkProtocol:n,blockQuote:G(),characterEscapeValue:T,characterReferenceMarkerHexadecimal:o,characterReferenceMarkerNumeric:o,characterReferenceValue:c,characterReference:i,codeFenced:G(D),codeFencedFence:q,codeFencedFenceInfo:W,codeFencedFenceMeta:N,codeFlowValue:T,codeIndented:G(A),codeText:G(y),codeTextData:T,data:T,definition:G(),definitionDestinationString:O,definitionLabelString:V,definitionTitleString:L,emphasis:G(),hardBreakEscape:G(S),hardBreakTrailing:G(S),htmlFlow:G(I),htmlFlowData:T,htmlText:G(j),htmlTextData:T,image:G(x),label:f,labelText:v,lineEnding:k,link:G(R),listItem:G(),listOrdered:G(),listUnordered:G(),paragraph:G(),referenceString:d,resourceDestinationString:b,resourceTitleString:l,resource:r,setextHeading:G(C),setextHeadingLineSequence:w,setextHeadingText:_,strong:G(),thematicBreak:G()}};zp(Z,($||{}).mdastExtensions||[]);let J={};return H;function H(g){let p={type:"root",children:[]},e={stack:[p],tokenStack:[],config:Z,enter:z,exit:U,buffer:X,resume:Y,data:J},W0=[],S0=-1;while(++S0<g.length)if(g[S0][1].type==="listOrdered"||g[S0][1].type==="listUnordered")if(g[S0][0]==="enter")W0.push(S0);else{let h0=W0.pop();S0=B(g,h0,S0)}S0=-1;while(++S0<g.length){let h0=Z[g[S0][0]];if(Xp.call(h0,g[S0][1].type))h0[g[S0][1].type].call(Object.assign({sliceSerialize:g[S0][2].sliceSerialize},e),g[S0][1])}if(e.tokenStack.length>0){let h0=e.tokenStack[e.tokenStack.length-1];(h0[1]||Qp).call(e,void 0,h0[0])}p.position={start:v7(g.length>0?g[0][1].start:{line:1,column:1,offset:0}),end:v7(g.length>0?g[g.length-2][1].end:{line:1,column:1,offset:0})},S0=-1;while(++S0<Z.transforms.length)p=Z.transforms[S0](p)||p;return p}function B(g,p,e){let W0=p-1,S0=-1,h0=!1,v0,j0,c0,z1;while(++W0<=e){let A1=g[W0];switch(A1[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{if(A1[0]==="enter")S0++;else S0--;z1=void 0;break}case"lineEndingBlank":{if(A1[0]==="enter"){if(v0&&!z1&&!S0&&!c0)c0=W0;z1=void 0}break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:z1=void 0}if(!S0&&A1[0]==="enter"&&A1[1].type==="listItemPrefix"||S0===-1&&A1[0]==="exit"&&(A1[1].type==="listUnordered"||A1[1].type==="listOrdered")){if(v0){let l0=W0;j0=void 0;while(l0--){let k0=g[l0];if(k0[1].type==="lineEnding"||k0[1].type==="lineEndingBlank"){if(k0[0]==="exit")continue;if(j0)g[j0][1].type="lineEndingBlank",h0=!0;k0[1].type="lineEnding",j0=l0}else if(k0[1].type==="linePrefix"||k0[1].type==="blockQuotePrefix"||k0[1].type==="blockQuotePrefixWhitespace"||k0[1].type==="blockQuoteMarker"||k0[1].type==="listItemIndent");else break}if(c0&&(!j0||c0<j0))v0._spread=!0;v0.end=Object.assign({},j0?g[j0][1].start:A1[1].end),g.splice(j0||W0,0,["exit",v0,A1[2]]),W0++,e++}if(A1[1].type==="listItemPrefix"){let l0={type:"listItem",_spread:!1,start:Object.assign({},A1[1].start),end:void 0};v0=l0,g.splice(W0,0,["enter",l0,A1[2]]),W0++,e++,c0=void 0,z1=!0}}}return g[p][1]._spread=h0,e}function Q(g,p){return e;function e(W0){if(z.call(this,g(W0),W0),p)p.call(this,W0)}}function X(){this.stack.push({type:"fragment",children:[]})}function z(g,p,e){this.stack[this.stack.length-1].children.push(g),this.stack.push(g),this.tokenStack.push([p,e||void 0]),g.position={start:v7(p.start),end:void 0}}function G(g){return p;function p(e){if(g)g.call(this,e);U.call(this,e)}}function U(g,p){let e=this.stack.pop(),W0=this.tokenStack.pop();if(!W0)throw Error("Cannot close `"+g.type+"` ("+y7({start:g.start,end:g.end})+"): it’s not open");else if(W0[0].type!==g.type)if(p)p.call(this,g,W0[0]);else(W0[1]||Qp).call(this,g,W0[0]);e.position.end=v7(g.end)}function Y(){return GZ(this.stack.pop())}function F(){this.data.expectingFirstListItemValue=!0}function K(g){if(this.data.expectingFirstListItemValue){let p=this.stack[this.stack.length-2];p.start=Number.parseInt(this.sliceSerialize(g),10),this.data.expectingFirstListItemValue=void 0}}function W(){let g=this.resume(),p=this.stack[this.stack.length-1];p.lang=g}function N(){let g=this.resume(),p=this.stack[this.stack.length-1];p.meta=g}function q(){if(this.data.flowCodeInside)return;this.buffer(),this.data.flowCodeInside=!0}function D(){let g=this.resume(),p=this.stack[this.stack.length-1];p.value=g.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function A(){let g=this.resume(),p=this.stack[this.stack.length-1];p.value=g.replace(/(\r?\n|\r)$/g,"")}function V(g){let p=this.resume(),e=this.stack[this.stack.length-1];e.label=p,e.identifier=j4(this.sliceSerialize(g)).toLowerCase()}function L(){let g=this.resume(),p=this.stack[this.stack.length-1];p.title=g}function O(){let g=this.resume(),p=this.stack[this.stack.length-1];p.url=g}function M(g){let p=this.stack[this.stack.length-1];if(!p.depth){let e=this.sliceSerialize(g).length;p.depth=e}}function _(){this.data.setextHeadingSlurpLineEnding=!0}function w(g){let p=this.stack[this.stack.length-1];p.depth=this.sliceSerialize(g).codePointAt(0)===61?1:2}function C(){this.data.setextHeadingSlurpLineEnding=void 0}function E(g){let e=this.stack[this.stack.length-1].children,W0=e[e.length-1];if(!W0||W0.type!=="text")W0=A0(),W0.position={start:v7(g.start),end:void 0},e.push(W0);this.stack.push(W0)}function T(g){let p=this.stack.pop();p.value+=this.sliceSerialize(g),p.position.end=v7(g.end)}function k(g){let p=this.stack[this.stack.length-1];if(this.data.atHardBreak){let e=p.children[p.children.length-1];e.position.end=v7(g.end),this.data.atHardBreak=void 0;return}if(!this.data.setextHeadingSlurpLineEnding&&Z.canContainEols.includes(p.type))E.call(this,g),T.call(this,g)}function S(){this.data.atHardBreak=!0}function I(){let g=this.resume(),p=this.stack[this.stack.length-1];p.value=g}function j(){let g=this.resume(),p=this.stack[this.stack.length-1];p.value=g}function y(){let g=this.resume(),p=this.stack[this.stack.length-1];p.value=g}function R(){let g=this.stack[this.stack.length-1];if(this.data.inReference){let p=this.data.referenceType||"shortcut";g.type+="Reference",g.referenceType=p,delete g.url,delete g.title}else delete g.identifier,delete g.label;this.data.referenceType=void 0}function x(){let g=this.stack[this.stack.length-1];if(this.data.inReference){let p=this.data.referenceType||"shortcut";g.type+="Reference",g.referenceType=p,delete g.url,delete g.title}else delete g.identifier,delete g.label;this.data.referenceType=void 0}function v(g){let p=this.sliceSerialize(g),e=this.stack[this.stack.length-2];e.label=Bp(p),e.identifier=j4(p).toLowerCase()}function f(){let g=this.stack[this.stack.length-1],p=this.resume(),e=this.stack[this.stack.length-1];if(this.data.inReference=!0,e.type==="link"){let W0=g.children;e.children=W0}else e.alt=p}function b(){let g=this.resume(),p=this.stack[this.stack.length-1];p.url=g}function l(){let g=this.resume(),p=this.stack[this.stack.length-1];p.title=g}function r(){this.data.inReference=void 0}function h(){this.data.referenceType="collapsed"}function d(g){let p=this.resume(),e=this.stack[this.stack.length-1];e.label=p,e.identifier=j4(this.sliceSerialize(g)).toLowerCase(),this.data.referenceType="full"}function o(g){this.data.characterReferenceType=g.type}function c(g){let p=this.sliceSerialize(g),e=this.data.characterReferenceType,W0;if(e)W0=EW(p,e==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0;else W0=IH(p);let S0=this.stack[this.stack.length-1];S0.value+=W0}function i(g){let p=this.stack.pop();p.position.end=v7(g.end)}function n(g){T.call(this,g);let p=this.stack[this.stack.length-1];p.url=this.sliceSerialize(g)}function Z0(g){T.call(this,g);let p=this.stack[this.stack.length-1];p.url="mailto:"+this.sliceSerialize(g)}function J0(){return{type:"blockquote",children:[]}}function U0(){return{type:"code",lang:null,meta:null,value:""}}function z0(){return{type:"inlineCode",value:""}}function X0(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function N0(){return{type:"emphasis",children:[]}}function q0(){return{type:"heading",depth:0,children:[]}}function K0(){return{type:"break"}}function s(){return{type:"html",value:""}}function a(){return{type:"image",title:null,url:"",alt:null}}function $0(){return{type:"link",title:null,url:"",children:[]}}function t(g){return{type:"list",ordered:g.type==="listOrdered",start:null,spread:g._spread,children:[]}}function B0(g){return{type:"listItem",spread:g._spread,checked:null,children:[]}}function _0(){return{type:"paragraph",children:[]}}function P0(){return{type:"strong",children:[]}}function A0(){return{type:"text",value:""}}function M0(){return{type:"thematicBreak"}}}function v7($){return{line:$.line,column:$.column,offset:$.offset}}function zp($,Z){let J=-1;while(++J<Z.length){let H=Z[J];if(Array.isArray(H))zp($,H);else fH0($,H)}}function fH0($,Z){let J;for(J in Z)if(Xp.call(Z,J))switch(J){case"canContainEols":{let H=Z[J];if(H)$[J].push(...H);break}case"transforms":{let H=Z[J];if(H)$[J].push(...H);break}case"enter":case"exit":{let H=Z[J];if(H)Object.assign($[J],H);break}}}function Qp($,Z){if($)throw Error("Cannot close `"+$.type+"` ("+y7({start:$.start,end:$.end})+"): a different token (`"+Z.type+"`, "+y7({start:Z.start,end:Z.end})+") is open");else throw Error("Cannot close document, a token (`"+Z.type+"`, "+y7({start:Z.start,end:Z.end})+") is still open")}function vW($){let Z=this;Z.parser=J;function J(H){return MP(H,{...Z.data("settings"),...$,extensions:Z.data("micromarkExtensions")||[],mdastExtensions:Z.data("fromMarkdownExtensions")||[]})}}var fW=-1,kH=0,NZ=1,yH=2,vX=3,fX=4,gX=5,mX=6,gW=7,mW=8;var Gp=typeof self==="object"?self:globalThis,gH0=($,Z)=>{let J=(B,Q)=>{return $.set(Q,B),B},H=(B)=>{if($.has(B))return $.get(B);let[Q,X]=Z[B];switch(Q){case kH:case fW:return J(X,B);case NZ:{let z=J([],B);for(let G of X)z.push(H(G));return z}case yH:{let z=J({},B);for(let[G,U]of X)z[H(G)]=H(U);return z}case vX:return J(new Date(X),B);case fX:{let{source:z,flags:G}=X;return J(new RegExp(z,G),B)}case gX:{let z=J(new Map,B);for(let[G,U]of X)z.set(H(G),H(U));return z}case mX:{let z=J(new Set,B);for(let G of X)z.add(H(G));return z}case gW:{let{name:z,message:G}=X;return J(new Gp[z](G),B)}case mW:return J(BigInt(X),B);case"BigInt":return J(Object(BigInt(X)),B);case"ArrayBuffer":return J(new Uint8Array(X).buffer,X);case"DataView":{let{buffer:z}=new Uint8Array(X);return J(new DataView(z),X)}}return J(new Gp[Q](X),B)};return H},PP=($)=>gH0(new Map,$)(0);var xH="",{toString:mH0}={},{keys:uH0}=Object,uX=($)=>{let Z=typeof $;if(Z!=="object"||!$)return[kH,Z];let J=mH0.call($).slice(8,-1);switch(J){case"Array":return[NZ,xH];case"Object":return[yH,xH];case"Date":return[vX,xH];case"RegExp":return[fX,xH];case"Map":return[gX,xH];case"Set":return[mX,xH];case"DataView":return[NZ,J]}if(J.includes("Array"))return[NZ,J];if(J.includes("Error"))return[gW,J];return[yH,J]},uW=([$,Z])=>$===kH&&(Z==="function"||Z==="symbol"),pH0=($,Z,J,H)=>{let B=(X,z)=>{let G=H.push(X)-1;return J.set(z,G),G},Q=(X)=>{if(J.has(X))return J.get(X);let[z,G]=uX(X);switch(z){case kH:{let Y=X;switch(G){case"bigint":z=mW,Y=X.toString();break;case"function":case"symbol":if($)throw TypeError("unable to serialize "+G);Y=null;break;case"undefined":return B([fW],X)}return B([z,Y],X)}case NZ:{if(G){let K=X;if(G==="DataView")K=new Uint8Array(X.buffer);else if(G==="ArrayBuffer")K=new Uint8Array(X);return B([G,[...K]],X)}let Y=[],F=B([z,Y],X);for(let K of X)Y.push(Q(K));return F}case yH:{if(G)switch(G){case"BigInt":return B([G,X.toString()],X);case"Boolean":case"Number":case"String":return B([G,X.valueOf()],X)}if(Z&&"toJSON"in X)return Q(X.toJSON());let Y=[],F=B([z,Y],X);for(let K of uH0(X))if($||!uW(uX(X[K])))Y.push([Q(K),Q(X[K])]);return F}case vX:return B([z,X.toISOString()],X);case fX:{let{source:Y,flags:F}=X;return B([z,{source:Y,flags:F}],X)}case gX:{let Y=[],F=B([z,Y],X);for(let[K,W]of X)if($||!(uW(uX(K))||uW(uX(W))))Y.push([Q(K),Q(W)]);return F}case mX:{let Y=[],F=B([z,Y],X);for(let K of X)if($||!uW(uX(K)))Y.push(Q(K));return F}}let{message:U}=X;return B([z,{name:G,message:U}],X)};return Q},_P=($,{json:Z,lossy:J}={})=>{let H=[];return pH0(!(Z||J),!!Z,new Map,H)($),H};var hH=typeof structuredClone==="function"?($,Z)=>Z&&(("json"in Z)||("lossy"in Z))?PP(_P($,Z)):structuredClone($):($,Z)=>PP(_P($,Z));function cH0($,Z){let J=[{type:"text",value:"↩"}];if(Z>1)J.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(Z)}]});return J}function dH0($,Z){return"Back to reference "+($+1)+(Z>1?"-"+Z:"")}function Up($){let Z=typeof $.options.clobberPrefix==="string"?$.options.clobberPrefix:"user-content-",J=$.options.footnoteBackContent||cH0,H=$.options.footnoteBackLabel||dH0,B=$.options.footnoteLabel||"Footnotes",Q=$.options.footnoteLabelTagName||"h2",X=$.options.footnoteLabelProperties||{className:["sr-only"]},z=[],G=-1;while(++G<$.footnoteOrder.length){let U=$.footnoteById.get($.footnoteOrder[G]);if(!U)continue;let Y=$.all(U),F=String(U.identifier).toUpperCase(),K=B9(F.toLowerCase()),W=0,N=[],q=$.footnoteCounts.get(F);while(q!==void 0&&++W<=q){if(N.length>0)N.push({type:"text",value:" "});let V=typeof J==="string"?J:J(G,W);if(typeof V==="string")V={type:"text",value:V};N.push({type:"element",tagName:"a",properties:{href:"#"+Z+"fnref-"+K+(W>1?"-"+W:""),dataFootnoteBackref:"",ariaLabel:typeof H==="string"?H:H(G,W),className:["data-footnote-backref"]},children:Array.isArray(V)?V:[V]})}let D=Y[Y.length-1];if(D&&D.type==="element"&&D.tagName==="p"){let V=D.children[D.children.length-1];if(V&&V.type==="text")V.value+=" ";else D.children.push({type:"text",value:" "});D.children.push(...N)}else Y.push(...N);let A={type:"element",tagName:"li",properties:{id:Z+"fn-"+K},children:$.wrap(Y,!0)};$.patch(U,A),z.push(A)}if(z.length===0)return;return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:Q,properties:{...hH(X),id:"footnote-label"},children:[{type:"text",value:B}]},{type:"text",value:`
|
|
21
|
+
`},{type:"element",tagName:"ol",properties:{},children:$.wrap(z,!0)},{type:"text",value:`
|
|
22
|
+
`}]}}var j3=function($){if($===null||$===void 0)return aH0;if(typeof $==="function")return pW($);if(typeof $==="object")return Array.isArray($)?lH0($):iH0($);if(typeof $==="string")return rH0($);throw Error("Expected function, string, or object as test")};function lH0($){let Z=[],J=-1;while(++J<$.length)Z[J]=j3($[J]);return pW(H);function H(...B){let Q=-1;while(++Q<Z.length)if(Z[Q].apply(this,B))return!0;return!1}}function iH0($){let Z=$;return pW(J);function J(H){let B=H,Q;for(Q in $)if(B[Q]!==Z[Q])return!1;return!0}}function rH0($){return pW(Z);function Z(J){return J&&J.type===$}}function pW($){return Z;function Z(J,H,B){return Boolean(oH0(J)&&$.call(this,J,typeof H==="number"?H:void 0,B||void 0))}}function aH0(){return!0}function oH0($){return $!==null&&typeof $==="object"&&"type"in $}function Yp($){return $}var Fp=[],cW=!0,qZ=!1,dW="skip";function pX($,Z,J,H){let B;if(typeof Z==="function"&&typeof J!=="function")H=J,J=Z;else B=Z;let Q=j3(B),X=H?-1:1;z($,void 0,[])();function z(G,U,Y){let F=G&&typeof G==="object"?G:{};if(typeof F.type==="string"){let W=typeof F.tagName==="string"?F.tagName:typeof F.name==="string"?F.name:void 0;Object.defineProperty(K,"name",{value:"node ("+Yp(G.type+(W?"<"+W+">":""))+")"})}return K;function K(){let W=Fp,N,q,D;if(!Z||Q(G,U,Y[Y.length-1]||void 0)){if(W=nH0(J(G,Y)),W[0]===qZ)return W}if("children"in G&&G.children){let A=G;if(A.children&&W[0]!==dW){q=(H?A.children.length:-1)+X,D=Y.concat(A);while(q>-1&&q<A.children.length){let V=A.children[q];if(N=z(V,q,D)(),N[0]===qZ)return N;q=typeof N[1]==="number"?N[1]:q+X}}}return W}}}function nH0($){if(Array.isArray($))return $;if(typeof $==="number")return[cW,$];return $===null||$===void 0?Fp:[$]}function X6($,Z,J,H){let B,Q,X;if(typeof Z==="function"&&typeof J!=="function")Q=void 0,X=Z,B=J;else Q=Z,X=J,B=H;pX($,Q,z,B);function z(G,U){let Y=U[U.length-1],F=Y?Y.children.indexOf(G):void 0;return X(G,F,Y)}}function Kp($,Z){let J={type:"element",tagName:"blockquote",properties:{},children:$.wrap($.all(Z),!0)};return $.patch(Z,J),$.applyData(Z,J)}function Wp($,Z){let J={type:"element",tagName:"br",properties:{},children:[]};return $.patch(Z,J),[$.applyData(Z,J),{type:"text",value:`
|
|
23
|
+
`}]}function Np($,Z){let J=Z.value?Z.value+`
|
|
24
|
+
`:"",H={},B=Z.lang?Z.lang.split(/\s+/):[];if(B.length>0)H.className=["language-"+B[0]];let Q={type:"element",tagName:"code",properties:H,children:[{type:"text",value:J}]};if(Z.meta)Q.data={meta:Z.meta};return $.patch(Z,Q),Q=$.applyData(Z,Q),Q={type:"element",tagName:"pre",properties:{},children:[Q]},$.patch(Z,Q),Q}function qp($,Z){let J={type:"element",tagName:"del",properties:{},children:$.all(Z)};return $.patch(Z,J),$.applyData(Z,J)}function Ap($,Z){let J={type:"element",tagName:"em",properties:{},children:$.all(Z)};return $.patch(Z,J),$.applyData(Z,J)}function Dp($,Z){let J=typeof $.options.clobberPrefix==="string"?$.options.clobberPrefix:"user-content-",H=String(Z.identifier).toUpperCase(),B=B9(H.toLowerCase()),Q=$.footnoteOrder.indexOf(H),X,z=$.footnoteCounts.get(H);if(z===void 0)z=0,$.footnoteOrder.push(H),X=$.footnoteOrder.length;else X=Q+1;z+=1,$.footnoteCounts.set(H,z);let G={type:"element",tagName:"a",properties:{href:"#"+J+"fn-"+B,id:J+"fnref-"+B+(z>1?"-"+z:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(X)}]};$.patch(Z,G);let U={type:"element",tagName:"sup",properties:{},children:[G]};return $.patch(Z,U),$.applyData(Z,U)}function Vp($,Z){let J={type:"element",tagName:"h"+Z.depth,properties:{},children:$.all(Z)};return $.patch(Z,J),$.applyData(Z,J)}function Lp($,Z){if($.options.allowDangerousHtml){let J={type:"raw",value:Z.value};return $.patch(Z,J),$.applyData(Z,J)}return}function lW($,Z){let J=Z.referenceType,H="]";if(J==="collapsed")H+="[]";else if(J==="full")H+="["+(Z.label||Z.identifier)+"]";if(Z.type==="imageReference")return[{type:"text",value:"!["+Z.alt+H}];let B=$.all(Z),Q=B[0];if(Q&&Q.type==="text")Q.value="["+Q.value;else B.unshift({type:"text",value:"["});let X=B[B.length-1];if(X&&X.type==="text")X.value+=H;else B.push({type:"text",value:H});return B}function Mp($,Z){let J=String(Z.identifier).toUpperCase(),H=$.definitionById.get(J);if(!H)return lW($,Z);let B={src:B9(H.url||""),alt:Z.alt};if(H.title!==null&&H.title!==void 0)B.title=H.title;let Q={type:"element",tagName:"img",properties:B,children:[]};return $.patch(Z,Q),$.applyData(Z,Q)}function Pp($,Z){let J={src:B9(Z.url)};if(Z.alt!==null&&Z.alt!==void 0)J.alt=Z.alt;if(Z.title!==null&&Z.title!==void 0)J.title=Z.title;let H={type:"element",tagName:"img",properties:J,children:[]};return $.patch(Z,H),$.applyData(Z,H)}function _p($,Z){let J={type:"text",value:Z.value.replace(/\r?\n|\r/g," ")};$.patch(Z,J);let H={type:"element",tagName:"code",properties:{},children:[J]};return $.patch(Z,H),$.applyData(Z,H)}function Op($,Z){let J=String(Z.identifier).toUpperCase(),H=$.definitionById.get(J);if(!H)return lW($,Z);let B={href:B9(H.url||"")};if(H.title!==null&&H.title!==void 0)B.title=H.title;let Q={type:"element",tagName:"a",properties:B,children:$.all(Z)};return $.patch(Z,Q),$.applyData(Z,Q)}function Tp($,Z){let J={href:B9(Z.url)};if(Z.title!==null&&Z.title!==void 0)J.title=Z.title;let H={type:"element",tagName:"a",properties:J,children:$.all(Z)};return $.patch(Z,H),$.applyData(Z,H)}function jp($,Z,J){let H=$.all(Z),B=J?sH0(J):Cp(Z),Q={},X=[];if(typeof Z.checked==="boolean"){let Y=H[0],F;if(Y&&Y.type==="element"&&Y.tagName==="p")F=Y;else F={type:"element",tagName:"p",properties:{},children:[]},H.unshift(F);if(F.children.length>0)F.children.unshift({type:"text",value:" "});F.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:Z.checked,disabled:!0},children:[]}),Q.className=["task-list-item"]}let z=-1;while(++z<H.length){let Y=H[z];if(B||z!==0||Y.type!=="element"||Y.tagName!=="p")X.push({type:"text",value:`
|
|
25
|
+
`});if(Y.type==="element"&&Y.tagName==="p"&&!B)X.push(...Y.children);else X.push(Y)}let G=H[H.length-1];if(G&&(B||G.type!=="element"||G.tagName!=="p"))X.push({type:"text",value:`
|
|
26
|
+
`});let U={type:"element",tagName:"li",properties:Q,children:X};return $.patch(Z,U),$.applyData(Z,U)}function sH0($){let Z=!1;if($.type==="list"){Z=$.spread||!1;let J=$.children,H=-1;while(!Z&&++H<J.length)Z=Cp(J[H])}return Z}function Cp($){let Z=$.spread;return Z===null||Z===void 0?$.children.length>1:Z}function Ep($,Z){let J={},H=$.all(Z),B=-1;if(typeof Z.start==="number"&&Z.start!==1)J.start=Z.start;while(++B<H.length){let X=H[B];if(X.type==="element"&&X.tagName==="li"&&X.properties&&Array.isArray(X.properties.className)&&X.properties.className.includes("task-list-item")){J.className=["contains-task-list"];break}}let Q={type:"element",tagName:Z.ordered?"ol":"ul",properties:J,children:$.wrap(H,!0)};return $.patch(Z,Q),$.applyData(Z,Q)}function bp($,Z){let J={type:"element",tagName:"p",properties:{},children:$.all(Z)};return $.patch(Z,J),$.applyData(Z,J)}function wp($,Z){let J={type:"root",children:$.wrap($.all(Z))};return $.patch(Z,J),$.applyData(Z,J)}function Sp($,Z){let J={type:"element",tagName:"strong",properties:{},children:$.all(Z)};return $.patch(Z,J),$.applyData(Z,J)}function Rp($,Z){let J=$.all(Z),H=J.shift(),B=[];if(H){let X={type:"element",tagName:"thead",properties:{},children:$.wrap([H],!0)};$.patch(Z.children[0],X),B.push(X)}if(J.length>0){let X={type:"element",tagName:"tbody",properties:{},children:$.wrap(J,!0)},z=RH(Z.children[1]),G=jW(Z.children[Z.children.length-1]);if(z&&G)X.position={start:z,end:G};B.push(X)}let Q={type:"element",tagName:"table",properties:{},children:$.wrap(B,!0)};return $.patch(Z,Q),$.applyData(Z,Q)}function Ip($,Z,J){let H=J?J.children:void 0,Q=(H?H.indexOf(Z):1)===0?"th":"td",X=J&&J.type==="table"?J.align:void 0,z=X?X.length:Z.children.length,G=-1,U=[];while(++G<z){let F=Z.children[G],K={},W=X?X[G]:void 0;if(W)K.align=W;let N={type:"element",tagName:Q,properties:K,children:[]};if(F)N.children=$.all(F),$.patch(F,N),N=$.applyData(F,N);U.push(N)}let Y={type:"element",tagName:"tr",properties:{},children:$.wrap(U,!0)};return $.patch(Z,Y),$.applyData(Z,Y)}function kp($,Z){let J={type:"element",tagName:"td",properties:{},children:$.all(Z)};return $.patch(Z,J),$.applyData(Z,J)}function xp($){let Z=String($),J=/\r?\n|\r/g,H=J.exec(Z),B=0,Q=[];while(H)Q.push(yp(Z.slice(B,H.index),B>0,!0),H[0]),B=H.index+H[0].length,H=J.exec(Z);return Q.push(yp(Z.slice(B),B>0,!1)),Q.join("")}function yp($,Z,J){let H=0,B=$.length;if(Z){let Q=$.codePointAt(H);while(Q===9||Q===32)H++,Q=$.codePointAt(H)}if(J){let Q=$.codePointAt(B-1);while(Q===9||Q===32)B--,Q=$.codePointAt(B-1)}return B>H?$.slice(H,B):""}function hp($,Z){let J={type:"text",value:xp(String(Z.value))};return $.patch(Z,J),$.applyData(Z,J)}function vp($,Z){let J={type:"element",tagName:"hr",properties:{},children:[]};return $.patch(Z,J),$.applyData(Z,J)}var fp={blockquote:Kp,break:Wp,code:Np,delete:qp,emphasis:Ap,footnoteReference:Dp,heading:Vp,html:Lp,imageReference:Mp,image:Pp,inlineCode:_p,linkReference:Op,link:Tp,listItem:jp,list:Ep,paragraph:bp,root:wp,strong:Sp,table:Rp,tableCell:kp,tableRow:Ip,text:hp,thematicBreak:vp,toml:iW,yaml:iW,definition:iW,footnoteDefinition:iW};function iW(){return}var OP={}.hasOwnProperty,tH0={};function mp($,Z){let J=Z||tH0,H=new Map,B=new Map,Q=new Map,X={...fp,...J.handlers},z={all:U,applyData:$B0,definitionById:H,footnoteById:B,footnoteCounts:Q,footnoteOrder:[],handlers:X,one:G,options:J,patch:eH0,wrap:JB0};return X6($,function(Y){if(Y.type==="definition"||Y.type==="footnoteDefinition"){let F=Y.type==="definition"?H:B,K=String(Y.identifier).toUpperCase();if(!F.has(K))F.set(K,Y)}}),z;function G(Y,F){let K=Y.type,W=z.handlers[K];if(OP.call(z.handlers,K)&&W)return W(z,Y,F);if(z.options.passThrough&&z.options.passThrough.includes(K)){if("children"in Y){let{children:q,...D}=Y,A=hH(D);return A.children=z.all(Y),A}return hH(Y)}return(z.options.unknownHandler||ZB0)(z,Y,F)}function U(Y){let F=[];if("children"in Y){let K=Y.children,W=-1;while(++W<K.length){let N=z.one(K[W],Y);if(N){if(W&&K[W-1].type==="break"){if(!Array.isArray(N)&&N.type==="text")N.value=gp(N.value);if(!Array.isArray(N)&&N.type==="element"){let q=N.children[0];if(q&&q.type==="text")q.value=gp(q.value)}}if(Array.isArray(N))F.push(...N);else F.push(N)}}}return F}}function eH0($,Z){if($.position)Z.position=tM($)}function $B0($,Z){let J=Z;if($&&$.data){let H=$.data.hName,B=$.data.hChildren,Q=$.data.hProperties;if(typeof H==="string")if(J.type==="element")J.tagName=H;else{let X="children"in J?J.children:[J];J={type:"element",tagName:H,properties:{},children:X}}if(J.type==="element"&&Q)Object.assign(J.properties,hH(Q));if("children"in J&&J.children&&B!==null&&B!==void 0)J.children=B}return J}function ZB0($,Z){let J=Z.data||{},H="value"in Z&&!(OP.call(J,"hProperties")||OP.call(J,"hChildren"))?{type:"text",value:Z.value}:{type:"element",tagName:"div",properties:{},children:$.all(Z)};return $.patch(Z,H),$.applyData(Z,H)}function JB0($,Z){let J=[],H=-1;if(Z)J.push({type:"text",value:`
|
|
27
|
+
`});while(++H<$.length){if(H)J.push({type:"text",value:`
|
|
28
|
+
`});J.push($[H])}if(Z&&$.length>0)J.push({type:"text",value:`
|
|
29
|
+
`});return J}function gp($){let Z=0,J=$.charCodeAt(Z);while(J===9||J===32)Z++,J=$.charCodeAt(Z);return $.slice(Z)}function rW($,Z){let J=mp($,Z),H=J.one($,void 0),B=Up(J),Q=Array.isArray(H)?{type:"root",children:H}:H||{type:"root",children:[]};if(B)G5("children"in Q),Q.children.push({type:"text",value:`
|
|
30
|
+
`},B);return Q}function aW($,Z){if($&&"run"in $)return async function(J,H){let B=rW(J,{file:H,...Z});await $.run(B,H)};return function(J,H){return rW(J,{file:H,...$||Z})}}function TP($){if($)throw $}var sW=P(op(),1);function cX($){if(typeof $!=="object"||$===null)return!1;let Z=Object.getPrototypeOf($);return(Z===null||Z===Object.prototype||Object.getPrototypeOf(Z)===null)&&!(Symbol.toStringTag in $)&&!(Symbol.iterator in $)}function jP(){let $=[],Z={run:J,use:H};return Z;function J(...B){let Q=-1,X=B.pop();if(typeof X!=="function")throw TypeError("Expected function as last argument, not "+X);z(null,...B);function z(G,...U){let Y=$[++Q],F=-1;if(G){X(G);return}while(++F<B.length)if(U[F]===null||U[F]===void 0)U[F]=B[F];if(B=U,Y)np(Y,z)(...U);else X(null,...U)}}function H(B){if(typeof B!=="function")throw TypeError("Expected `middelware` to be a function, not "+B);return $.push(B),Z}}function np($,Z){let J;return H;function H(...X){let z=$.length>X.length,G;if(z)X.push(B);try{G=$.apply(this,X)}catch(U){let Y=U;if(z&&J)throw Y;return B(Y)}if(!z)if(G&&G.then&&typeof G.then==="function")G.then(Q,B);else if(G instanceof Error)B(G);else Q(G)}function B(X,...z){if(!J)J=!0,Z(X,...z)}function Q(X){B(null,X)}}var E9={basename:HB0,dirname:BB0,extname:QB0,join:XB0,sep:"/"};function HB0($,Z){if(Z!==void 0&&typeof Z!=="string")throw TypeError('"ext" argument must be a string');dX($);let J=0,H=-1,B=$.length,Q;if(Z===void 0||Z.length===0||Z.length>$.length){while(B--)if($.codePointAt(B)===47){if(Q){J=B+1;break}}else if(H<0)Q=!0,H=B+1;return H<0?"":$.slice(J,H)}if(Z===$)return"";let X=-1,z=Z.length-1;while(B--)if($.codePointAt(B)===47){if(Q){J=B+1;break}}else{if(X<0)Q=!0,X=B+1;if(z>-1)if($.codePointAt(B)===Z.codePointAt(z--)){if(z<0)H=B}else z=-1,H=X}if(J===H)H=X;else if(H<0)H=$.length;return $.slice(J,H)}function BB0($){if(dX($),$.length===0)return".";let Z=-1,J=$.length,H;while(--J)if($.codePointAt(J)===47){if(H){Z=J;break}}else if(!H)H=!0;return Z<0?$.codePointAt(0)===47?"/":".":Z===1&&$.codePointAt(0)===47?"//":$.slice(0,Z)}function QB0($){dX($);let Z=$.length,J=-1,H=0,B=-1,Q=0,X;while(Z--){let z=$.codePointAt(Z);if(z===47){if(X){H=Z+1;break}continue}if(J<0)X=!0,J=Z+1;if(z===46){if(B<0)B=Z;else if(Q!==1)Q=1}else if(B>-1)Q=-1}if(B<0||J<0||Q===0||Q===1&&B===J-1&&B===H+1)return"";return $.slice(B,J)}function XB0(...$){let Z=-1,J;while(++Z<$.length)if(dX($[Z]),$[Z])J=J===void 0?$[Z]:J+"/"+$[Z];return J===void 0?".":zB0(J)}function zB0($){dX($);let Z=$.codePointAt(0)===47,J=GB0($,!Z);if(J.length===0&&!Z)J=".";if(J.length>0&&$.codePointAt($.length-1)===47)J+="/";return Z?"/"+J:J}function GB0($,Z){let J="",H=0,B=-1,Q=0,X=-1,z,G;while(++X<=$.length){if(X<$.length)z=$.codePointAt(X);else if(z===47)break;else z=47;if(z===47){if(B===X-1||Q===1);else if(B!==X-1&&Q===2){if(J.length<2||H!==2||J.codePointAt(J.length-1)!==46||J.codePointAt(J.length-2)!==46){if(J.length>2){if(G=J.lastIndexOf("/"),G!==J.length-1){if(G<0)J="",H=0;else J=J.slice(0,G),H=J.length-1-J.lastIndexOf("/");B=X,Q=0;continue}}else if(J.length>0){J="",H=0,B=X,Q=0;continue}}if(Z)J=J.length>0?J+"/..":"..",H=2}else{if(J.length>0)J+="/"+$.slice(B+1,X);else J=$.slice(B+1,X);H=X-B-1}B=X,Q=0}else if(z===46&&Q>-1)Q++;else Q=-1}return J}function dX($){if(typeof $!=="string")throw TypeError("Path must be a string. Received "+JSON.stringify($))}var sp={cwd:UB0};function UB0(){return"/"}function vH($){return Boolean($!==null&&typeof $==="object"&&"href"in $&&$.href&&"protocol"in $&&$.protocol&&$.auth===void 0)}function tp($){if(typeof $==="string")$=new URL($);else if(!vH($)){let Z=TypeError('The "path" argument must be of type string or an instance of URL. Received `'+$+"`");throw Z.code="ERR_INVALID_ARG_TYPE",Z}if($.protocol!=="file:"){let Z=TypeError("The URL must be of scheme file");throw Z.code="ERR_INVALID_URL_SCHEME",Z}return YB0($)}function YB0($){if($.hostname!==""){let H=TypeError('File URL host must be "localhost" or empty on darwin');throw H.code="ERR_INVALID_FILE_URL_HOST",H}let Z=$.pathname,J=-1;while(++J<Z.length)if(Z.codePointAt(J)===37&&Z.codePointAt(J+1)===50){let H=Z.codePointAt(J+2);if(H===70||H===102){let B=TypeError("File URL path must not include encoded / characters");throw B.code="ERR_INVALID_FILE_URL_PATH",B}}return decodeURIComponent(Z)}var CP=["history","path","basename","stem","extname","dirname"];class fH{constructor($){let Z;if(!$)Z={};else if(vH($))Z={path:$};else if(typeof $==="string"||FB0($))Z={value:$};else Z=$;this.cwd="cwd"in Z?"":sp.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let J=-1;while(++J<CP.length){let B=CP[J];if(B in Z&&Z[B]!==void 0&&Z[B]!==null)this[B]=B==="history"?[...Z[B]]:Z[B]}let H;for(H in Z)if(!CP.includes(H))this[H]=Z[H]}get basename(){return typeof this.path==="string"?E9.basename(this.path):void 0}set basename($){bP($,"basename"),EP($,"basename"),this.path=E9.join(this.dirname||"",$)}get dirname(){return typeof this.path==="string"?E9.dirname(this.path):void 0}set dirname($){ep(this.basename,"dirname"),this.path=E9.join($||"",this.basename)}get extname(){return typeof this.path==="string"?E9.extname(this.path):void 0}set extname($){if(EP($,"extname"),ep(this.dirname,"extname"),$){if($.codePointAt(0)!==46)throw Error("`extname` must start with `.`");if($.includes(".",1))throw Error("`extname` cannot contain multiple dots")}this.path=E9.join(this.dirname,this.stem+($||""))}get path(){return this.history[this.history.length-1]}set path($){if(vH($))$=tp($);if(bP($,"path"),this.path!==$)this.history.push($)}get stem(){return typeof this.path==="string"?E9.basename(this.path,this.extname):void 0}set stem($){bP($,"stem"),EP($,"stem"),this.path=E9.join(this.dirname||"",$+(this.extname||""))}fail($,Z,J){let H=this.message($,Z,J);throw H.fatal=!0,H}info($,Z,J){let H=this.message($,Z,J);return H.fatal=void 0,H}message($,Z,J){let H=new D2($,Z,J);if(this.path)H.name=this.path+":"+H.name,H.file=this.path;return H.fatal=!1,this.messages.push(H),H}toString($){if(this.value===void 0)return"";if(typeof this.value==="string")return this.value;return new TextDecoder($||void 0).decode(this.value)}}function EP($,Z){if($&&$.includes(E9.sep))throw Error("`"+Z+"` cannot be a path: did not expect `"+E9.sep+"`")}function bP($,Z){if(!$)throw Error("`"+Z+"` cannot be empty")}function ep($,Z){if(!$)throw Error("Setting `"+Z+"` requires `path` to be set too")}function FB0($){return Boolean($&&typeof $==="object"&&"byteLength"in $&&"byteOffset"in $)}var $c=function($){let H=this.constructor.prototype,B=H[$],Q=function(){return B.apply(Q,arguments)};return Object.setPrototypeOf(Q,H),Q};var KB0={}.hasOwnProperty;class IP extends $c{constructor(){super("copy");this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=jP()}copy(){let $=new IP,Z=-1;while(++Z<this.attachers.length){let J=this.attachers[Z];$.use(...J)}return $.data(sW.default(!0,{},this.namespace)),$}data($,Z){if(typeof $==="string"){if(arguments.length===2)return RP("data",this.frozen),this.namespace[$]=Z,this;return KB0.call(this.namespace,$)&&this.namespace[$]||void 0}if($)return RP("data",this.frozen),this.namespace=$,this;return this.namespace}freeze(){if(this.frozen)return this;let $=this;while(++this.freezeIndex<this.attachers.length){let[Z,...J]=this.attachers[this.freezeIndex];if(J[0]===!1)continue;if(J[0]===!0)J[0]=void 0;let H=Z.call($,...J);if(typeof H==="function")this.transformers.use(H)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse($){this.freeze();let Z=nW($),J=this.parser||this.Parser;return wP("parse",J),J(String(Z),Z)}process($,Z){let J=this;return this.freeze(),wP("process",this.parser||this.Parser),SP("process",this.compiler||this.Compiler),Z?H(void 0,Z):new Promise(H);function H(B,Q){let X=nW($),z=J.parse(X);J.run(z,X,function(U,Y,F){if(U||!Y||!F)return G(U);let K=Y,W=J.stringify(K,F);if(NB0(W))F.value=W;else F.result=W;G(U,F)});function G(U,Y){if(U||!Y)Q(U);else if(B)B(Y);else G5(Z,"`done` is defined if `resolve` is not"),Z(void 0,Y)}}}processSync($){let Z=!1,J;return this.freeze(),wP("processSync",this.parser||this.Parser),SP("processSync",this.compiler||this.Compiler),this.process($,H),Jc("processSync","process",Z),G5(J,"we either bailed on an error or have a tree"),J;function H(B,Q){Z=!0,TP(B),J=Q}}run($,Z,J){Zc($),this.freeze();let H=this.transformers;if(!J&&typeof Z==="function")J=Z,Z=void 0;return J?B(void 0,J):new Promise(B);function B(Q,X){G5(typeof Z!=="function","`file` can’t be a `done` anymore, we checked");let z=nW(Z);H.run($,z,G);function G(U,Y,F){let K=Y||$;if(U)X(U);else if(Q)Q(K);else G5(J,"`done` is defined if `resolve` is not"),J(void 0,K,F)}}}runSync($,Z){let J=!1,H;return this.run($,Z,B),Jc("runSync","run",J),G5(H,"we either bailed on an error or have a tree"),H;function B(Q,X){TP(Q),H=X,J=!0}}stringify($,Z){this.freeze();let J=nW(Z),H=this.compiler||this.Compiler;return SP("stringify",H),Zc($),H($,J)}use($,...Z){let J=this.attachers,H=this.namespace;if(RP("use",this.frozen),$===null||$===void 0);else if(typeof $==="function")z($,Z);else if(typeof $==="object")if(Array.isArray($))X($);else Q($);else throw TypeError("Expected usable value, not `"+$+"`");return this;function B(G){if(typeof G==="function")z(G,[]);else if(typeof G==="object")if(Array.isArray(G)){let[U,...Y]=G;z(U,Y)}else Q(G);else throw TypeError("Expected usable value, not `"+G+"`")}function Q(G){if(!("plugins"in G)&&!("settings"in G))throw Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");if(X(G.plugins),G.settings)H.settings=sW.default(!0,H.settings,G.settings)}function X(G){let U=-1;if(G===null||G===void 0);else if(Array.isArray(G))while(++U<G.length){let Y=G[U];B(Y)}else throw TypeError("Expected a list of plugins, not `"+G+"`")}function z(G,U){let Y=-1,F=-1;while(++Y<J.length)if(J[Y][0]===G){F=Y;break}if(F===-1)J.push([G,...U]);else if(U.length>0){let[K,...W]=U,N=J[F][1];if(cX(N)&&cX(K))K=sW.default(!0,N,K);J[F]=[G,K,...W]}}}}var kP=new IP().freeze();function wP($,Z){if(typeof Z!=="function")throw TypeError("Cannot `"+$+"` without `parser`")}function SP($,Z){if(typeof Z!=="function")throw TypeError("Cannot `"+$+"` without `compiler`")}function RP($,Z){if(Z)throw Error("Cannot call `"+$+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Zc($){if(!cX($)||typeof $.type!=="string")throw TypeError("Expected node, got `"+$+"`")}function Jc($,Z,J){if(!J)throw Error("`"+$+"` finished async. Use `"+Z+"` instead")}function nW($){return WB0($)?$:new fH($)}function WB0($){return Boolean($&&typeof $==="object"&&"message"in $&&"messages"in $)}function NB0($){return typeof $==="string"||qB0($)}function qB0($){return Boolean($&&typeof $==="object"&&"byteLength"in $&&"byteOffset"in $)}var AB0="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Hc=[],Bc={allowDangerousHtml:!0},DB0=/^(https?|ircs?|mailto|xmpp)$/i,VB0=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function tW($){let Z=LB0($),J=MB0($);return PB0(Z.runSync(Z.parse(J),J),$)}function LB0($){let Z=$.rehypePlugins||Hc,J=$.remarkPlugins||Hc,H=$.remarkRehypeOptions?{...$.remarkRehypeOptions,...Bc}:Bc;return kP().use(vW).use(J).use(aW,H).use(Z)}function MB0($){let Z=$.children||"",J=new fH;if(typeof Z==="string")J.value=Z;else LW("Unexpected value `"+Z+"` for `children` prop, expected `string`");return J}function PB0($,Z){let{allowedElements:J,allowElement:H,components:B,disallowedElements:Q,skipHtml:X,unwrapDisallowed:z}=Z,G=Z.urlTransform||eW;for(let Y of VB0)if(Object.hasOwn(Z,Y.from))LW("Unexpected `"+Y.from+"` prop, "+(Y.to?"use `"+Y.to+"` instead":"remove it")+" (see <"+AB0+"#"+Y.id+"> for more info)");if(J&&Q)LW("Unexpected combined `allowedElements` and `disallowedElements`, expected one or the other");return X6($,U),ZP($,{Fragment:gH.Fragment,components:B,ignoreInvalidStyle:!0,jsx:gH.jsx,jsxs:gH.jsxs,passKeys:!0,passNode:!0});function U(Y,F,K){if(Y.type==="raw"&&K&&typeof F==="number"){if(X)K.children.splice(F,1);else K.children[F]={type:"text",value:Y.value};return F}if(Y.type==="element"){let W;for(W in RX)if(Object.hasOwn(RX,W)&&Object.hasOwn(Y.properties,W)){let N=Y.properties[W],q=RX[W];if(q===null||q.includes(Y.tagName))Y.properties[W]=G(String(N||""),W,Y)}}if(Y.type==="element"){let W=J?!J.includes(Y.tagName):Q?Q.includes(Y.tagName):!1;if(!W&&H&&typeof F==="number")W=!H(Y,F,K);if(W&&K&&typeof F==="number"){if(z&&Y.children)K.children.splice(F,1,...Y.children);else K.children.splice(F,1);return F}}}}function eW($){let Z=$.indexOf(":"),J=$.indexOf("?"),H=$.indexOf("#"),B=$.indexOf("/");if(Z===-1||B!==-1&&Z>B||J!==-1&&Z>J||H!==-1&&Z>H||DB0.test($.slice(0,Z)))return $;return""}var $N=function($,Z,J){let H=j3(J);if(!$||!$.type||!$.children)throw Error("Expected parent node");if(typeof Z==="number"){if(Z<0||Z===Number.POSITIVE_INFINITY)throw Error("Expected positive finite number as index")}else if(Z=$.children.indexOf(Z),Z<0)throw Error("Expected child node or index");while(++Z<$.children.length)if(H($.children[Z],Z,$))return $.children[Z];return};var z6=function($){if($===null||$===void 0)return TB0;if(typeof $==="string")return OB0($);if(typeof $==="object")return _B0($);if(typeof $==="function")return yP($);throw Error("Expected function, string, or array as `test`")};function _B0($){let Z=[],J=-1;while(++J<$.length)Z[J]=z6($[J]);return yP(H);function H(...B){let Q=-1;while(++Q<Z.length)if(Z[Q].apply(this,B))return!0;return!1}}function OB0($){return yP(Z);function Z(J){return J.tagName===$}}function yP($){return Z;function Z(J,H,B){return Boolean(jB0(J)&&$.call(this,J,typeof H==="number"?H:void 0,B||void 0))}}function TB0($){return Boolean($&&typeof $==="object"&&"type"in $&&$.type==="element"&&"tagName"in $&&typeof $.tagName==="string")}function jB0($){return $!==null&&typeof $==="object"&&"type"in $&&"tagName"in $}var Xc=/\n/g,zc=/[\t ]+/g,xP=z6("br"),Gc=z6(IB0),CB0=z6("p"),Uc=z6("tr"),EB0=z6(["datalist","head","noembed","noframes","noscript","rp","script","style","template","title",RB0,kB0]),Yc=z6(["address","article","aside","blockquote","body","caption","center","dd","dialog","dir","dl","dt","div","figure","figcaption","footer","form,","h1","h2","h3","h4","h5","h6","header","hgroup","hr","html","legend","li","listing","main","menu","nav","ol","p","plaintext","pre","section","ul","xmp"]);function hP($,Z){let J=Z||{},H="children"in $?$.children:[],B=Yc($),Q=Wc($,{whitespace:J.whitespace||"normal",breakBefore:!1,breakAfter:!1}),X=[];if($.type==="text"||$.type==="comment")X.push(...Kc($,{whitespace:Q,breakBefore:!0,breakAfter:!0}));let z=-1;while(++z<H.length)X.push(...Fc(H[z],$,{whitespace:Q,breakBefore:z?void 0:B,breakAfter:z<H.length-1?xP(H[z+1]):B}));let G=[],U;z=-1;while(++z<X.length){let Y=X[z];if(typeof Y==="number"){if(U!==void 0&&Y>U)U=Y}else if(Y){if(U!==void 0&&U>-1)G.push(`
|
|
31
|
+
`.repeat(U)||" ");U=-1,G.push(Y)}}return G.join("")}function Fc($,Z,J){if($.type==="element")return bB0($,Z,J);if($.type==="text")return J.whitespace==="normal"?Kc($,J):wB0($);return[]}function bB0($,Z,J){let H=Wc($,J),B=$.children||[],Q=-1,X=[];if(EB0($))return X;let z,G;if(xP($))G=`
|
|
32
|
+
`;else if(Uc($)&&$N(Z,$,Uc))G=`
|
|
33
|
+
`;else if(CB0($))z=2,G=2;else if(Yc($))z=1,G=1;while(++Q<B.length)X=X.concat(Fc(B[Q],$,{whitespace:H,breakBefore:Q?void 0:z,breakAfter:Q<B.length-1?xP(B[Q+1]):G}));if(Gc($)&&$N(Z,$,Gc))X.push("\t");if(z)X.unshift(z);if(G)X.push(G);return X}function Kc($,Z){let J=String($.value),H=[],B=[],Q=0;while(Q<=J.length){Xc.lastIndex=Q;let G=Xc.exec(J),U=G&&"index"in G?G.index:J.length;H.push(SB0(J.slice(Q,U).replace(/[\u061C\u200E\u200F\u202A-\u202E\u2066-\u2069]/g,""),Q===0?Z.breakBefore:!0,U===J.length?Z.breakAfter:!0)),Q=U+1}let X=-1,z;while(++X<H.length)if(H[X].charCodeAt(H[X].length-1)===8203||X<H.length-1&&H[X+1].charCodeAt(0)===8203)B.push(H[X]),z=void 0;else if(H[X]){if(typeof z==="number")B.push(z);B.push(H[X]),z=0}else if(X===0||X===H.length-1)B.push(0);return B}function wB0($){return[String($.value)]}function SB0($,Z,J){let H=[],B=0,Q;while(B<$.length){zc.lastIndex=B;let X=zc.exec($);if(Q=X?X.index:$.length,!B&&!Q&&X&&!Z)H.push("");if(B!==Q)H.push($.slice(B,Q));B=X?Q+X[0].length:Q}if(B!==Q&&!J)H.push("");return H.join(" ")}function Wc($,Z){if($.type==="element"){let J=$.properties||{};switch($.tagName){case"listing":case"plaintext":case"xmp":return"pre";case"nobr":return"nowrap";case"pre":return J.wrap?"pre-wrap":"pre";case"td":case"th":return J.noWrap?"nowrap":Z.whitespace;case"textarea":return"pre-wrap";default:}}return Z.whitespace}function RB0($){return Boolean(($.properties||{}).hidden)}function IB0($){return $.tagName==="td"||$.tagName==="th"}function kB0($){return $.tagName==="dialog"&&!($.properties||{}).open}function yB0($){let Z=$.regex,J=$.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),H="decltype\\(auto\\)",B="[a-zA-Z_]\\w*::",Q="<[^<>]+>",X="(?!struct)(decltype\\(auto\\)|"+Z.optional("[a-zA-Z_]\\w*::")+"[a-zA-Z_]\\w*"+Z.optional("<[^<>]+>")+")",z={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},G="\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)",U={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[$.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'(\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)|.)",end:"'",illegal:"."},$.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},Y={className:"number",variants:[{begin:"[+-]?(?:(?:[0-9](?:'?[0-9])*\\.(?:[0-9](?:'?[0-9])*)?|\\.[0-9](?:'?[0-9])*)(?:[Ee][+-]?[0-9](?:'?[0-9])*)?|[0-9](?:'?[0-9])*[Ee][+-]?[0-9](?:'?[0-9])*|0[Xx](?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*(?:\\.(?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)?)?|\\.[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)[Pp][+-]?[0-9](?:'?[0-9])*)(?:[Ff](?:16|32|64|128)?|(BF|bf)16|[Ll]|)"},{begin:"[+-]?\\b(?:0[Bb][01](?:'?[01])*|0[Xx][0-9A-Fa-f](?:'?[0-9A-Fa-f])*|0(?:'?[0-7])*|[1-9](?:'?[0-9])*)(?:[Uu](?:LL?|ll?)|[Uu][Zz]?|(?:LL?|ll?)[Uu]?|[Zz][Uu]|)"}],relevance:0},F={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},$.inherit(U,{className:"string"}),{className:"string",begin:/<.*?>/},J,$.C_BLOCK_COMMENT_MODE]},K={className:"title",begin:Z.optional("[a-zA-Z_]\\w*::")+$.IDENT_RE,relevance:0},W=Z.optional("[a-zA-Z_]\\w*::")+$.IDENT_RE+"\\s*\\(",N=["alignas","alignof","and","and_eq","asm","atomic_cancel","atomic_commit","atomic_noexcept","auto","bitand","bitor","break","case","catch","class","co_await","co_return","co_yield","compl","concept","const_cast|10","consteval","constexpr","constinit","continue","decltype","default","delete","do","dynamic_cast|10","else","enum","explicit","export","extern","false","final","for","friend","goto","if","import","inline","module","mutable","namespace","new","noexcept","not","not_eq","nullptr","operator","or","or_eq","override","private","protected","public","reflexpr","register","reinterpret_cast|10","requires","return","sizeof","static_assert","static_cast|10","struct","switch","synchronized","template","this","thread_local","throw","transaction_safe","transaction_safe_dynamic","true","try","typedef","typeid","typename","union","using","virtual","volatile","while","xor","xor_eq"],q=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],D=["any","auto_ptr","barrier","binary_semaphore","bitset","complex","condition_variable","condition_variable_any","counting_semaphore","deque","false_type","flat_map","flat_set","future","imaginary","initializer_list","istringstream","jthread","latch","lock_guard","multimap","multiset","mutex","optional","ostringstream","packaged_task","pair","promise","priority_queue","queue","recursive_mutex","recursive_timed_mutex","scoped_lock","set","shared_future","shared_lock","shared_mutex","shared_timed_mutex","shared_ptr","stack","string_view","stringstream","timed_mutex","thread","true_type","tuple","unique_lock","unique_ptr","unordered_map","unordered_multimap","unordered_multiset","unordered_set","variant","vector","weak_ptr","wstring","wstring_view"],A=["abort","abs","acos","apply","as_const","asin","atan","atan2","calloc","ceil","cerr","cin","clog","cos","cosh","cout","declval","endl","exchange","exit","exp","fabs","floor","fmod","forward","fprintf","fputs","free","frexp","fscanf","future","invoke","isalnum","isalpha","iscntrl","isdigit","isgraph","islower","isprint","ispunct","isspace","isupper","isxdigit","labs","launder","ldexp","log","log10","make_pair","make_shared","make_shared_for_overwrite","make_tuple","make_unique","malloc","memchr","memcmp","memcpy","memset","modf","move","pow","printf","putchar","puts","realloc","scanf","sin","sinh","snprintf","sprintf","sqrt","sscanf","std","stderr","stdin","stdout","strcat","strchr","strcmp","strcpy","strcspn","strlen","strncat","strncmp","strncpy","strpbrk","strrchr","strspn","strstr","swap","tan","tanh","terminate","to_underlying","tolower","toupper","vfprintf","visit","vprintf","vsprintf"],O={type:q,keyword:N,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:D},M={className:"function.dispatch",relevance:0,keywords:{_hint:A},begin:Z.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,$.IDENT_RE,Z.lookahead(/(<[^<>]+>|)\s*\(/))},_=[M,F,z,J,$.C_BLOCK_COMMENT_MODE,Y,U],w={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:O,contains:_.concat([{begin:/\(/,end:/\)/,keywords:O,contains:_.concat(["self"]),relevance:0}]),relevance:0},C={className:"function",begin:"("+X+"[\\*&\\s]+)+"+W,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:O,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:"decltype\\(auto\\)",keywords:O,relevance:0},{begin:W,returnBegin:!0,contains:[K],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[U,Y]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:O,relevance:0,contains:[J,$.C_BLOCK_COMMENT_MODE,U,Y,z,{begin:/\(/,end:/\)/,keywords:O,relevance:0,contains:["self",J,$.C_BLOCK_COMMENT_MODE,U,Y,z]}]},z,J,$.C_BLOCK_COMMENT_MODE,F]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:O,illegal:"</",classNameAliases:{"function.dispatch":"built_in"},contains:[].concat(w,C,M,_,[F,{begin:"\\b(deque|list|queue|priority_queue|pair|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array|tuple|optional|variant|function|flat_map|flat_set)\\s*<(?!<)",end:">",keywords:O,contains:["self",z]},{begin:$.IDENT_RE+"::",keywords:O},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function Nc($){let Z={type:["boolean","byte","word","String"],built_in:["KeyboardController","MouseController","SoftwareSerial","EthernetServer","EthernetClient","LiquidCrystal","RobotControl","GSMVoiceCall","EthernetUDP","EsploraTFT","HttpClient","RobotMotor","WiFiClient","GSMScanner","FileSystem","Scheduler","GSMServer","YunClient","YunServer","IPAddress","GSMClient","GSMModem","Keyboard","Ethernet","Console","GSMBand","Esplora","Stepper","Process","WiFiUDP","GSM_SMS","Mailbox","USBHost","Firmata","PImage","Client","Server","GSMPIN","FileIO","Bridge","Serial","EEPROM","Stream","Mouse","Audio","Servo","File","Task","GPRS","WiFi","Wire","TFT","GSM","SPI","SD"],_hints:["setup","loop","runShellCommandAsynchronously","analogWriteResolution","retrieveCallingNumber","printFirmwareVersion","analogReadResolution","sendDigitalPortPair","noListenOnLocalhost","readJoystickButton","setFirmwareVersion","readJoystickSwitch","scrollDisplayRight","getVoiceCallStatus","scrollDisplayLeft","writeMicroseconds","delayMicroseconds","beginTransmission","getSignalStrength","runAsynchronously","getAsynchronously","listenOnLocalhost","getCurrentCarrier","readAccelerometer","messageAvailable","sendDigitalPorts","lineFollowConfig","countryNameWrite","runShellCommand","readStringUntil","rewindDirectory","readTemperature","setClockDivider","readLightSensor","endTransmission","analogReference","detachInterrupt","countryNameRead","attachInterrupt","encryptionType","readBytesUntil","robotNameWrite","readMicrophone","robotNameRead","cityNameWrite","userNameWrite","readJoystickY","readJoystickX","mouseReleased","openNextFile","scanNetworks","noInterrupts","digitalWrite","beginSpeaker","mousePressed","isActionDone","mouseDragged","displayLogos","noAutoscroll","addParameter","remoteNumber","getModifiers","keyboardRead","userNameRead","waitContinue","processInput","parseCommand","printVersion","readNetworks","writeMessage","blinkVersion","cityNameRead","readMessage","setDataMode","parsePacket","isListening","setBitOrder","beginPacket","isDirectory","motorsWrite","drawCompass","digitalRead","clearScreen","serialEvent","rightToLeft","setTextSize","leftToRight","requestFrom","keyReleased","compassRead","analogWrite","interrupts","WiFiServer","disconnect","playMelody","parseFloat","autoscroll","getPINUsed","setPINUsed","setTimeout","sendAnalog","readSlider","analogRead","beginWrite","createChar","motorsStop","keyPressed","tempoWrite","readButton","subnetMask","debugPrint","macAddress","writeGreen","randomSeed","attachGPRS","readString","sendString","remotePort","releaseAll","mouseMoved","background","getXChange","getYChange","answerCall","getResult","voiceCall","endPacket","constrain","getSocket","writeJSON","getButton","available","connected","findUntil","readBytes","exitValue","readGreen","writeBlue","startLoop","IPAddress","isPressed","sendSysex","pauseMode","gatewayIP","setCursor","getOemKey","tuneWrite","noDisplay","loadImage","switchPIN","onRequest","onReceive","changePIN","playFile","noBuffer","parseInt","overflow","checkPIN","knobRead","beginTFT","bitClear","updateIR","bitWrite","position","writeRGB","highByte","writeRed","setSpeed","readBlue","noStroke","remoteIP","transfer","shutdown","hangCall","beginSMS","endWrite","attached","maintain","noCursor","checkReg","checkPUK","shiftOut","isValid","shiftIn","pulseIn","connect","println","localIP","pinMode","getIMEI","display","noBlink","process","getBand","running","beginSD","drawBMP","lowByte","setBand","release","bitRead","prepare","pointTo","readRed","setMode","noFill","remove","listen","stroke","detach","attach","noTone","exists","buffer","height","bitSet","circle","config","cursor","random","IRread","setDNS","endSMS","getKey","micros","millis","begin","print","write","ready","flush","width","isPIN","blink","clear","press","mkdir","rmdir","close","point","yield","image","BSSID","click","delay","read","text","move","peek","beep","rect","line","open","seek","fill","size","turn","stop","home","find","step","tone","sqrt","RSSI","SSID","end","bit","tan","cos","sin","pow","map","abs","max","min","get","run","put"],literal:["DIGITAL_MESSAGE","FIRMATA_STRING","ANALOG_MESSAGE","REPORT_DIGITAL","REPORT_ANALOG","INPUT_PULLUP","SET_PIN_MODE","INTERNAL2V56","SYSTEM_RESET","LED_BUILTIN","INTERNAL1V1","SYSEX_START","INTERNAL","EXTERNAL","DEFAULT","OUTPUT","INPUT","HIGH","LOW"]},J=yB0($),H=J.keywords;return H.type=[...H.type,...Z.type],H.literal=[...H.literal,...Z.literal],H.built_in=[...H.built_in,...Z.built_in],H._hints=Z._hints,J.name="Arduino",J.aliases=["ino"],J.supersetOf="cpp",J}function qc($){let Z=$.regex,J={},H={begin:/\$\{/,end:/\}/,contains:["self",{begin:/:-/,contains:[J]}]};Object.assign(J,{className:"variable",variants:[{begin:Z.concat(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},H]});let B={className:"subst",begin:/\$\(/,end:/\)/,contains:[$.BACKSLASH_ESCAPE]},Q=$.inherit($.COMMENT(),{match:[/(^|\s)/,/#.*$/],scope:{2:"comment"}}),X={begin:/<<-?\s*(?=\w+)/,starts:{contains:[$.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:"string"})]}},z={className:"string",begin:/"/,end:/"/,contains:[$.BACKSLASH_ESCAPE,J,B]};B.contains.push(z);let G={match:/\\"/},U={className:"string",begin:/'/,end:/'/},Y={match:/\\'/},F={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},$.NUMBER_MODE,J]},K=["fish","bash","zsh","sh","csh","ksh","tcsh","dash","scsh"],W=$.SHEBANG({binary:`(${K.join("|")})`,relevance:10}),N={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[$.inherit($.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0},q=["if","then","else","elif","fi","time","for","while","until","in","do","done","case","esac","coproc","function","select"],D=["true","false"],A={match:/(\/[a-z._-]+)+/},V=["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset"],L=["alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","sudo","type","typeset","ulimit","unalias"],O=["autoload","bg","bindkey","bye","cap","chdir","clone","comparguments","compcall","compctl","compdescribe","compfiles","compgroups","compquote","comptags","comptry","compvalues","dirs","disable","disown","echotc","echoti","emulate","fc","fg","float","functions","getcap","getln","history","integer","jobs","kill","limit","log","noglob","popd","print","pushd","pushln","rehash","sched","setcap","setopt","stat","suspend","ttyctl","unfunction","unhash","unlimit","unsetopt","vared","wait","whence","where","which","zcompile","zformat","zftp","zle","zmodload","zparseopts","zprof","zpty","zregexparse","zsocket","zstyle","ztcp"],M=["chcon","chgrp","chown","chmod","cp","dd","df","dir","dircolors","ln","ls","mkdir","mkfifo","mknod","mktemp","mv","realpath","rm","rmdir","shred","sync","touch","truncate","vdir","b2sum","base32","base64","cat","cksum","comm","csplit","cut","expand","fmt","fold","head","join","md5sum","nl","numfmt","od","paste","ptx","pr","sha1sum","sha224sum","sha256sum","sha384sum","sha512sum","shuf","sort","split","sum","tac","tail","tr","tsort","unexpand","uniq","wc","arch","basename","chroot","date","dirname","du","echo","env","expr","factor","groups","hostid","id","link","logname","nice","nohup","nproc","pathchk","pinky","printenv","printf","pwd","readlink","runcon","seq","sleep","stat","stdbuf","stty","tee","test","timeout","tty","uname","unlink","uptime","users","who","whoami","yes"];return{name:"Bash",aliases:["sh","zsh"],keywords:{$pattern:/\b[a-z][a-z0-9._-]+\b/,keyword:q,literal:D,built_in:[...V,...L,"set","shopt",...O,...M]},contains:[W,$.SHEBANG(),N,F,Q,X,A,z,G,U,Y,J]}}function Ac($){let Z=$.regex,J=$.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),H="decltype\\(auto\\)",B="[a-zA-Z_]\\w*::",Q="<[^<>]+>",X="(decltype\\(auto\\)|"+Z.optional("[a-zA-Z_]\\w*::")+"[a-zA-Z_]\\w*"+Z.optional("<[^<>]+>")+")",z={className:"type",variants:[{begin:"\\b[a-z\\d_]*_t\\b"},{match:/\batomic_[a-z]{3,6}\b/}]},G="\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)",U={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[$.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'(\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)|.)",end:"'",illegal:"."},$.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},Y={className:"number",variants:[{match:/\b(0b[01']+)/},{match:/(-?)\b([\d']+(\.[\d']*)?|\.[\d']+)((ll|LL|l|L)(u|U)?|(u|U)(ll|LL|l|L)?|f|F|b|B)/},{match:/(-?)\b(0[xX][a-fA-F0-9]+(?:'[a-fA-F0-9]+)*(?:\.[a-fA-F0-9]*(?:'[a-fA-F0-9]*)*)?(?:[pP][-+]?[0-9]+)?(l|L)?(u|U)?)/},{match:/(-?)\b\d+(?:'\d+)*(?:\.\d*(?:'\d*)*)?(?:[eE][-+]?\d+)?/}],relevance:0},F={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef elifdef elifndef include"},contains:[{begin:/\\\n/,relevance:0},$.inherit(U,{className:"string"}),{className:"string",begin:/<.*?>/},J,$.C_BLOCK_COMMENT_MODE]},K={className:"title",begin:Z.optional("[a-zA-Z_]\\w*::")+$.IDENT_RE,relevance:0},W=Z.optional("[a-zA-Z_]\\w*::")+$.IDENT_RE+"\\s*\\(",D={keyword:["asm","auto","break","case","continue","default","do","else","enum","extern","for","fortran","goto","if","inline","register","restrict","return","sizeof","typeof","typeof_unqual","struct","switch","typedef","union","volatile","while","_Alignas","_Alignof","_Atomic","_Generic","_Noreturn","_Static_assert","_Thread_local","alignas","alignof","noreturn","static_assert","thread_local","_Pragma"],type:["float","double","signed","unsigned","int","short","long","char","void","_Bool","_BitInt","_Complex","_Imaginary","_Decimal32","_Decimal64","_Decimal96","_Decimal128","_Decimal64x","_Decimal128x","_Float16","_Float32","_Float64","_Float128","_Float32x","_Float64x","_Float128x","const","static","constexpr","complex","bool","imaginary"],literal:"true false NULL",built_in:"std string wstring cin cout cerr clog stdin stdout stderr stringstream istringstream ostringstream auto_ptr deque list queue stack vector map set pair bitset multiset multimap unordered_set unordered_map unordered_multiset unordered_multimap priority_queue make_pair array shared_ptr abort terminate abs acos asin atan2 atan calloc ceil cosh cos exit exp fabs floor fmod fprintf fputs free frexp fscanf future isalnum isalpha iscntrl isdigit isgraph islower isprint ispunct isspace isupper isxdigit tolower toupper labs ldexp log10 log malloc realloc memchr memcmp memcpy memset modf pow printf putchar puts scanf sinh sin snprintf sprintf sqrt sscanf strcat strchr strcmp strcpy strcspn strlen strncat strncmp strncpy strpbrk strrchr strspn strstr tanh tan vfprintf vprintf vsprintf endl initializer_list unique_ptr"},A=[F,z,J,$.C_BLOCK_COMMENT_MODE,Y,U],V={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:D,contains:A.concat([{begin:/\(/,end:/\)/,keywords:D,contains:A.concat(["self"]),relevance:0}]),relevance:0},L={begin:"("+X+"[\\*&\\s]+)+"+W,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:D,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:"decltype\\(auto\\)",keywords:D,relevance:0},{begin:W,returnBegin:!0,contains:[$.inherit(K,{className:"title.function"})],relevance:0},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:D,relevance:0,contains:[J,$.C_BLOCK_COMMENT_MODE,U,Y,z,{begin:/\(/,end:/\)/,keywords:D,relevance:0,contains:["self",J,$.C_BLOCK_COMMENT_MODE,U,Y,z]}]},z,J,$.C_BLOCK_COMMENT_MODE,F]};return{name:"C",aliases:["h"],keywords:D,disableAutodetect:!0,illegal:"</",contains:[].concat(V,L,A,[F,{begin:$.IDENT_RE+"::",keywords:D},{className:"class",beginKeywords:"enum class struct union",end:/[{;:<>=]/,contains:[{beginKeywords:"final class struct"},$.TITLE_MODE]}]),exports:{preprocessor:F,strings:U,keywords:D}}}function Dc($){let Z=$.regex,J=$.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),H="decltype\\(auto\\)",B="[a-zA-Z_]\\w*::",Q="<[^<>]+>",X="(?!struct)(decltype\\(auto\\)|"+Z.optional("[a-zA-Z_]\\w*::")+"[a-zA-Z_]\\w*"+Z.optional("<[^<>]+>")+")",z={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},G="\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)",U={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[$.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'(\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)|.)",end:"'",illegal:"."},$.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},Y={className:"number",variants:[{begin:"[+-]?(?:(?:[0-9](?:'?[0-9])*\\.(?:[0-9](?:'?[0-9])*)?|\\.[0-9](?:'?[0-9])*)(?:[Ee][+-]?[0-9](?:'?[0-9])*)?|[0-9](?:'?[0-9])*[Ee][+-]?[0-9](?:'?[0-9])*|0[Xx](?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*(?:\\.(?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)?)?|\\.[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)[Pp][+-]?[0-9](?:'?[0-9])*)(?:[Ff](?:16|32|64|128)?|(BF|bf)16|[Ll]|)"},{begin:"[+-]?\\b(?:0[Bb][01](?:'?[01])*|0[Xx][0-9A-Fa-f](?:'?[0-9A-Fa-f])*|0(?:'?[0-7])*|[1-9](?:'?[0-9])*)(?:[Uu](?:LL?|ll?)|[Uu][Zz]?|(?:LL?|ll?)[Uu]?|[Zz][Uu]|)"}],relevance:0},F={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},$.inherit(U,{className:"string"}),{className:"string",begin:/<.*?>/},J,$.C_BLOCK_COMMENT_MODE]},K={className:"title",begin:Z.optional("[a-zA-Z_]\\w*::")+$.IDENT_RE,relevance:0},W=Z.optional("[a-zA-Z_]\\w*::")+$.IDENT_RE+"\\s*\\(",N=["alignas","alignof","and","and_eq","asm","atomic_cancel","atomic_commit","atomic_noexcept","auto","bitand","bitor","break","case","catch","class","co_await","co_return","co_yield","compl","concept","const_cast|10","consteval","constexpr","constinit","continue","decltype","default","delete","do","dynamic_cast|10","else","enum","explicit","export","extern","false","final","for","friend","goto","if","import","inline","module","mutable","namespace","new","noexcept","not","not_eq","nullptr","operator","or","or_eq","override","private","protected","public","reflexpr","register","reinterpret_cast|10","requires","return","sizeof","static_assert","static_cast|10","struct","switch","synchronized","template","this","thread_local","throw","transaction_safe","transaction_safe_dynamic","true","try","typedef","typeid","typename","union","using","virtual","volatile","while","xor","xor_eq"],q=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],D=["any","auto_ptr","barrier","binary_semaphore","bitset","complex","condition_variable","condition_variable_any","counting_semaphore","deque","false_type","flat_map","flat_set","future","imaginary","initializer_list","istringstream","jthread","latch","lock_guard","multimap","multiset","mutex","optional","ostringstream","packaged_task","pair","promise","priority_queue","queue","recursive_mutex","recursive_timed_mutex","scoped_lock","set","shared_future","shared_lock","shared_mutex","shared_timed_mutex","shared_ptr","stack","string_view","stringstream","timed_mutex","thread","true_type","tuple","unique_lock","unique_ptr","unordered_map","unordered_multimap","unordered_multiset","unordered_set","variant","vector","weak_ptr","wstring","wstring_view"],A=["abort","abs","acos","apply","as_const","asin","atan","atan2","calloc","ceil","cerr","cin","clog","cos","cosh","cout","declval","endl","exchange","exit","exp","fabs","floor","fmod","forward","fprintf","fputs","free","frexp","fscanf","future","invoke","isalnum","isalpha","iscntrl","isdigit","isgraph","islower","isprint","ispunct","isspace","isupper","isxdigit","labs","launder","ldexp","log","log10","make_pair","make_shared","make_shared_for_overwrite","make_tuple","make_unique","malloc","memchr","memcmp","memcpy","memset","modf","move","pow","printf","putchar","puts","realloc","scanf","sin","sinh","snprintf","sprintf","sqrt","sscanf","std","stderr","stdin","stdout","strcat","strchr","strcmp","strcpy","strcspn","strlen","strncat","strncmp","strncpy","strpbrk","strrchr","strspn","strstr","swap","tan","tanh","terminate","to_underlying","tolower","toupper","vfprintf","visit","vprintf","vsprintf"],O={type:q,keyword:N,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:D},M={className:"function.dispatch",relevance:0,keywords:{_hint:A},begin:Z.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,$.IDENT_RE,Z.lookahead(/(<[^<>]+>|)\s*\(/))},_=[M,F,z,J,$.C_BLOCK_COMMENT_MODE,Y,U],w={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:O,contains:_.concat([{begin:/\(/,end:/\)/,keywords:O,contains:_.concat(["self"]),relevance:0}]),relevance:0},C={className:"function",begin:"("+X+"[\\*&\\s]+)+"+W,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:O,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:"decltype\\(auto\\)",keywords:O,relevance:0},{begin:W,returnBegin:!0,contains:[K],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[U,Y]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:O,relevance:0,contains:[J,$.C_BLOCK_COMMENT_MODE,U,Y,z,{begin:/\(/,end:/\)/,keywords:O,relevance:0,contains:["self",J,$.C_BLOCK_COMMENT_MODE,U,Y,z]}]},z,J,$.C_BLOCK_COMMENT_MODE,F]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:O,illegal:"</",classNameAliases:{"function.dispatch":"built_in"},contains:[].concat(w,C,M,_,[F,{begin:"\\b(deque|list|queue|priority_queue|pair|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array|tuple|optional|variant|function|flat_map|flat_set)\\s*<(?!<)",end:">",keywords:O,contains:["self",z]},{begin:$.IDENT_RE+"::",keywords:O},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function Vc($){let Z=["bool","byte","char","decimal","delegate","double","dynamic","enum","float","int","long","nint","nuint","object","sbyte","short","string","ulong","uint","ushort"],J=["public","private","protected","static","internal","protected","abstract","async","extern","override","unsafe","virtual","new","sealed","partial"],H=["default","false","null","true"],B=["abstract","as","base","break","case","catch","class","const","continue","do","else","event","explicit","extern","finally","fixed","for","foreach","goto","if","implicit","in","interface","internal","is","lock","namespace","new","operator","out","override","params","private","protected","public","readonly","record","ref","return","scoped","sealed","sizeof","stackalloc","static","struct","switch","this","throw","try","typeof","unchecked","unsafe","using","virtual","void","volatile","while"],Q=["add","alias","and","ascending","args","async","await","by","descending","dynamic","equals","file","from","get","global","group","init","into","join","let","nameof","not","notnull","on","or","orderby","partial","record","remove","required","scoped","select","set","unmanaged","value|0","var","when","where","with","yield"],X={keyword:B.concat(Q),built_in:Z,literal:H},z=$.inherit($.TITLE_MODE,{begin:"[a-zA-Z](\\.?\\w)*"}),G={className:"number",variants:[{begin:"\\b(0b[01']+)"},{begin:"(-?)\\b([\\d']+(\\.[\\d']*)?|\\.[\\d']+)(u|U|l|L|ul|UL|f|F|b|B)"},{begin:"(-?)(\\b0[xX][a-fA-F0-9']+|(\\b[\\d']+(\\.[\\d']*)?|\\.[\\d']+)([eE][-+]?[\\d']+)?)"}],relevance:0},U={className:"string",begin:/"""("*)(?!")(.|\n)*?"""\1/,relevance:1},Y={className:"string",begin:'@"',end:'"',contains:[{begin:'""'}]},F=$.inherit(Y,{illegal:/\n/}),K={className:"subst",begin:/\{/,end:/\}/,keywords:X},W=$.inherit(K,{illegal:/\n/}),N={className:"string",begin:/\$"/,end:'"',illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},$.BACKSLASH_ESCAPE,W]},q={className:"string",begin:/\$@"/,end:'"',contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},K]},D=$.inherit(q,{illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},W]});K.contains=[q,N,Y,$.APOS_STRING_MODE,$.QUOTE_STRING_MODE,G,$.C_BLOCK_COMMENT_MODE],W.contains=[D,N,F,$.APOS_STRING_MODE,$.QUOTE_STRING_MODE,G,$.inherit($.C_BLOCK_COMMENT_MODE,{illegal:/\n/})];let A={variants:[U,q,N,Y,$.APOS_STRING_MODE,$.QUOTE_STRING_MODE]},V={begin:"<",end:">",contains:[{beginKeywords:"in out"},z]},L=$.IDENT_RE+"(<"+$.IDENT_RE+"(\\s*,\\s*"+$.IDENT_RE+")*>)?(\\[\\])?",O={begin:"@"+$.IDENT_RE,relevance:0};return{name:"C#",aliases:["cs","c#"],keywords:X,illegal:/::/,contains:[$.COMMENT("///","$",{returnBegin:!0,contains:[{className:"doctag",variants:[{begin:"///",relevance:0},{begin:"<!--|-->"},{begin:"</?",end:">"}]}]}),$.C_LINE_COMMENT_MODE,$.C_BLOCK_COMMENT_MODE,{className:"meta",begin:"#",end:"$",keywords:{keyword:"if else elif endif define undef warning error line region endregion pragma checksum"}},A,G,{beginKeywords:"class interface",relevance:0,end:/[{;=]/,illegal:/[^\s:,]/,contains:[{beginKeywords:"where class"},z,V,$.C_LINE_COMMENT_MODE,$.C_BLOCK_COMMENT_MODE]},{beginKeywords:"namespace",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[z,$.C_LINE_COMMENT_MODE,$.C_BLOCK_COMMENT_MODE]},{beginKeywords:"record",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[z,V,$.C_LINE_COMMENT_MODE,$.C_BLOCK_COMMENT_MODE]},{className:"meta",begin:"^\\s*\\[(?=[\\w])",excludeBegin:!0,end:"\\]",excludeEnd:!0,contains:[{className:"string",begin:/"/,end:/"/}]},{beginKeywords:"new return throw await else",relevance:0},{className:"function",begin:"("+L+"\\s+)+"+$.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,end:/\s*[{;=]/,excludeEnd:!0,keywords:X,contains:[{beginKeywords:J.join(" "),relevance:0},{begin:$.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,contains:[$.TITLE_MODE,V],relevance:0},{match:/\(\)/},{className:"params",begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:X,relevance:0,contains:[A,G,$.C_BLOCK_COMMENT_MODE]},$.C_LINE_COMMENT_MODE,$.C_BLOCK_COMMENT_MODE]},O]}}var xB0=($)=>{return{IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:$.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[$.APOS_STRING_MODE,$.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:$.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}},hB0=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],vB0=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],fB0=[...hB0,...vB0],gB0=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),mB0=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),uB0=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),pB0=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function Lc($){let Z=$.regex,J=xB0($),H={begin:/-(webkit|moz|ms|o)-(?=[a-z])/},B="and or not only",Q=/@-?\w[\w]*(-\w+)*/,X="[a-zA-Z-][a-zA-Z0-9_-]*",z=[$.APOS_STRING_MODE,$.QUOTE_STRING_MODE];return{name:"CSS",case_insensitive:!0,illegal:/[=|'\$]/,keywords:{keyframePosition:"from to"},classNameAliases:{keyframePosition:"selector-tag"},contains:[J.BLOCK_COMMENT,H,J.CSS_NUMBER_MODE,{className:"selector-id",begin:/#[A-Za-z0-9_-]+/,relevance:0},{className:"selector-class",begin:"\\.[a-zA-Z-][a-zA-Z0-9_-]*",relevance:0},J.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",variants:[{begin:":("+mB0.join("|")+")"},{begin:":(:)?("+uB0.join("|")+")"}]},J.CSS_VARIABLE,{className:"attribute",begin:"\\b("+pB0.join("|")+")\\b"},{begin:/:/,end:/[;}{]/,contains:[J.BLOCK_COMMENT,J.HEXCOLOR,J.IMPORTANT,J.CSS_NUMBER_MODE,...z,{begin:/(url|data-uri)\(/,end:/\)/,relevance:0,keywords:{built_in:"url data-uri"},contains:[...z,{className:"string",begin:/[^)]/,endsWithParent:!0,excludeEnd:!0}]},J.FUNCTION_DISPATCH]},{begin:Z.lookahead(/@/),end:"[{;]",relevance:0,illegal:/:/,contains:[{className:"keyword",begin:Q},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{$pattern:/[a-z-]+/,keyword:"and or not only",attribute:gB0.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...z,J.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+fB0.join("|")+")\\b"}]}}function Mc($){let Z=$.regex;return{name:"Diff",aliases:["patch"],contains:[{className:"meta",relevance:10,match:Z.either(/^@@ +-\d+,\d+ +\+\d+,\d+ +@@/,/^\*\*\* +\d+,\d+ +\*\*\*\*$/,/^--- +\d+,\d+ +----$/)},{className:"comment",variants:[{begin:Z.either(/Index: /,/^index/,/={3,}/,/^-{3}/,/^\*{3} /,/^\+{3}/,/^diff --git/),end:/$/},{match:/^\*{15}$/}]},{className:"addition",begin:/^\+/,end:/$/},{className:"deletion",begin:/^-/,end:/$/},{className:"addition",begin:/^!/,end:/$/}]}}function Pc($){let Q={keyword:["break","case","chan","const","continue","default","defer","else","fallthrough","for","func","go","goto","if","import","interface","map","package","range","return","select","struct","switch","type","var"],type:["bool","byte","complex64","complex128","error","float32","float64","int8","int16","int32","int64","string","uint8","uint16","uint32","uint64","int","uint","uintptr","rune"],literal:["true","false","iota","nil"],built_in:["append","cap","close","complex","copy","imag","len","make","new","panic","print","println","real","recover","delete"]};return{name:"Go",aliases:["golang"],keywords:Q,illegal:"</",contains:[$.C_LINE_COMMENT_MODE,$.C_BLOCK_COMMENT_MODE,{className:"string",variants:[$.QUOTE_STRING_MODE,$.APOS_STRING_MODE,{begin:"`",end:"`"}]},{className:"number",variants:[{match:/-?\b0[xX]\.[a-fA-F0-9](_?[a-fA-F0-9])*[pP][+-]?\d(_?\d)*i?/,relevance:0},{match:/-?\b0[xX](_?[a-fA-F0-9])+((\.([a-fA-F0-9](_?[a-fA-F0-9])*)?)?[pP][+-]?\d(_?\d)*)?i?/,relevance:0},{match:/-?\b0[oO](_?[0-7])*i?/,relevance:0},{match:/-?\.\d(_?\d)*([eE][+-]?\d(_?\d)*)?i?/,relevance:0},{match:/-?\b\d(_?\d)*(\.(\d(_?\d)*)?)?([eE][+-]?\d(_?\d)*)?i?/,relevance:0}]},{begin:/:=/},{className:"function",beginKeywords:"func",end:"\\s*(\\{|$)",excludeEnd:!0,contains:[$.TITLE_MODE,{className:"params",begin:/\(/,end:/\)/,endsParent:!0,keywords:Q,illegal:/["']/}]}]}}function _c($){let Z=$.regex,J=/[_A-Za-z][_0-9A-Za-z]*/;return{name:"GraphQL",aliases:["gql"],case_insensitive:!0,disableAutodetect:!1,keywords:{keyword:["query","mutation","subscription","type","input","schema","directive","interface","union","scalar","fragment","enum","on"],literal:["true","false","null"]},contains:[$.HASH_COMMENT_MODE,$.QUOTE_STRING_MODE,$.NUMBER_MODE,{scope:"punctuation",match:/[.]{3}/,relevance:0},{scope:"punctuation",begin:/[\!\(\)\:\=\[\]\{\|\}]{1}/,relevance:0},{scope:"variable",begin:/\$/,end:/\W/,excludeEnd:!0,relevance:0},{scope:"meta",match:/@\w+/,excludeEnd:!0},{scope:"symbol",begin:Z.concat(J,Z.lookahead(/\s*:/)),relevance:0}],illegal:[/[;<']/,/BEGIN/]}}function Oc($){let Z=$.regex,J={className:"number",relevance:0,variants:[{begin:/([+-]+)?[\d]+_[\d_]+/},{begin:$.NUMBER_RE}]},H=$.COMMENT();H.variants=[{begin:/;/,end:/$/},{begin:/#/,end:/$/}];let B={className:"variable",variants:[{begin:/\$[\w\d"][\w\d_]*/},{begin:/\$\{(.*?)\}/}]},Q={className:"literal",begin:/\bon|off|true|false|yes|no\b/},X={className:"string",contains:[$.BACKSLASH_ESCAPE],variants:[{begin:"'''",end:"'''",relevance:10},{begin:'"""',end:'"""',relevance:10},{begin:'"',end:'"'},{begin:"'",end:"'"}]},z={begin:/\[/,end:/\]/,contains:[H,Q,B,X,J,"self"],relevance:0},G=/[A-Za-z0-9_-]+/,U=/"(\\"|[^"])*"/,Y=/'[^']*'/,F=Z.either(G,U,Y),K=Z.concat(F,"(\\s*\\.\\s*",F,")*",Z.lookahead(/\s*=\s*[^#\s]/));return{name:"TOML, also INI",aliases:["toml"],case_insensitive:!0,illegal:/\S/,contains:[H,{className:"section",begin:/\[+/,end:/\]+/},{begin:K,className:"attr",starts:{end:/$/,contains:[H,z,Q,B,X,J]}}]}}var mH="[0-9](_*[0-9])*",ZN=`\\.(${mH})`,JN="[0-9a-fA-F](_*[0-9a-fA-F])*",Tc={className:"number",variants:[{begin:`(\\b(${mH})((${ZN})|\\.)?|(${ZN}))[eE][+-]?(${mH})[fFdD]?\\b`},{begin:`\\b(${mH})((${ZN})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${ZN})[fFdD]?\\b`},{begin:`\\b(${mH})[fFdD]\\b`},{begin:`\\b0[xX]((${JN})\\.?|(${JN})?\\.(${JN}))[pP][+-]?(${mH})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${JN})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function jc($,Z,J){if(J===-1)return"";return $.replace(Z,(H)=>{return jc($,Z,J-1)})}function Cc($){let Z=$.regex,J="[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*",H="[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*"+jc("(?:<"+"[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*"+"~~~(?:\\s*,\\s*"+"[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*"+"~~~)*>)?",/~~~/g,2),G={keyword:["synchronized","abstract","private","var","static","if","const ","for","while","strictfp","finally","protected","import","native","final","void","enum","else","break","transient","catch","instanceof","volatile","case","assert","package","default","public","try","switch","continue","throws","protected","public","private","module","requires","exports","do","sealed","yield","permits","goto","when"],literal:["false","true","null"],type:["char","boolean","long","float","int","byte","short","double"],built_in:["super","this"]},U={className:"meta",begin:"@"+"[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*",contains:[{begin:/\(/,end:/\)/,contains:["self"]}]},Y={className:"params",begin:/\(/,end:/\)/,keywords:G,relevance:0,contains:[$.C_BLOCK_COMMENT_MODE],endsParent:!0};return{name:"Java",aliases:["jsp"],keywords:G,illegal:/<\/|#/,contains:[$.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{begin:/\w+@/,relevance:0},{className:"doctag",begin:"@[A-Za-z]+"}]}),{begin:/import java\.[a-z]+\./,keywords:"import",relevance:2},$.C_LINE_COMMENT_MODE,$.C_BLOCK_COMMENT_MODE,{begin:/"""/,end:/"""/,className:"string",contains:[$.BACKSLASH_ESCAPE]},$.APOS_STRING_MODE,$.QUOTE_STRING_MODE,{match:[/\b(?:class|interface|enum|extends|implements|new)/,/\s+/,"[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*"],className:{1:"keyword",3:"title.class"}},{match:/non-sealed/,scope:"keyword"},{begin:[Z.concat(/(?!else)/,"[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*"),/\s+/,"[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*",/\s+/,/=(?!=)/],className:{1:"type",3:"variable",5:"operator"}},{begin:[/record/,/\s+/,"[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*"],className:{1:"keyword",3:"title.class"},contains:[Y,$.C_LINE_COMMENT_MODE,$.C_BLOCK_COMMENT_MODE]},{beginKeywords:"new throw return else",relevance:0},{begin:["(?:"+H+"\\s+)",$.UNDERSCORE_IDENT_RE,/\s*(?=\()/],className:{2:"title.function"},keywords:G,contains:[{className:"params",begin:/\(/,end:/\)/,keywords:G,relevance:0,contains:[U,$.APOS_STRING_MODE,$.QUOTE_STRING_MODE,Tc,$.C_BLOCK_COMMENT_MODE]},$.C_LINE_COMMENT_MODE,$.C_BLOCK_COMMENT_MODE]},Tc,U]}}var cB0=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],dB0=["true","false","null","undefined","NaN","Infinity"],Ec=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],bc=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],wc=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],lB0=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],iB0=[].concat(wc,Ec,bc);function Sc($){let Z=$.regex,J=(v,{after:f})=>{let b="</"+v[0].slice(1);return v.input.indexOf(b,f)!==-1},H="[A-Za-z$_][0-9A-Za-z$_]*",B={begin:"<>",end:"</>"},Q=/<[A-Za-z0-9\\._:-]+\s*\/>/,X={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(v,f)=>{let b=v[0].length+v.index,l=v.input[b];if(l==="<"||l===","){f.ignoreMatch();return}if(l===">"){if(!J(v,{after:b}))f.ignoreMatch()}let r,h=v.input.substring(b);if(r=h.match(/^\s*=/)){f.ignoreMatch();return}if(r=h.match(/^\s+extends\s+/)){if(r.index===0){f.ignoreMatch();return}}}},z={$pattern:"[A-Za-z$_][0-9A-Za-z$_]*",keyword:cB0,literal:dB0,built_in:iB0,"variable.language":lB0},G="[0-9](_?[0-9])*",U="\\.([0-9](_?[0-9])*)",Y="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",F={className:"number",variants:[{begin:"(\\b(0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*)((\\.([0-9](_?[0-9])*))|\\.)?|(\\.([0-9](_?[0-9])*)))[eE][+-]?([0-9](_?[0-9])*)\\b"},{begin:"\\b(0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*)\\b((\\.([0-9](_?[0-9])*))\\b|\\.)?|(\\.([0-9](_?[0-9])*))\\b"},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},K={className:"subst",begin:"\\$\\{",end:"\\}",keywords:z,contains:[]},W={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[$.BACKSLASH_ESCAPE,K],subLanguage:"xml"}},N={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[$.BACKSLASH_ESCAPE,K],subLanguage:"css"}},q={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[$.BACKSLASH_ESCAPE,K],subLanguage:"graphql"}},D={className:"string",begin:"`",end:"`",contains:[$.BACKSLASH_ESCAPE,K]},V={className:"comment",variants:[$.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:"[A-Za-z$_][0-9A-Za-z$_]*(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),$.C_BLOCK_COMMENT_MODE,$.C_LINE_COMMENT_MODE]},L=[$.APOS_STRING_MODE,$.QUOTE_STRING_MODE,W,N,q,D,{match:/\$\d+/},F];K.contains=L.concat({begin:/\{/,end:/\}/,keywords:z,contains:["self"].concat(L)});let O=[].concat(V,K.contains),M=O.concat([{begin:/(\s*)\(/,end:/\)/,keywords:z,contains:["self"].concat(O)}]),_={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:z,contains:M},w={variants:[{match:[/class/,/\s+/,"[A-Za-z$_][0-9A-Za-z$_]*",/\s+/,/extends/,/\s+/,Z.concat("[A-Za-z$_][0-9A-Za-z$_]*","(",Z.concat(/\./,"[A-Za-z$_][0-9A-Za-z$_]*"),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,"[A-Za-z$_][0-9A-Za-z$_]*"],scope:{1:"keyword",3:"title.class"}}]},C={relevance:0,match:Z.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...Ec,...bc]}},E={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},T={variants:[{match:[/function/,/\s+/,"[A-Za-z$_][0-9A-Za-z$_]*",/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[_],illegal:/%/},k={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function S(v){return Z.concat("(?!",v.join("|"),")")}let I={match:Z.concat(/\b/,S([...wc,"super","import"].map((v)=>`${v}\\s*\\(`)),"[A-Za-z$_][0-9A-Za-z$_]*",Z.lookahead(/\s*\(/)),className:"title.function",relevance:0},j={begin:Z.concat(/\./,Z.lookahead(Z.concat("[A-Za-z$_][0-9A-Za-z$_]*",/(?![0-9A-Za-z$_(])/))),end:"[A-Za-z$_][0-9A-Za-z$_]*",excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},y={match:[/get|set/,/\s+/,"[A-Za-z$_][0-9A-Za-z$_]*",/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},_]},R="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+$.UNDERSCORE_IDENT_RE+")\\s*=>",x={match:[/const|var|let/,/\s+/,"[A-Za-z$_][0-9A-Za-z$_]*",/\s*/,/=\s*/,/(async\s*)?/,Z.lookahead(R)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[_]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:z,exports:{PARAMS_CONTAINS:M,CLASS_REFERENCE:C},illegal:/#(?![$_A-z])/,contains:[$.SHEBANG({label:"shebang",binary:"node",relevance:5}),E,$.APOS_STRING_MODE,$.QUOTE_STRING_MODE,W,N,q,D,V,{match:/\$\d+/},F,C,{scope:"attr",match:"[A-Za-z$_][0-9A-Za-z$_]*"+Z.lookahead(":"),relevance:0},x,{begin:"("+$.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[V,$.REGEXP_MODE,{className:"function",begin:R,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:$.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:z,contains:M}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:B.begin,end:B.end},{match:Q},{begin:X.begin,"on:begin":X.isTrulyOpeningTag,end:X.end}],subLanguage:"xml",contains:[{begin:X.begin,end:X.end,skip:!0,contains:["self"]}]}]},T,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+$.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[_,$.inherit($.TITLE_MODE,{begin:"[A-Za-z$_][0-9A-Za-z$_]*",className:"title.function"})]},{match:/\.\.\./,relevance:0},j,{match:"\\$[A-Za-z$_][0-9A-Za-z$_]*",relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[_]},I,k,w,y,{match:/\$[(.]/}]}}function Rc($){let Z={className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},J={match:/[{}[\],:]/,className:"punctuation",relevance:0},H=["true","false","null"],B={scope:"literal",beginKeywords:H.join(" ")};return{name:"JSON",aliases:["jsonc"],keywords:{literal:H},contains:[Z,J,$.QUOTE_STRING_MODE,B,$.C_NUMBER_MODE,$.C_LINE_COMMENT_MODE,$.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}var uH="[0-9](_*[0-9])*",HN=`\\.(${uH})`,BN="[0-9a-fA-F](_*[0-9a-fA-F])*",rB0={className:"number",variants:[{begin:`(\\b(${uH})((${HN})|\\.)?|(${HN}))[eE][+-]?(${uH})[fFdD]?\\b`},{begin:`\\b(${uH})((${HN})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${HN})[fFdD]?\\b`},{begin:`\\b(${uH})[fFdD]\\b`},{begin:`\\b0[xX]((${BN})\\.?|(${BN})?\\.(${BN}))[pP][+-]?(${uH})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${BN})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function Ic($){let Z={keyword:"abstract as val var vararg get set class object open private protected public noinline crossinline dynamic final enum if else do while for when throw try catch finally import package is in fun override companion reified inline lateinit init interface annotation data sealed internal infix operator out by constructor super tailrec where const inner suspend typealias external expect actual",built_in:"Byte Short Char Int Long Boolean Float Double Void Unit Nothing",literal:"true false null"},J={className:"keyword",begin:/\b(break|continue|return|this)\b/,starts:{contains:[{className:"symbol",begin:/@\w+/}]}},H={className:"symbol",begin:$.UNDERSCORE_IDENT_RE+"@"},B={className:"subst",begin:/\$\{/,end:/\}/,contains:[$.C_NUMBER_MODE]},Q={className:"variable",begin:"\\$"+$.UNDERSCORE_IDENT_RE},X={className:"string",variants:[{begin:'"""',end:'"""(?=[^"])',contains:[Q,B]},{begin:"'",end:"'",illegal:/\n/,contains:[$.BACKSLASH_ESCAPE]},{begin:'"',end:'"',illegal:/\n/,contains:[$.BACKSLASH_ESCAPE,Q,B]}]};B.contains.push(X);let z={className:"meta",begin:"@(?:file|property|field|get|set|receiver|param|setparam|delegate)\\s*:(?:\\s*"+$.UNDERSCORE_IDENT_RE+")?"},G={className:"meta",begin:"@"+$.UNDERSCORE_IDENT_RE,contains:[{begin:/\(/,end:/\)/,contains:[$.inherit(X,{className:"string"}),"self"]}]},U=rB0,Y=$.COMMENT("/\\*","\\*/",{contains:[$.C_BLOCK_COMMENT_MODE]}),F={variants:[{className:"type",begin:$.UNDERSCORE_IDENT_RE},{begin:/\(/,end:/\)/,contains:[]}]},K=F;return K.variants[1].contains=[F],F.variants[1].contains=[K],{name:"Kotlin",aliases:["kt","kts"],keywords:Z,contains:[$.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"}]}),$.C_LINE_COMMENT_MODE,Y,J,H,z,G,{className:"function",beginKeywords:"fun",end:"[(]|$",returnBegin:!0,excludeEnd:!0,keywords:Z,relevance:5,contains:[{begin:$.UNDERSCORE_IDENT_RE+"\\s*\\(",returnBegin:!0,relevance:0,contains:[$.UNDERSCORE_TITLE_MODE]},{className:"type",begin:/</,end:/>/,keywords:"reified",relevance:0},{className:"params",begin:/\(/,end:/\)/,endsParent:!0,keywords:Z,relevance:0,contains:[{begin:/:/,end:/[=,\/]/,endsWithParent:!0,contains:[F,$.C_LINE_COMMENT_MODE,Y],relevance:0},$.C_LINE_COMMENT_MODE,Y,z,G,X,$.C_NUMBER_MODE]},Y]},{begin:[/class|interface|trait/,/\s+/,$.UNDERSCORE_IDENT_RE],beginScope:{3:"title.class"},keywords:"class interface trait",end:/[:\{(]|$/,excludeEnd:!0,illegal:"extends implements",contains:[{beginKeywords:"public protected internal private constructor"},$.UNDERSCORE_TITLE_MODE,{className:"type",begin:/</,end:/>/,excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:/[,:]\s*/,end:/[<\(,){\s]|$/,excludeBegin:!0,returnEnd:!0},z,G]},X,{className:"meta",begin:"^#!/usr/bin/env",end:"$",illegal:`
|
|
34
|
+
`},U]}}var aB0=($)=>{return{IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:$.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[$.APOS_STRING_MODE,$.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:$.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}},oB0=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],nB0=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],sB0=[...oB0,...nB0],tB0=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),kc=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),yc=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),eB0=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse(),$Q0=kc.concat(yc).sort().reverse();function xc($){let Z=aB0($),J=$Q0,H="and or not only",B="[\\w-]+",Q="([\\w-]+|@\\{[\\w-]+\\})",X=[],z=[],G=function(L){return{className:"string",begin:"~?"+L+".*?"+L}},U=function(L,O,M){return{className:L,begin:O,relevance:M}},Y={$pattern:/[a-z-]+/,keyword:"and or not only",attribute:tB0.join(" ")},F={begin:"\\(",end:"\\)",contains:z,keywords:Y,relevance:0};z.push($.C_LINE_COMMENT_MODE,$.C_BLOCK_COMMENT_MODE,G("'"),G('"'),Z.CSS_NUMBER_MODE,{begin:"(url|data-uri)\\(",starts:{className:"string",end:"[\\)\\n]",excludeEnd:!0}},Z.HEXCOLOR,F,U("variable","@@?[\\w-]+",10),U("variable","@\\{[\\w-]+\\}"),U("built_in","~?`[^`]*?`"),{className:"attribute",begin:"[\\w-]+\\s*:",end:":",returnBegin:!0,excludeEnd:!0},Z.IMPORTANT,{beginKeywords:"and not"},Z.FUNCTION_DISPATCH);let K=z.concat({begin:/\{/,end:/\}/,contains:X}),W={beginKeywords:"when",endsWithParent:!0,contains:[{beginKeywords:"and not"}].concat(z)},N={begin:Q+"\\s*:",returnBegin:!0,end:/[;}]/,relevance:0,contains:[{begin:/-(webkit|moz|ms|o)-/},Z.CSS_VARIABLE,{className:"attribute",begin:"\\b("+eB0.join("|")+")\\b",end:/(?=:)/,starts:{endsWithParent:!0,illegal:"[<=$]",relevance:0,contains:z}}]},q={className:"keyword",begin:"@(import|media|charset|font-face|(-[a-z]+-)?keyframes|supports|document|namespace|page|viewport|host)\\b",starts:{end:"[;{}]",keywords:Y,returnEnd:!0,contains:z,relevance:0}},D={className:"variable",variants:[{begin:"@[\\w-]+\\s*:",relevance:15},{begin:"@[\\w-]+"}],starts:{end:"[;}]",returnEnd:!0,contains:K}},A={variants:[{begin:"[\\.#:&\\[>]",end:"[;{}]"},{begin:Q,end:/\{/}],returnBegin:!0,returnEnd:!0,illegal:`[<='$"]`,relevance:0,contains:[$.C_LINE_COMMENT_MODE,$.C_BLOCK_COMMENT_MODE,W,U("keyword","all\\b"),U("variable","@\\{[\\w-]+\\}"),{begin:"\\b("+sB0.join("|")+")\\b",className:"selector-tag"},Z.CSS_NUMBER_MODE,U("selector-tag",Q,0),U("selector-id","#"+Q),U("selector-class","\\."+Q,0),U("selector-tag","&",0),Z.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",begin:":("+kc.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+yc.join("|")+")"},{begin:/\(/,end:/\)/,relevance:0,contains:K},{begin:"!important"},Z.FUNCTION_DISPATCH]},V={begin:`[\\w-]+:(:)?(${J.join("|")})`,returnBegin:!0,contains:[A]};return X.push($.C_LINE_COMMENT_MODE,$.C_BLOCK_COMMENT_MODE,q,D,V,N,A,W,Z.FUNCTION_DISPATCH),{name:"Less",case_insensitive:!0,illegal:`[=>'/<($"]`,contains:X}}function hc($){let H={begin:"\\[=*\\[",end:"\\]=*\\]",contains:["self"]},B=[$.COMMENT("--(?!\\[=*\\[)","$"),$.COMMENT("--\\[=*\\[","\\]=*\\]",{contains:[H],relevance:10})];return{name:"Lua",aliases:["pluto"],keywords:{$pattern:$.UNDERSCORE_IDENT_RE,literal:"true false nil",keyword:"and break do else elseif end for goto if in local not or repeat return then until while",built_in:"_G _ENV _VERSION __index __newindex __mode __call __metatable __tostring __len __gc __add __sub __mul __div __mod __pow __concat __unm __eq __lt __le assert collectgarbage dofile error getfenv getmetatable ipairs load loadfile loadstring module next pairs pcall print rawequal rawget rawset require select setfenv setmetatable tonumber tostring type unpack xpcall arg self coroutine resume yield status wrap create running debug getupvalue debug sethook getmetatable gethook setmetatable setlocal traceback setfenv getinfo setupvalue getlocal getregistry getfenv io lines write close flush open output type read stderr stdin input stdout popen tmpfile math log max acos huge ldexp pi cos tanh pow deg tan cosh sinh random randomseed frexp ceil floor rad abs sqrt modf asin min mod fmod log10 atan2 exp sin atan os exit setlocale date getenv difftime remove time clock tmpname rename execute package preload loadlib loaded loaders cpath config path seeall string sub upper len gfind rep find match char dump gmatch reverse byte format gsub lower table setn insert getn foreachi maxn foreach concat sort remove"},contains:B.concat([{className:"function",beginKeywords:"function",end:"\\)",contains:[$.inherit($.TITLE_MODE,{begin:"([_a-zA-Z]\\w*\\.)*([_a-zA-Z]\\w*:)?[_a-zA-Z]\\w*"}),{className:"params",begin:"\\(",endsWithParent:!0,contains:B}].concat(B)},$.C_NUMBER_MODE,$.APOS_STRING_MODE,$.QUOTE_STRING_MODE,{className:"string",begin:"\\[=*\\[",end:"\\]=*\\]",contains:[H],relevance:5}])}}function vc($){let Z={className:"variable",variants:[{begin:"\\$\\("+$.UNDERSCORE_IDENT_RE+"\\)",contains:[$.BACKSLASH_ESCAPE]},{begin:/\$[@%<?\^\+\*]/}]},J={className:"string",begin:/"/,end:/"/,contains:[$.BACKSLASH_ESCAPE,Z]},H={className:"variable",begin:/\$\([\w-]+\s/,end:/\)/,keywords:{built_in:"subst patsubst strip findstring filter filter-out sort word wordlist firstword lastword dir notdir suffix basename addsuffix addprefix join wildcard realpath abspath error warning shell origin flavor foreach if or and call eval file value"},contains:[Z,J]},B={begin:"^"+$.UNDERSCORE_IDENT_RE+"\\s*(?=[:+?]?=)"},Q={className:"meta",begin:/^\.PHONY:/,end:/$/,keywords:{$pattern:/[\.\w]+/,keyword:".PHONY"}},X={className:"section",begin:/^[^\s]+:/,end:/$/,contains:[Z]};return{name:"Makefile",aliases:["mk","mak","make"],keywords:{$pattern:/[\w-]+/,keyword:"define endef undefine ifdef ifndef ifeq ifneq else endif include -include sinclude override export unexport private vpath"},contains:[$.HASH_COMMENT_MODE,Z,J,H,B,Q,X]}}function fc($){let Z=$.regex,J={begin:/<\/?[A-Za-z_]/,end:">",subLanguage:"xml",relevance:0},H={begin:"^[-\\*]{3,}",end:"$"},B={className:"code",variants:[{begin:"(`{3,})[^`](.|\\n)*?\\1`*[ ]*"},{begin:"(~{3,})[^~](.|\\n)*?\\1~*[ ]*"},{begin:"```",end:"```+[ ]*$"},{begin:"~~~",end:"~~~+[ ]*$"},{begin:"`.+?`"},{begin:"(?=^( {4}|\\t))",contains:[{begin:"^( {4}|\\t)",end:"(\\n)$"}],relevance:0}]},Q={className:"bullet",begin:"^[ \t]*([*+-]|(\\d+\\.))(?=\\s+)",end:"\\s+",excludeEnd:!0},X={begin:/^\[[^\n]+\]:/,returnBegin:!0,contains:[{className:"symbol",begin:/\[/,end:/\]/,excludeBegin:!0,excludeEnd:!0},{className:"link",begin:/:\s*/,end:/$/,excludeBegin:!0}]},z=/[A-Za-z][A-Za-z0-9+.-]*/,G={variants:[{begin:/\[.+?\]\[.*?\]/,relevance:0},{begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,relevance:2},{begin:Z.concat(/\[.+?\]\(/,z,/:\/\/.*?\)/),relevance:2},{begin:/\[.+?\]\([./?&#].*?\)/,relevance:1},{begin:/\[.*?\]\(.*?\)/,relevance:0}],returnBegin:!0,contains:[{match:/\[(?=\])/},{className:"string",relevance:0,begin:"\\[",end:"\\]",excludeBegin:!0,returnEnd:!0},{className:"link",relevance:0,begin:"\\]\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0},{className:"symbol",relevance:0,begin:"\\]\\[",end:"\\]",excludeBegin:!0,excludeEnd:!0}]},U={className:"strong",contains:[],variants:[{begin:/_{2}(?!\s)/,end:/_{2}/},{begin:/\*{2}(?!\s)/,end:/\*{2}/}]},Y={className:"emphasis",contains:[],variants:[{begin:/\*(?![*\s])/,end:/\*/},{begin:/_(?![_\s])/,end:/_/,relevance:0}]},F=$.inherit(U,{contains:[]}),K=$.inherit(Y,{contains:[]});U.contains.push(K),Y.contains.push(F);let W=[J,G];return[U,Y,F,K].forEach((A)=>{A.contains=A.contains.concat(W)}),W=W.concat(U,Y),{name:"Markdown",aliases:["md","mkdown","mkd"],contains:[{className:"section",variants:[{begin:"^#{1,6}",end:"$",contains:W},{begin:"(?=^.+?\\n[=-]{2,}$)",contains:[{begin:"^[=-]*$"},{begin:"^",end:"\\n",contains:W}]}]},J,Q,U,Y,{className:"quote",begin:"^>\\s+",contains:W,end:"$"},B,H,G,X,{scope:"literal",match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}function gc($){let Z={className:"built_in",begin:"\\b(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)\\w+"},J=/[a-zA-Z@][a-zA-Z0-9_]*/,z={"variable.language":["this","super"],$pattern:J,keyword:["while","export","sizeof","typedef","const","struct","for","union","volatile","static","mutable","if","do","return","goto","enum","else","break","extern","asm","case","default","register","explicit","typename","switch","continue","inline","readonly","assign","readwrite","self","@synchronized","id","typeof","nonatomic","IBOutlet","IBAction","strong","weak","copy","in","out","inout","bycopy","byref","oneway","__strong","__weak","__block","__autoreleasing","@private","@protected","@public","@try","@property","@end","@throw","@catch","@finally","@autoreleasepool","@synthesize","@dynamic","@selector","@optional","@required","@encode","@package","@import","@defs","@compatibility_alias","__bridge","__bridge_transfer","__bridge_retained","__bridge_retain","__covariant","__contravariant","__kindof","_Nonnull","_Nullable","_Null_unspecified","__FUNCTION__","__PRETTY_FUNCTION__","__attribute__","getter","setter","retain","unsafe_unretained","nonnull","nullable","null_unspecified","null_resettable","class","instancetype","NS_DESIGNATED_INITIALIZER","NS_UNAVAILABLE","NS_REQUIRES_SUPER","NS_RETURNS_INNER_POINTER","NS_INLINE","NS_AVAILABLE","NS_DEPRECATED","NS_ENUM","NS_OPTIONS","NS_SWIFT_UNAVAILABLE","NS_ASSUME_NONNULL_BEGIN","NS_ASSUME_NONNULL_END","NS_REFINED_FOR_SWIFT","NS_SWIFT_NAME","NS_SWIFT_NOTHROW","NS_DURING","NS_HANDLER","NS_ENDHANDLER","NS_VALUERETURN","NS_VOIDRETURN"],literal:["false","true","FALSE","TRUE","nil","YES","NO","NULL"],built_in:["dispatch_once_t","dispatch_queue_t","dispatch_sync","dispatch_async","dispatch_once"],type:["int","float","char","unsigned","signed","short","long","double","wchar_t","unichar","void","bool","BOOL","id|0","_Bool"]},G={$pattern:J,keyword:["@interface","@class","@protocol","@implementation"]};return{name:"Objective-C",aliases:["mm","objc","obj-c","obj-c++","objective-c++"],keywords:z,illegal:"</",contains:[Z,$.C_LINE_COMMENT_MODE,$.C_BLOCK_COMMENT_MODE,$.C_NUMBER_MODE,$.QUOTE_STRING_MODE,$.APOS_STRING_MODE,{className:"string",variants:[{begin:'@"',end:'"',illegal:"\\n",contains:[$.BACKSLASH_ESCAPE]}]},{className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},$.inherit($.QUOTE_STRING_MODE,{className:"string"}),{className:"string",begin:/<.*?>/,end:/$/,illegal:"\\n"},$.C_LINE_COMMENT_MODE,$.C_BLOCK_COMMENT_MODE]},{className:"class",begin:"("+G.keyword.join("|")+")\\b",end:/(\{|$)/,excludeEnd:!0,keywords:G,contains:[$.UNDERSCORE_TITLE_MODE]},{begin:"\\."+$.UNDERSCORE_IDENT_RE,relevance:0}]}}function mc($){let Z=$.regex,J=["abs","accept","alarm","and","atan2","bind","binmode","bless","break","caller","chdir","chmod","chomp","chop","chown","chr","chroot","class","close","closedir","connect","continue","cos","crypt","dbmclose","dbmopen","defined","delete","die","do","dump","each","else","elsif","endgrent","endhostent","endnetent","endprotoent","endpwent","endservent","eof","eval","exec","exists","exit","exp","fcntl","field","fileno","flock","for","foreach","fork","format","formline","getc","getgrent","getgrgid","getgrnam","gethostbyaddr","gethostbyname","gethostent","getlogin","getnetbyaddr","getnetbyname","getnetent","getpeername","getpgrp","getpriority","getprotobyname","getprotobynumber","getprotoent","getpwent","getpwnam","getpwuid","getservbyname","getservbyport","getservent","getsockname","getsockopt","given","glob","gmtime","goto","grep","gt","hex","if","index","int","ioctl","join","keys","kill","last","lc","lcfirst","length","link","listen","local","localtime","log","lstat","lt","ma","map","method","mkdir","msgctl","msgget","msgrcv","msgsnd","my","ne","next","no","not","oct","open","opendir","or","ord","our","pack","package","pipe","pop","pos","print","printf","prototype","push","q|0","qq","quotemeta","qw","qx","rand","read","readdir","readline","readlink","readpipe","recv","redo","ref","rename","require","reset","return","reverse","rewinddir","rindex","rmdir","say","scalar","seek","seekdir","select","semctl","semget","semop","send","setgrent","sethostent","setnetent","setpgrp","setpriority","setprotoent","setpwent","setservent","setsockopt","shift","shmctl","shmget","shmread","shmwrite","shutdown","sin","sleep","socket","socketpair","sort","splice","split","sprintf","sqrt","srand","stat","state","study","sub","substr","symlink","syscall","sysopen","sysread","sysseek","system","syswrite","tell","telldir","tie","tied","time","times","tr","truncate","uc","ucfirst","umask","undef","unless","unlink","unpack","unshift","untie","until","use","utime","values","vec","wait","waitpid","wantarray","warn","when","while","write","x|0","xor","y|0"],H=/[dualxmsipngr]{0,12}/,B={$pattern:/[\w.]+/,keyword:J.join(" ")},Q={className:"subst",begin:"[$@]\\{",end:"\\}",keywords:B},X={begin:/->\{/,end:/\}/},z={scope:"attr",match:/\s+:\s*\w+(\s*\(.*?\))?/},G={scope:"variable",variants:[{begin:/\$\d/},{begin:Z.concat(/[$%@](?!")(\^\w\b|#\w+(::\w+)*|\{\w+\}|\w+(::\w*)*)/,"(?![A-Za-z])(?![@$%])")},{begin:/[$%@](?!")[^\s\w{=]|\$=/,relevance:0}],contains:[z]},U={className:"number",variants:[{match:/0?\.[0-9][0-9_]+\b/},{match:/\bv?(0|[1-9][0-9_]*(\.[0-9_]+)?|[1-9][0-9_]*)\b/},{match:/\b0[0-7][0-7_]*\b/},{match:/\b0x[0-9a-fA-F][0-9a-fA-F_]*\b/},{match:/\b0b[0-1][0-1_]*\b/}],relevance:0},Y=[$.BACKSLASH_ESCAPE,Q,G],F=[/!/,/\//,/\|/,/\?/,/'/,/"/,/#/],K=(q,D,A="\\1")=>{let V=A==="\\1"?A:Z.concat(A,D);return Z.concat(Z.concat("(?:",q,")"),D,/(?:\\.|[^\\\/])*?/,V,/(?:\\.|[^\\\/])*?/,A,H)},W=(q,D,A)=>{return Z.concat(Z.concat("(?:",q,")"),D,/(?:\\.|[^\\\/])*?/,A,H)},N=[G,$.HASH_COMMENT_MODE,$.COMMENT(/^=\w/,/=cut/,{endsWithParent:!0}),X,{className:"string",contains:Y,variants:[{begin:"q[qwxr]?\\s*\\(",end:"\\)",relevance:5},{begin:"q[qwxr]?\\s*\\[",end:"\\]",relevance:5},{begin:"q[qwxr]?\\s*\\{",end:"\\}",relevance:5},{begin:"q[qwxr]?\\s*\\|",end:"\\|",relevance:5},{begin:"q[qwxr]?\\s*<",end:">",relevance:5},{begin:"qw\\s+q",end:"q",relevance:5},{begin:"'",end:"'",contains:[$.BACKSLASH_ESCAPE]},{begin:'"',end:'"'},{begin:"`",end:"`",contains:[$.BACKSLASH_ESCAPE]},{begin:/\{\w+\}/,relevance:0},{begin:"-?\\w+\\s*=>",relevance:0}]},U,{begin:"(\\/\\/|"+$.RE_STARTERS_RE+"|\\b(split|return|print|reverse|grep)\\b)\\s*",keywords:"split return print reverse grep",relevance:0,contains:[$.HASH_COMMENT_MODE,{className:"regexp",variants:[{begin:K("s|tr|y",Z.either(...F,{capture:!0}))},{begin:K("s|tr|y","\\(","\\)")},{begin:K("s|tr|y","\\[","\\]")},{begin:K("s|tr|y","\\{","\\}")}],relevance:2},{className:"regexp",variants:[{begin:/(m|qr)\/\//,relevance:0},{begin:W("(?:m|qr)?",/\//,/\//)},{begin:W("m|qr",Z.either(...F,{capture:!0}),/\1/)},{begin:W("m|qr",/\(/,/\)/)},{begin:W("m|qr",/\[/,/\]/)},{begin:W("m|qr",/\{/,/\}/)}]}]},{className:"function",beginKeywords:"sub method",end:"(\\s*\\(.*?\\))?[;{]",excludeEnd:!0,relevance:5,contains:[$.TITLE_MODE,z]},{className:"class",beginKeywords:"class",end:"[;{]",excludeEnd:!0,relevance:5,contains:[$.TITLE_MODE,z,U]},{begin:"-\\w\\b",relevance:0},{begin:"^__DATA__$",end:"^__END__$",subLanguage:"mojolicious",contains:[{begin:"^@@.*",end:"$",className:"comment"}]}];return Q.contains=N,X.contains=N,{name:"Perl",aliases:["pl","pm"],keywords:B,contains:N}}function uc($){let Z=$.regex,J=/(?![A-Za-z0-9])(?![$])/,H=Z.concat(/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/,J),B=Z.concat(/(\\?[A-Z][a-z0-9_\x7f-\xff]+|\\?[A-Z]+(?=[A-Z][a-z0-9_\x7f-\xff])){1,}/,J),Q=Z.concat(/[A-Z]+/,J),X={scope:"variable",match:"\\$+"+H},z={scope:"meta",variants:[{begin:/<\?php/,relevance:10},{begin:/<\?=/},{begin:/<\?/,relevance:0.1},{begin:/\?>/}]},G={scope:"subst",variants:[{begin:/\$\w+/},{begin:/\{\$/,end:/\}/}]},U=$.inherit($.APOS_STRING_MODE,{illegal:null}),Y=$.inherit($.QUOTE_STRING_MODE,{illegal:null,contains:$.QUOTE_STRING_MODE.contains.concat(G)}),F={begin:/<<<[ \t]*(?:(\w+)|"(\w+)")\n/,end:/[ \t]*(\w+)\b/,contains:$.QUOTE_STRING_MODE.contains.concat(G),"on:begin":(j,y)=>{y.data._beginMatch=j[1]||j[2]},"on:end":(j,y)=>{if(y.data._beginMatch!==j[1])y.ignoreMatch()}},K=$.END_SAME_AS_BEGIN({begin:/<<<[ \t]*'(\w+)'\n/,end:/[ \t]*(\w+)\b/}),W=`[
|
|
35
|
+
]`,N={scope:"string",variants:[Y,U,F,K]},q={scope:"number",variants:[{begin:"\\b0[bB][01]+(?:_[01]+)*\\b"},{begin:"\\b0[oO][0-7]+(?:_[0-7]+)*\\b"},{begin:"\\b0[xX][\\da-fA-F]+(?:_[\\da-fA-F]+)*\\b"},{begin:"(?:\\b\\d+(?:_\\d+)*(\\.(?:\\d+(?:_\\d+)*))?|\\B\\.\\d+)(?:[eE][+-]?\\d+)?"}],relevance:0},D=["false","null","true"],A=["__CLASS__","__DIR__","__FILE__","__FUNCTION__","__COMPILER_HALT_OFFSET__","__LINE__","__METHOD__","__NAMESPACE__","__TRAIT__","die","echo","exit","include","include_once","print","require","require_once","array","abstract","and","as","binary","bool","boolean","break","callable","case","catch","class","clone","const","continue","declare","default","do","double","else","elseif","empty","enddeclare","endfor","endforeach","endif","endswitch","endwhile","enum","eval","extends","final","finally","float","for","foreach","from","global","goto","if","implements","instanceof","insteadof","int","integer","interface","isset","iterable","list","match|0","mixed","new","never","object","or","private","protected","public","readonly","real","return","string","switch","throw","trait","try","unset","use","var","void","while","xor","yield"],V=["Error|0","AppendIterator","ArgumentCountError","ArithmeticError","ArrayIterator","ArrayObject","AssertionError","BadFunctionCallException","BadMethodCallException","CachingIterator","CallbackFilterIterator","CompileError","Countable","DirectoryIterator","DivisionByZeroError","DomainException","EmptyIterator","ErrorException","Exception","FilesystemIterator","FilterIterator","GlobIterator","InfiniteIterator","InvalidArgumentException","IteratorIterator","LengthException","LimitIterator","LogicException","MultipleIterator","NoRewindIterator","OutOfBoundsException","OutOfRangeException","OuterIterator","OverflowException","ParentIterator","ParseError","RangeException","RecursiveArrayIterator","RecursiveCachingIterator","RecursiveCallbackFilterIterator","RecursiveDirectoryIterator","RecursiveFilterIterator","RecursiveIterator","RecursiveIteratorIterator","RecursiveRegexIterator","RecursiveTreeIterator","RegexIterator","RuntimeException","SeekableIterator","SplDoublyLinkedList","SplFileInfo","SplFileObject","SplFixedArray","SplHeap","SplMaxHeap","SplMinHeap","SplObjectStorage","SplObserver","SplPriorityQueue","SplQueue","SplStack","SplSubject","SplTempFileObject","TypeError","UnderflowException","UnexpectedValueException","UnhandledMatchError","ArrayAccess","BackedEnum","Closure","Fiber","Generator","Iterator","IteratorAggregate","Serializable","Stringable","Throwable","Traversable","UnitEnum","WeakReference","WeakMap","Directory","__PHP_Incomplete_Class","parent","php_user_filter","self","static","stdClass"],O={keyword:A,literal:((j)=>{let y=[];return j.forEach((R)=>{if(y.push(R),R.toLowerCase()===R)y.push(R.toUpperCase());else y.push(R.toLowerCase())}),y})(D),built_in:V},M=(j)=>{return j.map((y)=>{return y.replace(/\|\d+$/,"")})},_={variants:[{match:[/new/,Z.concat(`[
|
|
36
|
+
]`,"+"),Z.concat("(?!",M(V).join("\\b|"),"\\b)"),B],scope:{1:"keyword",4:"title.class"}}]},w=Z.concat(H,"\\b(?!\\()"),C={variants:[{match:[Z.concat(/::/,Z.lookahead(/(?!class\b)/)),w],scope:{2:"variable.constant"}},{match:[/::/,/class/],scope:{2:"variable.language"}},{match:[B,Z.concat(/::/,Z.lookahead(/(?!class\b)/)),w],scope:{1:"title.class",3:"variable.constant"}},{match:[B,Z.concat("::",Z.lookahead(/(?!class\b)/))],scope:{1:"title.class"}},{match:[B,/::/,/class/],scope:{1:"title.class",3:"variable.language"}}]},E={scope:"attr",match:Z.concat(H,Z.lookahead(":"),Z.lookahead(/(?!::)/))},T={relevance:0,begin:/\(/,end:/\)/,keywords:O,contains:[E,X,C,$.C_BLOCK_COMMENT_MODE,N,q,_]},k={relevance:0,match:[/\b/,Z.concat("(?!fn\\b|function\\b|",M(A).join("\\b|"),"|",M(V).join("\\b|"),"\\b)"),H,Z.concat(`[
|
|
37
|
+
]`,"*"),Z.lookahead(/(?=\()/)],scope:{3:"title.function.invoke"},contains:[T]};T.contains.push(k);let S=[E,C,$.C_BLOCK_COMMENT_MODE,N,q,_],I={begin:Z.concat(/#\[\s*\\?/,Z.either(B,Q)),beginScope:"meta",end:/]/,endScope:"meta",keywords:{literal:D,keyword:["new","array"]},contains:[{begin:/\[/,end:/]/,keywords:{literal:D,keyword:["new","array"]},contains:["self",...S]},...S,{scope:"meta",variants:[{match:B},{match:Q}]}]};return{case_insensitive:!1,keywords:O,contains:[I,$.HASH_COMMENT_MODE,$.COMMENT("//","$"),$.COMMENT("/\\*","\\*/",{contains:[{scope:"doctag",match:"@[A-Za-z]+"}]}),{match:/__halt_compiler\(\);/,keywords:"__halt_compiler",starts:{scope:"comment",end:$.MATCH_NOTHING_RE,contains:[{match:/\?>/,scope:"meta",endsParent:!0}]}},z,{scope:"variable.language",match:/\$this\b/},X,k,C,{match:[/const/,/\s/,H],scope:{1:"keyword",3:"variable.constant"}},_,{scope:"function",relevance:0,beginKeywords:"fn function",end:/[;{]/,excludeEnd:!0,illegal:"[$%\\[]",contains:[{beginKeywords:"use"},$.UNDERSCORE_TITLE_MODE,{begin:"=>",endsParent:!0},{scope:"params",begin:"\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0,keywords:O,contains:["self",I,X,C,$.C_BLOCK_COMMENT_MODE,N,q]}]},{scope:"class",variants:[{beginKeywords:"enum",illegal:/[($"]/},{beginKeywords:"class interface trait",illegal:/[:($"]/}],relevance:0,end:/\{/,excludeEnd:!0,contains:[{beginKeywords:"extends implements"},$.UNDERSCORE_TITLE_MODE]},{beginKeywords:"namespace",relevance:0,end:";",illegal:/[.']/,contains:[$.inherit($.UNDERSCORE_TITLE_MODE,{scope:"title.class"})]},{beginKeywords:"use",relevance:0,end:";",contains:[{match:/\b(as|const|function)\b/,scope:"keyword"},$.UNDERSCORE_TITLE_MODE]},N,q]}}function pc($){return{name:"PHP template",subLanguage:"xml",contains:[{begin:/<\?(php|=)?/,end:/\?>/,subLanguage:"php",contains:[{begin:"/\\*",end:"\\*/",skip:!0},{begin:'b"',end:'"',skip:!0},{begin:"b'",end:"'",skip:!0},$.inherit($.APOS_STRING_MODE,{illegal:null,className:null,contains:null,skip:!0}),$.inherit($.QUOTE_STRING_MODE,{illegal:null,className:null,contains:null,skip:!0})]}]}}function cc($){return{name:"Plain text",aliases:["text","txt"],disableAutodetect:!0}}function dc($){let Z=$.regex,J=/[\p{XID_Start}_]\p{XID_Continue}*/u,H=["and","as","assert","async","await","break","case","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","match","nonlocal|10","not","or","pass","raise","return","try","while","with","yield"],z={$pattern:/[A-Za-z]\w+|__\w+__/,keyword:H,built_in:["__import__","abs","all","any","ascii","bin","bool","breakpoint","bytearray","bytes","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","exec","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip"],literal:["__debug__","Ellipsis","False","None","NotImplemented","True"],type:["Any","Callable","Coroutine","Dict","List","Literal","Generic","Optional","Sequence","Set","Tuple","Type","Union"]},G={className:"meta",begin:/^(>>>|\.\.\.) /},U={className:"subst",begin:/\{/,end:/\}/,keywords:z,illegal:/#/},Y={begin:/\{\{/,relevance:0},F={className:"string",contains:[$.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[$.BACKSLASH_ESCAPE,G],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[$.BACKSLASH_ESCAPE,G],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[$.BACKSLASH_ESCAPE,G,Y,U]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[$.BACKSLASH_ESCAPE,G,Y,U]},{begin:/([uU]|[rR])'/,end:/'/,relevance:10},{begin:/([uU]|[rR])"/,end:/"/,relevance:10},{begin:/([bB]|[bB][rR]|[rR][bB])'/,end:/'/},{begin:/([bB]|[bB][rR]|[rR][bB])"/,end:/"/},{begin:/([fF][rR]|[rR][fF]|[fF])'/,end:/'/,contains:[$.BACKSLASH_ESCAPE,Y,U]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[$.BACKSLASH_ESCAPE,Y,U]},$.APOS_STRING_MODE,$.QUOTE_STRING_MODE]},K="[0-9](_?[0-9])*",W="(\\b([0-9](_?[0-9])*))?\\.([0-9](_?[0-9])*)|\\b([0-9](_?[0-9])*)\\.",N=`\\b|${H.join("|")}`,q={className:"number",relevance:0,variants:[{begin:`(\\b([0-9](_?[0-9])*)|((\\b([0-9](_?[0-9])*))?\\.([0-9](_?[0-9])*)|\\b([0-9](_?[0-9])*)\\.))[eE][+-]?([0-9](_?[0-9])*)[jJ]?(?=${N})`},{begin:"((\\b([0-9](_?[0-9])*))?\\.([0-9](_?[0-9])*)|\\b([0-9](_?[0-9])*)\\.)[jJ]?"},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${N})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${N})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${N})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${N})`},{begin:`\\b([0-9](_?[0-9])*)[jJ](?=${N})`}]},D={className:"comment",begin:Z.lookahead(/# type:/),end:/$/,keywords:z,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},A={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:z,contains:["self",G,q,F,$.HASH_COMMENT_MODE]}]};return U.contains=[F,q,G],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:z,illegal:/(<\/|\?)|=>/,contains:[G,q,{scope:"variable.language",match:/\bself\b/},{beginKeywords:"if",relevance:0},{match:/\bor\b/,scope:"keyword"},F,D,$.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,J],scope:{1:"keyword",3:"title.function"},contains:[A]},{variants:[{match:[/\bclass/,/\s+/,J,/\s*/,/\(\s*/,J,/\s*\)/]},{match:[/\bclass/,/\s+/,J]}],scope:{1:"keyword",3:"title.class",6:"title.class.inherited"}},{className:"meta",begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[q,A,F]}]}}function lc($){return{aliases:["pycon"],contains:[{className:"meta.prompt",starts:{end:/ |$/,starts:{end:"$",subLanguage:"python"}},variants:[{begin:/^>>>(?=[ ]|$)/},{begin:/^\.\.\.(?=[ ]|$)/}]}]}}function ic($){let Z=$.regex,J=/(?:(?:[a-zA-Z]|\.[._a-zA-Z])[._a-zA-Z0-9]*)|\.(?!\d)/,H=Z.either(/0[xX][0-9a-fA-F]+\.[0-9a-fA-F]*[pP][+-]?\d+i?/,/0[xX][0-9a-fA-F]+(?:[pP][+-]?\d+)?[Li]?/,/(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?[Li]?/),B=/[=!<>:]=|\|\||&&|:::?|<-|<<-|->>|->|\|>|[-+*\/?!$&|:<=>@^~]|\*\*/,Q=Z.either(/[()]/,/[{}]/,/\[\[/,/[[\]]/,/\\/,/,/);return{name:"R",keywords:{$pattern:J,keyword:"function if in break next repeat else for while",literal:"NULL NA TRUE FALSE Inf NaN NA_integer_|10 NA_real_|10 NA_character_|10 NA_complex_|10",built_in:"LETTERS letters month.abb month.name pi T F abs acos acosh all any anyNA Arg as.call as.character as.complex as.double as.environment as.integer as.logical as.null.default as.numeric as.raw asin asinh atan atanh attr attributes baseenv browser c call ceiling class Conj cos cosh cospi cummax cummin cumprod cumsum digamma dim dimnames emptyenv exp expression floor forceAndCall gamma gc.time globalenv Im interactive invisible is.array is.atomic is.call is.character is.complex is.double is.environment is.expression is.finite is.function is.infinite is.integer is.language is.list is.logical is.matrix is.na is.name is.nan is.null is.numeric is.object is.pairlist is.raw is.recursive is.single is.symbol lazyLoadDBfetch length lgamma list log max min missing Mod names nargs nzchar oldClass on.exit pos.to.env proc.time prod quote range Re rep retracemem return round seq_along seq_len seq.int sign signif sin sinh sinpi sqrt standardGeneric substitute sum switch tan tanh tanpi tracemem trigamma trunc unclass untracemem UseMethod xtfrm"},contains:[$.COMMENT(/#'/,/$/,{contains:[{scope:"doctag",match:/@examples/,starts:{end:Z.lookahead(Z.either(/\n^#'\s*(?=@[a-zA-Z]+)/,/\n^(?!#')/)),endsParent:!0}},{scope:"doctag",begin:"@param",end:/$/,contains:[{scope:"variable",variants:[{match:J},{match:/`(?:\\.|[^`\\])+`/}],endsParent:!0}]},{scope:"doctag",match:/@[a-zA-Z]+/},{scope:"keyword",match:/\\[a-zA-Z]+/}]}),$.HASH_COMMENT_MODE,{scope:"string",contains:[$.BACKSLASH_ESCAPE],variants:[$.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\(/,end:/\)(-*)"/}),$.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\{/,end:/\}(-*)"/}),$.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\[/,end:/\](-*)"/}),$.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\(/,end:/\)(-*)'/}),$.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\{/,end:/\}(-*)'/}),$.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\[/,end:/\](-*)'/}),{begin:'"',end:'"',relevance:0},{begin:"'",end:"'",relevance:0}]},{relevance:0,variants:[{scope:{1:"operator",2:"number"},match:[B,H]},{scope:{1:"operator",2:"number"},match:[/%[^%]*%/,H]},{scope:{1:"punctuation",2:"number"},match:[Q,H]},{scope:{2:"number"},match:[/[^a-zA-Z0-9._]|^/,H]}]},{scope:{3:"operator"},match:[J,/\s+/,/<-/,/\s+/]},{scope:"operator",relevance:0,variants:[{match:B},{match:/%[^%]*%/}]},{scope:"punctuation",relevance:0,match:Q},{begin:"`",end:"`",contains:[{begin:/\\./}]}]}}function rc($){let Z=$.regex,J="([a-zA-Z_]\\w*[!?=]?|[-+~]@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?)",H=Z.either(/\b([A-Z]+[a-z0-9]+)+/,/\b([A-Z]+[a-z0-9]+)+[A-Z]+/),B=Z.concat(H,/(::\w+)*/),X={"variable.constant":["__FILE__","__LINE__","__ENCODING__"],"variable.language":["self","super"],keyword:["alias","and","begin","BEGIN","break","case","class","defined","do","else","elsif","end","END","ensure","for","if","in","module","next","not","or","redo","require","rescue","retry","return","then","undef","unless","until","when","while","yield",...["include","extend","prepend","public","private","protected","raise","throw"]],built_in:["proc","lambda","attr_accessor","attr_reader","attr_writer","define_method","private_constant","module_function"],literal:["true","false","nil"]},z={className:"doctag",begin:"@[A-Za-z]+"},G={begin:"#<",end:">"},U=[$.COMMENT("#","$",{contains:[z]}),$.COMMENT("^=begin","^=end",{contains:[z],relevance:10}),$.COMMENT("^__END__",$.MATCH_NOTHING_RE)],Y={className:"subst",begin:/#\{/,end:/\}/,keywords:X},F={className:"string",contains:[$.BACKSLASH_ESCAPE,Y],variants:[{begin:/'/,end:/'/},{begin:/"/,end:/"/},{begin:/`/,end:/`/},{begin:/%[qQwWx]?\(/,end:/\)/},{begin:/%[qQwWx]?\[/,end:/\]/},{begin:/%[qQwWx]?\{/,end:/\}/},{begin:/%[qQwWx]?</,end:/>/},{begin:/%[qQwWx]?\//,end:/\//},{begin:/%[qQwWx]?%/,end:/%/},{begin:/%[qQwWx]?-/,end:/-/},{begin:/%[qQwWx]?\|/,end:/\|/},{begin:/\B\?(\\\d{1,3})/},{begin:/\B\?(\\x[A-Fa-f0-9]{1,2})/},{begin:/\B\?(\\u\{?[A-Fa-f0-9]{1,6}\}?)/},{begin:/\B\?(\\M-\\C-|\\M-\\c|\\c\\M-|\\M-|\\C-\\M-)[\x20-\x7e]/},{begin:/\B\?\\(c|C-)[\x20-\x7e]/},{begin:/\B\?\\?\S/},{begin:Z.concat(/<<[-~]?'?/,Z.lookahead(/(\w+)(?=\W)[^\n]*\n(?:[^\n]*\n)*?\s*\1\b/)),contains:[$.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,contains:[$.BACKSLASH_ESCAPE,Y]})]}]},K="[1-9](_?[0-9])*|0",W="[0-9](_?[0-9])*",N={className:"number",relevance:0,variants:[{begin:"\\b([1-9](_?[0-9])*|0)(\\.([0-9](_?[0-9])*))?([eE][+-]?([0-9](_?[0-9])*)|r)?i?\\b"},{begin:"\\b0[dD][0-9](_?[0-9])*r?i?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*r?i?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*r?i?\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*r?i?\\b"},{begin:"\\b0(_?[0-7])+r?i?\\b"}]},q={variants:[{match:/\(\)/},{className:"params",begin:/\(/,end:/(?=\))/,excludeBegin:!0,endsParent:!0,keywords:X}]},_=[F,{variants:[{match:[/class\s+/,B,/\s+<\s+/,B]},{match:[/\b(class|module)\s+/,B]}],scope:{2:"title.class",4:"title.class.inherited"},keywords:X},{match:[/(include|extend)\s+/,B],scope:{2:"title.class"},keywords:X},{relevance:0,match:[B,/\.new[. (]/],scope:{1:"title.class"}},{relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"},{relevance:0,match:H,scope:"title.class"},{match:[/def/,/\s+/,"([a-zA-Z_]\\w*[!?=]?|[-+~]@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?)"],scope:{1:"keyword",3:"title.function"},contains:[q]},{begin:$.IDENT_RE+"::"},{className:"symbol",begin:$.UNDERSCORE_IDENT_RE+"(!|\\?)?:",relevance:0},{className:"symbol",begin:":(?!\\s)",contains:[F,{begin:"([a-zA-Z_]\\w*[!?=]?|[-+~]@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?)"}],relevance:0},N,{className:"variable",begin:"(\\$\\W)|((\\$|@@?)(\\w+))(?=[^@$?])(?![A-Za-z])(?![@$?'])"},{className:"params",begin:/\|(?!=)/,end:/\|/,excludeBegin:!0,excludeEnd:!0,relevance:0,keywords:X},{begin:"("+$.RE_STARTERS_RE+"|unless)\\s*",keywords:"unless",contains:[{className:"regexp",contains:[$.BACKSLASH_ESCAPE,Y],illegal:/\n/,variants:[{begin:"/",end:"/[a-z]*"},{begin:/%r\{/,end:/\}[a-z]*/},{begin:"%r\\(",end:"\\)[a-z]*"},{begin:"%r!",end:"![a-z]*"},{begin:"%r\\[",end:"\\][a-z]*"}]}].concat(G,U),relevance:0}].concat(G,U);Y.contains=_,q.contains=_;let w="[>?]>",C="[\\w#]+\\(\\w+\\):\\d+:\\d+[>*]",E="(\\w+-)?\\d+\\.\\d+\\.\\d+(p\\d+)?[^\\d][^>]+>",T=[{begin:/^\s*=>/,starts:{end:"$",contains:_}},{className:"meta.prompt",begin:"^("+w+"|"+C+"|"+E+")(?=[ ])",starts:{end:"$",keywords:X,contains:_}}];return U.unshift(G),{name:"Ruby",aliases:["rb","gemspec","podspec","thor","irb"],keywords:X,illegal:/\/\*/,contains:[$.SHEBANG({binary:"ruby"})].concat(T).concat(U).concat(_)}}function ac($){let Z=$.regex,J=/(r#)?/,H=Z.concat(J,$.UNDERSCORE_IDENT_RE),B=Z.concat(J,$.IDENT_RE),Q={className:"title.function.invoke",relevance:0,begin:Z.concat(/\b/,/(?!let|for|while|if|else|match\b)/,B,Z.lookahead(/\s*\(/))},X="([ui](8|16|32|64|128|size)|f(32|64))?",z=["abstract","as","async","await","become","box","break","const","continue","crate","do","dyn","else","enum","extern","false","final","fn","for","if","impl","in","let","loop","macro","match","mod","move","mut","override","priv","pub","ref","return","self","Self","static","struct","super","trait","true","try","type","typeof","union","unsafe","unsized","use","virtual","where","while","yield"],G=["true","false","Some","None","Ok","Err"],U=["drop ","Copy","Send","Sized","Sync","Drop","Fn","FnMut","FnOnce","ToOwned","Clone","Debug","PartialEq","PartialOrd","Eq","Ord","AsRef","AsMut","Into","From","Default","Iterator","Extend","IntoIterator","DoubleEndedIterator","ExactSizeIterator","SliceConcatExt","ToString","assert!","assert_eq!","bitflags!","bytes!","cfg!","col!","concat!","concat_idents!","debug_assert!","debug_assert_eq!","env!","eprintln!","panic!","file!","format!","format_args!","include_bytes!","include_str!","line!","local_data_key!","module_path!","option_env!","print!","println!","select!","stringify!","try!","unimplemented!","unreachable!","vec!","write!","writeln!","macro_rules!","assert_ne!","debug_assert_ne!"],Y=["i8","i16","i32","i64","i128","isize","u8","u16","u32","u64","u128","usize","f32","f64","str","char","bool","Box","Option","Result","String","Vec"];return{name:"Rust",aliases:["rs"],keywords:{$pattern:$.IDENT_RE+"!?",type:Y,keyword:z,literal:G,built_in:U},illegal:"</",contains:[$.C_LINE_COMMENT_MODE,$.COMMENT("/\\*","\\*/",{contains:["self"]}),$.inherit($.QUOTE_STRING_MODE,{begin:/b?"/,illegal:null}),{className:"symbol",begin:/'[a-zA-Z_][a-zA-Z0-9_]*(?!')/},{scope:"string",variants:[{begin:/b?r(#*)"(.|\n)*?"\1(?!#)/},{begin:/b?'/,end:/'/,contains:[{scope:"char.escape",match:/\\('|\w|x\w{2}|u\w{4}|U\w{8})/}]}]},{className:"number",variants:[{begin:"\\b0b([01_]+)([ui](8|16|32|64|128|size)|f(32|64))?"},{begin:"\\b0o([0-7_]+)([ui](8|16|32|64|128|size)|f(32|64))?"},{begin:"\\b0x([A-Fa-f0-9_]+)([ui](8|16|32|64|128|size)|f(32|64))?"},{begin:"\\b(\\d[\\d_]*(\\.[0-9_]+)?([eE][+-]?[0-9_]+)?)([ui](8|16|32|64|128|size)|f(32|64))?"}],relevance:0},{begin:[/fn/,/\s+/,H],className:{1:"keyword",3:"title.function"}},{className:"meta",begin:"#!?\\[",end:"\\]",contains:[{className:"string",begin:/"/,end:/"/,contains:[$.BACKSLASH_ESCAPE]}]},{begin:[/let/,/\s+/,/(?:mut\s+)?/,H],className:{1:"keyword",3:"keyword",4:"variable"}},{begin:[/for/,/\s+/,H,/\s+/,/in/],className:{1:"keyword",3:"variable",5:"keyword"}},{begin:[/type/,/\s+/,H],className:{1:"keyword",3:"title.class"}},{begin:[/(?:trait|enum|struct|union|impl|for)/,/\s+/,H],className:{1:"keyword",3:"title.class"}},{begin:$.IDENT_RE+"::",keywords:{keyword:"Self",built_in:U,type:Y}},{className:"punctuation",begin:"->"},Q]}}var ZQ0=($)=>{return{IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:$.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[$.APOS_STRING_MODE,$.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:$.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}},JQ0=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],HQ0=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],BQ0=[...JQ0,...HQ0],QQ0=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),XQ0=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),zQ0=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),GQ0=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function oc($){let Z=ZQ0($),J=zQ0,H=XQ0,B="@[a-z-]+",Q="and or not only",X="[a-zA-Z-][a-zA-Z0-9_-]*",z={className:"variable",begin:"(\\$[a-zA-Z-][a-zA-Z0-9_-]*)\\b",relevance:0};return{name:"SCSS",case_insensitive:!0,illegal:"[=/|']",contains:[$.C_LINE_COMMENT_MODE,$.C_BLOCK_COMMENT_MODE,Z.CSS_NUMBER_MODE,{className:"selector-id",begin:"#[A-Za-z0-9_-]+",relevance:0},{className:"selector-class",begin:"\\.[A-Za-z0-9_-]+",relevance:0},Z.ATTRIBUTE_SELECTOR_MODE,{className:"selector-tag",begin:"\\b("+BQ0.join("|")+")\\b",relevance:0},{className:"selector-pseudo",begin:":("+H.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+J.join("|")+")"},z,{begin:/\(/,end:/\)/,contains:[Z.CSS_NUMBER_MODE]},Z.CSS_VARIABLE,{className:"attribute",begin:"\\b("+GQ0.join("|")+")\\b"},{begin:"\\b(whitespace|wait|w-resize|visible|vertical-text|vertical-ideographic|uppercase|upper-roman|upper-alpha|underline|transparent|top|thin|thick|text|text-top|text-bottom|tb-rl|table-header-group|table-footer-group|sw-resize|super|strict|static|square|solid|small-caps|separate|se-resize|scroll|s-resize|rtl|row-resize|ridge|right|repeat|repeat-y|repeat-x|relative|progress|pointer|overline|outside|outset|oblique|nowrap|not-allowed|normal|none|nw-resize|no-repeat|no-drop|newspaper|ne-resize|n-resize|move|middle|medium|ltr|lr-tb|lowercase|lower-roman|lower-alpha|loose|list-item|line|line-through|line-edge|lighter|left|keep-all|justify|italic|inter-word|inter-ideograph|inside|inset|inline|inline-block|inherit|inactive|ideograph-space|ideograph-parenthesis|ideograph-numeric|ideograph-alpha|horizontal|hidden|help|hand|groove|fixed|ellipsis|e-resize|double|dotted|distribute|distribute-space|distribute-letter|distribute-all-lines|disc|disabled|default|decimal|dashed|crosshair|collapse|col-resize|circle|char|center|capitalize|break-word|break-all|bottom|both|bolder|bold|block|bidi-override|below|baseline|auto|always|all-scroll|absolute|table|table-cell)\\b"},{begin:/:/,end:/[;}{]/,relevance:0,contains:[Z.BLOCK_COMMENT,z,Z.HEXCOLOR,Z.CSS_NUMBER_MODE,$.QUOTE_STRING_MODE,$.APOS_STRING_MODE,Z.IMPORTANT,Z.FUNCTION_DISPATCH]},{begin:"@(page|font-face)",keywords:{$pattern:"@[a-z-]+",keyword:"@page @font-face"}},{begin:"@",end:"[{;]",returnBegin:!0,keywords:{$pattern:/[a-z-]+/,keyword:"and or not only",attribute:QQ0.join(" ")},contains:[{begin:"@[a-z-]+",className:"keyword"},{begin:/[a-z-]+(?=:)/,className:"attribute"},z,$.QUOTE_STRING_MODE,$.APOS_STRING_MODE,Z.HEXCOLOR,Z.CSS_NUMBER_MODE]},Z.FUNCTION_DISPATCH]}}function nc($){return{name:"Shell Session",aliases:["console","shellsession"],contains:[{className:"meta.prompt",begin:/^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/,starts:{end:/[^\\](?=\s*$)/,subLanguage:"bash"}}]}}function sc($){let Z=$.regex,J=$.COMMENT("--","$"),H={scope:"string",variants:[{begin:/'/,end:/'/,contains:[{match:/''/}]}]},B={begin:/"/,end:/"/,contains:[{match:/""/}]},Q=["true","false","unknown"],X=["double precision","large object","with timezone","without timezone"],z=["bigint","binary","blob","boolean","char","character","clob","date","dec","decfloat","decimal","float","int","integer","interval","nchar","nclob","national","numeric","real","row","smallint","time","timestamp","varchar","varying","varbinary"],G=["add","asc","collation","desc","final","first","last","view"],U=["abs","acos","all","allocate","alter","and","any","are","array","array_agg","array_max_cardinality","as","asensitive","asin","asymmetric","at","atan","atomic","authorization","avg","begin","begin_frame","begin_partition","between","bigint","binary","blob","boolean","both","by","call","called","cardinality","cascaded","case","cast","ceil","ceiling","char","char_length","character","character_length","check","classifier","clob","close","coalesce","collate","collect","column","commit","condition","connect","constraint","contains","convert","copy","corr","corresponding","cos","cosh","count","covar_pop","covar_samp","create","cross","cube","cume_dist","current","current_catalog","current_date","current_default_transform_group","current_path","current_role","current_row","current_schema","current_time","current_timestamp","current_path","current_role","current_transform_group_for_type","current_user","cursor","cycle","date","day","deallocate","dec","decimal","decfloat","declare","default","define","delete","dense_rank","deref","describe","deterministic","disconnect","distinct","double","drop","dynamic","each","element","else","empty","end","end_frame","end_partition","end-exec","equals","escape","every","except","exec","execute","exists","exp","external","extract","false","fetch","filter","first_value","float","floor","for","foreign","frame_row","free","from","full","function","fusion","get","global","grant","group","grouping","groups","having","hold","hour","identity","in","indicator","initial","inner","inout","insensitive","insert","int","integer","intersect","intersection","interval","into","is","join","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","language","large","last_value","lateral","lead","leading","left","like","like_regex","listagg","ln","local","localtime","localtimestamp","log","log10","lower","match","match_number","match_recognize","matches","max","member","merge","method","min","minute","mod","modifies","module","month","multiset","national","natural","nchar","nclob","new","no","none","normalize","not","nth_value","ntile","null","nullif","numeric","octet_length","occurrences_regex","of","offset","old","omit","on","one","only","open","or","order","out","outer","over","overlaps","overlay","parameter","partition","pattern","per","percent","percent_rank","percentile_cont","percentile_disc","period","portion","position","position_regex","power","precedes","precision","prepare","primary","procedure","ptf","range","rank","reads","real","recursive","ref","references","referencing","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","release","result","return","returns","revoke","right","rollback","rollup","row","row_number","rows","running","savepoint","scope","scroll","search","second","seek","select","sensitive","session_user","set","show","similar","sin","sinh","skip","smallint","some","specific","specifictype","sql","sqlexception","sqlstate","sqlwarning","sqrt","start","static","stddev_pop","stddev_samp","submultiset","subset","substring","substring_regex","succeeds","sum","symmetric","system","system_time","system_user","table","tablesample","tan","tanh","then","time","timestamp","timezone_hour","timezone_minute","to","trailing","translate","translate_regex","translation","treat","trigger","trim","trim_array","true","truncate","uescape","union","unique","unknown","unnest","update","upper","user","using","value","values","value_of","var_pop","var_samp","varbinary","varchar","varying","versioning","when","whenever","where","width_bucket","window","with","within","without","year"],Y=["abs","acos","array_agg","asin","atan","avg","cast","ceil","ceiling","coalesce","corr","cos","cosh","count","covar_pop","covar_samp","cume_dist","dense_rank","deref","element","exp","extract","first_value","floor","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","last_value","lead","listagg","ln","log","log10","lower","max","min","mod","nth_value","ntile","nullif","percent_rank","percentile_cont","percentile_disc","position","position_regex","power","rank","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","row_number","sin","sinh","sqrt","stddev_pop","stddev_samp","substring","substring_regex","sum","tan","tanh","translate","translate_regex","treat","trim","trim_array","unnest","upper","value_of","var_pop","var_samp","width_bucket"],F=["current_catalog","current_date","current_default_transform_group","current_path","current_role","current_schema","current_transform_group_for_type","current_user","session_user","system_time","system_user","current_time","localtime","current_timestamp","localtimestamp"],K=["create table","insert into","primary key","foreign key","not null","alter table","add constraint","grouping sets","on overflow","character set","respect nulls","ignore nulls","nulls first","nulls last","depth first","breadth first"],W=Y,N=[...U,...G].filter((M)=>{return!Y.includes(M)}),q={scope:"variable",match:/@[a-z0-9][a-z0-9_]*/},D={scope:"operator",match:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0},A={match:Z.concat(/\b/,Z.either(...W),/\s*\(/),relevance:0,keywords:{built_in:W}};function V(M){return Z.concat(/\b/,Z.either(...M.map((_)=>{return _.replace(/\s+/,"\\s+")})),/\b/)}let L={scope:"keyword",match:V(K),relevance:0};function O(M,{exceptions:_,when:w}={}){let C=w;return _=_||[],M.map((E)=>{if(E.match(/\|\d+$/)||_.includes(E))return E;else if(C(E))return`${E}|0`;else return E})}return{name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:O(N,{when:(M)=>M.length<3}),literal:Q,type:z,built_in:F},contains:[{scope:"type",match:V(X)},L,A,q,H,B,$.C_NUMBER_MODE,$.C_BLOCK_COMMENT_MODE,J,D]}}function Zd($){if(!$)return null;if(typeof $==="string")return $;return $.source}function lX($){return C5("(?=",$,")")}function C5(...$){return $.map((J)=>Zd(J)).join("")}function UQ0($){let Z=$[$.length-1];if(typeof Z==="object"&&Z.constructor===Object)return $.splice($.length-1,1),Z;else return{}}function p4(...$){return"("+(UQ0($).capture?"":"?:")+$.map((H)=>Zd(H)).join("|")+")"}var gP=($)=>C5(/\b/,$,/\w$/.test($)?/\b/:/\B/),YQ0=["Protocol","Type"].map(gP),tc=["init","self"].map(gP),FQ0=["Any","Self"],vP=["actor","any","associatedtype","async","await",/as\?/,/as!/,"as","borrowing","break","case","catch","class","consume","consuming","continue","convenience","copy","default","defer","deinit","didSet","distributed","do","dynamic","each","else","enum","extension","fallthrough",/fileprivate\(set\)/,"fileprivate","final","for","func","get","guard","if","import","indirect","infix",/init\?/,/init!/,"inout",/internal\(set\)/,"internal","in","is","isolated","nonisolated","lazy","let","macro","mutating","nonmutating",/open\(set\)/,"open","operator","optional","override","package","postfix","precedencegroup","prefix",/private\(set\)/,"private","protocol",/public\(set\)/,"public","repeat","required","rethrows","return","set","some","static","struct","subscript","super","switch","throws","throw",/try\?/,/try!/,"try","typealias",/unowned\(safe\)/,/unowned\(unsafe\)/,"unowned","var","weak","where","while","willSet"],ec=["false","nil","true"],KQ0=["assignment","associativity","higherThan","left","lowerThan","none","right"],WQ0=["#colorLiteral","#column","#dsohandle","#else","#elseif","#endif","#error","#file","#fileID","#fileLiteral","#filePath","#function","#if","#imageLiteral","#keyPath","#line","#selector","#sourceLocation","#warning"],$d=["abs","all","any","assert","assertionFailure","debugPrint","dump","fatalError","getVaList","isKnownUniquelyReferenced","max","min","numericCast","pointwiseMax","pointwiseMin","precondition","preconditionFailure","print","readLine","repeatElement","sequence","stride","swap","swift_unboxFromSwiftValueWithType","transcode","type","unsafeBitCast","unsafeDowncast","withExtendedLifetime","withUnsafeMutablePointer","withUnsafePointer","withVaList","withoutActuallyEscaping","zip"],Jd=p4(/[/=\-+!*%<>&|^~?]/,/[\u00A1-\u00A7]/,/[\u00A9\u00AB]/,/[\u00AC\u00AE]/,/[\u00B0\u00B1]/,/[\u00B6\u00BB\u00BF\u00D7\u00F7]/,/[\u2016-\u2017]/,/[\u2020-\u2027]/,/[\u2030-\u203E]/,/[\u2041-\u2053]/,/[\u2055-\u205E]/,/[\u2190-\u23FF]/,/[\u2500-\u2775]/,/[\u2794-\u2BFF]/,/[\u2E00-\u2E7F]/,/[\u3001-\u3003]/,/[\u3008-\u3020]/,/[\u3030]/),Hd=p4(Jd,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),fP=C5(Jd,Hd,"*"),Bd=p4(/[a-zA-Z_]/,/[\u00A8\u00AA\u00AD\u00AF\u00B2-\u00B5\u00B7-\u00BA]/,/[\u00BC-\u00BE\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF]/,/[\u0100-\u02FF\u0370-\u167F\u1681-\u180D\u180F-\u1DBF]/,/[\u1E00-\u1FFF]/,/[\u200B-\u200D\u202A-\u202E\u203F-\u2040\u2054\u2060-\u206F]/,/[\u2070-\u20CF\u2100-\u218F\u2460-\u24FF\u2776-\u2793]/,/[\u2C00-\u2DFF\u2E80-\u2FFF]/,/[\u3004-\u3007\u3021-\u302F\u3031-\u303F\u3040-\uD7FF]/,/[\uF900-\uFD3D\uFD40-\uFDCF\uFDF0-\uFE1F\uFE30-\uFE44]/,/[\uFE47-\uFEFE\uFF00-\uFFFD]/),XN=p4(Bd,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),C3=C5(Bd,XN,"*"),QN=C5(/[A-Z]/,XN,"*"),NQ0=["attached","autoclosure",C5(/convention\(/,p4("swift","block","c"),/\)/),"discardableResult","dynamicCallable","dynamicMemberLookup","escaping","freestanding","frozen","GKInspectable","IBAction","IBDesignable","IBInspectable","IBOutlet","IBSegueAction","inlinable","main","nonobjc","NSApplicationMain","NSCopying","NSManaged",C5(/objc\(/,C3,/\)/),"objc","objcMembers","propertyWrapper","requires_stored_property_inits","resultBuilder","Sendable","testable","UIApplicationMain","unchecked","unknown","usableFromInline","warn_unqualified_access"],qQ0=["iOS","iOSApplicationExtension","macOS","macOSApplicationExtension","macCatalyst","macCatalystApplicationExtension","watchOS","watchOSApplicationExtension","tvOS","tvOSApplicationExtension","swift"];function Qd($){let Z={match:/\s+/,relevance:0},J=$.COMMENT("/\\*","\\*/",{contains:["self"]}),H=[$.C_LINE_COMMENT_MODE,J],B={match:[/\./,p4(...YQ0,...tc)],className:{2:"keyword"}},Q={match:C5(/\./,p4(...vP)),relevance:0},X=vP.filter((K0)=>typeof K0==="string").concat(["_|0"]),z=vP.filter((K0)=>typeof K0!=="string").concat(FQ0).map(gP),G={variants:[{className:"keyword",match:p4(...z,...tc)}]},U={$pattern:p4(/\b\w+/,/#\w+/),keyword:X.concat(WQ0),literal:ec},Y=[B,Q,G],F={match:C5(/\./,p4(...$d)),relevance:0},K={className:"built_in",match:C5(/\b/,p4(...$d),/(?=\()/)},W=[F,K],N={match:/->/,relevance:0},q={className:"operator",relevance:0,variants:[{match:fP},{match:`\\.(\\.|${Hd})+`}]},D=[N,q],A="([0-9]_*)+",V="([0-9a-fA-F]_*)+",L={className:"number",relevance:0,variants:[{match:"\\b(([0-9]_*)+)(\\.(([0-9]_*)+))?([eE][+-]?(([0-9]_*)+))?\\b"},{match:"\\b0x(([0-9a-fA-F]_*)+)(\\.(([0-9a-fA-F]_*)+))?([pP][+-]?(([0-9]_*)+))?\\b"},{match:/\b0o([0-7]_*)+\b/},{match:/\b0b([01]_*)+\b/}]},O=(K0="")=>({className:"subst",variants:[{match:C5(/\\/,K0,/[0\\tnr"']/)},{match:C5(/\\/,K0,/u\{[0-9a-fA-F]{1,8}\}/)}]}),M=(K0="")=>({className:"subst",match:C5(/\\/,K0,/[\t ]*(?:[\r\n]|\r\n)/)}),_=(K0="")=>({className:"subst",label:"interpol",begin:C5(/\\/,K0,/\(/),end:/\)/}),w=(K0="")=>({begin:C5(K0,/"""/),end:C5(/"""/,K0),contains:[O(K0),M(K0),_(K0)]}),C=(K0="")=>({begin:C5(K0,/"/),end:C5(/"/,K0),contains:[O(K0),_(K0)]}),E={className:"string",variants:[w(),w("#"),w("##"),w("###"),C(),C("#"),C("##"),C("###")]},T=[$.BACKSLASH_ESCAPE,{begin:/\[/,end:/\]/,relevance:0,contains:[$.BACKSLASH_ESCAPE]}],k={begin:/\/[^\s](?=[^/\n]*\/)/,end:/\//,contains:T},S=(K0)=>{let s=C5(K0,/\//),a=C5(/\//,K0);return{begin:s,end:a,contains:[...T,{scope:"comment",begin:`#(?!.*${a})`,end:/$/}]}},I={scope:"regexp",variants:[S("###"),S("##"),S("#"),k]},j={match:C5(/`/,C3,/`/)},y={className:"variable",match:/\$\d+/},R={className:"variable",match:`\\$${XN}+`},x=[j,y,R],v={match:/(@|#(un)?)available/,scope:"keyword",starts:{contains:[{begin:/\(/,end:/\)/,keywords:qQ0,contains:[...D,L,E]}]}},f={scope:"keyword",match:C5(/@/,p4(...NQ0),lX(p4(/\(/,/\s+/)))},b={scope:"meta",match:C5(/@/,C3)},l=[v,f,b],r={match:lX(/\b[A-Z]/),relevance:0,contains:[{className:"type",match:C5(/(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)/,XN,"+")},{className:"type",match:QN,relevance:0},{match:/[?!]+/,relevance:0},{match:/\.\.\./,relevance:0},{match:C5(/\s+&\s+/,lX(QN)),relevance:0}]},h={begin:/</,end:/>/,keywords:U,contains:[...H,...Y,...l,N,r]};r.contains.push(h);let d={match:C5(C3,/\s*:/),keywords:"_|0",relevance:0},o={begin:/\(/,end:/\)/,relevance:0,keywords:U,contains:["self",d,...H,I,...Y,...W,...D,L,E,...x,...l,r]},c={begin:/</,end:/>/,keywords:"repeat each",contains:[...H,r]},i={begin:p4(lX(C5(C3,/\s*:/)),lX(C5(C3,/\s+/,C3,/\s*:/))),end:/:/,relevance:0,contains:[{className:"keyword",match:/\b_\b/},{className:"params",match:C3}]},n={begin:/\(/,end:/\)/,keywords:U,contains:[i,...H,...Y,...D,L,E,...l,r,o],endsParent:!0,illegal:/["']/},Z0={match:[/(func|macro)/,/\s+/,p4(j.match,C3,fP)],className:{1:"keyword",3:"title.function"},contains:[c,n,Z],illegal:[/\[/,/%/]},J0={match:[/\b(?:subscript|init[?!]?)/,/\s*(?=[<(])/],className:{1:"keyword"},contains:[c,n,Z],illegal:/\[|%/},U0={match:[/operator/,/\s+/,fP],className:{1:"keyword",3:"title"}},z0={begin:[/precedencegroup/,/\s+/,QN],className:{1:"keyword",3:"title"},contains:[r],keywords:[...KQ0,...ec],end:/}/},X0={match:[/class\b/,/\s+/,/func\b/,/\s+/,/\b[A-Za-z_][A-Za-z0-9_]*\b/],scope:{1:"keyword",3:"keyword",5:"title.function"}},N0={match:[/class\b/,/\s+/,/var\b/],scope:{1:"keyword",3:"keyword"}},q0={begin:[/(struct|protocol|class|extension|enum|actor)/,/\s+/,C3,/\s*/],beginScope:{1:"keyword",3:"title.class"},keywords:U,contains:[c,...Y,{begin:/:/,end:/\{/,keywords:U,contains:[{scope:"title.class.inherited",match:QN},...Y],relevance:0}]};for(let K0 of E.variants){let s=K0.contains.find(($0)=>$0.label==="interpol");s.keywords=U;let a=[...Y,...W,...D,L,E,...x];s.contains=[...a,{begin:/\(/,end:/\)/,contains:["self",...a]}]}return{name:"Swift",keywords:U,contains:[...H,Z0,J0,X0,N0,q0,U0,z0,{beginKeywords:"import",end:/$/,contains:[...H],relevance:0},I,...Y,...W,...D,L,E,...x,...l,r,o]}}var Xd=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],zd=["true","false","null","undefined","NaN","Infinity"],Gd=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],Ud=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],Yd=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],Fd=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],Kd=[].concat(Yd,Gd,Ud);function AQ0($){let Z=$.regex,J=(v,{after:f})=>{let b="</"+v[0].slice(1);return v.input.indexOf(b,f)!==-1},H="[A-Za-z$_][0-9A-Za-z$_]*",B={begin:"<>",end:"</>"},Q=/<[A-Za-z0-9\\._:-]+\s*\/>/,X={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(v,f)=>{let b=v[0].length+v.index,l=v.input[b];if(l==="<"||l===","){f.ignoreMatch();return}if(l===">"){if(!J(v,{after:b}))f.ignoreMatch()}let r,h=v.input.substring(b);if(r=h.match(/^\s*=/)){f.ignoreMatch();return}if(r=h.match(/^\s+extends\s+/)){if(r.index===0){f.ignoreMatch();return}}}},z={$pattern:"[A-Za-z$_][0-9A-Za-z$_]*",keyword:Xd,literal:zd,built_in:Kd,"variable.language":Fd},G="[0-9](_?[0-9])*",U="\\.([0-9](_?[0-9])*)",Y="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",F={className:"number",variants:[{begin:"(\\b(0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*)((\\.([0-9](_?[0-9])*))|\\.)?|(\\.([0-9](_?[0-9])*)))[eE][+-]?([0-9](_?[0-9])*)\\b"},{begin:"\\b(0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*)\\b((\\.([0-9](_?[0-9])*))\\b|\\.)?|(\\.([0-9](_?[0-9])*))\\b"},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},K={className:"subst",begin:"\\$\\{",end:"\\}",keywords:z,contains:[]},W={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[$.BACKSLASH_ESCAPE,K],subLanguage:"xml"}},N={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[$.BACKSLASH_ESCAPE,K],subLanguage:"css"}},q={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[$.BACKSLASH_ESCAPE,K],subLanguage:"graphql"}},D={className:"string",begin:"`",end:"`",contains:[$.BACKSLASH_ESCAPE,K]},V={className:"comment",variants:[$.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:"[A-Za-z$_][0-9A-Za-z$_]*(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),$.C_BLOCK_COMMENT_MODE,$.C_LINE_COMMENT_MODE]},L=[$.APOS_STRING_MODE,$.QUOTE_STRING_MODE,W,N,q,D,{match:/\$\d+/},F];K.contains=L.concat({begin:/\{/,end:/\}/,keywords:z,contains:["self"].concat(L)});let O=[].concat(V,K.contains),M=O.concat([{begin:/(\s*)\(/,end:/\)/,keywords:z,contains:["self"].concat(O)}]),_={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:z,contains:M},w={variants:[{match:[/class/,/\s+/,"[A-Za-z$_][0-9A-Za-z$_]*",/\s+/,/extends/,/\s+/,Z.concat("[A-Za-z$_][0-9A-Za-z$_]*","(",Z.concat(/\./,"[A-Za-z$_][0-9A-Za-z$_]*"),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,"[A-Za-z$_][0-9A-Za-z$_]*"],scope:{1:"keyword",3:"title.class"}}]},C={relevance:0,match:Z.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...Gd,...Ud]}},E={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},T={variants:[{match:[/function/,/\s+/,"[A-Za-z$_][0-9A-Za-z$_]*",/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[_],illegal:/%/},k={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function S(v){return Z.concat("(?!",v.join("|"),")")}let I={match:Z.concat(/\b/,S([...Yd,"super","import"].map((v)=>`${v}\\s*\\(`)),"[A-Za-z$_][0-9A-Za-z$_]*",Z.lookahead(/\s*\(/)),className:"title.function",relevance:0},j={begin:Z.concat(/\./,Z.lookahead(Z.concat("[A-Za-z$_][0-9A-Za-z$_]*",/(?![0-9A-Za-z$_(])/))),end:"[A-Za-z$_][0-9A-Za-z$_]*",excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},y={match:[/get|set/,/\s+/,"[A-Za-z$_][0-9A-Za-z$_]*",/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},_]},R="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+$.UNDERSCORE_IDENT_RE+")\\s*=>",x={match:[/const|var|let/,/\s+/,"[A-Za-z$_][0-9A-Za-z$_]*",/\s*/,/=\s*/,/(async\s*)?/,Z.lookahead(R)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[_]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:z,exports:{PARAMS_CONTAINS:M,CLASS_REFERENCE:C},illegal:/#(?![$_A-z])/,contains:[$.SHEBANG({label:"shebang",binary:"node",relevance:5}),E,$.APOS_STRING_MODE,$.QUOTE_STRING_MODE,W,N,q,D,V,{match:/\$\d+/},F,C,{scope:"attr",match:"[A-Za-z$_][0-9A-Za-z$_]*"+Z.lookahead(":"),relevance:0},x,{begin:"("+$.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[V,$.REGEXP_MODE,{className:"function",begin:R,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:$.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:z,contains:M}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:B.begin,end:B.end},{match:Q},{begin:X.begin,"on:begin":X.isTrulyOpeningTag,end:X.end}],subLanguage:"xml",contains:[{begin:X.begin,end:X.end,skip:!0,contains:["self"]}]}]},T,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+$.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[_,$.inherit($.TITLE_MODE,{begin:"[A-Za-z$_][0-9A-Za-z$_]*",className:"title.function"})]},{match:/\.\.\./,relevance:0},j,{match:"\\$[A-Za-z$_][0-9A-Za-z$_]*",relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[_]},I,k,w,y,{match:/\$[(.]/}]}}function Wd($){let Z=$.regex,J=AQ0($),H="[A-Za-z$_][0-9A-Za-z$_]*",B=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],Q={begin:[/namespace/,/\s+/,$.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},X={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:B},contains:[J.exports.CLASS_REFERENCE]},z={className:"meta",relevance:10,begin:/^\s*['"]use strict['"]/},G=["type","interface","public","private","protected","implements","declare","abstract","readonly","enum","override","satisfies"],U={$pattern:"[A-Za-z$_][0-9A-Za-z$_]*",keyword:Xd.concat(G),literal:zd,built_in:Kd.concat(B),"variable.language":Fd},Y={className:"meta",begin:"@[A-Za-z$_][0-9A-Za-z$_]*"},F=(q,D,A)=>{let V=q.contains.findIndex((L)=>L.label===D);if(V===-1)throw Error("can not find mode to replace");q.contains.splice(V,1,A)};Object.assign(J.keywords,U),J.exports.PARAMS_CONTAINS.push(Y);let K=J.contains.find((q)=>q.scope==="attr"),W=Object.assign({},K,{match:Z.concat("[A-Za-z$_][0-9A-Za-z$_]*",Z.lookahead(/\s*\?:/))});J.exports.PARAMS_CONTAINS.push([J.exports.CLASS_REFERENCE,K,W]),J.contains=J.contains.concat([Y,Q,X,W]),F(J,"shebang",$.SHEBANG()),F(J,"use_strict",z);let N=J.contains.find((q)=>q.label==="func.def");return N.relevance=0,Object.assign(J,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),J}function Nd($){let Z=$.regex,J={className:"string",begin:/"(""|[^/n])"C\b/},H={className:"string",begin:/"/,end:/"/,illegal:/\n/,contains:[{begin:/""/}]},B=/\d{1,2}\/\d{1,2}\/\d{4}/,Q=/\d{4}-\d{1,2}-\d{1,2}/,X=/(\d|1[012])(:\d+){0,2} *(AM|PM)/,z=/\d{1,2}(:\d{1,2}){1,2}/,G={className:"literal",variants:[{begin:Z.concat(/# */,Z.either(Q,B),/ *#/)},{begin:Z.concat(/# */,z,/ *#/)},{begin:Z.concat(/# */,X,/ *#/)},{begin:Z.concat(/# */,Z.either(Q,B),/ +/,Z.either(X,z),/ *#/)}]},U={className:"number",relevance:0,variants:[{begin:/\b\d[\d_]*((\.[\d_]+(E[+-]?[\d_]+)?)|(E[+-]?[\d_]+))[RFD@!#]?/},{begin:/\b\d[\d_]*((U?[SIL])|[%&])?/},{begin:/&H[\dA-F_]+((U?[SIL])|[%&])?/},{begin:/&O[0-7_]+((U?[SIL])|[%&])?/},{begin:/&B[01_]+((U?[SIL])|[%&])?/}]},Y={className:"label",begin:/^\w+:/},F=$.COMMENT(/'''/,/$/,{contains:[{className:"doctag",begin:/<\/?/,end:/>/}]}),K=$.COMMENT(null,/$/,{variants:[{begin:/'/},{begin:/([\t ]|^)REM(?=\s)/}]});return{name:"Visual Basic .NET",aliases:["vb"],case_insensitive:!0,classNameAliases:{label:"symbol"},keywords:{keyword:"addhandler alias aggregate ansi as async assembly auto binary by byref byval call case catch class compare const continue custom declare default delegate dim distinct do each equals else elseif end enum erase error event exit explicit finally for friend from function get global goto group handles if implements imports in inherits interface into iterator join key let lib loop me mid module mustinherit mustoverride mybase myclass namespace narrowing new next notinheritable notoverridable of off on operator option optional order overloads overridable overrides paramarray partial preserve private property protected public raiseevent readonly redim removehandler resume return select set shadows shared skip static step stop structure strict sub synclock take text then throw to try unicode until using when where while widening with withevents writeonly yield",built_in:"addressof and andalso await directcast gettype getxmlnamespace is isfalse isnot istrue like mod nameof new not or orelse trycast typeof xor cbool cbyte cchar cdate cdbl cdec cint clng cobj csbyte cshort csng cstr cuint culng cushort",type:"boolean byte char date decimal double integer long object sbyte short single string uinteger ulong ushort",literal:"true false nothing"},illegal:"//|\\{|\\}|endif|gosub|variant|wend|^\\$ ",contains:[J,H,G,U,Y,F,K,{className:"meta",begin:/[\t ]*#(const|disable|else|elseif|enable|end|externalsource|if|region)\b/,end:/$/,keywords:{keyword:"const disable else elseif enable end externalsource if region then"},contains:[K]}]}}function qd($){$.regex;let Z=$.COMMENT(/\(;/,/;\)/);Z.contains.push("self");let J=$.COMMENT(/;;/,/$/),H=["anyfunc","block","br","br_if","br_table","call","call_indirect","data","drop","elem","else","end","export","func","global.get","global.set","local.get","local.set","local.tee","get_global","get_local","global","if","import","local","loop","memory","memory.grow","memory.size","module","mut","nop","offset","param","result","return","select","set_global","set_local","start","table","tee_local","then","type","unreachable"],B={begin:[/(?:func|call|call_indirect)/,/\s+/,/\$[^\s)]+/],className:{1:"keyword",3:"title.function"}},Q={className:"variable",begin:/\$[\w_]+/},X={match:/(\((?!;)|\))+/,className:"punctuation",relevance:0},z={className:"number",relevance:0,match:/[+-]?\b(?:\d(?:_?\d)*(?:\.\d(?:_?\d)*)?(?:[eE][+-]?\d(?:_?\d)*)?|0x[\da-fA-F](?:_?[\da-fA-F])*(?:\.[\da-fA-F](?:_?[\da-fA-D])*)?(?:[pP][+-]?\d(?:_?\d)*)?)\b|\binf\b|\bnan(?::0x[\da-fA-F](?:_?[\da-fA-D])*)?\b/},G={match:/(i32|i64|f32|f64)(?!\.)/,className:"type"},U={className:"keyword",match:/\b(f32|f64|i32|i64)(?:\.(?:abs|add|and|ceil|clz|const|convert_[su]\/i(?:32|64)|copysign|ctz|demote\/f64|div(?:_[su])?|eqz?|extend_[su]\/i32|floor|ge(?:_[su])?|gt(?:_[su])?|le(?:_[su])?|load(?:(?:8|16|32)_[su])?|lt(?:_[su])?|max|min|mul|nearest|neg?|or|popcnt|promote\/f32|reinterpret\/[fi](?:32|64)|rem_[su]|rot[lr]|shl|shr_[su]|store(?:8|16|32)?|sqrt|sub|trunc(?:_[su]\/f(?:32|64))?|wrap\/i64|xor))\b/};return{name:"WebAssembly",keywords:{$pattern:/[\w.]+/,keyword:H},contains:[J,Z,{match:[/(?:offset|align)/,/\s*/,/=/],className:{1:"keyword",3:"operator"}},Q,X,B,$.QUOTE_STRING_MODE,G,U,z]}}function Ad($){let Z=$.regex,J=Z.concat(/[\p{L}_]/u,Z.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),H=/[\p{L}0-9._:-]+/u,B={className:"symbol",begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},Q={begin:/\s/,contains:[{className:"keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},X=$.inherit(Q,{begin:/\(/,end:/\)/}),z=$.inherit($.APOS_STRING_MODE,{className:"string"}),G=$.inherit($.QUOTE_STRING_MODE,{className:"string"}),U={endsWithParent:!0,illegal:/</,relevance:0,contains:[{className:"attr",begin:H,relevance:0},{begin:/=\s*/,relevance:0,contains:[{className:"string",endsParent:!0,variants:[{begin:/"/,end:/"/,contains:[B]},{begin:/'/,end:/'/,contains:[B]},{begin:/[^\s"'=<>`]+/}]}]}]};return{name:"HTML, XML",aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist","wsf","svg"],case_insensitive:!0,unicodeRegex:!0,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,relevance:10,contains:[Q,G,z,X,{begin:/\[/,end:/\]/,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,contains:[Q,X,G,z]}]}]},$.COMMENT(/<!--/,/-->/,{relevance:10}),{begin:/<!\[CDATA\[/,end:/\]\]>/,relevance:10},B,{className:"meta",end:/\?>/,variants:[{begin:/<\?xml/,relevance:10,contains:[G]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:"tag",begin:/<style(?=\s|>)/,end:/>/,keywords:{name:"style"},contains:[U],starts:{end:/<\/style>/,returnEnd:!0,subLanguage:["css","xml"]}},{className:"tag",begin:/<script(?=\s|>)/,end:/>/,keywords:{name:"script"},contains:[U],starts:{end:/<\/script>/,returnEnd:!0,subLanguage:["javascript","handlebars","xml"]}},{className:"tag",begin:/<>|<\/>/},{className:"tag",begin:Z.concat(/</,Z.lookahead(Z.concat(J,Z.either(/\/>/,/>/,/\s/)))),end:/\/?>/,contains:[{className:"name",begin:J,relevance:0,starts:U}]},{className:"tag",begin:Z.concat(/<\//,Z.lookahead(Z.concat(J,/>/))),contains:[{className:"name",begin:J,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}}function Dd($){let H={className:"attr",variants:[{begin:/[\w*@][\w*@ :()\./-]*:(?=[ \t]|$)/},{begin:/"[\w*@][\w*@ :()\./-]*":(?=[ \t]|$)/},{begin:/'[\w*@][\w*@ :()\./-]*':(?=[ \t]|$)/}]},B={className:"template-variable",variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]},Q={className:"string",relevance:0,begin:/'/,end:/'/,contains:[{match:/''/,scope:"char.escape",relevance:0}]},X={className:"string",relevance:0,variants:[{begin:/"/,end:/"/},{begin:/\S+/}],contains:[$.BACKSLASH_ESCAPE,B]},z=$.inherit(X,{variants:[{begin:/'/,end:/'/,contains:[{begin:/''/,relevance:0}]},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),G="[0-9]{4}(-[0-9][0-9]){0,2}",U="([Tt \\t][0-9][0-9]?(:[0-9][0-9]){2})?",Y="(\\.[0-9]*)?",F="([ \\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?",K={className:"number",begin:"\\b[0-9]{4}(-[0-9][0-9]){0,2}([Tt \\t][0-9][0-9]?(:[0-9][0-9]){2})?(\\.[0-9]*)?([ \\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?\\b"},W={end:",",endsWithParent:!0,excludeEnd:!0,keywords:"true false yes no null",relevance:0},N={begin:/\{/,end:/\}/,contains:[W],illegal:"\\n",relevance:0},q={begin:"\\[",end:"\\]",contains:[W],illegal:"\\n",relevance:0},D=[H,{className:"meta",begin:"^---\\s*$",relevance:10},{className:"string",begin:"[\\|>]([1-9]?[+-])?[ ]*\\n( +)[^ ][^\\n]*\\n(\\2[^\\n]+\\n?)*"},{begin:"<%[%=-]?",end:"[%-]?%>",subLanguage:"ruby",excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:"!\\w+![\\w#;/?:@&=+$,.~*'()[\\]]+"},{className:"type",begin:"!<[\\w#;/?:@&=+$,.~*'()[\\]]+>"},{className:"type",begin:"![\\w#;/?:@&=+$,.~*'()[\\]]+"},{className:"type",begin:"!![\\w#;/?:@&=+$,.~*'()[\\]]+"},{className:"meta",begin:"&"+$.UNDERSCORE_IDENT_RE+"$"},{className:"meta",begin:"\\*"+$.UNDERSCORE_IDENT_RE+"$"},{className:"bullet",begin:"-(?=[ ]|$)",relevance:0},$.HASH_COMMENT_MODE,{beginKeywords:"true false yes no null",keywords:{literal:"true false yes no null"}},K,{className:"number",begin:$.C_NUMBER_RE+"\\b",relevance:0},N,q,Q,X],A=[...D];return A.pop(),A.push(z),W.contains=A,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:D}}var mP={arduino:Nc,bash:qc,c:Ac,cpp:Dc,csharp:Vc,css:Lc,diff:Mc,go:Pc,graphql:_c,ini:Oc,java:Cc,javascript:Sc,json:Rc,kotlin:Ic,less:xc,lua:hc,makefile:vc,markdown:fc,objectivec:gc,perl:mc,php:uc,"php-template":pc,plaintext:cc,python:dc,"python-repl":lc,r:ic,ruby:rc,rust:ac,scss:oc,shell:nc,sql:sc,swift:Qd,typescript:Wd,vbnet:Nd,wasm:qd,xml:Ad,yaml:Dd};var ud=P(md(),1);var pd=ud.default;var cd={},XX0="hljs-";function rP($){let Z=pd.newInstance();if($)Q($);return{highlight:J,highlightAuto:H,listLanguages:B,register:Q,registerAlias:X,registered:z};function J(G,U,Y){G5(typeof G==="string","expected `string` as `name`"),G5(typeof U==="string","expected `string` as `value`");let F=Y||cd,K=typeof F.prefix==="string"?F.prefix:XX0;if(!Z.getLanguage(G))throw Error("Unknown language: `"+G+"` is not registered");Z.configure({__emitter:dd,classPrefix:K});let W=Z.highlight(U,{ignoreIllegals:!0,language:G});if(W.errorRaised)throw Error("Could not highlight with `Highlight.js`",{cause:W.errorRaised});let N=W._emitter.root,q=N.data;return q.language=W.language,q.relevance=W.relevance,N}function H(G,U){G5(typeof G==="string","expected `string` as `value`");let F=(U||cd).subset||B(),K=-1,W=0,N;while(++K<F.length){let q=F[K];if(!Z.getLanguage(q))continue;let D=J(q,G,U);if(D.data&&D.data.relevance!==void 0&&D.data.relevance>W)W=D.data.relevance,N=D}return N||{type:"root",children:[],data:{language:void 0,relevance:W}}}function B(){return Z.listLanguages()}function Q(G,U){if(typeof G==="string")G5(U!==void 0,"expected `grammar`"),Z.registerLanguage(G,U);else{let Y;for(Y in G)if(Object.hasOwn(G,Y))Z.registerLanguage(Y,G[Y])}}function X(G,U){if(typeof G==="string")G5(U!==void 0),Z.registerAliases(typeof U==="string"?U:[...U],{languageName:G});else{let Y;for(Y in G)if(Object.hasOwn(G,Y)){let F=G[Y];Z.registerAliases(typeof F==="string"?F:[...F],{languageName:Y})}}}function z(G){return Boolean(Z.getLanguage(G))}}class dd{constructor($){this.options=$,this.root={type:"root",children:[],data:{language:void 0,relevance:0}},this.stack=[this.root]}addText($){if($==="")return;let Z=this.stack[this.stack.length-1],J=Z.children[Z.children.length-1];if(J&&J.type==="text")J.value+=$;else Z.children.push({type:"text",value:$})}startScope($){this.openNode(String($))}endScope(){this.closeNode()}__addSublanguage($,Z){let J=this.stack[this.stack.length-1],H=$.root.children;if(Z)J.children.push({type:"element",tagName:"span",properties:{className:[Z]},children:H});else J.children.push(...H)}openNode($){let Z=this,J=$.split(".").map(function(Q,X){return X?Q+"_".repeat(X):Z.options.classPrefix+Q}),H=this.stack[this.stack.length-1],B={type:"element",tagName:"span",properties:{className:J},children:[]};H.children.push(B),this.stack.push(B)}closeNode(){this.stack.pop()}finalize(){}toHTML(){return""}}var zX0={};function YN($){let Z=$||zX0,J=Z.aliases,H=Z.detect||!1,B=Z.languages||mP,Q=Z.plainText,X=Z.prefix,z=Z.subset,G="hljs",U=rP(B);if(J)U.registerAlias(J);if(X){let Y=X.indexOf("-");G=Y===-1?X:X.slice(0,Y)}return function(Y,F){X6(Y,"element",function(K,W,N){if(K.tagName!=="code"||!N||N.type!=="element"||N.tagName!=="pre")return;let q=GX0(K);if(q===!1||!q&&!H||q&&Q&&Q.includes(q))return;if(!Array.isArray(K.properties.className))K.properties.className=[];if(!K.properties.className.includes(G))K.properties.className.unshift(G);let D=hP(K,{whitespace:"pre"}),A;try{A=q?U.highlight(q,D,{prefix:X}):U.highlightAuto(D,{prefix:X,subset:z})}catch(V){let L=V;if(q&&/Unknown language/.test(L.message)){F.message("Cannot highlight as `"+q+"`, it’s not registered",{ancestors:[N,K],cause:L,place:K.position,ruleId:"missing-language",source:"rehype-highlight"});return}throw L}if(!q&&A.data&&A.data.language)K.properties.className.push("language-"+A.data.language);if(A.children.length>0)K.children=A.children})}}function GX0($){let Z=$.properties.className,J=-1;if(!Array.isArray(Z))return;let H;while(++J<Z.length){let B=String(Z[J]);if(B==="no-highlight"||B==="nohighlight")return!1;if(!H&&B.slice(0,5)==="lang-")H=B.slice(5);if(!H&&B.slice(0,9)==="language-")H=B.slice(9)}return H}function aP($,Z){let J=String($);if(typeof Z!=="string")throw TypeError("Expected character");let H=0,B=J.indexOf(Z);while(B!==-1)H++,B=J.indexOf(Z,B+Z.length);return H}function oP($){if(typeof $!=="string")throw TypeError("Expected a string");return $.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function nP($,Z,J){let B=j3((J||{}).ignore||[]),Q=UX0(Z),X=-1;while(++X<Q.length)pX($,"text",z);function z(U,Y){let F=-1,K;while(++F<Y.length){let W=Y[F],N=K?K.children:void 0;if(B(W,N?N.indexOf(W):void 0,K))return;K=W}if(K)return G(U,Y)}function G(U,Y){let F=Y[Y.length-1],K=Q[X][0],W=Q[X][1],N=0,D=F.children.indexOf(U),A=!1,V=[];K.lastIndex=0;let L=K.exec(U.value);while(L){let O=L.index,M={index:L.index,input:L.input,stack:[...Y,U]},_=W(...L,M);if(typeof _==="string")_=_.length>0?{type:"text",value:_}:void 0;if(_===!1)K.lastIndex=O+1;else{if(N!==O)V.push({type:"text",value:U.value.slice(N,O)});if(Array.isArray(_))V.push(..._);else if(_)V.push(_);N=O+L[0].length,A=!0}if(!K.global)break;L=K.exec(U.value)}if(A){if(N<U.value.length)V.push({type:"text",value:U.value.slice(N)});F.children.splice(D,1,...V)}else V=[U];return D+V.length}}function UX0($){let Z=[];if(!Array.isArray($))throw TypeError("Expected find and replace tuple or list of tuples");let J=!$[0]||Array.isArray($[0])?$:[$],H=-1;while(++H<J.length){let B=J[H];Z.push([YX0(B[0]),FX0(B[1])])}return Z}function YX0($){return typeof $==="string"?new RegExp(oP($),"g"):$}function FX0($){return typeof $==="function"?$:function(){return $}}var sP="phrasing",tP=["autolink","link","image","label"];function $_(){return{transforms:[DX0],enter:{literalAutolink:KX0,literalAutolinkEmail:eP,literalAutolinkHttp:eP,literalAutolinkWww:eP},exit:{literalAutolink:AX0,literalAutolinkEmail:qX0,literalAutolinkHttp:WX0,literalAutolinkWww:NX0}}}function Z_(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:sP,notInConstruct:tP},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:sP,notInConstruct:tP},{character:":",before:"[ps]",after:"\\/",inConstruct:sP,notInConstruct:tP}]}}function KX0($){this.enter({type:"link",title:null,url:"",children:[]},$)}function eP($){this.config.enter.autolinkProtocol.call(this,$)}function WX0($){this.config.exit.autolinkProtocol.call(this,$)}function NX0($){this.config.exit.data.call(this,$);let Z=this.stack[this.stack.length-1];G5(Z.type==="link"),Z.url="http://"+this.sliceSerialize($)}function qX0($){this.config.exit.autolinkEmail.call(this,$)}function AX0($){this.exit($)}function DX0($){nP($,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,VX0],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,LX0]],{ignore:["link","linkReference"]})}function VX0($,Z,J,H,B){let Q="";if(!ld(B))return!1;if(/^w/i.test(Z))J=Z+J,Z="",Q="http://";if(!MX0(J))return!1;let X=PX0(J+H);if(!X[0])return!1;let z={type:"link",title:null,url:Q+Z+X[0],children:[{type:"text",value:Z+X[0]}]};if(X[1])return[z,{type:"text",value:X[1]}];return z}function LX0($,Z,J,H){if(!ld(H,!0)||/[-\d_]$/.test(J))return!1;return{type:"link",title:null,url:"mailto:"+Z+"@"+J,children:[{type:"text",value:Z+"@"+J}]}}function MX0($){let Z=$.split(".");if(Z.length<2||Z[Z.length-1]&&(/_/.test(Z[Z.length-1])||!/[a-zA-Z\d]/.test(Z[Z.length-1]))||Z[Z.length-2]&&(/_/.test(Z[Z.length-2])||!/[a-zA-Z\d]/.test(Z[Z.length-2])))return!1;return!0}function PX0($){let Z=/[!"&'),.:;<>?\]}]+$/.exec($);if(!Z)return[$,void 0];$=$.slice(0,Z.index);let J=Z[0],H=J.indexOf(")"),B=aP($,"("),Q=aP($,")");while(H!==-1&&B>Q)$+=J.slice(0,H+1),J=J.slice(H+1),H=J.indexOf(")"),Q++;return[$,J]}function ld($,Z){let J=$.input.charCodeAt($.index-1);return($.index===0||O3(J)||YZ(J))&&(!Z||J!==47)}id.peek=SX0;function _X0(){this.buffer()}function OX0($){this.enter({type:"footnoteReference",identifier:"",label:""},$)}function TX0(){this.buffer()}function jX0($){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},$)}function CX0($){let Z=this.resume(),J=this.stack[this.stack.length-1];G5(J.type==="footnoteReference"),J.identifier=j4(this.sliceSerialize($)).toLowerCase(),J.label=Z}function EX0($){this.exit($)}function bX0($){let Z=this.resume(),J=this.stack[this.stack.length-1];G5(J.type==="footnoteDefinition"),J.identifier=j4(this.sliceSerialize($)).toLowerCase(),J.label=Z}function wX0($){this.exit($)}function SX0(){return"["}function id($,Z,J,H){let B=J.createTracker(H),Q=B.move("[^"),X=J.enter("footnoteReference"),z=J.enter("reference");return Q+=B.move(J.safe(J.associationId($),{after:"]",before:Q})),z(),X(),Q+=B.move("]"),Q}function J_(){return{enter:{gfmFootnoteCallString:_X0,gfmFootnoteCall:OX0,gfmFootnoteDefinitionLabelString:TX0,gfmFootnoteDefinition:jX0},exit:{gfmFootnoteCallString:CX0,gfmFootnoteCall:EX0,gfmFootnoteDefinitionLabelString:bX0,gfmFootnoteDefinition:wX0}}}function H_($){let Z=!1;if($&&$.firstLineBlank)Z=!0;return{handlers:{footnoteDefinition:J,footnoteReference:id},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function J(H,B,Q,X){let z=Q.createTracker(X),G=z.move("[^"),U=Q.enter("footnoteDefinition"),Y=Q.enter("label");if(G+=z.move(Q.safe(Q.associationId(H),{before:G,after:"]"})),Y(),G+=z.move("]:"),H.children&&H.children.length>0)z.shift(4),G+=z.move((Z?`
|
|
38
|
+
`:" ")+Q.indentLines(Q.containerFlow(H,z.current()),Z?rd:RX0));return U(),G}}function RX0($,Z,J){return Z===0?$:rd($,Z,J)}function rd($,Z,J){return(J?"":" ")+$}var IX0=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];ad.peek=xX0;function B_(){return{canContainEols:["delete"],enter:{strikethrough:kX0},exit:{strikethrough:yX0}}}function Q_(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:IX0}],handlers:{delete:ad}}}function kX0($){this.enter({type:"delete",children:[]},$)}function yX0($){this.exit($)}function ad($,Z,J,H){let B=J.createTracker(H),Q=J.enter("strikethrough"),X=B.move("~~");return X+=J.containerPhrasing($,{...B.current(),before:X,after:"~"}),X+=B.move("~~"),Q(),X}function xX0(){return"~"}function hX0($){return $.length}function nd($,Z){let J=Z||{},H=(J.align||[]).concat(),B=J.stringLength||hX0,Q=[],X=[],z=[],G=[],U=0,Y=-1;while(++Y<$.length){let q=[],D=[],A=-1;if($[Y].length>U)U=$[Y].length;while(++A<$[Y].length){let V=vX0($[Y][A]);if(J.alignDelimiters!==!1){let L=B(V);if(D[A]=L,G[A]===void 0||L>G[A])G[A]=L}q.push(V)}X[Y]=q,z[Y]=D}let F=-1;if(typeof H==="object"&&"length"in H)while(++F<U)Q[F]=od(H[F]);else{let q=od(H);while(++F<U)Q[F]=q}F=-1;let K=[],W=[];while(++F<U){let q=Q[F],D="",A="";if(q===99)D=":",A=":";else if(q===108)D=":";else if(q===114)A=":";let V=J.alignDelimiters===!1?1:Math.max(1,G[F]-D.length-A.length),L=D+"-".repeat(V)+A;if(J.alignDelimiters!==!1){if(V=D.length+V+A.length,V>G[F])G[F]=V;W[F]=V}K[F]=L}X.splice(1,0,K),z.splice(1,0,W),Y=-1;let N=[];while(++Y<X.length){let q=X[Y],D=z[Y];F=-1;let A=[];while(++F<U){let V=q[F]||"",L="",O="";if(J.alignDelimiters!==!1){let M=G[F]-(D[F]||0),_=Q[F];if(_===114)L=" ".repeat(M);else if(_===99)if(M%2)L=" ".repeat(M/2+0.5),O=" ".repeat(M/2-0.5);else L=" ".repeat(M/2),O=L;else O=" ".repeat(M)}if(J.delimiterStart!==!1&&!F)A.push("|");if(J.padding!==!1&&!(J.alignDelimiters===!1&&V==="")&&(J.delimiterStart!==!1||F))A.push(" ");if(J.alignDelimiters!==!1)A.push(L);if(A.push(V),J.alignDelimiters!==!1)A.push(O);if(J.padding!==!1)A.push(" ");if(J.delimiterEnd!==!1||F!==U-1)A.push("|")}N.push(J.delimiterEnd===!1?A.join("").replace(/ +$/,""):A.join(""))}return N.join(`
|
|
39
|
+
`)}function vX0($){return $===null||$===void 0?"":String($)}function od($){let Z=typeof $==="string"?$.codePointAt(0):0;return Z===67||Z===99?99:Z===76||Z===108?108:Z===82||Z===114?114:0}function sd($,Z,J,H){let B=J.enter("blockquote"),Q=J.createTracker(H);Q.move("> "),Q.shift(2);let X=J.indentLines(J.containerFlow($,Q.current()),fX0);return B(),X}function fX0($,Z,J){return">"+(J?"":" ")+$}function ed($,Z){return td($,Z.inConstruct,!0)&&!td($,Z.notInConstruct,!1)}function td($,Z,J){if(typeof Z==="string")Z=[Z];if(!Z||Z.length===0)return J;let H=-1;while(++H<Z.length)if($.includes(Z[H]))return!0;return!1}function X_($,Z,J,H){let B=-1;while(++B<J.unsafe.length)if(J.unsafe[B].character===`
|
|
40
|
+
`&&ed(J.stack,J.unsafe[B]))return/[ \t]/.test(H.before)?"":" ";return"\\\n"}function $l($,Z){let J=String($),H=J.indexOf(Z),B=H,Q=0,X=0;if(typeof Z!=="string")throw TypeError("Expected substring");while(H!==-1){if(H===B){if(++Q>X)X=Q}else Q=1;B=H+Z.length,H=J.indexOf(Z,B)}return X}function Zl($,Z){return Boolean(Z.options.fences===!1&&$.value&&!$.lang&&/[^ \r\n]/.test($.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test($.value))}function Jl($){let Z=$.options.fence||"`";if(Z!=="`"&&Z!=="~")throw Error("Cannot serialize code with `"+Z+"` for `options.fence`, expected `` ` `` or `~`");return Z}function Hl($,Z,J,H){let B=Jl(J),Q=$.value||"",X=B==="`"?"GraveAccent":"Tilde";if(Zl($,J)){let F=J.enter("codeIndented"),K=J.indentLines(Q,gX0);return F(),K}let z=J.createTracker(H),G=B.repeat(Math.max($l(Q,B)+1,3)),U=J.enter("codeFenced"),Y=z.move(G);if($.lang){let F=J.enter(`codeFencedLang${X}`);Y+=z.move(J.safe($.lang,{before:Y,after:" ",encode:["`"],...z.current()})),F()}if($.lang&&$.meta){let F=J.enter(`codeFencedMeta${X}`);Y+=z.move(" "),Y+=z.move(J.safe($.meta,{before:Y,after:`
|
|
41
|
+
`,encode:["`"],...z.current()})),F()}if(Y+=z.move(`
|
|
42
|
+
`),Q)Y+=z.move(Q+`
|
|
43
|
+
`);return Y+=z.move(G),U(),Y}function gX0($,Z,J){return(J?"":" ")+$}function dH($){let Z=$.options.quote||'"';if(Z!=='"'&&Z!=="'")throw Error("Cannot serialize title with `"+Z+"` for `options.quote`, expected `\"`, or `'`");return Z}function Bl($,Z,J,H){let B=dH(J),Q=B==='"'?"Quote":"Apostrophe",X=J.enter("definition"),z=J.enter("label"),G=J.createTracker(H),U=G.move("[");if(U+=G.move(J.safe(J.associationId($),{before:U,after:"]",...G.current()})),U+=G.move("]: "),z(),!$.url||/[\0- \u007F]/.test($.url))z=J.enter("destinationLiteral"),U+=G.move("<"),U+=G.move(J.safe($.url,{before:U,after:">",...G.current()})),U+=G.move(">");else z=J.enter("destinationRaw"),U+=G.move(J.safe($.url,{before:U,after:$.title?" ":`
|
|
44
|
+
`,...G.current()}));if(z(),$.title)z=J.enter(`title${Q}`),U+=G.move(" "+B),U+=G.move(J.safe($.title,{before:U,after:B,...G.current()})),U+=G.move(B),z();return X(),U}function Ql($){let Z=$.options.emphasis||"*";if(Z!=="*"&&Z!=="_")throw Error("Cannot serialize emphasis with `"+Z+"` for `options.emphasis`, expected `*`, or `_`");return Z}function g7($){return"&#x"+$.toString(16).toUpperCase()+";"}function lH($,Z,J){let H=Q6($),B=Q6(Z);if(H===void 0)return B===void 0?J==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:B===1?{inside:!0,outside:!0}:{inside:!1,outside:!0};if(H===1)return B===void 0?{inside:!1,outside:!1}:B===1?{inside:!0,outside:!0}:{inside:!1,outside:!1};return B===void 0?{inside:!1,outside:!1}:B===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}z_.peek=mX0;function z_($,Z,J,H){let B=Ql(J),Q=J.enter("emphasis"),X=J.createTracker(H),z=X.move(B),G=X.move(J.containerPhrasing($,{after:B,before:z,...X.current()})),U=G.charCodeAt(0),Y=lH(H.before.charCodeAt(H.before.length-1),U,B);if(Y.inside)G=g7(U)+G.slice(1);let F=G.charCodeAt(G.length-1),K=lH(H.after.charCodeAt(0),F,B);if(K.inside)G=G.slice(0,-1)+g7(F);let W=X.move(B);return Q(),J.attentionEncodeSurroundingInfo={after:K.outside,before:Y.outside},z+G+W}function mX0($,Z,J){return J.options.emphasis||"*"}function Xl($,Z){let J=!1;return X6($,function(H){if("value"in H&&/\r?\n|\r/.test(H.value)||H.type==="break")return J=!0,qZ}),Boolean((!$.depth||$.depth<3)&&GZ($)&&(Z.options.setext||J))}function zl($,Z,J,H){let B=Math.max(Math.min(6,$.depth||1),1),Q=J.createTracker(H);if(Xl($,J)){let Y=J.enter("headingSetext"),F=J.enter("phrasing"),K=J.containerPhrasing($,{...Q.current(),before:`
|
|
45
|
+
`,after:`
|
|
46
|
+
`});return F(),Y(),K+`
|
|
47
|
+
`+(B===1?"=":"-").repeat(K.length-(Math.max(K.lastIndexOf("\r"),K.lastIndexOf(`
|
|
48
|
+
`))+1))}let X="#".repeat(B),z=J.enter("headingAtx"),G=J.enter("phrasing");Q.move(X+" ");let U=J.containerPhrasing($,{before:"# ",after:`
|
|
49
|
+
`,...Q.current()});if(/^[\t ]/.test(U))U=g7(U.charCodeAt(0))+U.slice(1);if(U=U?X+" "+U:X,J.options.closeAtx)U+=" "+X;return G(),z(),U}G_.peek=uX0;function G_($){return $.value||""}function uX0(){return"<"}U_.peek=pX0;function U_($,Z,J,H){let B=dH(J),Q=B==='"'?"Quote":"Apostrophe",X=J.enter("image"),z=J.enter("label"),G=J.createTracker(H),U=G.move("![");if(U+=G.move(J.safe($.alt,{before:U,after:"]",...G.current()})),U+=G.move("]("),z(),!$.url&&$.title||/[\0- \u007F]/.test($.url))z=J.enter("destinationLiteral"),U+=G.move("<"),U+=G.move(J.safe($.url,{before:U,after:">",...G.current()})),U+=G.move(">");else z=J.enter("destinationRaw"),U+=G.move(J.safe($.url,{before:U,after:$.title?" ":")",...G.current()}));if(z(),$.title)z=J.enter(`title${Q}`),U+=G.move(" "+B),U+=G.move(J.safe($.title,{before:U,after:B,...G.current()})),U+=G.move(B),z();return U+=G.move(")"),X(),U}function pX0(){return"!"}Y_.peek=cX0;function Y_($,Z,J,H){let B=$.referenceType,Q=J.enter("imageReference"),X=J.enter("label"),z=J.createTracker(H),G=z.move("!["),U=J.safe($.alt,{before:G,after:"]",...z.current()});G+=z.move(U+"]["),X();let Y=J.stack;J.stack=[],X=J.enter("reference");let F=J.safe(J.associationId($),{before:G,after:"]",...z.current()});if(X(),J.stack=Y,Q(),B==="full"||!U||U!==F)G+=z.move(F+"]");else if(B==="shortcut")G=G.slice(0,-1);else G+=z.move("]");return G}function cX0(){return"!"}F_.peek=dX0;function F_($,Z,J){let H=$.value||"",B="`",Q=-1;while(new RegExp("(^|[^`])"+B+"([^`]|$)").test(H))B+="`";if(/[^ \r\n]/.test(H)&&(/^[ \r\n]/.test(H)&&/[ \r\n]$/.test(H)||/^`|`$/.test(H)))H=" "+H+" ";while(++Q<J.unsafe.length){let X=J.unsafe[Q],z=J.compilePattern(X),G;if(!X.atBreak)continue;while(G=z.exec(H)){let U=G.index;if(H.charCodeAt(U)===10&&H.charCodeAt(U-1)===13)U--;H=H.slice(0,U)+" "+H.slice(G.index+1)}}return B+H+B}function dX0(){return"`"}function K_($,Z){let J=GZ($);return Boolean(!Z.options.resourceLink&&$.url&&!$.title&&$.children&&$.children.length===1&&$.children[0].type==="text"&&(J===$.url||"mailto:"+J===$.url)&&/^[a-z][a-z+.-]+:/i.test($.url)&&!/[\0- <>\u007F]/.test($.url))}W_.peek=lX0;function W_($,Z,J,H){let B=dH(J),Q=B==='"'?"Quote":"Apostrophe",X=J.createTracker(H),z,G;if(K_($,J)){let Y=J.stack;J.stack=[],z=J.enter("autolink");let F=X.move("<");return F+=X.move(J.containerPhrasing($,{before:F,after:">",...X.current()})),F+=X.move(">"),z(),J.stack=Y,F}z=J.enter("link"),G=J.enter("label");let U=X.move("[");if(U+=X.move(J.containerPhrasing($,{before:U,after:"](",...X.current()})),U+=X.move("]("),G(),!$.url&&$.title||/[\0- \u007F]/.test($.url))G=J.enter("destinationLiteral"),U+=X.move("<"),U+=X.move(J.safe($.url,{before:U,after:">",...X.current()})),U+=X.move(">");else G=J.enter("destinationRaw"),U+=X.move(J.safe($.url,{before:U,after:$.title?" ":")",...X.current()}));if(G(),$.title)G=J.enter(`title${Q}`),U+=X.move(" "+B),U+=X.move(J.safe($.title,{before:U,after:B,...X.current()})),U+=X.move(B),G();return U+=X.move(")"),z(),U}function lX0($,Z,J){return K_($,J)?"<":"["}N_.peek=iX0;function N_($,Z,J,H){let B=$.referenceType,Q=J.enter("linkReference"),X=J.enter("label"),z=J.createTracker(H),G=z.move("["),U=J.containerPhrasing($,{before:G,after:"]",...z.current()});G+=z.move(U+"]["),X();let Y=J.stack;J.stack=[],X=J.enter("reference");let F=J.safe(J.associationId($),{before:G,after:"]",...z.current()});if(X(),J.stack=Y,Q(),B==="full"||!U||U!==F)G+=z.move(F+"]");else if(B==="shortcut")G=G.slice(0,-1);else G+=z.move("]");return G}function iX0(){return"["}function iH($){let Z=$.options.bullet||"*";if(Z!=="*"&&Z!=="+"&&Z!=="-")throw Error("Cannot serialize items with `"+Z+"` for `options.bullet`, expected `*`, `+`, or `-`");return Z}function Gl($){let Z=iH($),J=$.options.bulletOther;if(!J)return Z==="*"?"-":"*";if(J!=="*"&&J!=="+"&&J!=="-")throw Error("Cannot serialize items with `"+J+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(J===Z)throw Error("Expected `bullet` (`"+Z+"`) and `bulletOther` (`"+J+"`) to be different");return J}function Ul($){let Z=$.options.bulletOrdered||".";if(Z!=="."&&Z!==")")throw Error("Cannot serialize items with `"+Z+"` for `options.bulletOrdered`, expected `.` or `)`");return Z}function FN($){let Z=$.options.rule||"*";if(Z!=="*"&&Z!=="-"&&Z!=="_")throw Error("Cannot serialize rules with `"+Z+"` for `options.rule`, expected `*`, `-`, or `_`");return Z}function Yl($,Z,J,H){let B=J.enter("list"),Q=J.bulletCurrent,X=$.ordered?Ul(J):iH(J),z=$.ordered?X==="."?")":".":Gl(J),G=Z&&J.bulletLastUsed?X===J.bulletLastUsed:!1;if(!$.ordered){let Y=$.children?$.children[0]:void 0;if((X==="*"||X==="-")&&Y&&(!Y.children||!Y.children[0])&&J.stack[J.stack.length-1]==="list"&&J.stack[J.stack.length-2]==="listItem"&&J.stack[J.stack.length-3]==="list"&&J.stack[J.stack.length-4]==="listItem"&&J.indexStack[J.indexStack.length-1]===0&&J.indexStack[J.indexStack.length-2]===0&&J.indexStack[J.indexStack.length-3]===0)G=!0;if(FN(J)===X&&Y){let F=-1;while(++F<$.children.length){let K=$.children[F];if(K&&K.type==="listItem"&&K.children&&K.children[0]&&K.children[0].type==="thematicBreak"){G=!0;break}}}}if(G)X=z;J.bulletCurrent=X;let U=J.containerFlow($,H);return J.bulletLastUsed=X,J.bulletCurrent=Q,B(),U}function Fl($){let Z=$.options.listItemIndent||"one";if(Z!=="tab"&&Z!=="one"&&Z!=="mixed")throw Error("Cannot serialize items with `"+Z+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return Z}function Kl($,Z,J,H){let B=Fl(J),Q=J.bulletCurrent||iH(J);if(Z&&Z.type==="list"&&Z.ordered)Q=(typeof Z.start==="number"&&Z.start>-1?Z.start:1)+(J.options.incrementListMarker===!1?0:Z.children.indexOf($))+Q;let X=Q.length+1;if(B==="tab"||B==="mixed"&&(Z&&Z.type==="list"&&Z.spread||$.spread))X=Math.ceil(X/4)*4;let z=J.createTracker(H);z.move(Q+" ".repeat(X-Q.length)),z.shift(X);let G=J.enter("listItem"),U=J.indentLines(J.containerFlow($,z.current()),Y);return G(),U;function Y(F,K,W){if(K)return(W?"":" ".repeat(X))+F;return(W?Q:Q+" ".repeat(X-Q.length))+F}}function Wl($,Z,J,H){let B=J.enter("paragraph"),Q=J.enter("phrasing"),X=J.containerPhrasing($,H);return Q(),B(),X}var q_=j3(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function Nl($,Z,J,H){return($.children.some(function(X){return q_(X)})?J.containerPhrasing:J.containerFlow).call(J,$,H)}function ql($){let Z=$.options.strong||"*";if(Z!=="*"&&Z!=="_")throw Error("Cannot serialize strong with `"+Z+"` for `options.strong`, expected `*`, or `_`");return Z}A_.peek=rX0;function A_($,Z,J,H){let B=ql(J),Q=J.enter("strong"),X=J.createTracker(H),z=X.move(B+B),G=X.move(J.containerPhrasing($,{after:B,before:z,...X.current()})),U=G.charCodeAt(0),Y=lH(H.before.charCodeAt(H.before.length-1),U,B);if(Y.inside)G=g7(U)+G.slice(1);let F=G.charCodeAt(G.length-1),K=lH(H.after.charCodeAt(0),F,B);if(K.inside)G=G.slice(0,-1)+g7(F);let W=X.move(B+B);return Q(),J.attentionEncodeSurroundingInfo={after:K.outside,before:Y.outside},z+G+W}function rX0($,Z,J){return J.options.strong||"*"}function Al($,Z,J,H){return J.safe($.value,H)}function Dl($){let Z=$.options.ruleRepetition||3;if(Z<3)throw Error("Cannot serialize rules with repetition `"+Z+"` for `options.ruleRepetition`, expected `3` or more");return Z}function Vl($,Z,J){let H=(FN(J)+(J.options.ruleSpaces?" ":"")).repeat(Dl(J));return J.options.ruleSpaces?H.slice(0,-1):H}var aX={blockquote:sd,break:X_,code:Hl,definition:Bl,emphasis:z_,hardBreak:X_,heading:zl,html:G_,image:U_,imageReference:Y_,inlineCode:F_,link:W_,linkReference:N_,list:Yl,listItem:Kl,paragraph:Wl,root:Nl,strong:A_,text:Al,thematicBreak:Vl};function V_(){return{enter:{table:aX0,tableData:Ll,tableHeader:Ll,tableRow:nX0},exit:{codeText:sX0,table:oX0,tableData:D_,tableHeader:D_,tableRow:D_}}}function aX0($){let Z=$._align;G5(Z,"expected `_align` on table"),this.enter({type:"table",align:Z.map(function(J){return J==="none"?null:J}),children:[]},$),this.data.inTable=!0}function oX0($){this.exit($),this.data.inTable=void 0}function nX0($){this.enter({type:"tableRow",children:[]},$)}function D_($){this.exit($)}function Ll($){this.enter({type:"tableCell",children:[]},$)}function sX0($){let Z=this.resume();if(this.data.inTable)Z=Z.replace(/\\([\\|])/g,tX0);let J=this.stack[this.stack.length-1];G5(J.type==="inlineCode"),J.value=Z,this.exit($)}function tX0($,Z){return Z==="|"?Z:$}function L_($){let Z=$||{},J=Z.tableCellPadding,H=Z.tablePipeAlign,B=Z.stringLength,Q=J?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
50
|
+
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[\t :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:K,table:X,tableCell:G,tableRow:z}};function X(W,N,q,D){return U(Y(W,q,D),W.align)}function z(W,N,q,D){let A=F(W,q,D),V=U([A]);return V.slice(0,V.indexOf(`
|
|
51
|
+
`))}function G(W,N,q,D){let A=q.enter("tableCell"),V=q.enter("phrasing"),L=q.containerPhrasing(W,{...D,before:Q,after:Q});return V(),A(),L}function U(W,N){return nd(W,{align:N,alignDelimiters:H,padding:J,stringLength:B})}function Y(W,N,q){let D=W.children,A=-1,V=[],L=N.enter("table");while(++A<D.length)V[A]=F(D[A],N,q);return L(),V}function F(W,N,q){let D=W.children,A=-1,V=[],L=N.enter("tableRow");while(++A<D.length)V[A]=G(D[A],W,N,q);return L(),V}function K(W,N,q){let D=aX.inlineCode(W,N,q);if(q.stack.includes("tableCell"))D=D.replace(/\|/g,"\\$&");return D}}function M_(){return{exit:{taskListCheckValueChecked:Ml,taskListCheckValueUnchecked:Ml,paragraph:eX0}}}function P_(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:$z0}}}function Ml($){let Z=this.stack[this.stack.length-2];G5(Z.type==="listItem"),Z.checked=$.type==="taskListCheckValueChecked"}function eX0($){let Z=this.stack[this.stack.length-2];if(Z&&Z.type==="listItem"&&typeof Z.checked==="boolean"){let J=this.stack[this.stack.length-1];G5(J.type==="paragraph");let H=J.children[0];if(H&&H.type==="text"){let B=Z.children,Q=-1,X;while(++Q<B.length){let z=B[Q];if(z.type==="paragraph"){X=z;break}}if(X===J){if(H.value=H.value.slice(1),H.value.length===0)J.children.shift();else if(J.position&&H.position&&typeof H.position.start.offset==="number")H.position.start.column++,H.position.start.offset++,J.position.start=Object.assign({},H.position.start)}}}this.exit($)}function $z0($,Z,J,H){let B=$.children[0],Q=typeof $.checked==="boolean"&&B&&B.type==="paragraph",X="["+($.checked?"x":" ")+"] ",z=J.createTracker(H);if(Q)z.move(X);let G=aX.listItem($,Z,J,{...H,...z.current()});if(Q)G=G.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,U);return G;function U(Y){return Y+X}}function __(){return[$_(),J_(),B_(),V_(),M_()]}function O_($){return{extensions:[Z_(),H_($),Q_(),L_($),P_()]}}var Zz0={tokenize:Xz0,partial:!0},Pl={tokenize:zz0,partial:!0},_l={tokenize:Gz0,partial:!0},Ol={tokenize:Uz0,partial:!0},Jz0={tokenize:Yz0,partial:!0},Tl={name:"wwwAutolink",tokenize:Bz0,previous:Cl},jl={name:"protocolAutolink",tokenize:Qz0,previous:El},G6={name:"emailAutolink",tokenize:Hz0,previous:bl},E3={};function j_(){return{text:E3}}var VZ=48;while(VZ<123)if(E3[VZ]=G6,VZ++,VZ===58)VZ=65;else if(VZ===91)VZ=97;E3[43]=G6;E3[45]=G6;E3[46]=G6;E3[95]=G6;E3[72]=[G6,jl];E3[104]=[G6,jl];E3[87]=[G6,Tl];E3[119]=[G6,Tl];function Hz0($,Z,J){let H=this,B,Q;return X;function X(F){if(!T_(F)||!bl.call(H,H.previous)||C_(H.events))return J(F);return $.enter("literalAutolink"),$.enter("literalAutolinkEmail"),z(F)}function z(F){if(T_(F))return $.consume(F),z;if(F===64)return $.consume(F),G;return J(F)}function G(F){if(F===46)return $.check(Jz0,Y,U)(F);if(F===45||F===95||Z2(F))return Q=!0,$.consume(F),G;return Y(F)}function U(F){return $.consume(F),B=!0,G}function Y(F){if(Q&&B&&j2(H.previous))return $.exit("literalAutolinkEmail"),$.exit("literalAutolink"),Z(F);return J(F)}}function Bz0($,Z,J){let H=this;return B;function B(X){if(X!==87&&X!==119||!Cl.call(H,H.previous)||C_(H.events))return J(X);return $.enter("literalAutolink"),$.enter("literalAutolinkWww"),$.check(Zz0,$.attempt(Pl,$.attempt(_l,Q),J),J)(X)}function Q(X){return $.exit("literalAutolinkWww"),$.exit("literalAutolink"),Z(X)}}function Qz0($,Z,J){let H=this,B="",Q=!1;return X;function X(F){if((F===72||F===104)&&El.call(H,H.previous)&&!C_(H.events))return $.enter("literalAutolink"),$.enter("literalAutolinkHttp"),B+=String.fromCodePoint(F),$.consume(F),z;return J(F)}function z(F){if(j2(F)&&B.length<5)return B+=String.fromCodePoint(F),$.consume(F),z;if(F===58){let K=B.toLowerCase();if(K==="http"||K==="https")return $.consume(F),G}return J(F)}function G(F){if(F===47){if($.consume(F),Q)return U;return Q=!0,G}return J(F)}function U(F){return F===null||UZ(F)||v1(F)||O3(F)||YZ(F)?J(F):$.attempt(Pl,$.attempt(_l,Y),J)(F)}function Y(F){return $.exit("literalAutolinkHttp"),$.exit("literalAutolink"),Z(F)}}function Xz0($,Z,J){let H=0;return B;function B(X){if((X===87||X===119)&&H<3)return H++,$.consume(X),B;if(X===46&&H===3)return $.consume(X),Q;return J(X)}function Q(X){return X===null?J(X):Z(X)}}function zz0($,Z,J){let H,B,Q;return X;function X(U){if(U===46||U===95)return $.check(Ol,G,z)(U);if(U===null||v1(U)||O3(U)||U!==45&&YZ(U))return G(U);return Q=!0,$.consume(U),X}function z(U){if(U===95)H=!0;else B=H,H=void 0;return $.consume(U),X}function G(U){if(B||H||!Q)return J(U);return Z(U)}}function Gz0($,Z){let J=0,H=0;return B;function B(X){if(X===40)return J++,$.consume(X),B;if(X===41&&H<J)return Q(X);if(X===33||X===34||X===38||X===39||X===41||X===42||X===44||X===46||X===58||X===59||X===60||X===63||X===93||X===95||X===126)return $.check(Ol,Z,Q)(X);if(X===null||v1(X)||O3(X))return Z(X);return $.consume(X),B}function Q(X){if(X===41)H++;return $.consume(X),B}}function Uz0($,Z,J){return H;function H(z){if(z===33||z===34||z===39||z===41||z===42||z===44||z===46||z===58||z===59||z===63||z===95||z===126)return $.consume(z),H;if(z===38)return $.consume(z),Q;if(z===93)return $.consume(z),B;if(z===60||z===null||v1(z)||O3(z))return Z(z);return J(z)}function B(z){if(z===null||z===40||z===91||v1(z)||O3(z))return Z(z);return H(z)}function Q(z){return j2(z)?X(z):J(z)}function X(z){if(z===59)return $.consume(z),H;if(j2(z))return $.consume(z),X;return J(z)}}function Yz0($,Z,J){return H;function H(Q){return $.consume(Q),B}function B(Q){return Z2(Q)?J(Q):Z(Q)}}function Cl($){return $===null||$===40||$===42||$===95||$===91||$===93||$===126||v1($)}function El($){return!j2($)}function bl($){return!($===47||T_($))}function T_($){return $===43||$===45||$===46||$===95||Z2($)}function C_($){let Z=$.length,J=!1;while(Z--){let H=$[Z][1];if((H.type==="labelLink"||H.type==="labelImage")&&!H._balanced){J=!0;break}if(H._gfmAutolinkLiteralWalkedInto){J=!1;break}}if($.length>0&&!J)$[$.length-1][1]._gfmAutolinkLiteralWalkedInto=!0;return J}var Fz0={tokenize:Vz0,partial:!0};function E_(){return{document:{[91]:{name:"gfmFootnoteDefinition",tokenize:qz0,continuation:{tokenize:Az0},exit:Dz0}},text:{[91]:{name:"gfmFootnoteCall",tokenize:Nz0},[93]:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:Kz0,resolveTo:Wz0}}}}function Kz0($,Z,J){let H=this,B=H.events.length,Q=H.parser.gfmFootnotes||(H.parser.gfmFootnotes=[]),X;while(B--){let G=H.events[B][1];if(G.type==="labelImage"){X=G;break}if(G.type==="gfmFootnoteCall"||G.type==="labelLink"||G.type==="label"||G.type==="image"||G.type==="link")break}return z;function z(G){if(!X||!X._balanced)return J(G);let U=j4(H.sliceSerialize({start:X.end,end:H.now()}));if(U.codePointAt(0)!==94||!Q.includes(U.slice(1)))return J(G);return $.enter("gfmFootnoteCallLabelMarker"),$.consume(G),$.exit("gfmFootnoteCallLabelMarker"),Z(G)}}function Wz0($,Z){let J=$.length,H;while(J--)if($[J][1].type==="labelImage"&&$[J][0]==="enter"){H=$[J][1];break}$[J+1][1].type="data",$[J+3][1].type="gfmFootnoteCallLabelMarker";let B={type:"gfmFootnoteCall",start:Object.assign({},$[J+3][1].start),end:Object.assign({},$[$.length-1][1].end)},Q={type:"gfmFootnoteCallMarker",start:Object.assign({},$[J+3][1].end),end:Object.assign({},$[J+3][1].end)};Q.end.column++,Q.end.offset++,Q.end._bufferIndex++;let X={type:"gfmFootnoteCallString",start:Object.assign({},Q.end),end:Object.assign({},$[$.length-1][1].start)},z={type:"chunkString",contentType:"string",start:Object.assign({},X.start),end:Object.assign({},X.end)},G=[$[J+1],$[J+2],["enter",B,Z],$[J+3],$[J+4],["enter",Q,Z],["exit",Q,Z],["enter",X,Z],["enter",z,Z],["exit",z,Z],["exit",X,Z],$[$.length-2],$[$.length-1],["exit",B,Z]];return $.splice(J,$.length-J+1,...G),$}function Nz0($,Z,J){let H=this,B=H.parser.gfmFootnotes||(H.parser.gfmFootnotes=[]),Q=0,X;return z;function z(F){return $.enter("gfmFootnoteCall"),$.enter("gfmFootnoteCallLabelMarker"),$.consume(F),$.exit("gfmFootnoteCallLabelMarker"),G}function G(F){if(F!==94)return J(F);return $.enter("gfmFootnoteCallMarker"),$.consume(F),$.exit("gfmFootnoteCallMarker"),$.enter("gfmFootnoteCallString"),$.enter("chunkString").contentType="string",U}function U(F){if(Q>999||F===93&&!X||F===null||F===91||v1(F))return J(F);if(F===93){$.exit("chunkString");let K=$.exit("gfmFootnoteCallString");if(!B.includes(j4(H.sliceSerialize(K))))return J(F);return $.enter("gfmFootnoteCallLabelMarker"),$.consume(F),$.exit("gfmFootnoteCallLabelMarker"),$.exit("gfmFootnoteCall"),Z}if(!v1(F))X=!0;return Q++,$.consume(F),F===92?Y:U}function Y(F){if(F===91||F===92||F===93)return $.consume(F),Q++,U;return U(F)}}function qz0($,Z,J){let H=this,B=H.parser.gfmFootnotes||(H.parser.gfmFootnotes=[]),Q,X=0,z;return G;function G(N){return $.enter("gfmFootnoteDefinition")._container=!0,$.enter("gfmFootnoteDefinitionLabel"),$.enter("gfmFootnoteDefinitionLabelMarker"),$.consume(N),$.exit("gfmFootnoteDefinitionLabelMarker"),U}function U(N){if(N===94)return $.enter("gfmFootnoteDefinitionMarker"),$.consume(N),$.exit("gfmFootnoteDefinitionMarker"),$.enter("gfmFootnoteDefinitionLabelString"),$.enter("chunkString").contentType="string",Y;return J(N)}function Y(N){if(X>999||N===93&&!z||N===null||N===91||v1(N))return J(N);if(N===93){$.exit("chunkString");let q=$.exit("gfmFootnoteDefinitionLabelString");return Q=j4(H.sliceSerialize(q)),$.enter("gfmFootnoteDefinitionLabelMarker"),$.consume(N),$.exit("gfmFootnoteDefinitionLabelMarker"),$.exit("gfmFootnoteDefinitionLabel"),K}if(!v1(N))z=!0;return X++,$.consume(N),N===92?F:Y}function F(N){if(N===91||N===92||N===93)return $.consume(N),X++,Y;return Y(N)}function K(N){if(N===58){if($.enter("definitionMarker"),$.consume(N),$.exit("definitionMarker"),!B.includes(Q))B.push(Q);return J1($,W,"gfmFootnoteDefinitionWhitespace")}return J(N)}function W(N){return Z(N)}}function Az0($,Z,J){return $.check(T3,Z,$.attempt(Fz0,Z,J))}function Dz0($){$.exit("gfmFootnoteDefinition")}function Vz0($,Z,J){let H=this;return J1($,B,"gfmFootnoteDefinitionIndent",5);function B(Q){let X=H.events[H.events.length-1];return X&&X[1].type==="gfmFootnoteDefinitionIndent"&&X[2].sliceSerialize(X[1],!0).length===4?Z(Q):J(Q)}}function b_($){let J=($||{}).singleTilde,H={name:"strikethrough",tokenize:Q,resolveAll:B};if(J===null||J===void 0)J=!0;return{text:{[126]:H},insideSpan:{null:[H]},attentionMarkers:{null:[126]}};function B(X,z){let G=-1;while(++G<X.length)if(X[G][0]==="enter"&&X[G][1].type==="strikethroughSequenceTemporary"&&X[G][1]._close){let U=G;while(U--)if(X[U][0]==="exit"&&X[U][1].type==="strikethroughSequenceTemporary"&&X[U][1]._open&&X[G][1].end.offset-X[G][1].start.offset===X[U][1].end.offset-X[U][1].start.offset){X[G][1].type="strikethroughSequence",X[U][1].type="strikethroughSequence";let Y={type:"strikethrough",start:Object.assign({},X[U][1].start),end:Object.assign({},X[G][1].end)},F={type:"strikethroughText",start:Object.assign({},X[U][1].end),end:Object.assign({},X[G][1].start)},K=[["enter",Y,z],["enter",X[U][1],z],["exit",X[U][1],z],["enter",F,z]],W=z.parser.constructs.insideSpan.null;if(W)z2(K,K.length,0,h7(W,X.slice(U+1,G),z));z2(K,K.length,0,[["exit",F,z],["enter",X[G][1],z],["exit",X[G][1],z],["exit",Y,z]]),z2(X,U-1,G-U+3,K),G=U+K.length-2;break}}G=-1;while(++G<X.length)if(X[G][1].type==="strikethroughSequenceTemporary")X[G][1].type="data";return X}function Q(X,z,G){let U=this.previous,Y=this.events,F=0;return K;function K(N){if(U===126&&Y[Y.length-1][1].type!=="characterEscape")return G(N);return X.enter("strikethroughSequenceTemporary"),W(N)}function W(N){let q=Q6(U);if(N===126){if(F>1)return G(N);return X.consume(N),F++,W}if(F<2&&!J)return G(N);let D=X.exit("strikethroughSequenceTemporary"),A=Q6(N);return D._open=!A||A===2&&Boolean(q),D._close=!q||q===2&&Boolean(A),z(N)}}}class w_{constructor(){this.map=[]}add($,Z,J){Lz0(this,$,Z,J)}consume($){if(this.map.sort(function(B,Q){return B[0]-Q[0]}),this.map.length===0)return;let Z=this.map.length,J=[];while(Z>0)Z-=1,J.push($.slice(this.map[Z][0]+this.map[Z][1]),this.map[Z][2]),$.length=this.map[Z][0];J.push($.slice()),$.length=0;let H=J.pop();while(H){for(let B of H)$.push(B);H=J.pop()}this.map.length=0}}function Lz0($,Z,J,H){let B=0;if(J===0&&H.length===0)return;while(B<$.map.length){if($.map[B][0]===Z){$.map[B][1]+=J,$.map[B][2].push(...H);return}B+=1}$.map.push([Z,J,H])}function wl($,Z){let J=!1,H=[];while(Z<$.length){let B=$[Z];if(J){if(B[0]==="enter"){if(B[1].type==="tableContent")H.push($[Z+1][1].type==="tableDelimiterMarker"?"left":"none")}else if(B[1].type==="tableContent"){if($[Z-1][1].type==="tableDelimiterMarker"){let Q=H.length-1;H[Q]=H[Q]==="left"?"center":"right"}}else if(B[1].type==="tableDelimiterRow")break}else if(B[0]==="enter"&&B[1].type==="tableDelimiterRow")J=!0;Z+=1}return H}function S_(){return{flow:{null:{name:"table",tokenize:Mz0,resolveAll:Pz0}}}}function Mz0($,Z,J){let H=this,B=0,Q=0,X;return z;function z(T){let k=H.events.length-1;while(k>-1){let j=H.events[k][1].type;if(j==="lineEnding"||j==="linePrefix")k--;else break}let S=k>-1?H.events[k][1].type:null,I=S==="tableHead"||S==="tableRow"?_:G;if(I===_&&H.parser.lazy[H.now().line])return J(T);return I(T)}function G(T){return $.enter("tableHead"),$.enter("tableRow"),U(T)}function U(T){if(T===124)return Y(T);return X=!0,Q+=1,Y(T)}function Y(T){if(T===null)return J(T);if(u0(T)){if(Q>1)return Q=0,H.interrupt=!0,$.exit("tableRow"),$.enter("lineEnding"),$.consume(T),$.exit("lineEnding"),W;return J(T)}if(X1(T))return J1($,Y,"whitespace")(T);if(Q+=1,X)X=!1,B+=1;if(T===124)return $.enter("tableCellDivider"),$.consume(T),$.exit("tableCellDivider"),X=!0,Y;return $.enter("data"),F(T)}function F(T){if(T===null||T===124||v1(T))return $.exit("data"),Y(T);return $.consume(T),T===92?K:F}function K(T){if(T===92||T===124)return $.consume(T),F;return F(T)}function W(T){if(H.interrupt=!1,H.parser.lazy[H.now().line])return J(T);if($.enter("tableDelimiterRow"),X=!1,X1(T))return J1($,N,"linePrefix",H.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(T);return N(T)}function N(T){if(T===45||T===58)return D(T);if(T===124)return X=!0,$.enter("tableCellDivider"),$.consume(T),$.exit("tableCellDivider"),q;return M(T)}function q(T){if(X1(T))return J1($,D,"whitespace")(T);return D(T)}function D(T){if(T===58)return Q+=1,X=!0,$.enter("tableDelimiterMarker"),$.consume(T),$.exit("tableDelimiterMarker"),A;if(T===45)return Q+=1,A(T);if(T===null||u0(T))return O(T);return M(T)}function A(T){if(T===45)return $.enter("tableDelimiterFiller"),V(T);return M(T)}function V(T){if(T===45)return $.consume(T),V;if(T===58)return X=!0,$.exit("tableDelimiterFiller"),$.enter("tableDelimiterMarker"),$.consume(T),$.exit("tableDelimiterMarker"),L;return $.exit("tableDelimiterFiller"),L(T)}function L(T){if(X1(T))return J1($,O,"whitespace")(T);return O(T)}function O(T){if(T===124)return N(T);if(T===null||u0(T)){if(!X||B!==Q)return M(T);return $.exit("tableDelimiterRow"),$.exit("tableHead"),Z(T)}return M(T)}function M(T){return J(T)}function _(T){return $.enter("tableRow"),w(T)}function w(T){if(T===124)return $.enter("tableCellDivider"),$.consume(T),$.exit("tableCellDivider"),w;if(T===null||u0(T))return $.exit("tableRow"),Z(T);if(X1(T))return J1($,w,"whitespace")(T);return $.enter("data"),C(T)}function C(T){if(T===null||T===124||v1(T))return $.exit("data"),w(T);return $.consume(T),T===92?E:C}function E(T){if(T===92||T===124)return $.consume(T),C;return C(T)}}function Pz0($,Z){let J=-1,H=!0,B=0,Q=[0,0,0,0],X=[0,0,0,0],z=!1,G=0,U,Y,F,K=new w_;while(++J<$.length){let W=$[J],N=W[1];if(W[0]==="enter"){if(N.type==="tableHead"){if(z=!1,G!==0)Sl(K,Z,G,U,Y),Y=void 0,G=0;U={type:"table",start:Object.assign({},N.start),end:Object.assign({},N.end)},K.add(J,0,[["enter",U,Z]])}else if(N.type==="tableRow"||N.type==="tableDelimiterRow"){if(H=!0,F=void 0,Q=[0,0,0,0],X=[0,J+1,0,0],z)z=!1,Y={type:"tableBody",start:Object.assign({},N.start),end:Object.assign({},N.end)},K.add(J,0,[["enter",Y,Z]]);B=N.type==="tableDelimiterRow"?2:Y?3:1}else if(B&&(N.type==="data"||N.type==="tableDelimiterMarker"||N.type==="tableDelimiterFiller")){if(H=!1,X[2]===0){if(Q[1]!==0)X[0]=X[1],F=KN(K,Z,Q,B,void 0,F),Q=[0,0,0,0];X[2]=J}}else if(N.type==="tableCellDivider")if(H)H=!1;else{if(Q[1]!==0)X[0]=X[1],F=KN(K,Z,Q,B,void 0,F);Q=X,X=[Q[1],J,0,0]}}else if(N.type==="tableHead")z=!0,G=J;else if(N.type==="tableRow"||N.type==="tableDelimiterRow"){if(G=J,Q[1]!==0)X[0]=X[1],F=KN(K,Z,Q,B,J,F);else if(X[1]!==0)F=KN(K,Z,X,B,J,F);B=0}else if(B&&(N.type==="data"||N.type==="tableDelimiterMarker"||N.type==="tableDelimiterFiller"))X[3]=J}if(G!==0)Sl(K,Z,G,U,Y);K.consume(Z.events),J=-1;while(++J<Z.events.length){let W=Z.events[J];if(W[0]==="enter"&&W[1].type==="table")W[1]._align=wl(Z.events,J)}return $}function KN($,Z,J,H,B,Q){let X=H===1?"tableHeader":H===2?"tableDelimiter":"tableData",z="tableContent";if(J[0]!==0)Q.end=Object.assign({},rH(Z.events,J[0])),$.add(J[0],0,[["exit",Q,Z]]);let G=rH(Z.events,J[1]);if(Q={type:X,start:Object.assign({},G),end:Object.assign({},G)},$.add(J[1],0,[["enter",Q,Z]]),J[2]!==0){let U=rH(Z.events,J[2]),Y=rH(Z.events,J[3]),F={type:"tableContent",start:Object.assign({},U),end:Object.assign({},Y)};if($.add(J[2],0,[["enter",F,Z]]),H!==2){let K=Z.events[J[2]],W=Z.events[J[3]];if(K[1].end=Object.assign({},W[1].end),K[1].type="chunkText",K[1].contentType="text",J[3]>J[2]+1){let N=J[2]+1,q=J[3]-J[2]-1;$.add(N,q,[])}}$.add(J[3]+1,0,[["exit",F,Z]])}if(B!==void 0)Q.end=Object.assign({},rH(Z.events,B)),$.add(B,0,[["exit",Q,Z]]),Q=void 0;return Q}function Sl($,Z,J,H,B){let Q=[],X=rH(Z.events,J);if(B)B.end=Object.assign({},X),Q.push(["exit",B,Z]);H.end=Object.assign({},X),Q.push(["exit",H,Z]),$.add(J+1,0,Q)}function rH($,Z){let J=$[Z],H=J[0]==="enter"?"start":"end";return J[1][H]}var _z0={name:"tasklistCheck",tokenize:Oz0};function R_(){return{text:{[91]:_z0}}}function Oz0($,Z,J){let H=this;return B;function B(G){if(H.previous!==null||!H._gfmTasklistFirstContentOfListItem)return J(G);return $.enter("taskListCheck"),$.enter("taskListCheckMarker"),$.consume(G),$.exit("taskListCheckMarker"),Q}function Q(G){if(v1(G))return $.enter("taskListCheckValueUnchecked"),$.consume(G),$.exit("taskListCheckValueUnchecked"),X;if(G===88||G===120)return $.enter("taskListCheckValueChecked"),$.consume(G),$.exit("taskListCheckValueChecked"),X;return J(G)}function X(G){if(G===93)return $.enter("taskListCheckMarker"),$.consume(G),$.exit("taskListCheckMarker"),$.exit("taskListCheck"),z;return J(G)}function z(G){if(u0(G))return Z(G);if(X1(G))return $.check({tokenize:Tz0},Z,J)(G);return J(G)}}function Tz0($,Z,J){return J1($,H,"whitespace");function H(B){return B===null?J(B):Z(B)}}function Rl($){return CW([j_(),E_(),b_($),S_(),R_()])}var jz0={};function WN($){let Z=this,J=$||jz0,H=Z.data(),B=H.micromarkExtensions||(H.micromarkExtensions=[]),Q=H.fromMarkdownExtensions||(H.fromMarkdownExtensions=[]),X=H.toMarkdownExtensions||(H.toMarkdownExtensions=[]);B.push(Rl(J)),Q.push(__()),X.push(O_(J))}var LZ=P(u(),1),Cz0=[WN],Ez0=[YN],bz0={code({node:$,className:Z,children:J,...H}){return LZ.jsx("code",{className:Q0("rounded-xs bg-accent px-1 py-0.5 font-mono font-normal before:content-none after:content-none",Z),...H,children:J})},pre({children:$}){return LZ.jsx("div",{className:"not-prose my-2 rounded-lg border border-border bg-accent px-3 py-2.5",children:LZ.jsx("pre",{className:"overflow-auto font-mono text-xs leading-relaxed whitespace-pre text-foreground [&>code]:rounded-none [&>code]:bg-transparent [&>code]:p-0",children:$})})}};function Il({size:$="sm",content:Z}){let J=d1(),{base:H}=w2();return LZ.jsx("div",{className:Q0("prose max-w-full min-w-0 wrap-anywhere prose-inherit",$==="sm"&&"prose-sm"),children:LZ.jsx(tW,{remarkPlugins:Cz0,rehypePlugins:Ez0,components:bz0,urlTransform:(B,Q,X)=>{if(X.tagName==="a"&&Q==="href"&&B.startsWith("moi:"))try{return O8(B,{workspaceId:J,base:H})}catch{return""}return eW(B)},children:Z})})}function kl({content:$}){return LZ.jsx(tW,{allowedElements:[],skipHtml:!0,unwrapDisallowed:!0,children:$})}var e_=P(m(),1);var yl="/airtable-hsa66v6q.png";var xl="/apollo-2ed5dy2d.png";var hl="/asana-tvgtwbx2.png";var vl="/atlassian-b3tq39hs.png";var fl="/box-w3n36t5g.png";var I_="/chrome-tspm94rw.svg";var gl="/clickup-qqrqqvqb.png";var ml="/cloudflare-j9p931v6.png";var ul="/context7-8ht0xjfy.png";var pl="/datadog-70ne3yzt.png";var cl="/discord-vejhptwx.png";var dl="/dropbox-4m5s9mgr.png";var ll="/elevenlabs-2nzzej1t.png";var il="/exa-qqj3vr0x.png";var rl="/figma-y9898rry.png";var al="/firecrawl-w2t8nehx.png";var ol="/github-av5r5y3e.png";var nl="/gitlab-4pv5vm6b.png";var sl="/gmail-sg6a5v3x.png";var tl="/googlecalendar-nqhh2v7r.png";var el="/googledrive-6s8xyab7.png";var $i="/grafana-1yfsnwr6.png";var Zi="/granola-7j3b0nk2.png";var Ji="/hubspot-hghcmc2t.png";var Hi="/huggingface-kxzaxj83.png";var Bi="/intercom-td763jt8.png";var Qi="/linear-v9s3az2d.png";var Xi="/monday-jdbs4wwf.png";var zi="/mongodb-emzxvhd5.png";var Gi="/neon-zj4qar44.png";var Ui="/notion-w034c0b8.png";var Yi="/paper-zbt34fab.png";var Fi="/paypal-kwwf7xsc.png";var Ki="/perplexity-4y63rxvj.png";var Wi="/postgresql-qsspbsr1.png";var Ni="/posthog-sphppc4w.png";var qi="/puppeteer-2xjt1a9b.png";var Ai="/railway-834de8d2.png";var Di="/redis-spm6w2m1.png";var Vi="/salesforce-1mk56v4z.png";var Li="/sentry-hdwpmvek.png";var Mi="/shopify-90dadaav.png";var Pi="/slack-1c1wj62s.png";var _i="/snowflake-hfpykpgy.png";var Oi="/stripe-zrfaqbj3.png";var Ti="/supabase-4vg33zf2.png";var ji="/telegram-v6tjyrs7.png";var Ci="/twilio-dpyjdwpj.png";var Ei="/vercel-7d0ssw28.png";var bi="/zapier-p67qfch0.png";var jG0={airtable:yl,apollo:xl,asana:hl,atlassian:vl,box:fl,chrome:I_,"chrome-devtools":I_,clickup:gl,cloudflare:ml,context7:ul,datadog:pl,discord:cl,dropbox:dl,elevenlabs:ll,exa:il,figma:rl,firecrawl:al,github:ol,gitlab:nl,gmail:sl,googlecalendar:tl,googledrive:el,grafana:$i,granola:Zi,hubspot:Ji,huggingface:Hi,intercom:Bi,linear:Qi,monday:Xi,mongodb:zi,neon:Gi,notion:Ui,paper:Yi,paypal:Fi,perplexity:Ki,postgresql:Wi,posthog:Ni,puppeteer:qi,railway:Ai,redis:Di,salesforce:Vi,sentry:Li,shopify:Mi,slack:Pi,snowflake:_i,stripe:Oi,supabase:Ti,telegram:ji,twilio:Ci,vercel:Ei,zapier:bi},CG0={"google drive":"googledrive","google calendar":"googlecalendar",gcal:"googlecalendar",gdrive:"googledrive","apollo.io":"apollo","paper-desktop":"paper","granola-mcp":"granola","claude-in-chrome":"chrome",postgres:"postgresql","hugging face":"huggingface",jira:"atlassian",confluence:"atlassian"};function wi($){let Z=$.match(/^claude[._]ai[._\s]+(.+)$/i);if(!Z)return $;return Z[1].replace(/_/g," ")}function NN($){return $.toLowerCase().replace(/[\s._-]+/g,"")}var EG0=new Map(Object.entries(jG0).map(([$,Z])=>[NN($),Z])),bG0=new Map(Object.entries(CG0).map(([$,Z])=>[NN($),NN(Z)]));function qN($){let Z=NN(wi($));return EG0.get(bG0.get(Z)??Z)}function AN($){return wi($).split(/[\s._-]+/).filter(Boolean).map((Z)=>Z[0].toUpperCase()+Z.slice(1)).join(" ")}var k_=P(u(),1);function oX({open:$,children:Z}){return k_.jsx(m4,{initial:!1,children:$&&k_.jsx(K5.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{type:"spring",duration:0.25,bounce:0.1},className:"overflow-hidden",children:Z},"content")})}var Si=P(m(),1);var ki=P(u(),1),wG0=/\.(png|jpe?g|gif|webp|avif|svg)$/i;function Ri($,Z){if($.name!=="Read"||!Z)return null;let J=$.input,H=typeof J.file_path==="string"?J.file_path:null;if(!H||!wG0.test(H))return null;let B=Z.endsWith("/")?Z:`${Z}/`;if(!H.startsWith(B))return null;return H.slice(B.length)}function Ii({relPath:$}){let Z=d1(),[J,H]=Si.useState(!1);if(J)return null;let B=`/api/workspaces/${Z}/preview/${$.split("/").map(encodeURIComponent).join("/")}`;return ki.jsx("img",{src:B,alt:$,loading:"lazy",onError:()=>H(!0),className:"max-h-64 max-w-full self-start rounded-lg border border-border object-contain"})}var eX=P(m(),1);var xi=P(u(),1),SG0=Q0("animate-[text-shimmer_2s_ease-in-out_infinite]","bg-clip-text text-transparent","bg-[length:200%_auto]","bg-[linear-gradient(90deg,var(--muted-foreground)_0%,var(--muted-foreground)_40%,var(--foreground)_50%,var(--muted-foreground)_60%,var(--muted-foreground)_100%)]");function yi({children:$,active:Z=!0,className:J}){return xi.jsx("span",{className:Q0(J,Z&&SG0),children:$})}var nX=P(u(),1);function DN({className:$}){return nX.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",className:$,"aria-hidden":"true",children:[nX.jsx("path",{d:"M3.49994 11.7501L11.6717 3.57855C12.7762 2.47398 14.5672 2.47398 15.6717 3.57855C16.7762 4.68312 16.7762 6.47398 15.6717 7.57855M15.6717 7.57855L9.49994 13.7501M15.6717 7.57855C16.7762 6.47398 18.5672 6.47398 19.6717 7.57855C20.7762 8.68312 20.7762 10.474 19.6717 11.5785L12.7072 18.543C12.3167 18.9335 12.3167 19.5667 12.7072 19.9572L13.9999 21.2499"}),nX.jsx("path",{d:"M17.4999 9.74921L11.3282 15.921C10.2238 17.0255 8.43275 17.0255 7.32825 15.921C6.22376 14.8164 6.22376 13.0255 7.32825 11.921L13.4999 5.74939"})]})}var C2=P(u(),1),VN="group/row flex w-full items-center gap-2 py-1.5 text-left select-none";function oH({isFirst:$,isLast:Z,marker:J,loading:H=!1,isError:B=!1,children:Q}){let X=J!=null||H;return C2.jsxs("div",{className:"relative flex gap-2.5",children:[C2.jsxs("div",{className:"relative w-[13px] shrink-0",children:[!$&&C2.jsx("span",{className:Q0("absolute top-0 left-1/2 w-px -translate-x-1/2 bg-border",X?"h-1":"h-2.5")}),!Z&&C2.jsx("span",{className:Q0("absolute bottom-0 left-1/2 w-px -translate-x-1/2 bg-border",X?"top-[26px]":"top-5")}),J?C2.jsx("span",{className:"absolute top-[15px] left-1/2 z-10 -translate-x-1/2 -translate-y-1/2",children:J}):H?C2.jsx("span",{className:"absolute top-[15px] left-1/2 z-10 flex -translate-x-1/2 -translate-y-1/2 p-0.5",children:C2.jsx(r5,{size:12,stroke:1.75,className:"animate-spin text-muted-foreground"})}):C2.jsx("span",{className:Q0("absolute top-[15px] left-1/2 z-10 size-[5px] -translate-x-1/2 -translate-y-1/2 rounded-full",B?"bg-destructive":"bg-border")})]}),Q]})}function sX({open:$}){return C2.jsx(K5.span,{animate:{rotate:$?90:0},transition:{type:"spring",duration:0.2,bounce:0.1},className:Q0("flex shrink-0",$?"opacity-100":"opacity-0 group-hover/row:opacity-100"),children:C2.jsx(B6,{size:12,stroke:1.75})})}function aH({children:$,className:Z}){return C2.jsx("span",{className:Q0("flex size-4 items-center justify-center overflow-hidden rounded-xs bg-muted",Z),children:$})}function hi({icon:$,size:Z=12,stroke:J=1.75}){return C2.jsx(aH,{children:C2.jsx($,{size:Z,stroke:J,className:"text-muted-foreground"})})}function vi({src:$}){if(!$)return C2.jsx(aH,{children:C2.jsx(DN,{className:"size-3 text-muted-foreground"})});return C2.jsx(aH,{children:C2.jsx("img",{src:$,alt:"",className:"size-full object-cover"})})}var uG0=mi(),y_=ri();function pG0($){if(!$)return"$";return/^[A-Za-z_][A-Za-z0-9_]*$/.test($)?`$${$}`:`\${${$}}`}function cG0($){try{return y_($,pG0)}catch{return null}}function ai($){return $.split("/").pop()??$}var dG0=new Set(["bash","sh","zsh","fish","dash","ash","ksh","mksh","csh","tcsh","nu","pwsh","powershell"]),lG0=new Set(["-o","+o","-O","+O","--rcfile","--init-file"]),iG0=/^[A-Za-z_][A-Za-z0-9_]*=/;function rG0($){if(/^-[a-zA-Z]*c$/.test($))return!0;let Z=$.toLowerCase();return Z==="--command"||Z==="-command"}function aG0($){let Z=cG0($);if(!Z||Z.length<3)return null;let J=(Q)=>{let X=Z[Q];return typeof X==="string"?X:null},H=0,B=()=>{while(iG0.test(J(H)??""))H++};if(B(),ai(J(H)??"")==="env")H++,B();if(!dG0.has(ai(J(H)??"")))return null;H++;while(H<Z.length){let Q=J(H);if(Q===null)return null;if(rG0(Q)){if(H+2!==Z.length)return null;return J(H+1)?.trim()||null}if(!Q.startsWith("-")&&!Q.startsWith("+"))return null;H+=lG0.has(Q)?2:1}return null}function oG0($){let Z=$;for(let J=0;J<3;J++){let H=aG0(Z);if(H===null)return Z;Z=H}return Z}function nG0($){return $.replace(/\\\r?\n[ \t]*/g," ").replace(/[ \t]*\r?\n[ \t]*/g," ").replace(/[ \t]{2,}/g," ").trim()}function PZ($){return nG0(oG0($))}function nH($,Z){let J=PZ($);return J?Z(`$ ${J}`):""}var sG0=/^[A-Za-z]:\//;function tG0($=""){if(!$)return $;return $.replace(/\\/g,"/").replace(sG0,(Z)=>Z.toUpperCase())}var eG0=/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;var oi=/^\/([A-Za-z]:)?$/;function $U0(){if(typeof process<"u"&&typeof process.cwd==="function")return process.cwd().replace(/\\/g,"/");return"/"}var x_=function(...$){$=$.map((H)=>tG0(H));let Z="",J=!1;for(let H=$.length-1;H>=-1&&!J;H--){let B=H>=0?$[H]:$U0();if(!B||B.length===0)continue;Z=`${B}/${Z}`,J=h_(B)}if(Z=ni(Z,!J),J&&!h_(Z))return`/${Z}`;return Z.length>0?Z:"."};function ni($,Z){let J="",H=0,B=-1,Q=0,X=null;for(let z=0;z<=$.length;++z){if(z<$.length)X=$[z];else if(X==="/")break;else X="/";if(X==="/"){if(B===z-1||Q===1);else if(Q===2){if(J.length<2||H!==2||J[J.length-1]!=="."||J[J.length-2]!=="."){if(J.length>2){let G=J.lastIndexOf("/");if(G===-1)J="",H=0;else J=J.slice(0,G),H=J.length-1-J.lastIndexOf("/");B=z,Q=0;continue}else if(J.length>0){J="",H=0,B=z,Q=0;continue}}if(Z)J+=J.length>0?"/..":"..",H=2}else{if(J.length>0)J+=`/${$.slice(B+1,z)}`;else J=$.slice(B+1,z);H=z-B-1}B=z,Q=0}else if(X==="."&&Q!==-1)++Q;else Q=-1}return J}var h_=function($){return eG0.test($)};var v_=function($,Z){let J=x_($).replace(oi,"$1").split("/"),H=x_(Z).replace(oi,"$1").split("/");if(H[0][1]===":"&&J[0][1]===":"&&J[0]!==H[0])return H.join("/");let B=[...J];for(let Q of B){if(H[0]!==Q)break;J.shift(),H.shift()}return[...J.map(()=>".."),...H].join("/")};function sH($){return $.input??{}}function N1($,Z){let J=$[Z];return typeof J==="string"?J:""}function si($){return(Z)=>Z.replace(/\/[^\s"']+/g,(J)=>{if(!$)return J;let H=v_($,J);return H.startsWith("..")?J:H})}function _Z($){let Z=Math.max(1,Math.round($/1000));if(Z<60)return`${Z}s`;let J=Math.floor(Z/60),H=Z%60;return H?`${J}m ${H}s`:`${J}m`}var ZU0={ToolSearch:"Tool search",WebSearch:"Web search",WebFetch:"Web fetch"};function JU0($){if(!$.startsWith("mcp__"))return $;let Z=$.slice(5).split("__");return Z.length>=2?Z.slice(1).join("__"):Z[0]}function HU0($,Z){let J=$.name,H=sH($);if(J==="Bash")return nH(N1(H,"command"),Z);if(J==="Read"||J==="Write"||J==="Edit")return Z(N1(H,"file_path"));if(J==="Glob")return Z(N1(H,"pattern"));if(J==="Grep")return`/${N1(H,"pattern")}/ ${Z(N1(H,"path"))}`;if(J==="WebSearch")return N1(H,"query");if(J==="WebFetch")return N1(H,"url");if(J==="ToolSearch"){let B=N1(H,"query");if(B.startsWith("select:"))return B.slice(7).split(",").map(JU0).join(", ");return B}return""}var tX={displayName:($)=>ZU0[$.name]??$.name,brief:HU0};var f_={exec:"Bash",apply_patch:"Edit",web_search:"Web search",update_plan:"Update plan",subagent:"Run sub-agent",subagent_activity:"Sub-agent",review:"Review",view_image:"View image",generate_image:"Generate image",list_mcp_resources:"List MCP resources",list_mcp_resource_templates:"List MCP templates",read_mcp_resource:"Read MCP resource"},ei={read:"Read",listFiles:"List files",search:"Search"};function $r($){let Z=$?.commandActions;if(!Array.isArray(Z)||Z.length===0)return null;let J=Z[0],H=J?.type;if(!H||!(H in ei))return null;if(Z.some((B)=>B?.type!==H))return null;return J}var ti={spawn_agent:"Run sub-agent",send_input:"Message the agent",resume_agent:"Resume the agent",close_agent:"Stopping the agent"};function BU0($){if($.name==="exec"){let Z=$r($.input);if(Z?.type)return ei[Z.type]}if($.name==="subagent"){let Z=$.input?.action;if(typeof Z==="string"&&Z in ti)return ti[Z]}return f_[$.name]??$.name}function QU0($,Z){let J=$.name,H=sH($);if(J==="exec"){let B=$r(H);if(B?.type==="read")return Z(B.path||B.name||"");if(B?.type==="search")return[B.query&&`/${B.query}/`,B.path&&Z(B.path)].filter(Boolean).join(" ");if(B?.type==="listFiles")return B.path?Z(B.path):"";return nH(N1(H,"command"),Z)}if(J==="apply_patch"){let B=H.changes;if(Array.isArray(B))return B.map((X)=>X&&typeof X==="object"?X.path:void 0).filter((X)=>typeof X==="string").map(Z).join(", ");return""}if(J==="web_search"){let B=H.queries;if(Array.isArray(B)&&B.length>0)return B.filter((Q)=>typeof Q==="string").join(" · ");return N1(H,"query")||[N1(H,"url"),N1(H,"pattern")].filter(Boolean).join(" · ")}if(J==="update_plan"){let B=H.plan;return typeof B==="string"?B.split(`
|
|
52
|
+
`)[0]:""}if(J==="subagent"){if(N1(H,"action")==="close_agent")return"";return N1(H,"prompt")}if(J==="subagent_activity")return N1(H,"kind");if(J==="generate_image")return N1(H,"prompt").split(`
|
|
53
|
+
`)[0];if(J==="read_mcp_resource")return N1(H,"uri");if(J==="list_mcp_resources"||J==="list_mcp_resource_templates")return N1(H,"server");return""}var Zr={displayName:BU0,brief:QU0};function Jr($){let Z=$.indexOf(":"),J=(Z>0?$.slice(0,Z):$).trim(),H=Z>0?$.slice(Z+1).trim():"",B=J.match(/^(.*?)\s*\(([^)]*)\)$/);if(!B)return{action:J,qualifier:"",detail:H};return{action:B[1].trim(),qualifier:B[2].trim(),detail:H}}var XU0={terminal:"Run command",read:"Read",write:"Write",edit:"Edit",patch:"Edit",search:"Search",extract:"Fetch webpage","web extract":"Fetch webpage","web search":"Web search",delegate:"Delegate task","delegate batch":"Delegate tasks",todo:"Update TODO",python:"Run Python","process wait":"Wait for process","session search":"Search sessions","skills list":"List skills","skill view":"View skill"};function zU0($){let{action:Z}=Jr($.name),J=XU0[Z];if(J)return J;let H=Z.replace(/_/g," ");return H.charAt(0).toUpperCase()+H.slice(1)}function GU0($,Z){let{action:J,qualifier:H,detail:B}=Jr($.name),Q=B||H;if(!Q)return"";return J==="terminal"?`$ ${PZ(Q)}`:Z(Q)}var Hr={displayName:zU0,brief:GU0};var UU0={read:"Read file",write:"Write file",edit:"Edit file",apply_patch:"Edit",exec:"Bash",bash:"Bash",ls:"List files",find:"Find files",grep:"Search",process:"Manage process",web_search:"Web search",web_fetch:"Fetch",sessions_list:"List sessions",sessions_history:"Recall session",sessions_yield:"Yield to session",sessions_send:"Send to session",sessions_spawn:"Spawn session",subagents:"Run sub-agent",agents_list:"List agents",session_status:"Session status",image:"Analyze image",image_generate:"Generate image",memory_get:"Read memory",memory_search:"Search memory",update_plan:"Update plan",message:"Send message",browser:"Browser",canvas:"Canvas",cron:"Cron",gateway:"Gateway",code_execution:"Run Python",tts:"Text-to-speech",music_generate:"Generate music",video_generate:"Generate video",x_search:"Search X"};function YU0($,Z){let J=$.name,H=sH($);if(J==="read"||J==="write"||J==="edit")return Z(N1(H,"path"));if(J==="apply_patch"){let B=H.changes;if(Array.isArray(B)&&B.length>0){let z=B.map((G)=>G&&typeof G==="object"?N1(G,"path"):"").filter(Boolean);if(z.length===1)return Z(z[0]);if(z.length>1)return`${z.length} files`}let Q=N1(H,"patch")||N1(H,"input"),X=Q.split(`
|
|
54
|
+
`).find((z)=>z.startsWith("*** "))??Q.split(`
|
|
55
|
+
`)[0];return Z(X??"")}if(J==="exec"||J==="bash"){let B=N1(H,"command")||N1(H,"code");return nH(B,Z)}if(J==="ls"||J==="find"||J==="grep")return Z(N1(H,"path")||N1(H,"pattern"));if(J==="process"){let B=N1(H,"action"),Q=N1(H,"name");return[B,Q].filter(Boolean).join(" ")||Z(PZ(N1(H,"command")))}if(J==="web_search"||J==="x_search")return N1(H,"query");if(J==="web_fetch")return N1(H,"url");if(J==="memory_search")return N1(H,"query");if(J==="memory_get")return N1(H,"key")||N1(H,"name");if(J==="sessions_history"||J==="sessions_send"||J==="sessions_yield")return N1(H,"sessionKey")||N1(H,"agentId");if(J==="sessions_list"||J==="agents_list")return N1(H,"agentId");if(J==="subagents"||J==="sessions_spawn")return N1(H,"task")||N1(H,"agentId");if(J==="image"||J==="image_generate")return N1(H,"prompt")||Z(N1(H,"path"));if(J==="message")return N1(H,"recipient")||N1(H,"to");if(J==="update_plan"){let B=H.plan;if(Array.isArray(B)){let X=B.find((z)=>!!z&&typeof z==="object"&&z.status==="in_progress")?.step??B[0]?.step;if(typeof X==="string")return X}return""}return""}var Br={displayName:($)=>UU0[$.name]??tX.displayName($),brief:($,Z)=>YU0($,Z)||tX.brief($,Z)};function g_($){if(!($.name==="Bash"||$.name==="exec"||$.name==="bash"))return null;let J=$.input??{},H=typeof J.command==="string"?J.command:"";if(!H)return null;let Q=PZ(H).match(/(?:^|\s|\$\()mcporter(?:\)?)\s+call\s+([A-Za-z0-9_-]+)\.([A-Za-z0-9_-]+)((?:\s+(?!&&|\|\||;|\|)\S+)*)/);if(!Q)return null;return{server:Q[1],tool:Q[2],rest:(Q[3]??"").trim()}}function m_($){let Z=$.name;if(!Z.startsWith("mcp__"))return null;let J=Z.slice(5),H=J.indexOf("__");if(H<=0)return null;return{server:J.slice(0,H),tool:J.slice(H+2),rest:""}}function u_($){if($.provider!=="codex"||!$.mcpServer)return null;if($.name in f_)return null;if($.mcpServer==="codex")return null;let Z=$.name.indexOf(".");if(Z>0)return{server:$.name.slice(0,Z),tool:$.name.slice(Z+1),rest:""};return{server:$.mcpServer,tool:$.name,rest:""}}function p_($,Z){let J=Z.toLowerCase();return["-","_","."].find((B)=>J.startsWith($.toLowerCase()+B))?Z.slice($.length+1):Z}var FU0={"claude-code":tX,openclaw:Br,codex:Zr,hermes:Hr};function Qr($){return FU0[$.provider??"claude-code"]}function Xr($){return Qr($).displayName($)}function zr($,Z){return Qr($).brief($,si(Z))}var G2=P(u(),1),Gr=[Ur,Yr,c_];function KU0(){let[$,Z]=eX.useState(0);eX.useEffect(()=>{let H=setInterval(()=>Z((B)=>(B+1)%Gr.length),600);return()=>clearInterval(H)},[]);let J=Gr[$];return G2.jsx(aH,{className:"size-5",children:G2.jsx(J,{size:16,stroke:1.75,className:"text-foreground"})})}function Fr({call:$,cwd:Z,isFirst:J,isLast:H,renderNestedParts:B}){let[Q,X]=eX.useState(!1),z=$.subagent,G=$.input??{},U=z?.description??G.description??"Subtask",Y=z?.status,F=$.state==="error"||Y==="failed",K=$.state==="running"||Y==="running",W=z?.usage?.toolUses,N=z?.usage?.durationMs,D=(K&&z?.progress?.length?z.progress[z.progress.length-1]:null)??(W!=null?`Took ${W} step${W===1?"":"s"}`:null),A=(z?.transcript??[]).flatMap((O)=>O.parts),V=typeof $.output==="string"?$.output:"",L=A.length>0||!!V;return G2.jsx(oH,{isFirst:J,isLast:H,marker:K?G2.jsx(KU0,{}):G2.jsx(aH,{className:"size-5",children:G2.jsx(c_,{size:16,stroke:1.75,className:"text-foreground"})}),isError:F,children:G2.jsxs("div",{className:"min-w-0 flex-1",children:[G2.jsxs("button",{type:"button",title:`Agent: ${U}`,onClick:()=>L&&X((O)=>!O),className:Q0("group/row flex w-full flex-col items-start gap-0.5 py-1.5 text-left select-none",L?"cursor-pointer":"cursor-default"),children:[G2.jsxs("span",{className:"flex w-full items-center gap-2",children:[G2.jsxs(yi,{active:K,className:"min-w-0 flex-1 truncate text-xs font-medium",children:["Agent: ",U]}),!K&&N!=null&&G2.jsx("span",{className:"shrink-0 rounded-full border border-border px-1.5 text-[10px] font-medium text-muted-foreground tabular-nums",children:_Z(N)}),Y==="failed"&&G2.jsx("span",{className:"shrink-0 text-xs text-destructive",children:"✗"}),Y==="stopped"&&G2.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:"✗"}),L&&G2.jsx(sX,{open:Q})]}),D&&G2.jsx("span",{className:"w-full truncate text-xs text-muted-foreground",children:D})]}),L&&G2.jsx(oX,{open:Q,children:G2.jsxs("div",{className:"mt-1 mb-1 overflow-hidden rounded-lg border border-border",children:[A.length>0&&G2.jsx("div",{className:"py-1.5 pr-2 pl-3",children:B(A,Z)}),V&&G2.jsx("div",{className:Q0("bg-muted/30 px-3.5 py-3 text-xs leading-relaxed whitespace-pre-wrap text-muted-foreground",A.length>0&&"border-t border-border"),children:V})]})})]})})}var OZ=P(m(),1);var Pr=P(m(),1);var l_=new Set(["<",">","{","}","[","]"]),o_=new Set(["for","do","while","if","else","return","function","var","let","const","true","false","undefined","this","new","delete","typeof","in","instanceof","void","break","continue","switch","case","default","throw","try","catch","finally","debugger","with","yield","async","await","class","extends","super","import","export","from","static"]),WU0=new Set([...o_,"type","interface","enum","implements","readonly","abstract","declare","namespace","module","private","protected","public","override","keyof","infer","is","asserts","satisfies","as","unknown","never","any","number","string","boolean","bigint","symbol","object"]),qr=new Set(["+","-","*","/","%","=","!","&","|","^","~","!","?",":",".",",",";","'",'"',".","(",")","[","]","#","@","\\",...l_]),NU0={keywords:o_,onCommentStart:Lr,onCommentEnd:TU0};function qU0($){let Z=0;if(/\binterface\s+[A-Za-z_$][\w$]*/.test($))Z+=2;if(/\btype\s+[A-Za-z_$][\w$]*\s*=/.test($))Z+=2;if(/\benum\s+[A-Za-z_$][\w$]*/.test($))Z+=2;if(/\b(?:implements|readonly|declare|namespace|satisfies|infer|keyof|asserts)\b/.test($))Z+=2;if(/:\s*[A-Za-z_$][\w$]*(?:<[^>\n]+>)?(?:\[\])?(?=\s*[,)=;{])/m.test($))Z+=1;if(/\b(?:const|let|var)\s+[A-Za-z_$][\w$]*\s*:\s*/.test($))Z+=1;if(/\)\s*:\s*[A-Za-z_$][\w$]*(?:<[^>\n]+>)?(?:\[\])?\s*(?:=>|\{)/.test($))Z+=1;return Z>=2}function AU0($,Z){if($[Z]!=="<")return!1;let J=0,H=!1;for(let B=Z;B<$.length;B++){let Q=$[B];if(Q==="<"){J++;continue}if(Q===">"){if(J--,J===0){let X=B+1;while(X<$.length&&/\s/.test($[X]))X++;if(!(H&&$[X]==="("))return!1;let z=$.slice(X,X+320);return/\)\s*(?::[\s\S]{0,120}?)?=>/.test(z)}continue}if(J===0)continue;if(/[$A-Za-z_]/.test(Q)){H=!0;continue}if(/[\s,\.\=\?\:\|\&\[\]]/.test(Q))continue;return!1}return!1}var _N=["identifier","keyword","string","class","property","entity","jsxliterals","sign","comment","break","space"],[tH,DU0,m7,d_,PN,VU0,LU0,b3,Kr,i_,Wr]=_N.map(($,Z)=>Z);function $z($){return/^[^\S\r\n]+$/g.test($)}function MU0($){return qr.has($)}var PU0={"&":"&","<":"<",">":">",'"':""","'":"'"};function _U0($){if(!/[&<>"']/.test($))return $;return $.replace(/[&<>"']/g,(Z)=>PU0[Z])}function ON($){return/^[\w_]+$/.test($)||Ar($)}function Nr($){let Z=$[0];return ON(Z)&&Z===Z.toUpperCase()||$==="null"}function Ar($){return/[^\u0000-\u007f]/.test($)}function Dr($){return/^[a-zA-Z]$/.test($)}function Vr($){return Dr($)||Ar($)}function eH($){return Vr($[0])&&($.length===1||ON($.slice(1)))}function r_($){return $==="`"}function a_($){return $==='"'||$==="'"}function OU0($){return a_($)||r_($)}function Lr($,Z){let J=$+Z;if(J==="/*")return 2;return J==="//"?1:0}function TU0($,Z){return $+Z==="*/"?2:Z===`
|
|
56
|
+
`?1:0}function jU0($){return $[0]==="/"&&!Lr($[0],$[1])}function CU0($,Z){let J=Z+1;while(J<$.length&&/\s/.test($[J]))J++;return $[J]===":"}function EU0($,Z){let J={...NU0,...Z},H=!!(Z&&Z.keywords instanceof Set),B=qU0($),Q=H?J.keywords:B?WU0:o_,{onCommentStart:X,onCommentEnd:z}=J,G=J.typeKeywords instanceof Set?J.typeKeywords:null,U="",Y=-1,F=[-1,""],K=[-2,""],W=[],N=!1,q=0,D=!1,A=0,V=()=>N&&!D&&!q,L=()=>q&&!V(),O=()=>!q&&V()&&!D&&A>0,M=null,_=0,w=!1,C=0,E=0,T=()=>M!==null,k=()=>w,S=()=>E>C,I=()=>E>0&&E===C,j=()=>T()||S();function y(x){let v=x===`
|
|
57
|
+
`;if(L()){if(T())return m7;let[,b]=F;if(eH(x)){if(b==="<"||b==="</")return VU0}}if(O())return LU0;if(T()||S())return m7;else if(G&&G.has(x))return F[1]==="."?tH:d_;else if(Q.has(x))return F[1]==="."?tH:DU0;else if(v)return i_;else if($z(x))return Wr;else if(x.split("").every(MU0))return b3;else if(Nr(x))return L()?tH:d_;else{if(eH(x)){let b=F[1]==="."&&eH(K[1]);if(!j()&&!b)return tH;if(b)return PN}return m7}}let R=(x,v)=>{if(v)U=v;if(U){Y=typeof x==="number"?x:y(U);let f=[Y,U];if(Y!==Wr&&Y!==i_)K=F,F=f;W.push(f)}U=""};for(let x=0;x<$.length;x++){let v=$[x],f=$[x-1],b=$[x+1],l=f+v,r=v+b;if(typeof J.onQuote==="function"&&v==="'"&&!T()&&!O()&&!S()){let i=J.onQuote(v,x,$);if(typeof i==="number"&&i>=1&&!Number.isNaN(i)){let n=Math.min(i,$.length-x),Z0=x+n;R(),U=$.slice(x,Z0),R(tH),x=Z0-1;continue}}if(a_(v)&&!O()&&!S()){R();let i=!1;if(f!=="\\"){if(M&&v===M)M=null,i=!0;else if(!M)M=v,_=W.length}if(R(m7,v),J.quotedKeys&&i&&CU0($,x))for(let n=_;n<W.length;n++)W[n][0]=PN;continue}if(!S()){if(f!=="\\n"&&r_(v)){R(),R(m7,v),E++;continue}}if(S()){if(f!=="\\n"&&r_(v)){if(E>0){R(),E--,R(m7,v);continue}}if(r==="${"){C++,R(m7),R(b3,r),x++;continue}}if(I()&&v==="}"){R(),C--,R(b3,v);continue}if(V()){if(v==="{"){R(),R(b3,v),D=!0;continue}}if(N){if(!q&&v==="<"){if(R(),b==="/")q=2,U=r,x++;else q=1,U=v;R(b3);continue}if(q){if(v===">"&&!"/=".includes(f)){if(R(),q===1)q=0,A++;else q=0,N=!1;R(b3,v);continue}if(r==="/>"||r==="</"){if(U!=="<"&&U!=="/")R();if(r==="/>")q=0;else A--;if(!A)N=!1;U=r,x++,R(b3);continue}if(v==="<"){R(),U=v,R(b3);continue}if(b==="-"&&!j()&&!O()){if(U){R(PN,U+v+b),x++;continue}}if(b==="="&&!j()){if(!$z(v)){if($z(U))R();let i=U+v;if(eH(i)){R(PN,i);continue}}}}}if(!q&&(v==="<"&&Vr(b)||r==="</")){let i=x-1;while(i>=0&&/\s/.test($[i]))i--;let n=i>=0?$[i]:"",[Z0,J0]=F,U0=!1,z0=!1;if(U&&!$z(U)){let q0=U;if(Nr(q0)||q0==="true"||q0==="false")U0=!0;else if(Q.has(q0)&&eH(q0))z0=!0;else if(eH(q0))U0=!0}let X0=v==="<"&&/[$\w\]\)]/.test(n)&&(U0||!z0&&(Z0===tH||Z0===d_||Z0===b3&&(J0===")"||J0==="]"))),N0=v==="<"&&AU0($,x);if(!X0&&!N0)q=b==="/"?2:1;if(v==="<"&&(b==="/"||Dr(b))){if(!X0&&!N0&&!j()&&!O()&&!k())N=!0}}let h=OU0(v),d=S(),o=!N&&jU0(r),c=O();if(h||d||a_(M))U+=v;else if(o){R();let[i,n]=F;if(o&&i!==-1&&!(i===b3&&n!==")"||i===Kr)){U=v,R();continue}w=!0;let Z0=x++,J0=()=>x>=$.length,U0=()=>J0()||$[x]===`
|
|
58
|
+
`,z0=!1,X0=!1;for(;!U0();x++){let N0=$[x],q0=$[x-1]==="\\";if(!q0&&N0==="[")X0=!0;if(!q0&&N0==="]")X0=!1;if(N0==="/"&&!X0&&!q0){z0=!0;while(Z0!==x&&/^[a-z]$/.test($[x+1])&&!U0())x++;break}}if(w=!1,Z0!==x&&z0)U=$.slice(Z0,x+1),R(m7);else U=v,R(),x=Z0}else if(X(v,b)){R();let i=x,n=X(v,b);if(n){for(;x<$.length;x++)if(z($[x-1],$[x])==n)break}U=$.slice(i,x+1),R(Kr)}else if(v===" "||v===`
|
|
59
|
+
`)if(v===" "&&($z(U)||!U||c)){let i=x+1;while($[i]===" ")i++;if(U+=$.slice(x,i),x=i-1,$[i]==="<")R()}else R(),U=v,R();else if(D&&v==="}")R(),U=v,R(),D=!1;else if(c&&!l_.has(v)||S()||(ON(v)===ON(U[U.length-1])||V())&&!qr.has(v))U+=v;else{if(l==="</")U=l;if(R(),l!=="</")U=v;if(r==="</"||r==="/>")U=r,R(),x++;else if(l_.has(v))R()}}return R(),W}function bU0($,Z){let J=[],H=Z&&typeof Z.lineClassName==="function"?Z.lineClassName:null,B=0,Q=(U,Y)=>{let F=H?H(Y,B):"";return B++,{type:"element",tagName:"span",children:U,properties:{className:F?`sh__line ${F}`:"sh__line"}}};function X(U){let Y=U.map(([,K])=>K).join(""),F=U.map(([K,W])=>{let N=_N[K];return{type:"element",tagName:"span",children:[{type:"text",value:W}],properties:{className:`sh__token--${N}`,style:{color:`var(--sh-${N})`}}}});J.push(Q(F,Y))}let z=[],G=!1;for(let U=0;U<$.length;U++){let Y=$[U],[F,K]=Y,W=U===$.length-1;if(F!==i_){if(K.includes(`
|
|
60
|
+
`)){let N=K.split(`
|
|
61
|
+
`);for(let q=0;q<N.length;q++)if(z.push([F,N[q]]),q<N.length-1)X(z),z.length=0}else z.push(Y);G=!1}else{if(G)X([]);else X(z),z.length=0;if(W)X([]);G=!0}}if(z.length)X(z);return J}var wU0=($)=>{let Z=`class="${$.className}"`;if($.style){let J=Object.entries($.style).map(([H,B])=>`${H}:${B}`).join(";");Z+=` style="${J}"`}return Z};function SU0($){return $.map((Z)=>{let{tagName:J}=Z,H=Z.children.map((B)=>{let{tagName:Q,children:X,properties:z}=B;return`<${Q} ${wU0(z)}>${_U0(X[0].value)}</${Q}>`}).join("");return`<${J} class="${Z.properties.className}">${H}</${J}>`}).join(`
|
|
62
|
+
`)}function Mr($,Z){let J=EU0($,Z),H=bU0(J,Z);return SU0(H)}var MM1={TokenTypes:_N,TokenMap:new Map(_N.map(($,Z)=>[$,Z]))};var n_=P(u(),1),RU0=Q0("[--sh-identifier:#1f2937]","[--sh-keyword:#cf222e]","[--sh-string:#16a34a]","[--sh-class:#2d6e7e]","[--sh-property:#0550ae]","[--sh-entity:#6f42c1]","[--sh-jsxliterals:#6f42c1]","[--sh-sign:#8b949e]","[--sh-comment:#9ca3af]");function _r({code:$,className:Z}){let J=Pr.useMemo(()=>Mr($),[$]);return n_.jsx("pre",{className:Q0("overflow-auto font-mono text-xs leading-relaxed whitespace-pre",RU0,Z),children:n_.jsx("code",{className:"font-mono",dangerouslySetInnerHTML:{__html:J}})})}var IU0={ts:"ts",tsx:"tsx",js:"js",jsx:"jsx",mjs:"js",cjs:"js",json:"json",md:"md",mdx:"mdx",css:"css",scss:"scss",html:"html",py:"py",rb:"rb",go:"go",rs:"rs",java:"java",c:"c",h:"c",cpp:"cpp",sh:"sh",bash:"sh",yml:"yaml",yaml:"yaml",toml:"toml",sql:"sql",php:"php",swift:"swift",kt:"kt"};function kU0($){let Z=$.split(/[\\/]/).pop()??"",J=Z.lastIndexOf("."),H=J>0?Z.slice(J+1).toLowerCase():"";return IU0[H]??null}function yU0($){let Z=$.trim();if(Z.length<2||!(Z.startsWith("{")||Z.startsWith("[")))return null;try{return JSON.stringify(JSON.parse(Z),null,2)}catch{return null}}function xU0($){let Z=$.split(`
|
|
63
|
+
`);if(!Z.some((J)=>/^\s*\d+\t/.test(J)))return $;return Z.map((J)=>J.replace(/^\s*\d+\t/,"")).join(`
|
|
64
|
+
`)}function Or($,Z){let J=$.input??{},H=typeof J.file_path==="string"?J.file_path:typeof J.path==="string"?J.path:"",B=H?kU0(H):null,Q=$.name==="Read"||$.name==="read",X=$.name==="Write"||$.name==="write";if(B&&Q&&Z)return{kind:"highlight",code:xU0(Z),label:B};if(B&&X&&typeof J.content==="string"&&J.content)return{kind:"highlight",code:J.content,label:B};let z=yU0(Z);if(z)return{kind:"highlight",code:z,label:"json"};return{kind:"plain"}}var c4=P(u(),1),s_="max-h-[280px] overflow-auto px-3 py-2.5 font-mono text-xs leading-relaxed";function Tr({call:$,output:Z,isError:J}){let[H,B]=OZ.useState(!1),Q=OZ.useMemo(()=>J?{kind:"plain"}:Or($,Z),[$,Z,J]);if(Q.kind==="plain")return c4.jsx("div",{className:Q0("rounded-lg border",J?"border-destructive/30 bg-destructive/10":"border-border bg-muted"),children:c4.jsx("pre",{className:Q0(s_,"break-all whitespace-pre-wrap",J?"text-destructive":"text-muted-foreground"),children:Z||"(empty)"})});return c4.jsxs("div",{className:"overflow-hidden rounded-lg border border-border bg-muted",children:[c4.jsx(hU0,{raw:H,onRaw:B,label:Q.label,copyText:H?Z:Q.code}),H?c4.jsx("pre",{className:Q0(s_,"break-all whitespace-pre-wrap text-muted-foreground"),children:Z||"(empty)"}):c4.jsx(_r,{code:Q.code,className:Q0(s_,"text-muted-foreground")})]})}function hU0({raw:$,onRaw:Z,label:J,copyText:H}){return c4.jsxs("div",{className:"flex items-center gap-1 border-b border-border p-2",children:[[[!1,J],[!0,"raw"]].map(([Q,X])=>c4.jsx(L0,{type:"button",variant:$===Q?"outline":"ghost",size:"sm",onClick:()=>Z(Q),className:"rounded-full text-xs uppercase",children:X},X)),c4.jsx("div",{className:"flex-1"}),c4.jsx(vU0,{text:H})]})}function vU0({text:$}){let[Z,J]=OZ.useState(!1);return OZ.useEffect(()=>{if(!Z)return;let B=setTimeout(()=>J(!1),1500);return()=>clearTimeout(B)},[Z]),c4.jsx(L0,{type:"button",variant:"ghost",size:"icon-sm",onClick:()=>{navigator.clipboard?.writeText($).then(()=>J(!0)).catch(()=>{})},"aria-label":Z?"Copied":"Copy",children:Z?c4.jsx(i8,{stroke:1.75}):c4.jsx(TN,{stroke:1.75})})}var l1=P(u(),1);function jN({parts:$,cwd:Z=null,processing:J=!1}){let H=$.filter((B)=>B.type==="reasoning"||B.type==="tool-call");return l1.jsx("div",{className:"flex flex-col",children:H.map((B,Q)=>{let X=Q===H.length-1,z={isFirst:Q===0,isLast:X};if(B.type==="reasoning")return l1.jsx(fU0,{text:B.text,durationMs:B.durationMs,inProgress:J&&X,...z},Q);return l1.jsx(gU0,{call:B.call,cwd:Z,...z},B.call.toolCallId||Q)})})}function t_({isFirst:$,isLast:Z,call:J,leading:H,marker:B,name:Q,brief:X,preview:z}){let[G,U]=e_.useState(!1),Y=J.state==="error",F=J.state==="running"||J.state==="pending",K=Y?J.errorText??"":typeof J.output==="string"?J.output:"",W=!!(K||Y||z),N=X?`${Q}: ${X}`:Q;return l1.jsx(oH,{isFirst:$,isLast:Z,marker:B,loading:F,isError:Y,children:l1.jsxs("div",{className:"min-w-0 flex-1",children:[l1.jsxs("button",{type:"button",title:N,onClick:()=>W&&U((q)=>!q),className:Q0(VN,W?"cursor-pointer":"cursor-default"),children:[H,l1.jsx("span",{className:"shrink-0 text-xs font-medium whitespace-nowrap",children:Q}),X&&l1.jsx("span",{className:"min-w-0 self-baseline truncate text-[12px] text-muted-foreground",children:X}),F&&B&&l1.jsx(r5,{size:12,stroke:1.75,className:"shrink-0 animate-spin text-muted-foreground"}),W&&l1.jsx(sX,{open:G})]}),W&&l1.jsx(oX,{open:G,children:l1.jsxs("div",{className:"mt-1 mb-1 flex flex-col gap-1.5",children:[z,(K||Y)&&l1.jsx(Tr,{call:J,output:K,isError:Y})]})})]})})}function fU0({isFirst:$,isLast:Z,text:J,inProgress:H=!1,durationMs:B}){let[Q,X]=e_.useState(!1);if(!J){let U=B===void 0?"Thought":`Thought for ${_Z(B)}`;return l1.jsx(oH,{isFirst:$,isLast:Z,loading:H,children:l1.jsx("div",{className:Q0(VN,"min-w-0 flex-1 cursor-default"),children:l1.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:H?"Thinking":U})})})}let z=H?"Thinking":"Thought",G=H||Q;return l1.jsx(oH,{isFirst:$,isLast:Z,loading:H,children:l1.jsxs("div",{className:"min-w-0 flex-1",children:[l1.jsxs("button",{type:"button","aria-expanded":G,onClick:()=>X((U)=>!U),className:Q0(VN,"cursor-pointer"),children:[l1.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:z}),l1.jsx(sX,{open:G})]}),l1.jsx(oX,{open:G,children:l1.jsx("div",{className:"mt-1 mb-1 pr-2 text-xs leading-relaxed whitespace-pre-wrap text-muted-foreground",children:l1.jsx(kl,{content:J})})})]})})}function gU0({call:$,cwd:Z,isFirst:J,isLast:H}){if($.caller==="subagent")return l1.jsx(Fr,{call:$,cwd:Z,isFirst:J,isLast:H,renderNestedParts:(X,z)=>l1.jsx(jN,{parts:X,cwd:z})});if($.name==="Skill"&&$.skill){let X=$.state==="success";return l1.jsx(t_,{isFirst:J,isLast:H,call:$,marker:X?l1.jsx(hi,{icon:jr,size:16,stroke:1.75}):void 0,name:"Loading skill",brief:$.skill.skillName})}let B=g_($)??m_($)??u_($);if(B){let X=p_(B.server,B.tool);return l1.jsx(t_,{isFirst:J,isLast:H,call:$,marker:l1.jsx(vi,{src:qN(B.server)}),name:AN(B.server),brief:B.rest?`${X} ${B.rest}`:X})}let Q=$.state==="error"?null:Ri($,Z);return l1.jsx(t_,{isFirst:J,isLast:H,call:$,leading:l1.jsx(mU0,{call:$}),name:Xr($),brief:zr($,Z),preview:Q?l1.jsx(Ii,{relPath:Q}):void 0})}function mU0({call:$}){if($.caller!=="mcp"&&$.caller!=="server-tool")return null;let Z=$.caller==="mcp"?`mcp${$.mcpServer?`:${$.mcpServer.slice(0,8)}`:""}`:"server";return l1.jsx("span",{className:"shrink-0 rounded border border-border px-1 text-[9px] text-muted-foreground uppercase",children:Z})}var f1=P(u(),1);function br($){if($.type==="reasoning")return!0;if($.type==="tool-call")return!0;return!1}function uU0($){let Z=[];for(let J of $)if(br(J)){let H=Z[Z.length-1];if(H&&H.kind==="run")H.parts.push(J);else Z.push({kind:"run",parts:[J]})}else Z.push({kind:"single",part:J});return Z}function CN({parts:$,cwd:Z,processing:J=!1}){let H=uU0($);return f1.jsx("div",{className:"flex flex-col",children:H.map((B,Q)=>{let X=Q===0?"":"mt-3",z=Q===H.length-1;return f1.jsx("div",{className:X,children:B.kind==="run"?f1.jsx(jN,{parts:B.parts,cwd:Z,processing:J&&z}):f1.jsx(iU0,{part:B.part})},Q)})})}function pU0($){return $.some((Z)=>Z.type!=="text"||Z.text.trim().length>0)}function cU0($){let Z=-1;for(let H=$.length-1;H>=0;H--)if(br($[H])){Z=H;break}if(Z<0)return null;let J=$.slice(Z+1);if(!pU0(J))return null;return{work:$.slice(0,Z+1),response:J}}function dU0({parts:$,cwd:Z,durationMs:J,defaultOpen:H}){let B=J===void 0?"Worked":`Worked for ${_Z(J)}`;return f1.jsxs(bK,{defaultOpen:H,className:"group/collapsible",children:[f1.jsxs(wK,{className:"flex w-fit items-center gap-1 rounded-sm py-1 text-left text-sm text-muted-foreground transition-colors outline-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring",children:[f1.jsx("span",{children:B}),f1.jsx(B6,{size:16,stroke:1.5,className:"shrink-0 transition-transform group-data-open/collapsible:rotate-90"})]}),f1.jsx(SK,{className:"overflow-hidden pt-2",children:f1.jsx(CN,{parts:$,cwd:Z})})]})}function lU0({parts:$,cwd:Z,processing:J=!1,durationMs:H}){let B=J?null:cU0($);return f1.jsx("div",{className:"w-full min-w-0",children:J?f1.jsx(CN,{parts:$,cwd:Z,processing:!0}):B?f1.jsxs("div",{className:"flex flex-col gap-3",children:[f1.jsx(dU0,{parts:B.work,cwd:Z,durationMs:H}),f1.jsx(CN,{parts:B.response,cwd:Z})]}):f1.jsx(CN,{parts:$,cwd:Z})})}var wr=Er.memo(function({turn:Z,processing:J=!1}){let H=w1().cwd;if(Z.role==="user"&&Z.origin.kind==="user-input"){let B=Z.parts.filter((z)=>z.type==="file-attachment"),Q=Z.parts.filter((z)=>z.type==="text-attachment"),X=Z.parts.filter((z)=>z.type==="text").map((z)=>z.type==="text"?z.text:"").join(`
|
|
65
|
+
`);if(!X&&B.length===0&&Q.length===0)return null;return f1.jsxs("div",{className:"flex w-full min-w-0 flex-col items-end gap-1.5 pl-8",children:[Q.map((z,G)=>f1.jsx(PX,{label:z.label},`text-attachment:${G}`)),B.map((z,G)=>f1.jsx(Sr,{mediaType:z.mediaType,previewUrl:z.previewUrl,label:z.label},G)),X&&f1.jsx("p",{className:Q0("max-w-full min-w-0 rounded-lg bg-primary px-3 py-2 text-sm leading-normal wrap-anywhere whitespace-pre-wrap text-primary-foreground","inset-shadow-[0_0_10px_color-mix(in_oklab,var(--color-white)_30%,transparent)]"),children:X})]})}return f1.jsx(lU0,{parts:Z.parts,cwd:H,processing:J,durationMs:Z.meta?.durationMs})});function iU0({part:$}){switch($.type){case"text-attachment":return f1.jsx(PX,{label:$.label});case"text":return f1.jsx(Il,{content:$.text});case"tool-call":return f1.jsx(jN,{parts:[$],cwd:null});case"file-attachment":return f1.jsx(Sr,{mediaType:$.mediaType,previewUrl:$.previewUrl,label:$.label});case"source-url":return f1.jsx(Cr,{url:$.url,title:$.title});case"source-document":return f1.jsx(Cr,{url:"#",title:$.title});case"data":return f1.jsx(rU0,{name:$.name,data:$.data});case"reasoning":return null}}function Sr({mediaType:$,previewUrl:Z,label:J}){if($.startsWith("image/")&&Z)return f1.jsx("img",{src:Z,alt:J??"attachment",className:"max-h-64 max-w-full rounded-lg border border-border object-contain"});return f1.jsxs("div",{className:"flex items-center gap-1.5 rounded-lg border border-border bg-accent px-2.5 py-1.5 text-xs text-accent-foreground",children:[f1.jsx(lJ,{size:16,stroke:1.75}),f1.jsx("span",{className:"truncate",children:J??$})]})}function Cr({url:$,title:Z}){return f1.jsx("a",{href:$,target:"_blank",rel:"noreferrer",className:"text-xs underline",children:Z??$})}function rU0({name:$,data:Z}){return f1.jsxs("details",{children:[f1.jsxs("summary",{className:"cursor-pointer list-none text-xs text-muted-foreground marker:hidden [&::-webkit-details-marker]:hidden",children:["data:",$]}),f1.jsx("pre",{className:"mt-1 overflow-auto rounded bg-muted p-2 font-mono text-xs text-muted-foreground",children:JSON.stringify(Z,null,2)})]})}var J5=P(u(),1),aU0=[],oU0=[];function $O({forkedFromSessionId:$,agent:Z,active:J=!0,focusRequest:H=0,docked:B=!1,chatLoaded:Q,hasWorkspaceApplets:X,view:z,previewTurn:G,sessionId:U,processing:Y,composerBanner:F,agentAvailability:K,annotation:W,send:N,stop:q,onNavigateFromWelcome:D,onClose:A,viewDraft:V}){let L=d1(),{base:O}=w2(),{data:M}=vJ(L),_=M?.find((X0)=>X0.sessionId===$)?.summary,w=s3(),C=z8.useRef(null),E=z8.useRef(null),T=V?.sessionId??U??N2(w),k=V?null:U??null,S=V?aU0:z.turns,I=C1((X0)=>X0.hasSentMessageFromMoi),j=C1((X0)=>(X0.workspaceIdsPendingAnalysis??[]).includes(L)),y=K4((X0)=>(X0.attachments[L8(L,T)]??[]).some((N0)=>N0.kind!=="text"&&N0.status==="uploading")),R=Q||!!V,x=!R||!MX(!0,y,K),v=V?null:G,f=V?oU0:z.notices,b=z8.useMemo(()=>kg(S),[S]),l=z8.useMemo(()=>Ig(b,v),[b,v]),r=z8.useMemo(()=>xg(l,f),[l,f]),h=l.length>0?l[l.length-1].id:null,d=V?!1:Y,o=!!V||!$&&Q&&r.length===0&&!d,c=Q&&!o,i=$u({tabId:w,isViewDraft:!!V,hasSentMessageFromMoi:I,isWorkspacePendingAnalysis:j}),{atBottom:n,scrollToBottom:Z0,scrollToTop:J0}=Sg(E,T);z8.useLayoutEffect(()=>{if(o&&i!=="overview-empty"&&i!=="tab-empty")J0()},[o,i,J0]),z8.useEffect(()=>{if(J)TM(C.current)},[J,H]);let U0=z8.useCallback(async(X0,N0)=>{await N(X0,N0),Z0()},[N,Z0]),z0=z8.useCallback((X0)=>{if(x)return;U0(X0.prompt,{directives:X0.context})},[U0,x]);return J5.jsxs("div",{className:"flex min-h-0 flex-1 flex-col pt-2 pb-3",children:[J5.jsxs("header",{className:"flex w-full min-w-0 items-center justify-between pr-2 pb-2 pl-2",children:[J5.jsx("div",{className:"flex h-7 min-w-0 flex-1",children:J5.jsx(zu,{className:Q0("text-foreground",B&&"text-muted-foreground")})}),B&&J5.jsxs(t1,{children:[J5.jsx(e1,{render:J5.jsx(L0,{variant:"ghost",size:"icon-sm",onClick:A,"aria-label":"Undock chat",children:J5.jsx(Rr,{className:"size-5! text-muted-foreground",stroke:1.5})})}),J5.jsx($5,{children:"Undock chat"})]}),!V&&!B&&J5.jsx(L0,{variant:"ghost",size:"icon-sm",onClick:A,"aria-label":"Close chat",children:J5.jsx(i5,{stroke:2})})]}),J5.jsxs("div",{className:"relative flex min-h-0 flex-1 flex-col",children:[J5.jsx("div",{ref:E,className:"flex scrollbar-thin flex-1 scroll-fade flex-col overflow-y-auto overscroll-contain px-5 pt-4 pb-8 [--scroll-fade-reveal:8px]",children:J5.jsxs("div",{className:"mx-auto flex w-full max-w-(--chat-max-container) flex-1 flex-col gap-6",children:[$&&J5.jsx("a",{href:O8(`moi:/chats/${encodeURIComponent($)}`,{workspaceId:L,base:O}),className:"block text-sm outline-none focus-visible:ring-3 focus-visible:ring-ring/50",children:J5.jsxs("div",{className:"flex items-center gap-3",children:[J5.jsx(oK,{size:20,stroke:1.5,"aria-hidden":"true",className:"shrink-0 text-muted-foreground"}),J5.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[J5.jsx("span",{className:"text-muted-foreground",children:"Started from another chat"}),J5.jsx("span",{className:"truncate font-medium",title:_,children:_||"Another chat"})]})]})}),o&&J5.jsx(Zu,{agent:Z,kind:i,hasWorkspaceApplets:X,disabled:x,onSelectPrompt:z0,onNavigate:D}),c&&r.map((X0)=>X0.kind==="notice"?J5.jsx(nU0,{notice:X0.notice},`notice:${X0.notice.id}`):J5.jsx(wr,{turn:X0.turn,processing:d&&X0.turn.id===h},X0.turn.id)),c&&J5.jsx("div",{className:"mt-auto -ml-3 pt-2",children:J5.jsx(P3,{preset:Z,color:"primary",animated:d,expression:d?"thinking":void 0})})]})}),c&&!n&&S.length>0&&J5.jsx(L0,{type:"button",variant:"outline",size:"icon",onClick:()=>Z0("smooth"),"aria-label":"Jump to latest",className:"absolute bottom-3 left-1/2 -translate-x-1/2 animate-in rounded-full fade-in slide-in-from-bottom-1",children:J5.jsx(cU,{stroke:1.5})})]}),J5.jsx("div",{className:"mx-auto flex w-full max-w-[calc(var(--chat-max-container)+24px)] flex-col px-3",children:J5.jsxs("div",{className:Q0("@container flex w-full flex-col transition-[padding]",F&&"gap-2 rounded-t-lg rounded-b-2xl p-2",F?.tone==="default"&&"bg-accent",F?.tone==="error"&&"bg-destructive/10"),children:[F?.content,J5.jsx(nm,{composerRef:C,onSend:U0,onStop:q,processing:d,sessionId:T,modelSessionId:k,availability:K,chatReady:R,annotation:V?void 0:W,onRemoveDrawing:V?.onRemoveDrawing??W?.onRemove,allowFiles:!V,placeholder:V?"Drop in the details":void 0})]})})]})}function nU0({notice:$}){let Z=jM($);if(!Z)return null;return J5.jsx("div",{className:"flex justify-center",children:J5.jsx("span",{className:"max-w-full truncate text-xs text-muted-foreground",children:Z})})}var BB=P(m(),1);var Ta=P(MO(),1);var w9=P(u(),1);function ja({agent:$,loading:Z,open:J,onOpenChange:H,onOpenChangeComplete:B,children:Q}){let X=BB.useRef(null),z=C1((q)=>q.popupChatWidth),G=C1((q)=>q.setPopupChatWidth),[U,Y]=BB.useState({width:z,min:0,max:z}),F=BB.useCallback((q)=>{if(X.current=q,!q)return;q.style.setProperty("--chat-popup-width",`${z}px`);let D=new ResizeObserver(([A])=>{if(!A)return;let{minWidth:V,maxWidth:L}=getComputedStyle(q);Y({width:Math.round(A.contentRect.width),min:parseFloat(V),max:parseFloat(L)})});return D.observe(q),()=>{D.disconnect(),X.current=null}},[z]),K=(q)=>{if(!X.current)return;let{minWidth:D,maxWidth:A}=getComputedStyle(X.current);G(Math.round(Math.min(parseFloat(A),Math.max(parseFloat(D),q))))},W=()=>H(!1);return w9.jsxs(p6,{open:J,onOpenChange:(q,D)=>{if(!q&&(D.reason==="outside-press"||D.reason==="focus-out")){D.cancel();return}H(q)},onOpenChangeComplete:B,children:[w9.jsx(c6,{render:w9.jsx("div",{className:"fixed right-3 bottom-3",children:w9.jsx(K5.div,{variants:{from:{opacity:0,scale:0.8,filter:"blur(4px)"},to:{opacity:1,scale:1,filter:"blur(0px)"},invisible:{opacity:0,scale:1,filter:"blur(4px)"}},initial:"from",animate:J?"invisible":"to",transition:{type:"spring",duration:0.3,delay:0.2,bounce:0},children:w9.jsx("button",{type:"button",className:"group block cursor-pointer p-0 drop-shadow-[0_0_4px_var(--background)] outline-none focus-visible:ring-3 focus-visible:ring-ring/50","aria-label":"Agent",children:w9.jsx(P3,{preset:$,color:"primary",animated:Z,size:Z?80:64,expression:Z?"thinking":void 0,className:Q0("drop-shadow-md drop-shadow-primary/25","group-hover:drop-shadow-lg group-hover:drop-shadow-primary/40","transition-[width,height,filter] duration-300 ease-in-out motion-reduce:transition-none")})})})})}),w9.jsx(Ta.Resizable,{axis:"x",width:U.width,height:0,resizeHandles:["w"],minConstraints:[U.min,0],maxConstraints:[U.max,0],onResize:(q,{size:D})=>G(Math.round(D.width)),handle:w9.jsx("div",{role:"separator","aria-label":"Resize chat popup","aria-orientation":"vertical","aria-valuemin":U.min,"aria-valuemax":U.max,"aria-valuenow":U.width,"aria-valuetext":`${U.width} pixels wide`,tabIndex:0,className:"absolute inset-y-6 -left-1 w-2 cursor-ew-resize touch-none rounded-full outline-none focus-visible:ring-3 focus-visible:ring-ring/50",onKeyDown:(q)=>{let D=X.current?.offsetWidth??z,A=q.shiftKey?32:16;if(q.key==="ArrowLeft")K(D+A);else if(q.key==="ArrowRight")K(D-A);else if(q.key==="Home")K(-1/0);else if(q.key==="End")K(1/0);else return;q.preventDefault()}}),children:w9.jsx(d6,{ref:F,side:"top",sideOffset:({anchor:q})=>-q.height,align:"end",className:"relative flex h-[calc(100vh-2rem)] w-(--chat-popup-width) max-w-[calc(100vw-1.5rem)] min-w-[min(440px,calc(100vw-1.5rem))] flex-col gap-0 rounded-3xl p-0 transition-[opacity,transform] sm:h-[calc(100vh-8rem)]",keepMounted:!0,children:Q(W)})})]})}var U6=P(u(),1);function fN({actions:$,className:Z,title:J,children:H,onClose:B,ref:Q}){return U6.jsxs(K5.div,{ref:Q,className:Q0("absolute inset-x-4 bottom-4 no-scrollbar flex max-h-full flex-col gap-4 overflow-y-auto rounded-2xl bg-popover text-popover-foreground shadow-md","mx-auto max-w-[calc(var(--chat-max-container)+var(--page-pad)*2)] p-(--page-pad)",H&&"pb-0",Z),variants:{hidden:{opacity:0,y:40,filter:"blur(4px)"},visible:{opacity:1,y:0,filter:"blur(0px)"}},initial:"hidden",animate:"visible",exit:"hidden",transition:{type:"spring",duration:0.25,bounce:0},children:[U6.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-4",children:[U6.jsx("p",{className:"text-sm font-medium",children:J}),U6.jsxs("div",{className:"flex items-center gap-2",children:[$,U6.jsx(L0,{type:"button",variant:"ghost",size:"icon-sm",onClick:B,"aria-label":"Close panel",children:U6.jsx(i5,{stroke:1.75})})]})]}),H&&U6.jsx("div",{className:"flex-1 pb-(--page-pad)",children:H})]})}var D5=P(u(),1),BK0=Object.entries(N7),QK0=Object.entries(CF),XK0=Object.entries(vQ),zK0=Object.entries(fQ),GK0="relative w-full rounded-lg text-left ring-1 ring-border transition-opacity outline-none focus-visible:ring-3 focus-visible:ring-ring/50";function gN({children:$,className:Z,gridClassName:J,label:H}){return D5.jsxs("div",{className:Q0("flex flex-col gap-2",Z),children:[D5.jsx("p",{className:"text-xs font-medium",children:H}),D5.jsx("div",{role:"group","aria-label":H,className:Q0("grid grid-cols-4 gap-2 @4xl/workspace:grid-cols-2",J),children:$})]})}function mN({active:$,children:Z,className:J,onSelect:H,style:B}){return D5.jsxs("button",{type:"button","aria-pressed":$,onClick:H,className:Q0(GK0,"flex items-center gap-2 p-3",J,!$&&"cursor-pointer pr-9 opacity-70 hover:opacity-100"),style:B,children:[D5.jsx("div",{className:"flex flex-1 flex-col justify-center",children:Z}),$&&D5.jsx(IF,{size:20,stroke:1.5,"aria-hidden":"true"})]})}function Ca({onClose:$,ref:Z}){kK();let{layout:J,setLayout:H}=w1(),B=_9(J.theme);function Q(X){H({theme:{...B,...X}})}return D5.jsx(fN,{ref:Z,title:"Theme",onClose:$,className:"@4xl/workspace:max-w-5xl",children:D5.jsxs("div",{className:"grid grid-cols-1 gap-4 @4xl/workspace:grid-cols-[repeat(2,minmax(0,1fr))_0.5rem_repeat(2,minmax(0,1fr))_0.5rem_minmax(0,1fr)_0.5rem_minmax(0,1fr)] @4xl/workspace:gap-x-2",children:[D5.jsx(gN,{label:"Font",className:"@4xl/workspace:col-span-2 @4xl/workspace:col-start-1",children:BK0.map(([X,z])=>D5.jsx(mN,{active:X===B.font,onSelect:()=>Q({font:X}),style:{fontFamily:z.sans},children:D5.jsx("span",{className:"text-sm font-medium",children:z.label})},X))}),D5.jsx(gN,{label:"Colors",className:"@4xl/workspace:col-span-2 @4xl/workspace:col-start-4",children:QK0.map(([X,z])=>D5.jsx(mN,{active:X===B.color,className:z.primary&&"bg-background text-foreground",onSelect:()=>Q({color:X}),style:C9({...B,color:X}),children:D5.jsxs("div",{className:"flex gap-2",children:[D5.jsx("span",{className:Q0("flex size-5 shrink-0 items-center justify-center rounded-sm text-[9px] leading-none font-bold",z.primary?"bg-primary text-primary-foreground":"bg-foreground text-background"),children:"Aa"}),D5.jsx("span",{className:"text-sm font-medium",children:z.label})]})},X))}),D5.jsx(gN,{label:"Radius",className:"@4xl/workspace:col-start-7",gridClassName:"@4xl/workspace:grid-cols-1",children:XK0.map(([X,z])=>D5.jsx(mN,{active:X===B.radius,onSelect:()=>Q({radius:X}),style:C9({...B,radius:X}),children:D5.jsxs("div",{className:"flex items-center gap-2",children:[D5.jsx("span",{className:"size-5 shrink-0 rounded-sm bg-card texture-checker-2.5 shadow-xs","aria-hidden":"true"}),D5.jsx("span",{className:"text-sm font-medium",children:z.label})]})},X))}),D5.jsx(gN,{label:"Agent",className:"@4xl/workspace:col-start-9",gridClassName:"@4xl/workspace:grid-cols-1",children:zK0.map(([X,z])=>D5.jsx(mN,{active:X===B.agent,onSelect:()=>Q({agent:X}),children:D5.jsxs("div",{className:"flex items-center gap-2",children:[D5.jsx("span",{className:"flex size-5 shrink-0 items-center justify-center",children:D5.jsx(P3,{preset:X,color:"primary",size:28})}),D5.jsx("span",{className:"text-sm font-medium",children:z.label})]})},X))})]})})}var Rq=P(m(),1);var wa=P(m(),1);function Ea($){return m1({queryKey:O0.appletThumbnails($),queryFn:async()=>(await B1(`/api/workspaces/${$}/applet-thumbnails`)).thumbnails,...M8})}function ba($){let Z=a0();return r1({mutationFn:(J)=>W4(`/api/workspaces/${$}/applet-thumbnails`,Z5("PUT",J),"Failed to save applet thumbnails"),onSuccess:()=>{Z.invalidateQueries({queryKey:O0.appletThumbnails($)}),Z.invalidateQueries({queryKey:O0.previews})}})}var UK0=1000,YK0=3,FK0=10800000,KK0=1000,WK0="1000px-3x-webp-q80-v1",NK0=5000,qK0=1000,AK0=1e4,DK0=100,VK0=5000;function LK0($){return Math.min(YK0,UK0/Math.max($.offsetWidth,$.offsetHeight))}function MK0($){return`${WK0}:${$??""}`}function PK0($,Z,J=Date.now()){if(!$||$.revision!==Z)return!0;let H=Date.parse($.capturedAt);return!Number.isFinite(H)||J-H>=FK0}function _K0($,Z){return $!==void 0&&$.revision===Z&&$.captureMs!==void 0&&$.captureMs>=KK0}var OK0=($)=>new Promise((Z)=>{setTimeout(()=>Z(null),$)});function TK0($,Z=DK0){let J=$.getBoundingClientRect(),H=J.top-Z,B=J.bottom+Z,Q=J.left-Z,X=J.right+Z;return(z)=>{if(z.nodeType!==1)return!0;let G=z,U=G.getBoundingClientRect();if(U.width===0&&U.height===0)return G.ownerDocument?.defaultView?.getComputedStyle(G).display!=="none";return U.bottom>H&&U.top<B&&U.right>Q&&U.left<X}}function jK0($,Z,J=VK0){let H=J,B=(Q)=>{for(let X of Q.children){if(!Z(X))continue;if(--H<0)return!0;if(B(X))return!0}return!1};return B($)}async function CK0($,Z){let{createContext:J,destroyContext:H,domToDataUrl:B}=await import("/chunk-j39y2aky.js"),Q=TK0($);if(jK0($,Q))return null;let X=async()=>{let z=await J($,{scale:LK0($),type:"image/webp",quality:0.8,backgroundColor:"#ffffff",timeout:qK0,filter:Q,...Z&&{onCreateForeignObjectSvg:(G)=>{let U=document.createElement("style");U.textContent="[data-widget-chrome] { border-radius: 0 !important; box-shadow: none !important; }[data-widget-chrome]::after { display: none !important; }",G.append(U)}}});try{return await B(z)}finally{H(z)}};return Promise.race([X(),OK0(AK0)])}async function EK0($,Z,J,H,B=CK0,Q=Date.now()){let X=[];for(let z of J){if(H())return null;let G=MK0(z.revision),U=Z.find((W)=>W.kind===$&&W.id===z.id);if(!PK0(U,G,Q)){X.push({id:z.id,revision:G});continue}if(_K0(U,G)){X.push({id:z.id,revision:G});continue}if(!z.element){X.push({id:z.id,revision:G,image:null});continue}let Y=performance.now(),F=await B(z.element,$==="widget").catch(()=>null),K=Math.round(performance.now()-Y);if(H())return null;X.push({id:z.id,revision:G,image:F,captureMs:K})}return X}function uN({kind:$,enabled:Z,targets:J}){let H=d1(),B=Ea(H).data,Q=ba(H),X=q5(J),z=q5(B??[]),G=q5(Q.mutate),U=J.map((F)=>`${F.id}@${F.revision??""}`).join(`
|
|
66
|
+
`),Y=B!==void 0;wa.useEffect(()=>{if(!Z||!Y||U==="")return;let F=!1,K=0,W,N=()=>{K+=1;let q=K;if(W!==void 0)clearTimeout(W);if(document.visibilityState!=="visible")return;W=setTimeout(async()=>{W=void 0;let D=await EK0($,z.current,X.current.map((A)=>({...A,element:document.querySelector(`[data-applet-thumbnail="${CSS.escape(b7($==="view"?"views":"widgets",A.id))}"]`)})),()=>F||K!==q||document.visibilityState!=="visible");if(!D||F||document.visibilityState!=="visible")return;G.current({kind:$,thumbnails:D})},NK0)};return document.addEventListener("visibilitychange",N),N(),()=>{if(F=!0,W!==void 0)clearTimeout(W);document.removeEventListener("visibilitychange",N)}},[Z,$,Y,z,G,U,X])}var Bo=P(m(),1);var u2=P(u(),1);function bK0($){if($==="needs-auth")return"Needs auth";return $[0].toUpperCase()+$.slice(1)}function wK0({name:$,status:Z}){let J=qN($),H="size-full rounded-lg ring-2 ring-background";return u2.jsxs("span",{className:"relative size-10 shrink-0",children:[J?u2.jsx("img",{src:J,alt:"",className:"size-full rounded-lg ring-2 ring-background"}):u2.jsx("span",{className:"flex size-full items-center justify-center rounded-lg bg-muted text-muted-foreground ring-2 ring-background",children:u2.jsx(DN,{className:"size-5"})}),Z!=="connected"&&u2.jsx(Sa,{"aria-hidden":"true",size:16,stroke:1.75,className:"absolute -top-1 -right-1 rounded-full bg-card text-amber-400"})]})}function Ra($){return[...$].sort((Z,J)=>Number(J.status==="connected")-Number(Z.status==="connected"))}function Ia({icon:$,children:Z}){return u2.jsxs("div",{className:"flex items-center gap-3 text-card-foreground",children:[$,u2.jsx("div",{className:"flex min-w-0 flex-1 flex-col justify-center gap-0.5",children:Z})]})}function ka({server:$}){return u2.jsxs(Ia,{icon:u2.jsx(wK0,{name:$.name,status:$.status}),children:[u2.jsx("div",{className:"truncate text-sm font-medium text-foreground",children:AN($.name)}),u2.jsx("span",{className:"text-sm text-muted-foreground",children:bK0($.status)})]})}function ya(){return u2.jsxs(Ia,{icon:u2.jsx(V4,{className:"size-10 shrink-0 rounded-lg"}),children:[u2.jsx(V4,{className:"h-4 w-36 max-w-full"}),u2.jsx(V4,{className:"h-4 w-20"})]})}function PO({children:$}){return u2.jsx("div",{className:"grid grid-cols-1 gap-6 sm:grid-cols-2",children:$})}function xa($,Z){return m1({queryKey:O0.mcp($),queryFn:()=>B1(`/api/workspaces/${$}/mcp`),enabled:Z,staleTime:1/0,gcTime:1/0,refetchOnMount:!1,refetchOnWindowFocus:!1})}var G8=P(u(),1);function QB({title:$,description:Z,children:J}){return G8.jsxs("div",{className:"flex flex-col gap-6",children:[G8.jsxs("header",{className:"flex flex-col gap-0.5",children:[G8.jsx("h2",{className:"text-lg font-medium",children:$}),Z&&G8.jsx("p",{className:"text-sm text-muted-foreground",children:Z})]}),J]})}function XB({label:$,children:Z}){return G8.jsxs("section",{className:"flex flex-col gap-2",children:[$&&G8.jsx("p",{className:"px-0.5 text-xs font-medium text-muted-foreground",children:$}),G8.jsx("div",{className:"flex flex-col divide-y divide-dashed divide-border overflow-hidden rounded-xl border",children:Z})]})}function Xz({title:$,description:Z,control:J}){return G8.jsxs("div",{className:"flex items-center gap-3 px-3.5 py-3",children:[G8.jsxs("div",{className:"flex min-w-0 flex-col",children:[G8.jsx("span",{className:"text-sm font-medium",children:$}),Z&&G8.jsx("span",{className:"text-xs text-muted-foreground",children:Z})]}),J&&G8.jsx("div",{className:"ml-auto flex shrink-0 items-center pl-3",children:J})]})}var b4=P(u(),1),SK0=Array.from({length:4},($,Z)=>Z);function RK0({connectors:$}){if($.isPending)return b4.jsx("div",{role:"status","aria-label":"Loading connectors",children:b4.jsx(PO,{children:SK0.map((Z)=>b4.jsx(ya,{},Z))})});if($.isError)return b4.jsxs(ha,{children:[b4.jsx("p",{className:"text-sm text-muted-foreground",children:"Could not load connectors"}),b4.jsx(L0,{variant:"outline",size:"sm",onClick:()=>$.refetch(),children:"Retry"})]});if($.data.length===0)return b4.jsxs(ha,{children:[b4.jsx(pN,{size:24,stroke:1.5,className:"text-muted-foreground"}),b4.jsx("p",{className:"text-sm text-foreground",children:"No connectors configured"})]});return b4.jsx(PO,{children:Ra($.data).map((Z)=>b4.jsx(ka,{server:Z},Z.name))})}function ha({children:$}){return b4.jsx("div",{className:"flex min-h-48 flex-col items-center justify-center gap-3 rounded-xl border border-dashed border-border px-8 py-12 text-center",children:$})}function va(){let{workspaceId:$}=w1(),Z=xa($,!0);return b4.jsx(QB,{title:"Connectors",description:"Connectors available to the agent in this workspace",children:b4.jsx(RK0,{connectors:Z})})}var jO=P(m(),1);var Gz={};k5(Gz,{Thumb:()=>da,Root:()=>pa});var TZ=P(m(),1);var cN=P(m(),1),_O=cN.createContext(void 0);function fa(){let $=cN.useContext(_O);if($===void 0)throw Error(I0(63));return $}var ga="data-checked",ma="data-unchecked";var dN={...h2,checked($){if($)return{[ga]:""};return{[ma]:""}}};var ua=P(m(),1);function lN($,Z,J,H=!0,B){let[Q,X]=ua.useState(),z=t0(B?`${B}-label`:void 0),G=$??Z??Q;return H0(()=>{let U=$||Z||!H?void 0:kK0(J.current,z);if(Q!==U)X(U)}),G}function kK0($,Z){let J=yK0($);if(!J)return;if(!J.id&&Z)J.id=Z;return J.id||void 0}function yK0($){if(!$)return;let Z=$.parentElement;if(Z&&Z.tagName==="LABEL")return Z;let J=$.id;if(J){let B=$.nextElementSibling;if(B&&B.htmlFor===J)return B}let H=$.labels;return H&&H[0]}var zz=P(u(),1),pa=TZ.forwardRef(function(Z,J){let{checked:H,className:B,defaultChecked:Q,"aria-labelledby":X,form:z,id:G,inputRef:U,name:Y,nativeButton:F=!1,onCheckedChange:K,readOnly:W=!1,required:N=!1,disabled:q=!1,render:D,uncheckedValue:A,value:V,style:L,...O}=Z,{clearErrors:M}=A4(),{state:_,setTouched:w,setDirty:C,validityData:E,setFilled:T,setFocused:k,validationMode:S,disabled:I,name:j,validation:y}=t5(),{labelId:R}=e5(),x=I||q,v=j??Y,f=TZ.useRef(null),b=l2(f,U,y.inputRef),l=TZ.useRef(null),r=t0(),h=H7({id:G}),d=F?void 0:h,[o,c]=D4({controlled:H,default:Boolean(Q),name:"Switch",state:"checked"});J7(l,r,o,void 0,!x,Y),H0(()=>{T(o)},[o,T]),G3(o,()=>{M(v),C(o!==E.initialValue),y.change(o)});let{getButtonProps:i,buttonRef:n}=w5({disabled:x,native:F}),Z0=lN(X,R,f,!F,d),J0={id:F?h:r,role:"switch","aria-checked":o,"aria-readonly":W||void 0,"aria-required":N||void 0,"aria-labelledby":Z0,onFocus(){if(!x)k(!0)},onBlur(){let N0=f.current;if(!N0||x)return;if(w(!0),k(!1),S==="onBlur")y.commit(N0.checked)},onClick(N0){if(W||x)return;N0.preventDefault();let q0=f.current;if(!q0)return;ZH(q0,N0)}},U0={...y.getValidationProps(x),checked:o,disabled:x,form:z,id:d,name:v,required:N,style:v?AG:U9,tabIndex:-1,type:"checkbox","aria-hidden":!0,ref:b,onChange(N0){if(N0.nativeEvent.defaultPrevented)return;if(W){N0.preventDefault();return}let q0=N0.currentTarget.checked,K0=w0(F0.none,N0.nativeEvent);if(K?.(q0,K0),K0.isCanceled)return;c(q0)},onClick(N0){N0.stopPropagation()},onFocus(){l.current?.focus()},...V!==void 0?{value:V}:D1},z0=TZ.useMemo(()=>({..._,checked:o,disabled:x,readOnly:W,required:N}),[_,o,x,W,N]),X0=G0("span",Z,{state:z0,ref:[J,l,n],props:[J0,O,i,(N0)=>y.getValidationProps(x,N0)],stateAttributesMapping:dN});return zz.jsxs(_O.Provider,{value:z0,children:[X0,!o&&v&&A!==void 0&&zz.jsx("input",{type:"hidden",form:z,name:v,value:A,disabled:x}),zz.jsx("input",{...U0,suppressHydrationWarning:!0})]})});var ca=P(m(),1);var da=ca.forwardRef(function(Z,J){let{render:H,className:B,style:Q,...X}=Z,z=fa();return G0("span",Z,{state:z,ref:J,stateAttributesMapping:dN,props:X})});var OO=P(u(),1);function la({className:$,...Z}){return OO.jsx(Gz.Root,{"data-slot":"switch",className:d0('peer relative inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-sm border border-transparent p-px transition-all outline-none after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-checked:bg-primary data-unchecked:bg-accent data-disabled:cursor-not-allowed data-disabled:opacity-50 [:where([class~="group/field-label"]:has(:focus-visible))_&]:border-transparent [:where([class~="group/field-label"]:has(:focus-visible))_&]:ring-0',$),...Z,children:OO.jsx(Gz.Thumb,{"data-slot":"switch-thumb",className:"pointer-events-none block size-4 rounded-xs bg-background shadow-xs ring-0 transition-transform data-checked:translate-x-full data-checked:bg-white data-unchecked:translate-x-0"})})}var TO=["app-settings"];function ia(){let $=a0();return P2((Z)=>{if(Z.type==="settings:updated")$.setQueryData(TO,Z.settings)}),m1({queryKey:TO,queryFn:()=>B1("/api/settings"),staleTime:30000})}function ra(){let $=a0();return r1({mutationFn:(Z)=>B1("/api/settings",Z5("PATCH",Z),"Failed to save settings"),onSuccess:(Z)=>{$.setQueryData(TO,Z)}})}function aa($){return m1({queryKey:O0.env($),queryFn:()=>B1(`/api/workspaces/${$}/env`),...M8})}function oa($){let Z=a0();return r1({mutationFn:(J)=>B1(`/api/workspaces/${$}/env`,Z5("PUT",J)),onSuccess:(J)=>{Z.setQueryData(O0.env($),J)}})}function na($){let Z=a0();return r1({mutationFn:(J)=>W4(`/api/workspaces/${$}/config`,Z5("PUT",{name:J}),"Failed to save name"),onSuccess:()=>{Z.invalidateQueries({queryKey:O0.layout($)}),Z.invalidateQueries({queryKey:O0.all})}})}function sa($){let Z=a0(),J=["workspace-icon",$];return r1({mutationKey:J,scope:{id:`workspace-icon:${$}`},mutationFn:async(H)=>{if(H.kind==="set"){await W4(`/api/workspaces/${$}/config`,Z5("PUT",{icon:H.icon,origin:Y3}),"Failed to save icon");return}if(H.kind==="reset"){await W4(`/api/workspaces/${$}/icon`,{method:"DELETE"},"Failed to reset icon");return}await B1(`/api/workspaces/${$}/icon`,{method:"PUT",headers:{"Content-Type":H.file.type||"application/octet-stream"},body:H.file})},onMutate:async(H)=>{if(H.kind!=="set")return;await Promise.all([Z.cancelQueries({queryKey:O0.layout($)}),Z.cancelQueries({queryKey:O0.all,exact:!0})]);let B={icon:H.icon};Z.setQueryData(O0.layout($),(Q)=>Q?{...Q,...B}:Q),Z.setQueryData(O0.all,(Q)=>Q?.map((X)=>X.id===$?{...X,...B}:X))},onSettled:()=>{if(Z.isMutating({mutationKey:J})>1)return;Z.invalidateQueries({queryKey:O0.layout($)}),Z.invalidateQueries({queryKey:O0.all,exact:!0})}})}function ta($){let Z=a0();return P2((J)=>{if(J.type==="env:updated"&&J.workspaceId===$)Z.invalidateQueries({queryKey:O0.env($)})}),{env:aa($),update:oa($)}}var a5=P(u(),1),xK0={dotenv:".env",custom:"secret",both:"override"},hK0=/^[A-Za-z_][A-Za-z0-9_]*$/;function ea(){let{workspaceId:$}=w1(),{env:Z,update:J}=ta($),[H,B]=jO.useState(""),[Q,X]=jO.useState(""),z=hK0.test(H),G=z&&Q.length>0&&!J.isPending,U=()=>{if(!G)return;J.mutate({set:{[H]:Q}},{onSuccess:()=>{B(""),X("")}})},Y=Z.data?.vars??[],F=Z.data?.files.reduce((W,N)=>W+N.count,0)??0,K=Z.data?.files.length??0;return a5.jsxs(QB,{title:"Environment",description:"Secrets injected into widgets and the agent at run time. Values are write-only — they're never shown again once saved.",children:[a5.jsxs(XB,{label:"Variables",children:[Z.isLoading?a5.jsx("div",{className:"flex items-center justify-center px-3.5 py-6 text-muted-foreground",children:a5.jsx(r5,{className:"size-4 animate-spin",stroke:1.75})}):Y.length===0?a5.jsx("p",{className:"px-3.5 py-4 text-sm text-muted-foreground",children:"No variables yet"}):Y.map((W)=>{let N=W.source!=="dotenv";return a5.jsxs("div",{className:"flex items-center gap-3 px-3.5 py-2.5",children:[a5.jsx("code",{className:"min-w-0 flex-1 truncate font-mono text-xs text-foreground",children:W.key}),a5.jsx("span",{className:"text-xs tracking-widest text-muted-foreground/60 select-none",children:"••••••"}),a5.jsx("span",{className:Q0("rounded-lg px-1.5 py-0.5 text-[11px] font-medium",W.source==="dotenv"?"bg-muted text-muted-foreground":"bg-primary/10 text-primary"),children:xK0[W.source]}),!N&&a5.jsx("span",{className:"text-right text-[11px] text-muted-foreground/60",children:"from file"}),a5.jsx(L0,{type:"button",variant:"ghost",size:"icon-sm",onClick:()=>J.mutate({remove:[W.key]}),disabled:!N,"aria-label":`Delete ${W.key}`,className:"disabled:invisible",children:a5.jsx(iN,{stroke:1.75})})]},W.key)}),a5.jsxs("div",{className:"flex items-center gap-2 px-3.5 py-2.5",children:[a5.jsx(p8,{value:H,onChange:(W)=>B(W.target.value),placeholder:"NEW_KEY","aria-invalid":H.length>0&&!z,className:"h-7 w-40 font-mono text-xs"}),a5.jsx(p8,{value:Q,onChange:(W)=>X(W.target.value),onKeyDown:(W)=>{if(W.key==="Enter")U()},type:"password",placeholder:"value",className:"h-7 flex-1 text-xs"}),a5.jsxs(L0,{variant:"outline",size:"sm",onClick:U,disabled:!G,children:[J.isPending?a5.jsx(r5,{stroke:1.75,className:"animate-spin"}):a5.jsx(t2,{stroke:1.75}),"Add"]})]})]}),a5.jsx(XB,{label:"From .env files",children:a5.jsx(Xz,{title:"Inherit .env files",description:K>0?`Discovered ${F} ${F===1?"key":"keys"} across ${K} ${K===1?"file":"files"} in this space`:"No .env files found in this space",control:a5.jsx(la,{checked:Z.data?.inheritDotenv??!0,disabled:Z.isLoading,onCheckedChange:(W)=>J.mutate({inheritDotenv:W})})})})]})}var S9={};k5(S9,{createHandle:()=>Jo,Viewport:()=>MY,Trigger:()=>Zo,Title:()=>PY,Root:()=>$o,Portal:()=>DY,Popup:()=>AY,Handle:()=>rN,Description:()=>KY,Close:()=>FY,Backdrop:()=>YY});function $o($){return LY("alert-dialog",$)}var Zo=_Y;class rN extends gJ{}function Jo(){return new rN}var w4=P(u(),1);function aN({...$}){return w4.jsx(S9.Root,{"data-slot":"alert-dialog",...$})}function oN({...$}){return w4.jsx(S9.Trigger,{"data-slot":"alert-dialog-trigger",...$})}function vK0({...$}){return w4.jsx(g8,{portal:S9.Portal,"data-slot":"alert-dialog-portal",...$})}function fK0({className:$,...Z}){return w4.jsx(S9.Backdrop,{"data-slot":"alert-dialog-overlay",className:d0("fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",$),...Z})}function nN({className:$,size:Z="default",...J}){return w4.jsxs(vK0,{children:[w4.jsx(fK0,{}),w4.jsx(S9.Popup,{"data-slot":"alert-dialog-content","data-size":Z,className:d0("group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid w-full -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-6 text-sm text-popover-foreground shadow-xl duration-100 outline-none data-[size=default]:max-w-xs data-[size=sm]:max-w-xs data-[size=default]:sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",$),...J})]})}function sN({className:$,...Z}){return w4.jsx("div",{"data-slot":"alert-dialog-header",className:d0("grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-4 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]",$),...Z})}function tN({className:$,...Z}){return w4.jsx("div",{"data-slot":"alert-dialog-footer",className:d0("-mx-6 -mb-6 flex flex-col-reverse gap-2 rounded-b-xl p-6 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end",$),...Z})}function eN({className:$,...Z}){return w4.jsx(S9.Title,{"data-slot":"alert-dialog-title",className:d0('text-base font-medium sm:group-data-[size=default]/alert-dialog-content:[:where([class~="group/alert-dialog-content"]):has([data-slot=alert-dialog-media])_&]:col-start-2',$),...Z})}function $q({className:$,...Z}){return w4.jsx(S9.Description,{"data-slot":"alert-dialog-description",className:d0("text-sm text-balance text-muted-foreground md:text-pretty *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",$),...Z})}function Zq({className:$,...Z}){return w4.jsx(L0,{"data-slot":"alert-dialog-action",className:d0($),...Z})}function Jq({className:$,variant:Z="outline",size:J="default",...H}){return w4.jsx(S9.Close,{"data-slot":"alert-dialog-cancel",className:d0($),render:w4.jsx(L0,{variant:Z,size:J}),...H})}var V2=P(u(),1);function Ho(){let{demo:$}=N4(),{name:Z,cwd:J,workspaceId:H}=w1(),[,B]=a4(),Q=zY(),X=Z??J??"this space",z=()=>{Q.mutate(H,{onSuccess:()=>B("/")})};return V2.jsxs(QB,{title:"General",description:"Basic details for this space",children:[V2.jsx(XB,{children:V2.jsx(Xz,{title:"Path",control:V2.jsx(p8,{value:J??"","aria-label":"Workspace path",title:J??void 0,className:"w-56",readOnly:!0})})}),!$&&V2.jsx(XB,{label:"Danger zone",children:V2.jsx(Xz,{title:"Remove space",description:"Remove this space from Moi. Its folder and sessions stay on disk.",control:V2.jsxs(aN,{children:[V2.jsx(oN,{render:V2.jsx(L0,{type:"button",variant:"destructive",size:"sm"}),disabled:Q.isPending,children:"Remove"}),V2.jsxs(nN,{children:[V2.jsxs(sN,{children:[V2.jsxs(eN,{children:["Remove “",X,"” from your workspaces?"]}),V2.jsx($q,{children:"This only removes it from your list. The folder and its sessions stay on disk. You can add it back any time."})]}),Q.isError&&V2.jsx("p",{className:"text-xs text-destructive",children:Q.error.message}),V2.jsxs(tN,{children:[V2.jsx(Jq,{disabled:Q.isPending,children:"Cancel"}),V2.jsxs(Zq,{type:"button",variant:"destructive",onClick:z,disabled:Q.isPending,children:[Q.isPending&&V2.jsx(r5,{"data-icon":"inline-start",stroke:1.75,className:"animate-spin"}),"Remove"]})]})]})]})})})]})}var U8=P(u(),1),gK0=[{id:"general",label:"General",icon:F3},{id:"connectors",label:"Connectors",icon:pN},{id:"environment",label:"Environment",icon:uY}];function Hq({children:$}){let[Z,J]=Bo.useState("general");return U8.jsxs(e6,{children:[$,U8.jsxs(mJ,{className:"flex h-[min(680px,90vh)] w-[880px] gap-0 overflow-hidden p-0 sm:max-w-[94vw]",children:[U8.jsx($7,{className:"sr-only",children:"Space settings"}),U8.jsxs("nav",{className:"flex w-48 shrink-0 flex-col gap-0.5 border-r bg-muted p-3",children:[U8.jsx("p",{className:"px-2.5 pt-4 pb-2 text-xs text-muted-foreground",children:"Settings"}),gK0.map((H)=>U8.jsxs(L0,{type:"button",variant:Z===H.id?"secondary":"ghost",size:"sm",onClick:()=>J(H.id),className:"justify-start",children:[U8.jsx(H.icon,{stroke:1.75}),H.label]},H.id))]}),U8.jsx("div",{className:"relative scrollbar-thin min-w-0 flex-1 overflow-y-auto",children:U8.jsxs("div",{className:"px-8 py-7",children:[Z==="general"&&U8.jsx(Ho,{}),Z==="connectors"&&U8.jsx(va,{}),Z==="environment"&&U8.jsx(ea,{})]})})]})]})}var Yo=P(m(),1);function Bq($){let Z=a0();return P2((J)=>{if((J.type==="views:changed"||J.type==="view:deleted")&&J.workspaceId===$){if(Z.invalidateQueries({queryKey:O0.views($)}),J.type==="view:deleted")Z.invalidateQueries({queryKey:O0.sessions($)})}}),m1({queryKey:O0.views($),queryFn:async()=>(await B1(`/api/workspaces/${$}/views`)).views,...M8})}function Uz($,Z){let J=a0();return r1({mutationFn:Z,onSuccess:()=>J.invalidateQueries({queryKey:O0.views($)})})}function Qo($){return Uz($,({viewId:Z,title:J})=>B1(`/api/workspaces/${$}/views/${encodeURIComponent(Z)}`,Z5("PATCH",{title:J}),"Couldn’t rename view"))}function CO($){return Uz($,(Z)=>W4(`/api/workspaces/${$}/views/${encodeURIComponent(Z)}`,{method:"DELETE"},"Couldn’t delete view"))}function Xo($){return Uz($,()=>B1(`/api/workspaces/${$}/views`,Z5("POST"),"Couldn’t create view"))}function zo($){return Uz($,({viewId:Z,requirements:J})=>B1(`/api/workspaces/${$}/views/${Z}`,Z5("PATCH",{requirements:J}),"Couldn’t save view requirements"))}function Go($){return Uz($,({viewId:Z,...J})=>B1(`/api/workspaces/${$}/views/${Z}/submit`,Z5("POST",J),"Couldn’t start view chat"))}var Uo=CO;function Yz($){return $.title||($.status==="compiled"?$.id:"New view")}function Fz($){return dY($.icon)??qW}var b1=P(u(),1);function mK0({outlined:$,onClick:Z}){return b1.jsxs("button",{type:"button","aria-label":"Create new view",onClick:Z,className:Q0("group flex w-20 shrink-0 cursor-pointer flex-col items-center gap-2 text-sm",$?"text-foreground":"text-muted-foreground"),children:[b1.jsx("div",{className:Q0("size-16 rounded-2xl squircle",$&&"shadow-xs transition-shadow duration-300 ease-out group-hover:shadow-2xl"),children:b1.jsx("div",{className:Q0("flex size-full items-center justify-center rounded-2xl squircle",$?"bg-background text-foreground":"bg-accent"),children:b1.jsx(t2,{size:32,stroke:1.25})})}),b1.jsx("span",{className:"line-clamp-2 w-full text-xs leading-snug font-medium text-ellipsis",children:"New view"})]})}function uK0({view:$,Icon:Z,onOpen:J}){let{workspaceId:H}=w1(),B=Qo(H),Q=CO(H),X=Yz($),[z,G]=Yo.useState(!1);function U(){G(!0)}function Y(F){let K=F.trim();if(!K||K===X)return;B.mutate({viewId:$.id,title:K},{onError:(W)=>{T1.add({title:"Couldn’t rename view",description:W.message,type:"error"})}})}return b1.jsxs("div",{className:"group/item relative w-20 shrink-0",children:[b1.jsxs("button",{type:"button","aria-label":`Open ${X}`,onClick:J,className:"group flex w-20 cursor-pointer flex-col items-center gap-2 text-sm text-foreground",children:[b1.jsx("div",{className:"size-16 rounded-2xl transition-shadow duration-300 ease-out squircle group-hover:shadow-xl group-hover/item:shadow-xl",children:b1.jsx("div",{"data-vivid":!0,className:"flex size-full items-center justify-center rounded-2xl bg-primary text-primary-foreground inset-shadow-[0_0_10px_color-mix(in_oklab,var(--color-white)_30%,transparent)] squircle",children:b1.jsx(Z,{size:32,stroke:1.25})})}),b1.jsx("span",{className:"line-clamp-2 w-full text-xs leading-snug font-medium text-ellipsis",children:z?"":X})]}),z&&b1.jsx(bF,{autoFocus:!0,selectOnFocus:!0,"aria-label":`Rename ${X}`,defaultValue:X,onBlur:()=>G(!1),onValueCommit:Y,className:"absolute top-18 left-0 m-0 h-auto w-20 max-w-20 min-w-0 rounded-xs px-1 py-0 text-center text-xs leading-snug font-medium"}),b1.jsxs(aN,{children:[b1.jsxs(r8,{children:[b1.jsx(a8,{render:b1.jsx(L0,{type:"button",variant:"outline",size:"icon-xs","aria-label":`View actions for ${X}`,className:"absolute -top-1 right-1 border-0 opacity-0 shadow-xs transition-opacity group-hover/item:opacity-100 group-hover/item:delay-400 focus-visible:opacity-100 data-popup-open:opacity-100",children:b1.jsx(mY,{stroke:1.75})})}),b1.jsxs(o8,{align:"end",className:"min-w-32",children:[b1.jsxs(B8,{onClick:U,disabled:B.isPending,children:[b1.jsx(VW,{stroke:1.75}),"Rename"]}),b1.jsxs(B8,{nativeButton:!0,render:b1.jsx(oN,{}),disabled:Q.isPending,onClick:()=>Q.reset(),className:"w-full",children:[b1.jsx(iN,{stroke:1.75}),"Delete"]})]})]}),b1.jsxs(nN,{children:[b1.jsxs(sN,{children:[b1.jsxs(eN,{children:["Delete “",X,"”?"]}),b1.jsx($q,{children:"This deletes the view and its source code. Related data and shared files stay in the workspace."})]}),Q.isError&&b1.jsx("p",{className:"text-xs text-destructive",children:Q.error.message}),b1.jsxs(tN,{children:[b1.jsx(Jq,{disabled:Q.isPending,children:"Cancel"}),b1.jsxs(Zq,{type:"button",variant:"destructive",disabled:Q.isPending,onClick:()=>Q.mutate($.id),children:[Q.isPending&&b1.jsx(r5,{"data-icon":"inline-start",stroke:1.75,className:"animate-spin"}),"Delete view"]})]})]})]})]})}function Fo({views:$,onOpenView:Z,onCreateView:J,showOnboarding:H}){let B=$.length===0;return b1.jsxs("div",{className:"relative no-scrollbar flex size-full items-center overflow-hidden bg-muted",children:[B&&b1.jsx("div",{className:"pointer-events-none absolute inset-0 texture-checker [mask-image:linear-gradient(to_right,transparent_40%,black_80%)]","aria-hidden":!0}),b1.jsx("h2",{className:"relative pr-6 pl-12 text-2xl font-semibold text-foreground",children:"Views"}),b1.jsxs("div",{className:"relative no-scrollbar flex scroll-fade-x gap-2 overflow-x-auto px-6 pt-4 [--scroll-fade-reveal:16px]",children:[$.map((Q)=>b1.jsx(uK0,{view:Q,Icon:Fz(Q),onOpen:()=>Z(Q.id)},Q.id)),b1.jsx(mK0,{outlined:B,onClick:J})]}),B&&H&&b1.jsx("p",{className:"relative mr-8 ml-auto max-w-56 text-right text-sm text-muted-foreground",children:"Create new views when you need separate pages for focused tasks"})]})}var Wo=P(u(),1),pK0={[DM.id]:($)=>Wo.jsx(Fo,{views:$.views,onOpenView:$.onOpenView,onCreateView:$.onCreateView,showOnboarding:$.showOnboarding})};function Ko($,Z){if(!_3($))return;return pK0[$](Z)}function No($,Z,J,H){let B=$.reduce((Q,X)=>Math.max(Q,X.y+X.h),0);for(let Q=0;Q<=B+J;Q++)for(let X=0;X<=H-Z;X++)if(!$.some((G)=>!(X+Z<=G.x||G.x+G.w<=X||Q+J<=G.y||G.y+G.h<=Q)))return{x:X,y:Q};return{x:0,y:B}}function Kz($,Z=[],J=4){let H=[];for(let B of $){let{x:Q,y:X}=B.x!==void 0&&B.y!==void 0?{x:B.x,y:B.y}:No([...Z,...H],B.w,B.h,J);H.push({i:B.id,x:Q,y:X,w:B.w,h:B.h})}return H}function Qq($,Z,J){return No($,Z,J,4)}function qo($,Z){let J=new Map(Z.map((H)=>[H.id,H]));return $.map((H)=>{let B=J.get(H.i);return B?{...H,x:B.x,y:B.y}:H})}var EO=P(m(),1),Xq=new Map;function cK0($){let Z=window.__moiAppletCss?.get($)??"",J=Xq.get($);if(!J){let Q=document.createElement("style");Q.dataset.appletStyle=$,document.head.appendChild(Q),J={el:Q,refs:0},Xq.set($,J)}if(J.el.textContent!==Z)J.el.textContent=Z;J.refs++;let H=J,B=!1;return()=>{if(B)return;if(B=!0,H.refs--,H.refs<=0)H.el.remove(),Xq.delete($)}}function dK0($){let Z=Xq.get($);if(!Z||Z.el===document.head.lastElementChild)return;document.head.appendChild(Z.el)}function zq($,Z,J=!1){EO.useInsertionEffect(()=>cK0($),[$,Z]),EO.useInsertionEffect(()=>{if(J)dK0($)},[$,J,Z])}var bO=P(u(),1);function Ao({segment:$,name:Z,version:J,children:H}){let B=d1(),Q=b7($,Z);return zq(pK($,B,Z),J),bO.jsx("div",{"data-applet":Q,className:"size-full",children:bO.jsx(HQ,{appletId:Q,children:H})})}var Do=P(m(),1);var zB=P(u(),1);class Wz extends Do.Component{state={error:null};static getDerivedStateFromError($){return{error:$}}componentDidCatch($,Z){console.error(`[widget:${this.props.name}]`,$,Z.componentStack),V8(this.props.workspaceId,{source:"render",kind:this.props.kind,name:this.props.name,message:$.message||String($),stack:[$.stack,Z.componentStack].filter(Boolean).join(`
|
|
67
|
+
`)})}componentDidUpdate($){if($.resetKey!==this.props.resetKey&&this.state.error)this.setState({error:null})}render(){if(this.state.error)return zB.jsxs("div",{className:"flex h-full w-full flex-col items-start justify-start gap-1.5 p-4 text-xs",children:[zB.jsxs("div",{className:"flex items-center gap-1.5 font-semibold text-destructive",children:[zB.jsx(BU,{size:16,stroke:1.75}),"Widget crashed"]}),zB.jsx("div",{className:"font-mono break-words text-muted-foreground",children:this.state.error.message})]});return this.props.children}}var c7=P(u(),1);function Vo({name:$}){let Z=d1(),J=$g($);return c7.jsxs(m4,{mode:"wait",initial:!1,children:[J.status==="ready"&&c7.jsx(K5.div,{className:"absolute inset-0",initial:{opacity:0,filter:"blur(4px)"},animate:{opacity:1,filter:"blur(0px)"},exit:{opacity:0,filter:"blur(4px)"},transition:{duration:0.45,ease:"easeInOut"},children:c7.jsx(Wz,{name:$,kind:"widget",workspaceId:Z,resetKey:J.version,children:c7.jsx(Ao,{segment:"widgets",name:$,version:J.version,children:c7.jsx(J.Component,{})})})},J.version),J.status==="error"&&c7.jsx(K5.p,{className:"absolute inset-0 p-4 text-xs text-destructive",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:0.45,ease:"easeInOut"},children:J.error},`err-${J.version}`)]})}var Mo=P(m(),1);var d7=P(u(),1);function Gq({customizing:$,hidden:Z,widgetId:J,onRemove:H,children:B}){let Q=Kg(),X=!J||!_3(J);return d7.jsxs(K5.div,{variants:{idle:{rotate:0},wiggle:{rotate:[0.5,-0.5],transition:{rotate:{repeat:1/0,repeatType:"reverse",duration:0.15,ease:"easeInOut"}}}},animate:$?"wiggle":"idle",transition:{type:"spring",duration:0.35,bounce:0},className:"group/widget relative size-full",children:[d7.jsx("div",{"data-widget-chrome":!0,"data-vivid":X?!0:void 0,style:X?C9(Q,"widget"):void 0,className:Q0("absolute inset-0 overflow-hidden rounded-2xl text-foreground squircle",$&&"pointer-events-none"),children:B}),$&&H&&d7.jsx("div",{className:"absolute -top-2 -right-2 opacity-0 transition-opacity group-hover/widget:opacity-100",children:d7.jsx(L0,{size:"icon-sm",variant:"outline",className:"rounded-full","aria-label":Z?"Restore widget":"Hide widget",onPointerDown:(z)=>z.stopPropagation(),onClick:H,children:Z?d7.jsx(t2,{stroke:1.75}):d7.jsx(Lo,{stroke:1.75})})})]})}var Y6=P(u(),1),lK0={0:"col-start-1",1:"col-start-2",2:"col-start-3",3:"col-start-4"},iK0={0:"row-start-1",1:"row-start-2",2:"row-start-3",3:"row-start-4",4:"row-start-5",5:"row-start-6",6:"row-start-7",7:"row-start-8"},rK0={1:"col-span-1",2:"col-span-2",3:"col-span-3",4:"col-span-4"},aK0={1:"row-span-1",2:"row-span-2",3:"row-span-3",4:"row-span-4"};function Po({items:$,renderItem:Z,onCreateWidget:J,onClose:H,onRestore:B,ref:Q}){let X=Mo.useMemo(()=>Kz($),[$]);return Y6.jsx(fN,{ref:Q,title:"Widgets",actions:Y6.jsxs(L0,{type:"button",variant:"secondary",size:"sm",onClick:J,children:[Y6.jsx(t2,{"data-icon":"inline-start",stroke:1.75}),"New widget"]}),onClose:H,className:"max-h-[60vh]",children:X.length>0&&Y6.jsx("div",{className:"grid auto-rows-[160px] grid-cols-4 gap-2",children:Y6.jsx(m4,{children:X.map((z)=>Y6.jsx(K5.div,{layoutId:z.i,className:Q0(lK0[z.x],iK0[z.y],rK0[z.w],aK0[z.h]),transition:{type:"spring",duration:0.35,bounce:0},children:Y6.jsx(Gq,{customizing:!0,widgetId:z.i,onRemove:()=>B(z.i),hidden:!0,children:Z(z.i)})},z.i))})})})}var Tq=P(m(),1);var i4=P(m(),1);var H1=P(m(),1),GB=P(m(),1),b8=P(m(),1),co=P(u(),1),Yq=P(m(),1),Fq=P(m(),1),g1=P(u(),1),oK0=Object.defineProperty,nK0=($,Z)=>{for(var J in Z)oK0($,J,{get:Z[J],enumerable:!0})},F6={};nK0(F6,{ActiveEmoji:()=>Xn,Empty:()=>Qn,List:()=>Jn,Loading:()=>Bn,Root:()=>oo,Search:()=>no,SkinTone:()=>zn,SkinToneSelector:()=>Hn,Viewport:()=>so});var vo="'Apple Color Emoji', 'Noto Color Emoji', 'Twemoji Mozilla', 'Android Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', EmojiSymbols, sans-serif",RO=["none","light","medium-light","medium","medium-dark","dark"];function wO($){return $.charAt(0).toUpperCase()+$.slice(1)}var R9=2,S4=null;function _o($){try{S4??=document.createElement("canvas").getContext("2d",{willReadFrequently:!0})}catch{}if(!S4||(queueMicrotask(()=>{S4&&(S4=null)}),S4.canvas.width=R9,S4.canvas.height=R9,S4.font=`2px ${vo}`,S4.textBaseline="middle",S4.measureText($).width>=R9*2))return!1;S4.fillStyle="#00f",S4.fillText($,0,0);let Z=S4.getImageData(0,0,R9,R9).data;S4.clearRect(0,0,R9,R9),S4.fillStyle="#f00",S4.fillText($,0,0);let J=S4.getImageData(0,0,R9,R9).data;for(let H=0;H<R9*R9*4;H+=4)if(Z[H]!==J[H]||Z[H+1]!==J[H+1]||Z[H+2]!==J[H+2])return!1;return!0}function Oo($,Z,J){try{let H=$.getItem(Z);if(!H)throw Error(`No value found for "${Z}".`);let B=JSON.parse(H);return J(B)}catch{return null}}function fo($,Z,J){$.setItem(Z,JSON.stringify(J))}function To($){return(Z)=>Z===void 0?void 0:$(Z)}function jo($){return(Z)=>Z===null?null:$(Z)}function $4($){if(typeof $!="string")throw Error();return $}function Uq($){if(typeof $!="number")throw Error();return $}function go($){if(typeof $!="boolean")throw Error();return $}function l7($){return(Z)=>{if(typeof Z!="object"||Z===null)throw Error();let J={};for(let H in $){let B=Z[H];B===void 0&&$[H](void 0),J[H]=$[H](B)}return J}}function SO($){return(Z)=>{if(!Array.isArray(Z))throw Error();return Z.length>0&&$(Z[0]),Z}}var mo=($,Z)=>`${$}/${Z}/data.json`,uo=($,Z)=>`${$}/${Z}/messages.json`,sK0=["bn","da","de","en-gb","en","es-mx","es","et","fi","fr","hi","hu","it","ja","ko","lt","ms","nb","nl","pl","pt","ru","sv","th","uk","vi","zh-hant","zh"],Co="en",po=($)=>`frimousse/data/${$}`,Eo="frimousse/metadata";async function bo($,Z){try{return(await fetch($,{method:"HEAD",signal:Z})).headers.get("etag")}catch{return null}}async function tK0($,Z,J){let[{emojis:H,emojisEtag:B},{messages:Q,messagesEtag:X}]=await Promise.all([fetch(mo($,Z),{signal:J}).then(async(z)=>({emojis:await z.json(),emojisEtag:z.headers.get("etag")})),fetch(uo($,Z),{signal:J}).then(async(z)=>({messages:await z.json(),messagesEtag:z.headers.get("etag")}))]);return{emojis:H,messages:Q,emojisEtag:B,messagesEtag:X}}async function eK0($,Z,J){let[H,B]=await Promise.all([bo(mo($,Z),J),bo(uo($,Z),J)]);return{emojisEtag:H,messagesEtag:B}}function $W0($){return $.skins?$.skins.filter((Z)=>typeof Z.tone=="number").reduce((Z,J)=>{let H=RO[J.tone];return Z[H]=J.emoji,Z},{}):void 0}async function wo($,Z,J){let{emojis:H,emojisEtag:B,messages:Q,messagesEtag:X}=await tK0($,Z,J),z=Q.subgroups.find((N)=>N.key==="country-flag"||N.key==="subdivision-flag"),G=Q.groups.filter((N)=>N.key!=="component"),U=H.filter((N)=>("group"in N)),Y=G.map((N)=>({index:N.order,label:wO(N.message)})),F=Q.skinTones.reduce((N,q)=>(N[q.key]=wO(q.message),N),{}),K=U.map((N)=>({emoji:N.emoji,category:N.group,version:N.version,label:wO(N.label),tags:N.tags??[],countryFlag:z&&N.subgroup===z.order||void 0,skins:$W0(N)})),W={locale:Z,emojis:K,categories:Y,skinTones:F};return fo(localStorage,po(Z),{data:W,metadata:{emojisEtag:B,messagesEtag:X}}),W}function ZW0($,Z){let J=new Map;for(let X of $)J.has(X.version)||J.set(X.version,X.emoji);let H=[...J.keys()].sort((X,z)=>z-X),B=H[0]??0,Q=_o("\uD83C\uDDEA\uD83C\uDDFA");if(typeof Z=="number")return{emojiVersion:Z,countryFlags:Q};for(let X of H){let z=J.get(X);if(_o(z))return{emojiVersion:X,countryFlags:Q}}return{emojiVersion:B,countryFlags:Q}}var JW0=l7({emojiVersion:Uq,countryFlags:go}),HW0=l7({data:l7({locale:$4,emojis:SO(l7({emoji:$4,category:Uq,label:$4,version:Uq,tags:SO($4),countryFlag:To(go),skins:To(l7({light:$4,"medium-light":$4,medium:$4,"medium-dark":$4,dark:$4}))})),categories:SO(l7({index:Uq,label:$4})),skinTones:l7({light:$4,"medium-light":$4,medium:$4,"medium-dark":$4,dark:$4})}),metadata:l7({emojisEtag:jo($4),messagesEtag:jo($4)})});async function BW0({locale:$,emojiVersion:Z,emojibaseUrl:J,signal:H}){let B=typeof J=="string"?J:`https://cdn.jsdelivr.net/npm/emojibase-data@${typeof Z=="number"?Math.floor(Z):"latest"}`,Q=Oo(sessionStorage,Eo,JW0),X=Oo(localStorage,po($),HW0),z;if(!X)z=await wo(B,$,H);else if(Q)z=X.data;else try{let{emojisEtag:U,messagesEtag:Y}=await eK0(B,$,H);z=!U||!Y||U!==X.metadata.emojisEtag||Y!==X.metadata.messagesEtag?await wo(B,$,H):X.data}catch{z=X.data}Q??=ZW0(z.emojis,Z),fo(sessionStorage,Eo,Q);let G=z.emojis.filter((U)=>{let Y=U.version<=Q.emojiVersion;return U.countryFlag?Y&&Q.countryFlags:Y});return{locale:$,emojis:G,categories:z.categories,skinTones:z.skinTones}}function So($){return sK0.includes($)?$:(console.warn(`Locale "${$}" is not supported, using "${Co}" instead.`),Co)}function Ro($){return RO.includes($)?$:(console.warn(`Skin tone "${$}" is not valid, using "none" instead.`),"none")}function QW0($,Z){let J=[];if(Z<=0)return J;for(let H=0,B=$.length;H<B;H+=Z)J.push($.slice(H,H+Z));return J}function XW0($,Z){if(!Z)return $;let J=Z.toLowerCase().trim(),H=new WeakMap;return $.filter((B)=>{let Q=0;B.label.toLowerCase().includes(J)&&(Q+=10);for(let X of B.tags)X.toLowerCase().includes(J)&&(Q+=1);return Q>0?(H.set(B,Q),!0):!1}).sort((B,Q)=>(H.get(Q)??0)-(H.get(B)??0))}function zW0($,Z,J,H){let B=XW0($.emojis,H),Q=[],X=[],z=[],G={},U=0,Y=0;for(let F of B)G[F.category]||(G[F.category]=[]),G[F.category].push({emoji:J&&J!=="none"&&F.skins?F.skins[J]:F.emoji,label:F.label});for(let F of $.categories){let K=G[F.index];if(!K||K.length===0)continue;let W=QW0(Array.from(K),Z).map((N)=>({categoryIndex:U,emojis:N}));Q.push(...W),X.push({label:F.label,rowsCount:W.length,startRowIndex:Y}),z.push(Y),U++,Y+=W.length}return{count:B.length,categories:X,categoriesStartRowIndices:z,rows:Q,skinTones:$.skinTones}}function GW0($){let Z={},J=null,H=null,B=new Set,Q=()=>{if(J){Z=J,J=null;for(let U of B)U(Z)}H=null},X=()=>J??Z,z=(U)=>{J??=Z,Object.assign(J,typeof U=="function"?U(X()):U),H||(H=requestAnimationFrame(Q))},G=(U)=>(B.add(U),()=>B.delete(U));return Z=$(z,X),{get:X,set:z,subscribe:G}}function UW0($){let[Z]=b8.useState($);return Z}function YW0($){let Z=b8.createContext(null);return{useStore:()=>{let J=b8.useContext(Z);if(!J)throw Error($);return J},Provider:({store:J,children:H})=>co.jsx(Z.Provider,{value:J,children:H})}}function E8($,Z,J=Object.is){let[H,B]=b8.useState(()=>Z($.get()));return b8.useEffect(()=>$.subscribe(()=>{let Q=Z($.get());B((X)=>J(X,Q)?X:Q)}),[$,Z,J]),b8.useDebugValue(H),H}function w3($,Z,J){let H=b8.useCallback((B)=>B[Z],[Z]);return E8($,H,J)}var Io=2;function FW0($,Z,J,H,B){let Q=0;return GW0((X,z)=>({locale:Z,columns:J,sticky:H,skinTone:B,onEmojiSelect:$,data:null,search:"",interaction:"none",activeColumnIndex:0,activeRowIndex:0,rowHeight:null,categoryHeaderHeight:null,viewportWidth:null,viewportHeight:null,viewportCurrentCategoryIndex:null,viewportStartCategoryIndex:0,viewportStartRowIndex:0,viewportEndRowIndex:0,rootRef:null,searchRef:null,viewportRef:null,listRef:null,updateViewportState:(G)=>{let U=z(),Y=G?.data??U.data,F=G?.categoryHeaderHeight??U.categoryHeaderHeight,K=G?.rowHeight??U.rowHeight,W=G?.viewportHeight??U.viewportHeight;if(!Y||Y.rows.length===0||!F||!K||!W)return X({...G,viewportStartCategoryIndex:0,viewportStartRowIndex:0,viewportEndRowIndex:0});let N=0,q=0;for(let C of Y.categories)if(q++*F+C.startRowIndex*K<Q)N+=F;else break;let D=Y.categories.length*F+Y.rows.length*K,A=Math.floor(Io*K/2),V=Math.ceil(Io*K/2),L=Math.min(Q-N-A,D-W),O=L+W+V,M=Math.max(0,Math.floor(L/K)),_=Math.min(Y.rows.length-1,Math.ceil(O/K)),w=Y.rows[M]?.categoryIndex;return X(w===void 0&&G?G:{...G,viewportStartCategoryIndex:w,viewportStartRowIndex:M,viewportEndRowIndex:_})},onDataChange:(G)=>{z().updateViewportState({data:G,activeColumnIndex:0,activeRowIndex:0})},onSearchChange:(G)=>{X({search:G,interaction:G?"keyboard":"none"})},onActiveEmojiChange:(G,U,Y)=>{if(X({interaction:G,activeColumnIndex:U,activeRowIndex:Y}),G!=="keyboard")return;let{listRef:F,viewportRef:K,sticky:W,rowHeight:N,viewportHeight:q,categoryHeaderHeight:D}=z(),A=F?.current,V=K?.current;if(!A||!V||!N||!D||!q)return;let L=Y;L===0&&V.scrollTo({top:0,behavior:"instant"});let O=A.querySelector(`[aria-rowindex="${L}"]`);if(!(O instanceof HTMLElement))return;let M=O.offsetTop,_=getComputedStyle(O),w=Number.parseFloat(_.scrollMarginTop),C=Number.parseFloat(_.scrollMarginBottom),E=Q+w;W&&M<Q+q/2&&(E+=D);let T=E+q-C;(M<E||M+N>T)&&V.scrollTo({top:Math.max(M<E+D?M-Math.max(W?D:0,w):M-q+N+C,0),behavior:"instant"})},onActiveEmojiReset:()=>{X({interaction:"none",activeColumnIndex:0,activeRowIndex:0})},onRowHeightChange:(G)=>{z().updateViewportState({rowHeight:G})},onCategoryHeaderHeightChange:(G)=>{z().updateViewportState({categoryHeaderHeight:G})},onViewportSizeChange:(G,U)=>{z().updateViewportState({viewportWidth:G,viewportHeight:U})},onViewportScroll:(G)=>{Q=G,z().updateViewportState()}}))}var{useStore:Y8,Provider:KW0}=YW0("EmojiPicker.Root is missing.");function WW0($){return $.search}function IO($){return $.interaction==="none"?void 0:$.data?.rows[$.activeRowIndex]?.emojis[$.activeColumnIndex]}function NW0($){return $.data===void 0||typeof $.data?.count=="number"&&$.data.count===0}function qW0($){return $.data===null||$.viewportHeight===null||$.rowHeight===null||$.categoryHeaderHeight===null}function lo($){return $.data?.rows.length}function AW0($){return $.data?.categories.length}function DW0($){return $.data?.categoriesStartRowIndices}function VW0($){return $.data?.skinTones}function io($,Z){return $?.emoji===Z?.emoji}function LW0($,Z){return $?.categoryIndex!==Z?.categoryIndex||$?.emojis.length!==Z?.emojis.length?!1:!!$?.emojis.every((J,H)=>io(J,Z?.emojis[H]))}var Nz="",ko=/\p{Emoji_Modifier_Base}/u,MW0=/\uFE0F$/,PW0=/\u{1F3FB}|\u{1F3FC}|\u{1F3FD}|\u{1F3FE}|\u{1F3FF}/gu,_W0={light:"\uD83C\uDFFB","medium-light":"\uD83C\uDFFC",medium:"\uD83C\uDFFD","medium-dark":"\uD83C\uDFFE",dark:"\uD83C\uDFFF"};function OW0($,Z){if(!$.split(Nz).some((H)=>ko.test(H)))return $;let J=$.split(Nz).map((H)=>H.replace(PW0,"")).join(Nz);return Z==="none"?J:J.split(Nz).map((H,B,Q)=>{let X=Q.length>1;return!ko.test(H)||X&&H==="\uD83E\uDD1D"?H:H.replace(MW0,"")+_W0[Z]}).join(Nz)}function TW0($){return RO.map((Z)=>({skinTone:Z,emoji:OW0($,Z)}))}function ro(){let $=Y8(),Z=E8($,IO,io);return GB.useDeferredValue(Z)}function ao($="✋"){let Z=Y8(),J=w3(Z,"skinTone"),H=GB.useMemo(()=>TW0($),[$]),B=GB.useCallback((Q)=>{Z.set({skinTone:Q})},[]);return[J,B,H]}function kO($,Z){if(Object.is($,Z))return!0;if(typeof $!="object"||typeof Z!="object"||$===null||Z===null||Array.isArray($)!==Array.isArray(Z))return!1;let J=Object.keys($),H=Object.keys(Z);return J.length!==H.length?!1:J.every((B)=>(B in Z)&&$[B]===Z[B])}function jW0(...$){}function CW0($,Z){let J=null;if(typeof window.requestIdleCallback=="function")J=window.requestIdleCallback($,Z);else{let H=Date.now();J=window.setTimeout(()=>{$({didTimeout:!1,timeRemaining:()=>Math.max(0,(Z?.timeout??50)-(Date.now()-H))})},10)}return()=>{typeof window.cancelIdleCallback=="function"?window.cancelIdleCallback(J):window.clearTimeout(J)}}var I9=typeof window<"u"?Yq.useLayoutEffect:Yq.useEffect;function EW0($){let Z=Fq.useRef($);return I9(()=>{Z.current=$}),Fq.useCallback((...J)=>Z.current(...J),[])}function bW0({emojiVersion:$,emojibaseUrl:Z}){let[J,H]=H1.useState(void 0),B=Y8(),Q=w3(B,"locale"),X=w3(B,"columns"),z=w3(B,"skinTone"),G=w3(B,"search");return H1.useEffect(()=>{let U=new AbortController,Y=U.signal;return BW0({locale:Q,emojiVersion:$,emojibaseUrl:Z,signal:Y}).then((F)=>{H(F)}).catch((F)=>{Y.aborted||console.error(F)}),()=>{U.abort()}},[$,Z,Q]),H1.useEffect(()=>{if(J)return CW0(()=>{B.get().onDataChange(zW0(J,X,z,G))},{timeout:100})},[J,X,z,G]),null}var oo=H1.forwardRef(({locale:$="en",columns:Z=9,skinTone:J="none",onEmojiSelect:H=jW0,emojiVersion:B,emojibaseUrl:Q,onFocusCapture:X,onBlurCapture:z,children:G,style:U,sticky:Y=!0,...F},K)=>{let W=EW0(H),N=UW0(()=>FW0(W,So($),Z,Y,Ro(J))),[q,D]=H1.useState(!1),A=H1.useRef(null),V=H1.useCallback((M)=>{M&&(A.current=M,N.set({rootRef:A}))},[]);I9(()=>{N.set({locale:So($)})},[$]),I9(()=>{N.set({columns:Z})},[Z]),I9(()=>{N.set({sticky:Y})},[Y]),I9(()=>{N.set({skinTone:Ro(J)})},[J]);let L=H1.useCallback((M)=>{X?.(M);let{searchRef:_,viewportRef:w}=N.get(),C=M.target===_?.current||M.target.hasAttribute("frimousse-search"),E=M.target===w?.current||M.target.hasAttribute("frimousse-viewport");M.isDefaultPrevented()||(D(C||E),M.isDefaultPrevented()||(D(C||E),E?N.get().onActiveEmojiChange("keyboard",0,0):C&&N.get().search===""&&N.set({interaction:"none"})))},[X]),O=H1.useCallback((M)=>{z?.(M),!M.isDefaultPrevented()&&!M.currentTarget.contains(M.relatedTarget)&&D(!1)},[z]);return I9(()=>{q||N.get().onActiveEmojiReset()},[q]),H1.useImperativeHandle(K,()=>A.current),H1.useEffect(()=>{if(!q)return;function M(_){if(_.defaultPrevented||!_.key.startsWith("Arrow")&&_.key!=="Enter")return;let{data:w,onEmojiSelect:C,onActiveEmojiChange:E,interaction:T,activeColumnIndex:k,activeRowIndex:S}=N.get();if(_.key==="Enter"){let I=IO(N.get());I&&(_.preventDefault(),C(I))}if(_.key.startsWith("Arrow")){let I=k,j=S;if(_.preventDefault(),T!=="none"){if(w?.rows&&w.rows.length>0)switch(_.key){case"ArrowLeft":{if(I===0){let y=j-1,R=w.rows[y];R&&(j=y,I=R.emojis.length-1)}else I-=1;break}case"ArrowRight":{if(I===w.rows[j].emojis.length-1){let y=j+1;w.rows[y]&&(j=y,I=0)}else I+=1;break}case"ArrowUp":{let y=w.rows[j-1];y&&(j-=1,y.emojis[I]||(I=y.emojis.length-1));break}case"ArrowDown":{let y=w.rows[j+1];y&&(j+=1,y.emojis[I]||(I=y.emojis.length-1));break}}E("keyboard",I,j)}else E("keyboard",0,0)}}return document.addEventListener("keydown",M),()=>{document.removeEventListener("keydown",M)}},[q]),I9(()=>{let M=null,_=null,w=null,C=null,E=N.subscribe((j)=>{A.current&&(M!==j.viewportWidth&&(M=j.viewportWidth,A.current.style.setProperty("--frimousse-viewport-width",`${j.viewportWidth}px`)),_!==j.viewportHeight&&(_=j.viewportHeight,A.current.style.setProperty("--frimousse-viewport-height",`${j.viewportHeight}px`)),w!==j.rowHeight&&(w=j.rowHeight,A.current.style.setProperty("--frimousse-row-height",`${j.rowHeight}px`)),C!==j.categoryHeaderHeight&&(C=j.categoryHeaderHeight,A.current.style.setProperty("--frimousse-category-header-height",`${j.categoryHeaderHeight}px`)))}),{viewportWidth:T,viewportHeight:k,rowHeight:S,categoryHeaderHeight:I}=N.get();return T&&A.current.style.setProperty("--frimousse-viewport-width",`${T}px`),k&&A.current.style.setProperty("--frimousse-viewport-height",`${k}px`),S&&A.current.style.setProperty("--frimousse-row-height",`${S}px`),I&&A.current.style.setProperty("--frimousse-category-header-height",`${I}px`),E},[]),g1.jsx("div",{"data-focused":q?"":void 0,"frimousse-root":"",onBlurCapture:O,onFocusCapture:L,...F,ref:V,style:{"--frimousse-emoji-font":vo,...U},children:g1.jsxs(KW0,{store:N,children:[g1.jsx(bW0,{emojiVersion:B,emojibaseUrl:Q}),G]})})}),no=H1.forwardRef(({value:$,defaultValue:Z,onChange:J,...H},B)=>{let Q=Y8(),X=H1.useRef(null),z=H1.useCallback((F)=>{F&&(X.current=F,Q.set({searchRef:X}))},[]),G=typeof $=="string",U=H1.useRef(G);H1.useEffect(()=>{U.current=G},[G]),I9(()=>{Q.set({search:typeof $=="string"?$:typeof Z=="string"?Z:""})},[]),I9(()=>{typeof $=="string"&&Q.get().onSearchChange($)},[$]);let Y=H1.useCallback((F)=>{J?.(F),F.isDefaultPrevented()||Q.get().onSearchChange(F.target.value)},[J]);return H1.useImperativeHandle(B,()=>X.current),g1.jsx("input",{autoCapitalize:"off",autoComplete:"off",autoCorrect:"off",enterKeyHint:"done","frimousse-search":"",placeholder:"Search…",spellCheck:!1,type:"search",...H,defaultValue:Z,onChange:Y,ref:z,value:$})}),wW0=H1.memo(()=>{let $=ro();return $?g1.jsx("div",{"aria-live":"polite",style:{border:0,clip:"rect(0, 0, 0, 0)",height:1,margin:-1,overflow:"hidden",padding:0,position:"absolute",whiteSpace:"nowrap",width:1,wordWrap:"normal"},children:$.label}):null}),so=H1.forwardRef(({children:$,onScroll:Z,onKeyDown:J,style:H,...B},Q)=>{let X=Y8(),z=H1.useRef(null),G=H1.useCallback((K)=>{K&&(z.current=K,X.set({viewportRef:z}))},[]),U=E8(X,lo),Y=E8(X,AW0),F=H1.useCallback((K)=>{Z?.(K),X.get().onViewportScroll(K.currentTarget.scrollTop)},[Z]);return I9(()=>{if(!z.current)return;let K=new ResizeObserver(([W])=>{let N=W?.borderBoxSize[0]?.inlineSize??0,q=W?.borderBoxSize[0]?.blockSize??0,{onViewportSizeChange:D,viewportHeight:A,viewportWidth:V}=X.get();(A!==q||V!==N)&&D(N,q)});return K.observe(z.current),X.get().onViewportSizeChange(z.current.offsetWidth,z.current.clientHeight),()=>{K.disconnect()}},[]),H1.useImperativeHandle(Q,()=>z.current),g1.jsxs("div",{"frimousse-viewport":"",...B,onScroll:F,ref:G,style:{position:"relative",boxSizing:"border-box",contain:"layout paint",containIntrinsicSize:typeof U=="number"&&typeof Y=="number"?`var(--frimousse-viewport-width, auto) calc(${U} * var(--frimousse-row-height) + ${Y} * var(--frimousse-category-header-height))`:void 0,overflowY:"auto",overscrollBehavior:"contain",scrollbarGutter:"stable",willChange:"scroll-position",...H},children:[g1.jsx(wW0,{}),$]})});function to($,Z,J){return{emoji:{...$,isActive:J},role:"gridcell","aria-colindex":Z,"aria-selected":J||void 0,"aria-label":$.label,"data-active":J?"":void 0,"frimousse-emoji":"",style:{fontFamily:"var(--frimousse-emoji-font)"},tabIndex:-1}}function eo($,Z=!1){return{role:Z?void 0:"row","aria-rowindex":Z?void 0:$,"frimousse-row":"",style:{contain:Z?void 0:"content",height:Z?void 0:"var(--frimousse-row-height)",display:"flex"}}}function $n($,Z){return{"frimousse-category":"",style:{contain:"content",top:Z?`calc(${$} * var(--frimousse-category-header-height) + ${Z.startRowIndex} * var(--frimousse-row-height))`:void 0,height:Z?`calc(var(--frimousse-category-header-height) + ${Z.rowsCount} * var(--frimousse-row-height))`:void 0,width:"100%",pointerEvents:"none",position:"absolute"}}}function Zn($,Z=!1,J=!0){return{category:$,"frimousse-category-header":"",style:{contain:Z?void 0:"layout paint",height:Z?void 0:"var(--frimousse-category-header-height)",pointerEvents:"auto",position:J?"sticky":void 0,top:0}}}function yo($,Z,J,H){return{"frimousse-list-sizer":"",style:{position:"relative",boxSizing:"border-box",height:`calc(${$} * var(--frimousse-row-height) + ${Z} * var(--frimousse-category-header-height))`,paddingTop:`calc(${J} * var(--frimousse-row-height) + ${H} * var(--frimousse-category-header-height))`}}}function xo($,Z,J){return{"aria-colcount":$,"aria-rowcount":Z,"frimousse-list":"",style:{"--frimousse-list-columns":$,...J},role:"grid"}}function SW0($){$.preventDefault()}var RW0=H1.memo(({Emoji:$,emoji:Z,columnIndex:J,rowIndex:H})=>{let B=Y8(),Q=E8(B,(U)=>IO(U)?.emoji===Z.emoji),X=H1.useCallback(()=>{B.get().onEmojiSelect(Z)},[Z]),z=H1.useCallback(()=>{B.get().onActiveEmojiChange("pointer",J,H)},[J,H]),G=H1.useCallback(()=>{B.get().onActiveEmojiReset()},[]);return g1.jsx($,{...to(Z,J,Q),onClick:X,onPointerDown:SW0,onPointerEnter:z,onPointerLeave:G})}),IW0=H1.memo(({Row:$,Emoji:Z,rowIndex:J})=>{let H=Y8(),B=E8(H,(Q)=>Q.data?.rows[J],LW0);return B?g1.jsx($,{...eo(J),children:B.emojis.map((Q,X)=>g1.jsx(RW0,{Emoji:Z,columnIndex:X,emoji:Q,rowIndex:J},Q.label))}):null}),kW0=H1.memo(({CategoryHeader:$,categoryIndex:Z})=>{let J=Y8(),H=E8(J,(Q)=>Q.data?.categories[Z],kO),B=w3(J,"sticky");return H?g1.jsx("div",{...$n(Z,H),children:g1.jsx($,{...Zn({label:H.label},!1,B)})}):null}),ho=H1.memo(({CategoryHeader:$,Row:Z,Emoji:J})=>{let H=H1.useRef(null),B=Y8(),Q=w3(B,"columns"),X=H1.useMemo(()=>Array(Q).fill({emoji:"\uD83D\uDE42",label:""}),[Q]),z=H1.useMemo(()=>({label:"Category"}),[]),G=H1.useRef(null),U=H1.useRef(null);return I9(()=>{let Y=H.current?.parentElement?.parentElement;if(!Y||!G.current||!U.current)return;let F=new ResizeObserver((N)=>{for(let q of N){let D=q.contentRect.height,{onRowHeightChange:A,onCategoryHeaderHeightChange:V,rowHeight:L,categoryHeaderHeight:O}=B.get();q.target===G.current&&L!==D&&A(D),q.target===U.current&&O!==D&&V(D)}});F.observe(Y),F.observe(G.current),F.observe(U.current);let{onRowHeightChange:K,onCategoryHeaderHeightChange:W}=B.get();return K(G.current.clientHeight),W(U.current.clientHeight),()=>{F.disconnect()}},[]),g1.jsxs("div",{"aria-hidden":!0,ref:H,style:{height:0,visibility:"hidden"},children:[g1.jsx("div",{"frimousse-row-sizer":"",ref:G,children:g1.jsx(Z,{...eo(-1,!0),children:X.map((Y,F)=>g1.jsx(J,{...to(Y,F,!1)},F))})}),g1.jsx("div",{...$n(-1),children:g1.jsx("div",{"frimousse-category-header-sizer":"",ref:U,children:g1.jsx($,{...Zn(z,!0)})})})]})});function yW0({category:$,...Z}){return g1.jsx("div",{...Z,children:$.label})}function xW0({emoji:$,...Z}){return g1.jsx("button",{type:"button",...Z,children:$.emoji})}function hW0({...$}){return g1.jsx("div",{...$})}var Jn=H1.forwardRef(({style:$,components:Z,...J},H)=>{let B=Y8(),Q=H1.useRef(null),X=H1.useCallback((A)=>{A&&(Q.current=A,B.set({listRef:Q}))},[]),z=Z?.CategoryHeader??yW0,G=Z?.Emoji??xW0,U=Z?.Row??hW0,Y=w3(B,"columns"),F=w3(B,"viewportStartRowIndex"),K=w3(B,"viewportEndRowIndex"),W=E8(B,lo),N=E8(B,DW0,kO),q=H1.useMemo(()=>N?.filter((A)=>A<F).length??0,[N,F]),D=N?.length??0;return H1.useImperativeHandle(H,()=>Q.current),!W||!N||D===0?g1.jsx("div",{...xo(Y,0,$),...J,children:g1.jsx("div",{...yo(0,0,0,0),children:g1.jsx(ho,{CategoryHeader:z,Emoji:G,Row:U})})}):g1.jsx("div",{...xo(Y,W,$),...J,ref:X,children:g1.jsxs("div",{...yo(W,D,F,q),children:[g1.jsx(ho,{CategoryHeader:z,Emoji:G,Row:U}),Array.from({length:K-F+1},(A,V)=>{let L=F+V,O=N.indexOf(L);return g1.jsxs(H1.Fragment,{children:[O>=0&&g1.jsx("div",{style:{height:"var(--frimousse-category-header-height)"}}),g1.jsx(IW0,{Emoji:G,Row:U,rowIndex:L})]},L)}),Array.from({length:D},(A,V)=>g1.jsx(kW0,{CategoryHeader:z,categoryIndex:V},V))]})})}),Hn=H1.forwardRef(({emoji:$,onClick:Z,"aria-label":J="Change skin tone",...H},B)=>{let Q=Y8(),X=E8(Q,VW0,kO),[z,G,U]=ao($),Y=H1.useMemo(()=>Math.max(0,U.findIndex((D)=>D.skinTone===z)),[z,U]),F=U[Y],K=U[(Y+1)%U.length].skinTone,W=z==="none"?void 0:X?.[z],N=K==="none"?void 0:X?.[K],q=H1.useCallback((D)=>{Z?.(D),D.isDefaultPrevented()||G(K)},[Z,G,K]);return g1.jsx("button",{type:"button",...H,"aria-label":J+(N?` (${N})`:""),"aria-live":"polite","aria-valuetext":W,"frimousse-skin-tone-selector":"",onClick:q,ref:B,children:F.emoji})});function Bn({children:$,...Z}){let J=Y8();return E8(J,qW0)?g1.jsx("span",{"frimousse-loading":"",...Z,children:$}):null}function vW0({children:$}){let Z=Y8(),J=E8(Z,WW0);return $({search:J})}function Qn({children:$,...Z}){let J=Y8();return E8(J,NW0)?g1.jsx("span",{"frimousse-empty":"",...Z,children:typeof $=="function"?g1.jsx(vW0,{children:$}):$}):null}function Xn({children:$}){let Z=ro();return $({emoji:Z})}function zn({children:$,emoji:Z}){let[J,H,B]=ao(Z);return $({skinTone:J,setSkinTone:H,skinToneVariations:B})}oo.displayName="EmojiPicker.Root";no.displayName="EmojiPicker.Search";so.displayName="EmojiPicker.Viewport";Jn.displayName="EmojiPicker.List";Bn.displayName="EmojiPicker.Loading";Qn.displayName="EmojiPicker.Empty";Hn.displayName="EmojiPicker.SkinToneSelector";Xn.displayName="EmojiPicker.ActiveEmoji";zn.displayName="EmojiPicker.SkinTone";var Az={};k5(Az,{Root:()=>Wn,Indicator:()=>Nn});var k9=P(m(),1);function Gn($){if(!$)return null;for(let Z of $.elements){let J=Z.tagName;if(J==="BUTTON"||J==="INPUT"){let H=Z;if(H.type==="submit")return H}}return null}var Un="data-checked",Yn="data-unchecked";function Kq($){return{checked(Z){if($.indeterminate)return{};if(Z)return{[Un]:""};return{[Yn]:""}},...h2}}var Wq=P(m(),1),gW0=Wq.createContext(void 0);function Fn(){return Wq.useContext(gW0)}var Nq=P(m(),1),yO=Nq.createContext(void 0);function Kn(){let $=Nq.useContext(yO);if($===void 0)throw Error(I0(14));return $}var qz=P(u(),1),mW0="data-parent",Wn=k9.forwardRef(function(Z,J){let{checked:H,className:B,defaultChecked:Q=!1,"aria-labelledby":X,disabled:z=!1,form:G,id:U,indeterminate:Y=!1,inputRef:F,name:K,onCheckedChange:W,parent:N=!1,readOnly:q=!1,render:D,required:A=!1,uncheckedValue:V,value:L,nativeButton:O=!1,style:M,..._}=Z,{clearErrors:w}=A4(),{disabled:C,name:E,setDirty:T,setFilled:k,setFocused:S,setTouched:I,state:j,validationMode:y,validityData:R,validation:x}=t5(),v=pJ(),{labelId:f,registerControlId:b,getDescriptionProps:l}=e5(),r=Fn(),h=r?.allValues===void 0?void 0:r.parent,d=h!==void 0,o=C||v.disabled||r?.disabled||z,c=E??K,i=L??c,n=t0(),Z0=r?.registerControlId!==b,J0=H7({id:U||void 0,enabled:Z0}),U0=O?J0:n,z0={};if(d){if(N)z0=h.getParentProps();else if(i!==void 0)z0=h.getChildProps(i)}let{checked:X0=H,indeterminate:N0=Y,onCheckedChange:q0,...K0}=z0,s=r?.value,a=k9.useRef(null),{getButtonProps:$0,buttonRef:t}=w5({disabled:o,native:O}),B0=r?.validation??x,[_0,P0]=D4({controlled:i!==void 0&&s!==void 0&&!N?s.includes(i):X0,default:Q,name:"Checkbox",state:"checked"}),A0=d?Boolean(X0):_0,M0=d?N0||Y:Y;J7(a,n,_0,void 0,!r&&!o,K);let g=h?.registerChildId,p=k9.useRef(null),e=B0.registerInput,W0=r?i:void 0,S0=k9.useCallback((k0)=>e(k0,{controlRef:a,value:W0}),[e,W0]),h0=l2(F,p,N?void 0:S0),v0=lN(X,f,p,!O,J0);H0(()=>{if(p.current)p.current.indeterminate=M0;if(!r)k(_0)},[_0,M0,r,k]),G3(_0,()=>{if(r)return;w(c),T(_0!==R.initialValue),B0.change(_0)});let j0=K2({checked:_0,disabled:o,form:G,name:N?void 0:c,id:O?void 0:J0,required:A,ref:h0,style:c?AG:U9,tabIndex:-1,type:"checkbox","aria-hidden":!0,onChange(k0){if(k0.nativeEvent.defaultPrevented)return;if(q){k0.preventDefault();return}let R1=k0.currentTarget.checked,Y1=w0(F0.none,k0.nativeEvent);if(W?.(R1,Y1),Y1.isCanceled)return;if(q0?.(R1,Y1),Y1.isCanceled)return;if(P0(R1),i!==void 0&&r!==void 0&&!N&&!d){let U5=R1?[...r.value,i]:r.value.filter((C0)=>C0!==i);r.setValue(U5,Y1)}},onClick(k0){k0.stopPropagation()},onFocus(){a.current?.focus()}},L!==void 0?{value:(r?_0&&L:L)||""}:D1,l,(k0)=>B0.getValidationProps(o,k0));k9.useEffect(()=>{if(!h||i===void 0)return;let k0=h.disabledStatesRef.current;return k0.set(i,o),()=>{k0.delete(i)}},[h,o,i]);let c0=k9.useMemo(()=>({...j,checked:A0,disabled:o,readOnly:q,required:A,indeterminate:M0}),[j,A0,o,q,A,M0]),z1=Kq(c0),A1=G0("span",Z,{state:c0,ref:[t,a,J],props:[{id:U0,role:"checkbox","aria-checked":M0?"mixed":A0,"aria-readonly":q||void 0,"aria-required":A||void 0,"aria-labelledby":v0,[mW0]:N?"":void 0,onFocus(){if(!o)S(!0)},onBlur(){let k0=p.current;if(!k0)return;if(I(!0),S(!1),y==="onBlur")B0.commit(r?s:k0.checked)},onKeyDown(k0){if(k0.key!=="Enter")return;if(k0.preventBaseUIHandler(),k0.defaultPrevented)return;let R1=p.current?.form??null,Y1=k0.currentTarget,U5=k0.nativeEvent,C0=k0.preventDefault,p0=U5.preventDefault,r0=!1;k0.preventDefault=()=>{r0=!0,C0.call(k0)},U5.preventDefault=()=>{r0=!0,p0.call(U5)},p0.call(U5),k1(Y1).queueMicrotask(()=>{if(k0.preventDefault=C0,U5.preventDefault=p0,!r0)Gn(R1)?.click()})},onClick(k0){if(q||o)return;k0.preventDefault();let R1=p.current;if(!R1)return;ZH(R1,k0)}},_,K0,$0,l,(k0)=>B0.getValidationProps(o,k0)],stateAttributesMapping:z1}),l0=A1.props.id;return H0(()=>{if(!g||N||i===void 0||l0===void 0)return;return g(i,l0)},[g,N,i,l0]),qz.jsxs(yO.Provider,{value:c0,children:[A1,!_0&&!r&&c&&!N&&V!==void 0&&qz.jsx("input",{type:"hidden",form:G,name:c,value:V,disabled:o}),qz.jsx("input",{...j0,suppressHydrationWarning:!0})]})});var qq=P(m(),1);var Nn=qq.forwardRef(function(Z,J){let{render:H,className:B,style:Q,keepMounted:X=!1,...z}=Z,G=Kn(),U=G.checked||G.indeterminate,{mounted:Y,transitionStatus:F,setMounted:K}=k2(U),W=qq.useRef(null),N={...G,transitionStatus:F};L5({batch:!0,enabled:!U,open:U,ref:W,onComplete(){if(!U)K(!1)}});let D={...Kq(G),...Y2},A=X||Y,V=G0("span",Z,{ref:[J,W],state:N,stateAttributesMapping:D,props:z});if(!A)return null;return V});var Aq=P(u(),1);function qn({className:$,...Z}){return Aq.jsx(Az.Root,{"data-slot":"checkbox",className:d0('peer relative flex size-4 shrink-0 items-center justify-center rounded-[4px] border transition-colors outline-none after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground [:where([class~="group/field"]):has(:disabled)_&]:opacity-50 [:where([class~="group/field-label"]):has(:focus-visible)_&]:not-data-checked:border-border [:where([class~="group/field-label"]):has(:focus-visible)_&]:data-checked:border-primary [:where([class~="group/field-label"]:has(:focus-visible))_&]:ring-0',$),...Z,children:Aq.jsx(Az.Indicator,{"data-slot":"checkbox-indicator",className:"grid place-content-center text-current transition-none [&>svg]:size-3.5",children:Aq.jsx(i8,{stroke:2})})})}var CZ={};k5(CZ,{Tab:()=>Ln,Root:()=>Vn,Panel:()=>In,List:()=>vn,Indicator:()=>Sn});var U2=P(m(),1);var Dq=P(m(),1),xO=Dq.createContext(void 0);function i7(){let $=Dq.useContext(xO);if($===void 0)throw Error(I0(64));return $}var An="data-activation-direction";var S3={tabActivationDirection:($)=>({[An]:$})};var hO=P(u(),1),Vn=U2.forwardRef(function(Z,J){let{className:H,defaultValue:B=0,onValueChange:Q,orientation:X="horizontal",render:z,value:G,style:U,...Y}=Z,F=Z.defaultValue!==void 0,K=U2.useRef([]),[W,N]=U2.useState(()=>new Map),[q,D]=D4({controlled:G,default:B,name:"Tabs",state:"value"}),A=G!==void 0,[V,L]=U2.useState(()=>new Map),O=U2.useRef(void 0),M=U2.useCallback((n)=>vO(V,n),[V]),[_,w]=U2.useState(()=>({previousValue:q,tabActivationDirection:"none"})),{previousValue:C,tabActivationDirection:E}=_,T=E,k=!1;if(C!==q)T=Dn(C,q,X,V),k=C!=null&&q!=null&&M(q)==null;let S=k?C:q,I=C!==S||E!==T;H0(()=>{if(!I)return;w({previousValue:S,tabActivationDirection:T})},[S,I,T]);let j=Y0((n,Z0)=>{let J0=Dn(q,n,X,V);if(Z0.activationDirection=J0,Q?.(n,Z0),Z0.isCanceled)return;D(n)}),y=Y0((n,Z0)=>{Q?.(n,w0(Z0,void 0,void 0,{activationDirection:"none"}))}),R=Y0((n,Z0)=>{return N((J0)=>{let U0=new Map(J0);return U0.set(n,Z0),U0}),()=>{N((J0)=>{if(J0.get(n)!==Z0)return J0;let U0=new Map(J0);return U0.delete(n),U0})}}),x=U2.useCallback((n)=>{return W.get(n)},[W]),v=U2.useCallback((n)=>{for(let Z0 of V.values())if(n===Z0.value)return Z0.id;return},[V]),f=U2.useMemo(()=>({getTabElementBySelectedValue:M,getTabIdByPanelValue:v,getTabPanelIdByValue:x,onValueChange:j,orientation:X,registerMountedTabPanel:R,setTabMap:L,tabActivationDirection:T,value:q}),[M,v,x,j,X,R,L,T,q]),b=U2.useMemo(()=>{for(let n of V.values())if(n.value===q)return n;return},[V,q]),l=U2.useMemo(()=>{for(let n of V.values())if(!n.disabled)return n.value;return},[V]),r=U2.useRef(!F),h=U2.useRef(B),d=U2.useRef(F),o=U2.useRef(!1);H0(()=>{if(A)return;function n(z0,X0){D(z0),w({previousValue:z0,tabActivationDirection:"none"}),y(z0,X0),r.current=!1}if(V.size===0){if(o.current&&q!==null&&!O.current?.isConnected)n(null,F0.missing);return}o.current=!0,O.current=V.keys().next().value;let Z0=b?.disabled,J0=b==null&&q!==null;if(!Z0&&q===h.current)d.current=!1;if(d.current&&Z0&&q===h.current)return;let U0=r.current;if(Z0||J0){let z0=l??null;if(q===z0){r.current=!1;return}let X0=F0.missing;if(U0)X0=F0.initial;else if(Z0)X0=F0.disabled;n(z0,X0);return}if(U0&&b!=null)y(q,F0.initial),r.current=!1},[l,A,y,b,D,V,q]);let i=G0("div",Z,{state:{orientation:X,tabActivationDirection:T},ref:J,props:Y,stateAttributesMapping:S3});return hO.jsx(xO.Provider,{value:f,children:hO.jsx(P7,{elementsRef:K,children:i})})});function vO($,Z){for(let[J,H]of $.entries())if(Z===H.value)return J;return null}function Dn($,Z,J,H){if($==null||Z==null)return"none";let[B,Q,X]=J==="horizontal"?["left","left","right"]:["top","up","down"],z=vO(H,$),G=vO(H,Z);if(z==null||G==null){if(z!==G&&(typeof $==="number"||typeof $==="string")&&typeof $===typeof Z)return Z>$?X:Q;return"none"}let U=z.getBoundingClientRect()[B],Y=G.getBoundingClientRect()[B];if(Y<U)return Q;if(Y>U)return X;return"none"}var K6=P(m(),1);var Dz="data-composite-item-active";var Vq=P(m(),1),fO=Vq.createContext(void 0);function Lq(){let $=Vq.useContext(fO);if($===void 0)throw Error(I0(65));return $}var Ln=K6.forwardRef(function(Z,J){let{className:H,disabled:B=!1,render:Q,value:X,id:z,nativeButton:G=!0,style:U,...Y}=Z,{value:F,getTabPanelIdByValue:K,onValueChange:W,orientation:N,tabActivationDirection:q}=i7(),{activateOnFocus:D,registerTabResizeObserverElement:A,tabsListElement:V}=Lq(),{highlightedIndex:L,onHighlightedIndexChange:O}=BH(),M=t0(z),_=K6.useMemo(()=>({disabled:B,id:M,value:X}),[B,M,X]),{compositeProps:w,compositeRef:C,index:E}=BK({metadata:_}),T=X===F,k=K6.useRef(!1),S=K6.useRef(null),I=Y0((o)=>{S.current?.(),S.current=o?A(o):null});H0(()=>{if(k.current){k.current=!1;return}if(!(T&&E>-1&&L!==E))return;let o=V;if(o!=null){let c=a1(m0(o));if(c&&R0(o,c))return}if(!B)O(E)},[T,E,L,O,B,V]);let{getButtonProps:j,buttonRef:y}=w5({disabled:B,native:G,focusableWhenDisabled:!0}),R=K(X),x=K6.useRef(!1),v=K6.useRef(!1);function f(o){W(X,w0(F0.none,o.nativeEvent,void 0,{activationDirection:"none"}))}function b(o){if(T||B)return;f(o)}function l(o){if(T||B)return;if(D&&(!x.current||v.current))f(o)}function r(o){if(T||B)return;x.current=!0,v.current=o.button===0;let c=m0(o.currentTarget);function i(){x.current=!1,v.current=!1,c.removeEventListener("pointerup",i),c.removeEventListener("pointercancel",i)}c.addEventListener("pointerup",i),c.addEventListener("pointercancel",i)}return G0("button",Z,{state:{disabled:B,active:T,orientation:N,tabActivationDirection:q},ref:[J,y,C,I],props:[w,{role:"tab","aria-controls":R,"aria-selected":T,id:M,onClick:b,onFocus:l,onPointerDown:r,[Dz]:T?"":void 0,onKeyDownCapture(){k.current=!0}},Y,j],stateAttributesMapping:S3})});var UB=P(m(),1);var Mn="--active-tab-left",Pn="--active-tab-right",_n="--active-tab-top",On="--active-tab-bottom",Tn="--active-tab-width",jn="--active-tab-height";var Mq=P(u(),1),Cn,cW0={...S3,activeTabPosition:()=>null,activeTabSize:()=>null},En=2,Sn=UB.forwardRef(function(Z,J){let{className:H,render:B,renderBeforeHydration:Q=!1,style:X,...z}=Z,{getTabElementBySelectedValue:G,orientation:U,tabActivationDirection:Y,value:F}=i7(),{tabsListElement:K,registerIndicatorUpdateListener:W}=Lq(),N=hj();UB.useEffect(()=>{return W(N)},[W,N]);let q=0,D=0,A=0,V=0,L=0,O=0,M=!1;if(F!=null&&K!=null){let S=G(F);if(S!=null){M=!0;let{width:I,height:j}=GJ(S),{width:y,height:R}=GJ(K),x=S.getBoundingClientRect(),v=K.getBoundingClientRect(),f=y>0?v.width/y:1,b=R>0?v.height/R:1,l=dW0(S,K);q=l.left,A=l.top;let r=(x.left-v.left)/f+K.scrollLeft-K.clientLeft,h=(x.top-v.top)/b+K.scrollTop-K.clientTop,d=lW0(S);if(Math.abs(r-d.x-q)<=En&&Math.abs(h-d.y-A)<=En)q=r,A=h;L=I,O=j,D=K.scrollWidth-q-L,V=K.scrollHeight-A-O}}let _=M?{left:q,right:D,top:A,bottom:V}:null,w=M?{width:L,height:O}:null,C=M?{[Mn]:`${q}px`,[Pn]:`${D}px`,[_n]:`${A}px`,[On]:`${V}px`,[Tn]:`${L}px`,[jn]:`${O}px`}:void 0,E=M&&L>0&&O>0,k=G0("span",Z,{state:{orientation:U,activeTabPosition:_,activeTabSize:w,tabActivationDirection:Y},ref:J,props:[{role:"presentation",style:C,hidden:!E},z,{suppressHydrationWarning:!0}],stateAttributesMapping:cW0});if(F==null)return null;return Mq.jsxs(UB.Fragment,{children:[k,Q&&(Cn||(Cn=Mq.jsx(WW,{script:FW})))]})});function dW0($,Z){let J=bn($),H=bn(Z),B=J.left-H.left-Z.clientLeft,Q=J.top-H.top-Z.clientTop,X=v8($);while(L1(X)&&X!==Z&&!h8(X))B-=X.scrollLeft,Q-=X.scrollTop,X=v8(X);return{left:B,top:Q}}function bn($){let Z=0,J=0,H=$;while(H!=null){Z+=H.offsetLeft,J+=H.offsetTop;let B=H.offsetParent;if(B!=null)Z+=B.clientLeft,J+=B.clientTop;H=B}return{left:Z,top:J}}function lW0($){let Z=k1($).getComputedStyle($),{x:J,y:H}=PG($,Z),B=J,Q=H,{translate:X}=Z;if(X&&X!=="none"){let z=X.split(" ");B+=wn(z[0],$.offsetWidth),Q+=wn(z[1],$.offsetHeight)}return{x:B,y:Q}}function wn($,Z){if(!$)return 0;let J=parseFloat($);if(!Number.isFinite(J))return 0;return $.endsWith("%")?J/100*Z:J}var Pq=P(m(),1);var Rn="data-index";var NE1=W8.startingStyle,qE1=W8.endingStyle;var rW0={...S3,...Y2},In=Pq.forwardRef(function(Z,J){let{className:H,value:B,render:Q,keepMounted:X=!1,style:z,...G}=Z,{value:U,getTabIdByPanelValue:Y,orientation:F,tabActivationDirection:K,registerMountedTabPanel:W}=i7(),N=t0(),{ref:q,index:D}=M4(),A=B===U,{mounted:V,transitionStatus:L,setMounted:O}=k2(A),M=!V,_=Y(B),w={hidden:M,orientation:F,tabActivationDirection:K,transitionStatus:L},C=Pq.useRef(null),E=G0("div",Z,{state:w,ref:[J,q,C],props:[{"aria-labelledby":_,hidden:M,id:N,role:"tabpanel",tabIndex:A?0:-1,inert:x8(!A),[Rn]:D},G],stateAttributesMapping:rW0});if(L5({open:A,ref:C,onComplete(){if(!A)O(!1)}}),H0(()=>{if(N==null||M&&!X)return;return W(B,N)},[M,X,B,N,W]),!(X||V))return null;return E});var y9=P(m(),1);var xn=P(m(),1);var jZ=P(m(),1);function kn($){let{loopFocus:Z=!0,orientation:J="both",grid:H,onLoop:B,direction:Q,highlightedIndex:X,onHighlightedIndexChange:z,rootRef:G,enableHomeAndEndKeys:U=!1,stopEventPropagation:Y,disabledIndices:F,modifierKeys:K=Q4}=$,[W,N]=jZ.useState(0),q=H!=null,D=jZ.useRef(null),A=l2(D,G),V=jZ.useRef([]),L=jZ.useRef(!1),O=jZ.useRef(null),M=X??W,_=Y0((k,S=!1)=>{if(O.current=V.current[k]??null,(z??N)(k),S){let I=V.current[k];HV(D.current,I,Q,J)}}),w=Y0((k)=>{if(k.size===0)return;if(L.current){let y=V.current,R=y.indexOf(O.current);if(R===-1){let x=y[M];if(!x||f3(y,M,F))_(aW0(y,F));else O.current=x}else if(R!==M)_(R);return}L.current=!0;let S=Array.from(k.keys()),I=S.find((y)=>y?.hasAttribute(Dz))??null,j=I?k.get(I)?.index??-1:-1;if(j!==-1)_(j);else if(f3(S,M,F)){let y=k8(S,{disabledIndices:F});if(!E6(S,y))_(y)}HV(D.current,I,Q,J)});H0(()=>{if(F==null||X!=null||!L.current)return;let k=V.current;if(f3(k,M,F)){let S=k8(k,{disabledIndices:F});if(!E6(k,S))_(S)}},[F,X,M,V,_]);let C=Y0((k,S,I)=>{if(!B)return I;return B(k,S,I,V)}),E=Y0((k)=>{let S=k.key===_J||k.key===OJ;if(!D9.has(k.key)||!U&&S)return;if(oW0(k,K))return;if(!D.current)return;let j=Q==="rtl",y=j?MJ:PJ,R=j?PJ:MJ,x=J==="vertical"?LJ:y,v=J==="vertical"?VJ:R,f=V1(k.nativeEvent);if(f!=null&&JV(f)&&!bh(f)){let{selectionStart:o,selectionEnd:c,value:i}=f;if(o==null||k.shiftKey||o!==c)return;if(k.key!==v&&o<i.length)return;if(k.key!==x&&o>0)return}let b=M,l=N$(V,F),r=oZ(V,F);if(H!=null)b=H({disabledIndices:F,elementsRef:V,event:k,highlightedIndex:M,loopFocus:Z,maxIndex:r,minIndex:l,onLoop:C,orientation:J,rtl:j});let h=J!=="vertical"&&k.key===y||J!=="horizontal"&&k.key===LJ,d=J!=="vertical"&&k.key===R||J!=="horizontal"&&k.key===VJ;if(U){if(k.key===_J)b=l;else if(k.key===OJ)b=r}if(b===M&&(h||d))if(Z&&b===r&&h){if(b=l,B)b=B(k,M,b,V)}else if(Z&&b===l&&d){if(b=r,B)b=B(k,M,b,V)}else b=k8(V.current,{startingIndex:b,decrement:d,disabledIndices:F});if(b!==M&&!E6(V.current,b)){if(Y)k.stopPropagation();if(q||S||h||d)k.preventDefault();_(b,!0),queueMicrotask(()=>{V.current[b]?.focus()})}});return{props:{ref:A,onFocus(k){let S=D.current,I=V1(k.nativeEvent);if(!S||I==null||!JV(I))return;I.setSelectionRange(0,I.value.length)},onKeyDown:E},highlightedIndex:M,onHighlightedIndexChange:_,elementsRef:V,onMapChange:w,relayKeyboardEvent:E}}function aW0($,Z){let J=-1;for(let H=0;H<$.length;H+=1){let B=$[H];if(!B||f3($,H,Z))continue;if(B.hasAttribute(Dz))return H;if(J===-1)J=H}return Math.max(J,0)}function oW0($,Z){for(let J of sw){if(Z.includes(J))continue;if($.getModifierState(J))return!0}return!1}var gO=P(u(),1);function hn($){let{render:Z,className:J,style:H,refs:B=Q4,props:Q=Q4,state:X=D1,stateAttributesMapping:z,highlightedIndex:G,onHighlightedIndexChange:U,orientation:Y,grid:F,loopFocus:K,onLoop:W,enableHomeAndEndKeys:N,onMapChange:q,stopEventPropagation:D=!0,rootRef:A,disabledIndices:V,modifierKeys:L,highlightItemOnHover:O=!1,tag:M="div",..._}=$,w=$8(),{props:C,highlightedIndex:E,onHighlightedIndexChange:T,elementsRef:k,onMapChange:S,relayKeyboardEvent:I}=kn({grid:F,loopFocus:K,onLoop:W,orientation:Y,highlightedIndex:G,onHighlightedIndexChange:U,rootRef:A,stopEventPropagation:D,enableHomeAndEndKeys:N,direction:w,disabledIndices:V,modifierKeys:L}),j=G0(M,$,{state:X,ref:B,props:[C,...Q,_],stateAttributesMapping:z}),y=xn.useMemo(()=>({highlightedIndex:E,onHighlightedIndexChange:T,highlightItemOnHover:O,relayKeyboardEvent:I}),[E,T,O,I]);return gO.jsx(yn.Provider,{value:y,children:gO.jsx(P7,{elementsRef:k,onMapChange:(R)=>{q?.(R),S(R)},children:j})})}var mO=P(u(),1),vn=y9.forwardRef(function(Z,J){let{activateOnFocus:H=!1,className:B,loopFocus:Q=!0,render:X,style:z,...G}=Z,{orientation:U,setTabMap:Y,tabActivationDirection:F}=i7(),[K,W]=y9.useState(0),[N,q]=y9.useState(null),D=y9.useRef(new Set),A=y9.useRef(new Set),V=y9.useRef(null);H0(()=>{if(typeof ResizeObserver>"u")return;let C=new ResizeObserver(()=>{D.current.forEach((E)=>{E()})});if(V.current=C,N)C.observe(N);return A.current.forEach((E)=>{C.observe(E)}),()=>{C.disconnect(),V.current=null}},[N]);let L=Y0((C)=>{return D.current.add(C),()=>{D.current.delete(C)}}),O=Y0((C)=>{return A.current.add(C),V.current?.observe(C),()=>{A.current.delete(C),V.current?.unobserve(C)}}),M={orientation:U,tabActivationDirection:F},_={"aria-orientation":U==="vertical"?"vertical":void 0,role:"tablist"},w=y9.useMemo(()=>({activateOnFocus:H,registerIndicatorUpdateListener:L,registerTabResizeObserverElement:O,tabsListElement:N}),[H,L,O,N]);return mO.jsx(fO.Provider,{value:w,children:mO.jsx(hn,{render:X,className:B,style:z,state:M,refs:[J,q],props:[_,G],stateAttributesMapping:S3,highlightedIndex:K,enableHomeAndEndKeys:!0,loopFocus:Q,orientation:U,onHighlightedIndexChange:W,onMapChange:Y,disabledIndices:Q4})})});var Vz=P(u(),1);function fn({className:$,orientation:Z="horizontal",...J}){return Vz.jsx(CZ.Root,{"data-slot":"tabs","data-orientation":Z,orientation:Z,className:d0("group/tabs flex gap-2 data-horizontal:flex-col",$),...J})}var nW0=r6("group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-horizontal/tabs:h-8 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col data-[variant=line]:rounded-none",{variants:{variant:{default:"bg-accent",line:"gap-1 bg-transparent"}},defaultVariants:{variant:"default"}});function gn({className:$,variant:Z="default",...J}){return Vz.jsx(CZ.List,{"data-slot":"tabs-list","data-variant":Z,className:d0(nW0({variant:Z}),$),...J})}function _q({className:$,...Z}){return Vz.jsx(CZ.Tab,{"data-slot":"tabs-trigger",className:d0("relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium whitespace-nowrap text-muted-foreground transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 aria-disabled:pointer-events-none aria-disabled:opacity-50 group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4","group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent","data-active:bg-background data-active:text-foreground data-active:ring-1 data-active:ring-border","after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100",$),...Z})}function Oq({className:$,...Z}){return Vz.jsx(CZ.Panel,{"data-slot":"tabs-content",className:d0("flex-1 text-sm outline-none",$),...Z})}var mn=["\uD83D\uDE80","✨","\uD83D\uDD25","⚡","\uD83D\uDCA1","\uD83E\uDDE0","\uD83E\uDD16","\uD83E\uDE84","\uD83E\uDDEA","⚙️","\uD83D\uDEE0️","\uD83D\uDCBB","\uD83D\uDCE6","\uD83D\uDCCA","\uD83D\uDCC8","\uD83D\uDCDD","\uD83D\uDCDA","\uD83C\uDFAF","\uD83C\uDFC6","\uD83D\uDC8E","\uD83E\uDE90","\uD83C\uDF0D","\uD83E\uDDED","\uD83C\uDFA8","\uD83C\uDFAE","☕"],uO="font-[Apple_Color_Emoji,Segoe_UI_Emoji,Noto_Color_Emoji,sans-serif]";var q1=P(u(),1),sW0=32,un=4,tW0=12,an="flex pt-4 pb-2 items-center bg-background px-3 text-xs font-medium text-muted-foreground",on=i4.createContext(null);function pn($,Z){if(Z)return{...$,background:"theme"};if($.type==="emoji")return{type:"emoji",value:$.value};return{type:"glyph",value:$.value}}function eW0({category:$,className:Z,...J}){return q1.jsx("div",{...J,className:Q0(an,Z),children:$.label})}function cn({className:$,...Z}){return q1.jsx("div",{className:Q0("flex flex-wrap content-start gap-1",$),...Z})}function pO({className:$,selected:Z=!1,...J}){return q1.jsx(L0,{type:"button",variant:"ghost",size:"icon","aria-pressed":Z,className:Q0("shrink-0 data-active:bg-accent",Z&&"bg-accent",$),...J})}function $N0({children:$,className:Z,...J}){return q1.jsx("div",{...J,className:Q0("flex h-8 gap-1 px-1.5",Z),children:$})}function ZN0({emoji:$,...Z}){let J=i4.useContext(on);return q1.jsx(pO,{selected:J===$.emoji,className:uO,...Z,children:q1.jsx("span",{className:"text-xl leading-none",children:$.emoji})})}function nn(){let{layout:$,workspaceId:Z}=w1(),{icon:J}=$,H=sa(Z),[B,Q]=i4.useState(J?.type??"glyph"),[X,z]=i4.useState(!J||J.type!=="upload"&&J.background==="theme"),G=J?.type==="upload"?void 0:J,[U,Y]=i4.useState(""),[F,K]=i4.useState(13),[W,N]=i4.useState(null),[q,D]=i4.useState(!1),A=i4.useRef(null),V=(M)=>{let _=pn(M,X);H.mutate({kind:"set",icon:_})},L=(M)=>{H.mutate({kind:"upload",file:M})},O=(M)=>{if(z(M),G){let _=pn(G,M);H.mutate({kind:"set",icon:_})}};return i4.useEffect(()=>{if(!W)return;let M=(w)=>{let C=Math.max(1,Math.floor((w-tW0+un)/(sW0+un)));K((E)=>E===C?E:C)};M(W.clientWidth);let _=new ResizeObserver(([w])=>{M(w?.contentRect.width??W.clientWidth)});return _.observe(W),()=>_.disconnect()},[W]),q1.jsxs(fn,{value:B,onValueChange:(M)=>Q(M),className:"min-w-0 gap-4",children:[q1.jsxs("div",{className:"flex items-center justify-between gap-4",children:[q1.jsxs(gn,{"aria-label":"Icon source",children:[q1.jsx(_q,{value:"glyph",children:"Icon"}),q1.jsx(_q,{value:"emoji",children:"Emoji"}),q1.jsx(_q,{value:"upload",children:"Upload"})]}),J&&q1.jsxs(L0,{type:"button",variant:"ghost",onClick:()=>{z(!0),H.mutate({kind:"reset"})},className:"text-muted-foreground",children:[q1.jsx(dn,{"data-icon":"inline-start",stroke:1.5}),"Reset"]})]}),q1.jsx(Oq,{value:"emoji",className:"flex-none",children:q1.jsx(on,{value:G?.type==="emoji"?G.value:null,children:q1.jsxs(F6.Root,{onEmojiSelect:(M)=>V({type:"emoji",value:M.emoji}),emojibaseUrl:"/vendor/emojibase",columns:F,className:"isolate flex h-72 flex-col overflow-hidden rounded-xl border border-border bg-background",children:[q1.jsxs("div",{className:"flex items-center gap-1.5 p-1.5 pb-0",children:[q1.jsx(F6.Search,{placeholder:"Search emoji",onChange:(M)=>Y(M.target.value),className:"h-8 min-w-0 flex-1 appearance-none rounded-md bg-muted px-2.5 text-sm outline-none placeholder:text-muted-foreground"}),q1.jsx(F6.SkinToneSelector,{className:"size-8 shrink-0 rounded-lg text-lg hover:bg-accent"})]}),q1.jsxs(F6.Viewport,{ref:N,className:"relative scrollbar-thin flex-1 overflow-y-auto outline-none",children:[q1.jsxs(F6.Loading,{className:"absolute inset-0 flex items-center justify-center gap-2 text-xs text-muted-foreground",children:[q1.jsx(r5,{size:16,stroke:1.75,className:"animate-spin"}),"Loading emoji…"]}),U.trim()===""&&q1.jsxs("div",{className:"border-b border-dashed border-border",children:[q1.jsx("p",{className:Q0("sticky top-0",an),children:"Favorites"}),q1.jsx(cn,{className:"px-1.5 pb-1.5",children:mn.map((M)=>q1.jsx(pO,{onClick:()=>V({type:"emoji",value:M}),selected:G?.type==="emoji"&&G.value===M,className:uO,children:q1.jsx("span",{className:"text-xl leading-none",children:M})},M))})]}),q1.jsxs(F6.Empty,{className:"absolute inset-0 flex flex-col items-center justify-center gap-1 text-xs text-muted-foreground",children:[q1.jsx(ln,{size:20,stroke:1.5}),"No emoji found"]}),q1.jsx(F6.List,{className:"select-none",components:{CategoryHeader:eW0,Row:$N0,Emoji:ZN0}})]})]})})}),q1.jsx(Oq,{value:"glyph",className:"scrollbar-thin h-72 overflow-y-auto rounded-xl border border-border bg-background p-1.5",children:q1.jsx(cn,{children:Jy.map(({id:M,Icon:_})=>q1.jsx(pO,{"aria-label":M,onClick:()=>V({type:"glyph",value:M}),selected:G?.type==="glyph"&&G.value===M,className:"text-muted-foreground aria-pressed:text-accent-foreground",children:q1.jsx(_,{stroke:1.75})},M))})}),q1.jsx(Oq,{value:"upload",className:"flex-none",children:q1.jsxs("button",{type:"button",onClick:()=>A.current?.click(),onDragOver:(M)=>{M.preventDefault(),D(!0)},onDragLeave:()=>D(!1),onDrop:(M)=>{M.preventDefault(),D(!1);let _=M.dataTransfer.files?.[0];if(_)L(_)},className:Q0("flex h-72 w-full flex-col items-center justify-center gap-2 rounded-xl border border-dashed transition-colors",q?"border-primary bg-primary/5 text-primary":"border-border text-muted-foreground hover:border-muted-foreground/30 hover:text-foreground"),children:[q1.jsx(rn,{size:24,stroke:1.5}),q1.jsx("span",{className:"text-xs font-medium",children:"Click or drop an image"}),q1.jsx("span",{className:"text-[11px] text-muted-foreground/70",children:"PNG, JPG, GIF, or WebP"})]})}),B!=="upload"&&q1.jsxs("label",{htmlFor:"workspace-icon-theme-background",className:"flex w-fit cursor-pointer items-center gap-2 text-sm font-medium",children:[q1.jsx(qn,{id:"workspace-icon-theme-background",checked:X,onCheckedChange:O}),"Use theme background"]}),H.error&&q1.jsx("p",{className:"text-xs text-destructive","aria-live":"polite",children:H.error.message}),q1.jsx("input",{ref:A,type:"file",accept:"image/png,image/jpeg,image/gif,image/webp",className:"hidden",onChange:(M)=>{let _=M.target.files?.[0];if(_)L(_);M.target.value=""}})]})}var r7=P(u(),1);function sn(){let{layout:$,name:Z,provider:J,workspaceId:H}=w1(),B=Z??"Workspace",Q=na(H),[X,z]=Tq.useState(B);Tq.useEffect(()=>z(B),[B]);function G(U){let Y=U.trim();if(z(Y),Y!==B)Q.mutate(Y===""?null:Y)}return r7.jsx(wF,{name:X,icon:$.icon,workspaceType:J,workspaceTheme:$.theme,onNameChange:z,onNameCommit:G,renderIcon:(U)=>r7.jsxs(p6,{children:[r7.jsx(c6,{render:r7.jsx("button",{type:"button","aria-label":"Change workspace icon",className:"group inline-flex size-10 shrink-0 cursor-pointer items-center justify-center rounded-lg p-0 outline-none focus-visible:ring-3 focus-visible:ring-ring/50",children:U})}),r7.jsx(d6,{align:"start",sideOffset:8,className:"w-[min(32rem,calc(100vw-2rem))] gap-4 rounded-2xl p-6",children:r7.jsx(nn,{})})]})})}var Ez=P(m(),1);function o7($){let{margin:Z,containerPadding:J,containerWidth:H,cols:B}=$;return(H-Z[0]*(B-1)-J[0]*2)/B}function x9($,Z,J){if(!Number.isFinite($))return $;return Math.round(Z*$+Math.max(0,$-1)*J)}function Mz($,Z,J,H,B,Q,X){let{margin:z,containerPadding:G,rowHeight:U}=$,Y=o7($),F,K,W,N;if(X)F=Math.round(X.width),K=Math.round(X.height);else F=x9(H,Y,z[0]),K=x9(B,U,z[1]);if(Q)W=Math.round(Q.top),N=Math.round(Q.left);else if(X)W=Math.round(X.top),N=Math.round(X.left);else W=Math.round((U+z[1])*J+G[1]),N=Math.round((Y+z[0])*Z+G[0]);if(!Q&&!X){if(Number.isFinite(H)){let D=Math.round((Y+z[0])*(Z+H)+G[0])-N-F;if(D!==z[0])F+=D-z[0]}if(Number.isFinite(B)){let D=Math.round((U+z[1])*(J+B)+G[1])-W-K;if(D!==z[1])K+=D-z[1]}}return{top:W,left:N,width:F,height:K}}function en($,Z,J,H,B){let{margin:Q,containerPadding:X,cols:z,rowHeight:G,maxRows:U}=$,Y=o7($),F=Math.round((J-X[0])/(Y+Q[0])),K=Math.round((Z-X[1])/(G+Q[1]));return F=Lz(F,0,z-H),K=Lz(K,0,U-B),{x:F,y:K}}function Pz($,Z,J){let{margin:H,containerPadding:B,rowHeight:Q}=$,X=o7($),z=Math.round((J-B[0])/(X+H[0])),G=Math.round((Z-B[1])/(Q+H[1]));return{x:z,y:G}}function $s($,Z,J){let{margin:H,rowHeight:B}=$,Q=o7($),X=Math.max(1,Math.round((Z+H[0])/(Q+H[0]))),z=Math.max(1,Math.round((J+H[1])/(B+H[1])));return{w:X,h:z}}function Lz($,Z,J){return Math.max(Math.min($,J),Z)}function Cq($,Z){if($.i===Z.i)return!1;if($.x+$.w<=Z.x)return!1;if($.x>=Z.x+Z.w)return!1;if($.y+$.h<=Z.y)return!1;if($.y>=Z.y+Z.h)return!1;return!0}function n7($,Z){for(let J=0;J<$.length;J++){let H=$[J];if(H!==void 0&&Cq(H,Z))return H}return}function cO($,Z){return $.filter((J)=>Cq(J,Z))}function JN0($,Z){if(Z==="horizontal")return dO($);if(Z==="vertical")return jq($);if(Z==="wrap")return jq($);return[...$]}function jq($){return[...$].sort((Z,J)=>{if(Z.y!==J.y)return Z.y-J.y;return Z.x-J.x})}function dO($){return[...$].sort((Z,J)=>{if(Z.x!==J.x)return Z.x-J.x;return Z.y-J.y})}function _z($){let Z=0;for(let J=0;J<$.length;J++){let H=$[J];if(H!==void 0){let B=H.y+H.h;if(B>Z)Z=B}}return Z}function s7($,Z){for(let J=0;J<$.length;J++){let H=$[J];if(H!==void 0&&H.i===Z)return H}return}function Oz($){return $.filter((Z)=>Z.static===!0)}function W6($){return{i:$.i,x:$.x,y:$.y,w:$.w,h:$.h,minW:$.minW,maxW:$.maxW,minH:$.minH,maxH:$.maxH,moved:Boolean($.moved),static:Boolean($.static),isDraggable:$.isDraggable,isResizable:$.isResizable,resizeHandles:$.resizeHandles,constraints:$.constraints,isBounded:$.isBounded}}function YB($){let Z=Array($.length);for(let J=0;J<$.length;J++){let H=$[J];if(H!==void 0)Z[J]=W6(H)}return Z}function HN0($,Z){let J=Array($.length);for(let H=0;H<$.length;H++){let B=$[H];if(B!==void 0)if(Z.i===B.i)J[H]=Z;else J[H]=B}return J}function Zs($,Z,J){let H=s7($,Z);if(!H)return[[...$],null];return H=J(W6(H)),[HN0($,H),H]}function lO($,Z){let J=Oz($);for(let H=0;H<$.length;H++){let B=$[H];if(B===void 0)continue;if(B.x+B.w>Z.cols)B.x=Z.cols-B.w;if(B.x<0)B.x=0,B.w=Z.cols;if(!B.static)J.push(B);else while(n7(J,B))B.y++}return $}function a7($,Z,J,H,B,Q,X,z,G){if(Z.static&&Z.isDraggable!==!0)return[...$];if(Z.y===H&&Z.x===J)return[...$];let{x:U,y:Y}=Z;if(typeof J==="number")Z.x=J;if(typeof H==="number")Z.y=H;Z.moved=!0;let F=JN0($,X);if(X==="vertical"&&typeof H==="number"?Y>=H:X==="horizontal"&&typeof J==="number"?U>=J:!1)F=F.reverse();let W=cO(F,Z),N=W.length>0;if(N&&G)return YB($);if(N&&Q)return Z.x=U,Z.y=Y,Z.moved=!1,$;let q=[...$];for(let D=0;D<W.length;D++){let A=W[D];if(A===void 0)continue;if(A.moved)continue;if(A.static)q=tn(q,A,Z,B,X);else q=tn(q,Z,A,B,X)}return q}function tn($,Z,J,H,B,Q){let X=B==="horizontal",z=B==="vertical",G=Z.static;if(H){H=!1;let F={x:X?Math.max(Z.x-J.w,0):J.x,y:z?Math.max(Z.y-J.h,0):J.y,w:J.w,h:J.h,i:"-1"},K=n7($,F),W=K!==void 0&&K.y+K.h>Z.y,N=K!==void 0&&Z.x+Z.w>K.x;if(!K)return a7($,J,X?F.x:void 0,z?F.y:void 0,H,G,B);if(W&&z)return a7($,J,void 0,J.y+1,H,G,B);if(W&&B===null)return Z.y=J.y,J.y=J.y+J.h,[...$];if(N&&X)return a7($,Z,J.x,void 0,H,G,B)}let U=X?J.x+1:void 0,Y=z?J.y+1:void 0;if(U===void 0&&Y===void 0)return[...$];return a7($,J,U,Y,H,G,B)}function FB($,Z,J){return Math.max(Z,Math.min(J,$))}var BN0={name:"gridBounds",constrainPosition($,Z,J,{cols:H,maxRows:B}){return{x:FB(Z,0,Math.max(0,H-$.w)),y:FB(J,0,Math.max(0,B-$.h))}},constrainSize($,Z,J,H,{cols:B,maxRows:Q}){let X=H==="w"||H==="nw"||H==="sw"?$.x+$.w:B-$.x,z=H==="n"||H==="nw"||H==="ne"?$.y+$.h:Q-$.y;return{w:FB(Z,1,Math.max(1,X)),h:FB(J,1,Math.max(1,z))}}},QN0={name:"minMaxSize",constrainSize($,Z,J){return{w:FB(Z,$.minW??1,$.maxW??1/0),h:FB(J,$.minH??1,$.maxH??1/0)}}};var iO=[BN0,QN0];function Tz($,Z,J,H,B){let Q={x:J,y:H};for(let X of $)if(X.constrainPosition)Q=X.constrainPosition(Z,Q.x,Q.y,B);if(Z.constraints){for(let X of Z.constraints)if(X.constrainPosition)Q=X.constrainPosition(Z,Q.x,Q.y,B)}return Q}function Js($,Z,J,H,B,Q){let X={w:J,h:H};for(let z of $)if(z.constrainSize)X=z.constrainSize(Z,X.w,X.h,B,Q);if(Z.constraints){for(let z of Z.constraints)if(z.constrainSize)X=z.constrainSize(Z,X.w,X.h,B,Q)}return X}function bq({top:$,left:Z,width:J,height:H}){let B=`translate(${Z}px,${$}px)`;return{transform:B,WebkitTransform:B,MozTransform:B,msTransform:B,OTransform:B,width:`${J}px`,height:`${H}px`,position:"absolute"}}function rO({top:$,left:Z,width:J,height:H}){return{top:`${$}px`,left:`${Z}px`,width:`${J}px`,height:`${H}px`,position:"absolute"}}function aO($){return $*100+"%"}function XN0($,Z,J,H){return $+J>H?Z:J}function Hs($,Z,J){return $<0?Z:J}function zN0($){return Math.max(0,$)}function Eq($){return Math.max(0,$)}var oO=($,Z,J)=>{let{left:H,height:B,width:Q}=Z,X=$.top-(B-$.height);return{left:H,width:Q,height:Hs(X,$.height,B),top:Eq(X)}},nO=($,Z,J)=>{let{top:H,left:B,height:Q,width:X}=Z;return{top:H,height:Q,width:XN0($.left,$.width,X,J),left:zN0(B)}},sO=($,Z,J)=>{let{top:H,height:B,width:Q}=Z,X=$.left+$.width-Q;if(X<0)return{height:B,width:$.left+$.width,top:Eq(H),left:0};return{height:B,width:Q,top:Eq(H),left:X}},tO=($,Z,J)=>{let{top:H,left:B,height:Q,width:X}=Z;return{width:X,left:B,height:Hs(H,$.height,Q),top:Eq(H)}},GN0=($,Z,J)=>oO($,nO($,Z,J)),UN0=($,Z,J)=>oO($,sO($,Z)),YN0=($,Z,J)=>tO($,nO($,Z,J)),FN0=($,Z,J)=>tO($,sO($,Z)),KN0={n:oO,ne:GN0,e:nO,se:YN0,s:tO,sw:FN0,w:sO,nw:UN0};function Bs($,Z,J,H){let B=KN0[$];if(!B)return J;return B(Z,{...Z,...J},H)}var WN0={type:"transform",scale:1,calcStyle($){return bq($)}};var Qs=WN0,Xs={cols:12,rowHeight:150,margin:[10,10],containerPadding:null,maxRows:1/0},zs={enabled:!0,bounded:!1,threshold:3},Gs={enabled:!0,handles:["se"]},Us={enabled:!1,defaultItem:{w:1,h:1}};function eO($,Z,J,H,B){let Q=H==="x"?"w":"h";Z[H]+=1;let X=$.findIndex((G)=>G.i===Z.i),z=B??Oz($).length>0;for(let G=X+1;G<$.length;G++){let U=$[G];if(U===void 0)continue;if(U.static)continue;if(!z&&U.y>Z.y+Z.h)break;if(Cq(Z,U))eO($,U,J+Z[Q],H,z)}Z[H]=J}function NN0($,Z,J,H){Z.x=Math.max(Z.x,0),Z.y=Math.max(Z.y,0),Z.y=Math.min(H,Z.y);while(Z.y>0&&!n7($,Z))Z.y--;let B;while((B=n7($,Z))!==void 0)eO(J,Z,B.y+B.h,"y");return Z.y=Math.max(Z.y,0),Z}function qN0($,Z,J,H){Z.x=Math.max(Z.x,0),Z.y=Math.max(Z.y,0);while(Z.x>0&&!n7($,Z))Z.x--;let B;while((B=n7($,Z))!==void 0)if(eO(H,Z,B.x+B.w,"x"),Z.x+Z.w>J){Z.x=J-Z.w,Z.y++;while(Z.x>0&&!n7($,Z))Z.x--}return Z.x=Math.max(Z.x,0),Z}var jz={type:"vertical",allowOverlap:!1,compact($,Z){let J=Oz($),H=_z(J),B=jq($),Q=Array($.length);for(let X=0;X<B.length;X++){let z=B[X];if(z===void 0)continue;let G=W6(z);if(!G.static)G=NN0(J,G,B,H),H=Math.max(H,G.y+G.h),J.push(G);let U=$.indexOf(z);Q[U]=G,G.moved=!1}return Q}},$T={type:"horizontal",allowOverlap:!1,compact($,Z){let J=Oz($),H=dO($),B=Array($.length);for(let Q=0;Q<H.length;Q++){let X=H[Q];if(X===void 0)continue;let z=W6(X);if(!z.static)z=qN0(J,z,Z,H),J.push(z);let G=$.indexOf(X);B[G]=z,z.moved=!1}return B}},ZT={type:null,allowOverlap:!1,compact($,Z){return YB($)}},AN0={...jz,allowOverlap:!0,compact($,Z){return YB($)}},DN0={...$T,allowOverlap:!0,compact($,Z){return YB($)}},VN0={...ZT,allowOverlap:!0};function JT($,Z=!1,J=!1){let H;if(Z)if($==="vertical")H=AN0;else if($==="horizontal")H=DN0;else H=VN0;else if($==="vertical")H=jz;else if($==="horizontal")H=$T;else H=ZT;if(J)return{...H,preventCollision:J};return H}var h9=P(m(),1);function LN0($){let Z=typeof globalThis.getComputedStyle==="function"?globalThis.getComputedStyle($):null;if(!Z)return $.clientWidth;let J=(B)=>{let Q=Number.parseFloat(B);return Number.isFinite(Q)?Q:0},H=Number.parseFloat(Z.width);if(Number.isFinite(H))return Math.max(0,H);return Math.max(0,$.clientWidth-J(Z.paddingLeft)-J(Z.paddingRight))}function HT($={}){let{measureBeforeMount:Z=!1,initialWidth:J=1280}=$,[H,B]=h9.useState(J),[Q,X]=h9.useState(!Z),z=h9.useRef(null),G=h9.useRef(null),U=h9.useCallback(()=>{let Y=z.current;if(Y){let F=Math.round(LN0(Y));if(B((K)=>K===F?K:F),!Q)X(!0)}},[Q]);return h9.useEffect(()=>{let Y=z.current;if(!Y)return;if(U(),typeof ResizeObserver<"u"){let F=null;return G.current=new ResizeObserver((K)=>{let W=K[0];if(W){let N=Math.round(W.contentRect.width);if(F!==null)cancelAnimationFrame(F);F=requestAnimationFrame(()=>{B((q)=>q===N?q:N),F=null})}}),G.current.observe(Y),()=>{if(F!==null)cancelAnimationFrame(F);if(G.current)G.current.disconnect(),G.current=null}}return()=>{if(G.current)G.current.disconnect(),G.current=null}},[U]),{width:H,mounted:Q,containerRef:z,measureWidth:U}}var g0=P(m(),1),Ns=P(yN(),1),qs=P(MO(),1);var q6=P(u(),1),EZ=P(Fs(),1);function BT($){let{children:Z,cols:J,containerWidth:H,margin:B,containerPadding:Q,rowHeight:X,maxRows:z,isDraggable:G,isResizable:U,isBounded:Y,static:F,useCSSTransforms:K=!0,usePercentages:W=!1,transformScale:N=1,positionStrategy:q,dragThreshold:D=0,droppingPosition:A,className:V="",style:L,handle:O="",cancel:M="",x:_,y:w,w:C,h:E,minW:T=1,maxW:k=1/0,minH:S=1,maxH:I=1/0,i:j,resizeHandles:y,resizeHandle:R,constraints:x=iO,layoutItem:v,layout:f=[],onDragStart:b,onDrag:l,onDragStop:r,onResizeStart:h,onResize:d,onResizeStop:o}=$,[c,i]=g0.useState(!1),[n,Z0]=g0.useState(!1),J0=g0.useRef(null),U0=g0.useRef({left:0,top:0}),z0=g0.useRef({top:0,left:0,width:0,height:0}),X0=g0.useRef(void 0),N0=g0.useRef(f);N0.current=f;let q0=g0.useRef(null),K0=g0.useRef(null),s=g0.useRef(!1),a=g0.useRef({x:0,y:0}),$0=g0.useRef(!1),t=g0.useMemo(()=>({cols:J,containerPadding:Q,containerWidth:H,margin:B,maxRows:z,rowHeight:X}),[J,Q,H,B,z,X]),B0=g0.useMemo(()=>({cols:J,maxRows:z,containerWidth:H,containerHeight:0,rowHeight:X,margin:B,layout:[]}),[J,z,H,X,B]),_0=g0.useCallback(()=>({...B0,layout:N0.current}),[B0]),P0=g0.useMemo(()=>v??{i:j,x:_,y:w,w:C,h:E,minW:T,maxW:k,minH:S,maxH:I},[v,j,_,w,C,E,T,k,S,I]),A0=g0.useCallback((C0)=>{if(q?.calcStyle)return q.calcStyle(C0);if(K)return bq(C0);let p0=rO(C0);if(W)return{...p0,left:aO(C0.left/H),width:aO(C0.width/H)};return p0},[q,K,W,H]),M0=g0.useCallback((C0,{node:p0})=>{if(!b)return;let{offsetParent:r0}=p0;if(!r0)return;let n0=r0.getBoundingClientRect(),D0=p0.getBoundingClientRect(),y0=D0.left/N,K1=n0.left/N,I1=D0.top/N,f0=n0.top/N,e0;if(q?.calcDragPosition){let $1=C0;e0=q.calcDragPosition($1.clientX,$1.clientY,$1.clientX-D0.left,$1.clientY-D0.top)}else e0={left:y0-K1+r0.scrollLeft,top:I1-f0+r0.scrollTop};if(U0.current=e0,D>0){let $1=C0;a.current={x:$1.clientX,y:$1.clientY},s.current=!0,$0.current=!1,i(!0);return}i(!0);let O1=Pz(t,e0.top,e0.left),{x:j1,y:x0}=Tz(x,P0,O1.x,O1.y,_0());b(j,j1,x0,{e:C0,node:p0,newPosition:e0})},[b,N,t,q,D,x,P0,_0,j]),g=g0.useCallback((C0,{node:p0,deltaX:r0,deltaY:n0})=>{if(!l||!c)return;let D0=C0;if(s.current&&!$0.current){let j1=D0.clientX-a.current.x,x0=D0.clientY-a.current.y;if(Math.hypot(j1,x0)<D)return;if($0.current=!0,s.current=!1,b){let i0=Pz(t,U0.current.top,U0.current.left),{x:P1,y:p1}=Tz(x,P0,i0.x,i0.y,_0());b(j,P1,p1,{e:C0,node:p0,newPosition:U0.current})}}let y0=U0.current.top+n0,K1=U0.current.left+r0;if(Y){let{offsetParent:j1}=p0;if(j1){let x0=j1.clientHeight-x9(E,X,B[1]);y0=Lz(y0,0,x0);let $1=o7(t),i0=H-x9(C,$1,B[0]);K1=Lz(K1,0,i0)}}let I1={top:y0,left:K1};U0.current=I1;let f0=Pz(t,y0,K1),{x:e0,y:O1}=Tz(x,P0,f0.x,f0.y,_0());l(j,e0,O1,{e:C0,node:p0,newPosition:I1})},[l,b,c,D,Y,E,X,B,t,H,C,j,x,P0,_0]),p=g0.useCallback((C0,{node:p0})=>{if(!r||!c)return;let r0=s.current;if(s.current=!1,$0.current=!1,a.current={x:0,y:0},r0){i(!1),U0.current={left:0,top:0};return}let{left:n0,top:D0}=U0.current,y0={top:D0,left:n0};i(!1),U0.current={left:0,top:0};let K1=Pz(t,D0,n0),{x:I1,y:f0}=Tz(x,P0,K1.x,K1.y,_0());r(j,I1,f0,{e:C0,node:p0,newPosition:y0})},[r,c,t,x,P0,_0,j]);q0.current=M0,K0.current=g;let e=g0.useCallback((C0,{node:p0,size:r0,handle:n0},D0,y0)=>{let K1=y0==="onResizeStart"?h:y0==="onResize"?d:o;if(!K1)return;let I1;if(p0)I1=Bs(n0,D0,r0,H);else I1={...r0,top:D0.top,left:D0.left};z0.current=I1;let f0=$s(t,I1.width,I1.height),{w:e0,h:O1}=Js(x,P0,f0.w,f0.h,n0,_0());K1(j,e0,O1,{e:C0.nativeEvent??C0,node:p0,size:I1,handle:n0})},[h,d,o,H,t,j,x,P0,_0]),W0=g0.useCallback((C0,p0)=>{Z0(!0);let r0=Mz(t,_,w,C,E),n0={...p0,handle:p0.handle};e(C0,n0,r0,"onResizeStart")},[e,t,_,w,C,E]),S0=g0.useCallback((C0,p0)=>{let r0=Mz(t,_,w,C,E),n0={...p0,handle:p0.handle};e(C0,n0,r0,"onResize")},[e,t,_,w,C,E]),h0=g0.useCallback((C0,p0)=>{Z0(!1),z0.current={top:0,left:0,width:0,height:0};let r0=Mz(t,_,w,C,E),n0={...p0,handle:p0.handle};e(C0,n0,r0,"onResizeStop")},[e,t,_,w,C,E]);g0.useEffect(()=>{if(!A)return;let C0=J0.current;if(!C0)return;let p0=X0.current||{left:0,top:0},r0=c&&(A.left!==p0.left||A.top!==p0.top);if(!c){let n0={node:C0,deltaX:A.left,deltaY:A.top,lastX:0,lastY:0,x:A.left,y:A.top};q0.current?.(A.e,n0)}else if(r0){let n0=A.left-U0.current.left,D0=A.top-U0.current.top,y0={node:C0,deltaX:n0,deltaY:D0,lastX:U0.current.left,lastY:U0.current.top,x:A.left,y:A.top};K0.current?.(A.e,y0)}X0.current=A},[A,c,j]);let v0=Mz(t,_,w,C,E,c?U0.current:null,n?z0.current:null),j0=g0.default.Children.only(Z),c0=o7(t),z1=[x9(T,c0,B[0]),x9(S,X,B[1])],A1=[x9(k,c0,B[0]),x9(I,X,B[1])],l0=j0.props,k0=l0.className,R1=l0.style,Y1=g0.default.cloneElement(j0,{ref:J0,className:QT("react-grid-item",k0,V,{static:F,resizing:n,"react-draggable":G,"react-draggable-dragging":c,dropping:Boolean(A),cssTransforms:K}),style:{...L,...R1,...A0(v0)}}),U5=R;return Y1=q6.jsx(qs.Resizable,{draggableOpts:{disabled:!U},className:U?void 0:"react-resizable-hide",width:v0.width,height:v0.height,minConstraints:z1,maxConstraints:A1,onResizeStart:W0,onResize:S0,onResizeStop:h0,transformScale:N,resizeHandles:y,handle:U5,children:Y1}),Y1=q6.jsx(Ns.DraggableCore,{disabled:!G,onStart:M0,onDrag:g,onStop:p,handle:O,cancel:".react-resizable-handle"+(M?","+M:""),scale:N,nodeRef:J0,children:Y1}),Y1}var N6=()=>{},Ks="react-grid-layout",As=!1;try{As=/firefox/i.test(navigator.userAgent)}catch{}function ON0($,Z){let J=g0.default.Children.toArray($),H=g0.default.Children.toArray(Z);if(J.length!==H.length)return!1;for(let B=0;B<J.length;B++){let Q=J[B],X=H[B];if(Q?.key!==X?.key)return!1}return!0}function Ws($,Z,J,H){let B=[],Q=new Set;g0.default.Children.forEach(Z,(z)=>{if(!g0.default.isValidElement(z)||z.key===null)return;let G=String(z.key);Q.add(G);let U=$.find((Y)=>Y.i===G);if(U)B.push(W6(U));else{let F=z.props["data-grid"];if(F)B.push({i:G,x:F.x??0,y:F.y??0,w:F.w??1,h:F.h??1,minW:F.minW,maxW:F.maxW,minH:F.minH,maxH:F.maxH,static:F.static,isDraggable:F.isDraggable,isResizable:F.isResizable,resizeHandles:F.resizeHandles,isBounded:F.isBounded});else B.push({i:G,x:0,y:_z(B),w:1,h:1})}});let X=lO(B,{cols:J});return H.compact(X,J)}function Cz($){let{children:Z,width:J,gridConfig:H,dragConfig:B,resizeConfig:Q,dropConfig:X,positionStrategy:z=Qs,compactor:G,constraints:U=iO,layout:Y=[],droppingItem:F,autoSize:K=!0,className:W="",style:N={},innerRef:q,onLayoutChange:D=N6,onDragStart:A=N6,onDrag:V=N6,onDragStop:L=N6,onResizeStart:O=N6,onResize:M=N6,onResizeStop:_=N6,onDrop:w=N6,onDropDragOver:C=N6}=$,E=g0.useMemo(()=>({...Xs,...H}),[H]),T=g0.useMemo(()=>({...zs,...B}),[B]),k=g0.useMemo(()=>({...Gs,...Q}),[Q]),S=g0.useMemo(()=>({...Us,...X}),[X]),{cols:I,rowHeight:j,maxRows:y,margin:R,containerPadding:x}=E,{enabled:v,bounded:f,handle:b,cancel:l,threshold:r}=T,{enabled:h,handles:d,handleComponent:o}=k,{enabled:c,defaultItem:i,onDragOver:n}=S,Z0=G??JT("vertical"),J0=Z0.type,U0=Z0.allowOverlap,z0=Z0.preventCollision??!1,X0=g0.useMemo(()=>F??{i:"__dropping-elem__",...i},[F,i]),N0=z.type==="transform",q0=z.scale,K0=x??R,[s,a]=g0.useState(!1),[$0,t]=g0.useState(()=>Ws(Y,Z,I,Z0)),[B0,_0]=g0.useState(null),[P0,A0]=g0.useState(!1),[M0,g]=g0.useState(null),[p,e]=g0.useState(),W0=g0.useRef(null),S0=g0.useRef(null),h0=g0.useRef(null),v0=g0.useRef(0),j0=g0.useRef($0),c0=g0.useRef(Y),z1=g0.useRef(Z),A1=g0.useRef(J0),l0=g0.useRef($0);l0.current=$0,g0.useEffect(()=>{if(a(!0),!EZ.deepEqual($0,Y))D($0)},[]),g0.useEffect(()=>{if(B0)return;if(M0)return;let x0=!EZ.deepEqual(Y,c0.current),$1=!ON0(Z,z1.current),i0=J0!==A1.current;if(x0||$1||i0){let p1=Ws(x0?Y:$0,Z,I,Z0);if(!EZ.deepEqual(p1,$0))t(p1)}c0.current=Y,z1.current=Z,A1.current=J0},[Y,Z,I,J0,Z0,B0,M0,$0]),g0.useEffect(()=>{if(!B0&&!EZ.deepEqual($0,j0.current)){j0.current=$0;let x0=$0.filter(($1)=>$1.i!==X0.i);D(x0)}},[$0,B0,D,X0.i]);let k0=g0.useMemo(()=>{if(!K)return;let x0=_z($0),$1=K0[1];return x0*j+(x0-1)*R[1]+$1*2+"px"},[K,$0,j,R,K0]),R1=g0.useCallback((x0,$1,i0,P1)=>{let p1=l0.current,i1=s7(p1,x0);if(!i1)return;let u5={w:i1.w,h:i1.h,x:i1.x,y:i1.y,i:x0};W0.current=W6(i1),h0.current=p1,_0(u5),A(p1,i1,i1,null,P1.e,P1.node)},[A]),Y1=g0.useCallback((x0,$1,i0,P1)=>{let p1=l0.current,i1=W0.current,u5=s7(p1,x0);if(!u5)return;let b2={w:u5.w,h:u5.h,x:u5.x,y:u5.y,i:x0},p5=a7(p1,u5,$1,i0,!0,z0,J0,I,U0);V(p5,i1,u5,b2,P1.e,P1.node),t(Z0.compact(p5,I)),_0(b2)},[z0,J0,I,U0,Z0,V]),U5=g0.useCallback((x0,$1,i0,P1)=>{if(!B0)return;let p1=l0.current,i1=W0.current,u5=s7(p1,x0);if(!u5)return;let b2=a7(p1,u5,$1,i0,!0,z0,J0,I,U0),p5=Z0.compact(b2,I);L(p5,i1,u5,null,P1.e,P1.node);let B4=h0.current;if(W0.current=null,h0.current=null,_0(null),t(p5),B4&&!EZ.deepEqual(B4,p5))D(p5)},[B0,z0,J0,I,U0,Z0,L,D]),C0=g0.useCallback((x0,$1,i0,P1)=>{let p1=l0.current,i1=s7(p1,x0);if(!i1)return;S0.current=W6(i1),h0.current=p1,A0(!0),O(p1,i1,i1,null,P1.e,P1.node)},[O]),p0=g0.useCallback((x0,$1,i0,P1)=>{let p1=l0.current,i1=S0.current,{handle:u5}=P1,b2=!1,p5,B4,[kz,y3]=Zs(p1,x0,(d5)=>{if(p5=d5.x,B4=d5.y,["sw","w","nw","n","ne"].includes(u5)){if(["sw","nw","w"].includes(u5))p5=d5.x+(d5.w-$1),$1=d5.x!==p5&&p5<0?d5.w:$1,p5=p5<0?0:p5;if(["ne","n","nw"].includes(u5))B4=d5.y+(d5.h-i0),i0=d5.y!==B4&&B4<0?d5.h:i0,B4=B4<0?0:B4;b2=!0}if(z0&&!U0){if(cO(p1,{...d5,w:$1,h:i0,x:p5??d5.x,y:B4??d5.y}).filter((xz)=>xz.i!==d5.i).length>0)B4=d5.y,i0=d5.h,p5=d5.x,$1=d5.w,b2=!1}return d5.w=$1,d5.h=i0,d5});if(!y3)return;let PB=kz;if(b2&&p5!==void 0&&B4!==void 0)PB=a7(kz,y3,p5,B4,!0,z0,J0,I,U0);let yz={w:y3.w,h:y3.h,x:y3.x,y:y3.y,i:x0,static:!0};M(PB,i1,y3,yz,P1.e,P1.node),t(Z0.compact(PB,I)),_0(yz)},[z0,J0,I,U0,Z0,M]),r0=g0.useCallback((x0,$1,i0,P1)=>{let p1=l0.current,i1=S0.current,u5=s7(p1,x0),b2=Z0.compact(p1,I);_(b2,i1,u5??null,null,P1.e,P1.node);let p5=h0.current;if(S0.current=null,h0.current=null,_0(null),A0(!1),t(b2),p5&&!EZ.deepEqual(p5,b2))D(b2)},[I,Z0,_,D]),n0=g0.useCallback(()=>{let x0=l0.current;if(!x0.some((P1)=>P1.i===X0.i)){g(null),_0(null),e(void 0);return}let i0=Z0.compact(x0.filter((P1)=>P1.i!==X0.i),I);t(i0),g(null),_0(null),e(void 0)},[X0.i,I,Z0]),D0=g0.useCallback((x0)=>{if(x0.preventDefault(),x0.stopPropagation(),As&&!x0.nativeEvent.target?.classList.contains(Ks))return!1;let $1=n?n(x0.nativeEvent):C(x0);if($1===!1){if(M0)n0();return!1}let{dragOffsetX:i0=0,dragOffsetY:P1=0,...p1}=$1??{},i1={...X0,...p1},u5=x0.currentTarget.getBoundingClientRect(),b2={cols:I,margin:R,maxRows:y,rowHeight:j,containerWidth:J,containerPadding:K0},p5=o7(b2),B4=x9(i1.w,p5,R[0]),kz=x9(i1.h,j,R[1]),y3=B4/2,PB=kz/2,yz=x0.clientX-u5.left+i0-y3,d5=x0.clientY-u5.top+P1-PB,tq=Math.max(0,yz),xz=Math.max(0,d5),hz={left:tq/q0,top:xz/q0,e:x0.nativeEvent};if(!M0){let eq=en(b2,xz,tq,i1.w,i1.h);g(q6.jsx("div",{},i1.i)),e(hz);let Ee=l0.current.filter((be)=>be.i!==i1.i);t([...Ee,{...i1,x:eq.x,y:eq.y,static:!1,isDraggable:!0}])}else if(p){if(p.left!==hz.left||p.top!==hz.top)e(hz)}},[M0,p,X0,n,C,n0,q0,I,R,y,j,J,K0]),y0=g0.useCallback((x0)=>{if(x0.preventDefault(),x0.stopPropagation(),v0.current--,v0.current<0)v0.current=0;if(v0.current===0)n0()},[n0]),K1=g0.useCallback((x0)=>{x0.preventDefault(),x0.stopPropagation(),v0.current++},[]),I1=g0.useCallback((x0)=>{x0.preventDefault(),x0.stopPropagation();let $1=l0.current,i0=$1.find((P1)=>P1.i===X0.i);v0.current=0,n0(),w($1,i0,x0.nativeEvent)},[X0.i,n0,w]),f0=g0.useCallback((x0,$1)=>{if(!x0||!x0.key)return null;let i0=s7($0,String(x0.key));if(!i0)return null;let P1=typeof i0.isDraggable==="boolean"?i0.isDraggable:!i0.static&&v,p1=typeof i0.isResizable==="boolean"?i0.isResizable:!i0.static&&h,i1=i0.resizeHandles||[...d],u5=P1&&f&&i0.isBounded!==!1,b2=o;return q6.jsx(BT,{containerWidth:J,cols:I,margin:R,containerPadding:K0,maxRows:y,rowHeight:j,cancel:l,handle:b,onDragStart:R1,onDrag:Y1,onDragStop:U5,onResizeStart:C0,onResize:p0,onResizeStop:r0,isDraggable:P1,isResizable:p1,isBounded:u5,useCSSTransforms:N0&&s,usePercentages:!s,transformScale:q0,positionStrategy:z,dragThreshold:r,w:i0.w,h:i0.h,x:i0.x,y:i0.y,i:i0.i,minH:i0.minH,minW:i0.minW,maxH:i0.maxH,maxW:i0.maxW,static:i0.static,droppingPosition:$1?p:void 0,resizeHandles:i1,resizeHandle:b2,constraints:U,layoutItem:i0,layout:$0,children:x0},i0.i)},[$0,J,I,R,K0,y,j,l,b,R1,Y1,U5,C0,p0,r0,v,h,f,N0,s,q0,z,r,p,d,o,U]),e0=()=>{if(!B0)return null;return q6.jsx(BT,{w:B0.w,h:B0.h,x:B0.x,y:B0.y,i:B0.i,className:`react-grid-placeholder ${P0?"placeholder-resizing":""}`,containerWidth:J,cols:I,margin:R,containerPadding:K0,maxRows:y,rowHeight:j,isDraggable:!1,isResizable:!1,isBounded:!1,useCSSTransforms:N0,transformScale:q0,constraints:U,layout:$0,children:q6.jsx("div",{})})},O1=QT(Ks,W),j1={height:k0,...N};return q6.jsxs("div",{ref:q,className:O1,style:j1,onDrop:c?I1:void 0,onDragLeave:c?y0:void 0,onDragEnter:c?K1:void 0,onDragOver:c?D0:void 0,children:[g0.default.Children.map(Z,(x0)=>{if(!g0.default.isValidElement(x0))return null;return f0(x0)}),c&&M0&&f0(M0,!0),e0()]})}var w8=P(u(),1),XT="moi:empty-state",Ds={type:"spring",duration:0.35,bounce:0};function jN0({items:$,customizing:Z,emptyState:J,renderItem:H,onMove:B,onRemove:Q}){let[X,z]=Ez.useState(()=>Kz($)),[G,U]=Ez.useState($),{width:Y,containerRef:F,mounted:K}=HT({measureBeforeMount:!0});if(G!==$)U($),z((q)=>{let D=new Map(q.map((L)=>[L.i,L])),A=$.filter((L)=>D.has(L.id)).map((L)=>({...D.get(L.id),w:L.w,h:L.h})),V=new Set(A.map((L)=>L.i));return[...A,...Kz($.filter((L)=>!V.has(L.id)),A)]});let W=J?[...X,{i:XT,x:0,y:X.reduce((q,D)=>Math.max(q,D.y+D.h),0),w:4,h:2,static:!0}]:X,N=Ez.useCallback((q)=>{let D=q.filter((A)=>A.i!==XT);z(D),B?.(D.map((A)=>({id:A.i,x:A.x,y:A.y})))},[B]);return w8.jsx("div",{ref:F,className:"w-full",children:K&&w8.jsxs(Cz,{width:Y,layout:W,gridConfig:{cols:4,rowHeight:160,margin:[8,8],containerPadding:[0,0]},dragConfig:{enabled:!!Z},resizeConfig:{enabled:!1},compactor:jz,onLayoutChange:N,children:[X.map((q)=>w8.jsx("div",{children:w8.jsx(K5.div,{layoutId:q.i,"data-applet-thumbnail":b7("widgets",q.i),className:"size-full",transition:Ds,children:w8.jsx(Gq,{customizing:Z,widgetId:q.i,onRemove:Q?()=>Q(q.i):void 0,children:H(q.i)})})},q.i)),J&&w8.jsx("div",{children:w8.jsx(K5.div,{layout:!0,className:"size-full",transition:Ds,children:J})},XT)]})})}function Vs({items:$,customizing:Z,header:J,emptyState:H,bottomInset:B=0,renderItem:Q,onMove:X,onRemove:z}){return w8.jsxs("div",{className:"size-full overflow-y-auto p-4",children:[w8.jsx("div",{className:"mx-auto h-32 w-full max-w-(--column-w)",children:J}),w8.jsx(K5.div,{className:"mx-auto flex min-h-0 w-full max-w-(--column-w) flex-col gap-2",animate:{marginBottom:B},transition:{type:"spring",duration:0.3,bounce:0},children:($.length>0||H)&&w8.jsx(jN0,{items:$,customizing:Z,emptyState:H,renderItem:Q,onMove:X,onRemove:z})})]})}var n1=P(u(),1);function CN0({onCreateWidget:$,showOnboarding:Z}){return n1.jsxs("div",{className:"relative grid size-full grid-cols-4 grid-rows-2 gap-2 overflow-hidden",children:[n1.jsx("div",{className:"col-span-2 overflow-hidden rounded-2xl bg-muted texture-checker squircle",children:n1.jsx("div",{className:"flex size-full items-start justify-start bg-radial-[at_top_left] from-muted from-40% to-transparent p-12",children:n1.jsx("h2",{className:"text-2xl font-semibold text-foreground",children:"Widgets"})})}),n1.jsx("div",{className:"col-span-2 overflow-hidden rounded-2xl bg-muted texture-checker squircle"}),n1.jsx("div",{className:"col-span-2 overflow-hidden rounded-2xl bg-muted texture-checker squircle"}),n1.jsx("div",{className:"col-span-2 overflow-hidden rounded-2xl bg-muted texture-checker squircle",children:Z&&n1.jsx("div",{className:"flex size-full items-end justify-end",children:n1.jsx("span",{className:"m-8 max-w-56 text-right text-sm text-muted-foreground",children:"Widgets can surface information, read data, and perform actions"})})}),n1.jsxs(L0,{type:"button",variant:"outline",className:Q0("absolute inset-0 m-auto h-fit w-fit","flex-col gap-1 rounded-2xl border-0 py-4 pr-12 pl-12! text-xs shadow-sm transition-shadow duration-300 ease-out squircle hover:bg-background hover:shadow-lg [&_svg]:size-8"),onClick:$,children:[n1.jsx(t2,{"data-icon":"inline-start",stroke:1}),"New widget"]})]})}function zT({Icon:$,label:Z,active:J,className:H,...B}){return n1.jsx(L0,{type:"button",variant:J?"default":"secondary",className:Q0("relative h-16 w-24 rounded-lg px-4 py-0 text-xs [&_svg]:size-5",H),"aria-pressed":J,...B,children:n1.jsx(m4,{mode:"popLayout",initial:!1,children:n1.jsxs(K5.span,{className:"flex flex-col items-center gap-1.5",variants:{from:{opacity:0,filter:"blur(4px)"},to:{opacity:1,filter:"blur(0px)"}},initial:"from",animate:"to",exit:"from",transition:{type:"spring",duration:0.2,bounce:0},children:[J?n1.jsx(i8,{stroke:1.5}):n1.jsx($,{stroke:1.5}),n1.jsx("span",{children:J?"Done":Z})]},J?"done":"action")})})}function EN0({customizing:$,theming:Z,onCustomizingChange:J,onThemingChange:H}){return n1.jsxs("div",{className:"flex size-full items-center gap-4",children:[n1.jsx(sn,{}),n1.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[n1.jsx(zT,{Icon:Ls,label:"Customize",active:$,onClick:()=>J(!$)}),n1.jsx(zT,{Icon:Sq,label:"Theme",active:Z,onClick:()=>H(!Z)}),n1.jsx(Hq,{children:n1.jsx($6,{render:n1.jsx(zT,{Icon:F3,label:"Settings"})})})]})]})}function bN0(){let[$,Z]=Rq.useState(0);return[Rq.useCallback((H)=>{if(!H)return;let B=new ResizeObserver(([Q])=>{let X=Q.borderBoxSize?.[0];Z(X?X.blockSize:Q.contentRect.height)});return B.observe(H),()=>B.disconnect()},[]),$]}function Ms({onCreateWidget:$,onCreateView:Z,onOpenView:J,customizing:H,theming:B,onThemingChange:Q,onCustomizingChange:X,widgets:z,views:G}){let{layout:U,setLayout:Y}=w1(),F=C1((E)=>E.hasSentMessageFromMoi),K=new Map(z.map((E)=>[E.id,E])),W=new Set(U.widgetGrid.map((E)=>E.i)),N=U.widgetGrid.filter((E)=>K.has(E.i)).map((E)=>{let T=K.get(E.i);return{id:E.i,w:T.config.colSpan,h:T.config.rowSpan,x:E.x,y:E.y}}),q=z.filter((E)=>!W.has(E.id)).map((E)=>({id:E.id,w:E.config.colSpan,h:E.config.rowSpan})),D=!H&&N.every((E)=>_3(E.id)),A=!F&&z.every((E)=>_3(E.id)),[V,L]=bN0(),O=H;uN({kind:"widget",enabled:!H,targets:N.filter((E)=>!_3(E.id)).map((E)=>({id:E.id,revision:K.get(E.id)?.revision}))});function M(E){let T=Ko(E,{views:G,onOpenView:J,onCreateView:Z,showOnboarding:A});if(T)return T;return n1.jsx(Vo,{name:E})}function _(E){Y({widgetGrid:U.widgetGrid.filter((T)=>T.i!==E)})}function w(E){let T=K.get(E);if(!T)return;let k=U.widgetGrid.map((I)=>{let j=K.get(I.i);return{...I,w:j?.config.colSpan??1,h:j?.config.rowSpan??1}}),S=Qq(k,T.config.colSpan,T.config.rowSpan);Y({widgetGrid:[...U.widgetGrid,{i:E,x:S.x,y:S.y}]})}function C(E){Y({widgetGrid:qo(U.widgetGrid,E)})}return n1.jsx("div",{className:"relative min-h-0 flex-1 bg-background",children:n1.jsxs(nU,{children:[n1.jsx(Vs,{items:N,customizing:H,header:n1.jsx(EN0,{customizing:H,theming:B,onCustomizingChange:X,onThemingChange:Q}),emptyState:D?n1.jsx(CN0,{onCreateWidget:$,showOnboarding:A}):void 0,bottomInset:O?L:0,renderItem:M,onMove:C,onRemove:_}),n1.jsx(m4,{children:H&&n1.jsx(Po,{ref:V,items:q,renderItem:M,onCreateWidget:$,onClose:()=>X(!1),onRestore:w})})]})})}var _s=P(u(),1);function Ps({children:$}){return _s.jsx("header",{className:Q0("@container relative flex shrink-0 items-center gap-1 py-2 pr-3 pl-4","after:absolute after:top-full after:left-0 after:h-px after:w-full after:bg-border"),children:$})}var Os=!0;var wN0=64;function Ts($,Z=[]){let J=FM($),H=J.attachments.map(KM);return(uf(J.text).trim()||(H.length?H:Z).filter(Boolean).join(", ")).replace(/\s+/gu," ").trim().slice(0,wN0).trimEnd()}function Iq($,Z,J={}){if("id"in $){let X={source:J.source,...$.kind==="image"?{purpose:J.purpose}:{}};return{attachment:{type:"upload",uploadId:$.id,...X},part:{type:"file-attachment",mediaType:$.mediaType,label:$.filename,...X,previewUrl:$.kind==="image"?Z:void 0}}}let{source:H,label:B,text:Q}=$;return{attachment:{type:"text",source:H,label:B,text:Q},part:mf({type:"text",source:H,label:B,text:Q})}}function js($){return{attachments:$.map((Z)=>Z.attachment),parts:$.map((Z)=>Z.part)}}async function Cs($,Z){let J=vK(Z);if(J)throw Error(J);return js(await Promise.all(Z.map(async(H)=>{if(H.type==="text")return Iq(H);let B=await VX($,H.file??H.path);return Iq(B,`/api/workspaces/${$}/uploads/${B.id}`,{source:H.source})})))}function GT($){return js($.flatMap((Z)=>{if(Z.kind==="text")return[Iq(Z)];if(!Z.upload)return[];return[Iq({...Z.upload,filename:Z.label,mediaType:Z.mediaType},Z.previewUrl,{source:Z.source,purpose:Z.kind==="drawing"?Z.purpose:void 0})]}))}function UT($){return!$?.applet&&!$?.preparedAttachments}function kq($,Z,J){if(!UT(J))return[];return(x1.getState().attachments[L8($,Z)]??[]).filter((B)=>B.kind==="text"||B.status==="ready"&&B.upload)}function SN0({queryClient:$,workspaceId:Z,sessionId:J,parts:H}){let B=`optimistic:${crypto.randomUUID()}`;return $.setQueryData(O0.events(Z,J),(Q)=>LU(Q??ZQ(),{kind:"turn",turn:{id:B,role:"user",origin:{kind:"user-input"},parts:H,timestamp:new Date().toISOString()}})),x1.getState().setActivity(Z,J,"running"),x1.getState().setError(Z,J,null),B}function yq({tabId:$,queryClient:Z,workspaceId:J,sessionId:H,text:B,filenames:Q=[]}){let X=Ts(B,Q);if(!X)return;Z.setQueryData(O0.sessions(J),(z)=>[{sessionId:H,summary:X,lastModified:Date.now(),...$?{tabId:$}:{}},...(z??[]).filter((G)=>G.sessionId!==H)])}function xq($,Z,J,H){let B=$?.models,Q=!Z||!B||B.some((F)=>F.value===Z)?Z:void 0,X=$?.provider==="codex"?HW($.models,Z):B?.find((F)=>F.value===(Q??"default")),z=$?.provider==="codex"&&X?X.resolvedModel??X.value:Q,G=J&&(!X||(X.supportedEffortLevels??[]).includes(J))?J:void 0,U=H===void 0||!X||X.supportsFastMode?H:!1,Y=Os&&$?.supportsStreaming?!0:void 0;return{model:z,effort:G,...U!==void 0?{fastMode:U}:{},stream:Y}}function t7($,Z,J){x1.getState().renameSession($,Z,J),C1.getState().moveComposerDraft(M2($,Z),M2($,J))}function hq($,Z,J=GT(Z)){let H=[...J.parts];if($.text)H.push({type:"text",text:$.text});return{attachments:J.attachments,optimisticId:SN0({...$,parts:H})}}function vq($,Z){for(let J of Z)x1.getState().removeAttachment($,J.localId);C1.getState().markMessageSentFromMoi($)}var bs=P(m(),1);function Es($){if($.status==="available")return null;if($.status==="checking")return"The agent is still connecting";if($.status==="disconnected")return"This workspace is disconnected from Moi";if($.status==="login-required")return"Sign in to the agent to send this message";return"The agent is unavailable in this workspace"}function RN0($,Z,J,H="shared"){let B=new Set,Q=!1,X=()=>{let G=Z.getQueryData(o2($,H)),U=Z.getQueryData(o2($));return qV(U,J().tabId,H==="browser-tab"?G:void 0)??null};async function z(G){if(Q)return;let U=(L)=>{T1.add({title:"Couldn’t send message",description:L,type:"error"}),V8($,{source:"runtime",message:`sendChatMessage() from ${G.applet.kind}:${G.applet.id}: ${L}`})},Y=Es(J().agentAvailability);if(Y){U(Y);return}let F=X(),K=J().tabId,W=!0,N,q=()=>{if(W=!1,A(),B.delete(D),N)T1.close(N)},D=()=>{if(!W)return;q(),T1.add({title:"Message canceled",description:"The active chat changed before attachments were ready",type:"info"})},A=Z.getQueryCache().subscribe(()=>{if(X()!==F||J().tabId!==K)D()});if(B.add(D),J().sessionId!==F){D();return}J().revealChat();let V;try{if(G.attachments.some((M)=>M.type==="file"))N=T1.add({title:"Preparing attachments…",type:"loading",timeout:0});if(V=await Cs($,G.attachments),!W)return;let L=J(),O=Es(L.agentAvailability);if(O)throw Error(O);if(L.sessionId!==F||L.tabId!==K){D();return}}catch(L){if(W)q(),U(L instanceof Error?L.message:"Couldn’t prepare the attachments");return}q();try{J().send(G.message,{applet:G.applet,preparedAttachments:V})}catch(L){U(L instanceof Error?L.message:"Something went wrong while sending this message")}}return{handle:z,dispose(){Q=!0;for(let G of B)G()}}}function ws($){let Z=d1(),J=a0(),H=s3(),B=a2(),Q=q5({...$,tabId:H});bs.useLayoutEffect(()=>{let X=RN0(Z,J,()=>Q.current,B?"browser-tab":"shared"),z=gK(Z).on("sendChatMessage",(G)=>{X.handle(G)});return()=>{z(),X.dispose()}},[Z,J,Q,H,B])}function Ss($,Z){let J=d1();mK(J,"addChatAttachment",(H)=>{Og({workspaceId:J,sessionId:$},H),Z()})}var bZ=P(m(),1);var Is=P(m(),1);var Rs=new Map;function IN0($){let Z=Rs.get($)??[];return Rs.delete($),Z}function kN0($,Z=[]){return[...IN0($),...Z]}function yN0($,Z){if(!$.startsWith("views/"))return;return Object.keys(Z).length>0?Z:void 0}function xN0($,Z){if($.startsWith("views/"))return Z?.find((J)=>J.id===$.slice(6))?.title||void 0;return}function ks({activeTab:$,appletParams:Z}){let J=d1(),H=Bq(J).data;return Is.useCallback((B={})=>{let Q=kN0(J,B.directives??[]),X=yN0($,Z);return{activeTab:{id:$,title:xN0($,H),...X?{params:X}:{}},...B.applet?{applet:B.applet}:{},...Q.length>0?{directives:Q}:{}}},[J,$,Z,H])}function ys($,Z){if(!Z?.forkedFromSessionId||!Z.forkedThroughMessageId)return $;let J=Z.forkedThroughMessageId,H=$.turns.findIndex((Q)=>Q.id===J);if(H<0)return $;let B=new Set(Z.forkedNoticeIds);return{...$,turns:$.turns.slice(H+1),notices:$.notices.filter((Q)=>!B.has(Q.id))}}function hN0($){return $.filter((Z)=>Z.text.length>0).map((Z)=>Z.kind==="reasoning"?{type:"reasoning",text:Z.text}:{type:"text",text:Z.text})}function xs($){let Z=hN0($?.blocks??[]);if(Z.length===0)return null;return{id:"live-preview",role:"assistant",origin:{kind:"user-input"},parts:Z}}var hs=ZQ();function vs($){let Z=d1(),J=a0(),{layout:H}=w1(),[B,Q]=t3($.activeTab),X=a2(),z=s8(Z).data,G=vJ(Z).data,U=B??null,Y=U??N2($.activeTab),F=ks($),K=K4((j)=>U?j.activity[`${Z}:${U}`]??"idle":"idle"),W=$Q(K),N=K4((j)=>U?j.errors[`${Z}:${U}`]??null:null),q=VR(Z,U),{refetch:D}=q,A=eU(Z,U),{refetch:V}=A,L=bZ.useCallback(async()=>{await D(),await V()},[D,V]),O=A.data?.forkedFromSessionId,M=!U||A.data!==void 0,_=M?q.data??hs:hs;if(q.data&&O)_=ys(q.data,A.data);let w=B!==void 0&&M&&G!==void 0&&(U===null||q.data!==void 0),C=K4((j)=>qw(j.previews,Z,U).root),E=bZ.useMemo(()=>xs(C),[C]),T=A.data?.config,k=bZ.useCallback((j,y)=>{let R=j.trim(),x=kq(Z,Y,y);if(!R&&x.length===0&&!y?.preparedAttachments?.attachments.length)return;let v=y?.preparedAttachments??GT(x),f=vK(v.attachments);if(f){T1.add({title:"Couldn’t send message",description:f,type:"error"});return}let b=U,l=!1;if(!b){if(b=crypto.randomUUID(),l=!0,!UT(y))t7(Z,Y,b);Q(b),yq({tabId:$.activeTab,queryClient:J,workspaceId:Z,sessionId:b,text:R,filenames:x.map((U0)=>U0.label)})}let{attachments:r,optimisticId:h}=hq({queryClient:J,workspaceId:Z,sessionId:b,text:R},x,v),d=T?.model??H.selectedModel,o=T?.effort??H.selectedEffort,c=T?.fastMode??H.selectedFastMode,{model:i,effort:n,fastMode:Z0,stream:J0}=xq(z,d,o,c);if(JY({type:"chat",workspaceId:Z,content:R,sessionId:b,isNew:l,selectedSessionScope:X?"browser-tab":"shared",optimisticId:h,model:i,effort:n,fastMode:Z0,stream:J0,context:F(y),...r.length>0?{attachments:r}:{}}),vq(Z,x),l)J.invalidateQueries({queryKey:O0.previews})},[$.activeTab,Y,U,Z,J,H.selectedModel,H.selectedEffort,H.selectedFastMode,F,T?.model,T?.effort,T?.fastMode,Q,X,z]),S=bZ.useCallback(()=>{if(!U)return;x1.getState().setError(Z,U,null)},[U,Z]),I=bZ.useCallback(()=>{if(!W||!U)return;JY({type:"stop",workspaceId:Z,sessionId:U})},[W,U,Z]);return{view:_,forkedFromSessionId:O,chatLoaded:w,previewTurn:E,sessionId:U,composerSessionId:Y,processing:W,error:N,loadError:A.error?.message??q.error?.message??null,retryLoad:L,send:k,stop:I,selectSession:Q,dismissError:S}}var gs=P(m(),1);var Z4=P(m(),1);function fs({active:$,viewId:Z,sessionId:J,source:H,workspaceId:B,onEditingStart:Q,onContinueInChat:X}){let z=Z4.useRef(`sketch:${Z}`),G=Z4.useRef(0),U=Z4.useRef(null),Y=Z4.useRef(null),F=Z4.useRef(!0),[K,W]=Z4.useState(!1),N=q5(Q),q=q5(X),D=Z4.useCallback((C)=>{if(!F.current)return;if(!C){G.current+=1,U.current=null,Y.current=null,x1.getState().removeAttachment(B,z.current);return}LX({workspaceId:B,sessionId:J,localId:z.current,purpose:"sketch",source:H,blob:C})},[J,H,B]),A=Z4.useCallback((C)=>{if(!C)return Y.current??Promise.resolve();if(C===U.current){if(x1.getState().attachments[L8(B,J)]?.some((S)=>S.localId===z.current&&S.kind!=="text"&&(S.status==="ready"||S.status==="uploading")))return Y.current??Promise.resolve()}U.current=C;let E=++G.current,T=sK({workspaceId:B,sessionId:J,localId:z.current,purpose:"sketch",source:H,blob:C,isCurrent:()=>G.current===E});return Y.current=T,T},[J,H,B]),V=aK({mode:"sketch",onChange:D,onEditingStart:()=>N.current()}),{controls:L}=V,O=Z4.useCallback(async()=>{await A(await L.flush())},[L,A]),M=Z4.useCallback(async()=>{await A(await L.deactivate())},[L,A]),_=Z4.useCallback(async()=>{if(K)return;W(!0);try{await M(),q.current()}finally{W(!1)}},[K,M,q]),w=Z4.useCallback(async()=>{F.current=!1,G.current+=1,U.current=null,Y.current=null,x1.getState().removeAttachment(B,z.current);try{await L.cancel()}finally{F.current=!0}},[L,B]);return Z4.useEffect(()=>{if(!$&&L.active)M()},[$,L.active,M]),{...V,continuing:K,continueInChat:_,prepareForSend:O,resetDocument:w}}var u1=P(u(),1);function ms({ref:$,active:Z,pendingView:J,running:H,sketchSessionId:B,chatDocked:Q,workspaceId:X,onEditingStart:z,onContinueInChat:G,onOpenChat:U,onDiscard:Y}){let F=J.status==="submitted"?H?"building":"waiting":J.status,K=fs({active:Z&&J.status==="draft",viewId:J.id,sessionId:B??J.executionSessionId??N2(S5(J.id)),source:S5(J.id),workspaceId:X,onEditingStart:z,onContinueInChat:G});return gs.useImperativeHandle($,()=>({prepareSketchForSend:K.prepareForSend,resetSketch:K.resetDocument}),[K.prepareForSend,K.resetDocument]),u1.jsx(gN0,{active:Z,chatDocked:Q,error:J.error,sketch:K,displayStatus:F,onDiscard:Y,onOpenChat:U})}function vN0(){return u1.jsx(fq,{children:u1.jsxs("div",{className:"flex max-w-md flex-col items-center gap-4 p-8 text-center",children:[u1.jsx(n2,{className:"size-6 text-muted-foreground"}),u1.jsx("p",{className:"text-sm text-muted-foreground",children:"Starting view chat…"})]})})}function fN0({error:$,onOpenChat:Z,onDiscard:J}){return u1.jsx(fq,{children:u1.jsxs("div",{className:"pointer-events-auto flex max-w-md flex-col items-center gap-4 bg-radial from-background from-50% to-transparent to-75% p-8 text-center",children:[u1.jsx("p",{className:"text-sm text-muted-foreground",children:$}),u1.jsx(L0,{onClick:Z,children:"Open chat"}),u1.jsx(L0,{variant:"secondary",onClick:J,children:"Discard view"})]})})}function gN0({active:$,chatDocked:Z,error:J,sketch:H,displayStatus:B,onDiscard:Q,onOpenChat:X}){let z=B==="draft";return u1.jsxs("div",{className:Q0("relative min-h-0 flex-1 overflow-hidden bg-background",$?"flex":"hidden"),children:[u1.jsx(mN0,{chatDocked:Z,sketch:H,draft:z}),u1.jsx("div",{inert:z?void 0:!0,className:Q0("absolute inset-0",!z&&"pointer-events-none opacity-50"),children:u1.jsx(iK,{...H.layerProps,children:z&&u1.jsx(nK,{controls:H.controls,title:"Sketch the view",busy:H.continuing,onComplete:()=>void H.continueInChat()})})}),u1.jsx("div",{"aria-hidden":!0,className:Q0("pointer-events-none absolute inset-0 transition-shadow duration-500 ease-in-out",B==="building"&&"animate-glow texture-inset-shadow-50% motion-reduce:animate-none")}),B==="building"&&u1.jsx(pN0,{controls:H.controls}),B==="starting"&&u1.jsx(vN0,{}),B==="waiting"&&u1.jsx(uN0,{error:J,onDiscard:Q,onOpenChat:X}),B==="failed"&&u1.jsx(fN0,{error:J,onOpenChat:X,onDiscard:Q})]})}function mN0({chatDocked:$,sketch:Z,draft:J}){let{controls:H,targetRef:B}=Z,{hasStrokes:Q}=DX(H);return u1.jsx("div",{ref:B,className:"absolute inset-0 flex items-center justify-center texture-checker-20",children:J&&!H.active&&!Q&&u1.jsxs("div",{className:Q0("mb-4 flex h-full flex-col items-center justify-center gap-2 p-12 text-center text-sm text-muted-foreground","bg-radial from-background from-10% to-transparent",$?"w-full":"mr-auto w-[calc(100%-var(--chat-max))]"),children:[u1.jsx(TH,{size:56,stroke:0.5}),u1.jsx("span",{className:"max-w-32",children:"Sketch how the view should look"})]})})}function uN0({error:$,onDiscard:Z,onOpenChat:J}){return u1.jsx(fq,{children:u1.jsxs("div",{className:"pointer-events-auto flex max-w-md flex-col items-center gap-4 bg-radial from-background from-50% to-transparent to-75% p-12 text-center",children:[u1.jsxs("div",{className:"flex flex-col gap-1",children:[u1.jsx("h1",{className:"font-medium",children:"The view needs your attention"}),u1.jsx("p",{className:"text-sm text-muted-foreground",children:$??"Open the chat to answer or ask the agent to continue"})]}),u1.jsxs("div",{className:"flex gap-2",children:[u1.jsx(L0,{onClick:J,children:"Open chat"}),u1.jsx(L0,{variant:"secondary",onClick:Z,children:"Discard view"})]})]})})}function pN0({controls:$}){let{hasStrokes:Z}=DX($);return u1.jsx(fq,{children:!Z&&u1.jsx(n2,{className:"size-6 text-muted-foreground"})})}function fq({children:$}){return u1.jsx("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center",children:$})}var F8=P(m(),1);function us($,{activeId:Z,available:J,now:H}){let B=[];if(Z!==null&&J.has(Z))B.push({id:Z,releasedAt:null});for(let Q of $){if(Q.id===Z||!J.has(Q.id))continue;let X=Q.releasedAt??H;if(H-X>=60000)continue;if(B.length>=4)break;B.push({id:Q.id,releasedAt:X})}return B}function ps($,Z){let J=null;for(let{releasedAt:H}of $){if(H===null)continue;let B=H+60000;if(J===null||B<J)J=B}return J===null?null:Math.max(0,J-Z)}function cs($,Z){return $.length===Z.length&&$.every((J,H)=>{let B=Z[H];return J.id===B.id&&J.releasedAt===B.releasedAt})}var E2=P(u(),1),ls=F8.memo(function({views:Z,activeViewId:J,params:H}){let B=cN0(J,Z),Q=new Set(B.map((X)=>X.id));return E2.jsx("div",{className:Q0("relative min-h-0 flex-1 overflow-hidden",!J&&"hidden"),children:Z.filter((X)=>Q.has(X.id)).map((X)=>E2.jsx(dN0,{view:X,active:X.id===J,params:H},X.id))})});function cN0($,Z){let[J,H]=F8.useState([]),B=q5(Z),Q=Z.map((z)=>z.id).join(`
|
|
68
|
+
`),X=F8.useCallback(()=>{H((z)=>{let G=us(z,{activeId:$,available:new Set(B.current.map((U)=>U.id)),now:Date.now()});return cs(z,G)?z:G})},[$,B]);return F8.useEffect(()=>{X()},[Q,X]),F8.useEffect(()=>{let z=ps(J,Date.now());if(z===null)return;let G=setTimeout(X,z);return()=>clearTimeout(G)},[X,J]),J}function dN0({view:$,active:Z,params:J}){let H=d1(),B=Zg($.id),{current:Q,outgoing:X}=iN0(B,Z),[z,G]=F8.useState(J);if(Z&&z!==J)G(J);zq(pK("views",H,$.id),Q?.version??B.version,Z);let U=B.status==="error";return uN({kind:"view",enabled:Z&&Boolean(Q)&&!U,targets:[{id:$.id,revision:$.revision}]}),E2.jsxs(E2.Fragment,{children:[Z&&U&&E2.jsx("p",{className:"absolute inset-0 p-4 text-xs text-destructive",children:B.error}),Z&&!U&&!Q&&E2.jsx(rN0,{}),Q&&!U&&E2.jsxs(F8.Activity,{mode:Z?"visible":"hidden",children:[X&&E2.jsx(ds,{view:$,build:X,params:z},X.version),E2.jsx(ds,{view:$,build:Q,params:z,entering:X!==null,current:!0},Q.version)]})]})}function ds({view:$,build:Z,params:J,entering:H,current:B=!1}){let Q=d1(),X=b7("views",$.id);return E2.jsx("div",{"data-applet-thumbnail":B?X:void 0,"data-applet":X,className:Q0("absolute inset-0 isolate",H&&"animate-in duration-200 ease-out blur-in-4 fade-in"),children:E2.jsx("div",{className:"size-full overflow-auto",children:E2.jsx(Wz,{name:$.id,kind:"view",workspaceId:Q,resetKey:Z.version,children:E2.jsx(HQ,{appletId:X,active:B,children:E2.jsx(Z.Component,{params:J})})})})})}var lN0=200;function iN0($,Z){let[J,H]=F8.useState({current:null,outgoing:null});if($.status==="ready"&&J.current?.version!==$.version){let B={Component:$.Component,version:$.version};H((Q)=>({current:B,outgoing:Z?Q.current:null}))}return F8.useEffect(()=>{if(!J.outgoing)return;let B=setTimeout(()=>H((Q)=>({...Q,outgoing:null})),lN0);return()=>clearTimeout(B)},[J.outgoing]),J}function rN0(){return E2.jsx("div",{className:"absolute inset-0 flex animate-in items-center justify-center delay-150 duration-200 fill-mode-both fade-in",children:E2.jsx(n2,{className:"text-muted-foreground"})})}function is($){return $?.status==="compiled"?void 0:$}async function rs($,Z,J,H,B,Q,X="shared"){let G=is($.getQueryData(O0.views(Z))?.find((F)=>F.id===J))?.executionSessionId??H;try{let[{views:F},K]=await Promise.all([B1(`/api/workspaces/${Z}/views`),B1(`/api/workspaces/${Z}/selected-session`)]),W=is(F.find((N)=>N.id===J));if(!Q&&W?.status==="draft")G=N2(S5(J)),$.setQueryData(O0.sessions(Z),(N)=>N?.filter((q)=>q.sessionId!==H)),$.removeQueries({queryKey:O0.events(Z,H)});else G=W?.executionSessionId??(Q?K.pinned:K.selected[S5(J)])??H;if(t7(Z,H,G),W?.status==="draft"||W?.status==="failed")x1.getState().setActivity(Z,G,"idle");if($.setQueryData(O0.views(Z),F),$.setQueryData(n3.sessionSelection(Z),K),X==="browser-tab"&&!Q){let q={...($.getQueryData(o2(Z,"browser-tab"))??n6(Z)).selected};if(W?.status==="draft")delete q[S5(J)];else q[S5(J)]=G;let D={selected:q,pinned:null};$.setQueryData(o2(Z,"browser-tab"),D),s6(Z,D)}}catch{t7(Z,H,G),$.invalidateQueries({queryKey:O0.views(Z)}),$.invalidateQueries({queryKey:n3.sessionSelection(Z)})}let U=M2(Z,G),Y=C1.getState();Y.setComposerDraft(U,Y.composerDrafts[U]??B)}function as(){let $=a0(),J=a2()?"browser-tab":"shared",{workspaceId:H,layout:B}=w1(),{pinnedSessionId:Q}=t6(),X=s8(H).data,z=Xo(H),G=zo(H),U=Go(H),Y=Uo(H);return{create:()=>z.mutateAsync(),save:(q,D)=>G.mutateAsync({viewId:q,requirements:D}),submit:async(q,D)=>{let A=D.trim(),V=Q??N2(S5(q.id)),L=Q??crypto.randomUUID(),O=kq(H,V);if(!A&&O.length===0)return;if(!Q)yq({tabId:S5(q.id),queryClient:$,workspaceId:H,sessionId:L,text:A,filenames:O.map((k)=>k.label)});if(!Q)t7(H,V,L),qQ($,H,L,S5(q.id),J);let M=hq({queryClient:$,workspaceId:H,sessionId:L,text:A},O),_=$.getQueryData(O0.session(H,L))?.config,{model:w,effort:C,fastMode:E,stream:T}=xq(X,_?.model??B.selectedModel,_?.effort??B.selectedEffort,_?.fastMode??B.selectedFastMode);$.setQueryData(O0.views(H),(k)=>k?.map((S)=>S.id===q.id&&S.status==="draft"?{...S,status:"starting",requirements:A,executionSessionId:L}:S));try{let k=await U.mutateAsync({viewId:q.id,sessionId:L,requirements:A,optimisticId:M.optimisticId,selectedSessionScope:J,...O.length>0?{attachments:M.attachments}:{},model:w,effort:C,fastMode:E,stream:T});if(t7(H,L,k.sessionId),tU($,H,L,k.sessionId),!Q)qQ($,H,k.sessionId,S5(q.id),J);vq(H,O);let S=M2(H,k.sessionId),I=C1.getState();if(I.composerDrafts[S]?.trim()===A)I.setComposerDraft(S,null)}catch(k){throw await rs($,H,q.id,L,A,!!Q,J),k}},discard:(q)=>Y.mutateAsync(q)}}var e7=P(m(),1);function os({workspaceId:$,pendingViews:Z,onSave:J}){let H=e7.useRef(new Set),B=e7.useRef(new Map),Q=q5(Z),X=q5(J),z=e7.useCallback((G)=>{clearTimeout(B.current.get(G)),B.current.delete(G),C1.getState().setComposerDraft(M2($,N2(S5(G))),null)},[$]);return e7.useEffect(()=>{for(let G of Z){let U=N2(S5(G.id)),Y=M2($,U);if(C1.getState().moveComposerDraft(U,Y),G.status!=="draft")z(G.id);else if(!H.current.has(Y)){if(H.current.add(Y),C1.getState().composerDrafts[Y]===void 0)C1.getState().setComposerDraft(Y,G.requirements)}}},[$,Z,z]),e7.useEffect(()=>{let G=B.current,U=(F)=>{if(Q.current.find((N)=>N.id===F)?.status!=="draft")return;let K=M2($,N2(S5(F))),W=C1.getState().composerDrafts[K];if(W===void 0)return;X.current(F,W).catch(()=>{T1.add({title:"Couldn’t save view description",type:"error"})})},Y=C1.subscribe((F,K)=>{for(let W of Q.current){if(W.status!=="draft")continue;let N=M2($,N2(S5(W.id))),q=F.composerDrafts[N];if(q===K.composerDrafts[N])continue;if(clearTimeout(G.get(W.id)),G.delete(W.id),q===void 0)continue;G.set(W.id,setTimeout(()=>{G.delete(W.id),U(W.id)},500))}});return()=>{Y();for(let[F,K]of G)clearTimeout(K),U(F);G.clear()}},[$,Q,X]),{clear:z}}function ns($,Z){if(Z)return{status:"disconnected"};return $??{status:"checking"}}var ss=P(u(),1);function bz({className:$,...Z}){return ss.jsx("div",{...Z,className:Q0("w-full p-2 text-sm @xl:p-1 @xl:pl-3",$)})}var wZ=P(u(),1);function gq({error:$,onDismiss:Z,onRetry:J}){return wZ.jsxs(bz,{role:"alert",className:"flex items-center gap-2 text-destructive",children:[wZ.jsx("span",{className:"flex-1 wrap-break-word",children:$}),J&&wZ.jsx(L0,{type:"button",variant:"ghost",size:"sm",onClick:J,children:"Retry"}),Z&&wZ.jsx(L0,{type:"button",variant:"ghost",size:"icon-sm",onClick:Z,className:"text-destructive hover:text-destructive","aria-label":"Dismiss error",children:wZ.jsx(i5,{stroke:1.75})})]})}var J4=P(u(),1);function es({error:$,pendingAction:Z,onUpdate:J,onDismiss:H}){if(!$&&Z==="auto")return J4.jsxs(bz,{role:"status",className:"flex items-center gap-1.5 text-muted-foreground",children:[J4.jsx(r5,{size:20,stroke:1.5,className:"shrink-0 animate-spin"}),J4.jsx("span",{className:"wrap-break-word",children:"Updating Moi skills…"})]});let B=Z!==null;return J4.jsxs(bz,{role:$?"alert":"status",className:Q0("grid grid-cols-[minmax(0,1fr)_auto] gap-x-2 gap-y-2","@xl:flex @xl:items-center",$&&"text-destructive"),children:[J4.jsxs("div",{className:"flex min-w-0 items-start gap-1.5 @xl:order-1 @xl:flex-1 @xl:items-center",children:[J4.jsx(ts,{size:20,stroke:1.5,className:"shrink-0"}),$?J4.jsx("span",{className:"wrap-break-word",children:`Update failed: ${$}`}):J4.jsx("span",{className:"wrap-break-word",children:"This workspace is using old Moi skills"})]}),J4.jsx(L0,{type:"button",variant:"ghost",size:"icon-sm",onClick:H,className:"col-start-2 row-start-1 -mt-1 -mr-1 text-muted-foreground hover:text-foreground @xl:order-4 @xl:m-0","aria-label":"Dismiss skill update",children:J4.jsx(i5,{stroke:1.75})}),J4.jsxs("div",{className:"col-span-2 flex flex-wrap gap-1.5 @xl:contents",children:[J4.jsxs(L0,{type:"button",variant:"default",size:"sm",onClick:()=>J("auto"),disabled:B,className:"@xl:order-2",children:[Z==="auto"&&J4.jsx(r5,{stroke:1.75,className:"animate-spin"}),Z==="auto"?"Updating…":"Auto-update"]}),J4.jsxs(L0,{type:"button",variant:"secondary",size:"sm",onClick:()=>J("once"),disabled:B,className:"@xl:order-3",children:[Z==="once"&&J4.jsx(r5,{stroke:1.75,className:"animate-spin"}),Z==="once"?"Updating…":"Update once"]})]})]})}var $$=P(m(),1);function YT($){return{workspaceId:$,phase:"idle",pendingAction:null,error:null}}function aN0($){return $.phase==="active"||$.phase==="idle"&&$.updateAvailable&&!$.autoUpdateEnabled}function oN0($){return $.updateAvailable&&$.autoUpdateEnabled&&!$.updatePending&&$.phase==="idle"}function $t($){let Z=Bg($),{isPending:J,mutate:H,reset:B}=Qg($),Q=ia(),{mutate:X}=ra(),z=Q.data!==void 0,G=Q.data?.autoUpdateSkills??!1,U=$$.useCallback(()=>X({autoUpdateSkills:!0}),[X]),[Y,F]=$$.useState(()=>YT($)),K=Y.workspaceId===$?Y:YT($);$$.useEffect(()=>{F(YT($)),B()},[$,B]);let W=$$.useCallback((D)=>{if(J)return;if(D==="auto")U();F({workspaceId:$,phase:"active",pendingAction:D,error:null}),H(void 0,{onSuccess:()=>{F((A)=>A.workspaceId===$?{...A,phase:"dismissed",pendingAction:null,error:null}:A)},onError:(A)=>{F((V)=>V.workspaceId===$&&V.phase!=="dismissed"?{...V,phase:"active",pendingAction:null,error:A.message}:V)}})},[U,J,H,$]),N=Z.data?.updateAvailable??!1;return $$.useEffect(()=>{if(z&&oN0({updateAvailable:N,autoUpdateEnabled:G,updatePending:J,phase:K.phase}))W("auto")},[G,K.phase,W,z,N,J]),{bannerProps:z&&aN0({updateAvailable:N,autoUpdateEnabled:G,phase:K.phase})?{error:K.error,pendingAction:K.pendingAction,onUpdate:W,onDismiss:()=>{F((D)=>D.workspaceId===$?{...D,phase:"dismissed",pendingAction:null,error:null}:D)}}:null}}var wz=P(u(),1);function Zt($,{chatError:Z,onDismissChatError:J,chatLoadError:H,onRetryChatLoad:B}){let{data:Q,error:X,refetch:z}=s8($),G=Q?.availability,{bannerProps:U}=$t($),Y=ns(G,Boolean(X)),F=X?{tone:"error",content:wz.jsx(gq,{error:"Could not check agent availability",onRetry:()=>void z()})}:void 0,K;if(H)K={tone:"error",content:wz.jsx(gq,{error:H,onRetry:B})};else if(Z)K={tone:"error",content:wz.jsx(gq,{error:Z,onDismiss:J})};let W=U?{tone:"default",content:wz.jsx(es,{...U})}:void 0;return{agentAvailability:Y,composerBanner:F??K??W,viewDraftComposerBanner:F??W}}var Jt=P(m(),1);var K8=P(u(),1);function Ht({onOpenTheme:$}){let{layout:Z,name:J,provider:H}=w1(),[B,Q]=Jt.useState(!1);return K8.jsx(Hq,{children:K8.jsxs(r8,{children:[K8.jsxs(a8,{className:"flex min-w-0 cursor-pointer items-center gap-2 rounded-sm outline-none focus-visible:ring-3 focus-visible:ring-ring/50","aria-label":`${J??"Workspace"} menu`,onPointerEnter:()=>Q(!0),onPointerLeave:()=>Q(!1),children:[K8.jsx(q7,{icon:B?{...Z.icon,type:"glyph",value:"dots"}:Z.icon,workspaceType:H,workspaceTheme:Z.theme,className:"size-5 rounded-sm"}),J&&K8.jsx("span",{className:"truncate text-sm font-medium text-foreground",children:J})]}),K8.jsx(o8,{align:"start",sideOffset:6,className:"w-36",children:K8.jsxs(O9,{children:[K8.jsxs(B8,{onClick:$,children:[K8.jsx(Sq,{stroke:1.75}),"Theme"]}),K8.jsxs(B8,{nativeButton:!0,render:K8.jsx($6,{}),className:"w-full",children:[K8.jsx(F3,{stroke:1.75}),"Settings"]})]})})]})})}var nN0=dK();function A6($,Z){if($==="overview"||$==="scratchpad")return!0;let J=NJ($);return J?Z.some((H)=>H.id===J):!1}function mq($,Z){let J=$.open.filter((H)=>A6(H,Z));return J.length>0?J:nN0.open}function FT($,Z,J){if($!==void 0)return $;let H=mq(Z,J);return H.includes(Z.active)?Z.active:H[0]??"overview"}var L2=P(m(),1);var KB=P(m(),1);var Bt=($)=>`moi:collab:${$}:tabs`;function sN0($,Z){try{let J=sessionStorage.getItem(Bt($));return J?lK(JSON.parse(J)):Z}catch{return Z}}function tN0($,Z){try{sessionStorage.setItem(Bt($),JSON.stringify(Z))}catch{}}function Qt(){let{workspaceId:$,layout:Z,setLayout:J}=w1(),H=a2(),B=KB.useMemo(()=>lK(Z.tabs),[Z.tabs]),[Q,X]=KB.useState(()=>H?sN0($,B):B),z=KB.useCallback((G)=>{let U=lK(G);if(H)X(U),tN0($,U);else J({tabs:U});return U},[H,J,$]);return[H?Q:B,z]}function Gt($){let Z=new URLSearchParams($);Z.sort();let J=Z.toString();return J?`?${J}`:""}function KT(){return window.location.pathname+Gt(window.location.search)}function WT($,Z){return $.get(Z)??`moi:/${Z}`}var Xt=new Map;function Ut({views:$,onOpenChat:Z}){let J=a0(),{workspaceId:H}=w1(),[B,Q]=Qt(),X=L2.useRef({views:$,tabsState:B,onOpenChat:Z});L2.useLayoutEffect(()=>{X.current={views:$,tabsState:B,onOpenChat:Z}},[$,B,Z]);let z=AR(),G=L2.useRef(null),[,U]=a4(),Y=w2(),{base:F}=Y,K=`${F.replace(/\/$/,"")}/workspace/${encodeURIComponent(H)}/`,W=X$(Y).slice(K.length),N=Gt(oz(Y)),q=L2.useMemo(()=>{let S=new URLSearchParams(N);return Object.fromEntries(Array.from(S.keys(),(I)=>[I,S.get(I)]))},[N]),D=L2.useMemo(()=>{let S=Xt.get(H);if(!S)Xt.set(H,S=new Map);return S},[H]),A=b$(W),V=W==="chat"||W==="chats"||W.startsWith("chats/"),L=FT(A,B,$),O=Boolean(W)&&!V&&(!A||!A6(A,$)),M=A!==void 0&&!O,_=L2.useCallback((S)=>{X.current={...X.current,tabsState:Q(S)}},[X,Q]),w=L2.useCallback(()=>{let S=b$(window.location.pathname.slice(K.length)),{tabsState:I,views:j}=X.current,y=S??FT(void 0,I,j),R=S?`moi:/${y}${window.location.search}`:WT(D,y);return{tab:y,href:R}},[X,K,D]),C=L2.useCallback(async(S,{replace:I=!1}={},j=new AbortController)=>{let y=O8(S,{workspaceId:H,base:F});if(G.current?.controller.abort(),!y.startsWith(K)){G.current=null,j.signal.throwIfAborted(),window.location.assign(y);return}G.current={controller:j,address:KT()};let R=(x)=>{if(j.signal.throwIfAborted(),G.current=null,KT()!==x||window.location.hash)U(`~${x}`,{replace:I})};try{let x=y.slice(K.length).split("?",1)[0];if(x==="chat"||x.startsWith("chats/")){let{tab:b,href:l}=w(),r=x==="chat"?!0:await z(decodeURIComponent(x.slice(6)),b,j.signal);if(R(O8(l,{workspaceId:H,base:F})),r)X.current.onOpenChat();return}if(!X3(x))throw Error("This destination is unavailable in this workspace");let v=O0.views(H),f=J.getQueryData(v)??X.current.views;if(!A6(x,f))await J.refetchQueries({queryKey:v,exact:!0},{throwOnError:!0}),f=J.getQueryData(v)??X.current.views;if(!A6(x,f))throw Error("This destination is unavailable in this workspace");R(y)}finally{if(G.current?.controller===j)G.current=null}},[F,w,X,K,J,z,U,H]);L2.useEffect(()=>{let S=G.current;if(S&&S.address!==KT())S.controller.abort()},[W,N,H]),L2.useEffect(()=>()=>G.current?.controller.abort(),[]);let E=L2.useCallback((S)=>{if(S instanceof Error&&S.name==="AbortError")return;let I=S instanceof Error?S.message:"Navigation failed";T1.add({type:"error",title:"Could not navigate",description:I}),V8(H,{source:"runtime",message:I})},[H]),T=L2.useCallback((S,I={})=>{C(WT(D,S),I).catch(E)},[C,D,E]);mK(H,"navigate",(S)=>{C(S).catch(E)}),zt(H,C),L2.useEffect(()=>{if(W&&!V)return;let S=WT(D,L);if(V)try{S=O8(`moi:/${W}`)}catch{}let I=new AbortController;return C(S,{replace:!0},I).catch((j)=>{if(!I.signal.aborted)E(j)}),()=>I.abort()},[L,V,C,W,D,E,N]),L2.useEffect(()=>{if(!M)return;D.set(L,`moi:/${L}${N}`);let S=X.current.tabsState,I=S.open.includes(L)?S.open:[...S.open,L];if(I!==S.open||S.active!==L)_({open:I,active:L})},[L,M,X,D,N,_]);let k=L2.useCallback((S)=>{if(S.defaultPrevented||S.button!==0||S.metaKey||S.ctrlKey||S.altKey||S.shiftKey)return;let I=S.target instanceof Element?S.target.closest("a[href]"):null;if(!(I instanceof HTMLAnchorElement)||I.hasAttribute("download")||I.target&&I.target!=="_self")return;let j=new URL(I.href);if(j.origin!==window.location.origin||!j.pathname.startsWith(K))return;if(j.hash)return;S.preventDefault(),C(`moi:/${j.pathname.slice(K.length)}${j.search}`).catch(E)},[C,K,E]);return{tabsState:B,activeTab:L,appletParams:q,navigateToTab:T,setTabs:_,isUnavailable:O,onNavigationClick:k}}var m5=P(u(),1),eN0=r6([M9({variant:"ghost",size:"sm"}),"group/tab min-w-0"],{variants:{active:{true:"bg-accent text-accent-foreground"},dragging:{true:"invisible"},preview:{true:"cursor-grabbing ring-1 ring-border"}},compoundVariants:[{preview:!0}]});function $q0({items:$}){return m5.jsxs(r8,{children:[m5.jsx(a8,{render:m5.jsx(L0,{type:"button",variant:"ghost",size:"icon-sm",className:"text-muted-foreground","aria-label":"Create tab",children:m5.jsx(t2,{stroke:1.75})})}),m5.jsx(o8,{align:"start",className:"min-w-48",children:m5.jsx(O9,{children:$.map((Z)=>m5.jsxs(B8,{onClick:Z.onClick,className:"font-medium",children:[m5.jsx(Z.Icon,{stroke:2}),Z.label]},Z.key))})})]})}function Yt($){let{tab:Z,active:J}=$,H=$.preview===!0;return m5.jsxs("button",{type:"button","aria-hidden":H||void 0,"aria-label":Z.label,disabled:H,tabIndex:H?-1:void 0,onClick:$.preview?void 0:()=>$.onSelect(Z.key),className:eN0({active:J,dragging:$.preview?!1:$.state.isDragging,preview:H}),...$.preview?{}:$.state.dragHandleProps,children:[m5.jsxs("div",{className:Q0("flex items-center gap-1 overflow-hidden select-none",Z.closable&&"group-hover/tab:mr-3"),children:[Z.loading?m5.jsx(n2,{"data-icon":"inline-start",className:"shrink-0"}):m5.jsx(Z.Icon,{"data-icon":"inline-start",stroke:2,className:"size-4 shrink-0"}),m5.jsx("span",{className:Q0("truncate",Z.closable&&"group-hover/tab:-mr-3 group-hover/tab:mask-r-from-[calc(100%-24px)] group-hover/tab:mask-r-to-[calc(100%-12px)]"),children:Z.label})]}),Z.closable&&m5.jsx("div",{"aria-label":`Close ${Z.label}`,tabIndex:H?-1:void 0,className:Q0("absolute right-2 hidden size-3 items-center justify-center text-muted-foreground group-hover/tab:flex hover:text-foreground",H&&"pointer-events-none"),onClick:$.preview?void 0:(B)=>{B.stopPropagation(),$.onClose(Z.key)},children:m5.jsx(i5,{stroke:1.75,className:"size-4 shrink-0"})})]})}function Ft({tabs:$,active:Z,createItems:J,onSelect:H,onClose:B,onReorder:Q}){return m5.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-1",children:[m5.jsx("div",{className:"no-scrollbar min-w-0 scroll-fade-x overflow-x-auto overflow-y-hidden [--scroll-fade-reveal:16px]",children:m5.jsx(VK,{items:$,getId:(X)=>X.key,isItemDragDisabled:(X)=>X.reorderable===!1,className:"flex w-max items-center gap-1",onReorder:(X)=>Q(X),renderPlaceholder:()=>m5.jsx("div",{className:"pointer-events-none absolute inset-0 rounded-md bg-muted"}),renderOverlay:(X)=>m5.jsx(Yt,{tab:X,active:Z===X.key,preview:!0}),renderItem:(X,z)=>m5.jsx(Yt,{tab:X,active:Z===X.key,state:z,onSelect:H,onClose:B})})}),m5.jsx("div",{className:"shrink-0",children:m5.jsx($q0,{items:J})})]})}var WB=P(m(),1);function NT($){let Z=document.documentElement,J=getComputedStyle(Z).getPropertyValue($).trim(),H=Number.parseFloat(J);if(!Number.isFinite(H))return 0;return J.endsWith("rem")?H*Number.parseFloat(getComputedStyle(Z).fontSize):H}function Kt(){let $=WB.useRef(null),[Z,J]=WB.useState(null);return WB.useLayoutEffect(()=>{let H=$.current;if(!H)return;let B=(X)=>{let z=NT("--column-w"),G=NT("--chat-min"),U=NT("--chat-max"),Y={fits:X-G>=z,workspaceMinWidth:z,chatMinWidth:G,chatMaxWidth:U};J((F)=>F?.fits===Y.fits&&F.workspaceMinWidth===Y.workspaceMinWidth&&F.chatMinWidth===Y.chatMinWidth&&F.chatMaxWidth===Y.chatMaxWidth?F:Y)};B(H.getBoundingClientRect().width);let Q=()=>B(H.getBoundingClientRect().width);return window.addEventListener("resize",Q),()=>window.removeEventListener("resize",Q)},[]),{ref:$,fits:Z?.fits??!1,constraints:Z?{workspaceMinWidth:Z.workspaceMinWidth,chatMinWidth:Z.chatMinWidth,chatMaxWidth:Z.chatMaxWidth}:null}}var B$=P(m(),1);var VB=P(u(),1),y1=P(m(),1);function Zq0($,Z){let J=getComputedStyle($),H=parseFloat(J.fontSize);return Z*H}function Jq0($,Z){let J=getComputedStyle($.ownerDocument.documentElement),H=parseFloat(J.fontSize);return Z*H}function Hq0($){return $/100*window.innerHeight}function Bq0($){return $/100*window.innerWidth}function Qq0($){switch(typeof $){case"number":return[$,"px"];case"string":{let Z=parseFloat($);return $.endsWith("%")?[Z,"%"]:$.endsWith("px")?[Z,"px"]:$.endsWith("rem")?[Z,"rem"]:$.endsWith("em")?[Z,"em"]:$.endsWith("vh")?[Z,"vh"]:$.endsWith("vw")?[Z,"vw"]:[Z,"%"]}}}function Sz({groupSize:$,panelElement:Z,styleProp:J}){let H,[B,Q]=Qq0(J);switch(Q){case"%":{H=B/100*$;break}case"px":{H=B;break}case"rem":{H=Jq0(Z,B);break}case"em":{H=Zq0(Z,B);break}case"vh":{H=Hq0(B);break}case"vw":{H=Bq0(B);break}}return H}function r4($){return parseFloat($.toFixed(3))}function LB({group:$}){let{orientation:Z,panels:J}=$;return J.reduce((H,B)=>(H+=Z==="horizontal"?B.element.offsetWidth:B.element.offsetHeight,H),0)}function AT($){let{panels:Z}=$,J=LB({group:$});return J===0?Z.map((H)=>({groupResizeBehavior:H.panelConstraints.groupResizeBehavior,collapsedSize:0,collapsible:H.panelConstraints.collapsible===!0,defaultSize:void 0,disabled:H.panelConstraints.disabled,minSize:0,maxSize:100,panelId:H.id})):Z.map((H)=>{let{element:B,panelConstraints:Q}=H,X=0;if(Q.collapsedSize!==void 0){let Y=Sz({groupSize:J,panelElement:B,styleProp:Q.collapsedSize});X=r4(Y/J*100)}let z;if(Q.defaultSize!==void 0){let Y=Sz({groupSize:J,panelElement:B,styleProp:Q.defaultSize});z=r4(Y/J*100)}let G=0;if(Q.minSize!==void 0){let Y=Sz({groupSize:J,panelElement:B,styleProp:Q.minSize});G=r4(Y/J*100)}let U=100;if(Q.maxSize!==void 0){let Y=Sz({groupSize:J,panelElement:B,styleProp:Q.maxSize});U=r4(Y/J*100)}return{groupResizeBehavior:Q.groupResizeBehavior,collapsedSize:X,collapsible:Q.collapsible===!0,defaultSize:z,disabled:Q.disabled,minSize:G,maxSize:U,panelId:H.id}})}function E5($,Z="Assertion error"){if(!$)throw Error(Z)}function DT($,Z){return Array.from(Z).sort($==="horizontal"?Xq0:zq0)}function Xq0($,Z){let J=$.element.offsetLeft-Z.element.offsetLeft;return J!==0?J:$.element.offsetWidth-Z.element.offsetWidth}function zq0($,Z){let J=$.element.offsetTop-Z.element.offsetTop;return J!==0?J:$.element.offsetHeight-Z.element.offsetHeight}function St($){return $!==null&&typeof $=="object"&&"nodeType"in $&&$.nodeType===Node.ELEMENT_NODE}function Rt($,Z){return{x:$.x>=Z.left&&$.x<=Z.right?0:Math.min(Math.abs($.x-Z.left),Math.abs($.x-Z.right)),y:$.y>=Z.top&&$.y<=Z.bottom?0:Math.min(Math.abs($.y-Z.top),Math.abs($.y-Z.bottom))}}function Gq0({orientation:$,rects:Z,targetRect:J}){let H={x:J.x+J.width/2,y:J.y+J.height/2},B,Q=Number.MAX_VALUE;for(let X of Z){let{x:z,y:G}=Rt(H,X),U=$==="horizontal"?z:G;U<Q&&(Q=U,B=X)}return E5(B,"No rect found"),B}var uq;function Uq0(){return uq===void 0&&(typeof matchMedia=="function"?uq=!!matchMedia("(pointer:coarse)").matches:uq=!1),uq}function It($){let{element:Z,orientation:J,panels:H,separators:B}=$,Q=DT(J,Array.from(Z.children).filter(St).map((N)=>({element:N}))).map(({element:N})=>N),X=[],z=!1,G=!1,U=-1,Y=-1,F=0,K,W=[];{let N=-1;for(let q of Q)q.hasAttribute("data-panel")&&(N++,q.hasAttribute("data-disabled")||(F++,U===-1&&(U=N),Y=N))}if(F>1){let N=-1;for(let q of Q)if(q.hasAttribute("data-panel")){N++;let D=H.find((A)=>A.element===q);if(D){if(K){let A=K.element.getBoundingClientRect(),V=q.getBoundingClientRect(),L;if(G){let O=J==="horizontal"?new DOMRect(A.right,A.top,0,A.height):new DOMRect(A.left,A.bottom,A.width,0),M=J==="horizontal"?new DOMRect(V.left,V.top,0,V.height):new DOMRect(V.left,V.top,V.width,0);switch(W.length){case 0:{L=[O,M];break}case 1:{let _=W[0],w=Gq0({orientation:J,rects:[A,V],targetRect:_.element.getBoundingClientRect()});L=[_,w===A?M:O];break}default:{L=W;break}}}else W.length?L=W:L=[J==="horizontal"?new DOMRect(A.right,V.top,V.left-A.right,V.height):new DOMRect(V.left,A.bottom,V.width,V.top-A.bottom)];for(let O of L){let M="width"in O?O:O.element.getBoundingClientRect(),_=Uq0()?$.resizeTargetMinimumSize.coarse:$.resizeTargetMinimumSize.fine;if(M.width<_){let C=_-M.width;M=new DOMRect(M.x-C/2,M.y,M.width+C,M.height)}if(M.height<_){let C=_-M.height;M=new DOMRect(M.x,M.y-C/2,M.width,M.height+C)}let w=N<=U||N>Y;!z&&!w&&X.push({group:$,groupSize:LB({group:$}),panels:[K,D],separator:"width"in O?void 0:O,rect:M}),z=!1}}G=!1,K=D,W=[]}}else if(q.hasAttribute("data-separator")){q.ariaDisabled!==null&&(z=!0);let D=B.find((A)=>A.element===q);D?W.push(D):(K=void 0,W=[])}else G=!0}return X}class VT{#$={};addListener($,Z){let J=this.#$[$];return J===void 0?this.#$[$]=[Z]:J.includes(Z)||J.push(Z),()=>{this.removeListener($,Z)}}emit($,Z){let J=this.#$[$];if(J!==void 0)if(J.length===1)J[0].call(null,Z);else{let H=!1,B=null,Q=Array.from(J);for(let X=0;X<Q.length;X++){let z=Q[X];try{z.call(null,Z)}catch(G){B===null&&(H=!0,B=G)}}if(H)throw B}}removeAllListeners(){this.#$={}}removeListener($,Z){let J=this.#$[$];if(J!==void 0){let H=J.indexOf(Z);H>=0&&J.splice(H,1)}}}var AB={cursorFlags:0,state:"inactive"},LT=new VT;function RZ(){return AB}function Yq0($){return LT.addListener("change",$)}function Fq0($){let Z=AB,J={...AB};J.cursorFlags=$,AB=J,LT.emit("change",{prev:Z,next:J})}function DB($){let Z=AB;AB=$,LT.emit("change",{prev:Z,next:$})}var Kq0=($)=>$,qT=()=>{},kt=1,yt=2,xt=4,ht=8,Wt=3,Nt=12,pq;function qt(){return pq===void 0&&(pq=!1,typeof window<"u"&&(window.navigator.userAgent.includes("Chrome")||window.navigator.userAgent.includes("Firefox"))&&(pq=!0)),pq}function Wq0({cursorFlags:$,groups:Z,state:J}){let H=0,B=0;switch(J){case"active":case"hover":Z.forEach((Q)=>{if(!Q.mutableState.disableCursor)switch(Q.orientation){case"horizontal":{H++;break}case"vertical":{B++;break}}})}if(!(H===0&&B===0)){switch(J){case"active":{if($&&qt()){let Q=($&kt)!==0,X=($&yt)!==0,z=($&xt)!==0,G=($&ht)!==0;if(Q)return z?"se-resize":G?"ne-resize":"e-resize";if(X)return z?"sw-resize":G?"nw-resize":"w-resize";if(z)return"s-resize";if(G)return"n-resize"}break}}return qt()?H>0&&B>0?"move":H>0?"ew-resize":"ns-resize":H>0&&B>0?"grab":H>0?"col-resize":"row-resize"}}var At=new WeakMap;function MT($){if(!$.defaultView||!$.adoptedStyleSheets)return;let{prevStyle:Z,styleSheet:J}=At.get($)??{};J===void 0&&(J=new $.defaultView.CSSStyleSheet,$.adoptedStyleSheets&&(Object.isExtensible($.adoptedStyleSheets)?$.adoptedStyleSheets.push(J):$.adoptedStyleSheets=[...$.adoptedStyleSheets,J]));let H=RZ();switch(H.state){case"active":case"hover":{let B=Wq0({cursorFlags:H.cursorFlags,groups:H.hitRegions.map((X)=>X.group),state:H.state}),Q=`*, *:hover {cursor: ${B} !important; }`;if(Z===Q)return;Z=Q,B?J.cssRules.length===0?J.insertRule(Q):J.replaceSync(Q):J.cssRules.length===1&&J.deleteRule(0);break}case"inactive":{Z=void 0,J.cssRules.length===1&&J.deleteRule(0);break}}At.set($,{prevStyle:Z,styleSheet:J})}var I3=new Map,vt=new VT;function Nq0($){I3=new Map(I3),I3.delete($)}function Dt($,Z){for(let[J]of I3)if(J.id===$)return J}function Z$($,Z){for(let[J,H]of I3)if(J.id===$)return H;if(Z)throw Error(`Could not find data for Group with id ${$}`)}function J$(){return I3}function PT($,Z){return vt.addListener("groupChange",(J)=>{J.group.id===$&&Z(J)})}function D6($,Z,J){let H=I3.get($);I3=new Map(I3),I3.set($,Z),vt.emit("groupChange",{group:$,isUserInteraction:J?.isUserInteraction===!0,prev:H,next:Z})}function ft($){let Z=RZ(),J=J$(),H=!1;switch(Z.state){case"active":DB({cursorFlags:0,state:"inactive"}),Z.hitRegions.length>0&&(MT($),H=!0,Z.hitRegions.forEach((B)=>{if(!J.has(B.group))return;let Q=Z$(B.group.id,!0);D6(B.group,Q,{isUserInteraction:!0})}))}return H}function Vt($){$.defaultPrevented||ft($.currentTarget)}function qq0($,Z,J){let H,B={x:1/0,y:1/0};for(let Q of Z){let X=Rt(J,Q.rect);switch($){case"horizontal":{X.x<=B.x&&(H=Q,B=X);break}case"vertical":{X.y<=B.y&&(H=Q,B=X);break}}}return H?{distance:B,hitRegion:H}:void 0}function Aq0($){return $!==null&&typeof $=="object"&&"nodeType"in $&&$.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function Dq0($,Z){if($===Z)throw Error("Cannot compare node with itself");let J={a:Pt($),b:Pt(Z)},H;for(;J.a.at(-1)===J.b.at(-1);)H=J.a.pop(),J.b.pop();E5(H,"Stacking order can only be calculated for elements with a common ancestor");let B={a:Mt(Lt(J.a)),b:Mt(Lt(J.b))};if(B.a===B.b){let Q=H.childNodes,X={a:J.a.at(-1),b:J.b.at(-1)},z=Q.length;for(;z--;){let G=Q[z];if(G===X.a)return 1;if(G===X.b)return-1}}return Math.sign(B.a-B.b)}var Vq0=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function Lq0($){let Z=getComputedStyle(gt($)??$).display;return Z==="flex"||Z==="inline-flex"}function Mq0($){let Z=getComputedStyle($);return!!(Z.position==="fixed"||Z.zIndex!=="auto"&&(Z.position!=="static"||Lq0($))||+Z.opacity<1||("transform"in Z)&&Z.transform!=="none"||("webkitTransform"in Z)&&Z.webkitTransform!=="none"||("mixBlendMode"in Z)&&Z.mixBlendMode!=="normal"||("filter"in Z)&&Z.filter!=="none"||("webkitFilter"in Z)&&Z.webkitFilter!=="none"||("isolation"in Z)&&Z.isolation==="isolate"||Vq0.test(Z.willChange)||Z.webkitOverflowScrolling==="touch")}function Lt($){let Z=$.length;for(;Z--;){let J=$[Z];if(E5(J,"Missing node"),Mq0(J))return J}return null}function Mt($){return $&&Number(getComputedStyle($).zIndex)||0}function Pt($){let Z=[];for(;$;)Z.push($),$=gt($);return Z}function gt($){let{parentNode:Z}=$;return Aq0(Z)?Z.host:Z}function Pq0($,Z){return $.x<Z.x+Z.width&&$.x+$.width>Z.x&&$.y<Z.y+Z.height&&$.y+$.height>Z.y}function _q0({groupElement:$,hitRegion:Z,pointerEventTarget:J}){if(!St(J)||J.contains($)||$.contains(J))return!0;if(Dq0(J,$)>0){let H=J;for(;H;){if(H.contains($))return!0;if(Pq0(H.getBoundingClientRect(),Z))return!1;H=H.parentElement}}return!0}function _T($,Z){let J=[];return Z.forEach((H,B)=>{if(B.disabled)return;let Q=It(B),X=qq0(B.orientation,Q,{x:$.clientX,y:$.clientY});X&&X.distance.x<=0&&X.distance.y<=0&&_q0({groupElement:B.element,hitRegion:X.hitRegion.rect,pointerEventTarget:$.target})&&J.push(X.hitRegion)}),J}function Oq0($,Z){if($.length!==Z.length)return!1;for(let J=0;J<$.length;J++)if($[J]!=Z[J])return!1;return!0}function R4($,Z,J=0){return Math.abs(r4($)-r4(Z))<=J}function R3($,Z){return R4($,Z)?0:$>Z?1:-1}function qB({overrideDisabledPanels:$,panelConstraints:Z,prevSize:J,size:H}){let{collapsedSize:B=0,collapsible:Q,disabled:X,maxSize:z=100,minSize:G=0}=Z;if(X&&!$)return J;if(R3(H,G)<0)if(Q){let U=(B+G)/2;R3(H,U)<0?H=B:H=G}else H=G;return H=Math.min(z,H),H=r4(H),H}function Iz({delta:$,initialLayout:Z,panelConstraints:J,pivotIndices:H,prevLayout:B,trigger:Q}){if(R4($,0))return Z;let X=Q==="imperative-api",z=Object.values(Z),G=Object.values(B),U=[...z],[Y,F]=H;E5(Y!=null,"Invalid first pivot index"),E5(F!=null,"Invalid second pivot index");let K=0;switch(Q){case"keyboard":{{let q=$<0?F:Y,D=J[q];E5(D,`Panel constraints not found for index ${q}`);let{collapsedSize:A=0,collapsible:V,minSize:L=0}=D;if(V){let O=z[q];if(E5(O!=null,`Previous layout not found for panel index ${q}`),R4(O,A)){let M=L-O;R3(M,Math.abs($))>0&&($=$<0?0-M:M)}}}{let q=$<0?Y:F,D=J[q];E5(D,`No panel constraints found for index ${q}`);let{collapsedSize:A=0,collapsible:V,minSize:L=0}=D;if(V){let O=z[q];if(E5(O!=null,`Previous layout not found for panel index ${q}`),R4(O,L)){let M=O-A;R3(M,Math.abs($))>0&&($=$<0?0-M:M)}}}break}default:{let q=$<0?F:Y,D=J[q];E5(D,`Panel constraints not found for index ${q}`);let A=z[q],{collapsible:V,collapsedSize:L,minSize:O}=D;if(V&&R3(A,O)<0)if($>0){let M=O-L,_=M/2,w=A+$;R3(w,O)<0&&($=R3($,_)<=0?0:M)}else{let M=O-L,_=100-M/2,w=A-$;R3(w,O)<0&&($=R3(100+$,_)>0?0:-M)}break}}{let q=$<0?1:-1,D=$<0?F:Y,A=0;for(;;){let L=z[D];E5(L!=null,`Previous layout not found for panel index ${D}`);let O=qB({overrideDisabledPanels:X,panelConstraints:J[D],prevSize:L,size:100})-L;if(A+=O,D+=q,D<0||D>=J.length)break}let V=Math.min(Math.abs($),Math.abs(A));$=$<0?0-V:V}{let q=$<0?Y:F;for(;q>=0&&q<J.length;){let D=Math.abs($)-Math.abs(K),A=z[q];E5(A!=null,`Previous layout not found for panel index ${q}`);let V=A-D,L=qB({overrideDisabledPanels:X,panelConstraints:J[q],prevSize:A,size:V});if(!R4(A,L)&&(K+=A-L,U[q]=L,K.toFixed(3).localeCompare(Math.abs($).toFixed(3),void 0,{numeric:!0})>=0))break;$<0?q--:q++}}if(Oq0(G,U))return B;{let q=$<0?F:Y,D=z[q];E5(D!=null,`Previous layout not found for panel index ${q}`);let A=D+K,V=qB({overrideDisabledPanels:X,panelConstraints:J[q],prevSize:D,size:A});if(U[q]=V,!R4(V,A)){let L=A-V,O=$<0?F:Y;for(;O>=0&&O<J.length;){let M=U[O];E5(M!=null,`Previous layout not found for panel index ${O}`);let _=M+L,w=qB({overrideDisabledPanels:X,panelConstraints:J[O],prevSize:M,size:_});if(R4(M,w)||(L-=w-M,U[O]=w),R4(L,0))break;$>0?O--:O++}}}let W=Object.values(U).reduce((q,D)=>D+q,0);if(!R4(W,100,0.1))return B;let N=Object.keys(B);return U.reduce((q,D,A)=>(q[N[A]]=D,q),{})}function IZ($,Z){if(Object.keys($).length!==Object.keys(Z).length)return!1;for(let J in $)if(Z[J]===void 0||R3($[J],Z[J])!==0)return!1;return!0}function kZ({layout:$,panelConstraints:Z}){let J=Object.values($),H=[...J],B=H.reduce((z,G)=>z+G,0);if(H.length!==Z.length)throw Error(`Invalid ${Z.length} panel layout: ${H.map((z)=>`${z}%`).join(", ")}`);if(!R4(B,100)&&H.length>0)for(let z=0;z<Z.length;z++){let G=H[z];E5(G!=null,`No layout data found for index ${z}`);let U=100/B*G;H[z]=U}let Q=0;for(let z=0;z<Z.length;z++){let G=J[z];E5(G!=null,`No layout data found for index ${z}`);let U=H[z];E5(U!=null,`No layout data found for index ${z}`);let Y=qB({overrideDisabledPanels:!0,panelConstraints:Z[z],prevSize:G,size:U});U!=Y&&(Q+=U-Y,H[z]=Y)}if(!R4(Q,0))for(let z=0;z<Z.length;z++){let G=H[z];E5(G!=null,`No layout data found for index ${z}`);let U=G+Q,Y=qB({overrideDisabledPanels:!0,panelConstraints:Z[z],prevSize:G,size:U});if(G!==Y&&(Q-=Y-G,H[z]=Y,R4(Q,0)))break}let X=Object.keys($);return H.reduce((z,G,U)=>(z[X[U]]=G,z),{})}function mt({groupId:$,panelId:Z}){let J=()=>{let G=J$();for(let[U,{defaultLayoutDeferred:Y,derivedPanelConstraints:F,layout:K,groupSize:W,separatorToPanels:N}]of G)if(U.id===$)return{defaultLayoutDeferred:Y,derivedPanelConstraints:F,group:U,groupSize:W,layout:K,separatorToPanels:N};throw Error(`Group ${$} not found`)},H=()=>{let G=J().derivedPanelConstraints.find((U)=>U.panelId===Z);if(G!==void 0)return G;throw Error(`Panel constraints not found for Panel ${Z}`)},B=()=>{let G=J().group.panels.find((U)=>U.id===Z);if(G!==void 0)return G;throw Error(`Layout not found for Panel ${Z}`)},Q=()=>{let G=J().layout[Z];if(G!==void 0)return G;throw Error(`Layout not found for Panel ${Z}`)},X=({nextSize:G,panels:U,prevLayout:Y,derivedPanelConstraints:F})=>{let K=Q(),W=U.findIndex((D)=>D.id===Z),N=W===0,q=W===U.length-1;if(q&&G<K&&(N||U.slice(0,W).every((D,A)=>{let V=F[A];return V?.collapsible&&R4(V.collapsedSize,Y[V.panelId])}))){let D=U.slice(0,W).reduce((A,V)=>A+Y[V.id],0);return{...Y,[Z]:r4(100-D)}}return Iz({delta:q?K-G:G-K,initialLayout:Y,panelConstraints:F,pivotIndices:q?[W-1,W]:[W,W+1],prevLayout:Y,trigger:"imperative-api"})},z=(G)=>{let U=Q();if(G===U)return;let{defaultLayoutDeferred:Y,derivedPanelConstraints:F,group:K,groupSize:W,layout:N,separatorToPanels:q}=J(),D=X({nextSize:G,panels:K.panels,prevLayout:N,derivedPanelConstraints:F}),A=kZ({layout:D,panelConstraints:F});IZ(N,A)||D6(K,{defaultLayoutDeferred:Y,derivedPanelConstraints:F,groupSize:W,layout:A,separatorToPanels:q})};return{collapse:()=>{let{collapsible:G,collapsedSize:U}=H(),{mutableValues:Y}=B(),F=Q();G&&F!==U&&(Y.expandToSize=F,z(U))},expand:()=>{let{collapsible:G,collapsedSize:U,minSize:Y}=H(),{mutableValues:F}=B(),K=Q();if(G&&K===U){let W=F.expandToSize??Y;W===0&&(W=1),z(W)}},getSize:()=>{let{group:G}=J(),U=Q(),{element:Y}=B(),F=G.orientation==="horizontal"?Y.offsetWidth:Y.offsetHeight;return{asPercentage:U,inPixels:F}},isCollapsed:()=>{let{collapsible:G,collapsedSize:U}=H(),Y=Q();return G&&R4(U,Y)},resize:(G)=>{let{group:U}=J(),{element:Y}=B(),F=LB({group:U}),K=Sz({groupSize:F,panelElement:Y,styleProp:G}),W=r4(K/F*100);z(W)}}}function _t($){if($.defaultPrevented)return;let Z=J$();_T($,Z).forEach((J)=>{if(J.separator&&!J.separator.disableDoubleClick){let H=J.panels.find((B)=>B.panelConstraints.defaultSize!==void 0);if(H){let B=H.panelConstraints.defaultSize,Q=mt({groupId:J.group.id,panelId:H.id});Q&&B!==void 0&&(Q.resize(B),$.preventDefault())}}})}function cq($){let Z=J$();for(let[J]of Z)if(J.separators.some((H)=>H.element===$))return J;throw Error("Could not find parent Group for separator element")}function ut({groupId:$}){let Z=()=>{let J=J$();for(let[H,B]of J)if(H.id===$)return{group:H,...B};throw Error(`Could not find Group with id "${$}"`)};return{getLayout(){let{defaultLayoutDeferred:J,layout:H}=Z();return J?{}:H},setLayout(J){let{defaultLayoutDeferred:H,derivedPanelConstraints:B,group:Q,groupSize:X,layout:z,separatorToPanels:G}=Z(),U=kZ({layout:J,panelConstraints:B});return H?z:(IZ(z,U)||D6(Q,{defaultLayoutDeferred:H,derivedPanelConstraints:B,groupSize:X,layout:U,separatorToPanels:G}),U)}}}function SZ($,Z){let J=cq($),H=Z$(J.id,!0),B=J.separators.find((Y)=>Y.element===$);E5(B,"Matching separator not found");let Q=H.separatorToPanels.get(B);E5(Q,"Matching panels not found");let X=Q.map((Y)=>J.panels.indexOf(Y)),z=ut({groupId:J.id}).getLayout(),G=Iz({delta:Z,initialLayout:z,panelConstraints:H.derivedPanelConstraints,pivotIndices:X,prevLayout:z,trigger:"keyboard"}),U=kZ({layout:G,panelConstraints:H.derivedPanelConstraints});IZ(z,U)||D6(J,{defaultLayoutDeferred:H.defaultLayoutDeferred,derivedPanelConstraints:H.derivedPanelConstraints,groupSize:H.groupSize,layout:U,separatorToPanels:H.separatorToPanels},{isUserInteraction:!0})}function Ot($){if($.defaultPrevented)return;let Z=$.currentTarget,J=cq(Z);if(!J.disabled)switch($.key){case"ArrowDown":{$.preventDefault(),J.orientation==="vertical"&&SZ(Z,5);break}case"ArrowLeft":{$.preventDefault(),J.orientation==="horizontal"&&SZ(Z,-5);break}case"ArrowRight":{$.preventDefault(),J.orientation==="horizontal"&&SZ(Z,5);break}case"ArrowUp":{$.preventDefault(),J.orientation==="vertical"&&SZ(Z,-5);break}case"End":{$.preventDefault(),SZ(Z,100);break}case"Enter":{$.preventDefault();let H=cq(Z),B=Z$(H.id,!0),{derivedPanelConstraints:Q,layout:X,separatorToPanels:z}=B,G=H.separators.find((K)=>K.element===Z);E5(G,"Matching separator not found");let U=z.get(G);E5(U,"Matching panels not found");let Y=U[0],F=Q.find((K)=>K.panelId===Y.id);if(E5(F,"Panel metadata not found"),F.collapsible){let K=X[Y.id],W=F.collapsedSize===K?H.mutableState.expandedPanelSizes[Y.id]??F.minSize:F.collapsedSize;SZ(Z,W-K)}break}case"F6":{$.preventDefault();let H=cq(Z).separators.map((X)=>X.element),B=Array.from(H).findIndex((X)=>X===$.currentTarget);E5(B!==null,"Index not found");let Q=$.shiftKey?B>0?B-1:H.length-1:B+1<H.length?B+1:0;H[Q].focus({preventScroll:!0});break}case"Home":{$.preventDefault(),SZ(Z,-100);break}}}function Tt($){if($.defaultPrevented)return;if($.pointerType==="mouse"&&$.button>0)return;let Z=J$(),J=_T($,Z),H=new Map,B=!1;J.forEach((Q)=>{Q.separator&&(B||(B=!0,Q.separator.element.focus({focusVisible:!1,preventScroll:!0})));let X=Z.get(Q.group);X&&H.set(Q.group,X.layout)}),DB({cursorFlags:0,hitRegions:J,initialLayoutMap:H,pointerDownAtPoint:{x:$.clientX,y:$.clientY},state:"active"}),J.length&&$.preventDefault()}function pt({document:$,event:Z,hitRegions:J,initialLayoutMap:H,mountedGroups:B,pointerDownAtPoint:Q,prevCursorFlags:X}){let z=0;J.forEach((U)=>{let{group:Y,groupSize:F}=U,{orientation:K,panels:W}=Y,{disableCursor:N}=Y.mutableState,q=0;Q?K==="horizontal"?q=(Z.clientX-Q.x)/F*100:q=(Z.clientY-Q.y)/F*100:K==="horizontal"?q=Z.clientX<0?-100:100:q=Z.clientY<0?-100:100;let D=H.get(Y),A=B.get(Y);if(!D||!A)return;let{defaultLayoutDeferred:V,derivedPanelConstraints:L,groupSize:O,layout:M,separatorToPanels:_}=A;if(L&&M&&_){let w=Iz({delta:q,initialLayout:D,panelConstraints:L,pivotIndices:U.panels.map((C)=>W.indexOf(C)),prevLayout:M,trigger:"mouse-or-touch"});if(IZ(w,M)){if(q!==0&&!N)switch(K){case"horizontal":{z|=q<0?kt:yt;break}case"vertical":{z|=q<0?xt:ht;break}}}else D6(U.group,{defaultLayoutDeferred:V,derivedPanelConstraints:L,groupSize:O,layout:w,separatorToPanels:_})}});let G=0;Z.movementX===0?G|=X&Wt:G|=z&Wt,Z.movementY===0?G|=X&Nt:G|=z&Nt,Fq0(G),MT($)}function jt($){let Z=J$(),J=RZ();switch(J.state){case"active":pt({document:$.currentTarget,event:$,hitRegions:J.hitRegions,initialLayoutMap:J.initialLayoutMap,mountedGroups:Z,prevCursorFlags:J.cursorFlags})}}function Ct($){if($.defaultPrevented)return;let Z=RZ(),J=J$();switch(Z.state){case"active":{if($.buttons===0){DB({cursorFlags:0,state:"inactive"}),Z.hitRegions.forEach((H)=>{if(!J.has(H.group))return;let B=Z$(H.group.id,!0);D6(H.group,B,{isUserInteraction:!0})});return}for(let H of Z.hitRegions)if(H.separator){let{element:B}=H.separator;B.isConnected&&!B.hasPointerCapture?.($.pointerId)&&B.setPointerCapture?.($.pointerId)}pt({document:$.currentTarget,event:$,hitRegions:Z.hitRegions,initialLayoutMap:Z.initialLayoutMap,mountedGroups:J,pointerDownAtPoint:Z.pointerDownAtPoint,prevCursorFlags:Z.cursorFlags});break}default:{let H=_T($,J);H.length===0?Z.state!=="inactive"&&DB({cursorFlags:0,state:"inactive"}):DB({cursorFlags:0,hitRegions:H,state:"hover"}),MT($.currentTarget);break}}}function Et($){if($.relatedTarget instanceof HTMLIFrameElement)switch(RZ().state){case"hover":DB({cursorFlags:0,state:"inactive"})}}function bt($){if($.defaultPrevented)return;if($.pointerType==="mouse"&&$.button>0)return;ft($.currentTarget)&&$.preventDefault()}function wt($){let Z=0,J=0,H={};for(let Q of $)if(Q.defaultSize!==void 0){Z++;let X=r4(Q.defaultSize);J+=X,H[Q.panelId]=X}else H[Q.panelId]=void 0;let B=$.length-Z;if(B!==0){let Q=r4((100-J)/B);for(let X of $)X.defaultSize===void 0&&(H[X.panelId]=Q)}return H}function Tq0($,Z,J){if(!J[0])return;let H=$.panels.find((G)=>G.element===Z);if(!H||!H.onResize)return;let B=LB({group:$}),Q=$.orientation==="horizontal"?H.element.offsetWidth:H.element.offsetHeight,X=H.mutableValues.prevSize,z={asPercentage:r4(Q/B*100),inPixels:Q};H.mutableValues.prevSize=z,H.onResize(z,H.id,X)}function jq0($,Z){if(Object.keys($).length!==Object.keys(Z).length)return!1;for(let J in $)if($[J]!==Z[J])return!1;return!0}function Cq0($,Z){return $.length!==Z.length?!1:$.every((J,H)=>jq0(J,Z[H]))}function Eq0({group:$,nextGroupSize:Z,prevGroupSize:J,prevLayout:H}){if(J<=0||Z<=0||J===Z)return H;let B=0,Q=0,X=!1,z=new Map,G=[];for(let F of $.panels){let K=H[F.id]??0;switch(F.panelConstraints.groupResizeBehavior){case"preserve-pixel-size":{X=!0;let W=K/100*J,N=r4(W/Z*100);z.set(F.id,N),B+=N;break}case"preserve-relative-size":default:{G.push(F.id),Q+=K;break}}}if(!X||G.length===0)return H;let U=100-B,Y={...H};if(z.forEach((F,K)=>{Y[K]=F}),Q>0)for(let F of G){let K=H[F]??0;Y[F]=r4(K/Q*U)}else{let F=r4(U/G.length);for(let K of G)Y[K]=F}return Y}function bq0($,Z){let J=$.map((B)=>B.id),H=Object.keys(Z);if(J.length!==H.length)return!1;for(let B of J)if(!H.includes(B))return!1;return!0}var NB=new Map;function wq0($){let Z=!0;E5($.element.ownerDocument.defaultView,"Cannot register an unmounted Group");let J=$.element.ownerDocument.defaultView.ResizeObserver,H=new Set,B=new Set,Q=new J((N)=>{for(let q of N){let{borderBoxSize:D,target:A}=q;if(A===$.element){if(Z){let V=LB({group:$});if(V===0)return;let L=Z$($.id);if(!L)return;let O=AT($),M=L.defaultLayoutDeferred?wt(O):L.layout,_=Eq0({group:$,nextGroupSize:V,prevGroupSize:L.groupSize,prevLayout:M}),w=kZ({layout:_,panelConstraints:O});if(!L.defaultLayoutDeferred&&IZ(L.layout,w)&&Cq0(L.derivedPanelConstraints,O)&&L.groupSize===V)continue;D6($,{defaultLayoutDeferred:!1,derivedPanelConstraints:O,groupSize:V,layout:w,separatorToPanels:L.separatorToPanels})}}else Tq0($,A,D)}});Q.observe($.element),$.panels.forEach((N)=>{E5(!H.has(N.id),`Panel ids must be unique; id "${N.id}" was used more than once`),H.add(N.id),N.onResize&&Q.observe(N.element)});let X=LB({group:$}),z=AT($),G=$.panels.map(({id:N})=>N).join(","),U=$.mutableState.defaultLayout;U&&(bq0($.panels,U)||(U=void 0));let Y=$.mutableState.layouts[G]??U??wt(z),F=kZ({layout:Y,panelConstraints:z}),K=$.element.ownerDocument;NB.set(K,(NB.get(K)??0)+1);let W=new Map;return It($).forEach((N)=>{N.separator&&W.set(N.separator,N.panels)}),D6($,{defaultLayoutDeferred:X===0,derivedPanelConstraints:z,groupSize:X,layout:F,separatorToPanels:W}),$.separators.forEach((N)=>{E5(!B.has(N.id),`Separator ids must be unique; id "${N.id}" was used more than once`),B.add(N.id),N.element.addEventListener("keydown",Ot)}),NB.get(K)===1&&(K.addEventListener("contextmenu",Vt,!0),K.addEventListener("dblclick",_t,!0),K.addEventListener("pointerdown",Tt,!0),K.addEventListener("pointerleave",jt),K.addEventListener("pointermove",Ct),K.addEventListener("pointerout",Et),K.addEventListener("pointerup",bt,!0)),function(){Z=!1,NB.set(K,Math.max(0,(NB.get(K)??0)-1)),Nq0($),$.separators.forEach((N)=>{N.element.removeEventListener("keydown",Ot)}),NB.get(K)||(K.removeEventListener("contextmenu",Vt,!0),K.removeEventListener("dblclick",_t,!0),K.removeEventListener("pointerdown",Tt,!0),K.removeEventListener("pointerleave",jt),K.removeEventListener("pointermove",Ct),K.removeEventListener("pointerout",Et),K.removeEventListener("pointerup",bt,!0)),Q.disconnect()}}function Sq0(){let[$,Z]=y1.useState({}),J=y1.useCallback(()=>Z({}),[]);return[$,J]}function OT($){let Z=y1.useId();return`${$??Z}`}var yZ=typeof window<"u"?y1.useLayoutEffect:y1.useEffect;function Rz($){let Z=y1.useRef($);return yZ(()=>{Z.current=$},[$]),y1.useCallback((...J)=>Z.current?.(...J),[Z])}function TT(...$){return Rz((Z)=>{$.forEach((J)=>{if(J)switch(typeof J){case"function":{J(Z);break}case"object":{J.current=Z;break}}})})}function jT($){let Z=y1.useRef({...$});return yZ(()=>{for(let J in $)Z.current[J]=$[J]},[$]),Z.current}var ct=y1.createContext(null);function Rq0($,Z){let J=y1.useRef({getLayout:()=>({}),setLayout:Kq0});y1.useImperativeHandle(Z,()=>J.current,[]),yZ(()=>{Object.assign(J.current,ut({groupId:$}))})}function CT({children:$,className:Z,defaultLayout:J,disableCursor:H,disabled:B,elementRef:Q,groupRef:X,id:z,onLayoutChange:G,onLayoutChanged:U,orientation:Y="horizontal",resizeTargetMinimumSize:F={coarse:20,fine:10},style:K,...W}){let N=y1.useRef({onLayoutChange:{},onLayoutChanged:{}}),q=Rz((k)=>{IZ(N.current.onLayoutChange,k)||(N.current.onLayoutChange=k,G?.(k))}),D=Rz((k,S)=>{IZ(N.current.onLayoutChanged,k)||(N.current.onLayoutChanged=k,U?.(k,{isUserInteraction:S}))}),A=OT(z),V=y1.useRef(null),[L,O]=Sq0(),M=y1.useRef({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:F,separators:[]}),_=TT(V,Q);Rq0(A,X);let w=Rz((k,S)=>{let I=RZ(),j=Dt(k),y=Z$(k);if(y){let R=!1;switch(I.state){case"active":{R=I.hitRegions.some((x)=>x.group===j);break}}return{flexGrow:y.layout[S]??1,pointerEvents:R?"none":void 0}}if(J?.[S])return{flexGrow:J?.[S]}}),C=jT({defaultLayout:J,disableCursor:H}),E=y1.useMemo(()=>({get disableCursor(){return!!C.disableCursor},getPanelStyles:w,id:A,orientation:Y,registerPanel:(k)=>{let S=M.current;return S.panels=DT(Y,[...S.panels,k]),O(),()=>{S.panels=S.panels.filter((I)=>I!==k),O()}},registerSeparator:(k)=>{let S=M.current;return S.separators=DT(Y,[...S.separators,k]),O(),()=>{S.separators=S.separators.filter((I)=>I!==k),O()}},updatePanelProps:(k,{disabled:S})=>{let I=M.current.panels.find((R)=>R.id===k);I&&(I.panelConstraints.disabled=S);let j=Dt(A),y=Z$(A);j&&y&&D6(j,{...y,derivedPanelConstraints:AT(j)})},updateSeparatorProps:(k,{disabled:S,disableDoubleClick:I})=>{let j=M.current.separators.find((y)=>y.id===k);j&&(j.disabled=S,j.disableDoubleClick=I)}}),[w,A,O,Y,C]),T=y1.useRef(null);return yZ(()=>{let k=V.current;if(k===null)return;let S=M.current,I;if(C.defaultLayout!==void 0&&Object.keys(C.defaultLayout).length===S.panels.length){I={};for(let b of S.panels){let l=C.defaultLayout[b.id];l!==void 0&&(I[b.id]=l)}}let j={disabled:!!B,element:k,id:A,mutableState:{defaultLayout:I,disableCursor:!!C.disableCursor,expandedPanelSizes:M.current.lastExpandedPanelSizes,layouts:M.current.layouts},orientation:Y,panels:S.panels,resizeTargetMinimumSize:S.resizeTargetMinimumSize,separators:S.separators};T.current=j;let y=wq0(j),{defaultLayoutDeferred:R,derivedPanelConstraints:x,layout:v}=Z$(j.id,!0);!R&&x.length>0&&(q(v),D(v,!1));let f=PT(A,(b)=>{let{defaultLayoutDeferred:l,derivedPanelConstraints:r,layout:h}=b.next;if(l||r.length===0)return;let d=j.panels.map(({id:c})=>c).join(",");j.mutableState.layouts[d]=h,r.forEach((c)=>{if(c.collapsible){let{layout:i}=b.prev??{};if(i){let n=R4(c.collapsedSize,h[c.panelId]),Z0=R4(c.collapsedSize,i[c.panelId]);n&&!Z0&&(j.mutableState.expandedPanelSizes[c.panelId]=i[c.panelId])}}});let o=RZ().state!=="active";q(h),o&&D(h,b.isUserInteraction)});return()=>{T.current=null,y(),f()}},[B,A,D,q,Y,L,C]),y1.useEffect(()=>{let k=T.current;k&&(k.mutableState.defaultLayout=J,k.mutableState.disableCursor=!!H)}),VB.jsx(ct.Provider,{value:E,children:VB.jsx("div",{...W,className:Z,"data-group":!0,"data-testid":A,id:A,ref:_,style:{height:"100%",width:"100%",overflow:"hidden",...K,display:"flex",flexDirection:Y==="horizontal"?"row":"column",flexWrap:"nowrap",touchAction:Y==="horizontal"?"pan-y":"pan-x"},children:$})})}CT.displayName="Group";function ET(){let $=y1.useContext(ct);return E5($,"Group Context not found; did you render a Panel or Separator outside of a Group?"),$}function Iq0($,Z){let{id:J}=ET(),H=y1.useRef({collapse:qT,expand:qT,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:qT});y1.useImperativeHandle(Z,()=>H.current,[]),yZ(()=>{Object.assign(H.current,mt({groupId:J,panelId:$}))})}function bT({children:$,className:Z,collapsedSize:J="0%",collapsible:H=!1,defaultSize:B,disabled:Q,elementRef:X,groupResizeBehavior:z="preserve-relative-size",id:G,maxSize:U="100%",minSize:Y="0%",onResize:F,panelRef:K,style:W,...N}){let q=!!G,D=OT(G),A=jT({disabled:Q}),V=y1.useRef(null),L=TT(V,X),{getPanelStyles:O,id:M,orientation:_,registerPanel:w,updatePanelProps:C}=ET(),E=F!==null,T=Rz((j,y,R)=>{F?.(j,G,R)});yZ(()=>{let j=V.current;if(j!==null){let y={element:j,id:D,idIsStable:q,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:E?T:void 0,panelConstraints:{groupResizeBehavior:z,collapsedSize:J,collapsible:H,defaultSize:B,disabled:A.disabled,maxSize:U,minSize:Y}};return w(y)}},[z,J,H,B,E,D,q,U,Y,T,w,A]),y1.useEffect(()=>{C(D,{disabled:Q})},[Q,D,C]),Iq0(D,K);let k=()=>{let j=O(M,D);if(j)return JSON.stringify(j)},S=y1.useSyncExternalStore((j)=>PT(M,j),k,k),I;return S?I=JSON.parse(S):B!==void 0?I={flexGrow:void 0,flexShrink:void 0,flexBasis:B}:I={flexGrow:1},VB.jsx("div",{...N,"data-disabled":Q||void 0,"data-panel":!0,"data-testid":D,id:D,ref:L,style:{...kq0,display:"flex",flexBasis:0,flexShrink:1,overflow:"visible",...I},children:VB.jsx("div",{className:Z,style:{maxHeight:"100%",maxWidth:"100%",flexGrow:1,overflow:"auto",...W,touchAction:_==="horizontal"?"pan-y":"pan-x"},children:$})})}bT.displayName="Panel";var kq0={minHeight:0,maxHeight:"100%",height:"auto",minWidth:0,maxWidth:"100%",width:"auto",border:"none",borderWidth:0,padding:0,margin:0};function yq0({layout:$,panelConstraints:Z,panelId:J,panelIndex:H}){let B,Q,X=$[J],z=Z.find((G)=>G.panelId===J);if(z){let G=z.maxSize,U=z.collapsible?z.collapsedSize:z.minSize,Y=[H,H+1];Q=kZ({layout:Iz({delta:U-X,initialLayout:$,panelConstraints:Z,pivotIndices:Y,prevLayout:$}),panelConstraints:Z})[J],B=kZ({layout:Iz({delta:G-X,initialLayout:$,panelConstraints:Z,pivotIndices:Y,prevLayout:$}),panelConstraints:Z})[J]}return{valueControls:J,valueMax:B,valueMin:Q,valueNow:X}}function wT({children:$,className:Z,disabled:J,disableDoubleClick:H,elementRef:B,id:Q,style:X,...z}){let G=OT(Q),U=jT({disabled:J,disableDoubleClick:H}),[Y,F]=y1.useState({}),[K,W]=y1.useState("inactive"),[N,q]=y1.useState(!1),D=y1.useRef(null),A=TT(D,B),{disableCursor:V,id:L,orientation:O,registerSeparator:M,updateSeparatorProps:_}=ET(),w=O==="horizontal"?"vertical":"horizontal";yZ(()=>{let T=D.current;if(T!==null){let k={disabled:U.disabled,disableDoubleClick:U.disableDoubleClick,element:T,id:G},S=M(k),I=Yq0((y)=>{W(y.next.state!=="inactive"&&y.next.hitRegions.some((R)=>R.separator===k)?y.next.state:"inactive")}),j=PT(L,(y)=>{let{derivedPanelConstraints:R,layout:x,separatorToPanels:v}=y.next,f=v.get(k);if(f){let b=f[0],l=R.findIndex((r)=>r.panelId===b.id);F(yq0({layout:x,panelConstraints:R,panelId:b.id,panelIndex:l}))}});return()=>{I(),j(),S()}}},[L,G,M,U]),y1.useEffect(()=>{_(G,{disabled:J,disableDoubleClick:H})},[J,H,G,_]);let C;J&&!V&&(C="not-allowed");let E;if(J)E="disabled";else switch(K){case"active":{E="active";break}default:N?E="focus":E=K}return VB.jsx("div",{...z,"aria-controls":Y.valueControls,"aria-disabled":J||void 0,"aria-orientation":w,"aria-valuemax":Y.valueMax,"aria-valuemin":Y.valueMin,"aria-valuenow":Y.valueNow,children:$,className:Z,"data-separator":E,"data-testid":G,id:G,onBlur:()=>q(!1),onFocus:()=>q(!0),ref:A,role:"separator",style:{flexBasis:"auto",cursor:C,...X,flexGrow:0,flexShrink:0,touchAction:"none"},tabIndex:J?void 0:0})}wT.displayName="Separator";var dq=P(u(),1);function dt({className:$,...Z}){return dq.jsx(CT,{"data-slot":"resizable-panel-group",className:d0("flex h-full w-full aria-[orientation=vertical]:flex-col",$),...Z})}function ST({...$}){return dq.jsx(bT,{"data-slot":"resizable-panel",...$})}function lt({showDivider:$=!0,className:Z,...J}){return dq.jsx(wT,{"data-slot":"resizable-handle",className:d0("relative flex items-center justify-center ring-offset-background after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:ring-ring focus-visible:outline-hidden aria-[orientation=horizontal]:w-full aria-[orientation=horizontal]:after:left-0 aria-[orientation=horizontal]:after:h-1 aria-[orientation=horizontal]:after:w-full aria-[orientation=horizontal]:after:translate-x-0 aria-[orientation=horizontal]:after:-translate-y-1/2",$?"w-px bg-border aria-[orientation=horizontal]:h-px":"w-0 aria-[orientation=horizontal]:h-0",Z),...J})}var H$=P(u(),1);function it({workspace:$,chat:Z,open:J,workspaceMinWidth:H,chatMinWidth:B,chatMaxWidth:Q,chatWidth:X,onCollapse:z,onChatWidthChange:G}){let U=B$.useRef(null),Y=B$.useRef(null),[F,K]=B$.useState(!1),W=Math.min(Math.max(X,B),Q),[N]=B$.useState(()=>J?W:0);return B$.useLayoutEffect(()=>{let q=U.current;if(!q)return;if(J)q.resize(W);else q.collapse()},[W,J]),H$.jsxs(dt,{orientation:"horizontal",className:Q0("overflow-visible!",F&&"[&>#chat]:transition-[flex-grow] [&>#chat]:duration-200 [&>#chat]:ease-in-out motion-reduce:[&>#chat]:transition-none!",F&&"has-[[data-separator=active]]:[&>#chat]:transition-none!"),onLayoutChanged:(q,D)=>{if(!F&&Y.current===null)Y.current=requestAnimationFrame(()=>{K(!0)});if(D.isUserInteraction)requestAnimationFrame(()=>{let A=U.current;if(!A)return;let V=A.getSize();if(V.inPixels>0)G(Math.round(V.inPixels))})},children:[H$.jsx(ST,{id:"workspace",className:"overflow-visible!",minSize:H,children:H$.jsx("div",{"data-slot":"workspace-split-workspace",className:"flex h-full min-h-0 min-w-0 flex-col",children:$})}),H$.jsx(lt,{"aria-label":"Resize chat",showDivider:!1,hidden:!J,disabled:!J}),H$.jsx(ST,{id:"chat","aria-hidden":!J,inert:!J,collapsible:!0,collapsedSize:0,defaultSize:N,minSize:B,maxSize:Q,groupResizeBehavior:"preserve-pixel-size",panelRef:U,onResize:(q,D,A)=>{if(J&&q.inPixels===0&&A&&A.inPixels>0)z()},className:Q0("overflow-hidden!",F&&"transition-opacity duration-200 ease-in-out motion-reduce:transition-none",J?"opacity-100":"opacity-0"),children:H$.jsx("div",{"data-slot":"workspace-split-chat",className:"flex h-full min-h-0 min-w-(--chat-min) flex-col",children:Z})})]})}var MB=P(u(),1);function lq($=!1){let{layout:Z,setLayout:J}=w1(),{ref:H,fits:B,constraints:Q}=Kt(),X=C1((Y)=>Y.dockedChatWidth),z=C1((Y)=>Y.setDockedChatWidth),G=!$&&B&&Z.layoutMode==="split"?"split":"fullscreen";return{ref:H,canUseSplit:B,constraints:Q,mode:G,setMode:(Y)=>J({layoutMode:Y}),chatWidth:X,setChatWidth:z}}function iq({frame:$,workspace:Z,chat:J,children:H,onClick:B}){let{ref:Q,canUseSplit:X,constraints:z,mode:G,setMode:U,chatWidth:Y,setChatWidth:F}=$;return MB.jsxs("div",{onClick:B,className:"relative flex h-full min-h-0 flex-1 flex-col font-sans text-foreground",children:[MB.jsx("div",{ref:Q,className:"flex min-h-0 flex-1",children:X&&z?MB.jsx(it,{...z,workspace:Z,chat:J,open:G==="split",chatWidth:Y,onCollapse:()=>U("fullscreen"),onChatWidthChange:F}):Z}),H]})}function rq({mode:$,children:Z}){return MB.jsx("div",{"data-slot":"workspace-pane",className:Q0("@container/workspace relative flex h-full min-h-0 min-w-0 flex-1 flex-col-reverse overflow-hidden bg-background shadow-md transition-[border-radius,background-color] duration-100 ease-out motion-reduce:transition-none",$==="split"&&"rounded-xl"),children:Z})}var xZ=P(u(),1);function rt({onOpenOverview:$}){return xZ.jsxs("div",{className:"flex flex-1 flex-col items-center justify-center gap-4 p-6 text-center",children:[xZ.jsxs("div",{className:"flex flex-col items-center justify-center gap-2",children:[xZ.jsx(AW,{size:56,stroke:0.5,"aria-hidden":!0}),xZ.jsx("p",{className:"text-sm",children:"There's no such page in this workspace"})]}),xZ.jsx(L0,{variant:"secondary",onClick:$,children:"Back to overview"})]})}var V5=P(u(),1),hq0=H4.lazy(()=>import("/chunk-a5372n61.js").then(($)=>({default:$.Scratchpad})));function at($,Z,J,H){if($==="overview")return{key:$,Icon:DW,label:"Overview",closable:!1,reorderable:!1};if($==="scratchpad")return{key:$,Icon:TX,label:"Scratchpad",closable:J};let B=NJ($),Q=B?Z.find((X)=>X.id===B):null;return Q?{key:$,Icon:Fz(Q),label:Yz(Q),closable:J||Q.status!=="compiled",loading:Q.status!=="compiled"&&!!Q.executionSessionId&&H(Q.executionSessionId)}:null}function nt({widgets:$,views:Z}){let{layout:J,workspaceId:H}=w1(),B=_9(J.theme),Q=as(),X=lq(),{mode:z,canUseSplit:G,setMode:U}=X,[Y,F]=H4.useState("idle"),[K,W]=H4.useState(!1),[N,q]=H4.useState(0),D=H4.useRef(new Map),A=K4((D0)=>D0.activity),V=Z.filter((D0)=>D0.status==="compiled"),L=Z.filter((D0)=>D0.status!=="compiled"),O=VU(A,H),M=os({workspaceId:H,pendingViews:L,onSave:(D0,y0)=>Q.save(D0,y0)}),_=$.some((D0)=>!_3(D0.id)),w=_||V.length>0,C=H4.useCallback(()=>{W(!0),q((D0)=>D0+1)},[]),{tabsState:E,activeTab:T,appletParams:k,navigateToTab:S,setTabs:I,isUnavailable:j,onNavigationClick:y}=Ut({views:Z,onOpenChat:C}),{view:R,forkedFromSessionId:x,chatLoaded:v,previewTurn:f,sessionId:b,composerSessionId:l,processing:r,error:h,loadError:d,retryLoad:o,send:c,stop:i,selectSession:n,dismissError:Z0}=vs({activeTab:T,appletParams:k}),{pinnedSessionId:J0}=t6(),{composerBanner:U0,viewDraftComposerBanner:z0,agentAvailability:X0}=Zt(H,{chatError:h,onDismissChatError:Z0,chatLoadError:d,onRetryChatLoad:o}),N0=mq(E,Z),q0=new Set(E.open),K0=N0.length>1,s=N0.map((D0)=>at(D0,Z,K0,(y0)=>WJ(A,H,y0))).filter((D0)=>Boolean(D0)),a=NJ(T),$0=a?V.find((D0)=>D0.id===a):void 0,t=a?L.find((D0)=>D0.id===a):void 0,B0=!J0&&b===null&&t?.status==="draft"&&(!t.executionSessionId||!WJ(A,H,t.executionSessionId))?t:void 0,_0=B0?.id,P0=!J0&&t?.status==="starting",A0=v&&!P0,M0=Y==="idle"&&(T==="overview"&&_||$0!==void 0),{controls:g,docked:p,layerProps:e,popup:W0,targetRef:S0}=Tg({workspaceId:H,sessionId:l,activeTab:T,mode:z,available:M0,closePopup:()=>W(!1),openPopup:()=>W(!0)});H4.useEffect(()=>{if(E.open.filter((K1)=>A6(K1,Z)).length===E.open.length)return;let y0=mq(E,Z);I({open:y0,active:y0.includes(E.active)?E.active:y0[0]})},[Z,I,E]),H4.useEffect(()=>{if(z!=="fullscreen")W(!1)},[z]),H4.useEffect(()=>{if(!_0)return;if(z==="fullscreen")W(!0);q((D0)=>D0+1)},[_0,z]);let h0=S,v0=()=>{Q.create().then((D0)=>h0(S5(D0.id)))},j0=(D0)=>{if(D0==="views"){let y0=V[0];if(y0)h0(S5(y0.id));else v0()}else h0(D0);W(!1)};P2((D0)=>{if(D0.type==="view:deleted"&&D0.workspaceId===H&&T===S5(D0.name))h0("overview")});let c0=async(D0)=>{let y0=D.current.get(D0.id);try{await Q.discard(D0.id)}catch(K1){return T1.add({title:K1 instanceof Error?K1.message:"Couldn’t discard view",type:"error"}),!1}return await y0?.resetSketch(),M.clear(D0.id),!0},z1=(D0)=>{if(D0==="overview")return;let y0=NJ(D0),K1=y0?L.find((j1)=>j1.id===y0):void 0;if(!K0&&!K1||!q0.has(D0))return;let I1=E.open.filter((j1)=>j1!==D0);if(I1.length===0)I1=["overview"];let f0=N0.indexOf(D0),e0=N0[f0+1]??N0[f0-1]??I1.find((j1)=>A6(j1,Z))??"overview",O1=E.active===D0||!I1.includes(E.active)?e0:E.active;if(I({open:I1,active:O1}),T===D0)S(e0);if(K1?.status==="draft")c0(K1)},A1=async(D0)=>{if(!await c0(D0))return;let y0=S5(D0.id);if(!q0.has(y0))return;let K1=E.open.filter((e0)=>e0!==y0);if(K1.length===0)K1=["overview"];let I1=K1.find((e0)=>A6(e0,Z))??"overview",f0=E.active===y0?I1:E.active;if(I({open:K1,active:f0}),T===y0)S(I1,{replace:!0})},l0=(D0)=>{I({open:D0,active:E.active})},k0=(D0)=>{if(D0!==void 0)C1.getState().setComposerDraft(M2(H,l),D0);if(z==="fullscreen"){if(W(!0),K)q((y0)=>y0+1);return}q((y0)=>y0+1)};ws({sessionId:b,send:c,revealChat:k0,agentAvailability:X0}),Ss(l,k0);let R1=[...!q0.has("scratchpad")?[{key:"scratchpad",Icon:TX,label:"Scratchpad",onClick:()=>h0("scratchpad")}]:[],...Z.map((D0)=>({view:D0,tab:S5(D0.id)})).filter(({tab:D0})=>!q0.has(D0)).map(({view:D0,tab:y0})=>({key:y0,Icon:Fz(D0),label:Yz(D0),onClick:()=>h0(y0)})),{key:"create-view",Icon:gY,label:"New view",onClick:v0}],Y1=H4.useCallback(()=>{if(B0)D.current.get(B0.id)?.resetSketch()},[B0]),U5=async(D0,y0)=>{if(t?.status==="draft")await D.current.get(t.id)?.prepareSketchForSend(),await Q.submit(t,D0),M.clear(t.id);else await c(D0,y0)},C0=B0?{sessionId:N2(S5(B0.id)),onRemoveDrawing:Y1}:void 0,p0={agent:B.agent,focusRequest:N,chatLoaded:A0,hasWorkspaceApplets:w,view:R,forkedFromSessionId:x,previewTurn:f,sessionId:b,processing:r,composerBanner:B0?z0:U0,agentAvailability:X0,send:U5,stop:i,onNavigateFromWelcome:j0,viewDraft:C0},r0=V5.jsx($O,{...p0,active:z==="split",onClose:()=>U("fullscreen"),annotation:p,docked:!0}),n0=V5.jsxs(rq,{mode:z,children:[V5.jsxs("div",{className:"relative flex min-h-0 flex-1",children:[V5.jsxs("div",{ref:S0,inert:g.active||void 0,"aria-hidden":g.active||void 0,className:"flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden bg-background transition-colors duration-100 ease-out motion-reduce:transition-none",children:[j?V5.jsx(rt,{onOpenOverview:()=>h0("overview")}):T==="overview"?V5.jsx(Ms,{customizing:Y==="customizing",theming:Y==="theming",onThemingChange:(D0)=>F(D0?"theming":"idle"),onCustomizingChange:(D0)=>F(D0?"customizing":"idle"),widgets:$,views:V,onOpenView:(D0)=>h0(S5(D0)),onCreateView:v0,onCreateWidget:()=>{n(null),k0("Create widget")}}):T==="scratchpad"?V5.jsx(H4.Suspense,{fallback:null,children:V5.jsx(hq0,{})}):null,L.map((D0)=>V5.jsx(ms,{ref:(y0)=>{if(y0)D.current.set(D0.id,y0);else D.current.delete(D0.id)},active:!j&&t?.id===D0.id,pendingView:D0,running:!!D0.executionSessionId&&WJ(A,H,D0.executionSessionId),sketchSessionId:D0.status==="draft"?J0??N2(S5(D0.id)):void 0,chatDocked:z==="split",workspaceId:H,onEditingStart:()=>{if(z==="fullscreen")W(!1)},onContinueInChat:k0,onOpenChat:()=>k0(),onDiscard:()=>A1(D0)},D0.id)),V5.jsx(ls,{views:V,activeViewId:j?null:$0?.id??null,params:k})]}),V5.jsx(iK,{...e,children:V5.jsx(nK,{controls:g,title:"Draw annotation",busy:g.finishing,onComplete:()=>void g.finish()})})]}),V5.jsx(m4,{children:Y==="theming"&&V5.jsx(Ca,{onClose:()=>F("idle")})}),V5.jsxs(Ps,{children:[V5.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-4",children:[V5.jsx(Ht,{onOpenTheme:()=>F("theming")}),V5.jsx(Ft,{tabs:s,active:T,createItems:R1,onSelect:h0,onClose:z1,onReorder:l0})]}),V5.jsx(KV,{workspaceId:H,describeTab:(D0)=>at(D0,Z,!1,()=>!1),onOpenTab:h0}),G&&z==="fullscreen"&&V5.jsxs(t1,{children:[V5.jsx(e1,{render:V5.jsx(L0,{variant:"ghost",size:"icon-sm",onClick:()=>U("split"),"aria-label":"Dock chat",className:"text-muted-foreground",children:V5.jsx(ot,{stroke:1.75})})}),V5.jsx($5,{children:"Dock chat"})]})]})]});return V5.jsx(iq,{frame:X,workspace:n0,chat:r0,onClick:y,children:z==="fullscreen"&&V5.jsx(ja,{agent:B.agent,loading:O,open:K,onOpenChange:W,onOpenChangeComplete:(D0)=>{if(D0)q((y0)=>y0+1)},children:(D0)=>V5.jsx($O,{...p0,active:K,onClose:D0,annotation:W0})})})}var We=P(m(),1);var hZ=P(m(),1);var tt=P(u(),1);function st({className:$,...Z}){return tt.jsx("textarea",{"data-slot":"textarea",className:d0("flex field-sizing-content min-h-16 w-full rounded-lg border bg-transparent px-2.5 py-2 text-base transition-colors outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",$),...Z})}function et($){return B1(`/api/harnesses/${$}/auth/login`,{method:"POST"},"Could not start sign-in")}function $e($){return m1({queryKey:["harness-auth",$],queryFn:()=>B1(`/api/harnesses/${$}/auth`),staleTime:2000,refetchInterval:2000})}function Ze($,Z,J){return W4(`/api/harnesses/${$}/auth/login/${Z}/code`,Z5("POST",{code:J}))}var aq=P(m(),1);var o5=P(u(),1);function Qe({code:$,url:Z}){let[J,H]=aq.useState(!1);return aq.useEffect(()=>{if(!J)return;let Q=setTimeout(()=>H(!1),3000);return()=>clearTimeout(Q)},[J]),o5.jsxs("ol",{className:"mx-auto grid w-full max-w-64 gap-6 text-left text-sm lg:max-w-3xl lg:grid-cols-3 lg:text-center",children:[o5.jsxs("li",{className:"flex flex-col items-start gap-3 lg:items-center",children:[o5.jsx(Je,{size:24,stroke:1.5,className:"shrink-0"}),o5.jsxs("div",{className:"flex min-w-0 flex-col items-start gap-3 lg:items-center",children:[o5.jsx("p",{children:"Enable device code sign-in for Codex in ChatGPT settings"}),o5.jsxs("a",{href:"https://chatgpt.com/settings/security",target:"_blank",rel:"noopener noreferrer",className:"inline-flex h-8 flex-wrap items-center gap-1 font-semibold focus-visible:ring-3 focus-visible:ring-ring/50",children:["Settings",o5.jsx(B6,{size:16,stroke:2,"aria-hidden":"true"}),"Security and login"]})]})]}),o5.jsxs("li",{className:"flex flex-col items-start gap-3 lg:items-center",children:[o5.jsx(He,{size:24,stroke:1.5,className:"shrink-0"}),o5.jsxs("div",{className:"flex min-w-0 flex-col items-start gap-3 lg:items-center",children:[o5.jsx("p",{children:"Copy the one-time device code provided below"}),o5.jsxs("div",{className:"flex h-8 items-center gap-2 rounded-lg border border-input bg-accent pr-2 pl-3",children:[o5.jsx("code",{className:"cursor-text text-sm font-medium select-text",children:$}),o5.jsxs("button",{type:"button",className:"relative size-4 cursor-pointer text-muted-foreground outline-none hover:text-foreground focus-visible:text-foreground","aria-label":J?"Code copied":"Copy code",onClick:()=>{navigator.clipboard?.writeText($).then(()=>H(!0)).catch(()=>{})},children:[o5.jsx(TN,{className:Q0("absolute inset-0 transition-[opacity,filter] duration-200 motion-reduce:transition-none",J&&"opacity-0 blur-[2px]"),stroke:1.75,size:16}),o5.jsx(i8,{className:Q0("absolute inset-0 transition-[opacity,filter] duration-200 motion-reduce:transition-none",!J&&"opacity-0 blur-[2px]"),stroke:1.75,size:16})]})]})]})]}),o5.jsxs("li",{className:"flex flex-col items-start gap-3 lg:items-center",children:[o5.jsx(Be,{size:24,stroke:1.5,className:"shrink-0"}),o5.jsxs("div",{className:"flex min-w-0 flex-col items-start gap-3 lg:items-center",children:[o5.jsx("p",{children:"Sign in to ChatGPT, paste the code, and then come back to Moi"}),o5.jsx("a",{href:Z,target:"_blank",rel:"noopener noreferrer",className:M9(),children:"Open ChatGPT"})]})]})]})}var W5=P(u(),1);function Xe({type:$,reason:Z,checking:J,onRecheck:H}){let{environment:B}=N4(),Q=$e($),X=a0(),[z,G]=hZ.useState(""),[U,Y]=hZ.useState(!1),F=hZ.useId(),K=l$[$],W=Q.data?.login,N=W?.state==="pending"?W:void 0,q=W?.state==="starting",D=B==="local"&&!U,A=!q&&!N&&Q.data?.availability.status==="available";hZ.useEffect(()=>{if(A)H()},[A,H]);let V=r1({mutationFn:async(M)=>{if(M==="start")Y(!1),G(""),await et($);if(M==="submit"&&N)await Ze($,N.id,z),G("")},onSettled:()=>X.invalidateQueries({queryKey:["harness-auth"]})}),L=Q.isError||Q.data?.availability.status==="unavailable",O=V.error?.message??(W?.state==="failed"?W.reason:void 0);return W5.jsx("div",{className:"flex flex-1 items-center justify-center p-6",children:W5.jsxs("div",{className:"flex w-full max-w-5xl flex-col text-center",children:[W5.jsx("img",{src:A3[$],alt:"",className:"mb-4 size-10 self-center"}),W5.jsxs("h1",{className:"mb-6 text-center text-xl font-medium",children:["Log in to ",K]}),W5.jsxs("section",{className:Q0("flex w-full flex-col gap-3 self-center",!N?.userCode&&"max-w-xs"),"aria-label":K,children:[Q.isPending?W5.jsx(n2,{className:"size-6 self-center text-muted-foreground",stroke:1.5}):L?W5.jsxs("div",{role:"alert",className:"flex flex-col items-start gap-2",children:[W5.jsx("p",{children:"Could not check agent sign-in status."}),W5.jsx(L0,{variant:"secondary",disabled:Q.isFetching,onClick:()=>void Q.refetch(),children:"Try again"})]}):A?W5.jsxs("div",{role:"status",className:"flex flex-col items-center gap-4",children:[W5.jsx("p",{className:"text-sm text-muted-foreground",children:J?"Checking workspace access…":`Signed in to ${K}, but this workspace still needs attention. ${Z}`}),W5.jsx(L0,{variant:"secondary",disabled:J,onClick:H,children:"Try again"})]}):W5.jsx(W5.Fragment,{children:N?.userCode?W5.jsx(Qe,{code:N.userCode,url:N.url}):N?W5.jsxs(W5.Fragment,{children:[W5.jsx("p",{role:"status",className:"text-sm text-muted-foreground",children:N.codeUrl&&!D?`Sign in to ${K} to get the authorization code.`:`Sign in to ${K}, then come back to Moi. Your workspace will open once you’re connected.`}),W5.jsxs("a",{className:M9({variant:"secondary"}),href:U?N.codeUrl??N.url:N.url,target:"_blank",rel:"noopener noreferrer",children:["Open ",K]}),D&&N.codeUrl&&W5.jsx(L0,{variant:"ghost",onClick:()=>Y(!0),children:"Having trouble signing in?"}),!D&&N.codeUrl&&W5.jsxs("form",{className:"mt-3 flex flex-col gap-3",onSubmit:(M)=>{M.preventDefault(),V.mutate("submit")},children:[W5.jsx("label",{htmlFor:F,className:"text-sm text-muted-foreground",children:"Paste the code here:"}),W5.jsx(st,{id:F,"aria-label":"Authorization code",rows:3,className:"field-sizing-fixed resize-none",value:z,onChange:(M)=>G(M.target.value),autoComplete:"off",spellCheck:!1}),W5.jsx(L0,{type:"submit",className:"mt-3",disabled:!z.trim()||V.isPending,children:V.isPending?"Connecting…":"Continue"})]})]}):W5.jsxs(L0,{className:"self-center",disabled:V.isPending||q,onClick:()=>V.mutate("start"),children:["Continue",W5.jsx(fY,{stroke:1.75,"data-icon":"inline-end"})]})}),O&&W5.jsx("p",{role:"alert",className:"text-sm text-destructive",children:O})]})]})})}var I5=P(u(),1);function Ge($){return I5.jsx(Ke,{title:"Could not check your agent",...$,children:"Could not check this workspace’s agent. Try again."})}function Ue({workspaceId:$}){let[,Z]=a4(),J=zY();return I5.jsxs("div",{className:"flex flex-1 flex-col items-center justify-center gap-4 p-6 text-center",children:[I5.jsx(ze,{size:56,stroke:0.5,className:"text-muted-foreground","aria-hidden":!0}),I5.jsx("h1",{className:"font-medium",children:"The workspace folder is missing"}),I5.jsx(L0,{variant:"secondary",disabled:J.isPending,onClick:()=>J.mutate($,{onSuccess:()=>Z("/")}),children:J.isPending?"Deleting workspace…":"Delete workspace"}),J.error&&I5.jsx("p",{role:"alert",className:"text-sm text-destructive",children:J.error.message})]})}function Ye({type:$,availability:Z,...J}){if(Z.status==="unavailable"&&Z.code==="not-installed")return I5.jsxs("div",{className:"flex flex-1 flex-col items-center justify-center gap-4 p-6 text-center",children:[I5.jsx("img",{src:A3[$],alt:"",className:"size-10"}),I5.jsxs("h1",{className:"font-medium",children:[l$[$]," is uninstalled from the device"]}),I5.jsx(L0,{variant:"secondary",disabled:J.retrying,onClick:J.onRetry,children:"Check again"})]});let H=Z.status==="login-required";return I5.jsxs(Ke,{title:H?"Connect your agent":"Your agent is unavailable",type:$,...J,children:[Z.reason,H&&I5.jsxs(I5.Fragment,{children:[I5.jsx("br",{}),I5.jsx("br",{}),"Complete sign-in in your agent’s terminal, then try again."]})]})}function Fe(){return I5.jsx("div",{className:"flex flex-1 items-center justify-center",children:I5.jsx(n2,{className:"size-6 text-muted-foreground",stroke:1.5})})}function Ke({title:$,type:Z,children:J,retrying:H,onRetry:B}){return I5.jsx("div",{className:"flex flex-1 items-center justify-center p-6",children:I5.jsxs("div",{className:"flex w-full max-w-md flex-col gap-6",children:[Z&&I5.jsx("img",{src:A3[Z],alt:"",className:"size-10 self-center"}),I5.jsx("h1",{className:"text-center text-xl font-medium",children:$}),I5.jsxs("div",{role:"alert",className:"flex flex-col items-center gap-4",children:[I5.jsx("p",{className:"text-sm wrap-anywhere whitespace-pre-wrap text-muted-foreground",children:J}),I5.jsx(L0,{variant:"secondary",disabled:H,onClick:B,children:"Try again"})]})]})})}var vZ=P(u(),1);function Ne($,Z=!1,J={}){let{data:H,isError:B,isPending:Q,isFetching:X,isFetchedAfterMount:z,refetch:G}=s8($),U=Q||X&&!z&&H?.availability.status!=="available",Y=We.useCallback(()=>{G()},[G]);function F(){if(U)return;if(B&&H?.availability.status==="available")return;if(B||!H)return vZ.jsx(Ge,{retrying:X,onRetry:Y});if(H.workspaceFolderMissing)return vZ.jsx(Ue,{workspaceId:$});let{provider:q,availability:D}=H;if(D.status==="available")return;if(D.status==="login-required"&&(q==="claude-code"||q==="codex"))return vZ.jsx(Xe,{type:q,reason:D.reason,checking:X,onRecheck:Y});return vZ.jsx(Ye,{type:q,availability:D,retrying:X,onRetry:Y})}let K=F(),W=!K&&!Z&&!U,N=_x($);return{content:N?vZ.jsx(Ox,{...J}):K??vZ.jsx(Fe,{}),ready:W&&!N,setupRequired:N||!!K}}var RT=P(u(),1);function qe({children:$}){return RT.jsx("section",{"aria-label":"Workspace setup",className:"flex min-h-0 flex-1 flex-col overflow-y-auto bg-muted texture-checker-20",children:RT.jsx("div",{className:"flex flex-1 flex-col bg-radial from-background from-25% to-transparent",children:$})})}var oq=P(u(),1);function Ae({setupRequired:$=!1,children:Z}){let J=lq($);return oq.jsx(iq,{frame:J,workspace:oq.jsx(rq,{mode:J.mode,children:$?oq.jsx(qe,{children:Z}):Z})})}var IT=P(u(),1);function De({contentPending:$,widgets:Z,views:J}){let{layout:H,workspaceId:B,name:Q,provider:X}=w1(),{content:z,ready:G,setupRequired:U}=Ne(B,$,{name:Q??"Workspace",icon:H.icon,workspaceType:X,workspaceTheme:H.theme});return G?IT.jsx(nt,{widgets:Z,views:J}):IT.jsx(Ae,{setupRequired:U,children:z})}var Le=P(m(),1);var nq=P(m(),1);function vq0($){return new Map($.map((Z)=>[Z.id,{w:Z.config.colSpan,h:Z.config.rowSpan}]))}function fq0($,Z,J){let H=new Set($.map((Y)=>Y.i)),B=Z.filter((Y)=>{let F=J.get(Y.id);if(!F)return!H.has(Y.id);if(!H.has(Y.id))return!1;return F.w!==Y.config.colSpan||F.h!==Y.config.rowSpan});if(B.length===0)return null;let Q=new Set(B.map((Y)=>Y.id)),X=new Map(Z.map((Y)=>[Y.id,Y.config])),z=$.filter((Y)=>!Q.has(Y.i)&&X.has(Y.i)).map((Y)=>{let F=X.get(Y.i);return{...Y,w:F.colSpan,h:F.rowSpan}}),G=z.map(({i:Y,x:F,y:K})=>({i:Y,x:F,y:K})),U=[...z];for(let Y of B){let F=Qq(U,Y.config.colSpan,Y.config.rowSpan);G.push({i:Y.id,...F}),U.push({i:Y.id,...F,w:Y.config.colSpan,h:Y.config.rowSpan})}return G}function Ve($,Z,J,H){let B=nq.useRef(null);nq.useEffect(()=>{if(!Z)return;let Q=vq0(Z);if(B.current?.workspaceId!==$){B.current={workspaceId:$,sizes:Q};return}let X=fq0(J.widgetGrid,Z,B.current.sizes);if(B.current={workspaceId:$,sizes:Q},X)H({widgetGrid:X})},[$,Z,J.widgetGrid,H])}function Me($){let{layout:Z,setLayout:J}=w1(),H=m1({queryKey:O0.widgets($),queryFn:async()=>{return(await B1(`/api/workspaces/${$}/widgets`)).widgets},...M8}),B=Le.useMemo(()=>zg(H.data??[]),[H.data]);return Ve($,H.data?B:void 0,Z,J),{...H,data:B}}var fZ=P(u(),1);function _e({id:$}){let{experimental:Z}=N4();return fZ.jsx(Pe,{id:$,children:fZ.jsx(Wg,{id:$,children:fZ.jsx(lD,{workspaceId:$,enabled:Z.collab,children:fZ.jsx(gq0,{id:$})})})})}function gq0({id:$}){let Z=a2(),J=a0(),[H]=t3(),{isLoading:B,layout:Q}=w1();Rf(Q.theme);let X=Me($),z=Bq($);Jg(),P2((U)=>{if(U.type==="theme:updated"||U.type==="workspace:updated"){if(U.origin===Y3)return;J.invalidateQueries({queryKey:O0.layout($)})}else if(U.type==="widget-layout:updated"||U.type==="widget:updated")J.invalidateQueries({queryKey:O0.widgets($)});else if(U.type==="view-layout:updated"||U.type==="view:updated")J.invalidateQueries({queryKey:O0.views($)})});let G=B||H===void 0||X.isLoading||z.isLoading;return fZ.jsx(FH,{children:fZ.jsx(De,{contentPending:G,widgets:X.data,views:z.data??[]},Z?"browser-tab":"shared")})}var v9=P(u(),1),Oe=null;function mq0(){if(!Oe)return v9.jsx(nz,{to:"/"});return v9.jsx(sq.Suspense,{fallback:null,children:v9.jsx(Oe,{})})}function Te(){let[,$]=a4();return sq.useEffect(()=>{return LV((Z)=>$(`/workspace/${Z}`)),()=>LV(null)},[$]),v9.jsxs(Sj,{children:[v9.jsx(bB,{path:"/dev/*?",component:mq0}),v9.jsx(bB,{path:"/",component:vf}),v9.jsx(bB,{path:"/settings",component:hv}),v9.jsx(bB,{path:"/workspace/:id/*?",children:(Z)=>v9.jsx(_e,{id:Z.id},Z.id)})]})}var k3=P(u(),1),Ce=new FA;TR(Ce);Fw();function Vx1($){function Z(){return k3.jsx(ZA,{client:Ce,children:k3.jsx(gR,{children:k3.jsxs(qU,{children:[k3.jsx(DA,{children:k3.jsx(hR,{children:k3.jsx(Te,{})})}),k3.jsx(bb,{})]})})})}je.createRoot($).render(k3.jsx(Z,{}))}export{Vx1 as mount};
|