moi-computer 0.11.1-next.5 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,68 +0,0 @@
1
- import{$ as Cf,$a as Xk,$b as Ek,A as L8,Aa as lI,Ab as sU,Ac as Es,B as y2,Ba as rU,Bb as Ak,Bc as LR,C as GQ,Ca as iI,Cb as Il,Cc as MR,D as M8,Da as rI,Db as iP,E as SZ,Ea as aI,Eb as kl,F as CA,Fa as oI,Fb as On,G as m0,Ga as nI,Gb as gW,H as x2,Ha as aU,Hb as Vk,I as bx,Ia as IR,Ib as f2,J as X2,Ja as OF,Jb as QR,K as z0,Ka as cx,Kb as co,L as Fa,Lb as Dk,M as uJ,Ma as sI,Mb as Lk,N as gJ,Na as PF,Nb as vJ,O as T5,Oa as WJ,Ob as S6,P as Bj,Pa as tI,Pb as Mk,Q as B0,Qa as eI,Qb as Pk,R as JJ,Ra as Cn,Rb as xB,S as a0,Sa as CI,Sb as dy,T as A$,Ta as $k,Tb as _k,U as j0,Ua as Zk,Ub as jk,V as rl,Va as Jk,W as RI,Wa as Hk,Wb as Ok,X as _n,Y as Pw,Ya as Qk,Yb as Tk,Z as qG,Za as Bk,Zb as Ck,_ as II,_b as wk,aa as gh,ab as jw,ac as pW,b as c,ba as _a,bb as oU,bc as Sk,c as Bq0,ca as fh,cb as _F,d as X1,da as TI,db as _s,dc as Pf,e as r2,ea as dh,eb as zk,ec as Oa,f as L1,fa as rJ,fb as mq,fc as eG,g as l1,ga as kI,gb as Zv,h as J0,ha as bI,hc as _f,i as y0,ia as gQ,ib as b5,ic as Rk,j as Gz,ja as yI,jb as Ow,jc as Ik,k as bT,ka as xI,kb as jn,kc as o5,l as U0,la as hI,lb as Gk,lc as Xi,m as e4,ma as Ps,mb as Uk,mc as ly,n as P2,na as vI,nb as cy,nc as Wf,o as R1,oa as gI,ob as wI,oc as xK,p as M3,pa as fI,pb as Kk,pc as Df,q as cT,qa as mI,qb as yB,qc as UE,r as s0,ra as uI,rb as ti,rc as KE,s as P1,sa as j8,sb as ja,sc as DR,t as n3,ta as pI,tb as Yk,u as zQ,ua as ZJ,ub as Fk,uc as FR,v as hC,va as R$,vb as Wk,vc as j4,w as QG,wa as el,wb as qk,wc as UU,x as wA,xa as _w,xb as nU,xc as zR,y as vC,ya as cI,yc as z5,z as EA,za as dI,zb as Nk,zc as e1}from"/chunk-ryg9z3kn.js";import{Ec as O8}from"/chunk-jf6czgrz.js";import{Fc as ME,Gc as PE,Hc as _E,Ic as j3,Jc as IG}from"/chunk-tpn177bt.js";import{Nc as q1,Oc as P4,Pc as g5}from"/chunk-vfpsc75k.js";import{Qc as m,Rc as kG,Sc as K5,Tc as Dh,Uc as W2,Vc as yn}from"/chunk-z3byfve5.js";import{Wc as P,Xc as O5,Yc as C5,Zc as FL}from"/chunk-97eg9mjn.js";var VZ=O5((Qt)=>{var h8=P(m());function os($,Z){return $===Z&&($!==0||1/$===1/Z)||$!==$&&Z!==Z}var ns=typeof Object.is==="function"?Object.is:os,ss=h8.useState,ts=h8.useEffect,es=h8.useLayoutEffect,$t=h8.useDebugValue;function Zt($,Z){var J=Z(),H=ss({inst:{value:J,getSnapshot:Z}}),Q=H[0].inst,B=H[1];return es(function(){Q.value=J,Q.getSnapshot=Z,DN(Q)&&B({inst:Q})},[$,J,Z]),ts(function(){return DN(Q)&&B({inst:Q}),$(function(){DN(Q)&&B({inst:Q})})},[$]),$t(J),J}function DN($){var Z=$.getSnapshot;$=$.value;try{var J=Z();return!ns($,J)}catch(H){return!0}}function Jt($,Z){return Z()}var Ht=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?Jt:Zt;Qt.useSyncExternalStore=h8.useSyncExternalStore!==void 0?h8.useSyncExternalStore:Ht});var pf=O5((_Z1,uf)=>{var vf=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,f70=/\n/g,m70=/^\s*/,u70=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,p70=/^:\s*/,c70=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,d70=/^[;\s]*/,l70=/^\s+|\s+$/g,i70=`
2
- `,gf="/",ff="*",h$="",r70="comment",a70="declaration";function o70($,Z){if(typeof $!=="string")throw TypeError("First argument must be a string");if(!$)return[];Z=Z||{};var J=1,H=1;function Q(q){var N=q.match(f70);if(N)J+=N.length;var V=q.lastIndexOf(i70);H=~V?q.length-V:H+q.length}function B(){var q={line:J,column:H};return function(N){return N.position=new X(q),U(),N}}function X(q){this.start=q,this.end={line:J,column:H},this.source=Z.source}X.prototype.content=$;function z(q){var N=Error(Z.source+":"+J+":"+H+": "+q);if(N.reason=q,N.filename=Z.source,N.line=J,N.column=H,N.source=$,Z.silent);else throw N}function G(q){var N=q.exec($);if(!N)return;var V=N[0];return Q(V),$=$.slice(V.length),N}function U(){G(m70)}function K(q){var N;q=q||[];while(N=Y())if(N!==!1)q.push(N);return q}function Y(){var q=B();if(gf!=$.charAt(0)||ff!=$.charAt(1))return;var N=2;while(h$!=$.charAt(N)&&(ff!=$.charAt(N)||gf!=$.charAt(N+1)))++N;if(N+=2,h$===$.charAt(N-1))return z("End of comment missing");var V=$.slice(2,N-2);return H+=2,Q(V),$=$.slice(N),H+=2,q({type:r70,comment:V})}function F(){var q=B(),N=G(u70);if(!N)return;if(Y(),!G(p70))return z("property missing ':'");var V=G(c70),A=q({type:a70,property:mf(N[0].replace(vf,h$)),value:V?mf(V[0].replace(vf,h$)):h$});return G(d70),A}function W(){var q=[];K(q);var N;while(N=F())if(N!==!1)q.push(N),K(q);return q}return U(),W()}function mf($){return $?$.replace(l70,h$):h$}uf.exports=o70});var cf=O5((fB)=>{var n70=fB&&fB.__importDefault||function($){return $&&$.__esModule?$:{default:$}};Object.defineProperty(fB,"__esModule",{value:!0});fB.default=t70;var s70=n70(pf());function t70($,Z){let J=null;if(!$||typeof $!=="string")return J;let H=(0,s70.default)($),Q=typeof Z==="function";return H.forEach((B)=>{if(B.type!=="declaration")return;let{property:X,value:z}=B;if(Q)Z(X,z,B);else if(z)J=J||{},J[X]=z}),J}});var af=O5((lf)=>{Object.defineProperty(lf,"__esModule",{value:!0});lf.camelCase=void 0;var e70=/^--[a-zA-Z0-9_-]+$/,$$0=/-([a-z])/g,Z$0=/^[^-]+$/,J$0=/^-(webkit|moz|ms|o|khtml)-/,H$0=/^-(ms)-/,Q$0=function($){return!$||Z$0.test($)||e70.test($)},B$0=function($,Z){return Z.toUpperCase()},df=function($,Z){return"".concat(Z,"-")},X$0=function($,Z){if(Z===void 0)Z={};if(Q$0($))return $;if($=$.toLowerCase(),Z.reactCompat)$=$.replace(H$0,df);else $=$.replace(J$0,df);return $.replace($$0,B$0)};lf.camelCase=X$0});var nf=O5(($M,of)=>{var z$0=$M&&$M.__importDefault||function($){return $&&$.__esModule?$:{default:$}},G$0=z$0(cf()),U$0=af();function eL($,Z){var J={};if(!$||typeof $!=="string")return J;return(0,G$0.default)($,function(H,Q){if(H&&Q)J[(0,U$0.camelCase)(H,Z)]=Q}),J}eL.default=eL;of.exports=eL});var Vu=O5((Wz1,Au)=>{var ZW=Object.prototype.hasOwnProperty,Nu=Object.prototype.toString,Uu=Object.defineProperty,Ku=Object.getOwnPropertyDescriptor,Yu=function(Z){if(typeof Array.isArray==="function")return Array.isArray(Z);return Nu.call(Z)==="[object Array]"},Fu=function(Z){if(!Z||Nu.call(Z)!=="[object Object]")return!1;var J=ZW.call(Z,"constructor"),H=Z.constructor&&Z.constructor.prototype&&ZW.call(Z.constructor.prototype,"isPrototypeOf");if(Z.constructor&&!J&&!H)return!1;var Q;for(Q in Z);return typeof Q>"u"||ZW.call(Z,Q)},Wu=function(Z,J){if(Uu&&J.name==="__proto__")Uu(Z,J.name,{enumerable:!0,configurable:!0,value:J.newValue,writable:!0});else Z[J.name]=J.newValue},qu=function(Z,J){if(J==="__proto__"){if(!ZW.call(Z,J))return;else if(Ku)return Ku(Z,J).value}return Z[J]};Au.exports=function $(){var Z,J,H,Q,B,X,z=arguments[0],G=1,U=arguments.length,K=!1;if(typeof z==="boolean")K=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=qu(z,J),Q=qu(Z,J),z!==Q){if(K&&Q&&(Fu(Q)||(B=Yu(Q)))){if(B)B=!1,X=H&&Yu(H)?H:[];else X=H&&Fu(H)?H:{};Wu(z,{name:J,newValue:$(K,X,Q)})}else if(typeof Q<"u")Wu(z,{name:J,newValue:Q})}}return z}});var Gc=O5((yU1,zc)=>{function ip($){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))ip(J)}),$}class lM{constructor($){if($.data===void 0)$.data={};this.data=$.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function rp($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;")}function K7($,...Z){let J=Object.create(null);for(let H in $)J[H]=$[H];return Z.forEach(function(H){for(let Q in H)J[Q]=H[Q]}),J}var yH0="</span>",mp=($)=>{return!!$.scope},xH0=($,{prefix:Z})=>{if($.startsWith("language:"))return $.replace("language:","language-");if($.includes(".")){let J=$.split(".");return[`${Z}${J.shift()}`,...J.map((H,Q)=>`${H}${"_".repeat(Q+1)}`)].join(" ")}return`${Z}${$}`};class ap{constructor($,Z){this.buffer="",this.classPrefix=Z.classPrefix,$.walk(this)}addText($){this.buffer+=rp($)}openNode($){if(!mp($))return;let Z=xH0($.scope,{prefix:this.classPrefix});this.span(Z)}closeNode($){if(!mp($))return;this.buffer+=yH0}value(){return this.buffer}span($){this.buffer+=`<span class="${$}">`}}var up=($={})=>{let Z={children:[]};return Object.assign(Z,$),Z};class iM{constructor(){this.rootNode=up(),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=up({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)=>{iM._collapse(Z)})}}class op extends iM{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 ap(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function JX($){if(!$)return null;if(typeof $==="string")return $;return $.source}function np($){return i$("(?=",$,")")}function hH0($){return i$("(?:",$,")*")}function vH0($){return i$("(?:",$,")?")}function i$(...$){return $.map((J)=>JX(J)).join("")}function gH0($){let Z=$[$.length-1];if(typeof Z==="object"&&Z.constructor===Object)return $.splice($.length-1,1),Z;else return{}}function rM(...$){return"("+(gH0($).capture?"":"?:")+$.map((H)=>JX(H)).join("|")+")"}function sp($){return new RegExp($.toString()+"|").exec("").length-1}function fH0($,Z){let J=$&&$.exec(Z);return J&&J.index===0}var mH0=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function aM($,{joinWith:Z}){let J=0;return $.map((H)=>{J+=1;let Q=J,B=JX(H),X="";while(B.length>0){let z=mH0.exec(B);if(!z){X+=B;break}if(X+=B.substring(0,z.index),B=B.substring(z.index+z[0].length),z[0][0]==="\\"&&z[1])X+="\\"+String(Number(z[1])+Q);else if(X+=z[0],z[0]==="(")J++}return X}).map((H)=>`(${H})`).join(Z)}var uH0=/\b\B/,tp="[a-zA-Z]\\w*",oM="[a-zA-Z_]\\w*",ep="\\b\\d+(\\.\\d+)?",$c="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",Zc="\\b(0b[01]+)",pH0="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",cH0=($={})=>{let Z=/^#![ ]*\//;if($.binary)$.begin=i$(Z,/.*\b/,$.binary,/\b.*/);return K7({scope:"meta",begin:Z,end:/$/,relevance:0,"on:begin":(J,H)=>{if(J.index!==0)H.ignoreMatch()}},$)},HX={begin:"\\\\[\\s\\S]",relevance:0},dH0={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[HX]},lH0={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[HX]},iH0={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/},NW=function($,Z,J={}){let H=K7({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 Q=rM("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:i$(/[ ]+/,"(",Q,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),H},rH0=NW("//","$"),aH0=NW("/\\*","\\*/"),oH0=NW("#","$"),nH0={scope:"number",begin:ep,relevance:0},sH0={scope:"number",begin:$c,relevance:0},tH0={scope:"number",begin:Zc,relevance:0},eH0={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[HX,{begin:/\[/,end:/\]/,relevance:0,contains:[HX]}]},$Q0={scope:"title",begin:tp,relevance:0},ZQ0={scope:"title",begin:oM,relevance:0},JQ0={begin:"\\.\\s*"+oM,relevance:0},HQ0=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()}})},WW=Object.freeze({__proto__:null,APOS_STRING_MODE:dH0,BACKSLASH_ESCAPE:HX,BINARY_NUMBER_MODE:tH0,BINARY_NUMBER_RE:Zc,COMMENT:NW,C_BLOCK_COMMENT_MODE:aH0,C_LINE_COMMENT_MODE:rH0,C_NUMBER_MODE:sH0,C_NUMBER_RE:$c,END_SAME_AS_BEGIN:HQ0,HASH_COMMENT_MODE:oH0,IDENT_RE:tp,MATCH_NOTHING_RE:uH0,METHOD_GUARD:JQ0,NUMBER_MODE:nH0,NUMBER_RE:ep,PHRASAL_WORDS_MODE:iH0,QUOTE_STRING_MODE:lH0,REGEXP_MODE:eH0,RE_STARTERS_RE:pH0,SHEBANG:cH0,TITLE_MODE:$Q0,UNDERSCORE_IDENT_RE:oM,UNDERSCORE_TITLE_MODE:ZQ0});function QQ0($,Z){if($.input[$.index-1]===".")Z.ignoreMatch()}function BQ0($,Z){if($.className!==void 0)$.scope=$.className,delete $.className}function XQ0($,Z){if(!Z)return;if(!$.beginKeywords)return;if($.begin="\\b("+$.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",$.__beforeBegin=QQ0,$.keywords=$.keywords||$.beginKeywords,delete $.beginKeywords,$.relevance===void 0)$.relevance=0}function zQ0($,Z){if(!Array.isArray($.illegal))return;$.illegal=rM(...$.illegal)}function GQ0($,Z){if(!$.match)return;if($.begin||$.end)throw Error("begin & end are not supported with match");$.begin=$.match,delete $.match}function UQ0($,Z){if($.relevance===void 0)$.relevance=1}var KQ0=($,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=i$(J.beforeMatch,np(J.begin)),$.starts={relevance:0,contains:[Object.assign(J,{endsParent:!0})]},$.relevance=0,delete J.beforeMatch},YQ0=["of","and","for","in","not","or","if","then","parent","list","value"],FQ0="keyword";function Jc($,Z,J=FQ0){let H=Object.create(null);if(typeof $==="string")Q(J,$.split(" "));else if(Array.isArray($))Q(J,$);else Object.keys($).forEach(function(B){Object.assign(H,Jc($[B],Z,B))});return H;function Q(B,X){if(Z)X=X.map((z)=>z.toLowerCase());X.forEach(function(z){let G=z.split("|");H[G[0]]=[B,WQ0(G[0],G[1])]})}}function WQ0($,Z){if(Z)return Number(Z);return qQ0($)?0:1}function qQ0($){return YQ0.includes($.toLowerCase())}var pp={},l$=($)=>{console.error($)},cp=($,...Z)=>{console.log(`WARN: ${$}`,...Z)},XH=($,Z)=>{if(pp[`${$}/${Z}`])return;console.log(`Deprecated as of ${$}. ${Z}`),pp[`${$}/${Z}`]=!0},qW=Error();function Hc($,Z,{key:J}){let H=0,Q=$[J],B={},X={};for(let z=1;z<=Z.length;z++)X[z+H]=Q[z],B[z+H]=!0,H+=sp(Z[z-1]);$[J]=X,$[J]._emit=B,$[J]._multi=!0}function NQ0($){if(!Array.isArray($.begin))return;if($.skip||$.excludeBegin||$.returnBegin)throw l$("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),qW;if(typeof $.beginScope!=="object"||$.beginScope===null)throw l$("beginScope must be object"),qW;Hc($,$.begin,{key:"beginScope"}),$.begin=aM($.begin,{joinWith:""})}function AQ0($){if(!Array.isArray($.end))return;if($.skip||$.excludeEnd||$.returnEnd)throw l$("skip, excludeEnd, returnEnd not compatible with endScope: {}"),qW;if(typeof $.endScope!=="object"||$.endScope===null)throw l$("endScope must be object"),qW;Hc($,$.end,{key:"endScope"}),$.end=aM($.end,{joinWith:""})}function VQ0($){if($.scope&&typeof $.scope==="object"&&$.scope!==null)$.beginScope=$.scope,delete $.scope}function DQ0($){if(VQ0($),typeof $.beginScope==="string")$.beginScope={_wrap:$.beginScope};if(typeof $.endScope==="string")$.endScope={_wrap:$.endScope};NQ0($),AQ0($)}function LQ0($){function Z(X,z){return new RegExp(JX(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+=sp(X)+1}compile(){if(this.regexes.length===0)this.exec=()=>null;let X=this.regexes.map((z)=>z[1]);this.matcherRe=Z(aM(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((K,Y)=>Y>0&&K!==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 Q(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 B(X,z){let G=X;if(X.isCompiled)return G;[BQ0,GQ0,DQ0,KQ0].forEach((K)=>K(X,z)),$.compilerExtensions.forEach((K)=>K(X,z)),X.__beforeBegin=null,[XQ0,zQ0,UQ0].forEach((K)=>K(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=Jc(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=JX(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(K){return MQ0(K==="self"?X:K)})),X.contains.forEach(function(K){B(K,G)}),X.starts)B(X.starts,z);return G.matcher=Q(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=K7($.classNameAliases||{}),B($)}function Qc($){if(!$)return!1;return $.endsWithParent||Qc($.starts)}function MQ0($){if($.variants&&!$.cachedVariants)$.cachedVariants=$.variants.map(function(Z){return K7($,{variants:null},Z)});if($.cachedVariants)return $.cachedVariants;if(Qc($))return K7($,{starts:$.starts?K7($.starts):null});if(Object.isFrozen($))return K7($);return $}var PQ0="11.11.1";class Bc extends Error{constructor($,Z){super($);this.name="HTMLInjectionError",this.html=Z}}var dM=rp,dp=K7,lp=Symbol("nomatch"),_Q0=7,Xc=function($){let Z=Object.create(null),J=Object.create(null),H=[],Q=!0,B="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:op};function G(k){return z.noHighlightRe.test(k)}function U(k){let h=k.className+" ";h+=k.parentNode?k.parentNode.className:"";let v=z.languageDetectRe.exec(h);if(v){let f=C(v[1]);if(!f)cp(B.replace("{}",v[1])),cp("Falling back to no-highlight mode for this block.",k);return f?v[1]:"no-highlight"}return h.split(/\s+/).find((f)=>G(f)||C(f))}function K(k,h,v){let f="",w="";if(typeof h==="object")f=k,v=h.ignoreIllegals,w=h.language;else XH("10.7.0","highlight(lang, code, ...args) has been deprecated."),XH("10.7.0",`Please use highlight(code, options) instead.
3
- https://github.com/highlightjs/highlight.js/issues/2277`),w=k,f=h;if(v===void 0)v=!0;let i={code:f,language:w};O("before:highlight",i);let r=i.result?i.result:Y(i.language,i.code,v);return r.code=i.code,O("after:highlight",r),r}function Y(k,h,v,f){let w=Object.create(null);function i(g,u){return g.keywords[u]}function r(){if(!a.keywords){$0.addText(Q0);return}let g=0;a.keywordPatternRe.lastIndex=0;let u=a.keywordPatternRe.exec(Q0),t="";while(u){t+=Q0.substring(g,u.index);let W0=N0.case_insensitive?u[0].toLowerCase():u[0],I0=i(a,W0);if(I0){let[c0,f0]=I0;if($0.addText(t),t="",w[W0]=(w[W0]||0)+1,w[W0]<=_Q0)_0+=f0;if(c0.startsWith("_"))t+=u[0];else{let T0=N0.classNameAliases[c0]||c0;s(u[0],T0)}}else t+=u[0];g=a.keywordPatternRe.lastIndex,u=a.keywordPatternRe.exec(Q0)}t+=Q0.substring(g),$0.addText(t)}function x(){if(Q0==="")return;let g=null;if(typeof a.subLanguage==="string"){if(!Z[a.subLanguage]){$0.addText(Q0);return}g=Y(a.subLanguage,Q0,!0,e[a.subLanguage]),e[a.subLanguage]=g._top}else g=W(Q0,a.subLanguage.length?a.subLanguage:null);if(a.relevance>0)_0+=g.relevance;$0.__addSublanguage(g._emitter,g.language)}function l(){if(a.subLanguage!=null)x();else r();Q0=""}function s(g,u){if(g==="")return;$0.startScope(u),$0.addText(g),$0.endScope()}function p(g,u){let t=1,W0=u.length-1;while(t<=W0){if(!g._emit[t]){t++;continue}let I0=N0.classNameAliases[g[t]]||g[t],c0=u[t];if(I0)s(c0,I0);else Q0=c0,r(),Q0="";t++}}function d(g,u){if(g.scope&&typeof g.scope==="string")$0.openNode(N0.classNameAliases[g.scope]||g.scope);if(g.beginScope){if(g.beginScope._wrap)s(Q0,N0.classNameAliases[g.beginScope._wrap]||g.beginScope._wrap),Q0="";else if(g.beginScope._multi)p(g.beginScope,u),Q0=""}return a=Object.create(g,{parent:{value:a}}),a}function o(g,u,t){let W0=fH0(g.endRe,t);if(W0){if(g["on:end"]){let I0=new lM(g);if(g["on:end"](u,I0),I0.isMatchIgnored)W0=!1}if(W0){while(g.endsParent&&g.parent)g=g.parent;return g}}if(g.endsWithParent)return o(g.parent,u,t)}function Z0(g){if(a.matcher.regexIndex===0)return Q0+=g[0],1;else return L0=!0,0}function H0(g){let u=g[0],t=g.rule,W0=new lM(t),I0=[t.__beforeBegin,t["on:begin"]];for(let c0 of I0){if(!c0)continue;if(c0(g,W0),W0.isMatchIgnored)return Z0(u)}if(t.skip)Q0+=u;else{if(t.excludeBegin)Q0+=u;if(l(),!t.returnBegin&&!t.excludeBegin)Q0=u}return d(t,g),t.returnBegin?0:u.length}function G0(g){let u=g[0],t=h.substring(g.index),W0=o(a,g,t);if(!W0)return lp;let I0=a;if(a.endScope&&a.endScope._wrap)l(),s(u,a.endScope._wrap);else if(a.endScope&&a.endScope._multi)l(),p(a.endScope,g);else if(I0.skip)Q0+=u;else{if(!(I0.returnEnd||I0.excludeEnd))Q0+=u;if(l(),I0.excludeEnd)Q0=u}do{if(a.scope)$0.closeNode();if(!a.skip&&!a.subLanguage)_0+=a.relevance;a=a.parent}while(a!==W0.parent);if(W0.starts)d(W0.starts,g);return I0.returnEnd?0:u.length}function X0(){let g=[];for(let u=a;u!==N0;u=u.parent)if(u.scope)g.unshift(u.scope);g.forEach((u)=>$0.openNode(u))}let Y0={};function V0(g,u){let t=u&&u[0];if(Q0+=g,t==null)return l(),0;if(Y0.type==="begin"&&u.type==="end"&&Y0.index===u.index&&t===""){if(Q0+=h.slice(u.index,u.index+1),!Q){let W0=Error(`0 width match regex (${k})`);throw W0.languageName=k,W0.badRule=Y0.rule,W0}return 1}if(Y0=u,u.type==="begin")return H0(u);else if(u.type==="illegal"&&!v){let W0=Error('Illegal lexeme "'+t+'" for mode "'+(a.scope||"<unnamed>")+'"');throw W0.mode=a,W0}else if(u.type==="end"){let W0=G0(u);if(W0!==lp)return W0}if(u.type==="illegal"&&t==="")return Q0+=`
4
- `,1;if(A0>1e5&&A0>u.index*3)throw Error("potential infinite loop, way more iterations than matches");return Q0+=t,t.length}let N0=C(k);if(!N0)throw l$(B.replace("{}",k)),Error('Unknown language: "'+k+'"');let F0=LQ0(N0),n="",a=f||F0,e={},$0=new z.__emitter(z);X0();let Q0="",_0=0,M0=0,A0=0,L0=!1;try{if(!N0.__emitTokens){a.matcher.considerAll();for(;;){if(A0++,L0)L0=!1;else a.matcher.considerAll();a.matcher.lastIndex=M0;let g=a.matcher.exec(h);if(!g)break;let u=h.substring(M0,g.index),t=V0(u,g);M0=g.index+t}V0(h.substring(M0))}else N0.__emitTokens(h,$0);return $0.finalize(),n=$0.toHTML(),{language:k,value:n,relevance:_0,illegal:!1,_emitter:$0,_top:a}}catch(g){if(g.message&&g.message.includes("Illegal"))return{language:k,value:dM(h),illegal:!0,relevance:0,_illegalBy:{message:g.message,index:M0,context:h.slice(M0-100,M0+100),mode:g.mode,resultSoFar:n},_emitter:$0};else if(Q)return{language:k,value:dM(h),illegal:!1,relevance:0,errorRaised:g,_emitter:$0,_top:a};else throw g}}function F(k){let h={value:dM(k),illegal:!1,relevance:0,_top:X,_emitter:new z.__emitter(z)};return h._emitter.addText(k),h}function W(k,h){h=h||z.languages||Object.keys(Z);let v=F(k),f=h.filter(C).filter(T).map((l)=>Y(l,k,!1));f.unshift(v);let w=f.sort((l,s)=>{if(l.relevance!==s.relevance)return s.relevance-l.relevance;if(l.language&&s.language){if(C(l.language).supersetOf===s.language)return 1;else if(C(s.language).supersetOf===l.language)return-1}return 0}),[i,r]=w,x=i;return x.secondBest=r,x}function q(k,h,v){let f=h&&J[h]||v;k.classList.add("hljs"),k.classList.add(`language-${f}`)}function N(k){let h=null,v=U(k);if(G(v))return;if(O("before:highlightElement",{el:k,language:v}),k.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",k);return}if(k.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(k);if(z.throwUnescapedHTML)throw new Bc("One of your code blocks includes unescaped HTML.",k.innerHTML)}h=k;let f=h.textContent,w=v?K(f,{language:v,ignoreIllegals:!0}):W(f);if(k.innerHTML=w.value,k.dataset.highlighted="yes",q(k,v,w.language),k.result={language:w.language,re:w.relevance,relevance:w.relevance},w.secondBest)k.secondBest={language:w.secondBest.language,relevance:w.secondBest.relevance};O("after:highlightElement",{el:k,result:w,text:f})}function V(k){z=dp(z,k)}let A=()=>{j(),XH("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function D(){j(),XH("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let L=!1;function j(){function k(){j()}if(document.readyState==="loading"){if(!L)window.addEventListener("DOMContentLoaded",k,!1);L=!0;return}document.querySelectorAll(z.cssSelector).forEach(N)}function M(k,h){let v=null;try{v=h($)}catch(f){if(l$("Language definition for '{}' could not be registered.".replace("{}",k)),!Q)throw f;else l$(f);v=X}if(!v.name)v.name=k;if(Z[k]=v,v.rawDefinition=h.bind(null,$),v.aliases)R(v.aliases,{languageName:k})}function _(k){delete Z[k];for(let h of Object.keys(J))if(J[h]===k)delete J[h]}function E(){return Object.keys(Z)}function C(k){return k=(k||"").toLowerCase(),Z[k]||Z[J[k]]}function R(k,{languageName:h}){if(typeof k==="string")k=[k];k.forEach((v)=>{J[v.toLowerCase()]=h})}function T(k){let h=C(k);return h&&!h.disableAutodetect}function I(k){if(k["before:highlightBlock"]&&!k["before:highlightElement"])k["before:highlightElement"]=(h)=>{k["before:highlightBlock"](Object.assign({block:h.el},h))};if(k["after:highlightBlock"]&&!k["after:highlightElement"])k["after:highlightElement"]=(h)=>{k["after:highlightBlock"](Object.assign({block:h.el},h))}}function y(k){I(k),H.push(k)}function S(k){let h=H.indexOf(k);if(h!==-1)H.splice(h,1)}function O(k,h){let v=k;H.forEach(function(f){if(f[v])f[v](h)})}function b(k){return XH("10.7.0","highlightBlock will be removed entirely in v12.0"),XH("10.7.0","Please use highlightElement now."),N(k)}Object.assign($,{highlight:K,highlightAuto:W,highlightAll:j,highlightElement:N,highlightBlock:b,configure:V,initHighlighting:A,initHighlightingOnLoad:D,registerLanguage:M,unregisterLanguage:_,listLanguages:E,getLanguage:C,registerAliases:R,autoDetection:T,inherit:dp,addPlugin:y,removePlugin:S}),$.debugMode=function(){Q=!1},$.safeMode=function(){Q=!0},$.versionString=PQ0,$.regex={concat:i$,lookahead:np,either:rM,optional:vH0,anyNumberOfTimes:hH0};for(let k in WW)if(typeof WW[k]==="object")ip(WW[k]);return Object.assign($,WW),$},zH=Xc({});zH.newInstance=()=>Xc({});zc.exports=zH;zH.HighlightJS=zH;zH.default=zH});var Gl=O5((bN1,zl)=>{var aX0=["||","&&",";;","|&","<(","<<<",">>",">&","<&","&",";","(",")","|","<",">"],Xl=/[\n\r\u2028\u2029]/,oX0=/[\s#!"$&'():;<=>@\\^`|]/g;zl.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(Xl.test(J.pattern))throw TypeError("glob `pattern` must not contain line terminators");return J.pattern.replace(oX0,"\\$&")}if("op"in J&&typeof J.op==="string"){if(aX0.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(Xl.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 Nl=O5((yN1,ql)=>{var Wl="(?:"+["\\|\\|","\\&\\&",";;","\\|\\&","\\<\\(","\\<\\<\\<",">>",">\\&","<\\&","[&;()|<>]"].join("|")+")",Ul=new RegExp("^"+Wl+"$"),Kl="|&;()<> \\t",nX0="'([^']*?)'",sX0='"((\\\\"|[^"])*?)"',tX0=/^#$/,Yl="'",Fl='"',TW="$",o$="",eX0=4294967296;for(CW=0;CW<4;CW++)o$+=(eX0*Math.random()).toString(16);var CW,$z0=new RegExp("^"+o$);function Zz0($,Z){var J=Z.lastIndex,H=[],Q;while(Q=Z.exec($))if(H[H.length]=Q,Z.lastIndex===Q.index)Z.lastIndex+=1;return Z.lastIndex=J,H}function Jz0($,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+o$+JSON.stringify(H)+o$;return Z+H}function Hz0($,Z,J){if(!J)J={};var H=J.escape||"\\",Q=J.splitUnquoted===!0?`
5
- `:typeof J.splitUnquoted==="string"?J.splitUnquoted:"",B="(\\"+H+`['"`+Kl+`]|[^\\s'"`+Kl+"])+",X=new RegExp(["("+Wl+")","("+B+"|"+sX0+"|"+nX0+")+"].join("|"),"g"),z=Zz0($,X);if(z.length===0)return[];if(!Z)Z={};var G=!1;return z.map(function(U){var K=U[0];if(!K||G)return;if(Ul.test(K))return{op:K};var Y=!1,F=!1,W="",q=[],N=!1,V=null,A=!1,D;function L(){D+=1;var I,y,S=K.charAt(D);if(S==="{"){if(D+=1,K.charAt(D)==="}")throw Error("Bad substitution: "+K.slice(D-2,D+1));var O=1;I=D;while(O>0&&I<K.length){if(K.charAt(I)==="{"&&K.charAt(I-1)==="$")O+=1;else if(K.charAt(I)==="}")O-=1;I+=1}if(O!==0)throw Error("Bad substitution: "+K.slice(D));I-=1,y=K.slice(D,I),D=I}else if(/[*@#?$!_-]/.test(S))y=S,D+=1;else{var b=K.slice(D);if(I=b.match(/[^\w\d_]/),!I)y=b,D=K.length;else y=b.slice(0,I.index),D+=I.index-1}return Jz0(Z,"",y)}function j(){if(V===null)return;if(V===0){if(W!=="")q[q.length]=W,W=""}else{q[q.length]=W,W="";for(var I=1;I<V;I+=1)q[q.length]=""}V=null}for(D=0;D<K.length;D++){var M=K.charAt(D);if(Q&&M!==TW)j();if(A=A||!Y&&(M==="*"||M==="?"),F)W+=M,F=!1;else if(Y)if(M===Y)Y=!1;else if(Y==Yl)W+=M;else if(M===H)if(D+=1,M=K.charAt(D),M===Fl||M===H||M===TW)W+=M;else W+=H+M;else if(M===TW)W+=L();else W+=M;else if(M===Fl||M===Yl)Y=M,N=!0;else if(Ul.test(M))return{op:K};else if(tX0.test(M)){G=!0;var _={comment:$.slice(U.index+D+1)};if(W.length)return[W,_];return[_]}else if(M===H)F=!0;else if(M===TW){var E=L();if(!Q)W+=E;else for(var C=0;C<E.length;C+=1){var R=E.charAt(C);if(Q.indexOf(R)<0)j(),W+=R;else if(V===null)V=R===" "||R==="\t"||R===`
6
- `?0:1;else if(R!==" "&&R!=="\t"&&R!==`
7
- `)V+=1}}else W+=M}if(A)return{op:"glob",pattern:W};if(Q){if(V!==null&&V>0){q[q.length]=W,W="";for(var T=1;T<V;T+=1)q[q.length]=""}if(W!==""||N&&q.length===0)q[q.length]=W;return q}return W}).reduce(function(U,K){if(typeof K>"u")return U;return[].concat(K).forEach(function(Y){U[U.length]=Y}),U},[])}ql.exports=function(Z,J,H){var Q=Hz0(Z,J,H);if(typeof J!=="function")return Q;return Q.reduce(function(B,X){if(typeof X==="object")return B[B.length]=X,B;var z=X.split(RegExp("("+o$+".*?"+o$+")","g"));if(z.length===1)return B[B.length]=z[0],B;return z.filter(Boolean).forEach(function(G){B[B.length]=$z0.test(G)?JSON.parse(G.split(o$)[1]):G}),B},[])}});var pa=O5((Eq,ua)=>{(function($,Z){typeof Eq==="object"&&typeof ua<"u"?Z(Eq):typeof define==="function"&&define.amd?define(["exports"],Z):($=typeof globalThis<"u"?globalThis:$||self,Z($["fast-equals"]={}))})(Eq,function($){function Z(p){return function(o,Z0,H0,G0,X0,Y0,V0){return p(o,Z0,V0)}}function J(p){return function(o,Z0,H0,G0){if(!o||!Z0||typeof o!=="object"||typeof Z0!=="object")return p(o,Z0,H0,G0);var X0=G0.get(o),Y0=G0.get(Z0);if(X0&&Y0)return X0===Z0&&Y0===o;G0.set(o,Z0),G0.set(Z0,o);var V0=p(o,Z0,H0,G0);return G0.delete(o),G0.delete(Z0),V0}}function H(p,d){var o={};for(var Z0 in p)o[Z0]=p[Z0];for(var Z0 in d)o[Z0]=d[Z0];return o}function Q(p){return p.constructor===Object||p.constructor==null}function B(p){return typeof p.then==="function"}function X(p,d){return p===d||p!==p&&d!==d}var z="[object Arguments]",G="[object Boolean]",U="[object Date]",K="[object RegExp]",Y="[object Map]",F="[object Number]",W="[object Object]",q="[object Set]",N="[object String]",V=Object.prototype.toString;function A(p){var{areArraysEqual:d,areDatesEqual:o,areMapsEqual:Z0,areObjectsEqual:H0,areRegExpsEqual:G0,areSetsEqual:X0,createIsNestedEqual:Y0}=p,V0=Y0(N0);function N0(F0,n,a){if(F0===n)return!0;if(!F0||!n||typeof F0!=="object"||typeof n!=="object")return F0!==F0&&n!==n;if(Q(F0)&&Q(n))return H0(F0,n,V0,a);var e=Array.isArray(F0),$0=Array.isArray(n);if(e||$0)return e===$0&&d(F0,n,V0,a);var Q0=V.call(F0);if(Q0!==V.call(n))return!1;if(Q0===U)return o(F0,n,V0,a);if(Q0===K)return G0(F0,n,V0,a);if(Q0===Y)return Z0(F0,n,V0,a);if(Q0===q)return X0(F0,n,V0,a);if(Q0===W||Q0===z)return B(F0)||B(n)?!1:H0(F0,n,V0,a);if(Q0===G||Q0===F||Q0===N)return X(F0.valueOf(),n.valueOf());return!1}return N0}function D(p,d,o,Z0){var H0=p.length;if(d.length!==H0)return!1;while(H0-- >0)if(!o(p[H0],d[H0],H0,H0,p,d,Z0))return!1;return!0}var L=J(D);function j(p,d){return X(p.valueOf(),d.valueOf())}function M(p,d,o,Z0){var H0=p.size===d.size;if(!H0)return!1;if(!p.size)return!0;var G0={},X0=0;return p.forEach(function(Y0,V0){if(!H0)return;var N0=!1,F0=0;d.forEach(function(n,a){if(!N0&&!G0[F0]&&(N0=o(V0,a,X0,F0,p,d,Z0)&&o(Y0,n,V0,a,p,d,Z0)))G0[F0]=!0;F0++}),X0++,H0=N0}),H0}var _=J(M),E="_owner",C=Object.prototype.hasOwnProperty;function R(p,d,o,Z0){var H0=Object.keys(p),G0=H0.length;if(Object.keys(d).length!==G0)return!1;var X0;while(G0-- >0){if(X0=H0[G0],X0===E){var Y0=!!p.$$typeof,V0=!!d.$$typeof;if((Y0||V0)&&Y0!==V0)return!1}if(!C.call(d,X0)||!o(p[X0],d[X0],X0,X0,p,d,Z0))return!1}return!0}var T=J(R);function I(p,d){return p.source===d.source&&p.flags===d.flags}function y(p,d,o,Z0){var H0=p.size===d.size;if(!H0)return!1;if(!p.size)return!0;var G0={};return p.forEach(function(X0,Y0){if(!H0)return;var V0=!1,N0=0;d.forEach(function(F0,n){if(!V0&&!G0[N0]&&(V0=o(X0,F0,Y0,n,p,d,Z0)))G0[N0]=!0;N0++}),H0=V0}),H0}var S=J(y),O=Object.freeze({areArraysEqual:D,areDatesEqual:j,areMapsEqual:M,areObjectsEqual:R,areRegExpsEqual:I,areSetsEqual:y,createIsNestedEqual:Z}),b=Object.freeze({areArraysEqual:L,areDatesEqual:j,areMapsEqual:_,areObjectsEqual:T,areRegExpsEqual:I,areSetsEqual:S,createIsNestedEqual:Z}),k=A(O);function h(p,d){return k(p,d,void 0)}var v=A(H(O,{createIsNestedEqual:function(){return X}}));function f(p,d){return v(p,d,void 0)}var w=A(b);function i(p,d){return w(p,d,new WeakMap)}var r=A(H(b,{createIsNestedEqual:function(){return X}}));function x(p,d){return r(p,d,new WeakMap)}function l(p){return A(H(O,p(O)))}function s(p){var d=A(H(b,p(b)));return function(o,Z0,H0){if(H0===void 0)H0=new WeakMap;return d(o,Z0,H0)}}$.circularDeepEqual=i,$.circularShallowEqual=x,$.createCustomCircularEqual=s,$.createCustomEqual=l,$.deepEqual=h,$.sameValueZeroEqual=X,$.shallowEqual=f,Object.defineProperty($,"__esModule",{value:!0})})});var da=O5((_O1,ca)=>{var RK0="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";ca.exports=RK0});var aa=O5((jO1,ra)=>{var IK0=da();function la(){}function ia(){}ia.resetWarningCache=la;ra.exports=function(){function $(H,Q,B,X,z,G){if(G===IK0)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:ia,resetWarningCache:la};return J.PropTypes=J,J}});var RX=O5((OO1,oa)=>{oa.exports=aa()();var kK0,bK0});var ta=O5((TO1,f_)=>{function sa($){var Z,J,H="";if(typeof $=="string"||typeof $=="number")H+=$;else if(typeof $=="object")if(Array.isArray($)){var Q=$.length;for(Z=0;Z<Q;Z++)$[Z]&&(J=sa($[Z]))&&(H&&(H+=" "),H+=J)}else for(J in $)$[J]&&(H&&(H+=" "),H+=J);return H}function na(){for(var $,Z,J=0,H="",Q=arguments.length;J<Q;J++)($=arguments[J])&&(Z=sa($))&&(H&&(H+=" "),H+=Z);return H}f_.exports=na,f_.exports.clsx=na});var IX=O5((ea)=>{Object.defineProperty(ea,"__esModule",{value:!0});ea.dontSetMe=gK0;ea.findInArray=yK0;ea.int=vK0;ea.isFunction=xK0;ea.isNum=hK0;function yK0($,Z){for(let J=0,H=$.length;J<H;J++)if(Z.apply(Z,[$[J],J,$]))return $[J]}function xK0($){return typeof $==="function"||Object.prototype.toString.call($)==="[object Function]"}function hK0($){return typeof $==="number"&&!isNaN($)}function vK0($){return parseInt($,10)}function gK0($,Z,J){if($[Z])return Error(`Invalid prop ${Z} passed to ${J} - do not set this, set it on the child.`)}});var Qo=O5((Jo)=>{Object.defineProperty(Jo,"__esModule",{value:!0});Jo.browserPrefixToKey=Zo;Jo.browserPrefixToStyle=dK0;Jo.default=void 0;Jo.getPrefix=$o;var m_=["Moz","Webkit","O","ms"];function $o(){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<m_.length;J++)if(Zo($,m_[J])in Z)return m_[J];return""}function Zo($,Z){return Z?`${Z}${lK0($)}`:$}function dK0($,Z){return Z?`-${Z.toLowerCase()}-${$}`:$}function lK0($){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 wO1=Jo.default=$o()});var Rq=O5((Yo)=>{Object.defineProperty(Yo,"__esModule",{value:!0});Yo.addClassName=Uo;Yo.addEvent=nK0;Yo.addUserSelectStyles=zY0;Yo.createCSSTransform=HY0;Yo.createSVGTransform=QY0;Yo.getTouch=BY0;Yo.getTouchIdentifier=XY0;Yo.getTranslation=u_;Yo.innerHeight=$Y0;Yo.innerWidth=ZY0;Yo.matchesSelector=Go;Yo.matchesSelectorAndParentsTo=oK0;Yo.offsetXYFromParent=JY0;Yo.outerHeight=tK0;Yo.outerWidth=eK0;Yo.removeClassName=Ko;Yo.removeEvent=sK0;Yo.scheduleRemoveUserSelectStyles=GY0;var G8=IX(),Bo=zo(Qo());function zo($,Z){if(typeof WeakMap=="function")var J=new WeakMap,H=new WeakMap;return(zo=function(Q,B){if(!B&&Q&&Q.__esModule)return Q;var X,z,G={__proto__:null,default:Q};if(Q===null||typeof Q!="object"&&typeof Q!="function")return G;if(X=B?H:J){if(X.has(Q))return X.get(Q);X.set(Q,G)}for(let U in Q)U!=="default"&&{}.hasOwnProperty.call(Q,U)&&((z=(X=Object.defineProperty)&&Object.getOwnPropertyDescriptor(Q,U))&&(z.get||z.set)?X(G,U,z):G[U]=Q[U]);return G})($,Z)}var Sq="";function Go($,Z){if(!Sq)Sq=(0,G8.findInArray)(["matches","webkitMatchesSelector","mozMatchesSelector","msMatchesSelector","oMatchesSelector"],function(J){return(0,G8.isFunction)($[J])});if(!(0,G8.isFunction)($[Sq]))return!1;return $[Sq](Z)}function oK0($,Z,J){let H=$;do{if(Go(H,Z))return!0;if(H===J)return!1;H=H.parentNode}while(H);return!1}function nK0($,Z,J,H){if(!$)return;let Q={capture:!0,...H};if($.addEventListener)$.addEventListener(Z,J,Q);else if($.attachEvent)$.attachEvent("on"+Z,J);else $["on"+Z]=J}function sK0($,Z,J,H){if(!$)return;let Q={capture:!0,...H};if($.removeEventListener)$.removeEventListener(Z,J,Q);else if($.detachEvent)$.detachEvent("on"+Z,J);else $["on"+Z]=null}function tK0($){let Z=$.clientHeight,J=$.ownerDocument.defaultView.getComputedStyle($);return Z+=(0,G8.int)(J.borderTopWidth),Z+=(0,G8.int)(J.borderBottomWidth),Z}function eK0($){let Z=$.clientWidth,J=$.ownerDocument.defaultView.getComputedStyle($);return Z+=(0,G8.int)(J.borderLeftWidth),Z+=(0,G8.int)(J.borderRightWidth),Z}function $Y0($){let Z=$.clientHeight,J=$.ownerDocument.defaultView.getComputedStyle($);return Z-=(0,G8.int)(J.paddingTop),Z-=(0,G8.int)(J.paddingBottom),Z}function ZY0($){let Z=$.clientWidth,J=$.ownerDocument.defaultView.getComputedStyle($);return Z-=(0,G8.int)(J.paddingLeft),Z-=(0,G8.int)(J.paddingRight),Z}function JY0($,Z,J){let Q=Z===Z.ownerDocument.body?{left:0,top:0}:Z.getBoundingClientRect(),B=($.clientX+Z.scrollLeft-Q.left)/J,X=($.clientY+Z.scrollTop-Q.top)/J;return{x:B,y:X}}function HY0($,Z){let J=u_($,Z,"px");return{[(0,Bo.browserPrefixToKey)("transform",Bo.default)]:J}}function QY0($,Z){return u_($,Z,"")}function u_($,Z,J){let{x:H,y:Q}=$,B=`translate(${H}${J},${Q}${J})`;if(Z){let X=`${typeof Z.x==="string"?Z.x:Z.x+J}`,z=`${typeof Z.y==="string"?Z.y:Z.y+J}`;B=`translate(${X}, ${z})`+B}return B}function BY0($,Z){return $.targetTouches&&(0,G8.findInArray)($.targetTouches,(J)=>Z===J.identifier)||$.changedTouches&&(0,G8.findInArray)($.changedTouches,(J)=>Z===J.identifier)}function XY0($){if($.targetTouches&&$.targetTouches[0])return $.targetTouches[0].identifier;if($.changedTouches&&$.changedTouches[0])return $.changedTouches[0].identifier}function zY0($){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)Uo($.body,"react-draggable-transparent-selection")}function GY0($){if(window.requestAnimationFrame)window.requestAnimationFrame(()=>{Xo($)});else Xo($)}function Xo($){if(!$)return;try{if($.body)Ko($.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 Uo($,Z){if($.classList)$.classList.add(Z);else if(!$.className.match(new RegExp(`(?:^|\\s)${Z}(?!\\S)`)))$.className+=` ${Z}`}function Ko($,Z){if($.classList)$.classList.remove(Z);else $.className=$.className.replace(new RegExp(`(?:^|\\s)${Z}(?!\\S)`,"g"),"")}});var c_=O5((Fo)=>{Object.defineProperty(Fo,"__esModule",{value:!0});Fo.canDragX=SY0;Fo.canDragY=RY0;Fo.createCoreData=kY0;Fo.createDraggableData=bY0;Fo.getBoundPosition=wY0;Fo.getControlPosition=IY0;Fo.snapToGrid=EY0;var U8=IX(),TH=Rq();function wY0($,Z,J){if(!$.props.bounds)return[Z,J];let{bounds:H}=$.props;H=typeof H==="string"?H:yY0(H);let Q=p_($);if(typeof H==="string"){let{ownerDocument:B}=Q,X=B.defaultView,z;if(H==="parent")z=Q.parentNode;else z=Q.getRootNode().querySelector(H);if(!(z instanceof X.HTMLElement))throw Error('Bounds selector "'+H+'" could not find an element.');let G=z,U=X.getComputedStyle(Q),K=X.getComputedStyle(G);H={left:-Q.offsetLeft+(0,U8.int)(K.paddingLeft)+(0,U8.int)(U.marginLeft),top:-Q.offsetTop+(0,U8.int)(K.paddingTop)+(0,U8.int)(U.marginTop),right:(0,TH.innerWidth)(G)-(0,TH.outerWidth)(Q)-Q.offsetLeft+(0,U8.int)(K.paddingRight)-(0,U8.int)(U.marginRight),bottom:(0,TH.innerHeight)(G)-(0,TH.outerHeight)(Q)-Q.offsetTop+(0,U8.int)(K.paddingBottom)-(0,U8.int)(U.marginBottom)}}if((0,U8.isNum)(H.right))Z=Math.min(Z,H.right);if((0,U8.isNum)(H.bottom))J=Math.min(J,H.bottom);if((0,U8.isNum)(H.left))Z=Math.max(Z,H.left);if((0,U8.isNum)(H.top))J=Math.max(J,H.top);return[Z,J]}function EY0($,Z,J){let H=Math.round(Z/$[0])*$[0],Q=Math.round(J/$[1])*$[1];return[H,Q]}function SY0($){return $.props.axis==="both"||$.props.axis==="x"}function RY0($){return $.props.axis==="both"||$.props.axis==="y"}function IY0($,Z,J){let H=typeof Z==="number"?(0,TH.getTouch)($,Z):null;if(typeof Z==="number"&&!H)return null;let Q=p_(J),B=J.props.offsetParent||Q.offsetParent||Q.ownerDocument.body;return(0,TH.offsetXYFromParent)(H||$,B,J.props.scale)}function kY0($,Z,J){let H=!(0,U8.isNum)($.lastX),Q=p_($);if(H)return{node:Q,deltaX:0,deltaY:0,lastX:Z,lastY:J,x:Z,y:J};else return{node:Q,deltaX:Z-$.lastX,deltaY:J-$.lastY,lastX:$.lastX,lastY:$.lastY,x:Z,y:J}}function bY0($,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 yY0($){return{left:$.left,top:$.top,right:$.right,bottom:$.bottom}}function p_($){let Z=$.findDOMNode();if(!Z)throw Error("<DraggableCore>: Unmounted during event!");return Z}});var d_=O5((Wo)=>{Object.defineProperty(Wo,"__esModule",{value:!0});Wo.default=pY0;function pY0(){}});var Vo=O5((No)=>{var rY0=P(m()),aY0=P(e4());Object.defineProperty(No,"__esModule",{value:!0});No.default=void 0;var l_=qo(rY0),S4=r_(RX()),dY0=r_(aY0),W4=Rq(),P7=c_(),i_=IX(),kX=r_(d_());function r_($){return $&&$.__esModule?$:{default:$}}function qo($,Z){if(typeof WeakMap=="function")var J=new WeakMap,H=new WeakMap;return(qo=function(Q,B){if(!B&&Q&&Q.__esModule)return Q;var X,z,G={__proto__:null,default:Q};if(Q===null||typeof Q!="object"&&typeof Q!="function")return G;if(X=B?H:J){if(X.has(Q))return X.get(Q);X.set(Q,G)}for(let U in Q)U!=="default"&&{}.hasOwnProperty.call(Q,U)&&((z=(X=Object.defineProperty)&&Object.getOwnPropertyDescriptor(Q,U))&&(z.get||z.set)?X(G,U,z):G[U]=Q[U]);return G})($,Z)}function R4($,Z,J){return(Z=lY0(Z))in $?Object.defineProperty($,Z,{value:J,enumerable:!0,configurable:!0,writable:!0}):$[Z]=J,$}function lY0($){var Z=iY0($,"string");return typeof Z=="symbol"?Z:Z+""}function iY0($,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 F9={touch:{start:"touchstart",move:"touchmove",stop:"touchend"},mouse:{start:"mousedown",move:"mousemove",stop:"mouseup"}},_7=F9.mouse;class bX extends l_.Component{constructor(){super(...arguments);R4(this,"dragging",!1),R4(this,"lastX",NaN),R4(this,"lastY",NaN),R4(this,"touchIdentifier",null),R4(this,"mounted",!1),R4(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,W4.matchesSelectorAndParentsTo)($.target,this.props.handle,Z)||this.props.cancel&&(0,W4.matchesSelectorAndParentsTo)($.target,this.props.cancel,Z))return;if($.type==="touchstart"&&!this.props.allowMobileScroll)$.preventDefault();let H=(0,W4.getTouchIdentifier)($);this.touchIdentifier=H;let Q=(0,P7.getControlPosition)($,H,this);if(Q==null)return;let{x:B,y:X}=Q,z=(0,P7.createCoreData)(this,B,X);if((0,kX.default)("DraggableCore: handleDragStart: %j",z),(0,kX.default)("calling",this.props.onStart),this.props.onStart($,z)===!1||this.mounted===!1)return;if(this.props.enableUserSelectHack)(0,W4.addUserSelectStyles)(J);this.dragging=!0,this.lastX=B,this.lastY=X,(0,W4.addEvent)(J,_7.move,this.handleDrag),(0,W4.addEvent)(J,_7.stop,this.handleDragStop)}),R4(this,"handleDrag",($)=>{let Z=(0,P7.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,P7.snapToGrid)(this.props.grid,X,z),!X&&!z)return;J=this.lastX+X,H=this.lastY+z}let Q=(0,P7.createCoreData)(this,J,H);if((0,kX.default)("DraggableCore: handleDrag: %j",Q),this.props.onDrag($,Q)===!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}),R4(this,"handleDragStop",($)=>{if(!this.dragging)return;let Z=(0,P7.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,P7.snapToGrid)(this.props.grid,z,G),J=this.lastX+z,H=this.lastY+G}let Q=(0,P7.createCoreData)(this,J,H);if(this.props.onStop($,Q)===!1||this.mounted===!1)return!1;let X=this.findDOMNode();if(X){if(this.props.enableUserSelectHack)(0,W4.scheduleRemoveUserSelectStyles)(X.ownerDocument)}if((0,kX.default)("DraggableCore: handleDragStop: %j",Q),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,X)(0,kX.default)("DraggableCore: Removing handlers"),(0,W4.removeEvent)(X.ownerDocument,_7.move,this.handleDrag),(0,W4.removeEvent)(X.ownerDocument,_7.stop,this.handleDragStop)}),R4(this,"onMouseDown",($)=>{return _7=F9.mouse,this.handleDragStart($)}),R4(this,"onMouseUp",($)=>{return _7=F9.mouse,this.handleDragStop($)}),R4(this,"onTouchStart",($)=>{return _7=F9.touch,this.handleDragStart($)}),R4(this,"onTouchEnd",($)=>{return _7=F9.touch,this.handleDragStop($)})}componentDidMount(){this.mounted=!0;let $=this.findDOMNode();if($)(0,W4.addEvent)($,F9.touch.start,this.onTouchStart,{passive:!1})}componentWillUnmount(){this.mounted=!1;let $=this.findDOMNode();if($){let{ownerDocument:Z}=$;if((0,W4.removeEvent)(Z,F9.mouse.move,this.handleDrag),(0,W4.removeEvent)(Z,F9.touch.move,this.handleDrag),(0,W4.removeEvent)(Z,F9.mouse.stop,this.handleDragStop),(0,W4.removeEvent)(Z,F9.touch.stop,this.handleDragStop),(0,W4.removeEvent)($,F9.touch.start,this.onTouchStart,{passive:!1}),this.props.enableUserSelectHack)(0,W4.scheduleRemoveUserSelectStyles)(Z)}}findDOMNode(){return this.props?.nodeRef?this.props?.nodeRef?.current:dY0.default.findDOMNode(this)}render(){return l_.cloneElement(l_.Children.only(this.props.children),{onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}}No.default=bX;R4(bX,"displayName","DraggableCore");R4(bX,"propTypes",{allowAnyClick:S4.default.bool,allowMobileScroll:S4.default.bool,children:S4.default.node.isRequired,disabled:S4.default.bool,enableUserSelectHack:S4.default.bool,offsetParent:function($,Z){if($[Z]&&$[Z].nodeType!==1)throw Error("Draggable's offsetParent must be a DOM Node.")},grid:S4.default.arrayOf(S4.default.number),handle:S4.default.string,cancel:S4.default.string,nodeRef:S4.default.object,onStart:S4.default.func,onDrag:S4.default.func,onStop:S4.default.func,onMouseDown:S4.default.func,scale:S4.default.number,className:i_.dontSetMe,style:i_.dontSetMe,transform:i_.dontSetMe});R4(bX,"defaultProps",{allowAnyClick:!1,allowMobileScroll:!1,disabled:!1,enableUserSelectHack:!0,onStart:function(){},onDrag:function(){},onStop:function(){},onMouseDown:function(){},scale:1})});var Po=O5((n_)=>{var eY0=P(m()),$F0=P(e4());Object.defineProperty(n_,"__esModule",{value:!0});Object.defineProperty(n_,"DraggableCore",{enumerable:!0,get:function(){return bq.default}});n_.default=void 0;var Iq=Lo(eY0),y5=yq(RX()),oY0=yq($F0),nY0=ta(),Do=Rq(),CH=c_(),a_=IX(),bq=yq(Vo()),kq=yq(d_());function yq($){return $&&$.__esModule?$:{default:$}}function Lo($,Z){if(typeof WeakMap=="function")var J=new WeakMap,H=new WeakMap;return(Lo=function(Q,B){if(!B&&Q&&Q.__esModule)return Q;var X,z,G={__proto__:null,default:Q};if(Q===null||typeof Q!="object"&&typeof Q!="function")return G;if(X=B?H:J){if(X.has(Q))return X.get(Q);X.set(Q,G)}for(let U in Q)U!=="default"&&{}.hasOwnProperty.call(Q,U)&&((z=(X=Object.defineProperty)&&Object.getOwnPropertyDescriptor(Q,U))&&(z.get||z.set)?X(G,U,z):G[U]=Q[U]);return G})($,Z)}function o_(){return o_=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 $},o_.apply(null,arguments)}function wH($,Z,J){return(Z=sY0(Z))in $?Object.defineProperty($,Z,{value:J,enumerable:!0,configurable:!0,writable:!0}):$[Z]=J,$}function sY0($){var Z=tY0($,"string");return typeof Z=="symbol"?Z:Z+""}function tY0($,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 yX extends Iq.Component{static getDerivedStateFromProps($,Z){let{position:J}=$,{prevPropsPosition:H}=Z;if(J&&(!H||J.x!==H.x||J.y!==H.y))return(0,kq.default)("Draggable: getDerivedStateFromProps %j",{position:J,prevPropsPosition:H}),{x:J.x,y:J.y,prevPropsPosition:{...J}};return null}constructor($){super($);if(wH(this,"onDragStart",(Z,J)=>{if((0,kq.default)("Draggable: onDragStart: %j",J),this.props.onStart(Z,(0,CH.createDraggableData)(this,J))===!1)return!1;this.setState({dragging:!0,dragged:!0})}),wH(this,"onDrag",(Z,J)=>{if(!this.state.dragging)return!1;(0,kq.default)("Draggable: onDrag: %j",J);let H=(0,CH.createDraggableData)(this,J),Q={x:H.x,y:H.y,slackX:0,slackY:0};if(this.props.bounds){let{x:X,y:z}=Q;Q.x+=this.state.slackX,Q.y+=this.state.slackY;let[G,U]=(0,CH.getBoundPosition)(this,Q.x,Q.y);Q.x=G,Q.y=U,Q.slackX=this.state.slackX+(X-Q.x),Q.slackY=this.state.slackY+(z-Q.y),H.x=Q.x,H.y=Q.y,H.deltaX=Q.x-this.state.x,H.deltaY=Q.y-this.state.y}if(this.props.onDrag(Z,H)===!1)return!1;this.setState(Q)}),wH(this,"onDragStop",(Z,J)=>{if(!this.state.dragging)return!1;if(this.props.onStop(Z,(0,CH.createDraggableData)(this,J))===!1)return!1;(0,kq.default)("Draggable: onDragStop: %j",J);let Q={dragging:!1,slackX:0,slackY:0};if(Boolean(this.props.position)){let{x:X,y:z}=this.props.position;Q.x=X,Q.y=z}this.setState(Q)}),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??oY0.default.findDOMNode(this)}render(){let{axis:$,bounds:Z,children:J,defaultPosition:H,defaultClassName:Q,defaultClassNameDragging:B,defaultClassNameDragged:X,position:z,positionOffset:G,scale:U,...K}=this.props,Y={},F=null,q=!Boolean(z)||this.state.dragging,N=z||H,V={x:(0,CH.canDragX)(this)&&q?this.state.x:N.x,y:(0,CH.canDragY)(this)&&q?this.state.y:N.y};if(this.state.isElementSVG)F=(0,Do.createSVGTransform)(V,G);else Y=(0,Do.createCSSTransform)(V,G);let A=(0,nY0.clsx)(J.props.className||"",Q,{[B]:this.state.dragging,[X]:this.state.dragged});return Iq.createElement(bq.default,o_({},K,{onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop}),Iq.cloneElement(Iq.Children.only(J),{className:A,style:{...J.props.style,...Y},transform:F}))}}n_.default=yX;wH(yX,"displayName","Draggable");wH(yX,"propTypes",{...bq.default.propTypes,axis:y5.default.oneOf(["both","x","y","none"]),bounds:y5.default.oneOfType([y5.default.shape({left:y5.default.number,right:y5.default.number,top:y5.default.number,bottom:y5.default.number}),y5.default.string,y5.default.oneOf([!1])]),defaultClassName:y5.default.string,defaultClassNameDragging:y5.default.string,defaultClassNameDragged:y5.default.string,defaultPosition:y5.default.shape({x:y5.default.number,y:y5.default.number}),positionOffset:y5.default.shape({x:y5.default.oneOfType([y5.default.number,y5.default.string]),y:y5.default.oneOfType([y5.default.number,y5.default.string])}),position:y5.default.shape({x:y5.default.number,y:y5.default.number}),className:a_.dontSetMe,style:a_.dontSetMe,transform:a_.dontSetMe});wH(yX,"defaultProps",{...bq.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 hq=O5((yO1,xq)=>{var{default:_o,DraggableCore:ZF0}=Po();xq.exports=_o;xq.exports.default=_o;xq.exports.DraggableCore=ZF0});var To=O5((GF0)=>{var YF0=P(m());GF0.__esModule=!0;GF0.cloneElement=zF0;var JF0=HF0(YF0);function HF0($){return $&&$.__esModule?$:{default:$}}function jo($,Z){var J=Object.keys($);if(Object.getOwnPropertySymbols){var H=Object.getOwnPropertySymbols($);Z&&(H=H.filter(function(Q){return Object.getOwnPropertyDescriptor($,Q).enumerable})),J.push.apply(J,H)}return J}function Oo($){for(var Z=1;Z<arguments.length;Z++){var J=arguments[Z]!=null?arguments[Z]:{};Z%2?jo(Object(J),!0).forEach(function(H){QF0($,H,J[H])}):Object.getOwnPropertyDescriptors?Object.defineProperties($,Object.getOwnPropertyDescriptors(J)):jo(Object(J)).forEach(function(H){Object.defineProperty($,H,Object.getOwnPropertyDescriptor(J,H))})}return $}function QF0($,Z,J){return(Z=BF0(Z))in $?Object.defineProperty($,Z,{value:J,enumerable:!0,configurable:!0,writable:!0}):$[Z]=J,$}function BF0($){var Z=XF0($,"string");return typeof Z=="symbol"?Z:Z+""}function XF0($,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 zF0($,Z){if(Z.style&&$.props.style)Z.style=Oo(Oo({},$.props.style),Z.style);if(Z.className&&$.props.className)Z.className=$.props.className+" "+Z.className;return JF0.default.cloneElement($,Z)}});var s_=O5((WF0)=>{WF0.__esModule=!0;WF0.resizableProps=void 0;var w1=FF0(RX()),hO1=hq();function FF0($){return $&&$.__esModule?$:{default:$}}var vO1=WF0.resizableProps={axis:w1.default.oneOf(["both","x","y","none"]),className:w1.default.string,children:w1.default.element.isRequired,draggableOpts:w1.default.shape({allowAnyClick:w1.default.bool,cancel:w1.default.string,children:w1.default.node,disabled:w1.default.bool,enableUserSelectHack:w1.default.bool,offsetParent:typeof Element<"u"?w1.default.instanceOf(Element):w1.default.any,grid:w1.default.arrayOf(w1.default.number),handle:w1.default.string,nodeRef:w1.default.object,onStart:w1.default.func,onDrag:w1.default.func,onStop:w1.default.func,onMouseDown:w1.default.func,scale:w1.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 w1.default.number.isRequired(...Z);return w1.default.number(...Z)},handle:w1.default.oneOfType([w1.default.node,w1.default.func]),handleSize:w1.default.arrayOf(w1.default.number),lockAspectRatio:w1.default.bool,maxConstraints:w1.default.arrayOf(w1.default.number),minConstraints:w1.default.arrayOf(w1.default.number),onResizeStop:w1.default.func,onResizeStart:w1.default.func,onResize:w1.default.func,resizeHandles:w1.default.arrayOf(w1.default.oneOf(["s","w","e","n","sw","nw","se","ne"])),transformScale:w1.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 w1.default.number.isRequired(...Z);return w1.default.number(...Z)}}});var $j=O5((jF0)=>{var TF0=P(m());jF0.__esModule=!0;jF0.default=void 0;var EH=Eo(TF0),NF0=hq(),AF0=To(),VF0=s_(),DF0=["children","className","draggableOpts","width","height","handle","handleSize","lockAspectRatio","axis","minConstraints","maxConstraints","onResize","onResizeStop","onResizeStart","resizeHandles","transformScale"];function Eo($,Z){if(typeof WeakMap=="function")var J=new WeakMap,H=new WeakMap;return(Eo=function(Q,B){if(!B&&Q&&Q.__esModule)return Q;var X,z,G={__proto__:null,default:Q};if(Q===null||typeof Q!="object"&&typeof Q!="function")return G;if(X=B?H:J){if(X.has(Q))return X.get(Q);X.set(Q,G)}for(let U in Q)U!=="default"&&{}.hasOwnProperty.call(Q,U)&&((z=(X=Object.defineProperty)&&Object.getOwnPropertyDescriptor(Q,U))&&(z.get||z.set)?X(G,U,z):G[U]=Q[U]);return G})($,Z)}function e_(){return e_=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 $},e_.apply(null,arguments)}function LF0($,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 wo($,Z){var J=Object.keys($);if(Object.getOwnPropertySymbols){var H=Object.getOwnPropertySymbols($);Z&&(H=H.filter(function(Q){return Object.getOwnPropertyDescriptor($,Q).enumerable})),J.push.apply(J,H)}return J}function t_($){for(var Z=1;Z<arguments.length;Z++){var J=arguments[Z]!=null?arguments[Z]:{};Z%2?wo(Object(J),!0).forEach(function(H){MF0($,H,J[H])}):Object.getOwnPropertyDescriptors?Object.defineProperties($,Object.getOwnPropertyDescriptors(J)):wo(Object(J)).forEach(function(H){Object.defineProperty($,H,Object.getOwnPropertyDescriptor(J,H))})}return $}function MF0($,Z,J){return(Z=PF0(Z))in $?Object.defineProperty($,Z,{value:J,enumerable:!0,configurable:!0,writable:!0}):$[Z]=J,$}function PF0($){var Z=_F0($,"string");return typeof Z=="symbol"?Z:Z+""}function _F0($,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 vq extends EH.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,Q=J.maxConstraints,B=J.lockAspectRatio;if(!H&&!Q&&!B)return[$,Z];if(B){let Y=this.props.width/this.props.height,F=$-this.props.width,W=Z-this.props.height;if(Math.abs(F)>Math.abs(W*Y))Z=$/Y;else $=Z*Y}let X=$,z=Z,G=this.slack||[0,0],U=G[0],K=G[1];if($+=U,Z+=K,H)$=Math.max(H[0],$),Z=Math.max(H[1],Z);if(Q)$=Math.min(Q[0],$),Z=Math.min(Q[1],Z);return this.slack=[U+(X-$),K+(z-Z)],[$,Z]}resizeHandler($,Z){return(J,H)=>{var Q,B,X,z;let{node:G,deltaX:U,deltaY:K}=H;if($==="onResizeStart")this.resetData();let Y=(this.props.axis==="both"||this.props.axis==="x")&&Z!=="n"&&Z!=="s",F=(this.props.axis==="both"||this.props.axis==="y")&&Z!=="e"&&Z!=="w";if(!Y&&!F)return;let W=Z[0],q=Z[Z.length-1],N=G.getBoundingClientRect();if(this.lastHandleRect!=null){if(q==="w"){let R=N.left-this.lastHandleRect.left;U+=R}if(W==="n"){let R=N.top-this.lastHandleRect.top;K+=R}}if(this.lastHandleRect=N,q==="w")U=-U;if(W==="n")K=-K;let V=(Q=(B=this.lastSize)==null?void 0:B.width)!=null?Q:this.props.width,A=(X=(z=this.lastSize)==null?void 0:z.height)!=null?X:this.props.height,D=V+(Y?U/this.props.transformScale:0),L=A+(F?K/this.props.transformScale:0);var j=this.runConstraints(D,L);if(D=j[0],L=j[1],$==="onResizeStop"&&this.lastSize){var M=this.lastSize;D=M.width,L=M.height}let _=D!==V||L!==A;if($!=="onResizeStop")this.lastSize={width:D,height:L};let E=typeof this.props[$]==="function"?this.props[$]:null;if(E&&!($==="onResize"&&!_))J.persist==null||J.persist(),E(J,{node:G,size:{width:D,height:L},handle:Z});if($==="onResizeStop")this.resetData()}}renderResizeHandle($,Z){let J=this.props.handle;if(!J)return EH.createElement("span",{className:"react-resizable-handle react-resizable-handle-"+$,ref:Z});if(typeof J==="function")return J($,Z);let H=typeof J.type==="string",Q=t_({ref:Z},H?{}:{handleAxis:$});return EH.cloneElement(J,Q)}render(){let $=this.props,Z=$.children,J=$.className,H=$.draggableOpts,Q=$.width,B=$.height,X=$.handle,z=$.handleSize,G=$.lockAspectRatio,U=$.axis,K=$.minConstraints,Y=$.maxConstraints,F=$.onResize,W=$.onResizeStop,q=$.onResizeStart,N=$.resizeHandles,V=$.transformScale,A=LF0($,DF0);return(0,AF0.cloneElement)(Z,t_(t_({},A),{},{className:(J?J+" ":"")+"react-resizable",children:[...EH.Children.toArray(Z.props.children),...N.map((D)=>{var L;let j=(L=this.handleRefs[D])!=null?L:this.handleRefs[D]=EH.createRef();return EH.createElement(NF0.DraggableCore,e_({},H,{nodeRef:j,key:"resizableHandle-"+D,onStop:this.resizeHandler("onResizeStop",D),onStart:this.resizeHandler("onResizeStart",D),onDrag:this.resizeHandler("onResize",D)}),this.renderResizeHandle(D,j))})]}))}}jF0.default=vq;vq.propTypes=VF0.resizableProps;vq.defaultProps={axis:"both",handleSize:[20,20],lockAspectRatio:!1,minConstraints:[20,20],maxConstraints:[1/0,1/0],resizeHandles:["se"],transformScale:1}});var yo=O5((yF0)=>{var hF0=P(m());yF0.__esModule=!0;yF0.default=void 0;var Zj=ko(hF0),CF0=Io(RX()),wF0=Io($j()),EF0=s_(),SF0=["handle","handleSize","onResize","onResizeStart","onResizeStop","draggableOpts","minConstraints","maxConstraints","lockAspectRatio","axis","width","height","resizeHandles","style","transformScale"];function Io($){return $&&$.__esModule?$:{default:$}}function ko($,Z){if(typeof WeakMap=="function")var J=new WeakMap,H=new WeakMap;return(ko=function(Q,B){if(!B&&Q&&Q.__esModule)return Q;var X,z,G={__proto__:null,default:Q};if(Q===null||typeof Q!="object"&&typeof Q!="function")return G;if(X=B?H:J){if(X.has(Q))return X.get(Q);X.set(Q,G)}for(let U in Q)U!=="default"&&{}.hasOwnProperty.call(Q,U)&&((z=(X=Object.defineProperty)&&Object.getOwnPropertyDescriptor(Q,U))&&(z.get||z.set)?X(G,U,z):G[U]=Q[U]);return G})($,Z)}function Jj(){return Jj=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 $},Jj.apply(null,arguments)}function Ro($,Z){var J=Object.keys($);if(Object.getOwnPropertySymbols){var H=Object.getOwnPropertySymbols($);Z&&(H=H.filter(function(Q){return Object.getOwnPropertyDescriptor($,Q).enumerable})),J.push.apply(J,H)}return J}function gq($){for(var Z=1;Z<arguments.length;Z++){var J=arguments[Z]!=null?arguments[Z]:{};Z%2?Ro(Object(J),!0).forEach(function(H){RF0($,H,J[H])}):Object.getOwnPropertyDescriptors?Object.defineProperties($,Object.getOwnPropertyDescriptors(J)):Ro(Object(J)).forEach(function(H){Object.defineProperty($,H,Object.getOwnPropertyDescriptor(J,H))})}return $}function RF0($,Z,J){return(Z=IF0(Z))in $?Object.defineProperty($,Z,{value:J,enumerable:!0,configurable:!0,writable:!0}):$[Z]=J,$}function IF0($){var Z=kF0($,"string");return typeof Z=="symbol"?Z:Z+""}function kF0($,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($==null)return{};var J={};for(var H in $)if({}.hasOwnProperty.call($,H)){if(Z.indexOf(H)!==-1)continue;J[H]=$[H]}return J}class Hj extends Zj.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,Q=$.onResizeStart,B=$.onResizeStop,X=$.draggableOpts,z=$.minConstraints,G=$.maxConstraints,U=$.lockAspectRatio,K=$.axis,Y=$.width,F=$.height,W=$.resizeHandles,q=$.style,N=$.transformScale,V=bF0($,SF0);return Zj.createElement(wF0.default,{axis:K,draggableOpts:X,handle:Z,handleSize:J,height:this.state.height,lockAspectRatio:U,maxConstraints:G,minConstraints:z,onResizeStart:Q,onResize:this.onResize,onResizeStop:B,resizeHandles:W,transformScale:N,width:this.state.width},Zj.createElement("div",Jj({},V,{style:gq(gq({},q),{},{width:this.state.width+"px",height:this.state.height+"px"})})))}}yF0.default=Hj;Hj.propTypes=gq(gq({},EF0.resizableProps),{},{children:CF0.default.element})});var xo=O5((uO1,fq)=>{fq.exports=function(){throw Error("Don't instantiate Resizable directly! Use require('react-resizable').Resizable")};fq.exports.Resizable=$j().default;fq.exports.ResizableBox=yo().default});var KZ=P(m(),1),Sj=P(c(),1),QN=KZ.createContext(void 0),U1=($)=>{let Z=KZ.useContext(QN);if($)return $;if(!Z)throw Error("No QueryClient set, use QueryClientProvider to set one");return Z},BN=({client:$,children:Z})=>{return KZ.useEffect(()=>{return $.mount(),()=>{$.unmount()}},[$]),Sj.jsx(QN.Provider,{value:$,children:Z})};var rX=P(m(),1),Rj=rX.createContext(!1),Ij=()=>rX.useContext(Rj),zq0=Rj.Provider;var vH=P(m(),1),hs=P(c(),1);function vs(){let $=!1;return{clearReset:()=>{$=!1},reset:()=>{$=!0},isReset:()=>{return $}}}var gs=vH.createContext(vs()),kj=()=>vH.useContext(gs);var tj=P(m(),1);var fs={setTimeout:($,Z)=>setTimeout($,Z),clearTimeout:($)=>clearTimeout($),setInterval:($,Z)=>setInterval($,Z),clearInterval:($)=>clearInterval($)},ms=class{#$=fs;#Z=!1;setTimeoutProvider($){this.#$=$}setTimeout($,Z){return this.#$.setTimeout($,Z)}clearTimeout($){this.#$.clearTimeout($)}setInterval($,Z){return this.#$.setInterval($,Z)}clearInterval($){this.#$.clearInterval($)}},W9=new ms;function bj($){setTimeout($,0)}var zN=typeof window>"u"||"Deno"in globalThis;function u5(){}function hj($,Z){return typeof $==="function"?$(Z):$}function aX($){return typeof $==="number"&&$>=0&&$!==1/0}function oX($,Z){return Math.max($+(Z||0)-Date.now(),0)}function R5($,Z){return typeof $==="function"?$(Z):$}function nX($,Z){let{type:J="all",exact:H,fetchStatus:Q,predicate:B,queryKey:X,stale:z}=$;if(X){if(H){if(Z.queryHash!==gH(X,Z.options))return!1}else if(!i3(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(Q&&Q!==Z.state.fetchStatus)return!1;if(B&&!B(Z))return!1;return!0}function sX($,Z){let{exact:J,status:H,predicate:Q,mutationKey:B}=$;if(B){if(!Z.options.mutationKey)return!1;if(J){if(q9(Z.options.mutationKey)!==q9(B))return!1}else if(!i3(Z.options.mutationKey,B))return!1}if(H&&Z.state.status!==H)return!1;if(Q&&!Q(Z))return!1;return!0}function gH($,Z){return(Z?.queryKeyHashFn||q9)($)}function q9($){return JSON.stringify($,(Z,J)=>XN(J)?Object.keys(J).sort().reduce((H,Q)=>{return H[Q]=J[Q],H},{}):J)}function i3($,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(!i3($[H],Z[H]))return!1;return!0}let J=Object.keys(Z);for(let H of J)if(!i3($[H],Z[H]))return!1;return!0}return!1}var us=Object.prototype.hasOwnProperty;function fH($,Z,J=0){if($===Z)return $;if(J>500)return Z;let H=yj($)&&yj(Z);if(!H&&!(XN($)&&XN(Z)))return Z;let Q=(H?$:Object.keys($)).length,B=H?Z:Object.keys(Z),X=B.length,z=H?Array(X):{},G=0;for(let U=0;U<X;U++){let K=H?U:B[U],Y=$[K],F=Z[K];if(Y===F){if(z[K]=Y,H?U<Q:us.call($,K))G++;continue}if(Y===null||F===null||typeof Y!=="object"||typeof F!=="object"){z[K]=F;continue}let W=fH(Y,F,J+1);if(z[K]=W,W===Y)G++}return Q===X&&G===Q?$:z}function YZ($,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 yj($){return Array.isArray($)&&$.length===Object.keys($).length}function XN($){if(!xj($))return!1;let Z=$.constructor;if(Z===void 0)return!0;let J=Z.prototype;if(!xj(J))return!1;if(!J.hasOwnProperty("isPrototypeOf"))return!1;if(Object.getPrototypeOf($)!==Object.prototype)return!1;return!0}function xj($){return Object.prototype.toString.call($)==="[object Object]"}function vj($){return new Promise((Z)=>{W9.setTimeout(Z,$)})}function mH($,Z,J){if(typeof J.structuralSharing==="function")return J.structuralSharing($,Z);else if(J.structuralSharing!==!1)return fH($,Z);return Z}function gj($,Z,J=0){let H=[...$,Z];return J&&H.length>J?H.slice(1):H}function fj($,Z,J=0){let H=[Z,...$];return J&&H.length>J?H.slice(0,-1):H}var FZ=Symbol();function tX($,Z){if(!$.queryFn&&Z?.initialPromise)return()=>Z.initialPromise;if(!$.queryFn||$.queryFn===FZ)return()=>Promise.reject(Error(`Missing queryFn: '${$.queryHash}'`));return $.queryFn}function WZ($,Z){if(typeof $==="function")return $(...Z);return!!$}function mj($,Z,J){let H=!1,Q;return Object.defineProperty($,"signal",{enumerable:!0,get:()=>{if(Q??=Z(),H)return Q;if(H=!0,Q.aborted)J();else Q.addEventListener("abort",J,{once:!0});return Q}}),$}var ps=()=>zN,qZ=()=>ps();var F8=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 cs=class extends F8{#$;#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"}},NZ=new cs;var uj=bj;function ds(){let $=[],Z=0,J=(z)=>{z()},H=(z)=>{z()},Q=uj,B=(z)=>{if(Z)$.push(z);else Q(()=>{J(z)})},X=()=>{let z=$;if($=[],z.length)Q(()=>{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)=>{B(()=>{z(...G)})}},schedule:B,setNotifyFunction:(z)=>{J=z},setBatchNotifyFunction:(z)=>{H=z},setScheduler:(z)=>{Q=z}}}var t1=ds();var ls=class extends F8{#$=!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.#$}},AZ=new ls;function is($){return Math.min(1000*2**$,30000)}function GN($){return($??"online")==="online"?AZ.isOnline():!0}var eX=class extends Error{constructor($){super("CancelledError");this.revert=$?.revert,this.silent=$?.silent}};function $z($){let Z=!1,J=0,H,Q="pending",B,X,z=new Promise((D,L)=>{B=D,X=L});z.catch(u5);let G=()=>Q!=="pending",U=(D)=>{if(!G()){let L=new eX(D);N(L),$.onCancel?.(L)}},K=()=>{Z=!0},Y=()=>{Z=!1},F=()=>NZ.isFocused()&&($.networkMode==="always"||AZ.isOnline())&&$.canRun(),W=()=>GN($.networkMode)&&$.canRun(),q=(D)=>{if(!G())H?.(),Q="resolved",B(D)},N=(D)=>{if(!G())H?.(),Q="rejected",X(D)},V=()=>{return new Promise((D)=>{H=(L)=>{if(G()||F())D(L)},$.onPause?.()}).then(()=>{if(H=void 0,!G())$.onContinue?.()})},A=()=>{if(G())return;let D,L=J===0?$.initialPromise:void 0;try{D=L??$.fn()}catch(j){D=Promise.reject(j)}Promise.resolve(D).then(q).catch((j)=>{if(G())return;let M=$.retry??(qZ()?0:3),_=$.retryDelay??is,E=typeof _==="function"?_(J,j):_,C=M===!0||typeof M==="number"&&J<M||typeof M==="function"&&M(J,j);if(Z||!C){N(j);return}J++,$.onFail?.(J,j),vj(E).then(()=>{return F()?void 0:V()}).then(()=>{if(Z)N(j);else A()})})};return{promise:z,status:()=>Q,cancel:U,continue:()=>{return H?.(),z},cancelRetry:K,continueRetry:Y,canStart:W,start:()=>{if(W())A();else V().then(A);return z}}}var Zz=class{#$;destroy(){this.clearGcTimeout()}scheduleGc(){if(this.clearGcTimeout(),aX(this.gcTime))this.#$=W9.setTimeout(()=>{this.optionalRemove()},this.gcTime)}updateGcTime($){this.gcTime=Math.max(this.gcTime||0,$??(qZ()?1/0:300000))}clearGcTimeout(){if(this.#$!==void 0)W9.clearTimeout(this.#$),this.#$=void 0}};function cj($){return{onFetch:(Z,J)=>{let H=Z.options,Q=Z.fetchOptions?.meta?.fetchMore?.direction,B=Z.state.data?.pages||[],X=Z.state.data?.pageParams||[],z={pages:[],pageParams:[]},G=0,U=async()=>{let K=!1,Y=(q)=>{mj(q,()=>Z.signal,()=>K=!0)},F=tX(Z.options,Z.fetchOptions),W=async(q,N,V)=>{if(K)return Promise.reject(Z.signal.reason);if(N==null&&q.pages.length)return Promise.resolve(q);let D=(()=>{let _={client:Z.client,queryKey:Z.queryKey,pageParam:N,direction:V?"backward":"forward",meta:Z.options.meta};return Y(_),_})(),L=await F(D),{maxPages:j}=Z.options,M=V?fj:gj;return{pages:M(q.pages,L,j),pageParams:M(q.pageParams,N,j)}};if(Q&&B.length){let q=Q==="backward",N=q?rs:pj,V={pages:B,pageParams:X};z=await W(V,N(H,V),q)}else{let q=$??B.length;do{let N=G===0?X[0]??H.initialPageParam:pj(H,z);if(G>0&&N==null)break;z=await W(z,N),G++}while(G<q)}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 pj($,{pages:Z,pageParams:J}){let H=Z.length-1;return Z.length>0?$.getNextPageParam(Z[H],Z,J[H],J):void 0}function rs($,{pages:Z,pageParams:J}){return Z.length>0?$.getPreviousPageParam?.(Z[0],Z,J[0],J):void 0}var ij=class extends Zz{#$;#Z;#J;#H;#B;#Q;#X;#G;constructor($){super();this.#G=!1,this.#X=$.defaultOptions,this.setOptions($.options),this.observers=[],this.#B=$.client,this.#H=this.#B.getQueryCache(),this.queryKey=$.queryKey,this.queryHash=$.queryHash,this.#Z=lj(this.options),this.state=$.state??this.#Z,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#$}get promise(){return this.#Q?.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=lj(this.options);if(Z.data!==void 0)this.setState(dj(Z.data,Z.dataUpdatedAt)),this.#Z=Z}}optionalRemove(){if(!this.observers.length&&this.state.fetchStatus==="idle")this.#H.remove(this)}setData($,Z){let J=mH(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.#Q?.promise;return this.#Q?.cancel($),Z?Z.then(u5).catch(u5):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(($)=>R5($.options.enabled,this)!==!1)}isDisabled(){if(this.getObserversCount()>0)return!this.isActive();return this.options.queryFn===FZ||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){if(this.getObserversCount()>0)return this.observers.some(($)=>R5($.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!oX(this.state.dataUpdatedAt,$)}onFocus(){this.observers.find(($)=>$.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#Q?.continue()}onOnline(){this.observers.find(($)=>$.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#Q?.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.#Q)if(this.#G||this.state.fetchStatus==="paused"&&this.state.status==="pending")this.#Q.cancel({revert:!0});else this.#Q.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.#Q?.status()!=="rejected"){if(this.state.data!==void 0&&Z?.cancelRefetch)this.cancel({silent:!0});else if(this.#Q)return this.#Q.continueRetry(),this.#Q.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}})},Q=()=>{let G=tX(this.options,Z),K=(()=>{let Y={client:this.#B,queryKey:this.queryKey,meta:this.meta};return H(Y),Y})();if(this.#G=!1,this.options.persister)return this.options.persister(G,K,this);return G(K)},X=(()=>{let G={fetchOptions:Z,options:this.options,queryKey:this.queryKey,client:this.#B,state:this.state,fetchFn:Q};return H(G),G})();if((this.#$==="infinite"?cj(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.#Q=$z({initialPromise:Z?.initialPromise,fn:X.fetchFn,onCancel:(G)=>{if(G instanceof eX&&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 eX){if(G.silent)return this.#Q.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.#Q===z)this.#Q=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,...UN(J.data,this.options),fetchMeta:$.meta??null};case"success":let H={...J,...dj($.data,$.dataUpdatedAt),dataUpdateCount:J.dataUpdateCount+1,...!$.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#J=$.manual?H:void 0,H;case"error":let Q=$.error;return{...J,error:Q,errorUpdateCount:J.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:J.fetchFailureCount+1,fetchFailureReason:Q,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...J,isInvalidated:!0};case"setState":return{...J,...$.state}}};this.state=Z(this.state),t1.batch(()=>{this.observers.slice().forEach((J)=>{J.onQueryUpdate()}),this.#H.notify({query:this,type:"updated",action:$})})}};function UN($,Z){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:GN(Z.networkMode)?"fetching":"paused",...$===void 0&&{error:null,status:"pending"}}}function dj($,Z){return{data:$,dataUpdatedAt:Z??Date.now(),error:null,isInvalidated:!1,status:"success"}}function lj($){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 YN=class extends F8{#$;#Z=void 0;#J=void 0;#H=void 0;#B;#Q;#X;#G;#z;#W;#K;#Y;#U;#q=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),rj(this.#Z,this.options))this.#F();else this.updateResult();this.#L()}}onUnsubscribe(){if(!this.hasListeners())this.destroy()}shouldFetchOnReconnect(){return KN(this.#Z,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return KN(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 R5(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&&!YZ(this.options,Z))this.#$.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#Z,observer:this});let H=this.hasListeners();if(H&&aj(this.#Z,J,this.options,Z))this.#F();if(this.updateResult(),H&&(this.#Z!==J||R5(this.options.enabled,this.#Z)!==R5(Z.enabled,this.#Z)||R5(this.options.staleTime,this.#Z)!==R5(Z.staleTime,this.#Z)))this.#A();let Q=this.#V();if(H&&(this.#Z!==J||R5(this.options.enabled,this.#Z)!==R5(Z.enabled,this.#Z)||Q!==this.#U))this.#D(Q)}getOptimisticResult($){let Z=this.#$.getQueryCache().build(this.#$,$),J=this.createResult(Z,$);if(!YZ(this.getCurrentResult(),J))this.#H=J,this.#Q=this.options,this.#B=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.#q.add($)}getCurrentQuery(){return this.#Z}refetch({...$}={}){return this.fetch({...$})}fetchOptimistic($){let Z=this.#$.defaultQueryOptions($),J=this.#$.getQueryCache().build(this.#$,Z),H=()=>{},Q,B=new Promise((X)=>{Q=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 Q?.(X),X}).finally(()=>{H()}),B])}fetch($){return this.#F({...$,cancelRefetch:$.cancelRefetch??!0}).then(()=>{return this.updateResult(),this.#H})}#F($){this.#_();let Z=this.#Z.fetch(this.options,$);if(!$?.throwOnError)Z=Z.catch(u5);return Z}#N($){return!qZ()&&R5(this.options.enabled,this.#Z)!==!1&&aX($)}#A(){this.#M();let $=R5(this.options.staleTime,this.#Z);if(this.#H.isStale||!this.#N($))return;let Z=oX(this.#H.dataUpdatedAt,$)+1;this.#K=W9.setTimeout(()=>{if(!this.#H.isStale)this.updateResult()},Z)}#V(){return(typeof this.options.refetchInterval==="function"?this.options.refetchInterval(this.#Z):this.options.refetchInterval)??!1}#D($){if(this.#P(),this.#U=$,this.#U===0||!this.#N(this.#U))return;this.#Y=W9.setInterval(()=>{if(this.options.refetchIntervalInBackground||NZ.isFocused())this.#F()},this.#U)}#L(){this.#A(),this.#D(this.#V())}#M(){if(this.#K!==void 0)W9.clearTimeout(this.#K),this.#K=void 0}#P(){if(this.#Y!==void 0)W9.clearInterval(this.#Y),this.#Y=void 0}createResult($,Z){let J=this.#Z,H=this.options,Q=this.#H,B=this.#B,X=this.#Q,z=$!==J?$.state:this.#J,{state:G}=$,U={...G},K=!1,Y;if(Z._optimisticResults){let M=this.hasListeners(),_=!M&&rj($,Z),E=M&&aj($,J,Z,H);if(_||E)U={...U,...UN(G.data,$.options)};if(Z._optimisticResults==="isRestoring")U.fetchStatus="idle"}let{error:F,errorUpdatedAt:W,status:q}=U;Y=U.data;let N=!1;if(Z.placeholderData!==void 0&&Y===void 0&&q==="pending"){let M;if(Q?.isPlaceholderData&&Z.placeholderData===X?.placeholderData)M=Q.data,N=!0;else M=typeof Z.placeholderData==="function"?Z.placeholderData(this.#W?.state.data,this.#W):Z.placeholderData;if(M!==void 0)q="success",Y=mH(Q?.data,M,Z),K=!0}if(Z.select&&Y!==void 0&&!N)if(Q&&Y===B?.data&&Z.select===this.#G)Y=this.#z;else try{this.#G=Z.select,Y=Z.select(Y),Y=mH(Q?.data,Y,Z),this.#z=Y,this.#X=null}catch(M){this.#X=M}else if(Y===void 0)this.#X=null;if(this.#X)F=this.#X,Y=this.#z,W=Date.now(),q="error",K=!1;let V=U.fetchStatus==="fetching",A=q==="pending",D=q==="error",L=A&&V,j=Y!==void 0;return{status:q,fetchStatus:U.fetchStatus,isPending:A,isSuccess:q==="success",isError:D,isInitialLoading:L,isLoading:L,data:Y,dataUpdatedAt:U.dataUpdatedAt,error:F,errorUpdatedAt:W,failureCount:U.fetchFailureCount,failureReason:U.fetchFailureReason,errorUpdateCount:U.errorUpdateCount,isFetched:$.isFetched(),isFetchedAfterMount:U.dataUpdateCount>z.dataUpdateCount||U.errorUpdateCount>z.errorUpdateCount,isFetching:V,isRefetching:V&&!A,isLoadingError:D&&!j,isPaused:U.fetchStatus==="paused",isPlaceholderData:K,isRefetchError:D&&j,isStale:FN($,Z),refetch:this.refetch,isEnabled:R5(Z.enabled,$)!==!1}}updateResult(){let $=this.#H,Z=this.createResult(this.#Z,this.options);if(this.#B=this.#Z.state,this.#Q=this.options,this.#B.data!==void 0)this.#W=this.#Z;if(YZ(Z,$))return;this.#H=Z;let H=(()=>{if(!$)return!0;let{notifyOnChangeProps:Q}=this.options,B=typeof Q==="function"?Q():Q;if(B==="all"||!B&&!this.#q.size)return!0;let X=new Set(B??this.#q);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)})})();t1.batch(()=>{if(H)this.listeners.forEach((Q)=>{Q(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 as($,Z){return R5(Z.enabled,$)!==!1&&$.state.data===void 0&&!($.state.status==="error"&&R5(Z.retryOnMount,$)===!1)}function rj($,Z){return as($,Z)||$.state.data!==void 0&&KN($,Z,Z.refetchOnMount)}function KN($,Z,J){if(R5(Z.enabled,$)!==!1&&R5(Z.staleTime,$)!=="static"){let H=typeof J==="function"?J($):J;return H==="always"||H!==!1&&FN($,Z)}return!1}function aj($,Z,J,H){return($!==Z||R5(H.enabled,$)===!1)&&(!J.suspense||$.state.status!=="error")&&FN($,J)}function FN($,Z){return R5(Z.enabled,$)!==!1&&$.isStaleByTime(R5(Z.staleTime,$))}var oj=class extends Zz{#$;#Z;#J;#H;constructor($){super();this.#$=$.client,this.mutationId=$.mutationId,this.#J=$.mutationCache,this.#Z=[],this.state=$.state||WN(),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.#B({type:"continue"})},J={client:this.#$,meta:this.options.meta,mutationKey:this.options.mutationKey},H=this.#H=$z({fn:()=>{if(!this.options.mutationFn)return Promise.reject(Error("No mutationFn found"));return this.options.mutationFn($,J)},onFail:(X,z)=>{this.#B({type:"failed",failureCount:X,error:z})},onPause:()=>{this.#B({type:"pause"})},onContinue:Z,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#J.canRun(this)}),Q=this.state.status==="pending",B=!H.canStart();try{if(Q)Z();else{if(this.#B({type:"pending",variables:$,isPaused:B}),this.#J.config.onMutate)await this.#J.config.onMutate($,this,J);let z=await this.options.onMutate?.($,J);if(z!==this.state.context)this.#B({type:"pending",context:z,variables:$,isPaused:B})}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.#B({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.#B({type:"error",error:X}),X}finally{if(this.#H===H)this.#H=void 0;this.#J.runNext(this)}}#B($){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),t1.batch(()=>{this.#Z.forEach((J)=>{J.onMutationUpdate($)}),this.#J.notify({mutation:this,type:"updated",action:$})})}};function WN(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var nj=class extends F8{#$;#Z;#J;constructor($={}){super();this.config=$,this.#$=new Set,this.#Z=new Map,this.#J=0}build($,Z,J){let H=new oj({client:$,mutationCache:this,mutationId:++this.#J,options:$.defaultMutationOptions(Z),state:J});return this.add(H),H}add($){this.#$.add($);let Z=Jz($);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=Jz($);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=Jz($);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=Jz($);if(typeof Z==="string")return this.#Z.get(Z)?.find((J)=>J!==$&&J.state.isPaused)?.continue()??Promise.resolve();else return Promise.resolve()}clear(){t1.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)=>sX(Z,J))}findAll($={}){return this.getAll().filter((Z)=>sX($,Z))}notify($){t1.batch(()=>{this.listeners.forEach((Z)=>{Z($)})})}resumePausedMutations(){let $=this.getAll().filter((Z)=>Z.state.isPaused);return t1.batch(()=>Promise.all($.map((Z)=>Z.continue().catch(u5))))}};function Jz($){return $.options.scope?.id}var qN=class extends F8{#$;#Z=void 0;#J;#H;constructor($,Z){super();this.#$=$,this.setOptions(Z),this.bindMethods(),this.#B()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions($){let Z=this.options;if(this.options=this.#$.defaultMutationOptions($),!YZ(this.options,Z))this.#$.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#J,observer:this});if(Z?.mutationKey&&this.options.mutationKey&&q9(Z.mutationKey)!==q9(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.#B()}onUnsubscribe(){if(!this.hasListeners())this.#J?.removeObserver(this)}onMutationUpdate($){this.#B(),this.#Q($)}getCurrentResult(){return this.#Z}reset(){this.#J?.removeObserver(this),this.#J=void 0,this.#B(),this.#Q()}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($)}#B(){let $=this.#J?.state??WN();this.#Z={...$,isPending:$.status==="pending",isSuccess:$.status==="success",isError:$.status==="error",isIdle:$.status==="idle",mutate:this.mutate,reset:this.reset}}#Q($){t1.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(Q){Promise.reject(Q)}try{this.#H.onSettled?.($.data,null,Z,J,H)}catch(Q){Promise.reject(Q)}}else if($?.type==="error"){try{this.#H.onError?.($.error,Z,J,H)}catch(Q){Promise.reject(Q)}try{this.#H.onSettled?.(void 0,$.error,Z,J,H)}catch(Q){Promise.reject(Q)}}}this.listeners.forEach((Z)=>{Z(this.#Z)})})}};var sj=class extends F8{#$;constructor($={}){super();this.config=$,this.#$=new Map}build($,Z,J){let H=Z.queryKey,Q=Z.queryHash??gH(H,Z),B=this.get(Q);if(!B)B=new ij({client:$,queryKey:H,queryHash:Q,options:$.defaultQueryOptions(Z),state:J,defaultOptions:$.getQueryDefaults(H)}),this.add(B);return B}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(){t1.batch(()=>{this.getAll().forEach(($)=>{this.remove($)})})}get($){return this.#$.get($)}getAll(){return[...this.#$.values()]}find($){let Z={exact:!0,...$};return this.getAll().find((J)=>nX(Z,J))}findAll($={}){let Z=this.getAll();return Object.keys($).length>0?Z.filter((J)=>nX($,J)):Z}notify($){t1.batch(()=>{this.listeners.forEach((Z)=>{Z($)})})}onFocus(){t1.batch(()=>{this.getAll().forEach(($)=>{$.onFocus()})})}onOnline(){t1.batch(()=>{this.getAll().forEach(($)=>{$.onOnline()})})}};var NN=class{#$;#Z;#J;#H;#B;#Q;#X;#G;constructor($={}){this.#$=$.queryCache||new sj,this.#Z=$.mutationCache||new nj,this.#J=$.defaultOptions||{},this.#H=new Map,this.#B=new Map,this.#Q=0}mount(){if(this.#Q++,this.#Q!==1)return;this.#X=NZ.subscribe(async($)=>{if($)await this.resumePausedMutations(),this.#$.onFocus()}),this.#G=AZ.subscribe(async($)=>{if($)await this.resumePausedMutations(),this.#$.onOnline()})}unmount(){if(this.#Q--,this.#Q!==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(R5(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:$}),Q=this.#$.get(H.queryHash)?.state.data,B=hj(Z,Q);if(B===void 0)return;return this.#$.build(this,H).setData(B,{...J,manual:!0})}setQueriesData($,Z,J){return t1.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.#$;t1.batch(()=>{Z.findAll($).forEach((J)=>{Z.remove(J)})})}resetQueries($,Z){let J=this.#$;return t1.batch(()=>{let H=J.findAll($),Q=new Set(H);return H.forEach((B)=>{B.reset()}),this.refetchQueries({type:"active",predicate:(B)=>Q.has(B)},Z)})}cancelQueries($,Z={}){let J={revert:!0,...Z},H=t1.batch(()=>this.#$.findAll($).map((Q)=>Q.cancel(J)));return Promise.all(H).then(u5).catch(u5)}invalidateQueries($,Z={}){return t1.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=t1.batch(()=>this.#$.findAll($).filter((Q)=>!Q.isDisabled()&&!Q.isStatic()).map((Q)=>{let B=Q.fetch(void 0,J);if(!J.throwOnError)B=B.catch(u5);return Q.state.fetchStatus==="paused"?Promise.resolve():B}));return Promise.all(H).then(u5)}async query($){let Z=this.defaultQueryOptions($);if(Z.retry===void 0)Z.retry=!1;let J=this.#$.build(this,Z),H=J.isStaleByTime(R5(Z.staleTime,J))?await J.fetch(Z):J.state.data,Q=Z.select;if(Q)return Q(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(R5(Z.staleTime,J))?J.fetch(Z):Promise.resolve(J.state.data)}prefetchQuery($){return this.fetchQuery($).then(u5).catch(u5)}infiniteQuery($){return $._type="infinite",this.query($)}fetchInfiniteQuery($){return $._type="infinite",this.fetchQuery($)}prefetchInfiniteQuery($){return this.fetchInfiniteQuery($).then(u5).catch(u5)}ensureInfiniteQueryData($){return $._type="infinite",this.ensureQueryData($)}resumePausedMutations(){if(AZ.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(q9($),{queryKey:$,defaultOptions:Z})}getQueryDefaults($){let Z=[...this.#H.values()],J={};return Z.forEach((H)=>{if(i3($,H.queryKey))Object.assign(J,H.defaultOptions)}),J}setMutationDefaults($,Z){this.#B.set(q9($),{mutationKey:$,defaultOptions:Z})}getMutationDefaults($){let Z=[...this.#B.values()],J={};return Z.forEach((H)=>{if(i3($,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=gH(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===FZ)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 ej=($,Z,J)=>{let H=J?.state.error&&typeof $.throwOnError==="function"?WZ($.throwOnError,[J.state.error,J]):$.throwOnError;if($.suspense||H){if(!Z.isReset())$.retryOnMount=!1}},$O=($)=>{tj.useEffect(()=>{$.clearReset()},[$])},ZO=({result:$,errorResetBoundary:Z,throwOnError:J,query:H,suspense:Q})=>{return $.isError&&!Z.isReset()&&!$.isFetching&&H&&(Q&&$.data===void 0||WZ(J,[$.error,H]))};var JO=($)=>{if($.suspense){let J=(Q)=>Q==="static"?Q:Math.max(Q??1000,1000),H=$.staleTime;if($.staleTime=typeof H==="function"?(...Q)=>J(H(...Q)):J(H),typeof $.gcTime==="number")$.gcTime=Math.max($.gcTime,1000)}},HO=($,Z)=>$?.suspense&&Z.isPending,QO=($,Z,J)=>Z.fetchOptimistic($).catch(()=>{J.clearReset()});var r3=P(m(),1);function BO($,Z,J){let H=Ij(),Q=kj(),B=U1(J),X=B.defaultQueryOptions($),z=B.getQueryCache().get(X.queryHash),G=$.subscribed!==!1;X._optimisticResults=H?"isRestoring":G?"optimistic":void 0,JO(X),ej(X,Q,z),$O(Q);let[U]=r3.useState(()=>new Z(B,X)),K=U.getOptimisticResult(X),Y=!H&&G;if(r3.useSyncExternalStore(r3.useCallback((F)=>{let W=Y?U.subscribe(t1.batchCalls(F)):u5;return U.updateResult(),W},[U,Y]),()=>U.getCurrentResult(),()=>U.getCurrentResult()),r3.useEffect(()=>{U.setOptions(X)},[X,U]),HO(X,K))throw QO(X,U,Q);if(ZO({result:K,errorResetBoundary:Q,throwOnError:X.throwOnError,query:z,suspense:X.suspense}))throw K.error;return!X.notifyOnChangeProps?U.trackResult(K):K}function J5($,Z){return BO($,YN,Z)}function AN($){return $}var Y3=P(m(),1);function VN($,Z){let J=U1(Z);return zO({filters:{...$,status:"pending"}},J).length}function XO($,Z){return $.findAll(Z.filters).map((J)=>Z.select?Z.select(J):J.state)}function zO($={},Z){let J=U1(Z).getMutationCache(),H=Y3.useRef($),Q=Y3.useRef(null);if(Q.current===null)Q.current=XO(J,$);return Y3.useEffect(()=>{H.current=$}),Y3.useSyncExternalStore(Y3.useCallback((B)=>J.subscribe(()=>{let X=fH(Q.current,XO(J,H.current));if(Q.current!==X)Q.current=X,t1.schedule(B)}),[J]),()=>Q.current,()=>Q.current)}var F3=P(m(),1);function H5($,Z){let J=U1(Z),[H]=F3.useState(()=>new qN(J,$));F3.useEffect(()=>{H.setOptions($)},[H,$]);let Q=F3.useSyncExternalStore(F3.useCallback((X)=>H.subscribe(t1.batchCalls(X)),[H]),()=>H.getCurrentResult(),()=>H.getCurrentResult()),B=F3.useCallback((...X)=>{H.mutate(X[0],X[1]).catch(u5)},[H]);if(Q.error&&WZ(H.options.throwOnError,[Q.error]))throw Q.error;return{...Q,mutate:B,mutateAsync:Q.mutate}}var ks=P(Bq0(),1);function GO($,Z){if($ instanceof RegExp)return{keys:!1,pattern:$};var J,H,Q,B,X=[],z="",G=$.split("/");G[0]||G.shift();while(Q=G.shift())if(J=Q[0],J==="*")X.push(J),z+=Q[1]==="?"?"(?:/(.*))?":"/(.*)";else if(J===":"){if(H=Q.indexOf("?",1),B=Q.indexOf(".",1),X.push(Q.substring(1,~H?H:~B?B:Q.length)),z+=!!~H&&!~B?"(?:/([^/]+?))?":"/([^/]+?)",~B)z+=(~H?"?":"")+"\\"+Q.substring(B)}else z+="/"+Q;return{keys:X,pattern:new RegExp("^"+z+(Z?"(?=$|/)":"/?$"),"i")}}var k7=P(m(),1),f1=P(m(),1);var Hz=P(VZ(),1);var Xt=k7.useInsertionEffect,zt=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",LN=zt?k7.useLayoutEffect:k7.useEffect,Gt=Xt||LN,Qz=($)=>{let Z=k7.useRef([$,(...J)=>Z[0](...J)]).current;return Gt(()=>{Z[0]=$}),Z[1]};var UO=["popstate","pushState","replaceState","hashchange"],uH=[],KO=()=>uH.forEach(($)=>$()),Ut=($)=>{if(uH.push($)===1)UO.forEach((Z)=>addEventListener(Z,KO));return()=>{if(uH=uH.filter((Z)=>Z!==$),!uH.length)UO.forEach((Z)=>removeEventListener(Z,KO))}},qO=($,Z)=>Hz.useSyncExternalStore(Ut,$,Z),YO=()=>location.search,Bz=({ssrSearch:$}={})=>qO(YO,$!=null?()=>$:YO),FO=()=>location.pathname,b7=({ssrPath:$}={})=>qO(FO,$!=null?()=>$:FO);var Kt=($,{replace:Z=!1,state:J=null}={})=>history[Z?"replaceState":"pushState"](J,"",$),NO=($)=>[b7($),Kt],WO=Symbol.for("wouter_v3");if(typeof history<"u"&&typeof window[WO]>"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,WO,{value:!0})}var VO=($="")=>$==="/"?"":$,DO=($,Z)=>$[0]==="~"?$.slice(1):VO(Z)+$,MN=($,Z)=>{return $=AO(VO($)),Z=AO(Z),!$||!Z.toLowerCase().indexOf($.toLowerCase())?Z.slice($.length)||"/":"~"+Z},AO=($)=>{try{return $.includes("%")?decodeURI($):$}catch(Z){return $}};var LO={hook:NO,searchHook:Bz,parser:GO,base:"",ssrPath:void 0,ssrSearch:void 0,ssrContext:void 0,hrefs:($)=>$,aroundNav:($,Z,J)=>$(Z,J)},MO=f1.createContext(LO),i2=()=>f1.useContext(MO),PO={},_O=f1.createContext(PO),Yt=()=>f1.useContext(_O),jO=($,Z=$.base)=>MN(Z,$.hook($)[0]),PN=($)=>{let[Z,J]=$.hook($);return[MN($.base,Z),Qz((H,Q)=>$.aroundNav(J,DO(H,$.base),Q))]},W8=()=>PN(i2());var OO=($,Z,J,H)=>{let{pattern:Q,keys:B}=Z instanceof RegExp?{pattern:Z}:$(Z||"*",H),X=Q.exec(J);if(!X)return[!1,null];let z={};for(let G=1;G<X.length;G++)z[G-1]=X[G];if(B)for(let G=0;G<B.length;G++)z[B[G]]=X[G+1];else Object.assign(z,X.groups);return H?[!0,z,X[0]]:[!0,z]};var _N=({children:$,...Z})=>{let J=i2(),H=Z.hook?LO:J,Q=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 B=f1.useRef(H),X=B.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)B.current=z={...z};z[G]=U}if(U!==H[G]||U!==Q[G])Q=z}return f1.createElement(MO.Provider,{value:Q},$)},Ft=({children:$,component:Z},J)=>{if(Z)return f1.createElement(Z,{params:J});return typeof $==="function"?$(J):$},Wt=($)=>{let Z=f1.useRef(PO),J=Z.current,H=Object.keys($);return Z.current=H.length!==Object.keys(J).length||H.some((Q)=>$[Q]!==J[Q])?$:J};var Xz=({path:$,nest:Z,match:J,...H})=>{let Q=i2(),B=jO(Q),[X,z,G]=J??OO(Q.parser,$,B,Z),U=Wt({...Yt(),...z});if(!X)return null;let K=Ft(H,U);return f1.createElement(_O.Provider,{value:U},G?f1.createElement(_N,{base:G},K):K)},y7=f1.forwardRef(($,Z)=>{let J=i2(),[H,Q]=PN(J),{to:B="",href:X=B,onClick:z,asChild:G,children:U,className:K,replace:Y,state:F,transition:W,...q}=$;if(q.onClick=Qz((N)=>{if(N.ctrlKey||N.metaKey||N.altKey||N.shiftKey||N.button!==0)return;if(z?.(N),!N.defaultPrevented)N.preventDefault(),Q(X,$)}),q.href=J.hrefs(X[0]==="~"?X.slice(1):J.base+X,J),K!==void 0)q.className=K?.call?K(H===X):K;if(Z)q.ref=Z;return G&&f1.isValidElement(U)?f1.cloneElement(U,q):f1.createElement("a",q,U)}),TO=($,Z=[])=>{if(Array.isArray($))for(let J of $)TO(J&&J.type===f1.Fragment?J.props.children:J,Z);else Z.push($);return Z},CO=({children:$,location:Z})=>{let J=i2(),H=jO(J);for(let Q of TO($)){let B=0;if(f1.isValidElement(Q)&&(B=OO(J.parser,Q.props.path,Z||H,Q.props.nest))[0])return f1.cloneElement(Q,{match:B})}return null},wO=($)=>{let{to:Z,href:J=Z}=$,H=i2(),[,Q]=PN(H),B=Qz(()=>Q(Z||J,$)),{ssrContext:X}=H;if(LN(()=>{B()},[]),X)X.redirectTo=Z;return null};var e2={};C5(e2,{useToastManager:()=>Lw,createToastManager:()=>Mw,Viewport:()=>YT,Title:()=>fT,Root:()=>ST,Provider:()=>zT,Positioner:()=>Nw,Portal:()=>oT,Description:()=>vT,Content:()=>RT,Close:()=>mT,Arrow:()=>Vw,Action:()=>pT});var XT=P(m(),1);var EO=P(m(),1);function a3($){EO.useEffect($,r2)}var zz=P(m(),1),jN=zz.createContext(void 0);function N9(){let $=zz.useContext(jN);if(!$)throw Error(y0(73));return $}var kO=P(m(),1),wN=P(VZ(),1);var o3=P(m(),1),qt=VZ();function Nt($,Z){return $===Z&&($!==0||1/$===1/Z)||$!==$&&Z!==Z}var At=typeof Object.is==="function"?Object.is:Nt,Vt=qt.useSyncExternalStore,Dt=o3.useRef,Lt=o3.useEffect,Mt=o3.useMemo,Pt=o3.useDebugValue;var ON=function($,Z,J,H,Q){var B=Dt(null);if(B.current===null){var X={hasValue:!1,value:null};B.current=X}else X=B.current;B=Mt(function(){function G(W){if(!U){if(U=!0,K=W,W=H(W),Q!==void 0&&X.hasValue){var q=X.value;if(Q(q,W))return Y=q}return Y=W}if(q=Y,At(K,W))return q;var N=H(W);if(Q!==void 0&&Q(q,N))return K=W,q;return K=W,Y=N}var U=!1,K,Y,F=J===void 0?null:J;return[function(){return G(Z())},F===null?void 0:function(){return G(F())}]},[Z,J,H,Q]);var z=Vt($,B[0],B[1]);return Lt(function(){X.hasValue=!0,X.value=z},[z]),Pt(z),z};var SO=P(m(),1);var TN=[],CN=void 0;function RO(){return CN}function IO($){TN.push($)}function v8($){let Z=(J,H)=>{let Q=l1(_t).current,B;try{CN=Q;for(let X of TN)X.before(Q);B=$(J,H);for(let X of TN)X.after(Q);Q.didInitialize=!0}finally{CN=void 0}return B};return Z.displayName=$.displayName||$.name,Z}function A9($){return SO.forwardRef(v8($))}function _t(){return{didInitialize:!1}}var jt=Gz(19),Ot=jt?Ct:wt;function Uz($,Z,J,H,Q){return Ot($,Z,J,H,Q)}function Tt($,Z,J,H,Q){let B=kO.useCallback(()=>Z($.getSnapshot(),J,H,Q),[$,Z,J,H,Q]);return wN.useSyncExternalStore($.subscribe,B,B)}IO({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],Q=H.selector(H.store.state,H.a1,H.a2,H.a3);if(!Object.is(H.value,Q))Z=!0,H.value=Q}if(Z)$.syncTick+=1;return $.syncTick}},after($){if($.syncHooks.length>0){if($.didChangeStore)$.didChangeStore=!1,$.subscribe=(Z)=>{let J=new Set;for(let Q of $.syncHooks)J.add(Q.store);let H=[];for(let Q of J)H.push(Q.subscribe(Z));return()=>{for(let Q of H)Q()}};wN.useSyncExternalStore($.subscribe,$.getSnapshot,$.getSnapshot)}}});function Ct($,Z,J,H,Q){let B=RO();if(!B)return Tt($,Z,J,H,Q);let X=B.syncIndex;B.syncIndex+=1;let z;if(!B.didInitialize)z={store:$,selector:Z,a1:J,a2:H,a3:Q,value:Z($.getSnapshot(),J,H,Q)},B.syncHooks.push(z);else if(z=B.syncHooks[X],z.store!==$||z.selector!==Z||!Object.is(z.a1,J)||!Object.is(z.a2,H)||!Object.is(z.a3,Q)){if(z.store!==$)B.didChangeStore=!0;z.store=$,z.selector=Z,z.a1=J,z.a2=H,z.a3=Q,z.value=Z($.getSnapshot(),J,H,Q)}return z.value}function wt($,Z,J,H,Q){return ON($.subscribe,$.getSnapshot,$.getSnapshot,(B)=>Z(B,J,H,Q))}class EN{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 Uz(this,$,Z,J,H)}}var x7=P(m(),1);class k2 extends EN{constructor($,Z={},J){super($);this.context=Z,this.selectors=J}useSyncedValue($,Z){x7.useDebugValue($);let J=this;J0(()=>{if(J.state[$]!==Z)J.set($,Z)},[J,$,Z])}useSyncedValueWithCleanup($,Z){let J=this;J0(()=>{if(J.state[$]!==Z)J.set($,Z);return()=>{J.set($,void 0)}},[J,$,Z])}useSyncedValues($){let Z=this,J=Object.values($);J0(()=>{Z.update($)},[Z,...J])}useControlledProp($,Z){x7.useDebugValue($);let J=this,H=Z!==void 0;J0(()=>{if(H&&!Object.is(J.state[$],Z))J.setState({...J.state,[$]:Z})},[J,$,Z,H])}select($,Z,J,H){let Q=this.selectors[$];return Q(this.state,Z,J,H)}useState($,Z,J,H){return x7.useDebugValue($),Uz(this,this.selectors[$],Z,J,H)}useContextCallback($,Z){x7.useDebugValue($);let J=U0(Z??X1);this.context[$]=J}useStateSetter($){let Z=x7.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((Q)=>{let B=J(Q);if(!Object.is(H,B)){let X=H;H=B,Z(B,X,this)}})}}function M2(...$){return()=>{for(let Z=0;Z<$.length;Z+=1){let J=$[Z];if(J)J()}}}function n0($,Z,J,H){return $.addEventListener(Z,J,H),()=>{$.removeEventListener(Z,J,H)}}var Kz=P(m(),1);function bO(){let[,$]=Kz.useState({});return Kz.useCallback(()=>{$({})},[])}var Yz=null,OV0=globalThis.requestAnimationFrame;class yO{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 Fz=new yO;class b2{static create(){return new b2}static request($){return Fz.request($)}static cancel($){return Fz.cancel($)}currentId=Yz;request($){this.cancel(),this.currentId=Fz.request(()=>{this.currentId=Yz,$()})}cancel=()=>{if(this.currentId!==Yz)Fz.cancel(this.currentId),this.currentId=Yz};disposeEffect=()=>{return this.cancel}}function N4(){let $=l1(b2.create).current;return a3($.disposeEffect),$}var pH=0;class c5{static create(){return new c5}currentId=pH;start($,Z){this.clear(),this.currentId=setTimeout(()=>{this.currentId=pH,Z()},$)}isStarted(){return this.currentId!==pH}clear=()=>{if(this.currentId!==pH)clearTimeout(this.currentId),this.currentId=pH};disposeEffect=()=>{return this.clear}}function d1(){let $=l1(c5.create).current;return a3($.disposeEffect),$}var xO=0;function Wz($){return xO+=1,`${$}-${Math.random().toString(36).slice(2,6)}-${xO}`}function qz($,Z){if(typeof $==="string")return{description:$};if(typeof $==="function"){let J=$(Z);return typeof J==="string"?{description:J}:J}return $}var r1={};C5(r1,{screenReader:()=>yN,os:()=>IN,mediaQuery:()=>hN,env:()=>xN,engine:()=>bN});var IN={};C5(IN,{windows:()=>It,mac:()=>fO,linux:()=>kt,ios:()=>SN,apple:()=>RN,android:()=>gO});function Et(){if(typeof navigator>"u")return{userAgent:"",platform:"",maxTouchPoints:0};return{userAgent:navigator.userAgent,platform:navigator.platform??"",maxTouchPoints:navigator.maxTouchPoints??0}}var{userAgent:St,platform:Rt,maxTouchPoints:hO}=Et(),h7=St.toLowerCase(),v7=Rt.toLowerCase();var SN=/^i(os$|p)/.test(v7)||v7==="macintel"&&hO>1,vO="android",gO=v7===vO||h7.includes(vO),fO=!SN&&v7.startsWith("mac"),It=v7.startsWith("win"),kt=!gO&&/^(linux|chrome os)/.test(v7),RN=fO||SN;var bN={};C5(bN,{webkit:()=>kN,gecko:()=>bt,blink:()=>yt});var kN=typeof CSS<"u"&&!!CSS.supports?.("-webkit-backdrop-filter:none"),bt=!kN&&h7.includes("firefox"),yt=!kN&&h7.includes("chrom");var yN={};C5(yN,{voiceOver:()=>xt});var xt=RN;var xN={};C5(xN,{jsdom:()=>ht});var ht=/jsdom|happydom/.test(h7);var hN={};C5(hN,{iOS:()=>vt});var vt="@supports (-webkit-touch-callout: none)";function p1($){let Z=$.activeElement;while(Z?.shadowRoot?.activeElement!=null)Z=Z.shadowRoot.activeElement;return Z}function k0($,Z){if(!$||!Z)return!1;let J=Z.getRootNode?.();if($.contains(Z))return!0;if(J&&n3(J)){let H=Z;while(H){if($===H)return!0;H=H.parentNode||H.host}}return!1}function M1($){if("composedPath"in $)return $.composedPath()[0]??$.target;return $.target}var cH="data-base-ui-focusable";var vN="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])",dH="ArrowLeft",lH="ArrowRight",gN="ArrowUp",Nz="ArrowDown";var n4={};C5(n4,{startingStyle:()=>g7,endingStyle:()=>iH});var g7="data-starting-style",iH="data-ending-style";var gt={[g7]:""},ft={[iH]:""},Q2={transitionStatus($){if($==="starting")return gt;if($==="ending")return ft;return null}};var f7={};C5(f7,{startingStyle:()=>mt,side:()=>pt,open:()=>fN,endingStyle:()=>ut,closed:()=>mN,anchorHidden:()=>uN,align:()=>ct});var fN="data-open",mN="data-closed",mt=g7,ut=iH,uN="data-anchor-hidden",pt="data-side",ct="data-align";var Vz={};C5(Vz,{pressed:()=>pN,popupOpen:()=>Az});var Az="data-popup-open",pN="data-pressed";var dt={[Az]:""},lt={[Az]:"",[pN]:""},it={[fN]:""},rt={[mN]:""},at={[uN]:""},V9={open($){if($)return dt;return null}},rH={open($){if($)return lt;return null}},s4={open($){if($)return it;return rt},anchorHidden($){if($)return at;return null}},a2={...s4,...Q2};var dV0=Vz.popupOpen,aH="data-trigger-disabled";function s3($,Z){if(!s0($))return!1;let J=$;if(Z.hasElement(J))return!J.hasAttribute(aH);for(let[,H]of Z.entries())if(k0(H,J))return!H.hasAttribute(aH);return!1}function Dz($,Z){if(Z==null)return!1;if("composedPath"in $)return $.composedPath().includes(Z);let J=$;return J.target!=null&&Z.contains(J.target)}function uO($){return $.matches("html,body")}function m7($){return P1($)&&$.matches(vN)}function cN($){return $?.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${vN}`)!=null}function oH($){if(!$)return!1;return $.getAttribute("role")==="combobox"&&m7($)}function D9($){if(!$||r1.env.jsdom)return!0;try{return $.matches(":focus-visible")}catch(Z){return!0}}function nH($){if(!$)return null;return $.hasAttribute(cH)?$:$.querySelector(`[${cH}]`)||$}function q8($,Z,J=!0){return $.filter((Q)=>Q.parentId===Z).flatMap((Q)=>[...!J||Q.context?.open?[Q]:[],...q8($,Q.id,J)])}function dN($,Z){let J=[],H=$.find((Q)=>Q.id===Z)?.parentId;while(H){let Q=$.find((B)=>B.id===H);if(H=Q?.parentId,Q)J=J.concat(Q)}return J}function b4($){$.preventDefault(),$.stopPropagation()}function pO($){return"nativeEvent"in $}function DZ($){if($.pointerType===""&&$.isTrusted)return!0;if(r1.os.android&&$.pointerType)return $.type==="click"&&$.buttons===1;return $.detail===0&&!$.pointerType}function LZ($){if(r1.env.jsdom)return!1;return!r1.os.android&&$.width===0&&$.height===0||r1.os.android&&$.width===1&&$.height===1&&$.pressure===0&&$.detail===0&&$.pointerType==="mouse"||$.width<1&&$.height<1&&$.pressure===0&&$.detail===0&&$.pointerType==="touch"}function t4($,Z){let J=["mouse","pen"];if(!Z)J.push("",void 0);return J.includes($)}function cO($){let Z=$.type;return Z==="click"||Z==="mousedown"||Z==="keydown"||Z==="keyup"}var{min:t3,max:g8,round:e3,floor:tH}=Math,L9=($)=>({x:$,y:$}),ot={left:"right",right:"left",bottom:"top",top:"bottom"};function Mz($,Z,J){return g8($,t3(Z,J))}function M9($,Z){return typeof $==="function"?$(Z):$}function o2($){return $.split("-")[0]}function N8($){return $.split("-")[1]}function Pz($){return $==="x"?"y":"x"}function eH($){return $==="y"?"height":"width"}function y4($){let Z=$[0];return Z==="t"||Z==="b"?"y":"x"}function $Q($){return Pz(y4($))}function iO($,Z,J){if(J===void 0)J=!1;let H=N8($),Q=$Q($),B=eH(Q),X=Q==="x"?H===(J?"end":"start")?"right":"left":H==="start"?"bottom":"top";if(Z.reference[B]>Z.floating[B])X=sH(X);return[X,sH(X)]}function rO($){let Z=sH($);return[Lz($),Z,Lz(Z)]}function Lz($){return $.includes("start")?$.replace("start","end"):$.replace("end","start")}var dO=["left","right"],lO=["right","left"],nt=["top","bottom"],st=["bottom","top"];function tt($,Z,J){switch($){case"top":case"bottom":if(J)return Z?lO:dO;return Z?dO:lO;case"left":case"right":return Z?nt:st;default:return[]}}function aO($,Z,J,H){let Q=N8($),B=tt(o2($),J==="start",H);if(Q){if(B=B.map((X)=>X+"-"+Q),Z)B=B.concat(B.map(Lz))}return B}function sH($){let Z=o2($);return ot[Z]+$.slice(Z.length)}function et($){var Z,J,H,Q;return{top:(Z=$.top)!=null?Z:0,right:(J=$.right)!=null?J:0,bottom:(H=$.bottom)!=null?H:0,left:(Q=$.left)!=null?Q:0}}function _z($){return typeof $!=="number"?et($):{top:$,right:$,bottom:$,left:$}}function u7($){let{x:Z,y:J,width:H,height:Q}=$;return{width:H,height:Q,top:J,left:Z,right:Z+H,bottom:J+Q,x:Z,y:J}}function $6($,Z){return Z<0||Z>=$.length}function p7($,Z){return A8($.current,{disabledIndices:Z})}function MZ($,Z){return A8($.current,{decrement:!0,startingIndex:$.current.length,disabledIndices:Z})}function A8($,{startingIndex:Z=-1,decrement:J=!1,disabledIndices:H,amount:Q=1}={}){let B=Z;do B+=J?-Q:Q;while(B>=0&&B<=$.length-1&&W3($,B,H));return B}function W3($,Z,J){if(typeof J==="function"?J(Z):J?.includes(Z)??!1)return!0;let Q=$[Z];if(!Q)return!1;if(!c7(Q))return!0;if(Q.matches(":disabled"))return!0;return!J&&(Q.hasAttribute("disabled")||Q.getAttribute("aria-disabled")==="true")}function $e($){return $.visibility==="hidden"||$.visibility==="collapse"}function c7($,Z=$?y2($):null){if(!$||!$.isConnected||!Z||$e(Z))return!1;if(typeof $.checkVisibility==="function")return $.checkVisibility();return Z.display!=="none"&&Z.display!=="contents"}var Ze='a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]';function Je($){let Z=$.assignedSlot;if(Z)return Z;if($.parentElement)return $.parentElement;let J=$.getRootNode();return n3(J)?J.host:null}function iN($){for(let Z of Array.from($.children))if(P2(Z)==="summary")return Z;return null}function He($,Z){let J=iN(Z);return!!J&&($===J||k0(J,$))}function oO($){let Z=$?P2($):"";return $!=null&&$.matches(Ze)&&(Z!=="summary"||$.parentElement!=null&&P2($.parentElement)==="details"&&iN($.parentElement)===$)&&(Z!=="details"||iN($)==null)&&(Z!=="input"||$.type!=="hidden")}function nO($){if(!oO($)||!$.isConnected||$.matches(":disabled"))return!1;for(let Z=$;Z;Z=Je(Z)){let J=Z!==$,H=P2(Z)==="slot";if(Z.hasAttribute("inert"))return!1;if(J&&P2(Z)==="details"&&!Z.open&&!He($,Z)||Z.hasAttribute("hidden")||!H&&!Qe(Z,J))return!1}return!0}function Qe($,Z){let J=y2($);if(!Z)return c7($,J);return J.display!=="none"}function sO($){let Z=$.tabIndex;if(Z<0){let J=P2($);if(J==="details"||J==="audio"||J==="video"||P1($)&&$.isContentEditable)return 0}return Z}function lN($){if(P2($)!=="input")return null;let Z=$;return Z.type==="radio"&&Z.name!==""?Z:null}function Be($,Z){let J=lN($);if(!J)return!0;let H=Z.find((Q)=>{let B=lN(Q);return B?.name===J.name&&B.form===J.form&&B.checked});if(H)return H===J;return Z.find((Q)=>{let B=lN(Q);return B?.name===J.name&&B.form===J.form})===J}function tO($){if(P1($)&&P2($)==="slot"){let Z=$.assignedElements({flatten:!0});if(Z.length>0)return Z}if(P1($)&&$.shadowRoot)return Array.from($.shadowRoot.children);return Array.from($.children)}function eO($,Z){tO($).forEach((J)=>{if(oO(J))Z.push(J);eO(J,Z)})}function $T($,Z,J){tO($).forEach((H)=>{if(P1(H)&&H.matches(Z))J.push(H);$T(H,Z,J)})}function jz($){return nO($)&&sO($)>=0}function rN($){let Z=[];return eO($,Z),Z.filter(nO)}function PZ($){let Z=rN($);return Z.filter((J)=>sO(J)>=0&&Be(J,Z))}function ZT($,Z){let J=PZ($),H=J.length;if(H===0)return;let Q=p1(m0($)),B=J.indexOf(Q),X=B===-1?Z===1?0:H-1:B+Z;return J[X]}function _Z($){return ZT(m0($).body,1)||$}function Oz($){return ZT(m0($).body,-1)||$}function JT($,Z){if(!$)return null;let J=PZ(m0($).body),H=J.length;if(H===0)return null;let Q=J.indexOf($);if(Q===-1)return null;let B=(Q+Z+H)%H;return J[B]}function HT($){return JT($,1)}function QT($){return JT($,-1)}function q3($,Z){let J=Z||$.currentTarget,H=$.relatedTarget;return!H||!k0(J,H)}function BT($){PZ($).forEach((J)=>{J.dataset.tabindex=J.getAttribute("tabindex")||"",J.setAttribute("tabindex","-1")})}function aN($){let Z=[];$T($,"[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 oN($){let Z=new Map,J=0,H=0;return $.forEach((Q,B)=>{let X=Q.transitionStatus==="ending";if(Z.set(Q.id,{value:Q,domIndex:B,visibleIndex:X?-1:J,offsetY:H}),H+=Q.height||0,!X)J+=1}),Z}function nN($,Z){let J=0;return $.map((H)=>{if(H.transitionStatus==="ending")return H;let Q=J>=Z;return J+=1,H.limited===Q?H:{...H,limited:Q}})}var f8={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 sN extends k2{timers=new Map;areTimersPaused=!1;constructor($){super({...$,toastMetadata:oN($.toasts)},{},f8)}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 Q=nN(this.state.toasts,Z);H.toasts=Q,H.toastMetadata=oN(Q)}this.update(H)}disposeEffect=()=>{return()=>{this.timers.forEach(($)=>{$.timeout?.clear()}),this.timers.clear()}};removeToast($,Z=!1){let J=f8.toastIndex(this.state,$);if(J===-1)return;let H=this.state.toasts[J];if(!Z)H?.onRemove?.();let Q=[...this.state.toasts];Q.splice(J,1),this.setToasts(Q)}addToast=($)=>{let{timeout:Z,limit:J}=this.state,H=$.id||Wz("toast");if($.id){let z=f8.toast(this.state,$.id);if(z)if(z.transitionStatus==="ending")this.removeToast($.id,!0);else{let{id:G,transitionStatus:U,...K}=$;return this.updateToastInternal($.id,K,!0,!0),$.id}}let Q={...$,id:H,updateKey:0,transitionStatus:"starting"},B=[Q,...this.state.toasts];this.setToasts(nN(B,J));let X=Q.timeout??Z;if(Q.type!=="loading"&&X>0)this.scheduleTimer(H,X,()=>this.closeToast(H));if(f8.expandedOrOutOfFocus(this.state))this.pauseTimers();return H};updateToast=($,Z)=>{let J=f8.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:Q,toasts:B}=this.state,X=f8.toast(this.state,$);if(!X)return;if(X.transitionStatus==="ending")return;let z={...X,...Z,...H&&{updateKey:X.updateKey+1}};this.setToasts(B.map((N)=>N.id===$?z:N));let G=z.timeout??Q,U=X.timeout??Q,K=Object.hasOwn(Z,"timeout"),Y=z.transitionStatus!=="ending"&&z.type!=="loading"&&G>0,F=this.timers.has($),W=U!==G,q=X.type==="loading";if(!Y&&F){this.clearTimer($);return}if(Y&&(!F||W||K||q||J)){if(this.clearTimer($),this.scheduleTimer($,G,()=>this.closeToast($)),f8.expandedOrOutOfFocus(this.state))this.pauseTimers()}};closeToast=($)=>{let Z=$===void 0,{limit:J,toasts:H}=this.state,Q;if(Z)Q=H,this.clearTimers();else{let z=f8.toast(this.state,$);if(!z)return;Q=[z],this.clearTimer($)}let B=H.map((z)=>Z||z.id===$?{...z,transitionStatus:"ending",height:0}:z),X=nN(B,J);this.setToasts(X,!X.some((z)=>z.transitionStatus!=="ending")),Q.forEach((z)=>{if(z.transitionStatus!=="ending")z.onClose?.()}),this.handleFocusManagement($)};promiseToast=($,Z)=>{let J=qz(Z.loading),H=this.addToast({...J,type:"loading"}),Q=$.then((B)=>{let X=qz(Z.success,B);return this.updateToast(H,{...X,type:"success",timeout:X.timeout}),B}).catch((B)=>{let X=qz(Z.error,B);return this.updateToast(H,{...X,type:"error",timeout:X.timeout}),Promise.reject(B)});if({}.hasOwnProperty.call(Z,"setPromise"))Z.setPromise(Q);return Q};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??=c5.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=M1($);if(k0(this.state.viewport,Z))return;this.resumeTimers(),this.update({hovering:!1,focused:!1})};scheduleTimer($,Z,J){let H=Date.now(),B=!f8.expandedOrOutOfFocus(this.state)?c5.create():void 0;B?.start(Z,()=>{this.handleTimerFired($),J()}),this.timers.set($,{timeout:B,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:oN($)};if(Z)J.hovering=!1,J.focused=!1;this.update(J)}handleFocusManagement($){let Z=p1(m0(this.state.viewport));if(!this.state.viewport||!k0(this.state.viewport,Z)||!D9(Z))return;if($===void 0){this.restoreFocusToPrevElement();return}let J=f8.toasts(this.state),H=f8.toastIndex(this.state,$),Q=(X,z)=>{for(let G=X;G>=0&&G<J.length;G+=z)if(J[G].transitionStatus!=="ending")return J[G];return null},B=Q(H+1,1)??Q(H-1,-1);if(B)B.ref?.current?.focus();else this.restoreFocusToPrevElement()}}var Tz=P(c(),1),zT=function(Z){let{children:J,timeout:H=5000,limit:Q=3,toastManager:B}=Z,X=l1(()=>new sN({timeout:H,limit:Q,viewport:null,toasts:[],hovering:!1,focused:!1,isWindowFocused:!0,prevFocusElement:null})).current;return a3(X.disposeEffect),XT.useEffect(function(){if(!B)return;return B[" subscribe"](({action:U,options:K})=>{let Y=K.id;if(U==="promise"&&K.promise)X.promiseToast(K.promise,K);else if(U==="update"&&Y)X.updateToast(Y,K.updates);else if(U==="close")X.closeToast(Y);else X.addToast(K)})},[X,B]),Tz.jsxs(jN.Provider,{value:X,children:[Tz.jsx(Xe,{store:X,timeout:H,limit:Q}),J]})};function Xe($){let{store:Z,timeout:J,limit:H}=$;return J0(()=>{Z.syncProviderProps(J,H)},[Z,J,H]),null}var V8=P(m(),1);var GT={clipPath:"inset(50%)",overflow:"hidden",whiteSpace:"nowrap",border:0,padding:0,width:1,height:1,margin:-1},m8={...GT,position:"fixed",top:0,left:0},Cz={...GT,position:"absolute"};var wz=P(m(),1);var UT=P(c(),1),x4=wz.forwardRef(function(Z,J){let[H,Q]=wz.useState();return J0(()=>{if(r1.screenReader.voiceOver&&r1.engine.webkit)Q("button")},[]),UT.jsx("span",{...Z,ref:J,style:m8,"aria-hidden":H?void 0:!0,...{tabIndex:0,role:H},"data-base-ui-focus-guard":""})});var KT="--toast-frontmost-height";var N3=P(c(),1),YT=V8.forwardRef(function(Z,J){let{render:H,className:Q,style:B,children:X,...z}=Z,G=N9(),U=d1(),K=V8.useRef(!1),Y=V8.useRef(!1),F=V8.useRef(!1),W=G.useState("isEmpty"),q=G.useState("toasts"),N=G.useState("focused"),V=G.useState("expanded"),A=G.useState("prevFocusElement"),D=q[0]?.height,L=q.some((f)=>f.transitionStatus==="ending"),j=q.filter((f)=>f.priority==="high");V8.useEffect(()=>{let f=G.state.viewport;if(!f||W)return;let w=R1(f),i=m0(f);function r(s){if(s.key==="F6"&&M1(s)!==f)s.preventDefault(),G.set("prevFocusElement",p1(i)),f?.focus({preventScroll:!0}),G.pauseTimers(),G.set("focused",!0)}function x(s){if(M1(s)!==w)return;G.set("isWindowFocused",!1),G.pauseTimers()}function l(s){if(s.relatedTarget)return;let p=M1(s),d=p1(m0(f));if(p===w||!k0(f,p)||!D9(d))G.resumeTimers();U.start(0,()=>G.set("isWindowFocused",!0))}return M2(n0(w,"keydown",r),n0(w,"blur",x,!0),n0(w,"focus",l,!0),n0(i,"pointerdown",G.handleDocumentPointerDown,!0))},[G,U,W]);function M(f){K.current=!0;let w=f.relatedTarget===G.state.viewport?q.find((i)=>i.transitionStatus!=="ending"&&!i.limited):void 0;if(w)w.ref?.current?.focus();else G.restoreFocusToPrevElement()}function _(f){if(f.key==="Tab"&&f.shiftKey&&M1(f.nativeEvent)===G.state.viewport)f.preventDefault(),G.restoreFocusToPrevElement()}function E(){if(G.state.toasts.some((w)=>w.transitionStatus==="ending")||F.current||!Y.current)return;if(G.state.isWindowFocused)G.resumeTimers();G.set("hovering",!1),Y.current=!1}V8.useEffect(E,[L,G]);function C(){G.pauseTimers(),G.set("hovering",!0),Y.current=!1}function R(){if(G.state.isWindowFocused)G.resumeTimers()}function T(){Y.current=!0,E()}function I(f){if(f.pointerType==="touch")F.current=!0}function y(f){if(f.pointerType!=="touch")return;F.current=!1,E()}function S(){if(K.current){K.current=!1;return}if(N)return;if(D9(p1(m0(G.state.viewport))))G.set("focused",!0),G.pauseTimers()}function O(f){if(!N||k0(G.state.viewport,f.relatedTarget))return;G.set("focused",!1),R()}let b={tabIndex:-1,role:"region","aria-live":"polite","aria-atomic":!1,"aria-relevant":"additions text","aria-label":"Notifications",onMouseEnter:C,onMouseMove:C,onMouseLeave:T,onFocus:S,onBlur:O,onKeyDown:_,onClick:S,onPointerDown:I,onPointerUp:y,onPointerCancel:y,style:{[KT]:D?`${D}px`:void 0}},k={expanded:V},h=!W&&A&&N3.jsx(x4,{onFocus:M}),v=z0("div",Z,{ref:[J,G.setViewport],state:k,props:[b,z,{children:N3.jsxs(V8.Fragment,{children:[h,X,h]})}]});return N3.jsxs(V8.Fragment,{children:[h,v,!N&&j.length>0&&N3.jsx("div",{style:m8,children:j.map((f)=>N3.jsxs("div",{role:"alert","aria-atomic":!0,children:[N3.jsx("div",{children:f.title}),N3.jsx("div",{children:f.description})]},f.id))})]})});var q5=P(m(),1),wT=P(e4(),1);function D8($){if(Gz(19))return $;return $?"true":void 0}var Ez=P(m(),1),tN=Ez.createContext(void 0);function Z6(){let $=Ez.useContext(tN);if(!$)throw Error(y0(66));return $}var FT=P(m(),1);var eN=P(e4(),1);function u8($){if($==null)return $;return"current"in $?$.current:$}var Sz=null;function Ge($){if(!Sz){let Z=[];Sz=Z,queueMicrotask(()=>{Sz=null,eN.flushSync(()=>{for(let J of Z)J()})})}Sz.push($)}function h4($,Z=!1,J=!1){let H=N4();return U0((Q,B=null)=>{H.cancel();let X=u8($);if(X==null)return;let z=X,G=()=>{if(!J){eN.flushSync(Q);return}Ge(()=>{if(!B?.aborted)Q()})};if(typeof z.getAnimations!=="function"||globalThis.BASE_UI_ANIMATIONS_DISABLED){Q();return}function U(){Promise.all(z.getAnimations().map((K)=>K.finished)).then(()=>{if(!B?.aborted)G()},()=>{if(B?.aborted)return;if(z.getAnimations().some((Y)=>Y.pending||Y.playState!=="finished")){U();return}G()})}if(Z){let K=g7;if(!z.hasAttribute(K)){H.request(U);return}let Y=new MutationObserver(()=>{if(!z.hasAttribute(K))Y.disconnect(),U()});Y.observe(z,{attributes:!0,attributeFilter:[K]}),B?.addEventListener("abort",()=>Y.disconnect(),{once:!0});return}H.request(U)})}function W5($){let{enabled:Z=!0,open:J,ref:H,batch:Q=!1,onComplete:B}=$,X=U0(B),z=h4(H,J,Q);FT.useEffect(()=>{if(!Z)return;let G=new AbortController;return z(X,G.signal),()=>{G.abort()}},[Z,J,X,z])}var WT=500,Rz=500,qT={style:{transition:"none"}},jZ="data-base-ui-click-trigger";var NT="[data-base-ui-swipe-ignore]",AT="[data-swipe-ignore]",VT={fallbackAxisSide:"none"},P9={fallbackAxisSide:"end"},DT={clipPath:"inset(50%)",position:"fixed",top:0,left:0};var kz=P(m(),1);function _2($,Z=Number.MIN_SAFE_INTEGER,J=Number.MAX_SAFE_INTEGER){return Math.max(Z,Math.min($,J))}function Iz($,Z){let J=(Z??R1($).getComputedStyle($)).transform,H=0,Q=0,B=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],Q=z[5],B=Math.sqrt(z[0]*z[0]+z[1]*z[1]);else if(z.length===16)H=z[12],Q=z[13],B=z[0]}}return{x:H,y:Q,scale:B}}function bz($,Z,J){switch($){case"up":return-J;case"down":return J;case"left":return-Z;case"right":return Z;default:return 0}}var yz="--toast-index",LT="--toast-offset-y",MT="--toast-height",PT="--toast-swipe-movement-x",_T="--toast-swipe-movement-y";var OT="data-swipe-direction",HL0=n4.startingStyle,QL0=n4.endingStyle;var ET=P(c(),1),Ke={...Q2,swipeDirection($){return $?{[OT]:$}:null}},TT=40,Ye=10,CT=0.5,Fe=1,We=`${NT},${AT}`,ST=q5.forwardRef(function(Z,J){let{toast:H,render:Q,className:B,swipeDirection:X=["down","right"],style:z,...G}=Z,U=H.positionerProps?.anchor!==void 0,K=[];if(!U)K=Array.isArray(X)?X:[X];let Y=K.length>0,F=N9(),[W,q]=q5.useState(void 0),[N,V]=q5.useState(!1),[A,D]=q5.useState(!1),[L,j]=q5.useState({x:0,y:0}),[M,_]=q5.useState({x:0,y:0,scale:1}),[E,C]=q5.useState(),[R,T]=q5.useState(),[I,y]=q5.useState(null),S=q5.useRef(null),O=q5.useRef(void 0),b=q5.useRef({x:0,y:0}),k=q5.useRef({x:0,y:0,scale:1}),h=q5.useRef(void 0),v=q5.useRef(0),f=q5.useRef(!1),w=q5.useRef({x:0,y:0}),i=q5.useRef(!1),r=q5.useRef({x:0,y:0}),x=q5.useRef(null),l=q5.useRef(null),s=F.useState("toastIndex",H.id),p=F.useState("toastVisibleIndex",H.id),d=F.useState("toastOffsetY",H.id),o=F.useState("focused"),Z0=F.useState("expanded");W5({open:H.transitionStatus!=="ending",ref:S,onComplete(){if(H.transitionStatus==="ending")F.removeToast(H.id)}});let H0=U0((M0=!1)=>{let A0=S.current;if(!A0)return;let L0=A0.style.height;A0.style.height="auto";let g=A0.offsetHeight;A0.style.height=L0;function u(){F.updateToastInternal(H.id,{ref:S,height:g,transitionStatus:void 0})}if(M0)wT.flushSync(u);else u()});J0(()=>{let M0=O.current;if(H.transitionStatus!=="starting"&&M0===H.id)return;if(M0!==void 0)q(void 0),_({x:0,y:0,scale:1}),G0({x:0,y:0});O.current=H.id,H0()},[H0,H.id,H.transitionStatus]);function G0(M0){r.current=M0,j(M0)}J0(()=>{return()=>{l.current?.abort()}},[]);function X0(M0,A0){let L0=(t)=>t>0?t**CT:-(Math.abs(t)**CT),g=M0>0&&!K.includes("right")||M0<0&&!K.includes("left"),u=A0>0&&!K.includes("down")||A0<0&&!K.includes("up");return{x:g?L0(M0):M0,y:u?L0(A0):A0}}let Y0=U0((M0)=>{if(M0.pointerId!==x.current)return;x.current=null,l.current?.abort(),l.current=null,V(!1),D(!1),y(null);let A0=k.current;if(M0.type==="pointercancel"||f.current){G0({x:A0.x,y:A0.y}),q(void 0);return}let L0=r.current,g=L0.x-A0.x,u=L0.y-A0.y,t;for(let W0 of K)if(bz(W0,g,u)>TT){t=W0;break}if(t)q(t),F.closeToast(H.id);else G0({x:A0.x,y:A0.y}),q(void 0)});function V0(M0){if(M0.button!==0)return;if(M0.pointerType==="touch")F.pauseTimers();if(M1(M0.nativeEvent)?.closest(`button,a,input,textarea,[role="button"],${We}`))return;f.current=!1,h.current=void 0,v.current=0,x.current=M0.pointerId,b.current={x:M0.clientX,y:M0.clientY},w.current=b.current;let g=M0.currentTarget,u=Iz(g);k.current=u,_(u),G0({x:u.x,y:u.y}),F.set("hovering",!0),V(!0),D(!1),y(null),i.current=!0,l.current?.abort();let t=new AbortController;l.current=t;let W0=m0(g);W0.addEventListener("pointerup",Y0,{signal:t.signal}),W0.addEventListener("pointercancel",Y0,{signal:t.signal}),g.setPointerCapture?.(M0.pointerId)}function N0(M0){if(M0.pointerId!==x.current)return;if(M0.preventDefault(),i.current)b.current={x:M0.clientX,y:M0.clientY},i.current=!1;let{clientY:A0,clientX:L0,movementX:g,movementY:u}=M0;if(u<0&&A0>w.current.y||u>0&&A0<w.current.y)w.current={x:w.current.x,y:A0};if(g<0&&L0>w.current.x||g>0&&L0<w.current.x)w.current={x:L0,y:w.current.y};let t=L0-b.current.x,W0=A0-b.current.y,I0=A0-w.current.y,c0=L0-w.current.x,f0=I;if(!A){if(Math.sqrt(t*t+W0*W0)>=Fe){D(!0);let B1=K.includes("left")||K.includes("right"),s1=K.includes("up")||K.includes("down");if(B1&&s1){let C0=Math.abs(t),p0=Math.abs(W0);f0=C0>p0?"horizontal":"vertical",y(f0)}}}let T0;if(!h.current){if(f0==="vertical"){if(W0>0)T0="down";else if(W0<0)T0="up"}else if(f0==="horizontal"){if(t>0)T0="right";else if(t<0)T0="left"}else if(Math.abs(t)>=Math.abs(W0))T0=t>0?"right":"left";else T0=W0>0?"down":"up";if(T0&&K.includes(T0))h.current=T0,v.current=bz(T0,t,W0),q(T0)}else{let E1=h.current,B1=bz(E1,c0,I0);if(B1>TT)f.current=!1,q(E1);else if(!(K.includes("left")&&K.includes("right"))&&!(K.includes("up")&&K.includes("down"))&&v.current-B1>=Ye)f.current=!0}let x0=X0(t,W0),J1=k.current.x,W1=k.current.y,d0=K.includes("left")||K.includes("right"),v0=K.includes("up")||K.includes("down");if(f0!=="vertical"&&d0)J1+=x0.x;if(f0!=="horizontal"&&v0)W1+=x0.y;G0({x:J1,y:W1})}function F0(M0){if(M0.key==="Escape"){if(!S.current||!k0(S.current,p1(m0(S.current))))return;F.closeToast(H.id)}}q5.useEffect(()=>{let M0=S.current;if(!Y||!M0)return;function A0(L0){if(x.current===null||!k0(M0,M1(L0)))return;L0.preventDefault()}return n0(M0,"touchmove",A0,{passive:!1})},[Y]);function n(){let M0=L.x-M.x,A0=L.y-M.y;return{transition:N?"none":void 0,transform:N?`translateX(${L.x}px) translateY(${L.y}px) scale(${M.scale})`:void 0,[PT]:`${M0}px`,[_T]:`${A0}px`}}let a=H.priority==="high",e={role:a?"alertdialog":"dialog",tabIndex:0,"aria-modal":!1,"aria-labelledby":E,"aria-describedby":R,"aria-hidden":a&&!o?!0:void 0,onPointerDown:Y?V0:void 0,onPointerMove:Y?N0:void 0,onPointerUp:Y?Y0:void 0,onPointerCancel:Y?Y0:void 0,onKeyDown:F0,inert:D8(H.limited),style:{...n(),[yz]:H.transitionStatus==="ending"?s:p,[LT]:`${d}px`,[MT]:H.height?`${H.height}px`:void 0}},$0=q5.useMemo(()=>({toast:H,setTitleId:C,setDescriptionId:T,recalculateHeight:H0,visibleIndex:p,expanded:Z0}),[H,C,T,H0,p,Z0]),Q0={transitionStatus:H.transitionStatus,expanded:Z0,limited:H.limited||!1,type:H.type,swiping:N,swipeDirection:W},_0=z0("div",Z,{ref:[J,S],state:Q0,stateAttributesMapping:Ke,props:[e,G]});return ET.jsx(tN.Provider,{value:$0,children:_0})});var xz=P(m(),1);var RT=xz.forwardRef(function(Z,J){let{render:H,className:Q,style:B,...X}=Z,{visibleIndex:z,expanded:G,recalculateHeight:U}=Z6(),K=xz.useRef(null);J0(()=>{U();let W=K.current;if(!W||typeof ResizeObserver!=="function"||typeof MutationObserver!=="function")return;let q=new ResizeObserver(()=>U(!0)),N=new MutationObserver(()=>U(!0));return q.observe(W),N.observe(W,{childList:!0,subtree:!0,characterData:!0}),()=>{q.disconnect(),N.disconnect()}},[U]);let Y=z>0;return z0("div",Z,{ref:[J,K],state:{expanded:G,behind:Y},props:X})});var hT=P(m(),1);var hz=P(m(),1);var IT=0;function qe($,Z="mui"){let[J,H]=hz.useState($),Q=$||J;return hz.useEffect(()=>{if(J==null)IT+=1,H(`${Z}-${IT}`)},[J,Z]),Q}var kT=bT.useId;function A4($,Z){if(kT!==void 0){let J=kT();return $??(Z?`${Z}-${J}`:J)}return qe($,Z)}var yT=P(m(),1);function xT($){if($==null||typeof $==="boolean"||$==="")return!1;if(Array.isArray($))return $.some(xT);return!0}function vz($){return yT.isValidElement($)&&xT($.props.children)}function gz($,Z,J){let{toast:H,setTitleId:Q,setDescriptionId:B}=Z6(),X=J==="title"?Q:B,z=Z??(J==="title"?H.title:H.description);return{id:A4($),children:z,type:H.type,setId:X}}function fz($,Z,J){let H=vz($);return J0(()=>{if(!H)return;return J(Z),()=>{J((Q)=>Q===Z?void 0:Q)}},[H,Z,J]),H?$:null}var vT=hT.forwardRef(function(Z,J){let{render:H,className:Q,style:B,id:X,children:z,...G}=Z,{id:U,children:K,type:Y,setId:F}=gz(X,z,"description"),q=z0("p",Z,{ref:J,state:{type:Y},props:{...G,id:U,children:K}});return fz(q,U,F)});var gT=P(m(),1);var fT=gT.forwardRef(function(Z,J){let{render:H,className:Q,style:B,id:X,children:z,...G}=Z,{id:U,children:K,type:Y,setId:F}=gz(X,z,"title"),q=z0("h2",Z,{ref:J,state:{type:Y},props:{...G,id:U,children:K}});return fz(q,U,F)});var mz=P(m(),1);var mT=mz.forwardRef(function(Z,J){let{render:H,className:Q,style:B,disabled:X,nativeButton:z=!0,...G}=Z,U=N9(),{toast:K,expanded:Y}=Z6(),[F,W]=mz.useState(!1),{getButtonProps:q,buttonRef:N}=T5({disabled:X,native:z}),V={type:K.type};return z0("button",Z,{ref:[J,N],state:V,props:[{"aria-hidden":!Y&&!F,onClick(){U.closeToast(K.id)},onFocus(){W(!0)},onBlur(){W(!1)}},G,q]})});var uT=P(m(),1);var pT=uT.forwardRef(function(Z,J){let{render:H,className:Q,style:B,disabled:X,nativeButton:z=!0,...G}=Z,{toast:U}=Z6(),K=U.actionProps?.children??G.children,{getButtonProps:Y,buttonRef:F}=T5({disabled:X,native:z}),W={type:U.type},q=z0("button",Z,{ref:[J,F],state:W,props:[G,U.actionProps,Y,{children:K}]});return vz(q)?q:null});var rT=P(m(),1);var cz=P(m(),1),lT=P(e4(),1);var I5=P(m(),1),$A=P(e4(),1);var K0={};C5(K0,{windowResize:()=>oe,wheel:()=>me,triggerPress:()=>Ae,triggerHover:()=>Ve,triggerFocus:()=>De,trackPress:()=>Te,swipe:()=>ae,siblingOpen:()=>ce,scrub:()=>ue,pointer:()=>ge,outsidePress:()=>Le,none:()=>Ne,missing:()=>le,listNavigation:()=>he,linkPress:()=>_e,keyboard:()=>ve,itemPress:()=>Me,inputPress:()=>ke,inputPaste:()=>Ie,inputClear:()=>Se,inputChange:()=>Ee,inputBlur:()=>Re,initial:()=>ie,incrementPress:()=>Ce,imperativeAction:()=>re,focusOut:()=>be,escapeKey:()=>ye,drag:()=>fe,disabled:()=>de,decrementPress:()=>we,closeWatcher:()=>xe,closePress:()=>Pe,clearPress:()=>je,chipRemovePress:()=>Oe,cancelOpen:()=>pe});var Ne="none",Ae="trigger-press",Ve="trigger-hover",De="trigger-focus",Le="outside-press",Me="item-press",Pe="close-press",_e="link-press",je="clear-press",Oe="chip-remove-press",Te="track-press",Ce="increment-press",we="decrement-press",Ee="input-change",Se="input-clear",Re="input-blur",Ie="input-paste",ke="input-press",be="focus-out",ye="escape-key",xe="close-watcher",he="list-navigation",ve="keyboard",ge="pointer",fe="drag",me="wheel",ue="scrub",pe="cancel-open",ce="sibling-open",de="disabled",le="missing",ie="initial",re="imperative-action",ae="swipe",oe="window-resize";function R0($,Z,J,H){let Q=!1,B=!1,X=H??L1;return{reason:$,event:Z??new Event("base-ui"),cancel(){Q=!0},allowPropagation(){B=!0},get isCanceled(){return Q},get isPropagationAllowed(){return B},trigger:J,...X}}function uz($,Z,J){let H=J??L1;return{reason:$,event:Z??new Event("base-ui"),...H}}function A3($){return`data-base-ui-${$}`}var d7=P(c(),1),dT=I5.createContext(null),ZA=()=>I5.useContext(dT),ne=A3("portal");function pz($={}){let{ref:Z,container:J,componentProps:H=L1,elementProps:Q}=$,B=A4(),z=ZA()?.portalNode,[G,U]=I5.useState(null),[K,Y]=I5.useState(null),F=U0((V)=>{if(V!==null)Y(V)}),W=I5.useRef(null);J0(()=>{if(J===null){if(W.current)W.current=null,Y(null),U(null);return}let V=(J&&(cT(J)?J:J.current))??z??document.body;if(V==null){if(W.current)W.current=null,Y(null),U(null);return}if(W.current!==V)W.current=V,Y(null),U(V)},[J,z]);let q=z0("div",H,{ref:[Z,F],props:[{id:B,[ne]:""},Q]}),N=G&&q?$A.createPortal(q,G):null;return{node:K,nodeId:I5.isValidElement(q)?q.props.id:void 0,subtree:N}}var l7=I5.forwardRef(function(Z,J){let{render:H,className:Q,style:B,children:X,container:z,portalOwnerRole:G,...U}=Z,{node:K,nodeId:Y,subtree:F}=pz({container:z,ref:J,componentProps:Z,elementProps:U}),W=I5.useRef(null),q=I5.useRef(null),N=I5.useRef(null),V=I5.useRef(null),[A,D]=I5.useState(null),L=I5.useRef(!1),j=A?.modal,M=A?.open,_=!!A&&!A.modal&&A.open&&!!K;I5.useEffect(()=>{if(!K||j)return;function C(R){if(K&&R.relatedTarget&&q3(R))if(R.type==="focusin"){if(L.current)aN(K),L.current=!1}else BT(K),L.current=!0}return M2(n0(K,"focusin",C,!0),n0(K,"focusout",C,!0))},[K,j]),J0(()=>{if(!K||M!==!0||!L.current)return;aN(K),L.current=!1},[M,K]);let E=I5.useMemo(()=>({beforeOutsideRef:W,afterOutsideRef:q,beforeInsideRef:N,afterInsideRef:V,portalNode:K,setFocusManagerState:D}),[K]);return d7.jsxs(I5.Fragment,{children:[F,d7.jsxs(dT.Provider,{value:E,children:[_&&K&&d7.jsx(x4,{"data-type":"outside",ref:W,onFocus:(C)=>{if(q3(C,K))N.current?.focus();else{let R=A?A.domReference:null;Oz(R)?.focus()}}}),_&&K&&d7.jsx("span",{role:G,"aria-owns":Y,style:DT}),K&&$A.createPortal(X,K),_&&K&&d7.jsx(x4,{"data-type":"outside",ref:q,onFocus:(C)=>{if(q3(C,K))V.current?.focus();else{let R=A?A.domReference:null;if(_Z(R)?.focus(),A?.closeOnFocusOut)A?.onOpenChange(!1,R0(K0.focusOut,C.nativeEvent))}}})]})]})});var iT=P(c(),1),OZ=cz.forwardRef(function(Z,J){let{children:H,container:Q,className:B,render:X,style:z,...G}=Z,{node:U,subtree:K}=pz({container:Q,ref:J,componentProps:Z,elementProps:G});if(!K&&!U)return null;return iT.jsxs(cz.Fragment,{children:[K,U&&lT.createPortal(H,U)]})});var aT=P(c(),1),oT=rT.forwardRef(function(Z,J){return aT.jsx(OZ,{ref:J,...Z})});var WG=P(m(),1);var $8=P(m(),1);function U5($){let Z=l1(se,$).current;return Z.next=$,J0(Z.effect),Z}function se($){let Z={current:$,next:$,effect:()=>{Z.current=Z.next}};return Z}var V4=P(m(),1);function te($,Z){if(Z!=null&&!t4(Z))return 0;if(typeof $==="function")return $();return $}function p8($,Z,J){let H=te($,J);if(typeof H==="number")return H;return H?.[Z]}function JA($){if(typeof $==="function")return $();return $}function dz($,Z){return Z||$==="click"||$==="mousedown"}function nT($){return $?.includes("mouse")&&$!=="mousedown"}var sT=P(c(),1),tT=V4.createContext({hasProvider:!1,timeoutMs:0,delayRef:{current:0},initialDelayRef:{current:0},timeout:new c5,currentIdRef:{current:null},currentContextRef:{current:null}});function ee($,Z){$.current=Z.current}function HA($){let{children:Z,delay:J,timeoutMs:H=0}=$,Q=V4.useRef(J),B=V4.useRef(J),X=V4.useRef(null),z=V4.useRef(null),G=d1();return J0(()=>{if(B.current=J,!X.current){Q.current=J;return}Q.current={open:p8(Q.current,"open"),close:p8(J,"close")}},[J,X,Q,B]),sT.jsx(tT.Provider,{value:V4.useMemo(()=>({hasProvider:!0,delayRef:Q,initialDelayRef:B,currentIdRef:X,timeoutMs:H,currentContextRef:z,timeout:G}),[H,G]),children:Z})}function QA($,Z={open:!1}){let{open:J}=Z,H="rootStore"in $?$.rootStore:$,Q=H.useState("floatingId"),B=V4.useContext(tT),{currentIdRef:X,delayRef:z,timeoutMs:G,initialDelayRef:U,currentContextRef:K,hasProvider:Y,timeout:F}=B,[W,q]=V4.useState(!1),N=V4.useRef(J);return J0(()=>{N.current=J},[J]),J0(()=>{function V(){K.current?.setIsInstantPhase(!1),X.current=null,K.current=null,z.current=U.current,F.clear()}if(!X.current)return;if(!J&&X.current===Q){if(q(!1),G){let A=Q;return F.start(G,()=>{if(H.select("open")||X.current&&X.current!==A)return;V()}),()=>{if(N.current||X.current!==A)F.clear()}}V()}return},[J,Q,X,z,G,U,K,F,H]),J0(()=>{if(!J)return;let V=K.current,A=X.current;if(F.clear(),K.current={onOpenChange:H.setOpen,setIsInstantPhase:q},X.current=Q,z.current={open:0,close:p8(U.current,"close")},A!==null&&A!==Q)q(!0),V?.setIsInstantPhase(!0),V?.onOpenChange(!1,R0(K0.none));else q(!1),V?.setIsInstantPhase(!1)},[J,Q,H,X,z,U,K,F]),J0(()=>{return()=>{if(X.current===Q){if(K.current=null,!N.current)return;X.current=null,ee(z,U),F.clear()}}},[K,X,z,Q,U,F]),V4.useMemo(()=>({activeIdRef:X,hasProvider:Y,delayRef:z,isInstantPhase:W}),[X,Y,z,W])}var s2=P(m(),1);var lz=0;function TZ($,Z={}){let{preventScroll:J=!1,sync:H=!1,shouldFocus:Q}=Z;cancelAnimationFrame(lz);function B(){if(Q&&!Q())return;$?.focus({preventScroll:J})}if(H)return B(),X1;let X=requestAnimationFrame(B);return lz=X,()=>{if(lz===X)cancelAnimationFrame(X),lz=0}}var BA={inert:new WeakMap,"aria-hidden":new WeakMap},eT="data-base-ui-inert",zA={inert:new WeakSet,"aria-hidden":new WeakSet},ZQ=new WeakMap,XA=0;function $00($){return zA[$]}function HC($){if(!$)return null;return n3($)?$.host:HC($.parentNode)}var $C=($,Z)=>Z.map((J)=>{if($.contains(J))return J;let H=HC(J);if($.contains(H))return H;return null}).filter((J)=>J!=null),ZC=($)=>{let Z=new Set;return $.forEach((J)=>{let H=J;while(H&&!Z.has(H))Z.add(H),H=H.parentNode}),Z},JC=($,Z,J)=>{let H=[],Q=(B)=>{if(!B||J.has(B))return;Array.from(B.children).forEach((X)=>{if(P2(X)==="script")return;if(Z.has(X))Q(X);else H.push(X)})};return Q($),H};function Z00($,Z,J,H,{mark:Q=!0}){let B=null;if(H)B="inert";else if(J)B="aria-hidden";let X=null,z=null,G=$C(Z,$),U=Q?JC(Z,ZC(G),new Set(G)):[],K=[],Y=[];if(B){let F=BA[B],W=$00(B);z=W,X=F;let q=$C(Z,Array.from(Z.querySelectorAll("[aria-live]"))),N=G.concat(q);JC(Z,ZC(N),new Set(N)).forEach((A)=>{let D=A.getAttribute(B),L=D!==null&&D!=="false",j=(F.get(A)||0)+1;if(F.set(A,j),K.push(A),j===1&&L)W.add(A);if(!L)A.setAttribute(B,B==="inert"?"":"true")})}if(Q)U.forEach((F)=>{let W=(ZQ.get(F)||0)+1;if(ZQ.set(F,W),Y.push(F),W===1)F.setAttribute(eT,"")});return XA+=1,()=>{if(X)K.forEach((F)=>{let q=(X.get(F)||0)-1;if(X.set(F,q),!q){if(!z?.has(F)&&B)F.removeAttribute(B);z?.delete(F)}});if(Q)Y.forEach((F)=>{let W=(ZQ.get(F)||0)-1;if(ZQ.set(F,W),!W)F.removeAttribute(eT)});if(XA-=1,!XA)BA.inert=new WeakMap,BA["aria-hidden"]=new WeakMap,zA.inert=new WeakSet,zA["aria-hidden"]=new WeakSet,ZQ=new WeakMap}}function GA($,Z={}){let{ariaHidden:J=!1,inert:H=!1,mark:Q=!0}=Z,B=m0($[0]).body;return Z00($,B,J,H,{mark:Q})}var J6=P(m(),1);function iz(){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 i7{nodesRef={current:[]};events=iz();addNode($){this.nodesRef.current.push($)}removeNode($){let Z=this.nodesRef.current.findIndex((J)=>J===$);if(Z!==-1)this.nodesRef.current.splice(Z,1)}}var UA=P(c(),1),QC=J6.createContext(null),BC=J6.createContext(null),D4=()=>J6.useContext(QC)?.id||null,n2=($)=>{let Z=J6.useContext(BC);return $??Z};function V3($){let Z=A4(),J=n2($),H=D4();return J0(()=>{if(!Z)return;let Q={id:Z,parentId:H};return J?.addNode(Q),()=>{J?.removeNode(Q)}},[J,Z,H]),Z}function r7($){let{children:Z,id:J}=$,H=D4();return UA.jsx(QC.Provider,{value:J6.useMemo(()=>({id:J,parentId:H}),[J,H]),children:Z})}function a7($){let{children:Z,externalTree:J}=$,H=l1(()=>J??new i7).current;return UA.jsx(BC.Provider,{value:H,children:Z})}var JQ=P(c(),1);function J00($,Z){let J=R1(M1($));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 XC=20,H6=[];function KA(){H6=H6.filter(($)=>{return $.deref()?.isConnected})}function zC($){if(KA(),$&&P2($)!=="body"){if(H6.push(new WeakRef($)),H6.length>XC)H6=H6.slice(-XC)}}function GC(){return KA(),H6[H6.length-1]?.deref()}function H00($){if(!$)return null;if(jz($))return $;return PZ($)[0]||$}function UC($){if($.hasAttribute("tabindex")&&!$.hasAttribute("data-tabindex"))return;if(!$.getAttribute("role")?.includes("dialog"))return;let J=rN($).filter((Q)=>{let B=Q.getAttribute("data-tabindex")||"";return jz(Q)||Q.hasAttribute("data-tabindex")&&!B.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 o7($){let{context:Z,children:J,disabled:H=!1,initialFocus:Q=!0,returnFocus:B=!0,restoreFocus:X=!1,modal:z=!0,closeOnFocusOut:G=!0,openInteractionType:U="",nextFocusableElement:K,previousFocusableElement:Y,beforeContentFocusGuardRef:F,externalTree:W,getInsideElements:q}=$,N="rootStore"in Z?Z.rootStore:Z,V=N.useState("open"),A=N.useState("domReferenceElement"),D=N.useState("floatingElement"),{events:L,dataRef:j}=N.context,M=U0(()=>j.current.floatingContext?.nodeId),_=Q===!1,E=oH(A)&&_,C=U5(Q),R=U5(B),T=U5(U),I=U5(V),y=n2(W),S=ZA(),O=s2.useRef(!1),b=s2.useRef(!1),k=s2.useRef(!1),h=s2.useRef(null),v=s2.useRef(""),f=s2.useRef(""),w=s2.useRef(null),i=s2.useRef(null),r=x2(w,F,S?.beforeInsideRef),x=x2(i,S?.afterInsideRef),l=d1(),s=d1(),p=N4(),d=S!=null,o=nH(D),Z0=U0((X0=o)=>{return X0?PZ(X0):[]}),H0=U0(()=>q?.().filter((X0)=>X0!=null)??[]);s2.useEffect(()=>{if(H||!z)return;function X0(V0){if(V0.key==="Tab"){if(k0(o,p1(m0(o)))&&Z0().length===0&&!E)b4(V0)}}let Y0=m0(o);return n0(Y0,"keydown",X0)},[H,o,z,E,Z0]),s2.useEffect(()=>{if(H||!V)return;let X0=m0(o);function Y0(){k.current=!1}function V0(F0){let n=M1(F0),a=H0(),e=k0(D,n)||k0(A,n)||k0(S?.portalNode,n)||a.some(($0)=>$0===n||k0($0,n));if(k.current=!e,f.current=F0.pointerType||"keyboard",n?.closest(`[${jZ}]`))b.current=!0,s.start(0,()=>{b.current=!1})}function N0(){f.current="keyboard"}return M2(n0(X0,"pointerdown",V0,!0),n0(X0,"pointerup",Y0,!0),n0(X0,"pointercancel",Y0,!0),n0(X0,"keydown",N0,!0),Y0)},[H,D,A,o,V,S,s,H0]),s2.useEffect(()=>{if(H||!G)return;let X0=m0(o);function Y0(){b.current=!0,s.start(0,()=>{b.current=!1})}function V0(a){let e=M1(a);if(jz(e))h.current=e}function N0(a){let{relatedTarget:e,currentTarget:$0}=a,Q0=M1(a);if(z&&e==null&&Q0!=null&&k0(D,Q0))zC(Q0);queueMicrotask(()=>{let _0=M(),M0=N.context.triggerElements,A0=H0(),L0=e?.hasAttribute(A3("focus-guard"))&&[w.current,i.current,S?.beforeInsideRef.current,S?.afterInsideRef.current,S?.beforeOutsideRef.current,S?.afterOutsideRef.current,u8(Y),u8(K)].includes(e),g=!(k0(A,e)||k0(D,e)||k0(e,D)||k0(S?.portalNode,e)||A0.some((u)=>u===e||k0(u,e))||M0.hasMatchingElement((u)=>k0(u,e))||L0||y&&(q8(y.nodesRef.current,_0).find((u)=>k0(u.context?.elements.floating,e)||k0(u.context?.elements.domReference,e))||dN(y.nodesRef.current,_0).find((u)=>[u.context?.elements.floating,nH(u.context?.elements.floating)].includes(e)||u.context?.elements.domReference===e)));if($0===A&&o)UC(o);if(X&&$0!==A&&!c7(Q0)&&p1(X0)===X0.body){if(P1(o)){if(o.focus(),X==="popup"){p.request(()=>{o.focus()});return}}let u=Z0(),t=h.current,W0=(t&&u.includes(t)?t:null)||u[u.length-1]||o;if(P1(W0))W0.focus()}if(j.current.insideReactTree){j.current.insideReactTree=!1;return}if((E?!0:!z)&&e&&g&&!b.current&&(E||e!==GC()))O.current=!0,N.setOpen(!1,R0(K0.focusOut,a))})}function F0(){if(k.current)return;j.current.insideReactTree=!0,l.start(0,()=>{j.current.insideReactTree=!1})}let n=P1(A)?A:null;if(!D&&!n)return;return M2(n&&n0(n,"focusout",N0),n&&n0(n,"pointerdown",Y0),D&&n0(D,"focusin",V0),D&&n0(D,"focusout",N0),D&&S&&n0(D,"focusout",F0,!0))},[H,A,D,o,z,y,S,N,G,X,Z0,E,M,j,l,s,p,K,Y,H0]),s2.useEffect(()=>{if(H||!D||!V)return;let X0=Array.from(S?.portalNode?.querySelectorAll(`[${A3("portal")}]`)||[]),V0=(y?dN(y.nodesRef.current,M()):[]).find(($0)=>oH($0.context?.elements.domReference||null))?.context?.elements.domReference,F0=[...[D,...X0,w.current,i.current,S?.beforeOutsideRef.current,S?.afterOutsideRef.current,...H0()],V0,u8(Y),u8(K),E?A:null].filter(($0)=>$0!=null),n=GA(F0,{ariaHidden:z||E,mark:!1}),a=[D,...X0].filter(($0)=>$0!=null),e=GA(a);return()=>{e(),n()}},[V,H,A,D,z,S,E,y,M,K,Y,H0]),J0(()=>{if(!V||H||!P1(o))return;v.current="",f.current="";let X0=m0(o),Y0=p1(X0);queueMicrotask(()=>{let V0=C.current,N0=typeof V0==="function"?V0(T.current||""):V0;if(N0===void 0||N0===!1)return;if(k0(o,Y0))return;let n=null,a=()=>{if(n==null)n=Z0(o);return n[0]||o},e;if(N0===!0||N0===null)e=a();else e=u8(N0);e=e||a();let $0=k0(o,p1(X0));TZ(e,{preventScroll:e===o,shouldFocus(){if(!I.current)return!1;if($0)return!0;let Q0=p1(X0);return!(Q0!==e&&k0(o,Q0))}})})},[H,V,o,Z0,C,T,I]),J0(()=>{if(H||!o)return;let X0=m0(o),Y0=p1(X0),V0=T.current==null;zC(Y0);function N0(n){if(!n.open)v.current=J00(n.nativeEvent,f.current);if(n.reason===K0.triggerHover&&n.nativeEvent.type==="mouseleave")O.current=!0;if(n.reason!==K0.outsidePress)return;if(n.nested)O.current=!1;else if(DZ(n.nativeEvent)||LZ(n.nativeEvent))O.current=!1;else{let a=!1;if(m0(o).createElement("div").focus({get preventScroll(){return a=!0,!1}}),a)O.current=!1;else O.current=!0}}L.on("openchange",N0);function F0(n){let a=R.current,e=typeof a==="function"?a(n):a;if(e===void 0||e===!1)return null;if(e===null)e=!0;let $0=A?.isConnected?A:null,Q0=Y0?.isConnected&&P2(Y0)!=="body"?Y0:null,_0=V0?Q0||$0:$0||Q0;if(!_0)_0=GC()||null;if(typeof e==="boolean")return _0;return u8(e)||_0||null}return()=>{L.off("openchange",N0);let n=p1(X0),a=H0(),e=k0(D,n)||a.some((M0)=>M0===n||k0(M0,n))||y&&q8(y.nodesRef.current,M(),!1).some((M0)=>k0(M0.context?.elements.floating,n)),$0=R.current,Q0=v.current,_0=F0(Q0);queueMicrotask(()=>{let M0=H00(_0),A0=typeof $0!=="boolean";if($0&&!O.current&&P1(M0)&&(!A0&&M0!==n&&n!==X0.body?e:!0)){let L0={preventScroll:!0};if(Q0==="keyboard")L0.focusVisible=!0;M0.focus(L0)}O.current=!1})}},[H,D,o,R,T,L,y,A,M,H0]),J0(()=>{if(!r1.engine.webkit||V||!D)return;let X0=p1(m0(D));if(!P1(X0)||!m7(X0))return;if(k0(D,X0))X0.blur()},[V,D]),J0(()=>{if(H||!S)return;return S.setFocusManagerState({modal:z,closeOnFocusOut:G,open:V,onOpenChange:N.setOpen,domReference:A}),()=>{S.setFocusManagerState(null)}},[H,S,z,V,N,G,A]),J0(()=>{if(H||!o)return;return UC(o),()=>{queueMicrotask(KA)}},[H,o]);let G0=!H&&(z?!E:!0)&&(d||z);return JQ.jsxs(s2.Fragment,{children:[G0&&JQ.jsx(x4,{"data-type":"inside",ref:r,onFocus:(X0)=>{if(z){let Y0=Z0();TZ(Y0[Y0.length-1])}else if(S?.portalNode)if(O.current=!1,q3(X0,S.portalNode))_Z(A)?.focus();else u8(Y??S.beforeOutsideRef)?.focus()}}),J,G0&&JQ.jsx(x4,{"data-type":"inside",ref:x,onFocus:(X0)=>{if(z)TZ(Z0()[0]);else if(S?.portalNode){if(G)O.current=!0;if(q3(X0,S.portalNode))Oz(A)?.focus();else u8(K??S.afterOutsideRef)?.focus()}}})]})}var HQ=P(m(),1);function D3($,Z={}){let{enabled:J=!0,event:H="click",toggle:Q=!0,ignoreMouse:B=!1,stickIfOpen:X=!0,touchOpenDelay:z=0,reason:G=K0.triggerPress}=Z,U="rootStore"in $?$.rootStore:$,K=U.context.dataRef,Y=HQ.useRef(void 0),F=N4(),W=d1(),q=HQ.useMemo(()=>{function N(A,D,L,j){let M=R0(G,D,L);if(A&&j==="touch"&&z>0)W.start(z,()=>{U.setOpen(!0,M)});else U.setOpen(A,M)}function V(A,D,L){let j=K.current.openEvent,M=U.select("domReferenceElement")!==D;if(A&&M)return!0;if(!A)return!0;if(!Q)return!0;if(j&&X)return!L(j.type);return!1}return{onPointerDown(A){Y.current=t4(A.pointerType,!0)&&LZ(A.nativeEvent)?"virtual":A.pointerType},onMouseDown(A){let D=Y.current,L=A.nativeEvent,j=U.select("open");if(A.button!==0||H==="click"||t4(D,!0)&&B)return;let M=V(j,A.currentTarget,(C)=>C==="click"||C==="mousedown"),_=M1(L);if(m7(_)){N(M,L,_,D);return}let E=A.currentTarget;F.request(()=>{N(M,L,E,D)})},onClick(A){if(H==="mousedown-only")return;let D=Y.current;if(H==="mousedown"&&D){Y.current=void 0;return}if(t4(D,!0)&&B)return;let L=U.select("open"),j=V(L,A.currentTarget,(M)=>M==="click"||M==="mousedown"||M==="keydown"||M==="keyup");N(j,A.nativeEvent,A.currentTarget,D)},onKeyDown(){Y.current=void 0}}},[K,H,B,G,U,X,Q,F,W,z]);return HQ.useMemo(()=>J?{reference:q}:L1,[J,q])}var v4=P(m(),1);function Q00($,Z){let J=null,H=null,Q=!1;return{contextElement:$||void 0,getBoundingClientRect(){let B=$?.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=B.width,K=B.height,Y=B.x,F=B.y;if(J==null&&Z.x&&X)J=B.x-Z.x;if(H==null&&Z.y&&z)H=B.y-Z.y;if(Y-=J||0,F-=H||0,U=0,K=0,!Q||G)U=Z.axis==="y"?B.width:0,K=Z.axis==="x"?B.height:0,Y=X&&Z.x!=null?Z.x:Y,F=z&&Z.y!=null?Z.y:F;else if(Q&&!G)K=Z.axis==="x"?B.height:K,U=Z.axis==="y"?B.width:U;return Q=!0,{width:U,height:K,x:Y,y:F,top:F,right:Y+U,bottom:F+K,left:Y}}}}function KC($){return $!=null&&$.clientX!=null}function YA($,Z={}){let{enabled:J=!0,axis:H="both"}=Z,Q="rootStore"in $?$.rootStore:$,B=Q.useState("open"),X=Q.useState("floatingElement"),z=Q.useState("domReferenceElement"),G=Q.context.dataRef,U=v4.useRef(!1),K=v4.useRef(null),[Y,F]=v4.useState(),[W,q]=v4.useState([]),N=U0((j)=>{Q.set("positionReference",j)}),V=U0((j,M,_)=>{if(U.current)return;if(G.current.openEvent&&!KC(G.current.openEvent))return;Q.set("positionReference",Q00(_??z,{x:j,y:M,axis:H,dataRef:G,pointerType:Y}))}),A=U0((j)=>{if(!B)V(j.clientX,j.clientY,j.currentTarget);else if(!K.current)V(j.clientX,j.clientY,j.currentTarget),q([])}),D=t4(Y)?X:B;v4.useEffect(()=>{if(!J){N(z);return}if(!D)return;function j(){K.current?.(),K.current=null}let M=R1(X);function _(E){let C=M1(E);if(!k0(X,C))V(E.clientX,E.clientY);else j()}if(!G.current.openEvent||KC(G.current.openEvent))K.current=n0(M,"mousemove",_);else N(z);return j},[D,J,X,G,z,Q,V,N,W]),v4.useEffect(()=>()=>{Q.set("positionReference",null)},[Q]),v4.useEffect(()=>{if(J&&!X)U.current=!1},[J,X]),v4.useEffect(()=>{if(!J&&B)U.current=!0},[J,B]);let L=v4.useMemo(()=>{function j(M){F(M.pointerType)}return{onPointerDown:j,onPointerEnter:j,onMouseMove:A,onMouseEnter:A}},[A]);return v4.useMemo(()=>J?{reference:L,trigger:L}:{},[J,L])}var L4=P(m(),1);function B00(){return!1}function X00($){return{escapeKey:typeof $==="boolean"?$:$?.escapeKey??!1,outsidePress:typeof $==="boolean"?$:$?.outsidePress??!0}}function c8($,Z={}){let{enabled:J=!0,escapeKey:H=!0,outsidePress:Q=!0,outsidePressEvent:B="sloppy",referencePress:X=B00,bubbles:z,externalTree:G}=Z,U="rootStore"in $?$.rootStore:$,K=U.useState("open"),Y=U.useState("floatingElement"),{dataRef:F,events:W}=U.context,q=n2(G),N=U0(typeof Q==="function"?Q:()=>!1),V=typeof Q==="function"?N:Q,A=V!==!1,D=U0(()=>B),{escapeKey:L,outsidePress:j}=X00(z),M=L4.useRef(!1),_=L4.useRef(!1),E=L4.useRef(!1),C=L4.useRef(!1),R=L4.useRef(!1),T=L4.useRef(""),I=L4.useRef(null),y=d1(),S=d1(),O=U0(()=>{S.clear(),F.current.insideReactTree=!1}),b=U0((l)=>{let s=F.current.floatingContext?.nodeId;return(q?q8(q.nodesRef.current,s):[]).some((d)=>d.context?.open&&!d.context.dataRef.current[l])}),k=U0((l)=>{return Dz(l,U.select("floatingElement"))||Dz(l,U.select("domReferenceElement"))}),h=U0((l)=>{if(!X())return;U.setOpen(!1,R0(K0.triggerPress,l.nativeEvent))}),v=U0((l)=>{if(!K||!J||!H||l.key!=="Escape")return;if(R.current)return;if(!L&&b("__escapeKeyBubbles"))return;let s=pO(l)?l.nativeEvent:l,p=R0(K0.escapeKey,s);if(U.setOpen(!1,p),!p.isCanceled)l.preventDefault();if(!L&&!p.isPropagationAllowed)l.stopPropagation()}),f=U0(()=>{F.current.insideReactTree=!0,S.start(0,O)}),w=U0((l)=>{if(!K||!J||l.button!==0)return;let s=M1(l.nativeEvent);if(!k0(U.select("floatingElement"),s))return;if(!M.current)M.current=!0,_.current=!1}),i=U0((l)=>{if(!K||!J)return;if(!(l.defaultPrevented||l.nativeEvent.defaultPrevented))return;if(M.current)_.current=!0});L4.useEffect(()=>{function l(s){if(!s.open)C.current=!1}return W.on("openchange",l),()=>{W.off("openchange",l)}},[W]),L4.useEffect(()=>{if(!K||!J){if(!K)C.current=!1;return O}F.current.__escapeKeyBubbles=L,F.current.__outsidePressBubbles=j;let l=new c5,s=new c5,p=m0(Y);function d(){l.clear(),R.current=!0}function o(){l.start(r1.engine.webkit?5:0,()=>{R.current=!1})}function Z0(){E.current=!0,s.start(0,()=>{E.current=!1})}function H0(){M.current=!1,_.current=!1}function G0(){let g=T.current,u=g==="pen"||!g?"mouse":g,t=D(),W0=typeof t==="function"?t():t;if(typeof W0==="string")return W0;return W0[u]}function X0(g){let u=G0();return u==="intentional"&&g.type!=="click"||u==="sloppy"&&g.type==="click"}function Y0(g){let u=F.current.floatingContext?.nodeId,t=q&&q8(q.nodesRef.current,u).some((W0)=>Dz(g,W0.context?.elements.floating));return k(g)||t}function V0(g){if(X0(g)){if(g.type!=="click"&&!k(g))s.clear(),E.current=!1;O();return}if(F.current.insideReactTree){O();return}let u=M1(g),t=`[${A3("inert")}]`,W0=s0(u)?u.getRootNode():null,I0=Array.from((n3(W0)?W0:m0(U.select("floatingElement"))).querySelectorAll(t)),c0=U.context.triggerElements;if(u&&(c0.hasElement(u)||c0.hasMatchingElement((T0)=>k0(T0,u))))return;let f0=s0(u)?u:null;while(f0&&!L8(f0)){let T0=M8(f0);if(L8(T0)||!s0(T0))break;f0=T0}if(I0.length&&s0(u)&&!uO(u)&&!k0(u,U.select("floatingElement"))&&I0.every((T0)=>!k0(f0,T0)))return;if(P1(u)&&!("touches"in g)){let T0=L8(u),x0=y2(u),J1=/auto|scroll/,W1=T0||J1.test(x0.overflowX),d0=T0||J1.test(x0.overflowY),v0=W1&&u.clientWidth>0&&u.scrollWidth>u.clientWidth,E1=d0&&u.clientHeight>0&&u.scrollHeight>u.clientHeight,B1=x0.direction==="rtl",s1=E1&&(B1?g.offsetX<=u.offsetWidth-u.clientWidth:g.offsetX>u.clientWidth),C0=v0&&g.offsetY>u.clientHeight;if(s1||C0)return}if(Y0(g))return;if(G0()==="intentional"){if(g.detail!==0&&!DZ(g)&&!C.current)return;if(E.current){s.clear(),E.current=!1;return}}if(typeof V==="function"&&!V(g))return;if(b("__outsidePressBubbles"))return;U.setOpen(!1,R0(K0.outsidePress,g)),O()}function N0(g){if(G0()!=="sloppy"||g.pointerType==="touch"||!U.select("open")||!J||k(g))return;V0(g)}function F0(g){if(G0()!=="sloppy"||!U.select("open")||!J||k(g))return;let u=g.touches[0];if(u)I.current={startTime:Date.now(),startX:u.clientX,startY:u.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},y.start(1000,()=>{if(I.current)I.current.dismissOnTouchEnd=!1,I.current.dismissOnMouseDown=!1})}function n(g,u){let t=M1(g);if(!t)return;let W0=n0(t,g.type,()=>{u(g),W0()})}function a(g){T.current="touch",n(g,F0)}function e(g){if(y.clear(),g.type==="pointerdown"){if(g.button===0)C.current=!0;T.current=g.pointerType}if(g.type==="mousedown"&&I.current&&!I.current.dismissOnMouseDown)return;n(g,(u)=>{if(u.type==="pointerdown")N0(u);else V0(u)})}function $0(g){if(g.type==="pointercancel")C.current=!1;if(!M.current)return;let u=_.current;if(H0(),G0()!=="intentional")return;if(g.type==="pointercancel"){if(u)Z0();return}if(Y0(g))return;if(u){Z0();return}if(typeof V==="function"&&!V(g))return;s.clear(),E.current=!0,O()}function Q0(g){if(G0()!=="sloppy"||!I.current||k(g))return;let u=g.touches[0];if(!u)return;let t=Math.abs(u.clientX-I.current.startX),W0=Math.abs(u.clientY-I.current.startY),I0=Math.sqrt(t*t+W0*W0);if(I0>5)I.current.dismissOnTouchEnd=!0;if(I0>10)V0(g),y.clear(),I.current=null}function _0(g){n(g,Q0)}function M0(g){if(G0()!=="sloppy"||!I.current||k(g))return;if(I.current.dismissOnTouchEnd)V0(g);y.clear(),I.current=null}function A0(g){n(g,M0)}let L0=M2(H&&M2(n0(p,"keydown",v),n0(p,"compositionstart",d),n0(p,"compositionend",o)),A&&M2(n0(p,"click",e,!0),n0(p,"pointerdown",e,!0),n0(p,"pointerup",$0,!0),n0(p,"pointercancel",$0,!0),n0(p,"mousedown",e,!0),n0(p,"mouseup",$0,!0),n0(p,"touchstart",a,{capture:!0,passive:!0}),n0(p,"touchmove",_0,{capture:!0,passive:!0}),n0(p,"touchend",A0,{capture:!0,passive:!0})));return()=>{L0(),l.clear(),s.clear(),H0(),E.current=!1,O()}},[F,Y,H,A,V,K,J,L,j,v,O,D,b,k,q,U,y]);let r=L4.useMemo(()=>({onKeyDown:v,onPointerDown:h,onClick:h}),[v,h]),x=L4.useMemo(()=>({onKeyDown:v,onPointerDown:i,onMouseDown:i,onClickCapture:f,onMouseDownCapture(l){f(),w(l)},onPointerDownCapture(l){f(),w(l)},onMouseUpCapture:f,onTouchEndCapture:f,onTouchMoveCapture:f}),[v,f,w,i]);return L4.useMemo(()=>J?{reference:r,floating:x,trigger:r}:{},[J,r,x])}function rz($,Z,J,H){return{left:$,top:Z,right:J,bottom:H,x:$,y:Z,width:J-$,height:H-Z}}function z00($){return{left:$.left,top:$.top,right:$.right,bottom:$.bottom,width:$.width,height:$.height}}function FC($){let Z=[],J,H=Number.POSITIVE_INFINITY,Q=Number.POSITIVE_INFINITY,B=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),Q=Math.min(Q,z.top),B=Math.max(B,z.right),X=Math.max(X,z.bottom),!J||z.top-J.top>J.height/2)Z.push(z00(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:rz(H,Q,B,X)}}function WC($,Z,J){return $.findIndex((H)=>Z>H.left-2&&Z<H.right+2&&J>H.top-2&&J<H.bottom+2)}function YC($){return rz($.left,$.top,$.right,$.bottom)}function G00($,Z,J){let{lines:H}=FC($.getClientRects());if(H.length<2)return;let Q=WC(H,Z,J);return{x:Z,y:J,lineIndex:Q===-1?void 0:Q,element:$}}function U00($,Z,J){let{lines:H,fallback:Q}=FC($.getClientRects());if(H.length<2)return null;let B=J?.x,X=J?.y,z=Z[0];if(J?.lineIndex!=null&&H[J.lineIndex])return YC(H[J.lineIndex]);if(B!=null&&X!=null){let q=WC(H,B,X);if(q!==-1)return YC(H[q])}if(H.length===2&&H[0].left>H[1].right&&B!=null&&X!=null)return Q;if(z==="t"||z==="b"){let q=H[0],N=H[H.length-1],V=z==="t"?q:N;return rz(V.left,q.top,V.right,N.bottom)}let G=z==="l",U=H[0].left,K=H[0].right,Y=G?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY,F=H[0],W=H[0];for(let q of H){U=Math.min(U,q.left),K=Math.max(K,q.right);let N=G?q.left:q.right;if(G&&N<Y||!G&&N>Y)Y=N,F=q,W=q;else if(N===Y)W=q}return rz(U,F.top,K,W.bottom)}function K00($){if("contextElement"in $&&$.contextElement)return $.contextElement;return s0($)?$:void 0}function qC($,Z){function J(Q){FA($,Q.currentTarget,Q.clientX,Q.clientY)}function H(Q){if(!Z)J(Q)}return{onFocus(){$.current=void 0},onMouseEnter:H,onMouseMove:H}}function FA($,Z,J,H){let Q=G00(Z,J,H);return $.current=Q,Q}function NC($){return{name:"inline",async fn(Z){let J=Z.elements.reference;if(typeof J?.getClientRects!=="function")return{};let H=K00(J),Q=$.current,B=Q?.element===J||Q?.element===H?Q:void 0,X=U00(J,Z.placement,B);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 d8{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(y0(99,this.componentName,$,this.componentName))}Z.setOpen(!0,R0(K0.imperativeAction,void 0,J))}closePopup(){let $=this.attachedStore;if($===null)return;$.setOpen(!1,R0(K0.imperativeAction))}}var qA=P(m(),1),DC=P(e4(),1);var AC=P(m(),1);var Y00={open:($)=>$.open,transitionStatus:($)=>$.transitionStatus,domReferenceElement:($)=>$.domReferenceElement,referenceElement:($)=>$.positionReference??$.referenceElement,floatingElement:($)=>$.floatingElement,floatingId:($)=>$.floatingId};class n7 extends k2{constructor($){let{syncOnly:Z,nested:J,onOpenChange:H,triggerElements:Q,...B}=$;super({...B,positionReference:B.referenceElement,domReferenceElement:B.referenceElement},{onOpenChange:H,dataRef:{current:{}},events:iz(),nested:J,triggerElements:Q},Y00);this.syncOnly=Z}syncOpenEvent=($,Z)=>{if(!$||!this.state.open||Z!=null&&cO(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 QQ($){let{popupStore:Z,treatPopupAsFloatingElement:J=!1,floatingRootContext:H,floatingId:Q,nested:B,onOpenChange:X}=$,z=Z.useState("open"),G=Z.useState("activeTriggerElement"),U=Z.useState(J?"popupElement":"positionerElement"),K=Z.context.triggerElements,Y=X,F=AC.useRef(null);if(H===void 0&&F.current===null)F.current=new n7({open:z,transitionStatus:void 0,referenceElement:G,floatingElement:U,triggerElements:K,onOpenChange:Y,floatingId:Q,syncOnly:!0,nested:B});let W=H??F.current;return Z.useSyncedValue("floatingId",Q),J0(()=>{let q={open:z,floatingId:Q,referenceElement:G,floatingElement:U};if(s0(G))q.domReferenceElement=G;if(W.state.positionReference===W.state.referenceElement)q.positionReference=G;W.update(q)},[z,Q,G,U,W]),W.context.onOpenChange=Y,W.context.nested=B,W}var WA=P(m(),1);function j2($,Z=!1,J=!1,H=!1){let[Q,B]=WA.useState($&&Z?"idle":void 0),[X,z]=WA.useState($&&!H);if($&&!X)z(!0),B("starting");if(!$&&X&&Q!=="ending"&&!J)B("ending");if(!$&&!X&&Q==="ending")B(void 0);return J0(()=>{if(!$&&X&&Q!=="ending"&&J){let G=b2.request(()=>{B("ending")});return()=>{b2.cancel(G)}}return},[$,X,Q,J]),J0(()=>{if(!$||Z)return;let G=b2.request(()=>{B(void 0)});return()=>{b2.cancel(G)}},[Z,$]),J0(()=>{if(!$||!Z)return;if($&&X&&Q!=="idle")B("starting");let G=b2.request(()=>{B("idle")});return()=>{b2.cancel(G)}},[Z,$,X,Q]),{mounted:X,setMounted:z,transitionStatus:Q}}var _9={tabIndex:-1,[cH]:""};function az($){return(Z)=>Z==="touch"?$.current:!0}function Q6($,Z=!1){let J=A4(),H=D4()!=null,Q=l1(()=>$(J,H)).current;return QQ({popupStore:Q,treatPopupAsFloatingElement:Z,floatingRootContext:Q.state.floatingRootContext,floatingId:J,nested:H,onOpenChange:Q.setOpen}),Q}function j9({handle:$,store:Z}){return J0(()=>{return $.attachStore(Z)},[$,Z]),null}function VC($){let Z=$.context.triggerElements.size;if($.select("open")&&$.state.triggerCount!==Z)$.set("triggerCount",Z)}function NA($,Z){let J=qA.useRef(null);return U0((H)=>{let Q=J.current;if(Q!==null){if(Q.element===H&&Q.store===Z&&Q.id===$)return;J.current=null;let B=Q.store;if(B.context.triggerElements.getById(Q.id)===Q.element)B.context.triggerElements.delete(Q.id),VC(B)}if(H!==null&&$!==void 0)J.current={store:Z,id:$,element:H},Z.context.triggerElements.add($,H),VC(Z)})}function s7($,Z,J,H=!1){let Q=$.preventUnmountingOnClose;if(Z)Q=!1;else if(H)Q=!0;let B=J?.id??null,X=$.activeTriggerId,z=$.activeTriggerElement;if(B||Z)X=B,z=J??null;return{open:Z,preventUnmountingOnClose:Q,activeTriggerId:X,activeTriggerElement:z}}function BQ($){let Z=!1;return $.preventUnmountOnClose=()=>{Z=!0},()=>Z}function oz($,Z,J,H={}){let Q=J.reason,B=Q===K0.triggerHover,X=Z&&Q===K0.triggerFocus,z=!Z&&(Q===K0.triggerPress||Q===K0.escapeKey),G=BQ(J);if($.context.onOpenChange?.(Z,J),J.isCanceled)return;H.onBeforeDispatch?.(),$.state.floatingRootContext.dispatchOpenChange(Z,J);let U=()=>{let K=s7($.state,Z,J.trigger,G()),Y={...H.extraState,...K};if(X)Y.instantType="focus";else if(z)Y.instantType="dismiss";else if(B)Y.instantType=void 0;$.update(Y)};if(B)DC.flushSync(U);else U()}function O9($,Z,J,H){let Q=J.useState("isMountedByTrigger",$),B=NA($,J),X=U0((G)=>{let U=J.select("open"),K=J.select("activeTriggerId");if(K===$){let Y={activeTriggerElement:G,...U?H:null};J.update(Y);return}if(K==null&&U){let Y={activeTriggerId:$??null,activeTriggerElement:G,...H};J.update(Y)}}),z=U0((G)=>{if(B(G),G)X(G)});return J0(()=>{return z(Z.current),()=>z(null)},[z,Z,J,$]),J0(()=>{if(Q){let G={activeTriggerElement:Z.current,...H};J.update(G)}},[Q,J,Z,...Object.values(H)]),{registerTrigger:z,isMountedByThisTrigger:Q}}function T9($,Z={}){let{closeOnActiveTriggerUnmount:J=!1}=Z,H=qA.useRef(null),Q=$.useState("open"),B=$.useState("triggerCount"),X=$.useState("activeTriggerId"),z=$.useState("activeTriggerElement");J0(()=>{if(!Q){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 K=$.select("activeTriggerId"),Y=null;if(K){let F=$.context.triggerElements.getById(K);if(!F){for(let[W,q]of $.context.triggerElements.entries())if(q===$.state.activeTriggerElement){U.activeTriggerId=W,U.activeTriggerElement=q,H.current=W;break}if(U.activeTriggerId===void 0)if(H.current===K)Y=K;else H.current=null}else if(H.current=K,F!==$.state.activeTriggerElement)U.activeTriggerElement=F}else H.current=null;if(!Y&&!K&&G===1){let F=$.context.triggerElements.entries().next();if(!F.done){let[W,q]=F.value;U.activeTriggerId=W,U.activeTriggerElement=q,H.current=W}}if(U.triggerCount!==void 0||U.activeTriggerId!==void 0||U.activeTriggerElement!==void 0)$.update(U);if(Y){if(J)queueMicrotask(()=>{if($.select("open")&&$.select("activeTriggerId")===Y&&!$.context.triggerElements.getById(Y)){let F=R0(K0.none);if($.setOpen(!1,F),!F.isCanceled)$.update({activeTriggerId:null,activeTriggerElement:null})}})}},[Q,$,B,X,z,J])}function C9($,Z,J,H){let{mounted:Q,setMounted:B,transitionStatus:X}=j2($,!1,!1,H),z=Z.useState("preventUnmountingOnClose"),G=$?!1:z;Z.useSyncedValues({mounted:Q,transitionStatus:X,preventUnmountingOnClose:G});let U=U0(()=>{B(!1),Z.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1,preventUnmountingOnClose:!1}),J?.(),Z.context.onOpenChangeComplete?.(!1)});return W5({enabled:Q&&!$&&!G,open:$,ref:Z.context.popupRef,onComplete(){if(!$)U()}}),{forceUnmount:U,transitionStatus:X}}function w9($,Z){$.useSyncedValues(Z),J0(()=>()=>{$.update({activeTriggerProps:L1,inactiveTriggerProps:L1,popupProps:L1})},[$])}function nz($,Z){J0(()=>{if(!Z&&$.state.openMethod!==null)$.set("openMethod",null)},[Z,$]),J0(()=>()=>{if($.state.openMethod!==null)$.set("openMethod",null)},[$])}class O2{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 n7({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:L1,inactiveTriggerProps:L1,popupProps:L1}}var XQ=($)=>$.triggerIdProp??$.activeTriggerId,AA=($)=>$.openProp??$.open,LC=($)=>{return($.popupElement?.id??$.floatingId)||void 0};function MC($,Z){return Z!==void 0&&AA($)&&XQ($)===Z}function F00($,Z){if(MC($,Z))return!0;return Z!==void 0&&AA($)&&XQ($)==null&&$.triggerCount===1}var S9={open:AA,mounted:($)=>$.mounted,transitionStatus:($)=>$.transitionStatus,floatingRootContext:($)=>$.floatingRootContext,triggerCount:($)=>$.triggerCount,preventUnmountingOnClose:($)=>$.preventUnmountingOnClose,payload:($)=>$.payload,activeTriggerId:XQ,activeTriggerElement:($)=>$.mounted?$.activeTriggerElement:null,popupId:LC,isTriggerActive:($,Z)=>Z!==void 0&&XQ($)===Z,isOpenedByTrigger:($,Z)=>MC($,Z),isMountedByTrigger:($,Z)=>Z!==void 0&&XQ($)===Z&&$.mounted,triggerProps:($,Z)=>Z?$.activeTriggerProps:$.inactiveTriggerProps,triggerPopupId:($,Z)=>F00($,Z)?LC($):void 0,popupProps:($)=>$.popupProps,popupElement:($)=>$.popupElement,positionerElement:($)=>$.positionerElement};var VA=P(m(),1),PC=P(VZ(),1);function R9($){let Z=VA.useCallback((H)=>{if($===void 0)return X1;return $.subscribeStore(H)},[$]),J=VA.useCallback(()=>{return $===void 0?void 0:$.store},[$]);return PC.useSyncExternalStore(Z,J,()=>$?.serverStore)}function DA($){let{open:Z=!1,onOpenChange:J,elements:H={}}=$,Q=A4(),B=D4()!=null,X=l1(()=>new n7({open:Z,transitionStatus:void 0,onOpenChange:J,referenceElement:H.reference??null,floatingElement:H.floating??null,triggerElements:new O2,floatingId:Q,syncOnly:!1,nested:B})).current;return J0(()=>{let z={open:Z,floatingId:Q};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,Q,H.reference,H.floating,X]),X.context.onOpenChange=J,X.context.nested=B,X}var I9=P(m(),1);var LA=r1.os.mac&&r1.engine.webkit;function t7($,Z={}){let{enabled:J=!0,delay:H}=Z,Q="rootStore"in $?$.rootStore:$,{events:B,dataRef:X}=Q.context,z=I9.useRef(!1),G=I9.useRef(null),U=I9.useRef(!0),K=d1();I9.useEffect(()=>{let F=Q.select("domReferenceElement");if(!J)return;let W=R1(F);function q(){let A=Q.select("domReferenceElement");if(!Q.select("open")&&P1(A)&&A===p1(m0(A)))z.current=!0,G.current=A}function N(){U.current=!0}function V(){U.current=!1}return M2(n0(W,"blur",q),LA&&n0(W,"keydown",N,!0),LA&&n0(W,"pointerdown",V,!0))},[Q,J]),I9.useEffect(()=>{if(!J)return;function F(W){if(W.reason===K0.triggerPress||W.reason===K0.escapeKey){let q=Q.select("domReferenceElement");if(s0(q))G.current=q,z.current=!0}}return B.on("openchange",F),()=>{B.off("openchange",F)}},[B,J,Q]);let Y=I9.useMemo(()=>{function F(){z.current=!1,G.current=null}return{onMouseLeave(){F()},onFocus(W){let q=W.currentTarget;if(z.current){if(G.current===q)return;F()}let N=M1(W.nativeEvent);if(s0(N)){if(LA&&!W.relatedTarget){if(!U.current&&!m7(N))return}else if(!D9(N))return}let V=s3(W.relatedTarget,Q.context.triggerElements),{nativeEvent:A,currentTarget:D}=W,L=typeof H==="function"?H():H;if(Q.select("open")&&V||L===0||L===void 0){Q.setOpen(!0,R0(K0.triggerFocus,A,D));return}K.start(L,()=>{if(z.current)return;Q.setOpen(!0,R0(K0.triggerFocus,A,D))})},onBlur(W){F();let{relatedTarget:q,nativeEvent:N}=W,V=s0(q)&&q.hasAttribute(A3("focus-guard"))&&q.getAttribute("data-type")==="outside";K.start(0,()=>{let A=Q.select("domReferenceElement"),D=p1(m0(A));if(!q&&D===A)return;if(k0(X.current.floatingContext?.refs.floating.current,D)||k0(A,D)||V)return;if(s3(q??D,Q.context.triggerElements))return;Q.setOpen(!1,R0(K0.triggerFocus,N))})}}},[X,H,Q,K]);return I9.useMemo(()=>J?{reference:Y,trigger:Y}:{},[J,Y])}var PA=P(m(),1);class MA{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 c5,this.restTimeout=new c5,this.handleCloseOptions=void 0}static create(){return new MA}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>{return this.dispose}}var sz=new WeakMap;function CZ($){if(!$.performedPointerEventsMutation)return;let Z=$.pointerEventsScopeElement;if(Z&&sz.get(Z)===$)$.pointerEventsScopeElement?.style.removeProperty("pointer-events"),$.pointerEventsReferenceElement?.style.removeProperty("pointer-events"),$.pointerEventsFloatingElement?.style.removeProperty("pointer-events"),sz.delete(Z);$.performedPointerEventsMutation=!1,$.pointerEventsScopeElement=null,$.pointerEventsReferenceElement=null,$.pointerEventsFloatingElement=null}function tz($,Z){let{scopeElement:J,referenceElement:H,floatingElement:Q}=Z,B=sz.get(J);if(B&&B!==$)CZ(B);CZ($),$.performedPointerEventsMutation=!0,$.pointerEventsScopeElement=J,$.pointerEventsReferenceElement=H,$.pointerEventsFloatingElement=Q,sz.set(J,$),J.style.pointerEvents="none",H.style.pointerEvents="auto",Q.style.pointerEvents="auto"}function wZ($){let Z=$.context.dataRef.current,J=l1(()=>Z.hoverInteractionState??MA.create()).current;if(!Z.hoverInteractionState)Z.hoverInteractionState=J;return a3(Z.hoverInteractionState.disposeEffect),Z.hoverInteractionState}function L3($,Z={}){let{enabled:J=!0,closeDelay:H=0,nodeId:Q}=Z,B="rootStore"in $?$.rootStore:$,X=B.useState("open"),z=B.useState("floatingElement"),G=B.useState("domReferenceElement"),{dataRef:U}=B.context,K=n2(),Y=D4(),F=wZ(B),W=d1(),q=U0(()=>{return dz(U.current.openEvent?.type,F.interactedInside)}),N=U0(()=>{return nT(U.current.openEvent?.type)}),V=U0(()=>{CZ(F)});J0(()=>{if(!X)F.pointerType=void 0,F.restTimeoutPending=!1,F.interactedInside=!1,V()},[X,F,V]),PA.useEffect(()=>{return V},[V]),J0(()=>{if(!J)return;if(X&&F.handleCloseOptions?.blockPointerEvents&&N()&&s0(G)&&z){let A=G,D=z,L=m0(z),j=K?.nodesRef.current.find((C)=>C.id===Y)?.context?.elements.floating;if(j)j.style.pointerEvents="";let M=F.pointerEventsScopeElement!==D?F.pointerEventsScopeElement:null,_=j!==D?j:null,E=F.handleCloseOptions?.getScope?.()??M??_??A.closest("[data-rootownerid]")??L.body;return tz(F,{scopeElement:E,referenceElement:A,floatingElement:D}),()=>{V()}}return},[J,X,G,z,F,N,K,Y,V]),PA.useEffect(()=>{if(!J)return;function A(){return!!(K&&Y&&q8(K.nodesRef.current,Y).length>0)}function D(C){let R=p8(H,"close",F.pointerType),T=()=>{B.setOpen(!1,R0(K0.triggerHover,C)),K?.events.emit("floating.closed",C)};if(R)F.openChangeTimeout.start(R,T);else F.openChangeTimeout.clear(),T()}function L(C){let R=M1(C);if(!cN(R)){F.interactedInside=!1;return}F.interactedInside=R?.closest("[aria-haspopup]")!=null}function j(){F.openChangeTimeout.clear(),W.clear(),K?.events.off("floating.closed",_),V()}function M(C){if(A()&&K){K.events.on("floating.closed",_);return}if(s3(C.relatedTarget,B.context.triggerElements))return;let R=U.current.floatingContext?.nodeId??Q,T=C.relatedTarget;if(K&&R&&s0(T)&&q8(K.nodesRef.current,R,!1).some((y)=>k0(y.context?.elements.floating,T)))return;if(F.handler){F.handler(C);return}if(V(),N()&&!q())D(C)}function _(C){if(!K||!Y||A())return;W.start(0,()=>{K.events.off("floating.closed",_),B.setOpen(!1,R0(K0.triggerHover,C)),K.events.emit("floating.closed",C)})}let E=z;return M2(E&&n0(E,"mouseenter",j),E&&n0(E,"mouseleave",M),E&&n0(E,"pointerdown",L,!0),()=>{K?.events.off("floating.closed",_)})},[J,z,B,U,H,Q,N,q,V,F,K,Y,W])}var B6=P(m(),1),_C=P(e4(),1);var W00={current:null};function l8($,Z={}){let{enabled:J=!0,delay:H=0,handleClose:Q=null,mouseOnly:B=!1,restMs:X=0,move:z=!0,triggerElementRef:G=W00,externalTree:U,isActiveTrigger:K=!0,getHandleCloseContext:Y,isClosing:F,shouldOpen:W,guardStaleOpen:q=!1}=Z,N="rootStore"in $?$.rootStore:$,{dataRef:V,events:A}=N.context,D=n2(U),L=wZ(N),j=B6.useRef(!1),M=U5(Q),_=U5(H),E=U5(X),C=U5(J),R=U5(W),T=U5(F),I=U0(()=>{return dz(V.current.openEvent?.type,L.interactedInside)}),y=U0(()=>{return R.current?.()!==!1}),S=U0((k,h,v)=>{let f=N.context.triggerElements;if(f.hasElement(h))return!k||!k0(k,h);if(!s0(v))return!1;let w=v;return f.hasMatchingElement((i)=>k0(i,w))&&(!k||!k0(k,w))}),O=U0(()=>{if(!L.handler)return;m0(N.select("domReferenceElement")).removeEventListener("mousemove",L.handler),L.handler=void 0}),b=U0(()=>{CZ(L)});if(K)L.handleCloseOptions=Q?.__options;return B6.useEffect(()=>O,[O]),B6.useEffect(()=>{if(!J)return;function k(h){if(!h.open)j.current=h.reason===K0.triggerHover,O(),L.openChangeTimeout.clear(),L.restTimeout.clear(),L.blockMouseMove=!0,L.restTimeoutPending=!1;else j.current=!1}return A.on("openchange",k),()=>{A.off("openchange",k)}},[J,A,L,O]),B6.useEffect(()=>{if(!J)return;function k(r,x=!0){let l=p8(_.current,"close",L.pointerType);if(l)L.openChangeTimeout.start(l,()=>{N.setOpen(!1,R0(K0.triggerHover,r)),D?.events.emit("floating.closed",r)});else if(x)L.openChangeTimeout.clear(),N.setOpen(!1,R0(K0.triggerHover,r)),D?.events.emit("floating.closed",r)}let h=G.current??(K?N.select("domReferenceElement"):null);if(!s0(h))return;function v(r){if(L.openChangeTimeout.clear(),L.blockMouseMove=!1,B&&!t4(L.pointerType))return;let x=JA(E.current),l=p8(_.current,"open",L.pointerType),s=M1(r),p=r.currentTarget??null,d=N.select("domReferenceElement"),o=p;if(s0(s)&&!N.context.triggerElements.hasElement(s)){for(let n of N.context.triggerElements.elements())if(k0(n,s)){o=n;break}}if(s0(p)&&s0(d)&&!N.context.triggerElements.hasElement(p)&&k0(p,d))o=d;let Z0=o==null?!1:S(d,o,s),H0=N.select("open"),G0=T.current?.()??N.select("transitionStatus")==="ending",X0=!H0&&G0&&j.current,Y0=!Z0&&s0(o)&&s0(d)&&k0(d,o)&&X0,V0=x>0&&!l,N0=Z0&&(H0||X0)||Y0,F0=!H0||Z0;if(N0){if(y())N.setOpen(!0,R0(K0.triggerHover,r,o));return}if(V0)return;if(l)L.openChangeTimeout.start(l,()=>{if(F0&&y())N.setOpen(!0,R0(K0.triggerHover,r,o))});else if(F0){if(y())N.setOpen(!0,R0(K0.triggerHover,r,o))}}function f(r){if(I()){b();return}O();let x=N.select("domReferenceElement"),l=m0(x);L.restTimeout.clear(),L.restTimeoutPending=!1;let s=V.current.floatingContext??Y?.();if(s3(r.relatedTarget,N.context.triggerElements))return;if(M.current&&s){if(!N.select("open"))L.openChangeTimeout.clear();let d=G.current;L.handler=M.current({...s,tree:D,x:r.clientX,y:r.clientY,onClose(){if(b(),O(),C.current&&!I()&&d===N.select("domReferenceElement"))k(r,!0)}}),l.addEventListener("mousemove",L.handler),L.handler(r);return}if(L.pointerType==="touch"?!k0(N.select("floatingElement"),r.relatedTarget):!0)k(r)}function w(r){if(k0(h,r.relatedTarget))return;L.openChangeTimeout.clear(),L.restTimeout.clear(),L.restTimeoutPending=!1}let i=q?n0(h,"mouseout",w):void 0;if(z)return M2(n0(h,"mousemove",v,{once:!0}),n0(h,"mouseenter",v),n0(h,"mouseleave",f),i);return M2(n0(h,"mouseenter",v),n0(h,"mouseleave",f),i)},[O,b,V,_,N,J,M,L,K,S,I,B,z,E,G,D,C,Y,T,y,q]),B6.useMemo(()=>{if(!J)return;function k(h){L.pointerType=h.pointerType}return{onPointerDown:k,onPointerEnter:k,onMouseMove(h){let{nativeEvent:v}=h,f=h.currentTarget,w=N.select("domReferenceElement"),i=N.select("open"),r=S(w,f,h.target);if(B&&!t4(L.pointerType))return;if(i&&r&&L.handleCloseOptions?.blockPointerEvents){let s=N.select("floatingElement");if(s){let p=L.handleCloseOptions?.getScope?.()??f.ownerDocument.body;tz(L,{scopeElement:p,referenceElement:f,floatingElement:s})}}let x=JA(E.current);if(i&&!r||x===0)return;if(!r&&L.restTimeoutPending&&h.movementX**2+h.movementY**2<2)return;L.restTimeout.clear();function l(){if(L.restTimeoutPending=!1,I())return;let s=N.select("open");if(!L.blockMouseMove&&(!s||r)&&y())N.setOpen(!0,R0(K0.triggerHover,v,f))}if(L.pointerType==="touch")_C.flushSync(()=>{l()});else if(r&&i)l();else L.restTimeoutPending=!0,L.restTimeout.start(x,l)}}},[J,L,I,S,B,N,E,y])}var h2=P(m(),1);var q00="Escape";function jC($){return r1.engine.webkit&&$.movementX===0&&$.movementY===0}function $G($,Z,J){switch($){case"vertical":return Z;case"horizontal":return J;default:return Z||J}}function ez($,Z){return $G(Z,$===gN||$===Nz,$===dH||$===lH)}function _A($,Z,J){return $G(Z,$===Nz,J?$===dH:$===lH)||$==="Enter"||$===" "||$===""}function N00($,Z,J){return $G(Z,J?$===dH:$===lH,$===Nz)}function A00($,Z,J,H){let Q=J?$===lH:$===dH,B=$===gN;if(Z==="both"||Z==="horizontal"&&H)return $===q00;return $G(Z,Q,B)}function jA($,Z){let{listRef:J,activeIndex:H,onNavigate:Q=()=>{},enabled:B=!0,selectedIndex:X=null,allowEscape:z=!1,loopFocus:G=!1,nested:U=!1,rtl:K=!1,virtual:Y=!1,focusItemOnOpen:F="auto",focusItemOnHover:W=!0,openOnArrowKeyDown:q=!0,disabledIndices:N=void 0,orientation:V="vertical",parentOrientation:A,id:D,resetOnPointerLeave:L=!0,externalTree:j,grid:M}=Z,_=M!=null,E="rootStore"in $?$.rootStore:$,C=E.useState("open"),R=E.useState("floatingElement"),T=E.useState("domReferenceElement"),I=E.context.dataRef,y=nH(R),S=oH(T),O=U5(y),b=D4(),k=n2(j),h=h2.useRef(F),v=h2.useRef(X??-1),f=h2.useRef(null),w=h2.useRef(!0),i=U0((A0)=>{Q(v.current===-1?null:v.current,A0)}),r=h2.useRef(!!R),x=h2.useRef(C),l=h2.useRef(!1),s=h2.useRef(!1),p=h2.useRef(null),d=U5(N),o=U5(C),Z0=U5(X),H0=U5(L),G0=N4(),X0=N4(),Y0=U0(()=>{function A0(t){if(Y)k?.events.emit("virtualfocus",t);else p.current=TZ(t,{sync:l.current,preventScroll:!0})}let L0=J.current[v.current],g=s.current;if(L0)A0(L0);(l.current?(t)=>t():(t)=>G0.request(t))(()=>{let t=J.current[v.current]||L0;if(!t)return;if(!L0)A0(t);if(e&&(g||!w.current))t.scrollIntoView?.({block:"nearest",inline:"nearest"})})});J0(()=>{I.current.orientation=V},[I,V]),J0(()=>{if(!B)return;if(C&&R){if(v.current=X??-1,h.current&&X!=null)s.current=!0,i()}else if(r.current)v.current=-1,i()},[B,C,R,X,i]),J0(()=>{if(!B)return;if(!C){l.current=!1;return}if(!R)return;if(H==null){if(l.current=!1,Z0.current!=null)return;if(r.current)v.current=-1,Y0();if((!x.current||!r.current)&&h.current&&(f.current!=null||h.current===!0&&f.current==null)){let A0=0,L0=()=>{if(J.current[0]==null){if(A0<2)(A0?(u)=>X0.request(u):queueMicrotask)(L0);A0+=1}else v.current=f.current==null||_A(f.current,V,K)||U?p7(J):MZ(J),f.current=null,i()};L0()}}else if(!$6(J.current,H))v.current=H,Y0(),s.current=!1},[B,C,R,H,Z0,U,J,V,K,i,Y0,X0]),J0(()=>{if(!B||R||!k||Y||!r.current)return;let A0=k.nodesRef.current,L0=A0.find((t)=>t.id===b)?.context?.elements.floating,g=p1(m0(T??L0??null)),u=A0.some((t)=>t.context&&k0(t.context.elements.floating,g));if(L0&&!u&&w.current)L0.focus({preventScroll:!0})},[B,R,T,k,b,Y]),J0(()=>{x.current=C,r.current=!!R}),J0(()=>{if(!C)f.current=null,h.current=F},[C,F]);let V0=H!=null,N0=U0((A0)=>{if(!o.current)return;let L0=J.current.indexOf(A0.currentTarget);if(L0!==-1&&(v.current!==L0||H!==L0))v.current=L0,i(A0)}),F0=U0(()=>{return A??k?.nodesRef.current.find((A0)=>A0.id===b)?.context?.dataRef?.current.orientation}),n=U0(()=>{return p7(J,d.current)}),a=U0((A0)=>{if(w.current=!1,l.current=!0,A0.which===229)return;if(!o.current&&A0.currentTarget===O.current)return;if(U&&A00(A0.key,V,K,_)){if(!ez(A0.key,F0()))b4(A0);if(E.setOpen(!1,R0(K0.listNavigation,A0.nativeEvent)),P1(T))if(Y)k?.events.emit("virtualfocus",T);else T.focus();return}let L0=v.current,g=p7(J,N),u=MZ(J,N);if(!S){if(A0.key==="Home")b4(A0),v.current=g,i(A0);if(A0.key==="End")b4(A0),v.current=u,i(A0)}if(M!=null){let t=M(A0,v.current,J,V,G,K,N,g,u);if(t!=null)v.current=t,i(A0);if(V==="both")return}if(ez(A0.key,V)){if(b4(A0),C&&!Y&&p1(A0.currentTarget.ownerDocument)===A0.currentTarget){v.current=_A(A0.key,V,K)?g:u,i(A0);return}if(_A(A0.key,V,K))if(G)if(L0>=u)if(z&&L0!==J.current.length)v.current=-1;else l.current=!1,v.current=g;else v.current=A8(J.current,{startingIndex:L0,disabledIndices:N});else v.current=Math.min(u,A8(J.current,{startingIndex:L0,disabledIndices:N}));else if(G)if(L0<=g)if(z&&L0!==-1)v.current=J.current.length;else l.current=!1,v.current=u;else v.current=A8(J.current,{startingIndex:L0,decrement:!0,disabledIndices:N});else v.current=Math.max(g,A8(J.current,{startingIndex:L0,decrement:!0,disabledIndices:N}));if($6(J.current,v.current))v.current=-1;i(A0)}}),e=h2.useMemo(()=>{return{onFocus(L0){l.current=!0,N0(L0)},onClick:({currentTarget:L0})=>L0.focus({preventScroll:!0}),onMouseMove(L0){if(jC(L0))return;if(l.current=!0,s.current=!1,W)N0(L0)},onPointerLeave(L0){if(!o.current||!w.current||L0.pointerType==="touch")return;l.current=!0;let g=L0.relatedTarget;if(!W||J.current.includes(g))return;if(!H0.current)return;if(p.current?.(),p.current=null,v.current=-1,i(L0),!Y){let u=O.current,t=p1(m0(u));if(u&&k0(u,t))u.focus({preventScroll:!0})}}}},[N0,o,O,W,J,i,H0,Y]),$0=h2.useMemo(()=>{return Y&&C&&V0&&{"aria-activedescendant":`${D}-${H}`}},[Y,C,V0,D,H]),Q0=h2.useMemo(()=>{return{...!S?$0:{},onKeyDown(A0){if(A0.key==="Tab"&&A0.shiftKey&&C&&!Y){let L0=M1(A0.nativeEvent);if(L0&&!k0(O.current,L0))return;if(b4(A0),E.setOpen(!1,R0(K0.focusOut,A0.nativeEvent)),P1(T))T.focus();return}a(A0)},onPointerMove(A0){if(jC(A0))return;w.current=!0}}},[$0,a,O,S,E,C,Y,T]),_0=h2.useMemo(()=>{function A0(u){E.setOpen(!0,R0(K0.listNavigation,u.nativeEvent,u.currentTarget))}function L0(u){if(F==="auto"&&DZ(u.nativeEvent))h.current=!Y}function g(u){if(h.current=F,F==="auto"&&LZ(u.nativeEvent))h.current=!0}return{onKeyDown(u){let t=E.select("open");w.current=!1;let W0=u.key.startsWith("Arrow"),I0=N00(u.key,F0(),K),c0=ez(u.key,V),f0=(U?I0:c0)||u.key==="Enter"||u.key.trim()==="";if(Y&&t)return a(u);if(!t&&!q&&W0)return;if(f0){let T0=ez(u.key,F0());f.current=U&&T0?null:u.key}if(U){if(I0)if(b4(u),t)v.current=n(),i(u);else A0(u);return}if(c0){if(Z0.current!=null)v.current=Z0.current;if(b4(u),!t&&q)A0(u);else a(u);if(t)i(u)}return},onFocus(u){if(E.select("open")&&!Y)v.current=-1,i(u)},onPointerDown:g,onPointerEnter:g,onMouseDown:L0,onClick:L0}},[a,F,n,U,i,E,q,V,F0,K,Z0,Y]),M0=h2.useMemo(()=>{return{...$0,..._0}},[$0,_0]);return h2.useMemo(()=>B?{reference:M0,floating:Q0,item:e,trigger:_0}:{},[B,M0,Q0,_0,e])}var e7=P(m(),1);function OA($,Z){let{listRef:J,elementsRef:H,activeIndex:Q,onMatch:B,disabledIndices:X,onTyping:z,enabled:G=!0,resetMs:U=750,selectedIndex:K=null}=Z,Y="rootStore"in $?$.rootStore:$,F=Y.useState("open"),W=d1(),q=e7.useRef(""),N=e7.useRef(K??Q??-1),V=e7.useRef(null),A=U0((j)=>{function M(O){return H?.current[O]}function _(O){let b=M(O);if(b&&!c7(b)||b?.matches(":disabled"))return!1;return X==null||!W3(r2,O,X)}function E(O,b,k=0){if(O.length===0)return-1;let h=(k%O.length+O.length)%O.length,v=b.toLowerCase();for(let f=0;f<O.length;f+=1){let w=(h+f)%O.length;if(!O[w]?.toLowerCase().startsWith(v)||!_(w))continue;return w}return-1}let C=J.current;if(q.current.length>0&&j.key===" ")b4(j),z?.(!0);if(q.current.length>0&&q.current[0]!==" "){if(E(C,q.current)===-1&&j.key!==" ")z?.(!1)}if(C==null||j.key.length!==1||j.ctrlKey||j.metaKey||j.altKey)return;if(F&&j.key!==" ")b4(j),z?.(!0);let R=q.current==="";if(R)N.current=K??Q??-1;if(C.every((O,b)=>O&&_(b)?O[0]?.toLowerCase()!==O[1]?.toLowerCase():!0)&&q.current===j.key)q.current="",N.current=V.current;q.current+=j.key,W.start(U,()=>{q.current="",N.current=V.current,z?.(!1)});let y=((R?K??Q??-1:N.current)??0)+1,S=E(C,q.current,y);if(S!==-1)B?.(S),V.current=S;else if(j.key!==" ")q.current="",z?.(!1)}),D=U0((j)=>{let M=j.relatedTarget,_=Y.select("domReferenceElement"),E=Y.select("floatingElement");if(k0(_,M)||k0(E,M))return;W.clear(),q.current="",N.current=V.current,z?.(!1)});J0(()=>{if(!F&&K!==null)return;if(W.clear(),V.current=null,q.current!=="")q.current=""},[F,K,W]);let L=e7.useMemo(()=>({onKeyDown:A,onBlur:D}),[A,D]);return e7.useMemo(()=>G?{reference:L,floating:L}:{},[G,L])}var OC=0.1,V00=OC*OC,N5=0.5;function ZG($,Z,J,H,Q,B){return H>=Z!==B>=Z&&$<=(Q-J)*(Z-H)/(B-H)+J}function JG($,Z,J,H,Q,B,X,z,G,U){let K=!1;if(ZG($,Z,J,H,Q,B))K=!K;if(ZG($,Z,Q,B,X,z))K=!K;if(ZG($,Z,X,z,G,U))K=!K;if(ZG($,Z,G,U,J,H))K=!K;return K}function D00($,Z,J){return $>=J.x&&$<=J.x+J.width&&Z>=J.y&&Z<=J.y+J.height}function HG($,Z,J,H,Q,B){let X=Math.min(J,Q),z=Math.max(J,Q),G=Math.min(H,B),U=Math.max(H,B);return $>=X&&$<=z&&Z>=G&&Z<=U}function i8($={}){let{blockPointerEvents:Z=!1}=$,J=new c5,H=({x:Q,y:B,placement:X,elements:z,onClose:G,nodeId:U,tree:K})=>{let Y=X?.split("-")[0],F=!1,W=null,q=null,N=typeof performance<"u"?performance.now():0;function V(D,L){let j=performance.now(),M=j-N;if(W===null||q===null||M===0)return W=D,q=L,N=j,!1;let _=D-W,E=L-q,C=_*_+E*E,R=M*M*V00;return W=D,q=L,N=j,C<R}function A(){J.clear(),G()}return function(L){J.clear();let{domReference:j,floating:M}=z;if(!j||!M||Y==null||Q==null||B==null)return;let{clientX:_,clientY:E}=L,C=M1(L),R=L.type==="mouseleave",T=k0(M,C),I=k0(j,C);if(T){if(F=!0,!R)return}if(I){if(F=!1,!R){F=!0;return}}if(R&&s0(L.relatedTarget)&&k0(M,L.relatedTarget))return;function y(){return Boolean(K&&q8(K.nodesRef.current,U).length>0)}function S(){if(!y())A()}if(y())return;let O=j.getBoundingClientRect(),b=M.getBoundingClientRect(),k=Q>b.right-b.width/2,h=B>b.bottom-b.height/2,v=b.width>O.width,f=b.height>O.height,w=(v?O:b).left,i=(v?O:b).right,r=(f?O:b).top,x=(f?O:b).bottom;if(Y==="top"&&B>=O.bottom-1||Y==="bottom"&&B<=O.top+1||Y==="left"&&Q>=O.right-1||Y==="right"&&Q<=O.left+1){S();return}let l=!1;switch(Y){case"top":l=HG(_,E,w,O.top+1,i,b.bottom-1);break;case"bottom":l=HG(_,E,w,b.top+1,i,O.bottom-1);break;case"left":l=HG(_,E,b.right-1,x,O.left+1,r);break;case"right":l=HG(_,E,O.right-1,x,b.left+1,r);break;default:}if(l)return;if(F&&!D00(_,E,O)){S();return}if(!R&&V(_,E)){S();return}let s=!1;switch(Y){case"top":{let p=v?N5/2:N5*4,d=v?Q+p:k?Q+p:Q-p,o=v?Q-p:k?Q+p:Q-p,Z0=B+N5+1,H0=k?b.bottom-N5:v?b.bottom-N5:b.top,G0=k?v?b.bottom-N5:b.top:b.bottom-N5;s=JG(_,E,d,Z0,o,Z0,b.left,H0,b.right,G0);break}case"bottom":{let p=v?N5/2:N5*4,d=v?Q+p:k?Q+p:Q-p,o=v?Q-p:k?Q+p:Q-p,Z0=B-N5,H0=k?b.top+N5:v?b.top+N5:b.bottom,G0=k?v?b.top+N5:b.bottom:b.top+N5;s=JG(_,E,d,Z0,o,Z0,b.left,H0,b.right,G0);break}case"left":{let p=f?N5/2:N5*4,d=f?B+p:h?B+p:B-p,o=f?B-p:h?B+p:B-p,Z0=Q+N5+1,H0=h?b.right-N5:f?b.right-N5:b.left,G0=h?f?b.right-N5:b.left:b.right-N5;s=JG(_,E,H0,b.top,G0,b.bottom,Z0,d,Z0,o);break}case"right":{let p=f?N5/2:N5*4,d=f?B+p:h?B+p:B-p,o=f?B-p:h?B+p:B-p,Z0=Q-N5,H0=h?b.left+N5:f?b.left+N5:b.right,G0=h?f?b.left+N5:b.right:b.left+N5;s=JG(_,E,Z0,d,Z0,o,H0,b.top,G0,b.bottom);break}default:}if(!s)S();else if(!F)J.start(40,S);return}};return H.__options={...$,blockPointerEvents:Z},H}function TC($,Z,J){let{reference:H,floating:Q}=$,B=y4(Z),X=$Q(Z),z=eH(X),G=o2(Z),U=B==="y",K=H.x+H.width/2-Q.width/2,Y=H.y+H.height/2-Q.height/2,F=H[z]/2-Q[z]/2,W;switch(G){case"top":W={x:K,y:H.y-Q.height};break;case"bottom":W={x:K,y:H.y+H.height};break;case"right":W={x:H.x+H.width,y:Y};break;case"left":W={x:H.x-Q.width,y:Y};break;default:W={x:H.x,y:H.y}}let q=N8(Z);if(q)W[X]+=F*(q==="end"?1:-1)*(J&&U?-1:1);return W}async function CC($,Z){var J;if(Z===void 0)Z={};let{x:H,y:Q,platform:B,rects:X,elements:z,strategy:G}=$,{boundary:U="clippingAncestors",rootBoundary:K="viewport",elementContext:Y="floating",altBoundary:F=!1,padding:W=0}=M9(Z,$),q=_z(W),V=z[F?Y==="floating"?"reference":"floating":Y],A=u7(await B.getClippingRect({element:((J=await(B.isElement==null?void 0:B.isElement(V)))!=null?J:!0)?V:V.contextElement||await(B.getDocumentElement==null?void 0:B.getDocumentElement(z.floating)),boundary:U,rootBoundary:K,strategy:G})),D=Y==="floating"?{x:H,y:Q,width:X.floating.width,height:X.floating.height}:X.reference,L=await(B.getOffsetParent==null?void 0:B.getOffsetParent(z.floating)),j=await(B.isElement==null?void 0:B.isElement(L))&&await(B.getScale==null?void 0:B.getScale(L))||{x:1,y:1},M=u7(B.convertOffsetParentRelativeRectToViewportRelativeRect?await B.convertOffsetParentRelativeRectToViewportRelativeRect({elements:z,rect:D,offsetParent:L,strategy:G}):D);return{top:(A.top-M.top+q.top)/j.y,bottom:(M.bottom-A.bottom+q.bottom)/j.y,left:(A.left-M.left+q.left)/j.x,right:(M.right-A.right+q.right)/j.x}}var L00=50,wC=async($,Z,J)=>{let{placement:H="bottom",strategy:Q="absolute",middleware:B=[],platform:X}=J,z=X.detectOverflow?X:{...X,detectOverflow:CC},G=await(X.isRTL==null?void 0:X.isRTL(Z)),U=await X.getElementRects({reference:$,floating:Z,strategy:Q}),{x:K,y:Y}=TC(U,H,G),F=H,W=0,q={};for(let N=0;N<B.length;N++){let V=B[N];if(!V)continue;let{name:A,fn:D}=V,{x:L,y:j,data:M,reset:_}=await D({x:K,y:Y,initialPlacement:H,placement:F,strategy:Q,middlewareData:q,rects:U,platform:z,elements:{reference:$,floating:Z}});if(K=L!=null?L:K,Y=j!=null?j:Y,q[A]={...q[A],...M},_&&W<L00){if(W++,typeof _==="object"){if(_.placement)F=_.placement;if(_.rects)U=_.rects===!0?await X.getElementRects({reference:$,floating:Z,strategy:Q}):_.rects;({x:K,y:Y}=TC(U,F,G))}N=-1}}return{x:K,y:Y,placement:F,strategy:Q,middlewareData:q}};var EC=function($){if($===void 0)$={};return{name:"flip",options:$,async fn(Z){var J,H;let{placement:Q,middlewareData:B,rects:X,initialPlacement:z,platform:G,elements:U}=Z,{mainAxis:K=!0,crossAxis:Y=!0,fallbackPlacements:F,fallbackStrategy:W="bestFit",fallbackAxisSideDirection:q="none",flipAlignment:N=!0,...V}=M9($,Z);if((J=B.arrow)!=null&&J.alignmentOffset)return{};let A=o2(Q),D=y4(z),L=o2(z)===z,j=await(G.isRTL==null?void 0:G.isRTL(U.floating)),M=F||(L||!N?[sH(z)]:rO(z)),_=q!=="none";if(!F&&_)M.push(...aO(z,N,q,j));let E=[z,...M],C=await G.detectOverflow(Z,V),R=[],T=((H=B.flip)==null?void 0:H.overflows)||[];if(K)R.push(C[A]);if(Y){let O=iO(Q,X,j);R.push(C[O[0]],C[O[1]])}if(T=[...T,{placement:Q,overflows:R}],!R.every((O)=>O<=0)){var I,y;let O=(((I=B.flip)==null?void 0:I.index)||0)+1,b=E[O];if(b){if(!(Y==="alignment"?D!==y4(b):!1)||T.every((v)=>y4(v.placement)===D?v.overflows[0]>0:!0))return{data:{index:O,overflows:T},reset:{placement:b}}}let k=(y=T.filter((h)=>h.overflows[0]<=0).sort((h,v)=>h.overflows[1]-v.overflows[1])[0])==null?void 0:y.placement;if(!k)switch(W){case"bestFit":{var S;let h=(S=T.filter((v)=>{if(_){let f=y4(v.placement);return f===D||f==="y"}return!0}).map((v)=>[v.placement,v.overflows.filter((f)=>f>0).reduce((f,w)=>f+w,0)]).sort((v,f)=>v[1]-f[1])[0])==null?void 0:S[0];if(h)k=h;break}case"initialPlacement":k=z;break}if(Q!==k)return{reset:{placement:k}}}return{}}}};var SC=new Set(["left","top"]);async function M00($,Z){let{placement:J,platform:H,elements:Q}=$,B=await(H.isRTL==null?void 0:H.isRTL(Q.floating)),X=o2(J),z=N8(J),G=y4(J)==="y",U=SC.has(X)?-1:1,K=B&&G?-1:1,Y=M9(Z,$),{mainAxis:F,crossAxis:W,alignmentAxis:q}=typeof Y==="number"?{mainAxis:Y,crossAxis:0,alignmentAxis:null}:{mainAxis:Y.mainAxis||0,crossAxis:Y.crossAxis||0,alignmentAxis:Y.alignmentAxis};if(z&&typeof q==="number")W=z==="end"?q*-1:q;return G?{x:W*K,y:F*U}:{x:F*U,y:W*K}}var RC=function($){if($===void 0)$=0;return{name:"offset",options:$,async fn(Z){var J,H;let{x:Q,y:B,placement:X,middlewareData:z}=Z,G=await M00(Z,$);if(X===((J=z.offset)==null?void 0:J.placement)&&(H=z.arrow)!=null&&H.alignmentOffset)return{};return{x:Q+G.x,y:B+G.y,data:{...G,placement:X}}}}},IC=function($){if($===void 0)$={};return{name:"shift",options:$,async fn(Z){let{x:J,y:H,placement:Q,platform:B}=Z,{mainAxis:X=!0,crossAxis:z=!1,limiter:G={fn:(D)=>{let{x:L,y:j}=D;return{x:L,y:j}}},...U}=M9($,Z),K={x:J,y:H},Y=await B.detectOverflow(Z,U),F=y4(Q),W=Pz(F),q=K[W],N=K[F],V=(D,L)=>Mz(L+Y[D==="y"?"top":"left"],L,L-Y[D==="y"?"bottom":"right"]);if(X)q=V(W,q);if(z)N=V(F,N);let A=G.fn({...Z,[W]:q,[F]:N});return{...A,data:{x:A.x-J,y:A.y-H,enabled:{[W]:X,[F]:z}}}}}},kC=function($){if($===void 0)$={};return{options:$,fn(Z){var J,H;let{x:Q,y:B,placement:X,rects:z,middlewareData:G}=Z,{offset:U=0,mainAxis:K=!0,crossAxis:Y=!0}=M9($,Z),F={x:Q,y:B},W=y4(X),q=Pz(W),N=F[q],V=F[W],A=M9(U,Z),D=typeof A==="number"?{mainAxis:A,crossAxis:0}:{mainAxis:(J=A.mainAxis)!=null?J:0,crossAxis:(H=A.crossAxis)!=null?H:0};if(K){let M=q==="y"?"height":"width",_=z.reference[q]-z.floating[M]+D.mainAxis,E=z.reference[q]+z.reference[M]-D.mainAxis;if(N<_)N=_;else if(N>E)N=E}if(Y){var L,j;let M=q==="y"?"width":"height",_=SC.has(o2(X)),E=z.reference[W]-z.floating[M]+(_?((L=G.offset)==null?void 0:L[W])||0:0)+(_?0:D.crossAxis),C=z.reference[W]+z.reference[M]+(_?0:((j=G.offset)==null?void 0:j[W])||0)-(_?D.crossAxis:0);if(V<E)V=E;else if(V>C)V=C}return{[q]:N,[W]:V}}}},bC=function($){if($===void 0)$={};return{name:"size",options:$,async fn(Z){let{placement:J,rects:H,platform:Q,elements:B}=Z,{apply:X=()=>{},...z}=M9($,Z),G=await Q.detectOverflow(Z,z),U=o2(J),K=N8(J),Y=y4(J)==="y",{width:F,height:W}=H.floating,q,N;if(U==="top"||U==="bottom")q=U,N=K===(await(Q.isRTL==null?void 0:Q.isRTL(B.floating))?"start":"end")?"left":"right";else N=U,q=K==="end"?"top":"bottom";let V=W-G.top-G.bottom,A=F-G.left-G.right,D=t3(W-G[q],V),L=t3(F-G[N],A),j=Z.middlewareData.shift,M=!j,_=D,E=L;if(j!=null&&j.enabled.x)E=A;if(j!=null&&j.enabled.y)_=V;if(M&&!K)if(Y)E=F-2*g8(G.left,G.right);else _=W-2*g8(G.top,G.bottom);await X({...Z,availableWidth:E,availableHeight:_});let C=await Q.getDimensions(B.floating);if(F!==C.width||W!==C.height)return{reset:{rects:!0}};return{}}}};function gC($){let Z=y2($),J=parseFloat(Z.width)||0,H=parseFloat(Z.height)||0,Q=P1($),B=Q?$.offsetWidth:J,X=Q?$.offsetHeight:H,z=e3(J)!==B||e3(H)!==X;if(z)J=B,H=X;return{width:J,height:H,$:z}}function SA($){return!s0($)?$.contextElement:$}function EZ($){let Z=SA($);if(!P1(Z))return L9(1);let J=Z.getBoundingClientRect(),{width:H,height:Q,$:B}=gC(Z),X=(B?e3(J.width):J.width)/H,z=(B?e3(J.height):J.height)/Q;if(!X||!Number.isFinite(X))X=1;if(!z||!Number.isFinite(z))z=1;return{x:X,y:z}}var P00=L9(0);function fC($){let Z=R1($);if(!EA()||!Z.visualViewport)return P00;return{x:Z.visualViewport.offsetLeft,y:Z.visualViewport.offsetTop}}function _00($,Z,J){if(Z===void 0)Z=!1;return!!J&&Z&&J===R1($)}function $$($,Z,J,H){if(Z===void 0)Z=!1;if(J===void 0)J=!1;let Q=$.getBoundingClientRect(),B=SA($),X=L9(1);if(Z)if(H){if(s0(H))X=EZ(H)}else X=EZ($);let z=_00(B,J,H)?fC(B):L9(0),G=(Q.left+z.x)/X.x,U=(Q.top+z.y)/X.y,K=Q.width/X.x,Y=Q.height/X.y;if(B&&H){let F=R1(B),W=s0(H)?R1(H):H,q=F,N=CA(q);while(N&&W!==q){let V=EZ(N),A=N.getBoundingClientRect(),D=y2(N),L=A.left+(N.clientLeft+parseFloat(D.paddingLeft))*V.x,j=A.top+(N.clientTop+parseFloat(D.paddingTop))*V.y;G*=V.x,U*=V.y,K*=V.x,Y*=V.y,G+=L,U+=j,q=R1(N),N=CA(q)}}return u7({width:K,height:Y,x:G,y:U})}function BG($,Z){let J=GQ($).scrollLeft;if(!Z)return $$(M3($)).left+J;return Z.left+J}function mC($,Z){let J=$.getBoundingClientRect(),H=J.left+Z.scrollLeft-BG($,J),Q=J.top+Z.scrollTop;return{x:H,y:Q}}function j00($){let{elements:Z,rect:J,offsetParent:H,strategy:Q}=$,B=Q==="fixed",X=M3(H),z=Z?QG(Z.floating):!1;if(H===X||z&&B)return J;let G={scrollLeft:0,scrollTop:0},U=L9(1),K=L9(0),Y=P1(H);if(Y||!B){if(P2(H)!=="body"||zQ(X))G=GQ(H);if(Y){let W=$$(H);U=EZ(H),K.x=W.x+H.clientLeft,K.y=W.y+H.clientTop}}let F=X&&!Y&&!B?mC(X,G):L9(0);return{width:J.width*U.x,height:J.height*U.y,x:J.x*U.x-G.scrollLeft*U.x+K.x+F.x,y:J.y*U.y-G.scrollTop*U.y+K.y+F.y}}function O00($){return $.getClientRects?Array.from($.getClientRects()):[]}function T00($){let Z=GQ($),J=$.ownerDocument.body,H=g8($.scrollWidth,$.clientWidth,J.scrollWidth,J.clientWidth),Q=g8($.scrollHeight,$.clientHeight,J.scrollHeight,J.clientHeight),B=-Z.scrollLeft+BG($),X=-Z.scrollTop;if(y2(J).direction==="rtl")B+=g8($.clientWidth,J.clientWidth)-H;return{width:H,height:Q,x:B,y:X}}var C00=25;function w00($,Z,J){if(J===void 0)J="viewport";let H=J==="layoutViewport",Q=R1($),B=M3($),X=Q.visualViewport,z=B.clientWidth,G=B.clientHeight,U=0,K=0;if(X){let F=!EA()||Z==="fixed";if(H){if(!F)U=-X.offsetLeft,K=-X.offsetTop}else if(z=X.width,G=X.height,F)U=X.offsetLeft,K=X.offsetTop}if(BG(B)<=0){let F=B.ownerDocument,W=F.body,q=getComputedStyle(W),N=F.compatMode==="CSS1Compat"?parseFloat(q.marginLeft)+parseFloat(q.marginRight)||0:0,V=Math.abs(B.clientWidth-W.clientWidth-N),A=getComputedStyle(B).scrollbarGutter==="stable both-edges"?V/2:V;if(A<=C00)z-=A}return{width:z,height:G,x:U,y:K}}function E00($,Z){let J=$$($,!0,Z==="fixed"),H=J.top+$.clientTop,Q=J.left+$.clientLeft,B=EZ($),X=$.clientWidth*B.x,z=$.clientHeight*B.y,G=Q*B.x,U=H*B.y;return{width:X,height:z,x:G,y:U}}function yC($,Z,J){let H;if(Z==="viewport"||Z==="layoutViewport")H=w00($,J,Z);else if(Z==="document")H=T00(M3($));else if(s0(Z))H=E00(Z,J);else{let Q=fC($);H={x:Z.x-Q.x,y:Z.y-Q.y,width:Z.width,height:Z.height}}return u7(H)}function S00($,Z){let J=Z.get($);if(J)return J;let H=SZ($,[],!1).filter((z)=>s0(z)&&P2(z)!=="body"),Q=null,B=y2($).position==="fixed",X=B?M8($):$;while(s0(X)&&!L8(X)){let z=y2(X),G=wA(X),U=Q?Q.position:B?"fixed":"";if(!G&&(U==="fixed"||U==="absolute"&&z.position==="static"))H=H.filter((Y)=>Y!==X);else Q=z;X=M8(X)}return Z.set($,H),H}function R00($){let{element:Z,boundary:J,rootBoundary:H,strategy:Q}=$,X=[...J==="clippingAncestors"?QG(Z)?[]:S00(Z,this._c):[].concat(J),H],z=yC(Z,X[0],Q),G=z.top,U=z.right,K=z.bottom,Y=z.left;for(let F=1;F<X.length;F++){let W=yC(Z,X[F],Q);G=g8(W.top,G),U=t3(W.right,U),K=t3(W.bottom,K),Y=g8(W.left,Y)}return{width:U-Y,height:K-G,x:Y,y:G}}function I00($){let{width:Z,height:J}=gC($);return{width:Z,height:J}}function k00($,Z,J){let H=P1(Z),Q=M3(Z),B=J==="fixed",X=$$($,!0,B,Z),z={scrollLeft:0,scrollTop:0},G=L9(0);if(H||!B){if(P2(Z)!=="body"||zQ(Q))z=GQ(Z);if(H){let F=$$(Z,!0,B,Z);G.x=F.x+Z.clientLeft,G.y=F.y+Z.clientTop}}if(!H&&Q)G.x=BG(Q);let U=Q&&!H&&!B?mC(Q,z):L9(0),K=X.left+z.scrollLeft-G.x-U.x,Y=X.top+z.scrollTop-G.y-U.y;return{x:K,y:Y,width:X.width,height:X.height}}function TA($){return y2($).position==="static"}function xC($,Z){if(!P1($)||y2($).position==="fixed")return null;if(Z)return Z($);let J=$.offsetParent;if(M3($)===J)J=J.ownerDocument.body;return J}function uC($,Z){let J=R1($);if(QG($))return J;if(!P1($)){let Q=M8($);while(Q&&!L8(Q)){if(s0(Q)&&!TA(Q))return Q;Q=M8(Q)}return J}let H=xC($,Z);while(H&&hC(H)&&TA(H))H=xC(H,Z);if(H&&L8(H)&&TA(H)&&!wA(H))return J;return H||vC($)||J}var b00=async function($){let Z=this.getOffsetParent||uC,J=this.getDimensions,H=await J($.floating);return{reference:k00($.reference,await Z($.floating),$.strategy),floating:{x:0,y:0,width:H.width,height:H.height}}};function y00($){return y2($).direction==="rtl"}var RA={convertOffsetParentRelativeRectToViewportRelativeRect:j00,getDocumentElement:M3,getClippingRect:R00,getOffsetParent:uC,getElementRects:b00,getClientRects:O00,getDimensions:I00,getScale:EZ,isElement:s0,isRTL:y00};function pC($,Z){return $.x===Z.x&&$.y===Z.y&&$.width===Z.width&&$.height===Z.height}function x00($,Z,J){let H=null,Q,B=M3($);function X(){var K;clearTimeout(Q),(K=H)==null||K.disconnect(),H=null}function z(K,Y){if(K===void 0)K=!1;if(Y===void 0)Y=1;X();let F=$.getBoundingClientRect(),{left:W,top:q,width:N,height:V}=F;if(!K)Z();if(!N||!V)return;let A=tH(q),D=tH(B.clientWidth-(W+N)),L=tH(B.clientHeight-(q+V)),j=tH(W),_={rootMargin:-A+"px "+-D+"px "+-L+"px "+-j+"px",threshold:g8(0,t3(1,Y))||1},E=!0;function C(R){let T=R[0].intersectionRatio;if(!pC(F,$.getBoundingClientRect()))return z();if(T!==Y){if(!E)return z();if(!T)Q=setTimeout(()=>{z(!1,0.0000001)},1000);else z(!1,T)}E=!1}try{H=new IntersectionObserver(C,{..._,root:B.ownerDocument})}catch(R){H=new IntersectionObserver(C,_)}H.observe($)}let G=R1($),U=()=>z(J);return G.addEventListener("resize",U),z(!0),()=>{G.removeEventListener("resize",U),X()}}function UQ($,Z,J,H){if(H===void 0)H={};let{ancestorScroll:Q=!0,ancestorResize:B=!0,elementResize:X=typeof ResizeObserver==="function",layoutShift:z=typeof IntersectionObserver==="function",animationFrame:G=!1}=H,U=SA($),K=Q||B?[...U?SZ(U):[],...Z?SZ(Z):[]]:[];K.forEach((A)=>{Q&&A.addEventListener("scroll",J),B&&A.addEventListener("resize",J)});let Y=U&&z?x00(U,J,B):null,F=-1,W=null;if(X){if(W=new ResizeObserver((A)=>{let[D]=A;if(D&&D.target===U&&W&&Z)W.unobserve(Z),cancelAnimationFrame(F),F=requestAnimationFrame(()=>{var L;(L=W)==null||L.observe(Z)});J()}),U&&!G)W.observe(U);if(Z)W.observe(Z)}let q,N=G?$$($):null;if(G)V();function V(){let A=$$($);if(N&&!pC(N,A))J();N=A,q=requestAnimationFrame(V)}return J(),()=>{var A;if(K.forEach((D)=>{Q&&D.removeEventListener("scroll",J),B&&D.removeEventListener("resize",J)}),Y==null||Y(),(A=W)==null||A.disconnect(),W=null,G)cancelAnimationFrame(q)}}var cC=RC;var dC=IC,lC=EC,iC=bC;var rC=kC,XG=($,Z,J)=>{let H=new Map,Q=J!=null?J:{},B={...RA,...Q.platform,_c:H};return wC($,Z,{...Q,platform:B})};var B2=P(m(),1),oC=P(m(),1),nC=P(e4(),1),v00=typeof document<"u",g00=function(){},zG=v00?oC.useLayoutEffect:g00;function GG($,Z){if($===Z)return!0;if(typeof $!==typeof Z)return!1;if(typeof $==="function"&&$.toString()===Z.toString())return!0;let J,H,Q;if($&&Z&&typeof $==="object"){if(Array.isArray($)){if(J=$.length,J!==Z.length)return!1;for(H=J;H--!==0;)if(!GG($[H],Z[H]))return!1;return!0}if(Q=Object.keys($),J=Q.length,J!==Object.keys(Z).length)return!1;for(H=J;H--!==0;)if(!{}.hasOwnProperty.call(Z,Q[H]))return!1;for(H=J;H--!==0;){let B=Q[H];if(B==="_owner"&&$.$$typeof)continue;if(!GG($[B],Z[B]))return!1}return!0}return $!==$&&Z!==Z}function sC($){if(typeof window>"u")return 1;return($.ownerDocument.defaultView||window).devicePixelRatio||1}function aC($,Z){let J=sC($);return Math.round(Z*J)/J}function IA($){let Z=B2.useRef($);return zG(()=>{Z.current=$}),Z}function tC($){if($===void 0)$={};let{placement:Z="bottom",strategy:J="absolute",middleware:H=[],platform:Q,elements:{reference:B,floating:X}={},transform:z=!0,whileElementsMounted:G,open:U}=$,[K,Y]=B2.useState({x:0,y:0,strategy:J,placement:Z,middlewareData:{},isPositioned:!1}),[F,W]=B2.useState(H);if(!GG(F,H))W(H);let[q,N]=B2.useState(null),[V,A]=B2.useState(null),D=B2.useCallback((v)=>{if(v!==_.current)_.current=v,N(v)},[]),L=B2.useCallback((v)=>{if(v!==E.current)E.current=v,A(v)},[]),j=B||q,M=X||V,_=B2.useRef(null),E=B2.useRef(null),C=B2.useRef(K),R=G!=null,T=IA(G),I=IA(Q),y=IA(U),S=B2.useCallback(()=>{if(!_.current||!E.current)return;let v={placement:Z,strategy:J,middleware:F};if(I.current)v.platform=I.current;XG(_.current,E.current,v).then((f)=>{let w={...f,isPositioned:y.current!==!1};if(O.current&&!GG(C.current,w))C.current=w,nC.flushSync(()=>{Y(w)})})},[F,Z,J,I,y]);zG(()=>{if(U===!1&&C.current.isPositioned)C.current.isPositioned=!1,Y((v)=>({...v,isPositioned:!1}))},[U]);let O=B2.useRef(!1);zG(()=>{return O.current=!0,()=>{O.current=!1}},[]),zG(()=>{if(j)_.current=j;if(M)E.current=M;if(j&&M){if(T.current)return T.current(j,M,S);S()}},[j,M,S,T,R]);let b=B2.useMemo(()=>({reference:_,floating:E,setReference:D,setFloating:L}),[D,L]),k=B2.useMemo(()=>({reference:j,floating:M}),[j,M]),h=B2.useMemo(()=>{let v={position:J,left:0,top:0};if(!k.floating)return v;let f=aC(k.floating,K.x),w=aC(k.floating,K.y);if(z)return{...v,transform:"translate("+f+"px, "+w+"px)",...sC(k.floating)>=1.5&&{willChange:"transform"}};return{position:J,left:f,top:w}},[J,z,k.floating,K.x,K.y]);return B2.useMemo(()=>({...K,update:S,refs:b,elements:k,floatingStyles:h}),[K,S,b,k,h])}var kA=($,Z)=>{let J=cC($);return{name:J.name,fn:J.fn,options:[$,Z]}},bA=($,Z)=>{let J=dC($);return{name:J.name,fn:J.fn,options:[$,Z]}},yA=($,Z)=>{return{fn:rC($).fn,options:[$,Z]}},xA=($,Z)=>{let J=lC($);return{name:J.name,fn:J.fn,options:[$,Z]}},hA=($,Z)=>{let J=iC($);return{name:J.name,fn:J.fn,options:[$,Z]}};var t2=P(m(),1);function eC($){return f00($,$.rootContext)}function f00($,Z){let{nodeId:J,externalTree:H}=$,Q=Z.useState("referenceElement"),B=Z.useState("floatingElement"),X=Z.useState("domReferenceElement"),z=Z.useState("open"),G=Z.useState("floatingId"),[U,K]=t2.useState(null),[Y,F]=t2.useState(void 0),[W,q]=t2.useState(void 0),N=t2.useRef(null),V=n2(H),A=t2.useMemo(()=>({reference:Q,floating:B,domReference:X}),[Q,B,X]),D=tC({...$,elements:{...A,...U&&{reference:U}}}),L=s0(Y)?Y:null,j=W===void 0?Z.state.floatingElement:W;Z.useSyncedValue("referenceElement",Y??null),Z.useSyncedValue("domReferenceElement",Y===void 0?X:L),Z.useSyncedValue("floatingElement",j);let M=t2.useCallback((I)=>{let y=s0(I)?{getBoundingClientRect:()=>I.getBoundingClientRect(),getClientRects:()=>I.getClientRects(),contextElement:I}:I;K(y),D.refs.setReference(y)},[D.refs]),_=t2.useCallback((I)=>{if(s0(I)||I===null)N.current=I,F(I);if(s0(D.refs.reference.current)||D.refs.reference.current===null||I!==null&&!s0(I))D.refs.setReference(I)},[D.refs,F]),E=t2.useCallback((I)=>{q(I),D.refs.setFloating(I)},[D.refs]),C=t2.useMemo(()=>({...D.refs,setReference:_,setFloating:E,setPositionReference:M,domReference:N}),[D.refs,_,E,M]),R=t2.useMemo(()=>({...D.elements,domReference:X}),[D.elements,X]),T=t2.useMemo(()=>({...D,dataRef:Z.context.dataRef,open:z,onOpenChange:Z.setOpen,events:Z.context.events,floatingId:G,refs:C,elements:R,nodeId:J,rootStore:Z}),[D,C,R,J,Z,z,G]);return J0(()=>{if(X)N.current=X},[X]),J0(()=>{Z.context.dataRef.current.floatingContext=T;let I=V?.nodesRef.current.find((y)=>y.id===J);if(I)I.context=T}),t2.useMemo(()=>({...D,context:T,refs:C,elements:R,rootStore:Z}),[D,C,R,T,Z])}var UG=P(m(),1),m00=UG.createContext(void 0);function g4(){return UG.useContext(m00)?.direction??"ltr"}var u00=($)=>({name:"arrow",options:$,async fn(Z){let{x:J,y:H,placement:Q,rects:B,platform:X,elements:z,middlewareData:G}=Z,{element:U,padding:K=0,offsetParent:Y="real"}=M9($,Z)||{};if(U==null)return{};let F=_z(K),W={x:J,y:H},q=$Q(Q),N=eH(q),V=await X.getDimensions(U),A=q==="y",D=A?"top":"left",L=A?"bottom":"right",j=A?"clientHeight":"clientWidth",M=B.reference[N]+B.reference[q]-W[q]-B.floating[N],_=W[q]-B.reference[q],E=Y==="real"?await X.getOffsetParent?.(U):z.floating,C=z.floating[j]||B.floating[N];if(!C||!await X.isElement?.(E))C=z.floating[j]||B.floating[N];let R=M/2-_/2,T=C/2-V[N]/2-1,I=Math.min(F[D],T),y=Math.min(F[L],T),S=I,O=C-V[N]-y,b=C/2-V[N]/2+R,k=Mz(S,b,O),h=!G.arrow&&N8(Q)!=null&&b!==k&&B.reference[N]/2-(b<S?I:y)-V[N]/2<0,v=h?b<S?b-S:b-O:0;return{[q]:W[q]+v,data:{[q]:k,centerOffset:b-k-v,...h&&{alignmentOffset:v}},reset:h}}}),$w=($,Z)=>{let{name:J,fn:H}=u00($);return{name:J,fn:H,options:[$,Z]}};var Zw={name:"hide",async fn($){let{width:Z,height:J,x:H,y:Q}=$.rects.reference,B=Z===0&&J===0&&H===0&&Q===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||B}}}};var RZ={sideX:"left",sideY:"top"};var KG="--available-width",YG="--available-height",Jw="--anchor-width",Hw="--anchor-height",Qw="--transform-origin",Bw="--positioner-width",Xw="--positioner-height";var Gw=KG,Uw=YG;function Fw($,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 Kw($,Z,J){let{rects:H,placement:Q}=$;return{side:Fw(Z,o2(Q),J),align:N8(Q)||"center",anchor:{width:H.reference.width,height:H.reference.height},positioner:{width:H.floating.width,height:H.floating.height}}}function k9($){return p00($,eC)}function p00($,Z){let{anchor:J,positionMethod:H="absolute",side:Q="bottom",sideOffset:B=0,align:X="center",alignOffset:z=0,collisionBoundary:G,collisionPadding:U=5,sticky:K=!1,arrowPadding:Y=5,disableAnchorTracking:F=!1,inline:W,keepMounted:q=!1,floatingRootContext:N,mounted:V,collisionAvoidance:A,shift:D,nodeId:L,adaptiveOrigin:j,lazyFlip:M=!1,externalTree:_}=$,[E,C]=$8.useState(null);if(!V&&E!==null)C(null);let R=A.side||"flip",T=A.align||"flip",I=A.fallbackAxisSide||"end",y=D?.crossAxis??!1,S=D?.rootBoundary,O=typeof J==="function"?J:void 0,b=U0(O),k=O?b:J,h=U5(J),v=U5(V),w=g4()==="rtl",i=E||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":w?"left":"right","inline-start":w?"right":"left"}[Q],r=X==="center"?i:`${i}-${X}`,x=U;if(typeof x==="number")x={top:x,right:x,bottom:x,left:x};else if(x)x={top:x.top||0,right:x.right||0,bottom:x.bottom||0,left:x.left||0};let l=1,s=Q==="bottom"?l:0,p=Q==="top"?l:0,d=Q==="right"?l:0,o=Q==="left"?l:0,Z0={boundary:G==="clipping-ancestors"?"clippingAncestors":G,padding:x},H0=$8.useRef(null),G0=U5(B),X0=U5(z),Y0=typeof B!=="function"?B:0,V0=typeof z!=="function"?z:0,N0=[];if(W)N0.push(W);N0.push(kA((C0)=>{let p0=Kw(C0,Q,w),i0=typeof G0.current==="function"?G0.current(p0):G0.current,o0=typeof X0.current==="function"?X0.current(p0):X0.current;return{mainAxis:i0,crossAxis:o0,alignmentAxis:o0}},[Y0,V0,w,Q]));let F0=T==="none"&&R!=="shift",n=!F0&&(K||y||R==="shift"),a=R==="none"?null:xA({...Z0,padding:{top:x.top+l+s,right:x.right+l+o,bottom:x.bottom+l+p,left:x.left+l+d},mainAxis:!y&&R==="flip",crossAxis:T==="flip"?"alignment":!1,fallbackAxisSideDirection:I}),e=F0?null:bA({...Z0,rootBoundary:S,mainAxis:T!=="none",crossAxis:n,limiter:K||y?void 0:yA((C0)=>{if(!H0.current)return{};let{width:p0,height:i0}=H0.current.getBoundingClientRect(),o0=y4(o2(C0.placement)),V1=o0==="y"?p0:i0,D1=o0==="y"?x.left+x.right:x.top+x.bottom;return{offset:V1/2+D1/2}})},[Z0,K,y,S,x,T]);if(R==="shift"||T==="shift"||X==="center")N0.push(e,a);else N0.push(a,e);N0.push(hA({...Z0,apply({elements:{floating:C0},availableWidth:p0,availableHeight:i0,rects:o0}){if(!v.current)return;let V1=C0.style;V1.setProperty(Gw,`${p0}px`),V1.setProperty(Uw,`${i0}px`);let D1=R1(C0).devicePixelRatio||1,{x:u1,y:q0,width:P0,height:l0}=o0.reference,z1=(Math.round((u1+P0)*D1)-Math.round(u1*D1))/D1,O1=(Math.round((q0+l0)*D1)-Math.round(q0*D1))/D1;V1.setProperty(Jw,`${z1}px`),V1.setProperty(Hw,`${O1}px`)}}),$w((C0)=>({element:H0.current||m0(C0.elements.floating).createElement("div"),padding:H0.current?Y:0,offsetParent:"floating"}),[Y]),{name:"transformOrigin",fn(C0){let{elements:{floating:p0},middlewareData:i0,placement:o0,platform:V1,rects:D1,y:u1}=C0,q0=o2(o0),P0=N8(o0),l0=y4(q0)==="y",z1=H0.current,O1=typeof B==="function"?B(Kw(C0,Q,w)):B,b0;if(!z1&&P0&&Math.abs(l0?i0.shift?.x||0:i0.shift?.y||0)<=1)b0=P0==="start"===(l0&&V1.isRTL?.(p0)===!0)?"100%":"0%";else{let h0=l0?i0.arrow?.x||0:i0.arrow?.y||0,G1=l0?z1?.clientWidth||0:z1?.clientHeight||0;b0=`${h0+G1/2}px`}let r0=q0==="top"||q0==="left"?`calc(100% + ${O1}px)`:`${-O1}px`;if(n&&l0&&Math.abs(i0.shift?.y||0)>O1)r0=`${D1.reference.y+D1.reference.height/2-u1}px`;return p0.style.setProperty(Qw,l0?`${b0} ${r0}`:`${r0} ${b0}`),{}}},Zw,j),J0(()=>{if(!V&&N)N.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[V,N]);let $0=$8.useMemo(()=>({ancestorScroll:!F,elementResize:!F&&typeof ResizeObserver<"u",layoutShift:!F&&typeof IntersectionObserver<"u"}),[F]),{refs:Q0,elements:_0,x:M0,y:A0,middlewareData:L0,update:g,placement:u,context:t,isPositioned:W0,floatingStyles:I0}=Z({rootContext:N,open:q?V:void 0,placement:r,middleware:N0,strategy:H,whileElementsMounted:q?void 0:(...C0)=>UQ(...C0,$0),nodeId:L,externalTree:_}),{sideX:c0,sideY:f0}=L0.adaptiveOrigin||RZ,T0=W0?H:"fixed",x0=$8.useMemo(()=>{let C0;if(!W0)C0={position:T0,top:0,left:0};else if(j)C0={position:T0,[c0]:M0,[f0]:A0};else C0={...I0,position:T0};if(C0[Gw]="100vw",C0[Uw]="100vh",!W0)C0.opacity=0;return C0},[j,T0,c0,M0,f0,A0,I0,W0]),J1=$8.useRef(null);J0(()=>{if(!V)return;let C0=h.current,p0=typeof C0==="function"?C0():C0,o0=(Yw(p0)?p0.current:p0)||null||null;if(o0!==J1.current)Q0.setPositionReference(o0),J1.current=o0},[V,Q0,k,h]),$8.useEffect(()=>{if(!V)return;let C0=h.current;if(typeof C0==="function")return;if(Yw(C0)&&C0.current!==J1.current)Q0.setPositionReference(C0.current),J1.current=C0.current},[V,Q0,k,h]),$8.useEffect(()=>{if(q&&V&&_0.reference&&_0.floating)return UQ(_0.reference,_0.floating,g,$0);return},[q,V,_0,g,$0]);let W1=o2(u),d0=Fw(Q,W1,w),v0=N8(u)||"center",E1=Boolean(L0.hide?.referenceHidden);J0(()=>{if(M&&V&&W0&&W1!==i)C(W1)},[M,V,W0,W1,i]);let B1=$8.useMemo(()=>({position:"absolute",top:L0.arrow?.y,left:L0.arrow?.x}),[L0.arrow]),s1=L0.arrow?.centerOffset!==0;return $8.useMemo(()=>({positionerStyles:x0,arrowStyles:B1,arrowRef:H0,arrowUncentered:s1,side:d0,align:v0,physicalSide:W1,anchorHidden:E1,refs:Q0,context:t,isPositioned:W0,update:g}),[x0,B1,H0,s1,d0,v0,W1,E1,Q0,t,W0,g])}function Yw($){return $!=null&&"current"in $}var FG=P(m(),1),vA=FG.createContext(void 0);function Ww(){let $=FG.useContext(vA);if($===void 0)throw Error(y0(84));return $}function b9($){return $==="starting"?qT:L1}function y9($,Z,{styles:J,transitionStatus:H,props:Q,refs:B,hidden:X,inert:z=!1}){let G={...J};if(z)G.pointerEvents="none";return z0("div",$,{state:Z,ref:B,props:[{role:"presentation",hidden:X,style:G},b9(H),Q],stateAttributesMapping:s4})}var qw=P(c(),1),Nw=WG.forwardRef(function(Z,J){let{toast:H,...Q}=Z,B=N9(),X=H.positionerProps??L1,{render:z,className:G,anchor:U=X.anchor,positionMethod:K=X.positionMethod??"absolute",side:Y=X.side??"top",align:F=X.align??"center",sideOffset:W=X.sideOffset??0,alignOffset:q=X.alignOffset??0,collisionBoundary:N=X.collisionBoundary??"clipping-ancestors",collisionPadding:V=X.collisionPadding??5,arrowPadding:A=X.arrowPadding??5,sticky:D=X.sticky??!1,disableAnchorTracking:L=X.disableAnchorTracking??!1,collisionAvoidance:j=X.collisionAvoidance??P9,style:M,..._}=Q,[E,C]=WG.useState(null),R=B.useState("toastIndex",H.id),T=B.useState("toastVisibleIndex",H.id),I=s0(U)?U:null,y=DA({open:!0,onOpenChange:X1,elements:{floating:E,reference:I}}),S=k9({anchor:I,positionMethod:K,floatingRootContext:y,mounted:!0,side:Y,sideOffset:W,align:F,alignOffset:q,collisionBoundary:N,collisionPadding:V,sticky:D,arrowPadding:A,disableAnchorTracking:L,keepMounted:!0,collisionAvoidance:j}),O={side:S.side,align:S.align,anchorHidden:S.anchorHidden},b=y9(Z,O,{styles:{...S.positionerStyles,[yz]:H.transitionStatus==="ending"?R:T},transitionStatus:H.transitionStatus,props:_,refs:[J,C]});return qw.jsx(vA.Provider,{value:S,children:b})});var Aw=P(m(),1);var Vw=Aw.forwardRef(function(Z,J){let{className:H,render:Q,style:B,...X}=Z,{arrowRef:z,side:G,align:U,arrowUncentered:K,arrowStyles:Y}=Ww();return z0("div",Z,{state:{side:G,align:U,uncentered:K},ref:[J,z],props:[{style:Y,"aria-hidden":!0},X]})});var Dw=P(m(),1);function Lw(){let $=N9(),Z=$.useState("toasts");return Dw.useMemo(()=>({toasts:Z,add:$.addToast,close:$.closeToast,update:$.updateToast,promise:$.promiseToast}),[Z,$])}function Mw(){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||Wz("toast"),Q={...J,id:H,transitionStatus:"starting"};return Z({action:"add",options:Q}),H},close(J){Z({action:"close",options:{id:J}})},update(J,H){Z({action:"update",options:{id:J,updates:H}})},promise(J,H){let Q=J;return Z({action:"promise",options:{...H,promise:J,setPromise(B){Q=B}}}),Q}}}var a1=P(c(),1),A5=e2.createToastManager();function c00({...$}){return a1.jsx(e2.Provider,{...$})}function d00({...$}){return a1.jsx(e2.Portal,{"data-slot":"toast-portal",...$})}function l00({className:$,...Z}){return a1.jsx(e2.Viewport,{"data-slot":"toast-viewport",className:B0("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 i00({className:$,...Z}){return a1.jsx(e2.Root,{"data-slot":"toast",className:B0("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 r00({className:$,...Z}){return a1.jsx(e2.Content,{"data-slot":"toast-content",className:B0("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 a00({className:$,...Z}){return a1.jsx(e2.Title,{"data-slot":"toast-title",className:B0("text-sm font-medium",$),...Z})}function o00({className:$,...Z}){return a1.jsx(e2.Description,{"data-slot":"toast-description",className:B0("text-sm text-muted-foreground",$),...Z})}function n00({className:$,render:Z=a1.jsx(j0,{variant:"outline",size:"sm"}),...J}){return a1.jsx(e2.Action,{"data-slot":"toast-action",render:Z,className:B0("shrink-0",$),...J})}function s00({className:$,children:Z,render:J=a1.jsx(j0,{variant:"ghost",size:"icon-sm"}),...H}){return a1.jsx(e2.Close,{"data-slot":"toast-close","aria-label":"Close toast",render:J,className:B0("relative shrink-0 text-muted-foreground after:absolute after:-inset-2 after:content-[''] hover:text-foreground",$),...H,children:Z??a1.jsx(o5,{"aria-hidden":"true",stroke:1.75})})}function t00({type:$}){let Z=null;if($==="success")Z=a1.jsx(_w,{"aria-hidden":"true",stroke:1.75});if($==="info")Z=a1.jsx(jw,{"aria-hidden":"true",stroke:1.75});if($==="warning")Z=a1.jsx(qG,{"aria-hidden":"true",stroke:1.75});if($==="error")Z=a1.jsx(Pw,{className:"text-destructive","aria-hidden":"true",stroke:1.75});if($==="loading")Z=a1.jsx(Ow,{className:"animate-spin","aria-hidden":"true",stroke:1.75});if(!Z)return null;return a1.jsx("span",{"data-slot":"toast-icon",className:"shrink-0 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4",children:Z})}function e00(){let{toasts:$}=e2.useToastManager();return $.map((Z)=>a1.jsx(i00,{toast:Z,children:a1.jsxs(r00,{children:[a1.jsx(t00,{type:Z.type}),a1.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[a1.jsx(a00,{}),a1.jsx(o00,{})]}),a1.jsx(n00,{}),a1.jsx(s00,{})]})},Z.id))}function Tw({children:$,toastManager:Z=A5,...J}){return a1.jsxs(c00,{toastManager:Z,...J,children:[$,a1.jsx(d00,{children:a1.jsx(l00,{children:a1.jsx(e00,{})})})]})}var zC0=e2.createToastManager,GC0=e2.useToastManager;var P3={};C5(P3,{createHandle:()=>BE,Viewport:()=>QE,Trigger:()=>hw,Root:()=>Iw,Provider:()=>rw,Positioner:()=>uw,Portal:()=>fw,Popup:()=>cw,Handle:()=>jG,Arrow:()=>lw});var IZ=P(m(),1);var NG=P(m(),1),gA=NG.createContext(void 0);function P8($){let Z=NG.useContext(gA);if(Z===void 0&&!$)throw Error(y0(72));return Z}var Cw=P(m(),1);class r8 extends k2{setState($){}update($){}set($,Z){}notifyAll(){}}var ww={...S9,disabled:($)=>$.disabled,instantType:($)=>$.instantType,isInstantPhase:($)=>$.isInstantPhase,trackCursorAxis:($)=>$.trackCursorAxis,disableHoverablePopup:($)=>$.disableHoverablePopup,lastOpenChangeReason:($)=>$.openChangeReason,closeOnClick:($)=>$.closeOnClick,closeDelay:($)=>$.closeDelay,adaptiveOrigin:($)=>$.adaptiveOrigin};class fA extends k2{constructor($,Z,J){let H=new O2;super(Sw($,H,Z,J),Rw(H),ww)}setOpen=($,Z)=>{oz(this,$,Z,{extraState:{openChangeReason:Z.reason}})};cancelPendingOpen($){this.state.floatingRootContext.dispatchOpenChange(!1,R0(K0.triggerPress,$))}}function Ew(){let $=new O2,Z=new r8(Object.freeze(Sw(void 0,$)),Object.freeze(Rw($)),ww);return Object.assign(Z,{setOpen:X1,cancelPendingOpen:X1})}function Sw($,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 Rw($){return{popupRef:Cw.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:$}}var KQ=P(c(),1),Iw=v8(function(Z){let{disabled:J=!1,defaultOpen:H=!1,open:Q,disableHoverablePopup:B=!1,trackCursorAxis:X="none",actionsRef:z,onOpenChange:G,onOpenChangeComplete:U,handle:K,triggerId:Y,defaultTriggerId:F=null,children:W}=Z,q=Q6((I,y)=>new fA({open:H,openProp:Q,activeTriggerId:F,triggerIdProp:Y},I,y));q.useControlledProp("openProp",Q),q.useControlledProp("triggerIdProp",Y),q.useContextCallback("onOpenChange",G),q.useContextCallback("onOpenChangeComplete",U);let N=q.useState("open"),V=!J&&N,A=q.useState("activeTriggerId"),D=q.useState("mounted"),L=q.useState("payload");q.useSyncedValues({trackCursorAxis:X,disableHoverablePopup:B,disabled:J}),T9(q,{closeOnActiveTriggerUnmount:!0});let{forceUnmount:j,transitionStatus:M}=C9(V,q),_=q.useState("isInstantPhase"),E=q.useState("instantType"),C=q.useState("lastOpenChangeReason"),R=IZ.useRef(null);J0(()=>{if(N&&J)q.setOpen(!1,R0(K0.disabled))},[N,J,q]),J0(()=>{if(M==="ending"&&C===K0.none||M!=="ending"&&_){if(E!=="delay")R.current=E;q.set("instantType","delay")}else if(R.current!==null)q.set("instantType",R.current),R.current=null},[M,_,C,E,q]),J0(()=>{if(V){if(A==null)q.set("payload",void 0)}},[q,A,V]),IZ.useImperativeHandle(z,()=>({unmount:j,close:()=>q.setOpen(!1,R0(K0.imperativeAction))}),[j,q]);let T=V||D||!J&&X!=="none";return KQ.jsxs(gA.Provider,{value:q,children:[K&&KQ.jsx(j9,{handle:K,store:q}),T&&KQ.jsx($10,{store:q,disabled:J,trackCursorAxis:X}),typeof W==="function"?W({payload:L}):W]})});function $10({store:$,disabled:Z,trackCursorAxis:J}){let H=$.useState("floatingRootContext"),Q=c8(H,{enabled:!Z,referencePress:()=>$.select("closeOnClick")}),B=YA(H,{enabled:!Z&&J!=="none",axis:J==="none"?void 0:J}),X=IZ.useMemo(()=>X2(B.reference,Q.reference),[B.reference,Q.reference]);return w9($,{activeTriggerProps:X,inactiveTriggerProps:X,popupProps:Q.floating??L1}),null}var VG=P(m(),1);function t0($){return A4($,"base-ui")}var AG=P(m(),1),mA=AG.createContext(void 0);function kw(){return AG.useContext(mA)}var bw=600;var xw="data-base-ui-tooltip-trigger";function yw($){if("composedPath"in $){let J=$.composedPath();for(let H=0;H<J.length;H+=1){let Q=J[H];if(s0(Q))return Q}}let Z=$.target;if(s0(Z))return Z;return null}function Z10($){let Z=$;while(Z){let J=Z.closest(`[${xw}]`);if(J)return J;let H=Z.getRootNode();Z="host"in H&&s0(H.host)?H.host:null}return null}var hw=A9(function(Z,J){let{render:H,className:Q,style:B,handle:X,payload:z,disabled:G,delay:U,closeOnClick:K=!0,closeDelay:Y,id:F,...W}=Z,q=P8(!0),V=R9(X)??q;if(!V)throw Error(y0(82));let A=t0(F),D=V.useState("isTriggerActive",A),L=V.useState("isOpenedByTrigger",A),j=V.useState("floatingRootContext"),M=VG.useRef(null),_=Y??0,{registerTrigger:E,isMountedByThisTrigger:C}=O9(A,M,V,{payload:z,closeOnClick:K,closeDelay:_}),R=kw(),{activeIdRef:T,delayRef:I,isInstantPhase:y,hasProvider:S}=QA(j,{open:L}),O=wZ(j);V.useSyncedValue("isInstantPhase",y);let b=V.useState("disabled"),k=G??b,h=U5(k),v=V.useState("trackCursorAxis"),f=V.useState("disableHoverablePopup"),w=VG.useRef(!1),i=d1(),r=VG.useRef(void 0);function x(){if(S&&T.current!=null)return 0;return U??R??bw}function l(Y0){let V0=M.current;if(!V0||!Y0)return!1;let N0=Z10(Y0);return N0!==null&&N0!==V0&&k0(V0,N0)}function s(Y0){let V0=l(Y0);if(w.current=V0,V0)O.openChangeTimeout.clear(),O.restTimeout.clear(),O.restTimeoutPending=!1,i.clear();return V0}let p=l8(j,{enabled:!k,mouseOnly:!0,move:!1,handleClose:!f&&v!=="both"?i8():null,restMs:x,delay(){if(Y==null&&S)return{close:p8(I.current,"close")};return{close:_}},triggerElementRef:M,isActiveTrigger:D,isClosing:()=>V.select("transitionStatus")==="ending",shouldOpen(){return!w.current}}),d=t7(j,{enabled:!k}).reference,o=(Y0)=>{let V0=w.current,N0=yw(Y0),F0=s(N0),n=M.current,a=n&&N0&&k0(n,N0);if(F0&&V.select("open")&&V.select("lastOpenChangeReason")===K0.triggerHover){V.setOpen(!1,R0(K0.triggerHover,Y0));return}if(V0&&!F0&&a&&!h.current&&!V.select("open")&&n&&t4(r.current)){let e=()=>{if(!w.current&&!h.current&&!V.select("open"))V.setOpen(!0,R0(K0.triggerHover,Y0,n))},$0=x();if($0===0)i.clear(),e();else i.start($0,e)}},Z0=V.useState("triggerProps",C);return z0("button",Z,{state:{open:L},ref:[J,E,M],props:[p,d,C||v!=="none"?Z0:void 0,{onMouseOver(Y0){o(Y0.nativeEvent)},onFocus(Y0){if(l(yw(Y0.nativeEvent)))Y0.preventBaseUIHandler()},onMouseLeave(){w.current=!1,i.clear(),r.current=void 0},onPointerEnter(Y0){r.current=Y0.pointerType},onPointerDown(Y0){if(r.current=Y0.pointerType,V.set("closeOnClick",K),K&&!V.select("open"))V.cancelPendingOpen(Y0.nativeEvent)},onClick(Y0){if(K&&!V.select("open"))V.cancelPendingOpen(Y0.nativeEvent)},id:A,[aH]:k?"":void 0,[xw]:k?void 0:""},W],stateAttributesMapping:V9})});var gw=P(m(),1);var DG=P(m(),1),uA=DG.createContext(void 0);function vw(){let $=DG.useContext(uA);if($===void 0)throw Error(y0(70));return $}var pA=P(c(),1),fw=gw.forwardRef(function(Z,J){let{keepMounted:H=!1,...Q}=Z;if(!(P8().useState("mounted")||H))return null;return pA.jsx(uA.Provider,{value:H,children:pA.jsx(OZ,{ref:J,...Q})})});var MG=P(m(),1);var LG=P(m(),1),cA=LG.createContext(void 0);function kZ(){let $=LG.useContext(cA);if($===void 0)throw Error(y0(71));return $}var mw=P(c(),1),uw=MG.forwardRef(function(Z,J){let{render:H,className:Q,anchor:B,positionMethod:X="absolute",side:z="top",align:G="center",sideOffset:U=0,alignOffset:K=0,collisionBoundary:Y="clipping-ancestors",collisionPadding:F=5,arrowPadding:W=5,sticky:q=!1,disableAnchorTracking:N=!1,collisionAvoidance:V=P9,style:A,...D}=Z,L=P8(),j=vw(),M=L.useState("open"),_=L.useState("mounted"),E=L.useState("trackCursorAxis"),C=L.useState("disableHoverablePopup"),R=L.useState("floatingRootContext"),T=L.useState("instantType"),I=L.useState("transitionStatus"),y=L.useState("adaptiveOrigin"),S=k9({anchor:B,positionMethod:X,floatingRootContext:R,mounted:_,side:z,sideOffset:U,align:G,alignOffset:K,collisionBoundary:Y,collisionPadding:F,sticky:q,arrowPadding:W,disableAnchorTracking:N,keepMounted:j,collisionAvoidance:V,adaptiveOrigin:y}),O=MG.useMemo(()=>({open:M,side:S.side,align:S.align,anchorHidden:S.anchorHidden,instant:E!=="none"?"tracking-cursor":T}),[M,S.side,S.align,S.anchorHidden,E,T]),b=y9(Z,O,{styles:S.positionerStyles,transitionStatus:I,props:D,refs:[J,L.useStateSetter("positionerElement")],hidden:!_,inert:!M||E==="both"||C});return mw.jsx(cA.Provider,{value:S,children:b})});var pw=P(m(),1);var cw=pw.forwardRef(function(Z,J){let{render:H,className:Q,style:B,...X}=Z,z=P8(),{side:G,align:U}=kZ(),K=z.useState("open"),Y=z.useState("instantType"),F=z.useState("transitionStatus"),W=z.useState("popupProps"),q=z.useState("floatingRootContext"),N=z.useState("disabled"),V=z.useState("closeDelay");W5({open:K,ref:z.context.popupRef,onComplete(){if(K)z.context.onOpenChangeComplete?.(!0)}}),L3(q,{enabled:!N,closeDelay:V});let A=z.useStateSetter("popupElement");return z0("div",Z,{state:{open:K,side:G,align:U,instant:Y,transitionStatus:F},ref:[J,z.context.popupRef,A],props:[_9,W,b9(F),X],stateAttributesMapping:a2})});var dw=P(m(),1);var lw=dw.forwardRef(function(Z,J){let{render:H,className:Q,style:B,...X}=Z,z=P8(),{arrowRef:G,side:U,align:K,arrowUncentered:Y,arrowStyles:F}=kZ(),W=z.useState("open"),q=z.useState("instantType");return z0("div",Z,{state:{open:W,side:U,align:K,uncentered:Y,instant:q},ref:[J,G],props:[{style:F,"aria-hidden":!0},X],stateAttributesMapping:s4})});var iw=P(m(),1);var dA=P(c(),1),rw=function(Z){let{delay:J,closeDelay:H,timeout:Q=400}=Z,B=iw.useMemo(()=>({open:J,close:H}),[J,H]);return dA.jsx(mA.Provider,{value:J,children:dA.jsx(HA,{delay:B,timeoutMs:Q,children:Z.children})})};var HE=P(m(),1);var v2=P(m(),1),JE=P(e4(),1);var aw=P(m(),1);function ow($){let[Z,J]=aw.useState({current:$,previous:null});if(!Object.is($,Z.current))J({current:$,previous:Z.current});return Z.previous}var yZ=P(m(),1);function bZ($){let Z=y2($),J=parseFloat(Z.width)||0,H=parseFloat(Z.height)||0,Q=P1($),B=Q?$.offsetWidth:J,X=Q?$.offsetHeight:H;if(e3(J)!==B||e3(H)!==X)J=B,H=X;return{width:J,height:H}}var YQ="--popup-width",FQ="--popup-height";function tw($){let{popupElement:Z,positionerElement:J,content:H,mounted:Q,onMeasureLayout:B,onMeasureLayoutComplete:X,side:z,direction:G}=$,U=h4(Z,!0),K=N4(),Y=yZ.useRef(null),F=yZ.useRef(!0),W=yZ.useRef(X1),q=U0(B),N=U0(X),V=yZ.useMemo(()=>J10(z,G),[z,G]);J0(()=>{if(!Q){W.current=X1,F.current=!0,Y.current=null;return}if(!Z||!J)return;W.current=sw(Z,V),lA(Z,"auto");let A=_G(Z,"position","static"),D=_G(Z,"transform","none"),L=_G(Z,"scale","1"),j=sw(J,{[KG]:"max-content",[YG]:"max-content"});function M(){A(),D(),j()}function _(){M(),L()}if(q?.(),F.current||Y.current===null){PG(J,"max-content");let T=bZ(Z);return Y.current=T,PG(J,T),_(),N?.(null,T),F.current=!1,()=>{W.current(),W.current=X1}}PG(J,"max-content");let E=Y.current,C=bZ(Z);Y.current=C,lA(Z,E),_(),N?.(E,C),PG(J,C);let R=new AbortController;return K.request(()=>{lA(Z,C),U(()=>{Z.style.setProperty(YQ,"auto"),Z.style.setProperty(FQ,"auto")},R.signal)}),()=>{R.abort(),K.cancel(),W.current(),W.current=X1}},[H,Z,J,U,K,Q,q,N,V])}function J10($,Z){let J=$==="top",H=$==="left"||$===(Z==="rtl"?"inline-end":"inline-start");if(!J&&!H)return L1;return{position:"absolute",[J?"bottom":"top"]:"0",[H?"right":"left"]:"0"}}function _G($,Z,J){let H=$.style.getPropertyValue(Z);return $.style.setProperty(Z,J),()=>{$.style.setProperty(Z,H)}}function sw($,Z){let J=[];for(let[H,Q]of Object.entries(Z))J.push(_G($,H,Q));return J.length?()=>{J.forEach((H)=>H())}:X1}function lA($,Z){let J=Z==="auto"?"auto":`${Z.width}px`,H=Z==="auto"?"auto":`${Z.height}px`;$.style.setProperty(YQ,J),$.style.setProperty(FQ,H)}function PG($,Z){let J=Z==="max-content"?"max-content":`${Z.width}px`,H=Z==="max-content"?"max-content":`${Z.height}px`;$.style.setProperty(Bw,J),$.style.setProperty(Xw,H)}var ew={name:"adaptiveOrigin",async fn($){let{x:Z,y:J,rects:{floating:H},elements:{floating:Q},platform:B,strategy:X,placement:z}=$,G=R1(Q),U=G.getComputedStyle(Q);if(!(U.transitionDuration!=="0s"&&U.transitionDuration!==""))return{x:Z,y:J,data:RZ};let Y=await B.getOffsetParent?.(Q),F={width:0,height:0};if(X==="fixed"&&G?.visualViewport)F={width:G.visualViewport.width,height:G.visualViewport.height};else if(Y===G){let D=m0(Q);F={width:D.documentElement.clientWidth,height:D.documentElement.clientHeight}}else if(await B.isElement?.(Y))F=await B.getDimensions(Y);let W=o2(z),q=Z,N=J;if(W==="left")q=F.width-(Z+H.width);if(W==="top")N=F.height-(J+H.height);let V=W==="left"?"right":RZ.sideX,A=W==="top"?"bottom":RZ.sideY;return{x:q,y:N,data:{sideX:V,sideY:A}}}};var $E="data-activation-direction";var xZ=P(c(),1),X6={activationDirection:($)=>$?{[$E]:$}:null};function z6($){let{store:Z,side:J,children:H}=$,Q=g4(),B=Z.useState("activeTriggerElement"),X=Z.useState("activeTriggerId"),z=Z.useState("open"),G=Z.useState("payload"),U=Z.useState("mounted"),K=Z.useState("popupElement"),Y=Z.useState("positionerElement"),F=ow(z?B:null),W=X10(X,G),q=v2.useRef(null),[N,V]=v2.useState(null),[A,D]=v2.useState(null),L=v2.useRef(null),j=v2.useRef(null),M=h4(L,!0),_=N4(),E=v2.useRef(null),[C,R]=v2.useState(null),[T,I]=v2.useState(!1);J0(()=>{return Z.set("adaptiveOrigin",ew),()=>{Z.set("adaptiveOrigin",void 0)}},[Z]);let y=U0(()=>{L.current?.style.setProperty("animation","none"),L.current?.style.setProperty("transition","none"),j.current?.style.setProperty("display","none")}),S=U0((f)=>{if(L.current?.style.removeProperty("animation"),L.current?.style.removeProperty("transition"),j.current?.style.removeProperty("display"),f)R(f)}),O=U0(()=>{E.current?.abort();let f=new AbortController;E.current=f,M(()=>{V(null),R(null),q.current=null},f.signal)}),b=v2.useRef(null);J0(()=>{if(!z||!U)b.current=null},[z,U]),J0(()=>{if(B&&F&&B!==F&&b.current!==B&&q.current){V(q.current),I(!0);let f=B10(F,B);D(f),b.current=B}},[B,F]),J0(()=>{if(N==null)return;E.current?.abort(),I(!0),_.request(()=>{JE.flushSync(()=>{I(!1)}),O()})},[W,N,O,_]),J0(()=>{let f=L.current;if(!f)return;let w=m0(f).createElement("div");for(let i of Array.from(f.childNodes))w.appendChild(i.cloneNode(!0));q.current=w});let k=N!=null,h;if(!k)h=xZ.jsx("div",{"data-current":!0,ref:L,children:H},W);else h=xZ.jsxs(v2.Fragment,{children:[xZ.jsx("div",{"data-previous":!0,inert:D8(!0),ref:j,style:{...C?{[YQ]:`${C.width}px`,[FQ]:`${C.height}px`}:null,position:"absolute"},"data-ending-style":T?void 0:""},"previous"),xZ.jsx("div",{"data-current":!0,ref:L,"data-starting-style":T?"":void 0,children:H},W)]});J0(()=>{let f=j.current;if(!f||!N)return;f.replaceChildren(...Array.from(N.childNodes))},[N]),tw({popupElement:K,positionerElement:Y,mounted:U,content:G,onMeasureLayout:y,onMeasureLayoutComplete:S,side:J,direction:Q});let v={activationDirection:Q10(A),transitioning:k};return{children:h,state:v}}function Q10($){if(!$)return;return`${ZE($.horizontal,5,"right","left")} ${ZE($.vertical,5,"down","up")}`}function ZE($,Z,J,H){if($>Z)return J;if($<-Z)return H;return""}function B10($,Z){let J=$.getBoundingClientRect(),H=Z.getBoundingClientRect(),Q={x:J.left+J.width/2,y:J.top+J.height/2},B={x:H.left+H.width/2,y:H.top+H.height/2};return{horizontal:B.x-Q.x,vertical:B.y-Q.y}}function X10($,Z){let[J,H]=v2.useState(0),Q=v2.useRef($),B=v2.useRef(Z),X=v2.useRef(!1);return J0(()=>{let z=Q.current,G=B.current,U=$!==z,K=Z!==G;if(U)H((Y)=>Y+1),X.current=!K;else if(X.current&&K)H((Y)=>Y+1),X.current=!1;Q.current=$,B.current=Z},[$,Z]),`${$??"current"}-${J}`}var QE=HE.forwardRef(function(Z,J){let{render:H,className:Q,style:B,children:X,...z}=Z,G=P8(),U=kZ(),K=G.useState("instantType"),{children:Y,state:F}=z6({store:G,side:U.side,children:X}),W={activationDirection:F.activationDirection,transitioning:F.transitioning,instant:K};return z0("div",Z,{state:W,ref:J,props:[z,{children:Y}],stateAttributesMapping:X6})});class jG extends d8{constructor(){super(Ew(),"Tooltip")}open($){this.openByTrigger($)}close(){this.closePopup()}get isOpen(){return this.attachedStore?.select("open")??!1}}function BE(){return new jG}var OG=P(m(),1),G6=P(c(),1);function _8({portal:$,children:Z,...J}){let[H,Q]=OG.useState(void 0),B=OG.useCallback((X)=>{if(X)Q(X.closest("[data-applet]")?.getAttribute("data-applet")??void 0)},[]);return G6.jsxs(G6.Fragment,{children:[G6.jsx("span",{hidden:!0,ref:B}),G6.jsx($,{...J,children:G6.jsx("div",{"data-applet":H,className:"contents",children:Z})})]})}var Z$=P(c(),1);function TG({delay:$=100,...Z}){return Z$.jsx(P3.Provider,{"data-slot":"tooltip-provider",delay:$,...Z})}function Q5({...$}){return Z$.jsx(P3.Root,{"data-slot":"tooltip",...$})}function B5({...$}){return Z$.jsx(P3.Trigger,{"data-slot":"tooltip-trigger",...$})}function X5({className:$,side:Z="top",sideOffset:J=6,align:H="center",alignOffset:Q=0,children:B,...X}){return Z$.jsx(_8,{portal:P3.Portal,children:Z$.jsx(P3.Positioner,{align:H,alignOffset:Q,side:Z,sideOffset:J,className:"isolate z-50",children:Z$.jsx(P3.Popup,{"data-slot":"tooltip-content",className:a0("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:B})})})}function CG({cooldownMs:$,windowMs:Z,maxPerWindow:J,maxKeys:H=256,now:Q=Date.now}){let B=new Map,X=0,z=0;return{admit(G){let U=Q(),K=B.get(G);if(K!==void 0&&U-K<$)return"cooldown";if(U-X>=Z)X=U,z=0;if(z>=J)return"window";if(z++,B.set(G,U),B.size>H)for(let Y of[...B.keys()].slice(0,Math.ceil(H/2)))B.delete(Y);return"ok"}}}var z10=CG({cooldownMs:5000,windowMs:60000,maxPerWindow:30});function Z8($,Z){let J=[$,Z.source,Z.kind,Z.name,Z.message].join("\x00");if(z10.admit(J)!=="ok")return;fetch(`/api/workspaces/${$}/applet-log`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({events:[Z]})}).catch(()=>{})}var G10=/\/api\/workspaces\/([^/\s)]+)\/(widgets|views)\/([^/\s)]+)\//;function XE($){if(!$)return null;let Z=G10.exec($);if(!Z)return null;return{workspaceId:Z[1],kind:Z[2]==="widgets"?"widget":"view",name:Z[3]}}var zE=!1;function GE(){if(zE)return;zE=!0;let $=(Z,J,H)=>{let Q=J instanceof Error?J:null,B=Q?.stack??"",X=Z??XE(B);if(!X)return;Z8(X.workspaceId,{source:"window",kind:X.kind,name:X.name,message:Q?.message||H||String(J),...B?{stack:B}:{}})};window.addEventListener("error",(Z)=>$(XE(Z.filename),Z.error,Z.message)),window.addEventListener("unhandledrejection",(Z)=>$(null,Z.reason))}function J$($,Z){return`${$}:${Z}`}function hZ($){return $==="running"}function YE($){return Object.values($).some(hZ)}function WQ($,Z,J){return hZ($[J$(Z,J)])}function EG($,Z){let J=`${Z}:`;return Object.entries($).some(([H,Q])=>H.startsWith(J)&&hZ(Q))}function FE($,Z,J){if(!J)return!1;let H=`${Z}:`,Q=J$(Z,J);return Object.entries($).some(([B,X])=>B.startsWith(H)&&B!==Q&&hZ(X))}function a8($,Z){return J$($,Z??"new")}function wG($,Z,J){for(let[H,Q]of Object.entries($)){if(!H.startsWith(`${Z}:`))continue;let B=Q.find((X)=>X.localId===J);if(B)return{key:H,attachment:B}}}var b1=UE()(($)=>({activity:{},errors:{},previews:{},attachments:{},setActivity:(Z,J,H)=>$((Q)=>({activity:{...Q.activity,[J$(Z,J)]:H}})),reconcileActivity:(Z)=>$(()=>({activity:Object.fromEntries(Z.map((J)=>[J$(J.workspaceId,J.sessionId),J.activity]))})),setError:(Z,J,H)=>$((Q)=>({errors:{...Q.errors,[J$(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,...Q}=J.previews;return{previews:Q}}),clearPreviewsForSession:(Z,J)=>$((H)=>{let Q={},B=!1;for(let[X,z]of Object.entries(H.previews))if(z.workspaceId===Z&&z.sessionId===J)B=!0;else Q[X]=z;return B?{previews:Q}:H}),clearAllPreviews:()=>$((Z)=>Object.keys(Z.previews).length?{previews:{}}:Z),sweepPreviews:(Z,J)=>$((H)=>{let Q={},B=!1;for(let[X,z]of Object.entries(H.previews))if(J-z.updatedAt>Z)B=!0;else Q[X]=z;return B?{previews:Q}:H}),addAttachments:(Z,J,H)=>$((Q)=>{let B=a8(Z,J);return{attachments:{...Q.attachments,[B]:[...Q.attachments[B]??[],...H]}}}),updateAttachment:(Z,J,H)=>$((Q)=>{let B=wG(Q.attachments,Z,J);if(!B)return{};let{key:X,attachment:z}=B,G=Q.attachments[X];if(z.kind!=="text"&&z.previewUrl&&"previewUrl"in H&&H.previewUrl!==z.previewUrl)URL.revokeObjectURL(z.previewUrl);return{attachments:{...Q.attachments,[X]:G.map((U)=>U.localId===J&&U.kind!=="text"?{...U,...H}:U)}}}),removeAttachment:(Z,J)=>$((H)=>{let Q=wG(H.attachments,Z,J);if(!Q)return{};let{key:B,attachment:X}=Q,z=H.attachments[B];if(X.kind!=="text"&&X.previewUrl)URL.revokeObjectURL(X.previewUrl);return{attachments:{...H.attachments,[B]:z.filter((G)=>G.localId!==J)}}}),clearAttachments:(Z,J)=>$((H)=>{let Q=a8(Z,J);for(let X of H.attachments[Q]??[])if(X.kind!=="text"&&X.previewUrl)URL.revokeObjectURL(X.previewUrl);let B={...H.attachments};return delete B[Q],{attachments:B}}),renameSession:(Z,J,H)=>$((Q)=>{let B=a8(Z,J),X=J$(Z,H),z={...Q.activity},G={...Q.errors};if(B in z)z[X]=z[B],delete z[B];if(B in G)G[X]=G[B],delete G[B];let U=Q.previews,K=!1;for(let[F,W]of Object.entries(Q.previews))if(W.workspaceId===Z&&W.sessionId===J){if(!K)U={...Q.previews},K=!0;U[F]={...W,sessionId:H}}let Y=Q.attachments;if(B!==X&&Y[B])Y={...Y,[X]:[...Y[X]??[],...Y[B]]},delete Y[B];return{activity:z,errors:G,previews:U,attachments:Y}})}));function WE($,Z,J){if(!J)return{root:null,byParent:{}};let H=null,Q={};for(let B of Object.values($)){if(B.workspaceId!==Z||B.sessionId!==J)continue;if(B.parentToolUseId===null){if(!H||B.updatedAt>H.updatedAt)H=B}else{let X=Q[B.parentToolUseId];if(!X||B.updatedAt>X.updatedAt)Q[B.parentToolUseId]=B}}return{root:H,byParent:Q}}function g2($){return KE(b1,$)}var S0={all:["workspaces"],discover:["workspaces","discover"],setupInfo:["workspaces","setup-info"],preview:($)=>["workspaces","preview",$],layout:($)=>["workspaces","layout",$],widgets:($)=>["workspaces","widgets",$],appletThumbnails:($)=>["workspaces","applet-thumbnails",$],views:($)=>["workspaces","views",$],viewBuilders:($)=>["workspaces","view-builders",$],sessions:($)=>["workspaces","sessions",$],events:($,Z)=>["workspaces","events",$,Z],sessionConfig:($,Z)=>["workspaces","sessionConfig",$,Z],mcp:($)=>["workspaces","mcp",$],agent:($)=>["workspaces","agent",$],skills:($)=>["workspaces","skills",$],env:($)=>["workspaces","env",$]};function qQ(){return{turns:[],notices:[]}}function SG($,Z){switch(Z.kind){case"snapshot":return{...$,snapshot:Z.snapshot};case"turn":{let J=$.turns.findIndex((Q)=>Q.id===Z.turn.id);if(J>=0)return{...$,turns:$.turns.map((Q,B)=>B===J?Z.turn:Q)};if(Z.turn.seq===void 0)return{...$,turns:[...$.turns,Z.turn]};let H=$.turns.findIndex((Q)=>Q.seq!==void 0&&Q.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 qE($){let Z=qQ(),J=new Map,H=new Map,Q=-1/0;for(let B of $)switch(B.kind){case"snapshot":Z.snapshot=B.snapshot;break;case"turn":{let X=B.turn,z=X.seq,G=J.get(X.id);if(G!==void 0)Z.turns[G]=X;else{let U=z!==void 0&&z<Q?Z.turns.findIndex((K)=>K.seq!==void 0&&K.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 K=U;K<Z.turns.length;K++)J.set(Z.turns[K].id,K)}}if(z!==void 0)Q=Math.max(Q,z);break}case"notice":H.set(B.notice.id,B.notice);break;case"result":Z.result=B.result;break}return Z.notices=[...H.values()],Z}var iA=new WeakMap;function NE($,Z,J,H){for(let Q of iA.get($)??[])if(Q.workspaceId===Z&&Q.sessionId===J)Q.events.push(H)}function AE($,Z){return AN({queryKey:S0.events($,Z),queryFn:async({client:J,signal:H})=>{let Q=iA.get(J)??new Set;iA.set(J,Q);let B={workspaceId:$,sessionId:Z,events:[]};Q.add(B);try{let X=await q1(`/api/workspaces/${$}/sessions/${Z}/events`,{signal:H},"Couldn’t load chat");return qE([...X,...B.events])}finally{Q.delete(B)}},staleTime:1/0,gcTime:300000})}var f4=P(m(),1);function NQ($){return $==="agent"||$==="overview"||$==="scratchpad"||typeof $==="string"&&/^(views|view-builders)\/[a-zA-Z0-9_-]+$/.test($)}var vZ=($)=>`views/${$}`,AQ=($)=>$.startsWith("views/")?$.slice(6):null,H$=($)=>`view-builders/${$}`,Q$=($)=>$.startsWith("view-builders/")?$.slice(14):null;function x9($){return typeof $==="object"&&$!==null&&!Array.isArray($)}function rA($){if(typeof $!=="string"||!$.startsWith("moi:/")||$.startsWith("moi://"))throw Error("Expected a workspace address such as moi:/views/events?eventId=123");let Z=$.slice(5).split(/[?#]/,1)[0];if($.includes("#")||/[\s\\]/.test(Z))throw Error("Invalid workspace address");let J=_3(Z);if(!J||J==="agent"||J.startsWith("view-builders/"))throw Error(`Unsupported workspace destination: ${Z}`);let H=$.indexOf("?"),Q=H<0?"":VQ($.slice(H+1));return{tab:J,search:Q}}function VQ($){let Z=new URLSearchParams($);Z.sort();let J=Z.toString();return J?`?${J}`:""}function VE($){let Z=new URLSearchParams($);return Object.fromEntries(Array.from(Z.keys(),(J)=>[J,Z.get(J)]))}function _3($){try{let Z=decodeURIComponent($);return NQ(Z)?Z:null}catch{return null}}function RG($){let Z=/^(view|view-builder):(.+)$/.exec($);return Z?_3(`${Z[1]}s/${Z[2]}`):null}function o8($,Z=""){return`${Z.replace(/\/$/,"")}/workspace/${encodeURIComponent($)}`}function gZ($,Z,J=""){return`${o8($,J)}/${Z.tab}${Z.search}`}function DE($,Z){return gZ($,{tab:Z,search:""})}function B$($,Z){if($.startsWith("moi:/files/")){let H=$.slice(11),Q=H.search(/[?#]/),B=Q<0?H:H.slice(0,Q),X=Q<0?"":H.slice(Q),z=B.split("/").map((G)=>{let U=decodeURIComponent(G);if(!U||U==="."||U===".."||/[/\\\0]/.test(U))throw Error("Invalid workspace file path");return encodeURIComponent(U)});return`${Z.apiBase}/files/${z.join("/")}${X}`}if($.startsWith("moi:")){let{tab:H,search:Q}=rA($);return Z.workspacePath?`${Z.workspacePath}/${H}${Q}`:""}let J=new URL($);if(J.protocol!=="https:"&&J.protocol!=="http:")throw Error("Unsupported URL");return J.href}var U6={status:"disconnected",connectionId:null,connections:[],users:[],error:null},U10=[],LE=($,Z)=>JSON.stringify([$,Z]);class aA{state=U6;usersState=U6;channels=new Map;listeners=new Set;registrations=new Map;location=null;send=()=>{};getSnapshot=()=>this.state;getUsersSnapshot=()=>this.usersState;getPresenceSnapshot=($,Z)=>this.channels.get(LE($,Z))??U10;subscribe=($)=>{return this.listeners.add($),()=>{this.listeners.delete($)}};setSender($){this.send=$}connecting(){this.publish({status:"connecting",error:null})}disconnect($){this.publish({...U6,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((Q)=>({...Q,presence:[]}))};if(Z||JSON.stringify(J)!==JSON.stringify(this.usersState))this.usersState=J;let H=new Map;if(this.location?.status==="active")for(let Q of this.state.connections){if(Q.connectionId===this.state.connectionId||Q.location?.page!==this.location.page||Q.location.status!=="active")continue;for(let B of Q.presence){let X=LE(B.appletId,B.channel),z=H.get(X)??[];z.push({registrationId:B.registrationId,connectionId:Q.connectionId,userId:Q.userId,value:B.value}),H.set(X,z)}}this.channels=new Map([...H].map(([Q,B])=>{let X=this.channels.get(Q);return[Q,X&&JSON.stringify(X)===JSON.stringify(B)?X:B]})),this.listeners.forEach((Q)=>Q())}}var K6=()=>{},jE=[],OE={workspaceId:"",enabled:!1,start:()=>K6,getSnapshot:()=>U6,getUsersSnapshot:()=>U6,getPresenceSnapshot:()=>jE,subscribe:()=>K6,getCurrentUser:j3,subscribeCurrentUser:IG,getWorkspaceDirectory:()=>{return},subscribeWorkspaceUsers:()=>K6,getLocation:()=>null,setLocation:K6,setPresence:K6,deletePresence:K6};class oA{workspaceId;enabled;store=new aA;socket=null;retry;heartbeat;unsubscribeCurrentUser;presenceTimer;queuedPresence=new Map;stopped=!0;attempts=0;lastMessageAt=0;userId=j3()?.id;constructor($,Z=!0){this.workspaceId=$;this.enabled=Z;this.store.setSender((J)=>this.send(J))}getSnapshot=()=>this.enabled?this.store.getSnapshot():U6;getUsersSnapshot=()=>this.enabled?this.store.getUsersSnapshot():U6;getPresenceSnapshot=($,Z)=>this.enabled?this.store.getPresenceSnapshot($,Z):jE;subscribe=($)=>this.enabled?this.store.subscribe($):K6;getCurrentUser=j3;subscribeCurrentUser=IG;getWorkspaceDirectory=()=>PE(this.workspaceId);subscribeWorkspaceUsers=($)=>_E(this.workspaceId,$);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 K6;if(!this.stopped)return()=>{};return this.stopped=!1,this.userId=j3()?.id,this.unsubscribeCurrentUser=IG(()=>{let $=j3();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&&j3()!==void 0}connect(){if(!this.wantsConnection()){this.store.disconnect();return}if(this.socket)return;clearTimeout(this.retry),this.store.connecting();let $=new WebSocket(kG(`/api/workspaces/${encodeURIComponent(this.workspaceId)}/collab/ws`));this.socket=$,$.onopen=()=>{if($!==this.socket)return;this.lastMessageAt=Date.now();let Z=j3();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:ME,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(!j3()&&($.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 eA=P(c(),1),TE=f4.createContext(OE),CE=f4.createContext(null);function nA($,Z,J=""){let H=o8(Z,J)+"/",Q=$.startsWith(H)?$.slice(H.length):"";return _3(Q)??RG(Q)??(Q||"overview")}function sA({workspaceId:$,enabled:Z,children:J}){let H=f4.useMemo(()=>new oA($,Z),[$,Z]),Q=i2(),B=b7(Q),{base:X}=Q;return f4.useEffect(()=>H.start(),[H]),f4.useEffect(()=>{let z=()=>H.setLocation({page:nA(window.location.pathname,$,X),status:document.visibilityState==="hidden"?"away":"active"});return z(),document.addEventListener("visibilitychange",z),()=>document.removeEventListener("visibilitychange",z)},[X,H,B,$]),eA.jsx(TE,{value:H,children:J})}function DQ({appletId:$,active:Z=!0,children:J}){let{enabled:H}=O3(),Q=f4.useMemo(()=>({active:H&&Z,appletId:$}),[H,Z,$]);return eA.jsx(CE,{value:Q,children:J})}function O3(){return f4.useContext(TE)}function tA(){return f4.useContext(CE)}function M4(){let $=O3(),Z=f4.useSyncExternalStore($.subscribeCurrentUser,$.getCurrentUser,$.getCurrentUser);return $.enabled&&Z!==void 0}var JU=P(m(),1);var T3={};C5(T3,{createHandle:()=>AS,Viewport:()=>NS,Trigger:()=>fE,Title:()=>US,Root:()=>bE,Positioner:()=>sE,Portal:()=>pE,Popup:()=>HS,Handle:()=>lG,Description:()=>YS,Close:()=>WS,Backdrop:()=>zS,Arrow:()=>BS});var LQ=P(m(),1);var bG=P(m(),1),$V=bG.createContext(void 0);function d5($){let Z=bG.useContext($V);if(Z===void 0&&!$)throw Error(y0(47));return Z}var yG=P(m(),1),wE=P(e4(),1);var EE={...S9,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 ZV extends k2{constructor($,Z,J){let H=new O2;super(RE($,H,Z,J),IE(H),EE)}setOpen=($,Z)=>{let J=Z.reason===K0.triggerHover,H=Z.reason===K0.triggerPress&&Z.event.detail===0,Q=!$&&(Z.reason===K0.escapeKey||Z.reason==null),B=BQ(Z),X=this.select("activeTriggerId");if(!$&&Z.reason===K0.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=s7(this.state,$,Z.trigger,B());U.openChangeReason=Z.reason,this.update(U)};if(J)this.set("stickIfOpen",!0),this.context.stickIfOpenTimeout.start(Rz,()=>{this.set("stickIfOpen",!1)}),wE.flushSync(z);else z();let G;if(H)G="click";else if(Q)G="dismiss";else if(Z.reason===K0.focusOut)G="focus";this.set("instantType",G)}}function SE(){let $=new O2,Z=new r8(Object.freeze(RE(void 0,$)),Object.freeze(IE($)),EE);return Object.assign(Z,{setOpen:X1})}function RE($,Z,J,H=!1){let Q={...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(Q.open&&$?.mounted===void 0)Q.mounted=!0;return Q}function IE($){return{popupRef:yG.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:yG.createRef(),beforeContentFocusGuardRef:yG.createRef(),stickIfOpenTimeout:new c5,triggerElements:$}}var Y6=P(c(),1),kE=v8(function({props:Z}){let{children:J,open:H,defaultOpen:Q=!1,onOpenChange:B,onOpenChangeComplete:X,modal:z=!1,handle:G,triggerId:U,defaultTriggerId:K=null}=Z,Y=K10(G,{modal:z,open:Q,openProp:H,activeTriggerId:K,triggerIdProp:U});Y.useControlledProp("openProp",H),Y.useControlledProp("triggerIdProp",U);let F=Y.useState("open"),W=Y.useState("mounted"),q=Y.useState("payload");Y.useContextCallback("onOpenChange",B),Y.useContextCallback("onOpenChangeComplete",X),nz(Y,F),T9(Y);let{forceUnmount:N}=C9(F,Y,()=>{Y.update({stickIfOpen:!0,openChangeReason:null})});Y.useSyncedValues({modal:z}),LQ.useEffect(()=>{if(!F)Y.context.stickIfOpenTimeout.clear()},[Y,F]),LQ.useImperativeHandle(Z.actionsRef,()=>({unmount:N,close:()=>Y.setOpen(!1,R0(K0.imperativeAction))}),[N,Y]);let V=F||W;return Y6.jsxs($V.Provider,{value:Y,children:[G&&Y6.jsx(j9,{handle:G,store:Y}),V&&Y6.jsx(Y10,{store:Y,modal:z}),typeof J==="function"?J({payload:q}):J]})});function bE($){if(d5(!0))return Y6.jsx(kE,{props:$});return Y6.jsx(a7,{children:Y6.jsx(kE,{props:$})})}function K10($,Z){let J=Q6((H,Q)=>new ZV(Z,H,Q));return LQ.useEffect(()=>J.context.stickIfOpenTimeout.disposeEffect(),[J]),J}function Y10({store:$,modal:Z}){let J=$.useState("floatingRootContext"),H=c8(J,{outsidePressEvent:{mouse:Z==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}}),Q=H.reference,B=H.floating;return w9($,{activeTriggerProps:Q,inactiveTriggerProps:Q,popupProps:B}),null}var jQ=P(m(),1);var yE=300;var xE=P(m(),1),JV=P(e4(),1);function xG($,Z){let J=xE.useRef(null);function H(B){JV.flushSync(()=>{$.setOpen(!1,R0(K0.focusOut,B.nativeEvent,B.currentTarget))}),QT(J.current)?.focus()}function Q(B){let X=$.select("positionerElement");if(X&&q3(B,X))$.context.beforeContentFocusGuardRef.current?.focus();else{JV.flushSync(()=>{$.setOpen(!1,R0(K0.focusOut,B.nativeEvent,B.currentTarget))});let z=HT($.context.triggerFocusTargetRef.current||Z.current);while(z!==null&&k0(X,z)){let G=z;if(z=_Z(z),z===G)break}z?.focus()}}return{preFocusGuardRef:J,handlePreFocusGuardFocus:H,handleFocusTargetFocus:Q}}var PQ=P(m(),1);var MQ=P(m(),1);function hE($){let Z=MQ.useRef(""),J=MQ.useCallback((Q)=>{if(Q.defaultPrevented)return;Z.current=Q.pointerType,$(Q,Q.pointerType)},[$]);return{onClick:MQ.useCallback((Q)=>{if(Q.detail===0){$(Q,"keyboard");return}if("pointerType"in Q)$(Q,Q.pointerType);else $(Q,Z.current);Z.current=""},[$]),onPointerDown:J}}var vE=P(m(),1);function h9($,Z){let J=vE.useRef($),H=U0(Z);J0(()=>{if(J.current!==$)H(J.current);J.current=$},[$,H])}function _Q($,Z){let J=U0((B,X)=>{if(!(typeof $==="function"?$():$))Z(X||(r1.os.ios?"touch":""))}),{onClick:H,onPointerDown:Q}=hE(J);return PQ.useMemo(()=>({onClick:H,onPointerDown:Q}),[H,Q])}function gE($){let[Z,J]=PQ.useState(null),H=_Q($,J);return h9($,(Q)=>{if(Q&&!$)J(null)}),PQ.useMemo(()=>({openMethod:Z,triggerProps:H}),[Z,H])}var fZ=P(c(),1),fE=A9(function(Z,J){let{render:H,className:Q,style:B,disabled:X=!1,nativeButton:z=!0,handle:G,payload:U,openOnHover:K=!1,delay:Y=yE,closeDelay:F=0,id:W,...q}=Z,N=d5(!0),A=R9(G)??N;if(!A)throw Error(y0(74));let D=t0(W),L=A.useState("isTriggerActive",D),j=A.useState("floatingRootContext"),M=A.useState("isOpenedByTrigger",D),_=A.useState("triggerPopupId",D),E=jQ.useRef(null),{registerTrigger:C,isMountedByThisTrigger:R}=O9(D,E,A,{payload:U,disabled:X,openOnHover:K,closeDelay:F}),T=A.useState("openChangeReason"),I=A.useState("stickIfOpen"),y=A.useState("openMethod"),S=A.useState("focusManagerModal"),O=l8(j,{enabled:!X&&K&&(y!=="touch"||T!==K0.triggerPress),mouseOnly:!0,move:!1,handleClose:i8(),restMs:Y,delay:{close:F},triggerElementRef:E,isActiveTrigger:L,isClosing:()=>A.select("transitionStatus")==="ending"}),b=D3(j,{stickIfOpen:I}),k=_Q(()=>A.select("open"),(d)=>{A.set("openMethod",d)}),h=A.useState("triggerProps",R),{getButtonProps:v,buttonRef:f}=T5({disabled:X,native:z}),w={open(d){if(d&&T===K0.triggerPress)return rH.open(d);return V9.open(d)}},{preFocusGuardRef:i,handlePreFocusGuardFocus:r,handleFocusTargetFocus:x}=xG(A,E),s=z0("button",Z,{state:{disabled:X,open:M},ref:[f,J,C,E],props:[b.reference,O,h,k,{[jZ]:"",id:D,"aria-haspopup":"dialog","aria-expanded":M,"aria-controls":_},q,v],stateAttributesMapping:w}),p=fZ.jsx(jQ.Fragment,{children:s},D);if(R&&!S)return fZ.jsxs(jQ.Fragment,{children:[fZ.jsx(x4,{ref:i,onFocus:r}),p,fZ.jsx(x4,{ref:A.context.triggerFocusTargetRef,onFocus:x})]});return p});var uE=P(m(),1);var hG=P(m(),1),HV=hG.createContext(void 0);function mE(){let $=hG.useContext(HV);if($===void 0)throw Error(y0(45));return $}var QV=P(c(),1),pE=uE.forwardRef(function(Z,J){let{keepMounted:H=!1,...Q}=Z;if(!(d5().useState("mounted")||H))return null;return QV.jsx(HV.Provider,{value:H,children:QV.jsx(l7,{ref:J,...Q})})});var uG=P(m(),1);var vG=P(m(),1),BV=vG.createContext(void 0);function mZ(){let $=vG.useContext(BV);if(!$)throw Error(y0(46));return $}var cE=P(m(),1),dE=P(c(),1),uZ=cE.forwardRef(function(Z,J){let{cutout:H,...Q}=Z,B;if(H){let X=H.getBoundingClientRect();B=`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 dE.jsx("div",{ref:J,role:"presentation","data-base-ui-inert":"",...Q,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:B}})});var nE=P(m(),1);var lE={},iE={},rE="";function gG($,Z){return zQ($)?$:Z}function aE($,Z,J){return/hidden|clip/.test($.getComputedStyle(gG(Z,J)).overflowY)}function F10($){if(typeof document>"u")return!1;let Z=m0($);return R1(Z).innerWidth-Z.documentElement.clientWidth>0}function W10($){if(!(typeof CSS<"u"&&CSS.supports&&CSS.supports("scrollbar-gutter","stable"))||typeof document>"u")return!1;let J=m0($),H=J.documentElement,Q=J.body,B=gG(H,Q),X=B.style.overflowY,z=H.style.scrollbarGutter;H.style.scrollbarGutter="stable",B.style.overflowY="scroll";let G=B.offsetWidth;B.style.overflowY="hidden";let U=B.offsetWidth;return B.style.overflowY=X,H.style.scrollbarGutter=z,G===U}function q10($){let Z=m0($),J=Z.documentElement,H=Z.body,Q=gG(J,H),B={overflowY:Q.style.overflowY,overflowX:Q.style.overflowX};return Object.assign(Q.style,{overflowY:"hidden",overflowX:"hidden"}),()=>{Object.assign(Q.style,B)}}function N10($){let Z=m0($),J=Z.documentElement,H=Z.body,Q=R1(J),B=0,X=0,z=!1,G=b2.create();if(r1.engine.webkit&&(Q.visualViewport?.scale??1)!==1)return()=>{};function U(){let W=Q.getComputedStyle(J),q=Q.getComputedStyle(H),A=(W.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";B=J.scrollTop,X=J.scrollLeft,lE={scrollbarGutter:J.style.scrollbarGutter,overflowY:J.style.overflowY,overflowX:J.style.overflowX},rE=J.style.scrollBehavior,iE={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 D=J.scrollHeight>J.clientHeight,L=J.scrollWidth>J.clientWidth,j=W.overflowY==="scroll"||q.overflowY==="scroll",M=W.overflowX==="scroll"||q.overflowX==="scroll",_=Math.max(0,Q.innerWidth-H.clientWidth),E=Math.max(0,Q.innerHeight-H.clientHeight),C=parseFloat(q.marginTop)+parseFloat(q.marginBottom),R=parseFloat(q.marginLeft)+parseFloat(q.marginRight),T=gG(J,H);if(z=W10($),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"}),D||j)J.style.overflowY="scroll";if(L||M)J.style.overflowX="scroll";Object.assign(H.style,{position:"relative",height:C||E?`calc(100dvh - ${C+E}px)`:"100dvh",width:R||_?`calc(100vw - ${R+_}px)`:"100vw",boxSizing:"border-box",overflowY:"hidden",overflowX:"hidden",scrollBehavior:"unset"}),H.scrollTop=B,H.scrollLeft=X,J.setAttribute("data-base-ui-scroll-locked",""),J.style.scrollBehavior="unset"}function K(){if(Object.assign(J.style,lE),Object.assign(H.style,iE),!z)J.scrollTop=B,J.scrollLeft=X,J.removeAttribute("data-base-ui-scroll-locked"),J.style.scrollBehavior=rE}function Y(){K(),G.request(U)}U();let F=n0(Q,"resize",Y);return()=>{if(G.cancel(),K(),typeof Q.removeEventListener==="function")F()}}class oE{lockCount=0;restore=null;timeoutLock=c5.create();timeoutUnlock=c5.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,Q=R1(J);if(aE(Q,J,H)){let X=new Q.MutationObserver(()=>{if(aE(Q,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 B=r1.os.ios||!F10($);this.restore=B?q10($):N10($)}}var A10=new oE;function fG($=!0,Z=null){J0(()=>{if(!$)return;return A10.acquire(Z)},[$,Z])}var V10=20;function mG($,Z,J,H){let[Q,B]=nE.useState(!1);J0(()=>{if(!$||!Z||J==null){B(!1);return}let X=m0(J).documentElement.clientWidth,z=J.offsetWidth;B(X>0&&z>0&&z>=X-V10)},[$,Z,J]),fG($&&(!Z||Q),H)}var OQ=P(c(),1),sE=uG.forwardRef(function(Z,J){let{render:H,className:Q,style:B,anchor:X,positionMethod:z,side:G,align:U,sideOffset:K,alignOffset:Y,collisionBoundary:F="clipping-ancestors",collisionPadding:W,arrowPadding:q,sticky:N,disableAnchorTracking:V=!1,collisionAvoidance:A=P9,...D}=Z,L=d5(),j=mE(),M=V3(),_=L.useState("floatingRootContext"),E=L.useState("mounted"),C=L.useState("open"),R=L.useState("openChangeReason"),T=L.useState("activeTriggerElement"),I=L.useState("modal"),y=L.useState("openMethod"),S=L.useState("positionerElement"),O=L.useState("instantType"),b=L.useState("transitionStatus"),k=L.useState("adaptiveOrigin"),h=uG.useRef(null),v=h4(S),f=k9({anchor:X,floatingRootContext:_,positionMethod:z,mounted:E,side:G,sideOffset:K,align:U,alignOffset:Y,arrowPadding:q,collisionBoundary:F,collisionPadding:W,sticky:N,disableAnchorTracking:V,keepMounted:j,nodeId:M,collisionAvoidance:A,adaptiveOrigin:k}),w=_.useState("domReferenceElement");J0(()=>{let s=w,p=h.current;if(s)h.current=s;if(p&&s&&s!==p){L.set("instantType",void 0);let d=new AbortController;return v(()=>{L.set("instantType","trigger-change")},d.signal),()=>{d.abort()}}return},[w,v,L]);let i=I===!0&&R!==K0.triggerHover;mG(C&&i,y==="touch",S,T);let r=L.useStateSetter("positionerElement"),x={open:C,side:f.side,align:f.align,anchorHidden:f.anchorHidden,instant:O},l=y9(Z,x,{styles:f.positionerStyles,transitionStatus:b,props:D,refs:[J,r],hidden:!E,inert:!C});return OQ.jsxs(BV.Provider,{value:f,children:[E&&i&&OQ.jsx(uZ,{inert:D8(!C),cutout:T}),OQ.jsx(r7,{id:M,children:l})]})});var JS=P(m(),1);var pZ="ArrowUp",cZ="ArrowDown",dZ="ArrowLeft",lZ="ArrowRight",iZ="Home",rZ="End",XV="PageUp",zV="PageDown",n8=new Set([pZ,cZ,dZ,lZ,iZ,rZ]),D10="Shift",eE=[D10,"Control","Alt","Meta"];function L10($){return P1($)&&$.tagName==="INPUT"}function GV($){if(L10($)&&$.selectionStart!=null)return!0;if(P1($)&&$.tagName==="TEXTAREA")return!0;return!1}function UV($,Z,J,H){if(!$||!Z||!Z.scrollTo)return;let{scrollLeft:Q,scrollTop:B}=$,X=$.clientWidth<$.scrollWidth,z=$.clientHeight<$.scrollHeight;if(X&&H!=="vertical"){let G=tE($,Z,"left"),U=pG($),K=pG(Z);if(J==="ltr"){if(G+Z.offsetWidth+K.scrollMarginRight>$.scrollLeft+$.clientWidth-U.scrollPaddingRight)Q=G+Z.offsetWidth+K.scrollMarginRight-$.clientWidth+U.scrollPaddingRight;else if(G-K.scrollMarginLeft<$.scrollLeft+U.scrollPaddingLeft)Q=G-K.scrollMarginLeft-U.scrollPaddingLeft}if(J==="rtl"){if(G-K.scrollMarginLeft<$.scrollLeft+U.scrollPaddingLeft)Q=G-K.scrollMarginLeft-U.scrollPaddingLeft;else if(G+Z.offsetWidth+K.scrollMarginRight>$.scrollLeft+$.clientWidth-U.scrollPaddingRight)Q=G+Z.offsetWidth+K.scrollMarginRight-$.clientWidth+U.scrollPaddingRight}}if(z&&H!=="horizontal"){let G=tE($,Z,"top"),U=pG($),K=pG(Z);if(G-K.scrollMarginTop<$.scrollTop+U.scrollPaddingTop)B=G-K.scrollMarginTop-U.scrollPaddingTop;else if(G+Z.offsetHeight+K.scrollMarginBottom>$.scrollTop+$.clientHeight-U.scrollPaddingBottom)B=G+Z.offsetHeight+K.scrollMarginBottom-$.clientHeight+U.scrollPaddingBottom}$.scrollTo({left:Q,top:B,behavior:"auto"})}function tE($,Z,J){let H=J==="left"?"offsetLeft":"offsetTop",Q=0;while(Z.offsetParent){if(Q+=Z[H],Z.offsetParent===$)break;Z=Z.offsetParent}return Q}function pG($){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 cG=P(m(),1),M10=cG.createContext(void 0);function dG($){let Z=cG.useContext(M10);if(Z===void 0&&!$)throw Error(y0(69));return Z}var F6=P(m(),1);var KV=F6.createContext(void 0);function $S(){let[$,Z]=F6.useState(0),J=U0(()=>{return Z((Q)=>Q+1),()=>{Z((Q)=>Math.max(0,Q-1))}});return{context:F6.useMemo(()=>({register:J}),[J]),hasClosePart:$>0}}function ZS(){let $=F6.useContext(KV);J0(()=>{return $?.register()},[$])}var YV=P(c(),1),HS=JS.forwardRef(function(Z,J){let{render:H,className:Q,style:B,initialFocus:X,finalFocus:z,...G}=Z,U=d5(),K=mZ(),Y=dG(!0)!=null,{context:F,hasClosePart:W}=$S(),q=U.useState("open"),N=U.useState("openMethod"),V=U.useState("instantType"),A=U.useState("transitionStatus"),D=U.useState("popupProps"),L=U.useState("titleElementId"),j=U.useState("descriptionElementId"),M=U.useState("modal"),_=U.useState("mounted"),E=U.useState("openChangeReason"),C=U.useState("activeTriggerElement"),R=U.useState("floatingRootContext"),T=R.useState("floatingId"),I=U.useState("disabled"),y=U.useState("openOnHover"),S=U.useState("closeDelay");W5({open:q,ref:U.context.popupRef,onComplete(){if(q)U.context.onOpenChangeComplete?.(!0)}}),L3(R,{enabled:y&&!I,closeDelay:S});let O=X===void 0?az(U.context.popupRef):X,b=M!==!1&&W;U.useSyncedValue("focusManagerModal",b);let k=U.useStateSetter("popupElement"),h={open:q,side:K.side,align:K.align,instant:V,transitionStatus:A},v=z0("div",Z,{state:h,ref:[J,U.context.popupRef,k],props:[D,{id:T,role:"dialog",..._9,"aria-labelledby":L,"aria-describedby":j,onKeyDown(f){if(Y&&n8.has(f.key))f.stopPropagation()}},b9(A),G],stateAttributesMapping:a2});return YV.jsx(o7,{context:R,openInteractionType:N,modal:b,disabled:!_||E===K0.triggerHover,initialFocus:O,returnFocus:z,restoreFocus:"popup",previousFocusableElement:P1(C)?C:void 0,nextFocusableElement:U.context.triggerFocusTargetRef,beforeContentFocusGuardRef:U.context.beforeContentFocusGuardRef,children:YV.jsx(KV.Provider,{value:F,children:v})})});var QS=P(m(),1);var BS=QS.forwardRef(function(Z,J){let{render:H,className:Q,style:B,...X}=Z,G=d5().useState("open"),{arrowRef:U,side:K,align:Y,arrowUncentered:F,arrowStyles:W}=mZ();return z0("div",Z,{state:{open:G,side:K,align:Y,uncentered:F},ref:[J,U],props:[{style:W,"aria-hidden":!0},X],stateAttributesMapping:s4})});var XS=P(m(),1);var zS=XS.forwardRef(function(Z,J){let{render:H,className:Q,style:B,...X}=Z,z=d5(),G=z.useState("open"),U=z.useState("mounted"),K=z.useState("transitionStatus"),Y=z.useState("openChangeReason");return z0("div",Z,{state:{open:G,transitionStatus:K},ref:J,props:[{role:"presentation",hidden:!U,style:{pointerEvents:Y===K0.triggerHover?"none":void 0,userSelect:"none",WebkitUserSelect:"none"}},X],stateAttributesMapping:a2})});var GS=P(m(),1);var US=GS.forwardRef(function(Z,J){let{render:H,className:Q,style:B,...X}=Z,z=d5(),G=t0(X.id);return z.useSyncedValueWithCleanup("titleElementId",G),z0("h2",Z,{ref:J,props:[{id:G},X]})});var KS=P(m(),1);var YS=KS.forwardRef(function(Z,J){let{render:H,className:Q,style:B,...X}=Z,z=d5(),G=t0(X.id);return z.useSyncedValueWithCleanup("descriptionElementId",G),z0("p",Z,{ref:J,props:[{id:G},X]})});var FS=P(m(),1);var WS=FS.forwardRef(function(Z,J){let{render:H,className:Q,style:B,disabled:X=!1,nativeButton:z=!0,...G}=Z,{buttonRef:U,getButtonProps:K}=T5({disabled:X,focusableWhenDisabled:!1,native:z}),Y=d5();return ZS(),z0("button",Z,{ref:[J,U],props:[{onClick(W){Y.setOpen(!1,R0(K0.closePress,W.nativeEvent))}},G,K]})});var qS=P(m(),1);var NS=qS.forwardRef(function(Z,J){let{render:H,className:Q,style:B,children:X,...z}=Z,G=d5(),{side:U}=mZ(),K=G.useState("instantType"),{children:Y,state:F}=z6({store:G,side:U,children:X}),W={activationDirection:F.activationDirection,transitioning:F.transitioning,instant:K};return z0("div",Z,{state:W,ref:J,props:[z,{children:Y}],stateAttributesMapping:X6})});class lG extends d8{constructor(){super(SE(),"Popover")}open($){this.openByTrigger($)}close(){this.closePopup()}get isOpen(){return this.attachedStore?.select("open")??!1}}function AS(){return new lG}var W6=P(c(),1);function q6({...$}){return W6.jsx(T3.Root,{"data-slot":"popover",...$})}function N6({...$}){return W6.jsx(T3.Trigger,{"data-slot":"popover-trigger",...$})}function A6({className:$,align:Z="center",alignOffset:J=0,side:H="bottom",sideOffset:Q=4,keepMounted:B,...X}){return W6.jsx(_8,{portal:T3.Portal,keepMounted:B,children:W6.jsx(T3.Positioner,{align:Z,alignOffset:J,side:H,sideOffset:Q,className:"isolate z-50",children:W6.jsx(T3.Popup,{"data-slot":"popover-content",className:a0("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 VS({className:$,...Z}){return W6.jsx("div",{"data-slot":"popover-header",className:a0("flex flex-col gap-0.5 text-sm",$),...Z})}function DS({className:$,...Z}){return W6.jsx(T3.Title,{"data-slot":"popover-title",className:a0("font-medium",$),...Z})}var rG=P(m(),1),X$=P(c(),1),P10=($,Z)=>`mo-root${$==="always"?" mo-always":""}${Z?" mo-expr":""}`;function _10($){let Z=Math.round($.num("motion.blink",3500,6500)),J=Math.round($.num("motion.saccade",4200,7600)),H=$.num("motion.lookX",1,2.2),Q=$.num("motion.lookY",0.8,1.7),B=(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:B(H)*($.bool("motion.lookXFlip")?-1:1),lookY:B(Q)*($.bool("motion.lookYFlip")?-1:1),lookMX:B(H),lookMY:B(Q)}}function j10($){let Z=(H)=>`${-H}ms`,J=_10($);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 FV({l:$,c:Z,h:J}){let H=J*Math.PI/180,Q=Z*Math.cos(H),B=Z*Math.sin(H),X=$+0.3963377774*Q+0.2158037573*B,z=$-0.1055613458*Q-0.0638541728*B,G=$-0.0894841775*Q-1.291485548*B,U=X*X*X,K=z*z*z,Y=G*G*G;return[4.0767416621*U-3.3077115913*K+0.2309699292*Y,-1.2684380046*U+2.6097574011*K-0.3413193965*Y,-0.0041960863*U-0.7034186147*K+1.707614701*Y]}var LS=($)=>$.every((Z)=>Z>=-0.0001&&Z<=1.0001);function jS($){let Z=FV($);if(!LS(Z)){let J=0,H=$.c;for(let Q=0;Q<12;Q++){let B=(J+H)/2;if(LS(FV({...$,c:B})))J=B;else H=B}Z=FV({...$,c:J})}return Z.map((J)=>Math.min(1,Math.max(0,J)))}function MS($){let[Z,J,H]=jS($);return 0.2126*Z+0.7152*J+0.0722*H}function iG($,Z){let J=MS($),H=MS(Z);return(Math.max(J,H)+0.05)/(Math.min(J,H)+0.05)}function OS($,Z,J){if(iG($,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)),iG(z,Z)>=J)return z;if(z.l===0||z.l===1)break}}let Q={...$,l:0,c:0},B={...$,l:1,c:0};return iG(Q,Z)>=iG(B,Z)?Q:B}function O10($){return"#"+jS($).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 PS=[[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}]],T10=($)=>PS.find(([Z])=>$<Z)?.[1]??PS[0][1],C10={l:0.145,c:0,h:0},w10=1.5,E10=($,Z)=>{let J=T10(Z),H=OS({l:J.l,c:J.c,h:$},C10,w10);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:$}}},S10=[["head","bg",1.25],["eye","head",4.5]];function R10($,Z=!0,J=0){let H=E10($,J);if(Z)for(let[Q,B,X]of S10)H[Q]=OS(H[Q],H[B],X);return H}function I10($,Z=!0,J=0){let H=R10($,Z,J),Q={};for(let B in H)Q[B]=O10(H[B]);return Q}var V5=($)=>{let Z=Math.round($*100)/100;return Object.is(Z,-0)?"0":String(Z)};function WV({cx:$,cy:Z,rx:J,ry:H,n:Q=4,rot:B=0}){let X=Math.min(1,(8*Math.pow(2,-1/Q)-4)/3),z=J,G=H,U=z*X,K=G*X,Y=[[z,0],[z,K],[U,G],[0,G],[-U,G],[-z,K],[-z,0],[-z,-K],[-U,-G],[0,-G],[U,-G],[z,-K],[z,0]],F=B*Math.PI/180,W=Math.cos(F),q=Math.sin(F),N=(A)=>{let[D,L]=Y[A];return`${V5($+D*W-L*q)} ${V5(Z+D*q+L*W)}`},V=`M${N(0)}`;for(let A=1;A<13;A+=3)V+=`C${N(A)} ${N(A+1)} ${N(A+2)}`;return V+"Z"}function k10($,Z,J,H,Q,B=0){let X=Q.length,z=B*Math.PI/180,G=Q.map((Y,F)=>{let W=z+2*Math.PI*F/X;return[$+J*Y*Math.cos(W),Z+H*Y*Math.sin(W)]}),U=(Y)=>G[(Y%X+X)%X],K=`M${V5(U(0)[0])} ${V5(U(0)[1])}`;for(let Y=0;Y<X;Y++){let[F,W]=U(Y-1),[q,N]=U(Y),[V,A]=U(Y+1),[D,L]=U(Y+2);K+=`C${V5(q+(V-F)/6)} ${V5(N+(A-W)/6)} ${V5(V-(D-q)/6)} ${V5(A-(L-N)/6)} ${V5(V)} ${V5(A)}`}return K+"Z"}function b10({cx:$,cy:Z,rx:J,ry:H,sides:Q,round:B=0.3,rot:X=0}){let z=B>0?B<1?B/2:0.5:0,G=X*Math.PI/180-Math.PI/2,U=Array.from({length:Q},(W,q)=>{let N=G+2*Math.PI*q/Q;return[$+J*Math.cos(N),Z+H*Math.sin(N)]}),K=(W)=>U[(W%Q+Q)%Q],Y=(W,q)=>{let[N,V]=K(W),[A,D]=K(q);return`${V5(N+(A-N)*z)} ${V5(V+(D-V)*z)}`},F=`M${Y(0,-1)}`;for(let W=0;W<Q;W++){let[q,N]=K(W);if(F+=`Q${V5(q)} ${V5(N)} ${Y(W,W+1)}`,z<0.5)F+=`L${Y(W+1,W)}`}return F+"Z"}function y10($,Z,J,H){let Q=V5($-J),B=V5($+J);return`M${Q} ${V5(Z-H)}H${B}V${V5(Z+H)}H${Q}Z`}function x10($,Z,J,H,Q){let B=Math.max(1.05,Q),X=J*Math.sqrt(1-1/(B*B)),z=Z-H/B,G=Z-B*H,U=X*0.14,K=z+0.86*(G-z);return`M${V5($-X)} ${V5(z)}L${V5($-U)} ${V5(K)}Q${V5($)} ${V5(G)} ${V5($+U)} ${V5(K)}L${V5($+X)} ${V5(z)}Z`}function qV($,Z){for(let J=0;J<Z.length;J++)$=Math.imul($^Z[J],3432918353),$=$<<13|$>>>19;return $}function h10($){return $=Math.imul($^$>>>16,2246822507),$=Math.imul($^$>>>13,3266489909),($^$>>>16)>>>0}var TS=new TextEncoder;function v10($){return $.normalize("NFC").trim().toLowerCase()}function g10($,Z=!0){let J=Z?v10($):$;return qV(1779033703^J.length,TS.encode(J))}function _S($,Z){return h10(qV(qV($,Uint8Array.of(255)),TS.encode(Z)))/4294967296}function f10($,Z=!0,J){let H=g10($,Z),Q=(B)=>{let X=J?.[B],z=Array.isArray(X)?X[Math.floor(_S(H,B)*X.length)]:X;return z===void 0?_S(H,B):z>0?z<1?z:0.999999:0};return Q.num=(B,X,z)=>X+Q(B)*(z-X),Q.int=(B,X,z)=>X+Math.floor(Q(B)*(z-X+1)),Q.pick=(B,X)=>X[Math.floor(Q(B)*X.length)],Q.bool=(B,X=0.5)=>Q(B)<X,Q.jitter=(B,X)=>(Q(B)*2-1)*X,Q}function CS($,Z,J){let H=Z.expression;if(J||!H)return{l:$,wrap:""};return H.bake($,H.p)}var m10=($,Z)=>Z?.tint?Z.tint($,Z.p):$,wS=($,Z)=>Z?`<g transform="${Z}">${$}</g>`:$,u10=($)=>$.replace(/[&<>]/g,(Z)=>Z==="&"?"&amp;":Z==="<"?"&lt;":"&gt;");function ES($,Z){let J=f10($,Z.normalize??!0,Z.traits);return{t:J,palette:{...I10(Z.hue??J.num("hue",0,360),Z.contrast??!0,Z.tone??J("tone")),...Z.palette}}}var p10=($)=>$.title?`<title>${u10($.title)}</title>`:"";function SS($,Z,J){let H=Z.background??$.background;if(H===!1)return;return{d:H==="square"?"M0 0H100V100H0Z":WV({cx:50,cy:50,rx:50,ry:50,n:H==="circle"?2:6}),fill:J.bg}}var c10=($)=>$?`<path d="${$.d}" fill="${$.fill}"/>`:"";function d10($){return(Z,J={})=>{let{t:H,palette:Q}=ES(Z,J),B=m10(Q,J.expression),X=J.size?` width="${J.size}" height="${J.size}"`:"",z=CS($.layout(H),J),G=p10(J)+c10(SS($,J,B))+wS($.render(z.l,B),z.wrap);return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"${X}>${G}</svg>`}}function l10($){return(Z,J={},H)=>{let{t:Q,palette:B}=ES(Z,J),X=H?.(Q,B),z=CS($.layout(Q),J,X);return{cls:X?.cls,bg:SS($,J,B),inner:wS($.render(z.l,B,!!X),z.wrap),vars:X?.vars}}}var i10=($,Z,J)=>{let H=Z.rx,Q=$.num("eye.rx",0.075,0.105)*H,B=$.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=Q*Math.max(1,X),K=Q*B*Math.max(1,X*z),Y=U+H*0.03+G,F=$.jitter("gaze.x",0.09)*J.rx,W=$.num("gaze.y",-0.2,0.08)*J.ry,q=$.jitter("eye.dy",0.04)*J.ry,N=Math.hypot(U,K),V=Math.hypot((Math.abs(F)+Y+N)/J.rx,(Math.abs(W)+Math.abs(q)+N)/J.ry),A=V>0.9?0.9/V:1,D=Q*A,L=D*B,j=Y*A,M=Math.max(0,Math.min(1,G/K)),_=Math.min(12,Math.asin(M)*180/Math.PI),E=$.num("eye.lean",-1,1)*_,C=Math.max(-12,Math.min(12,E+$.jitter("eye.lean2",3.5))),R=J.cx+F*A,T=J.cy+W*A;return[{cx:R-j,cy:T,rx:D,ry:L,n:$.num("eye.n",3.5,6),rot:E},{cx:R+j,cy:T+q*A,rx:D*X,ry:L*X*z,n:$.num("eye.n",3.5,6),rot:C}]};function r10($,Z){let J=(B)=>($.find(([,X])=>B<X)??$[$.length-1])[0];function H(B){let X=J(B("shape")),z=B.num("body.r",31,38)*X.core,G={cx:50+B.jitter("body.x",1.5),cy:50+B.jitter("body.y",1.5),rx:z,ry:z*B.num("body.ratio",0.92,1.08),n:B.num("body.n",1.9,2.5),rot:0,radii:Array.from({length:B.int("body.pts",6,8)},(Y,F)=>1+B.jitter(`body.r${F}`,0.16))};X.body?.(B,G);let U=X.face?.(G)??G,K={petals:[],extra:[]};return X.decorate?.(B,G,K),{shape:X.name,draw:X.path,body:G,face:U,petals:K.petals,extra:K.extra,eyes:Z(B,G,U)}}function Q(B,X,z){let G=(Y)=>Math.round(Y*100)/100,U=(Y,F)=>{let W=`<path d="${WV(Y)}"/>`;return z?`<g class="mo-eye" style="--mo-wrap:${F?1:-1};--mo-lean:${G(Y.rot)};transform-origin:${G(Y.cx)}px ${G(Y.cy)}px">${W}</g>`:W},K=`<g fill="${X.head}">`+B.petals.map((Y)=>`<circle cx="${G(Y.cx)}" cy="${G(Y.cy)}" r="${G(Y.r)}"/>`).join("")+B.extra.map((Y)=>`<path d="${Y}"/>`).join("")+`<path d="${B.draw?B.draw(B.body):WV(B.body)}"/></g><g fill="${X.eye}"${z?' class="mo-eyes"':""}>`+B.eyes.map(U).join("")+"</g>";return z?`<g class="mo-breathe"><g class="mo-bob">${K}</g></g>`:K}return{layout:H,render:Q,background:!1}}var RS=($)=>b10($),IS=($)=>k10($.cx,$.cy,$.rx,$.ry,$.radii,$.rot),NV=($)=>(Z)=>({cx:Z.cx,cy:Z.cy,rx:Z.rx*$,ry:Z.ry*$}),kS=($)=>NV(Math.min(...$.radii)*0.95)($),a10=($)=>NV(0.84)($),o10={name:"round",core:1},n10={name:"organic",core:0.98,path:IS,face:kS},s10={name:"boxy",core:0.86,body:($,Z)=>{Z.n=$.num("body.n",3.4,6),Z.rot=$.num("body.rot",-20,20)}},t10={name:"capsule",core:1.02,body:($,Z)=>{Z.ry*=$.num("capsule.squat",0.55,0.68)},face:NV(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:($)=>y10($.cx,$.cy,$.rx-$.ry,$.ry)},e10={name:"nub",core:0.88,decorate:($,Z,J)=>{let H=$.int("nub.n",1,2);for(let Q=0;Q<H;Q++){let B=$.num(`nub.a${Q}`,0,2*Math.PI);J.petals.push({cx:Z.cx+Math.cos(B)*Z.rx*0.88,cy:Z.cy+Math.sin(B)*Z.rx*0.88,r:Z.rx*$.num(`nub.r${Q}`,0.24,0.4)})}}},$50={name:"cloud",core:0.78,face:kS,path:IS,decorate:($,Z,J)=>{let H=$.int("cloud.n",4,6);for(let Q=0;Q<H;Q++){let B=Math.PI+Math.PI*(Q+0.5)/H;J.petals.push({cx:Z.cx+Math.cos(B)*Z.rx*0.8,cy:Z.cy+Math.sin(B)*Z.rx*0.5,r:Z.rx*$.num(`cloud.r${Q}`,0.44,0.62)})}}},Z50={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(x10(Z.cx,Z.cy,Z.rx,Z.ry,$.num("droplet.tip",1.4,1.65)))}},J50={name:"hexagon",core:1.05,path:RS,face:a10,body:($,Z)=>{Z.sides=6,Z.rot=$.num("body.rot",-12,12),Z.round=$.num("poly.round",0.24,0.5)}},H50={name:"sun",core:0.7,decorate:($,Z,J)=>{let H=$.int("sun.n",6,9),Q=Z.rx*$.num("sun.dist",1,1.08),B=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)*Q,cy:Z.cy+Math.sin(G)*Q,r:B})}}},Q50={name:"triangle",core:1.15,path:RS,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})},B50=[[o10,0.22],[n10,0.48],[s10,0.6],[t10,0.7],[e10,0.79],[$50,0.86],[Z50,0.915],[J50,0.95],[H50,0.98],[Q50,1]],bS=r10(B50,i10),X50=d10(bS),z50=($,Z)=>(J,H)=>{let Q=Z?Z.vars(Z.p):{},B=Z?.tint?Z.tint(H,Z.p):H;return{cls:P10($,!!Object.keys(Q).length||!!Z?.tint),vars:{...j10(J),"--mo-head":B.head,"--mo-eye":B.eye,...Q}}};function G50($,Z={}){return l10(bS)($,Z,Z.animate&&z50(Z.animate,Z.expression))}function U50($,Z){return"data:image/svg+xml,"+X50($,Z).replace(/"/g,"'").replace(/[%#<>{}|\\^[\]`]/g,(J)=>"%"+J.charCodeAt(0).toString(16).toUpperCase()).replace(/\s+/g," ")}function yS({name:$,size:Z,background:J,palette:H,hue:Q,tone:B,normalize:X,contrast:z,title:G,animate:U,expression:K,traits:Y,...F}){let W={size:Z,background:J,palette:H,hue:Q,tone:B,normalize:X,contrast:z,title:G,expression:K,traits:Y},q=JSON.stringify([$,W,U]),N=rG.useMemo(()=>U?"":U50($,W),[q]),V=rG.useMemo(()=>U?G50($,{...W,animate:U}):null,[q]),A=rG.useMemo(()=>({__html:V?.inner??""}),[V?.inner]);if(V){let{style:j,...M}=F;return X$.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:{...V.vars,...j},...M,children:[G?X$.jsx("title",{children:G}):null,V.bg?X$.jsx("path",{d:V.bg.d,fill:V.bg.fill}):null,X$.jsx("g",{className:V.cls,dangerouslySetInnerHTML:A})]})}let{alt:D,...L}=F;return X$.jsx("img",{src:N,width:Z,height:Z,alt:D??G??"",...L})}var aG=yS;var sZ={};C5(sZ,{Root:()=>hS,Image:()=>fS,Fallback:()=>mS});var oZ=P(m(),1);var oG=P(m(),1),AV=oG.createContext(void 0);function nG(){let $=oG.useContext(AV);if($===void 0)throw Error(y0(13));return $}var aZ={imageLoadingStatus:()=>null};var xS=P(c(),1),hS=oZ.forwardRef(function(Z,J){let{className:H,render:Q,style:B,...X}=Z,[z,G]=oZ.useState("idle"),U={imageLoadingStatus:z},K=oZ.useMemo(()=>({imageLoadingStatus:z,setImageLoadingStatus:G}),[z,G]),Y=z0("span",Z,{state:U,ref:J,props:X,stateAttributesMapping:aZ});return xS.jsx(AV.Provider,{value:K,children:Y})});var TQ=P(m(),1);var vS=P(m(),1);function gS($,{referrerPolicy:Z,crossOrigin:J,sizes:H,srcSet:Q},B){let X=vS.useState("idle"),z=X[1];return J0(()=>{if(!B)return X1;if(!$&&!Q)return z("error"),X1;let G=!0,U=new window.Image,K=(Y)=>()=>{if(!G)return;z(Y)};if(z("loading"),U.onload=K("loaded"),U.onerror=K("error"),Z)U.referrerPolicy=Z;if(U.crossOrigin=J??null,H)U.sizes=H;if(Q)U.srcset=Q;if($)U.src=$;if(U.complete)z(U.naturalWidth>0?"loaded":"error");return()=>{G=!1}},[B,$,Q,H,J,Z,z]),X}var K50={...aZ,...Q2},fS=TQ.forwardRef(function(Z,J){let{className:H,render:Q,onLoadingStatusChange:B,keepMounted:X=!1,style:z,sizes:G,srcSet:U,src:K,...Y}=Z,{setImageLoadingStatus:F}=nG(),[W,q]=gS(K,Z,!X),N=W==="loaded",{mounted:V,transitionStatus:A,setMounted:D}=j2(N),L=TQ.useRef(null),j=TQ.useRef(!0);J0(()=>{if(!X)return;let I=j.current;j.current=!1;let y=L.current;if(!y)return;if(!y.complete){q("loading");return}let S=y.naturalWidth>0?"loaded":"error";if(q(S),S==="loaded"&&I)D(!0)},[X,K,U,G,Y.crossOrigin,Y.referrerPolicy,Q,q,D]);let M=X?{"data-loading":W==="loading"?"":void 0,"data-error":W==="error"?"":void 0,"aria-hidden":W!=="loaded"||void 0,onLoad(){q("loaded")},onError(){q("error")}}:void 0,_=U0((I)=>{B?.(I),F(I)});J0(()=>{if(W!=="idle")_(W)},[W,_]),J0(()=>{return()=>F("idle")},[F]),W5({enabled:!N,open:N,ref:L,onComplete(){if(!N)D(!1)}});let E={imageLoadingStatus:W,transitionStatus:X&&A==="ending"?void 0:A},C=X||V,R={};if(G!==void 0)R.sizes=G;if(U!==void 0)R.srcSet=U;if(K!==void 0)R.src=K;let T=z0("img",Z,{state:E,ref:[J,L],props:[M,Y,R],stateAttributesMapping:K50,enabled:C});if(!C)return null;return T});var nZ=P(m(),1);var mS=nZ.forwardRef(function(Z,J){let{className:H,render:Q,delay:B=0,style:X,...z}=Z,{imageLoadingStatus:G}=nG(),[U,K]=nZ.useState(B===0),Y=d1();return nZ.useEffect(()=>{if(B>0)Y.start(B,()=>K(!0));else K(!0);return Y.clear},[Y,B]),z0("span",Z,{state:{imageLoadingStatus:G},ref:J,props:z,stateAttributesMapping:aZ,enabled:G!=="loaded"&&(B===0||U)})});var z$=P(c(),1);function uS({className:$,size:Z="default",...J}){return z$.jsx(sZ.Root,{"data-slot":"avatar","data-size":Z,className:a0("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 pS({className:$,...Z}){return z$.jsx(sZ.Image,{"data-slot":"avatar-image",className:a0("aspect-square size-full rounded-full object-cover",$),...Z})}function cS({className:$,...Z}){return z$.jsx(sZ.Fallback,{"data-slot":"avatar-fallback",className:a0("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 dS({className:$,...Z}){return z$.jsx("span",{"data-slot":"avatar-badge",className:a0("absolute right-0 bottom-0 size-(--avatar-badge-size) rounded-full bg-primary select-none",$),...Z})}function lS({className:$,...Z}){return z$.jsx("div",{"data-slot":"avatar-group",className:a0("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 iS({className:$,size:Z="default",...J}){return z$.jsx("div",{"data-slot":"avatar-group-count","data-size":Z,className:a0("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})}var k5=P(m(),1);function V6($){return $.name?.trim()||$.email?.trim()||$.id}function rS($,Z){let J=$.filter((H)=>H.userId===Z);return J.some((H)=>H.location?.status==="active")?"active":J.length?"away":"offline"}function aS($,Z,J){if(J!==void 0)return J;let H=new Map($.map((Q)=>[Q.id,Q]));if(Z)H.set(Z.id,Z);return[...H.values()]}function tZ($,Z){let J=$.users.find((H)=>H.id===Z);return J?{...J,status:rS($.connections,Z)}:void 0}function oS($,Z,J,{scope:H="page",status:Q}={}){let B=[],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=tZ($,z);if(G&&(!Q||G.status===Q))B.push(G)}return B}function nS($,Z){return[...Z.users].sort((H,Q)=>Number(Q.id===Z.currentUser?.id)-Number(H.id===Z.currentUser?.id)).map((H)=>{let Q=new Set;for(let X of $){if(X.userId!==H.id||X.connectionId===Z.connectionId)continue;if(X.location)Q.add(X.location.page)}let B=H.id===Z.currentUser?.id;if(B&&Z.page)Q.add(Z.page);return{profile:H,self:B,pages:[...Q],status:rS($,H.id)}})}function sS($,Z,J=()=>!0){let H=!1,Q=()=>{if(!H)return;H=!1,$.deletePresence(Z.registrationId)};return{publish(B,X){if(!X||!J(B)){Q();return}H=!0,$.setPresence({...Z,value:B})},clear:Q}}function VV(){let $=O3();return k5.useSyncExternalStore($.subscribe,$.getUsersSnapshot,$.getUsersSnapshot)}function DV(){let $=O3();return k5.useSyncExternalStore($.subscribeWorkspaceUsers,$.getWorkspaceDirectory,$.getWorkspaceDirectory)}function eZ(){let $=O3(),Z=VV(),J=k5.useSyncExternalStore($.subscribeCurrentUser,$.getCurrentUser,$.getCurrentUser),H=DV(),Q=k5.useMemo(()=>aS(Z.users,J,H?.status==="loading"?[]:H?.users),[Z.users,J,H]);return{state:Z,self:J,users:Q,engine:$}}function D6($){let{state:Z,users:J}=eZ();return k5.useMemo(()=>tZ({...Z,users:J},$),[Z,J,$])}function tS($){let{state:Z,users:J}=eZ();return $.map((H)=>tZ({...Z,users:J},H))}function sG({status:$}={}){let{state:Z,users:J}=eZ();return k5.useMemo(()=>J.map((H)=>tZ({...Z,users:J},H.id)).filter((H)=>!$||H.status===$),[Z,J,$])}function tG(){let{state:$,self:Z,users:J}=eZ();return k5.useMemo(()=>Z?tZ({...$,users:J},Z.id):void 0,[$,Z,J])}function eS($={}){let{state:Z,self:J,users:H,engine:Q}=eZ(),{scope:B,status:X}=$;return k5.useMemo(()=>oS({...Z,users:H},J?.id,Q.getLocation(),{scope:B,status:X}),[Z,J,H,Q,B,X])}var $J={custom:($)=>`custom:${$}`,cursor:($)=>`cursor:${$}`,target:($)=>`field:${$}`};function $R($){return CQ($J.custom($))}function CQ($){let{users:Z,engine:J}=eZ(),H=tA(),Q=H?.appletId??"",B=k5.useCallback(()=>J.getPresenceSnapshot(Q,$),[J,Q,$]),X=k5.useSyncExternalStore(J.subscribe,B,B);return k5.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 wQ($,Z,J){let H=O3(),Q=tA(),[B]=k5.useState(()=>crypto.randomUUID()),X=k5.useRef(Z),z=k5.useRef(!1),G=Q?.appletId??"",U=k5.useMemo(()=>sS(H,{registrationId:B,appletId:G,channel:$},J),[H,B,G,$,J]),K=k5.useCallback(()=>{U.publish(X.current,Q?.active===!0&&document.visibilityState!=="hidden")},[Q,U]);return k5.useLayoutEffect(()=>{if(!Q?.active)return;return z.current=!0,K(),document.addEventListener("visibilitychange",K),()=>{z.current=!1,document.removeEventListener("visibilitychange",K),U.clear()}},[Q,K,U]),k5.useCallback((Y)=>{if(X.current=Y,z.current)K()},[K])}function Y50($,Z,J){let H=wQ($,Z,J);k5.useLayoutEffect(()=>H(Z),[H,Z])}function ZR($,Z){Y50($J.custom($),Z)}var L6=P(c(),1);function M6({id:$,size:Z="default",showStatusBadge:J,className:H}){let Q=D6($),B=Q?V6(Q):"Unknown user";return L6.jsxs(uS,{size:Z,"aria-label":B,"data-collab-color":Q?.color??"unknown",className:H,children:[Q?.avatar&&L6.jsx(pS,{src:Q.avatar,alt:""}),L6.jsx(cS,{children:Q?L6.jsx(aG,{name:$,animate:"hover",background:"circle",traits:{shape:0,"body.r":1},palette:{bg:"var(--collab)",head:"var(--collab)",eye:"var(--collab-foreground)"}}):L6.jsx(eG,{size:Z==="xs"||Z==="sm"?12:16,stroke:1.75})}),J&&Q?.status==="active"&&L6.jsx(dS,{className:"bg-success"})]})}var v9=P(c(),1),F50="Unknown user";function $U({id:$,size:Z="default",showStatusBadge:J,showYouLabel:H,description:Q,className:B}){let X=D6($),z=tG(),G=X?V6(X):F50,U=X!==void 0&&X.id===z?.id;return v9.jsxs("span",{className:B0("inline-flex min-w-0 items-center gap-2",B),children:[v9.jsx(M6,{id:$,size:Z,showStatusBadge:J}),v9.jsxs("span",{className:B0("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:B0("truncate",!X&&"text-muted-foreground"),children:G}),H&&U&&v9.jsx("span",{className:"shrink-0 text-muted-foreground",children:"(You)"})]}),Q&&v9.jsxs("span",{className:B0("truncate text-muted-foreground",Z==="sm"&&"text-xs leading-tight"),children:[Z==="xs"&&v9.jsx("span",{"aria-hidden":"true",className:"whitespace-pre",children:" · "}),Q]})]})]})}var EQ=P(c(),1);function ZU({ids:$,max:Z=3,size:J="sm",className:H}){let Q=[...new Set($)],B=Q.slice(0,Z),X=Q.length-B.length;return EQ.jsxs(lS,{className:H,"aria-label":`${Q.length} users`,children:[B.map((z)=>EQ.jsx(M6,{id:z,size:J},z)),X>0&&EQ.jsxs(iS,{size:J,"aria-label":`${X} more`,children:["+",X]})]})}var n5=P(c(),1),JR={active:0,away:1,offline:2};function LV({workspaceId:$,describeTab:Z,onOpenTab:J}){let H=M4(),Q=O3(),B=VV(),X=sG(),z=DV(),G=JU.useSyncExternalStore(Q.subscribeCurrentUser,Q.getCurrentUser,Q.getCurrentUser),U=i2(),K=nA(b7(U),$,U.base),Y=nS(B.connections,{currentUser:G,connectionId:B.connectionId,users:X,page:K}),F=Y.filter((N)=>N.self||N.status!=="offline").map((N)=>N.profile.id),[W,q]=JU.useState(!1);if(!H)return null;return n5.jsxs(q6,{open:W,onOpenChange:q,children:[n5.jsxs(N6,{render:n5.jsx(j0,{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:[n5.jsx(ZU,{ids:F,size:"xs",max:4}),n5.jsx(ZJ,{stroke:2.5,className:"size-3! text-muted-foreground"})]}),n5.jsxs(A6,{align:"end",className:"max-w-64 p-1",children:[n5.jsx(DS,{className:"sr-only",children:"Users in this workspace"}),n5.jsx(W50,{users:Y,page:K,describeTab:Z,onOpenTab:(N)=>{q(!1),J(N)}}),z?.status==="loading"&&n5.jsx("p",{className:"px-2 py-1 text-xs text-muted-foreground",children:"Loading workspace users…"}),Y.length===0&&z?.status!=="loading"&&n5.jsx("p",{className:"px-2 py-1 text-xs text-muted-foreground",children:"No workspace users to show."})]})]})}function W50({users:$,page:Z,describeTab:J,onOpenTab:H}){let Q=$.toSorted((B,X)=>JR[B.status]-JR[X.status]||Number(X.self)-Number(B.self));return n5.jsx("ul",{className:"flex max-h-80 scroll-fade flex-col overflow-y-auto",children:Q.map((B)=>n5.jsx(q50,{user:B,page:Z,describeTab:J,onOpenTab:H},B.profile.id))})}function q50({user:$,page:Z,describeTab:J,onOpenTab:H}){let Q=$.pages.map((F)=>{let W=_3(F);return{tab:W,info:W?J(W):null}}),B=$.self||$.status==="offline"?void 0:Q.find(({tab:F,info:W})=>F!==null&&W!==null&&F!==Z),X=B?.tab,z=[...new Set(Q.map(({tab:F,info:W})=>W?.label??F??"Another tab"))].join(", "),G=$.status==="offline"?"Offline":$.status==="away"?z?`${z} · Away`:"Away":z||"Another tab",U=$.status==="offline"?void 0:Q[0]?.info?.Icon,K=n5.jsx($U,{id:$.profile.id,className:"flex-1",size:"sm",showYouLabel:!0,description:n5.jsxs("span",{className:"flex items-center gap-1 text-xs",children:[U&&n5.jsx(U,{size:12,stroke:1.75,className:"shrink-0"}),n5.jsx("span",{className:"truncate",children:G})]})}),Y="flex w-full items-center gap-2.5 rounded-md px-2 py-1 text-left";return n5.jsx("li",{children:X?n5.jsx("button",{type:"button",title:`Go to ${B?.info?.label}`,className:B0("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:K}):n5.jsx("div",{className:"flex w-full items-center gap-2.5 rounded-md px-2 py-1 text-left",children:K})})}var G$=P(m(),1);function HR($){return z0($.defaultTagName??"div",$,$)}var N50=JJ("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 HU({className:$,variant:Z="default",render:J,...H}){return HR({defaultTagName:"span",props:X2({className:a0(N50({variant:Z}),$)},H),render:J,state:{slot:"badge",variant:Z}})}var P6=P(m(),1);function QU(...$){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 MV=($)=>$!==!1&&$!==null,HJ=P6.createContext([]);function BU($){return QU(...P6.useContext(HJ),$)}function XU($,Z){let J=Z===void 0,H=P6.useRef(null),Q=$J.target($),B=CQ(Q),X=wQ(Q,!1,MV),z=(U,K)=>K!==null&&U instanceof Element&&U.closest("[data-presence-target]")===K;P6.useLayoutEffect(()=>{X(Z??z(document.activeElement,H.current))},[$,Z,X]);let G=new Map;for(let U of B)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 s8=P(c(),1);function A50($){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 BR({id:$="default",children:Z,className:J}){let H=G$.useRef(null),Q=G$.useRef(null);G$.useLayoutEffect(()=>{let K=H.current,Y=Q.current;if(!K||!Y)return;let F=()=>{Y.style.transform=`translate(${K.scrollLeft}px, ${K.scrollTop}px)`};return F(),K.addEventListener("scroll",F),()=>K.removeEventListener("scroll",F)},[]);let B=$J.cursor($),X=CQ(B),z=wQ(B,null,MV),G=new Map;for(let{connectionId:K,userId:Y,value:F}of X){let W=A50(F);if(W)G.set(K,{id:Y,point:W})}let U=(K)=>{if(K.pointerType==="touch")return;let Y=H.current;if(!Y||!(K.target instanceof Element)||K.target.closest("[data-collab-cursors]")!==Y)return;let F=Y.getBoundingClientRect(),W=K.target instanceof Element?K.target.closest("[data-collab-target]"):null,q=W&&Y.contains(W)?W:null,N=q?.getBoundingClientRect();z({x:K.clientX-F.left-Y.clientLeft+Y.scrollLeft,y:K.clientY-F.top-Y.clientTop+Y.scrollTop,...q&&N?{target:q.dataset.collabTarget??"",targetX:N.width?(K.clientX-N.left)/N.width:0,targetY:N.height?(K.clientY-N.top)/N.height:0}:{}})};return s8.jsxs("div",{ref:H,"data-collab-cursors":$,className:B0("relative",J),onPointerEnter:U,onPointerMove:U,onPointerLeave:(K)=>{if(K.target instanceof Element&&K.target.closest("[data-collab-cursors]")===K.currentTarget)z(null)},children:[Z,s8.jsx("div",{ref:Q,className:"pointer-events-none absolute inset-0 overflow-hidden","aria-hidden":"true",children:[...G].map(([K,{id:Y,point:F}])=>s8.jsx(V50,{root:H,point:F,id:Y},K))})]})}function V50({root:$,point:Z,id:J}){let H=G$.useRef(null);return G$.useLayoutEffect(()=>{let Q=$.current,B=H.current;if(!Q||!B)return;let X=(K=!1)=>{let Y=Z.x-Q.scrollLeft,F=Z.y-Q.scrollTop;if(Z.target){let q=[...Q.querySelectorAll("[data-collab-target]")].find((A)=>A.dataset.collabTarget===Z.target);if(!q){B.hidden=!0;return}let N=Q.getBoundingClientRect(),V=q.getBoundingClientRect();Y=V.left-N.left-Q.clientLeft+V.width*(Z.targetX??0),F=V.top-N.top-Q.clientTop+V.height*(Z.targetY??0)}let W=`translate(${Y}px, ${F}px)`;if(B.hidden||B.style.transform!==W)B.dataset.moving=K&&!B.hidden?"true":"false",B.style.transform=W;B.hidden=!1};X(!0);let z=()=>X(),G=new ResizeObserver(z);G.observe(Q);let U=new MutationObserver(z);return U.observe(Q,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["data-collab-target"]}),Q.addEventListener("scroll",z,!0),window.addEventListener("resize",z),()=>{G.disconnect(),U.disconnect(),Q.removeEventListener("scroll",z,!0),window.removeEventListener("resize",z)}},[$,Z]),s8.jsx(D50,{ref:H,id:J})}function D50({id:$,ref:Z}){let J=D6($);return s8.jsx("span",{ref:Z,hidden:!0,"aria-hidden":"true","data-collab-color":J?.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:s8.jsxs("span",{className:"relative block animate-in duration-200 zoom-in-75 fade-in",children:[s8.jsx(QR,{size:24,stroke:1.5,className:"-translate-x-0.5 -translate-y-0.5 fill-collab stroke-white drop-shadow-xs"}),s8.jsx(HU,{className:"absolute top-3.5 left-3.5 bg-collab text-collab-foreground",children:s8.jsx("span",{className:"truncate",children:J?V6(J):"Someone"})})]})})}var zU=P(m(),1);var _6=P(c(),1);function XR({id:$,present:Z,align:J,children:H,className:Q}){let B=BU($),X=XU(B,Z);return _6.jsx(L50,{...X.props,ids:X.users.map((z)=>z.id),align:J,className:Q,children:H})}function L50({ids:$,align:Z,children:J,className:H,...Q}){let B=tS($).filter((X)=>X!==void 0);return _6.jsxs("div",{className:B0("relative",H),...Q,children:[_6.jsx(_50,{names:B.map(V6).join(", "),color:B[0]?.color,align:Z}),J]})}var SQ=4,M50=6,P50=["borderTopLeftRadius","borderTopRightRadius","borderBottomRightRadius","borderBottomLeftRadius"];function _50({names:$,color:Z,align:J="end"}){let H=zU.useRef(null);return zU.useLayoutEffect(()=>{let Q=H.current,B=Q?.parentElement;if(!$||!Q||!B)return;let X=()=>{let G=[...B.children].filter((A)=>{if(A===Q)return!1;let{display:D,position:L}=getComputedStyle(A);return D!=="none"&&L!=="absolute"&&L!=="fixed"}),U=[...B.childNodes].some((A)=>A.nodeType===Node.TEXT_NODE&&A.textContent?.trim()),K=G.length===1&&!U?G[0]:null,Y=K instanceof HTMLElement?K:null,W=(Y??B).getBoundingClientRect(),q=B.getBoundingClientRect(),N=Q.style;N.left=`${W.left-q.left-B.clientLeft+B.scrollLeft-SQ}px`,N.top=`${W.top-q.top-B.clientTop+B.scrollTop-SQ}px`,N.width=`${W.width+SQ*2}px`,N.height=`${W.height+SQ*2}px`,N.setProperty("--presence-target-width",`${W.width}px`);let V=Y?getComputedStyle(Y):null;for(let A of P50)N[A]=V?`calc(${V[A]} + ${SQ}px)`:`${M50}px`};X();let z=new ResizeObserver(X);z.observe(B);for(let G of B.children)if(G!==Q)z.observe(G);return()=>z.disconnect()}),_6.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:_6.jsx(HU,{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:_6.jsx("span",{className:"truncate",children:$})})})}var QJ=P(m(),1);var GU=P(c(),1);function GR({id:$,children:Z}){let J=QJ.useContext(HJ),H=QJ.useMemo(()=>{return QU($),[...J,$]},[J,$]),Q=QJ.useId();return GU.jsx(zR,{reducedMotion:"user",children:GU.jsx(UU,{id:Q,children:GU.jsx(HJ,{value:H,children:Z})})})}var UR=P(m(),1);var U$=P(c(),1);function KR({id:$,present:Z,align:J,children:H,className:Q}){let B=BU($),X=XU(B,Z),z=UR.useContext(HJ).length>0;return U$.jsx(j50,{...X.props,users:X.users,animate:z&&Z===void 0,align:J,className:Q,children:H})}function j50({users:$,children:Z,animate:J=!1,align:H="center",className:Q,...B}){return U$.jsxs("div",{className:B0("relative pl-8",Q),...B,children:[Z,U$.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})=>U$.jsx(z5.span,{layoutId:J?`presence:${z}`:void 0,children:U$.jsx(M6,{id:X,size:"sm",className:"animate-in duration-200 zoom-in-75 fade-in"})},X))})]})}var PV={Cursors:BR,User:$U,UserAvatar:M6,UserAvatarGroup:ZU,PresenceFrame:XR,PresenceAvatars:KR,PresenceGroup:GR,useMe:tG,usePeers:eS,useUser:D6,useWorkspaceUsers:sG,usePresence:$R,usePublishPresence:ZR};var _V=($)=>`moi:collab:${$}:session`;function jV($){try{return sessionStorage.getItem(_V($))}catch{return null}}function OV($,Z){try{if(Z===null)sessionStorage.removeItem(_V($));else sessionStorage.setItem(_V($),Z)}catch{}}var RQ=P(m(),1);var TV={all:["app-ui"],selectedSession:($)=>["app-ui","selected-session",$]};function K$($,Z="shared"){let J=TV.selectedSession($);return Z==="browser-tab"?[...J,"browser-tab"]:J}function O50($,Z){return[...K$($,Z),"save"]}function T50($,Z,J,H="shared"){let Q=K$(Z,H),B=$.getQueryData(Q),X=B?.sessionId??null;if(B&&X===J)return null;return $.setQueryData(Q,{sessionId:J}),{sessionId:J,previousSessionId:X}}function C50($,Z,J,H,Q="shared"){let B=K$(Z,Q),X=$.getQueryData(B);if(J.sessionId!==H.sessionId&&X?.sessionId!==J.sessionId)return"conflict";if(X?.sessionId!==H.sessionId&&X?.sessionId!==H.previousSessionId)return"ignored";return $.setQueryData(B,J),"applied"}function w50($,Z,J,H){if(H)return;$.setQueryData(TV.selectedSession(Z),{sessionId:J})}function YR($,Z,J,H){for(let Q of["shared","browser-tab"])$.setQueryData(K$(Z,Q),(B)=>B?.sessionId===J?{sessionId:H}:B);if(jV(Z)===J)OV(Z,H)}function j6(){let $=e1(),J=M4()?"browser-tab":"shared",H=U1(),Q=RQ.useMemo(()=>K$($,J),[$,J]),B=RQ.useMemo(()=>O50($,J),[$,J]),X=VN({mutationKey:B,exact:!0}),z=J5({queryKey:Q,queryFn:()=>J==="browser-tab"?Promise.resolve({sessionId:jV($)}):q1(`/api/workspaces/${$}/selected-session`),staleTime:1/0,gcTime:0,refetchOnMount:!1,refetchOnWindowFocus:!1}),{mutate:G}=H5({mutationKey:B,scope:{id:`selected-session:${$}`},mutationFn:(Y)=>{if(J==="browser-tab")return OV($,Y.sessionId),Promise.resolve({sessionId:Y.sessionId});return q1(`/api/workspaces/${$}/selected-session`,g5("PUT",Y),"Couldn’t save selected chat")},onSuccess:(Y,F)=>{if(C50(H,$,Y,F,J)!=="conflict")return;A5.add({title:"Couldn’t save selected chat",type:"error"}),H.invalidateQueries({queryKey:Q})},onError:(Y,F)=>{if(H.getQueryData(Q)?.sessionId!==F.sessionId)return;A5.add({title:"Couldn’t save selected chat",type:"error"}),H.invalidateQueries({queryKey:Q})}}),U=RQ.useCallback((Y)=>{let F=T50(H,$,Y,J);if(F)G(F)},[H,G,$,J]);return W2((Y)=>{if(J==="browser-tab"||Y.type!=="selected-session:updated"||Y.workspaceId!==$)return;w50(H,$,Y.sessionId,X>0)}),[z.isLoading?void 0:z.data?.sessionId??null,U]}function WR($,Z){let{queryClient:J,sendMessage:H,onWorkspaceSwitch:Q}=Z,B=b1.getState();if($.type==="status_snapshot"){B.reconcileActivity($.sessions??[]);return}if($.type==="status"){let{workspaceId:U,sessionId:K,activity:Y}=$;if(B.setActivity(U,K,Y),Y!=="running")B.clearPreviewsForSession(U,K);return}if($.type==="preview"){let U=$,K=S0.events(U.workspaceId,U.sessionId);if(J?.getQueryData(K)===void 0)return;B.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:K,to:Y}=$,F=S0.sessions(U),q=J?.getQueryData(F)?.find((A)=>A.sessionId===K||A.sessionId===Y);if(q)J?.cancelQueries({queryKey:F});if(B.renameSession(U,K,Y),J)YR(J,U,K,Y);if(q)J?.setQueryData(F,(A)=>[{...q,sessionId:Y},...(A??[]).filter((D)=>D.sessionId!==K&&D.sessionId!==Y)]);let N=J?.getQueryData(S0.events(U,K));if(N!==void 0)J?.setQueryData(S0.events(U,Y),N),J?.removeQueries({queryKey:S0.events(U,K)});let V=J?.getQueryData(S0.sessionConfig(U,K));if(V!==void 0)J?.setQueryData(S0.sessionConfig(U,Y),V),J?.removeQueries({queryKey:S0.sessionConfig(U,K)});if(!q)J?.invalidateQueries({queryKey:F});J?.invalidateQueries({queryKey:S0.preview(U)});return}if($.type==="sessions_changed"){let U=$.workspaceId,K=S0.sessions(U);J?.invalidateQueries({queryKey:K}),J?.invalidateQueries({queryKey:S0.preview(U)});return}if($.type==="workspace:switch"){Q?.($.workspaceId);return}if($.type==="scratchpad:op"){let U=FR($.workspaceId);if(!U)return;let K=$.opId;U($.op).then((Y)=>H({type:"scratchpad:op-result",opId:K,result:Y}),(Y)=>H({type:"scratchpad:op-result",opId:K,error:Y instanceof Error?Y.message:String(Y)}));return}let{workspaceId:X,sessionId:z}=$;if(!X||!z)return;let G=$.kind;if(G==="snapshot"||G==="turn"||G==="notice"||G==="result"){if(E50(J,X,z,$),G==="turn"){let U=$.turn?.meta?.apiMessageId;if(U)B.clearPreview(U)}if(G==="result")B.clearPreviewsForSession(X,z)}if(G==="error"&&typeof $.content==="string"){if(B.setError(X,z,$.content),$.terminal!==!1)B.setActivity(X,z,"idle"),B.clearPreviewsForSession(X,z)}if(G==="stopped")B.setActivity(X,z,"idle"),B.clearPreviewsForSession(X,z)}function E50($,Z,J,H){if(!$)return;NE($,Z,J,H);let Q=S0.events(Z,J),B=$.getQueryData(Q);if(B===void 0)return;$.setQueryData(Q,SG(B,H))}var wV=null,BJ=null,KU=0,YU=null,CV=[],NR=null,qR=null,S50=15000;function AR($){if(wV=$,!qR)qR=setInterval(()=>b1.getState().sweepPreviews(S50,Date.now()),5000);if(BJ)return;VR()}function VR(){let $=++KU;if(YU)clearTimeout(YU),YU=null;let Z=new WebSocket(kG("/ws"));BJ=Z,Z.onopen=()=>{if(KU!==$){Z.close();return}for(let J of CV)Z.send(JSON.stringify(J));CV.length=0,wV?.invalidateQueries({queryKey:["workspaces","events"]}),b1.getState().clearAllPreviews()},Z.onmessage=(J)=>{if(KU!==$)return;let H;try{H=JSON.parse(J.data)}catch{return}R50(H)},Z.onclose=()=>{if(KU!==$)return;BJ=null,YU=setTimeout(VR,1000)},Z.onerror=()=>Z.close()}function R50($){WR($,{queryClient:wV,sendMessage:FU,onWorkspaceSwitch:NR})}function FU($){if(BJ&&BJ.readyState===WebSocket.OPEN)BJ.send(JSON.stringify($));else CV.push($)}function EV($){NR=$}var ZN=P(m(),1);var I50=($)=>DR()(MR((Z)=>({discoveredWorkspacesOpen:!0,hasSentMessageFromMoi:!1,workspaceIdsPendingAnalysis:[],composerDrafts:{},viewBuilderDrafts:{},dockedChatWidth:360,setDiscoveredWorkspacesOpen:(J)=>Z({discoveredWorkspacesOpen:J}),markWorkspacePendingAnalysis:(J)=>Z((H)=>{let Q=H.workspaceIdsPendingAnalysis??[];return{workspaceIdsPendingAnalysis:Q.includes(J)?Q:[...Q,J]}}),markMessageSentFromMoi:(J)=>Z((H)=>({hasSentMessageFromMoi:!0,workspaceIdsPendingAnalysis:(H.workspaceIdsPendingAnalysis??[]).filter((Q)=>Q!==J)})),setComposerDraft:(J,H)=>Z((Q)=>{let B={...Q.composerDrafts??{}};if(H)B[J]=H;else delete B[J];return{composerDrafts:B}}),setViewBuilderDraft:(J,H)=>Z((Q)=>{let B=Q.viewBuilderDrafts??{};if(H===null){if(!(J in B))return Q;let X={...B};return delete X[J],{viewBuilderDrafts:X}}if(B[J]===H)return Q;return{viewBuilderDrafts:{...B,[J]:H}}}),setDockedChatWidth:(J)=>Z({dockedChatWidth:J})}),$?{name:"moi:ui",storage:LR(()=>$)}:{name:"moi:ui"})),w5=I50();function PR($,Z){let J=$??[],H=J.findIndex((Q)=>Q.id===Z.id||Q.path===Z.path);if(H===-1)return[Z,...J];return J.map((Q,B)=>B===H?{...Q,...Z}:Q)}function WU(){return J5({queryKey:S0.all,queryFn:()=>q1("/api/workspaces"),staleTime:1/0,refetchOnMount:"always"})}function qU($){return J5({queryKey:S0.preview($),queryFn:()=>q1(`/api/workspaces/${$}/preview`),staleTime:60000})}function _R(){return J5({queryKey:S0.discover,queryFn:()=>q1("/api/workspaces/discover")})}function jR(){let $=U1();return H5({mutationFn:(Z)=>q1("/api/workspaces",g5("POST",Z),"Failed to add workspace"),onSuccess:(Z,J)=>{w5.getState().markWorkspacePendingAnalysis(Z.id),$.setQueryData(S0.all,(H)=>PR(H,Z)),$.setQueryData(S0.discover,(H)=>(H??[]).filter((Q)=>Q.path!==J.path))}})}function NU(){return J5({queryKey:S0.setupInfo,queryFn:()=>q1("/api/workspaces/create"),staleTime:30000,refetchOnMount:"always"})}function OR(){let $=U1();return H5({mutationFn:(Z)=>q1("/api/workspaces/create",g5("POST",Z),"Failed to create workspace"),onSuccess:(Z)=>{$.setQueryData(S0.all,(J)=>PR(J,Z))}})}function TR(){let $=U1();return H5({mutationFn:(Z)=>q1("/api/workspaces/order",g5("PUT",{ids:Z}),"Failed to reorder spaces"),onMutate:async(Z)=>{await $.cancelQueries({queryKey:S0.all,exact:!0});let J=$.getQueryData(S0.all);if(J){let H=new Map(J.map((B)=>[B.id,B])),Q=Z.map((B)=>H.get(B)).filter((B)=>Boolean(B));if(Q.length===J.length)$.setQueryData(S0.all,Q)}return{previous:J}},onError:(Z,J,H)=>{if(H?.previous)$.setQueryData(S0.all,H.previous);$.invalidateQueries({queryKey:S0.all,exact:!0})},onSuccess:(Z)=>{$.setQueryData(S0.all,Z)}})}function CR(){let $=U1();return H5({mutationFn:(Z)=>P4(`/api/workspaces/${Z}`,{method:"DELETE"},"Failed to remove workspace"),onSuccess:(Z,J)=>{$.setQueryData(S0.all,(H)=>(H??[]).filter((Q)=>Q.id!==J)),$.invalidateQueries({queryKey:S0.discover})}})}var kR=P(m(),1);var wR=P(c(),1);function J8({className:$,...Z}){return wR.jsx(b5,{"data-slot":"spinner",role:"status","aria-label":"Loading",className:a0("size-4 animate-spin",$),stroke:1.75,...Z})}var SV="Wait for active agents to finish, or stop them before updating moi";var k50=["update"],ER=300000,b50=1000;function SR($){return J5({queryKey:k50,queryFn:()=>q1("/api/update"),staleTime:ER,refetchInterval:$?b50:ER,refetchOnWindowFocus:!0,retry:!1})}function RR(){return H5({mutationFn:()=>q1("/api/update",{method:"POST"},"Could not update moi")})}var C3=P(c(),1);function y50($,Z){return!!Z&&$?.runningVersion===Z}function x50($,Z,J){let H=Z||J,Q=$&&!H;return{busy:H,blocked:Q,label:Z?"Updating":J?"Restarting":Q?SV:"Update"}}function bR(){let $=RR(),Z=SR($.isSuccess),J=g2((z)=>YE(z.activity)),H=Z.data,Q=$.data?.installedVersion??null;if(kR.useEffect(()=>{if(y50(H,Q))window.location.reload()},[Q,H]),Z.isPending)return{status:"loading"};if(!H?.availableVersion&&!$.isSuccess)return{status:"unavailable"};let B=$.isSuccess;return{status:"available",button:{...x50(J,$.isPending,B),errorMessage:$.error?.message??null,onClick:()=>$.mutate()}}}function yR({busy:$,blocked:Z,label:J,errorMessage:H,onClick:Q}){return C3.jsxs(Q5,{children:[C3.jsx(B5,{render:C3.jsx("div",{children:C3.jsx(j0,{type:"button",size:"icon",variant:$?"ghost":"default","aria-label":J,disabled:Z||$,onClick:Q,children:$?C3.jsx(J8,{stroke:1.5}):C3.jsx(IR,{stroke:1.5})})})}),C3.jsx(X5,{side:"right",className:Z?"max-w-56":void 0,children:Z?SV:H??J})]})}var $B=P(m(),1);var t8={};C5(t8,{createHandle:()=>eR,Viewport:()=>wU,Trigger:()=>SU,Title:()=>EU,Root:()=>oR,Portal:()=>OU,Popup:()=>jU,Handle:()=>XJ,Description:()=>LU,Close:()=>DU,Backdrop:()=>VU});var xR=P(m(),1);var AU=P(m(),1),RV=AU.createContext(void 0);function T2($){let Z=AU.useContext(RV);if(!$&&Z===void 0)throw Error(y0(27));return Z}var VU=xR.forwardRef(function(Z,J){let{render:H,className:Q,style:B,forceRender:X=!1,...z}=Z,G=T2(),U=G.useState("open"),K=G.useState("nested"),Y=G.useState("mounted"),F=G.useState("transitionStatus");return z0("div",Z,{state:{open:U,transitionStatus:F},ref:[G.context.backdropRef,J],stateAttributesMapping:a2,props:[{role:"presentation",hidden:!Y,style:{userSelect:"none",WebkitUserSelect:"none"}},z],enabled:X||!K})});var hR=P(m(),1);var DU=hR.forwardRef(function(Z,J){let{render:H,className:Q,style:B,disabled:X=!1,nativeButton:z=!0,...G}=Z,U=T2(),K=U.useState("open"),{getButtonProps:Y,buttonRef:F}=T5({disabled:X,native:z}),W={disabled:X};function q(N){if(K)U.setOpen(!1,R0(K0.closePress,N.nativeEvent))}return z0("button",Z,{state:W,ref:[J,F],props:[{onClick:q},G,Y]})});var vR=P(m(),1);var LU=vR.forwardRef(function(Z,J){let{render:H,className:Q,style:B,id:X,...z}=Z,G=T2(),U=t0(X);return G.useSyncedValueWithCleanup("descriptionElementId",U),z0("p",Z,{ref:J,props:[{id:U},z]})});var mR=P(m(),1);var MU=P(m(),1),IV=MU.createContext(void 0);function PU(){let $=MU.useContext(IV);if($===void 0)throw Error(y0(26));return $}var gR="--nested-dialogs";var Ox0=f7.open,Tx0=f7.closed,Cx0=f7.startingStyle,wx0=f7.endingStyle;var fR="data-nested-dialog-open";var _U={...s4,...Q2,nestedDialogOpen($){return $?{[fR]:""}:null}};var uR=P(c(),1),jU=mR.forwardRef(function(Z,J){let{render:H,className:Q,style:B,finalFocus:X,initialFocus:z,...G}=Z,U=T2(),K=U.useState("descriptionElementId"),Y=U.useState("disablePointerDismissal"),F=U.useState("floatingRootContext"),W=U.useState("popupProps"),q=U.useState("modal"),N=U.useState("mounted"),V=U.useState("nested"),A=U.useState("nestedOpenDialogCount"),D=U.useState("open"),L=U.useState("openMethod"),j=U.useState("titleElementId"),M=U.useState("transitionStatus"),_=U.useState("role"),E=F.useState("floatingId");PU(),W5({open:D,ref:U.context.popupRef,onComplete(){if(D)U.context.onOpenChangeComplete?.(!0)}});let C=z===void 0?az(U.context.popupRef):z,R=A>0,T=U.useStateSetter("popupElement"),y=z0("div",Z,{state:{open:D,nested:V,transitionStatus:M,nestedDialogOpen:R},props:[W,{id:E,"aria-labelledby":j,"aria-describedby":K,role:_,..._9,hidden:!N,onKeyDown(S){if(n8.has(S.key))S.stopPropagation()},style:{[gR]:A}},G],ref:[J,U.context.popupRef,T],stateAttributesMapping:_U});return uR.jsx(o7,{context:F,openInteractionType:L,disabled:!N,closeOnFocusOut:!Y,initialFocus:C,returnFocus:X,modal:q!==!1,restoreFocus:"popup",children:y})});var pR=P(m(),1);var IQ=P(c(),1),OU=pR.forwardRef(function(Z,J){let{keepMounted:H=!1,...Q}=Z,B=T2(),X=B.useState("mounted"),z=B.useState("modal"),G=B.useState("open");if(!(X||H))return null;return IQ.jsx(IV.Provider,{value:H,children:IQ.jsxs(l7,{ref:J,...Q,children:[X&&z===!0&&IQ.jsx(uZ,{ref:B.context.internalBackdropRef,inert:D8(!G)}),Z.children]})})});var aR=P(m(),1);var kV=P(m(),1);function cR({store:$,parentContext:Z,isDrawer:J}){let H=$.useState("open"),Q=$.useState("disablePointerDismissal"),B=$.useState("modal"),X=$.useState("popupElement"),z=$.useState("floatingRootContext"),[G,U]=kV.useState(0),[K,Y]=kV.useState(0),F=G===0,W=c8(z,{outsidePressEvent(){if($.context.internalBackdropRef.current||$.context.backdropRef.current)return"intentional";return{mouse:B==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}},outsidePress(q){if(!$.context.outsidePressEnabledRef.current)return!1;if("button"in q&&q.button!==0)return!1;if("touches"in q){if(q.type==="touchend"){if(q.changedTouches.length!==1||q.touches.length!==0)return!1}else if(q.touches.length!==1)return!1}let N=M1(q);if(F&&!Q){if(B){let V=$.context.internalBackdropRef.current,A=$.context.backdropRef.current;return V||A?V===N||A===N||k0(N,X)&&!N?.hasAttribute("data-base-ui-portal"):!0}return!0}return!1},escapeKey:F});return fG(H&&B===!0,X),$.useContextCallback("onNestedDialogOpen",(q,N)=>{U(q),Y(N)}),J0(()=>{if(Z?.onNestedDialogOpen)if(H)Z.onNestedDialogOpen(G+1,K+(J?1:0));else Z.onNestedDialogOpen(0,0);return()=>{if(Z?.onNestedDialogOpen&&H)Z.onNestedDialogOpen(0,0)}},[J,H,G,K,Z]),w9($,{activeTriggerProps:W.reference,inactiveTriggerProps:W.trigger,popupProps:W.floating,nestedOpenDialogCount:G,nestedOpenDrawerCount:K}),null}var TU=P(m(),1);var dR={...S9,modal:($)=>$.modal,nested:($)=>$.nested,nestedOpenDialogCount:($)=>$.nestedOpenDialogCount,nestedOpenDrawerCount:($)=>$.nestedOpenDrawerCount,disablePointerDismissal:($)=>$.disablePointerDismissal,openMethod:($)=>$.openMethod,descriptionElementId:($)=>$.descriptionElementId,titleElementId:($)=>$.titleElementId,viewportElement:($)=>$.viewportElement,role:($)=>$.role};class bV extends k2{constructor($,Z,J){let H=new O2,Q=iR($,H,Z,J);super(Q,rR(H),dR)}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(s7(this.state,$,Z.trigger))}}function lR(){let $=new O2;return new r8(Object.freeze(iR(void 0,$)),Object.freeze(rR($)),dR)}function iR($,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 rR($){return{popupRef:TU.createRef(),backdropRef:TU.createRef(),internalBackdropRef:TU.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:$,onOpenChange:void 0,onOpenChangeComplete:void 0}}var kQ=P(c(),1);function CU($,Z){let{children:J,open:H,defaultOpen:Q=!1,onOpenChange:B,onOpenChangeComplete:X,disablePointerDismissal:z=!1,modal:G=!0,actionsRef:U,handle:K,triggerId:Y,defaultTriggerId:F=null}=Z,W=$==="drawer",q=$==="alert-dialog",N=q?!0:G,V=q||z,A=q?"alertdialog":"dialog",D=T2(!0),L=D!=null,j={modal:N,disablePointerDismissal:V,nested:L,role:A},M=Q6((I,y)=>new bV({open:Q,openProp:H,activeTriggerId:F,triggerIdProp:Y,...j},I,y),!0);M.useControlledProp("openProp",H),M.useControlledProp("triggerIdProp",Y),M.useSyncedValues(j),M.useContextCallback("onOpenChange",B),M.useContextCallback("onOpenChangeComplete",X);let _=M.useState("open"),E=M.useState("mounted"),C=M.useState("payload");nz(M,_),T9(M);let{forceUnmount:R}=C9(_,M);aR.useImperativeHandle(U,()=>({unmount:R,close:()=>M.setOpen(!1,R0(K0.imperativeAction))}),[R,M]);let T=_||E;return kQ.jsxs(RV.Provider,{value:M,children:[K&&kQ.jsx(j9,{handle:K,store:M}),T&&kQ.jsx(cR,{store:M,parentContext:D?.context,isDrawer:W}),typeof J==="function"?J({payload:C}):J]})}var oR=v8(function(Z){return CU("dialog",Z)});var nR=P(m(),1);var wU=nR.forwardRef(function(Z,J){let{render:H,className:Q,style:B,children:X,...z}=Z,G=PU(),U=T2(),K=U.useState("open"),Y=U.useState("nested"),F=U.useState("transitionStatus"),W=U.useState("nestedOpenDialogCount"),q=U.useState("mounted"),N=U.useStateSetter("viewportElement"),V=W>0;return z0("div",Z,{enabled:G||q,state:{open:K,nested:Y,transitionStatus:F,nestedDialogOpen:V},ref:[J,N],stateAttributesMapping:_U,props:[{role:"presentation",hidden:!q,style:{pointerEvents:!K?"none":void 0},children:X},z]})});var sR=P(m(),1);var EU=sR.forwardRef(function(Z,J){let{render:H,className:Q,style:B,id:X,...z}=Z,G=T2(),U=t0(X);return G.useSyncedValueWithCleanup("titleElementId",U),z0("h2",Z,{ref:J,props:[{id:U},z]})});var tR=P(m(),1);var SU=A9(function(Z,J){let{render:H,className:Q,style:B,disabled:X=!1,nativeButton:z=!0,id:G,payload:U,handle:K,...Y}=Z,F=T2(!0),q=R9(K)??F;if(!q)throw Error(y0(79));let N=t0(G),V=q.useState("floatingRootContext"),A=q.useState("isOpenedByTrigger",N),D=q.useState("triggerPopupId",N),L=tR.useRef(null),{registerTrigger:j,isMountedByThisTrigger:M}=O9(N,L,q,{payload:U}),{getButtonProps:_,buttonRef:E}=T5({disabled:X,native:z}),C=D3(V),R=_Q(()=>q.select("open"),(y)=>{q.set("openMethod",y)}),T={disabled:X,open:A},I=q.useState("triggerProps",M);return z0("button",Z,{state:T,ref:[E,J,j,L],props:[C.reference,I,R,{[jZ]:"",id:N,"aria-haspopup":"dialog","aria-expanded":A,"aria-controls":D},Y,_],stateAttributesMapping:V9})});class XJ extends d8{constructor(){super(lR(),"Dialog",!1)}open($){this.openByTrigger($)}openWithPayload($){let Z=this.attachedStore;if(Z===null)return;Z.set("payload",$),Z.setOpen(!0,R0(K0.imperativeAction))}close(){this.closePopup()}get isOpen(){return this.attachedStore?.select("open")??!1}}function eR(){return new XJ}var $4=P(c(),1);function O6({...$}){return $4.jsx(t8.Root,{"data-slot":"dialog",...$})}function w3({...$}){return $4.jsx(t8.Trigger,{"data-slot":"dialog-trigger",...$})}function g50({...$}){return $4.jsx(_8,{portal:t8.Portal,"data-slot":"dialog-portal",...$})}function bQ({...$}){return $4.jsx(t8.Close,{"data-slot":"dialog-close",...$})}function f50({className:$,...Z}){return $4.jsx(t8.Backdrop,{"data-slot":"dialog-overlay",className:a0("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 zJ({className:$,children:Z,showCloseButton:J=!0,...H}){return $4.jsxs(g50,{children:[$4.jsx(f50,{}),$4.jsxs(t8.Popup,{"data-slot":"dialog-content",className:a0("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&&$4.jsxs(bQ,{render:$4.jsx(j0,{variant:"ghost",size:"icon-sm",className:"absolute top-4 right-4"}),children:[$4.jsx(o5,{stroke:1.75}),$4.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function T6({className:$,...Z}){return $4.jsx(t8.Title,{"data-slot":"dialog-title",className:a0("text-lg font-semibold",$),...Z})}function GJ({className:$,...Z}){return $4.jsx(t8.Description,{"data-slot":"dialog-description",className:a0("text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",$),...Z})}var LI=P(m(),1);var pU={};C5(pU,{Validity:()=>VI,Root:()=>UI,Label:()=>YI,Item:()=>DI,Error:()=>FI,Description:()=>qI,Control:()=>NI});var w2=P(m(),1);var RU=P(m(),1);var $I="data-valid",ZI="data-invalid";var Y$={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},u50={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},JI={disabled:!1,...u50},C2={valid($){if($===null)return null;if($)return{[$I]:""};return{[ZI]:""}}};var p50={invalid:void 0,name:void 0,validityData:{state:Y$,errors:[],error:"",value:"",initialValue:null},setValidityData:X1,disabled:void 0,setTouched:X1,setDirty:X1,setFilled:X1,setFocused:X1,validationMode:"onSubmit",shouldValidateOnChange:()=>!1,state:JI,registerFieldControl:X1,validation:{getValidationProps:($,Z=L1)=>Z,inputRef:{current:null},registeredInputs:new Map,registerInput:X1,getInputControl:()=>null,commit:async()=>{},change:X1}},yV=RU.createContext(p50);function l5($=!0){let Z=RU.useContext(yV);if(Z.setValidityData===X1&&!$)throw Error(y0(28));return Z}var IU=P(m(),1),c50=IU.createContext(void 0);function HI($=!1){let Z=IU.useContext(c50);if(!Z&&!$)throw Error(y0(86));return Z}var kU=P(m(),1);var d50=kU.createContext({elementRef:{current:null},formRef:{current:{fields:new Map}},errors:{},clearErrors:X1,validationMode:"onSubmit",submitCountRef:{current:0}});function Z4(){return kU.useContext(d50)}var C6=P(m(),1);var bU=P(m(),1);var xV=bU.createContext({controlId:void 0,registerControlId:X1,resetControlId:X1,labelId:void 0,setLabelId:X1,messageIds:[],setMessageIds:X1,getDescriptionProps:($)=>$});function i5(){return bU.useContext(xV)}var QI=P(c(),1),yU=function(Z){let J=t0(),[H,Q]=C6.useState(J),[B,X]=C6.useState(),[z,G]=C6.useState([]),U=H===void 0?J:H,K=l1(()=>new Map),{messageIds:Y}=i5(),F=U0((V,A)=>{let D=K.current;if(A===void 0)D.delete(V);else D.set(V,A);Q((L)=>{if(D.size===0)return L;let j;for(let M of D.values()){if(M===L)return L;if(j===void 0)j=M}return j})}),W=U0(()=>{if(K.current.size===0)Q(J)}),q=C6.useCallback((V)=>{let A=V["aria-describedby"]?V["aria-describedby"].split(" "):[];return A.push(...Y,...z),{...V,"aria-describedby":Array.from(new Set(A)).join(" ")||void 0}},[Y,z]),N=C6.useMemo(()=>({controlId:U,registerControlId:F,resetControlId:W,labelId:B,setLabelId:X,messageIds:z,setMessageIds:G,getDescriptionProps:q}),[U,F,W,B,X,z,G,q]);return QI.jsx(xV.Provider,{value:N,children:Z.children})};var E3=P(m(),1);function F$($,Z){return{...$,state:{...$.state,valid:!Z&&$.state.valid}}}var hV=Object.keys(Y$);function l50($,Z){if($.matches(":disabled"))return!1;if(!Z||$.form===Z)return!0;return $.form===null&&!$.hasAttribute("form")}function BI($,Z){let J=null;for(let H of $.keys()){if(!l50(H,Z))continue;if(!H.validity.valid)return H;J??=H}return J}function XI($){return{...Y$,valid:!$,customError:$}}function vV($){return $&&$.validationMessage?[$.validationMessage]:[]}function zI($){let{elementRef:Z,formRef:J}=Z4(),{setValidityData:H,validate:Q,validityData:B,validationDebounceTime:X,invalid:z,markedDirtyRef:G,state:U,shouldValidateOnChange:K,validationMode:Y,registeredFieldIdRef:F}=$,{controlId:W,getDescriptionProps:q}=i5(),N=d1(),V=E3.useRef(null),A=l1(()=>new Map).current,D=E3.useRef(0),L=E3.useRef(null),j=E3.useCallback((R,T)=>{return A.set(R,T),()=>{A.delete(R)}},[A]),M=U0(()=>{let R=BI(A,Z.current);return R&&A.get(R)?.controlRef.current||null}),_=U0(async(R,T=!1)=>{D.current+=1;let I=D.current;function y(l,s=z){let p=F.current??W;if(p==null)return;let d=J.current.fields.get(p);if(!d)return;let o=F$(l,s);J.current.fields.set(p,{...d,validityData:o})}function S(l,s){let p=l.valid===!1?s:[];return{value:R,state:l,error:p[0]??"",errors:p,initialValue:B.initialValue}}function O(l,s){let p=l.validity.customError?l.validationMessage:"",d=s.replace(/\r\n?/g,`
10
- `);l.setCustomValidity(d),L.current=[l,d,p]}function b(){let l=L.current;if(L.current=null,l&&(!l[0].willValidate||l[0].validationMessage===l[1]))l[0].setCustomValidity(l[2])}function k(l,s,p){let d=S(l,s);y(d,p),H(d)}function h(l){let s=hV.reduce((d,o)=>{return d[o]=l.validity[o],d},{}),p=!1;for(let d of hV){if(d==="valid")continue;if(d==="valueMissing"&&s[d])p=!0;else if(s[d])return s}if(p&&!G.current)s.valid=!0,s.valueMissing=!1;return s}function v(){return A.size>0?BI(A,Z.current):V.current}let f=v();function w(){return f=v(),f?.willValidate?h(f):XI(!1)}if(T){if(U.valid!==!1||!f)return;if(!f.validity.valueMissing){b();let l=v(),s=l?.validity.customError?vV(l):[];k(XI(s.length>0),s,!1);return}for(let l of hV)if(l!=="valid"&&l!=="valueMissing"&&l!=="customError"&&f.validity[l])return}N.clear(),b();let i=w(),r=vV(f),x=K();if(r.length===0||x){let l=Array.from(J.current.fields.values()).reduce((d,o)=>{if(o.name)d[o.name]=o.getValue();return d},{}),s=Q(R,l),p;if(typeof s==="object"&&s!==null&&"then"in s){if(i.valid===!1)k(i,r);else if(Y==="onSubmit"||!B.state.customError)i.valid=null,k(i,r);if(p=await s,I!==D.current)return;i=w()}else p=s;if(r=p?[].concat(p).filter(Boolean):[],r.length>0){if(i.valid=!1,i.customError=!0,f?.willValidate)O(f,r.join(`
11
- `))}else r=vV(f)}k(i,r)}),E=U0((R,T=!1)=>{if(N.clear(),D.current+=1,T)return;let I=K();if(I&&R!==""&&X)N.start(X,()=>{_(R)});else _(R,!I)}),C=E3.useCallback((R,T={})=>X2(q(T),U.valid===!1&&!U.disabled&&!R?{"aria-invalid":!0}:L1),[q,U.disabled,U.valid]);return E3.useMemo(()=>({getValidationProps:C,inputRef:V,registeredInputs:A,registerInput:j,getInputControl:M,commit:_,change:E}),[C,A,j,M,_,E])}var xU=P(m(),1);function GI($){let{change:Z,commit:J,invalid:H,markedDirtyRef:Q,name:B,setRegisteredFieldName:X,registeredFieldIdRef:z,setValidityData:G,validityData:U}=$,{formRef:K}=Z4(),Y=xU.useRef(null),F=xU.useRef(null),W=xU.useRef(!1),q=U0(()=>{let M=F.current;if(!M)return;if(M.getValue)return M.getValue();return M.value});function N(M){return M.value===void 0?q():M.value}let V=U0(()=>{let M=F.current;if(Q.current=!0,!M){J(U.value);return}J(N(M))});function A(){let M=F.current;if(!M||!M.id)return;K.current.fields.set(M.id,{getValue:q,name:B??M.name,controlRef:M.controlRef,validityData:F$(U,H),validate:V})}function D(M=F.current?.id){if(M)K.current.fields.delete(M)}function L(M){if(W.current)return;W.current=!0;let _=N(M);G((E)=>E.initialValue===_?E:{...E,initialValue:_})}J0(()=>{let M=F.current;if(!M||!M.id)return;X(B?void 0:M.name),K.current.fields.set(M.id,{getValue:q,name:B??M.name,controlRef:M.controlRef,validityData:F$(U,H),validate:V})},[K,q,H,B,X,V,U]),J0(()=>{let M=K.current.fields;return()=>{let _=F.current?.id;if(_)M.delete(_)}},[K]);let j=U0((M,_)=>{if(!_){if(Y.current===M)Y.current=null,Z(void 0,!0),D(),F.current=null,X(void 0),z.current=void 0;return}let E=F.current?.id,C=Y.current;if(C&&C!==M)Z(void 0,!0);if(Y.current=M,F.current=_,!B)X(_.name);if(z.current=_.id,E&&E!==_.id)D(E);L(_),A()});return[V,j]}var hU=P(c(),1),i50=w2.forwardRef(function(Z,J){let{errors:H,validationMode:Q,submitCountRef:B}=Z4(),{render:X,className:z,validate:G,validationDebounceTime:U=0,validationMode:K=Q,name:Y,disabled:F=!1,invalid:W,dirty:q,touched:N,actionsRef:V,style:A,...D}=Z,L=HI(!0)?.disabled,j=U0(G||(()=>null)),M=L||F,[_,E]=w2.useState(!1),[C,R]=w2.useState(!1),[T,I]=w2.useState(!1),[y,S]=w2.useState(!1),O=q??C,b=N??_,k=w2.useRef(O),h=w2.useRef(void 0),[v,f]=w2.useState(),w=Y??v;J0(()=>{if(q!==void 0)k.current=q},[q]);let i=U0((F0)=>{if(q!==void 0)return;if(F0)k.current=!0;R(F0)}),r=U0((F0)=>{if(N!==void 0)return;E(F0)}),x=U0(()=>K==="onChange"||K==="onSubmit"&&B.current>0),l=w&&Object.hasOwn(H,w)?H[w]:null,s=!!(Array.isArray(l)?l.length:l),p=W===!0||s,[d,o]=w2.useState({state:Y$,error:"",errors:[],value:null,initialValue:null}),Z0=!p&&(M?null:d.state.valid),H0=w2.useMemo(()=>({disabled:M,touched:b,dirty:O,valid:Z0,filled:T,focused:y}),[M,b,O,Z0,T,y]),G0=zI({setValidityData:o,validate:j,validityData:d,validationDebounceTime:U,invalid:p,markedDirtyRef:k,state:H0,shouldValidateOnChange:x,validationMode:K,registeredFieldIdRef:h}),[X0,Y0]=GI({change:G0.change,commit:G0.commit,invalid:p,markedDirtyRef:k,name:Y,setRegisteredFieldName:f,registeredFieldIdRef:h,setValidityData:o,validityData:d});w2.useImperativeHandle(V,()=>({validate:X0}),[X0]);let V0=w2.useMemo(()=>({invalid:p,name:w,validityData:d,setValidityData:o,disabled:M,setTouched:r,setDirty:i,setFilled:I,setFocused:S,validationMode:K,shouldValidateOnChange:x,state:H0,registerFieldControl:Y0,validation:G0}),[p,w,d,M,r,i,I,S,K,x,H0,Y0,G0]),N0=z0("div",Z,{ref:J,state:H0,props:D,stateAttributesMapping:C2});return hU.jsx(yV.Provider,{value:V0,children:N0})}),UI=w2.forwardRef(function(Z,J){return hU.jsx(yU,{children:hU.jsx(i50,{...Z,ref:J})})});var yQ=P(m(),1);function KI($,Z){let J=t0($);return J0(()=>{return Z(J),()=>{Z((H)=>H===J?void 0:H)}},[J,Z]),J}function vU($={}){let{id:Z,fallbackControlId:J,native:H=!1,setLabelId:Q,focusControl:B}=$,{controlId:X,setLabelId:z}=i5(),G=U0((W)=>{z(W),Q?.(W)}),U=KI(Z,G),K=X??J;function Y(W){if(B){B(W,K);return}if(!K)return;let q=m0(W.currentTarget).getElementById(K);if(P1(q))gU(q)}function F(W){if(M1(W.nativeEvent)?.closest("button,input,select,textarea"))return;if(!W.defaultPrevented&&W.detail>1)W.preventDefault();if(H)return;Y(W)}return H?{id:U,htmlFor:K,onMouseDown:F}:{id:U,onClick:F,onPointerDown(W){W.preventDefault()}}}function gU($){$.focus({focusVisible:!0})}var fU=P(m(),1),gV=fU.createContext({disabled:!1});function UJ(){return fU.useContext(gV)}var YI=yQ.forwardRef(function(Z,J){let{render:H,className:Q,style:B,id:X,nativeLabel:z=!0,...G}=Z,U=l5(!1),K=UJ(),{labelId:Y}=i5(),F={...U.state,disabled:U.disabled||K.disabled},W=yQ.useRef(null),q=vU({id:Y??X,native:z});return z0("label",Z,{ref:[J,W],state:F,props:[q,G],stateAttributesMapping:C2})});var W$=P(m(),1);var fV=P(c(),1),r50={...C2,...Q2},FI=W$.forwardRef(function(Z,J){let{render:H,id:Q,className:B,match:X,style:z,...G}=Z,U=t0(Q),{validityData:K,state:Y,name:F}=l5(!1),{setMessageIds:W}=i5(),{errors:q}=Z4(),N=F&&Object.hasOwn(q,F)?q[F]:null,V=!!(Array.isArray(N)?N.length:N),A=typeof X==="string",D=!1;if(X===!0)D=!0;else if(Y.disabled)D=!1;else if(A)D=Boolean(K.state[X]);else D=V||K.state.valid===!1;let{mounted:L,transitionStatus:j,setMounted:M}=j2(D);J0(()=>{if(!D||!U)return;return W((k)=>k.concat(U)),()=>{W((k)=>k.filter((h)=>h!==U))}},[D,U,W]);let _=W$.useRef(null),[E,C]=W$.useState(null),[R,T]=W$.useState(null),I=K.error;if(!A&&V)I=N;else if(K.errors.length>1)I=K.errors;let y=I;if(Array.isArray(I))y=I.length>1?fV.jsx("ul",{children:I.map((k)=>fV.jsx("li",{children:k},k))}):I[0];let S=Array.isArray(I)?JSON.stringify(I):I;if(D&&S!==R)T(S),C(y);W5({open:D,ref:_,onComplete(){if(!D)M(!1)}});let O={...Y,transitionStatus:j},b=z0("div",Z,{ref:[J,_],state:O,props:[{id:U,children:D?y:E},G],stateAttributesMapping:r50,enabled:L});if(!L)return null;return b});var WI=P(m(),1);var qI=WI.forwardRef(function(Z,J){let{render:H,id:Q,className:B,style:X,...z}=Z,G=t0(Q),U=l5(!1),K=UJ(),{setMessageIds:Y}=i5(),F={...U.state,disabled:U.disabled||K.disabled};return J0(()=>{if(!G)return;return Y((q)=>q.concat(G)),()=>{Y((q)=>q.filter((N)=>N!==G))}},[G,Y]),z0("p",Z,{ref:J,state:F,props:[{id:G},z],stateAttributesMapping:C2})});var mU=P(m(),1);var q$=P(m(),1);function J4({controlled:$,default:Z,name:J,state:H="value"}){let{current:Q}=q$.useRef($!==void 0),[B,X]=q$.useState(Z),z=Q&&$!==void 0?$:B,G=q$.useCallback((U)=>{if(!Q)X(U)},[]);return[z,G]}function w6($,Z,J,H,Q=!0,B){let{registerFieldControl:X}=l5(),z=l1(()=>Symbol());J0(()=>{let G=z.current;if(!Q){X(G,void 0);return}X(G,{controlRef:$,getValue:H,id:Z,name:B,value:J})},[$,Q,H,Z,B,X,z,J]),J0(()=>{let G=z.current;return()=>{X(G,void 0)}},[X,z])}var mV=P(m(),1);function E6($={}){let{id:Z,enabled:J=!0}=$,{controlId:H,registerControlId:Q,resetControlId:B}=i5(),X=t0(),z=l1(()=>Symbol()),G=mV.useRef(!1),U=mV.useRef(!1),K=U0(()=>{if(!G.current||Q===X1)return;G.current=!1,Q(z.current,void 0)});return J0(()=>{if(!J||Q===X1){K();return}let Y;if(Z!==void 0)U.current=!0,Y=Z;else if(U.current)Y=X;else{B();return}if(Y===void 0){K();return}G.current=!0,Q(z.current,Y);return},[Z,J,Q,B,X,z,K]),J0(()=>{return K},[K]),(J?H:void 0)??Z??X}var NI=mU.forwardRef(function(Z,J){let{render:H,className:Q,id:B,name:X,value:z,disabled:G=!1,onValueChange:U,defaultValue:K,autoFocus:Y=!1,style:F,...W}=Z,{state:q,name:N,disabled:V,setTouched:A,setDirty:D,validityData:L,setFocused:j,setFilled:M,validationMode:_,validation:E}=l5(),{clearErrors:C,elementRef:R,submitCountRef:T}=Z4(),I=V||G,y=N??X,S={...q,disabled:I},{labelId:O}=i5(),b=E6({id:B}),[k]=J4({controlled:z,default:K,name:"FieldControl",state:"value"}),h=z!==void 0,v=h?k:void 0,f=v==null?void 0:String(v),w=U0(()=>E.inputRef.current?.value);w6(E.inputRef,b,f,w,!I,X),J0(()=>{let l=f??E.inputRef.current?.value;if(l!==void 0)M(l!=="")},[f,E.inputRef,M]),h9(f,()=>{if(f===void 0)return;C(y),D(f!==(L.initialValue??"")),E.change(f)});let i=mU.useRef(null),r=d1();return J0(()=>{if(Y&&i.current===p1(m0(i.current)))j(!0)},[Y,j]),z0("input",Z,{ref:[J,i],state:S,props:[{id:b,disabled:I,name:y,ref:E.inputRef,"aria-labelledby":O,autoFocus:Y,...h?{value:v}:{defaultValue:K},onChange(l){let s=l.currentTarget.value,p=R0(K0.none,l.nativeEvent);if(U?.(s,p),h)return;if(D(s!==(L.initialValue??"")),M(s!==""),!l.nativeEvent.defaultPrevented&&!p.isCanceled)C(y),E.change(s)},onFocus(){j(!0)},onBlur(l){if(A(!0),j(!1),_==="onBlur"){let s=l.currentTarget.value;if(E.commit(s),h)queueMicrotask(()=>{let p=E.inputRef.current?.value;if(p!==void 0&&p!==s&&p!==(L.initialValue??""))E.commit(p)})}},onKeyDown(l){if(l.currentTarget.tagName==="INPUT"&&l.key==="Enter"){A(!0);let s=l.currentTarget.value,p=l.currentTarget.form;if(p&&p===R.current&&!l.defaultPrevented){let d=l.currentTarget,o=T.current;r.start(0,()=>{if(T.current===o)E.commit(d.value)})}else E.commit(s)}}},W,(l)=>E.getValidationProps(I,l)],stateAttributesMapping:C2})});var xQ=P(m(),1);var AI=P(c(),1),VI=function(Z){let{children:J}=Z,{validityData:H,invalid:Q}=l5(!1),B=xQ.useMemo(()=>F$(H,Q),[H,Q]),X=B.state.valid===!1,{transitionStatus:z}=j2(X),G=xQ.useMemo(()=>{return{...B,validity:B.state,transitionStatus:z}},[B,z]);return AI.jsx(xQ.Fragment,{children:J(G)})};var uU=P(m(),1);var uV=P(c(),1),DI=uU.forwardRef(function(Z,J){let{render:H,className:Q,style:B,disabled:X=!1,...z}=Z,{state:G,disabled:U}=l5(!1),K=U||X,Y={...G,disabled:K},F=uU.useMemo(()=>({disabled:K}),[K]),W=z0("div",Z,{ref:J,state:Y,props:z,stateAttributesMapping:C2});return uV.jsx(yU,{children:uV.jsx(gV.Provider,{value:F,children:W})})});var MI=P(c(),1),hQ=LI.forwardRef(function(Z,J){return MI.jsx(pU.Control,{ref:J,...Z})});var PI=P(c(),1);function N$({className:$,type:Z,...J}){return PI.jsx(hQ,{type:Z,"data-slot":"input",className:a0("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 _I($){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 KJ=["claude-code","codex","openclaw","hermes"];var YJ=P(m(),1);var cU="/claude-z2xnay0d.svg";var jI="/floppy-disk-wmjs0n85.webp";var dU="/hermes-pznd63x9.png";var lU="/openai-ep9ht2pq.svg";var iU="/openclaw-a2pyfhpn.svg";var K1=P(c(),1),EI="Set up the moi workspace for this project. Fetch https://moi.computer/INSTALL.md, and follow the steps.";function FJ({trigger:$,open:Z,onOpenChange:J}){return K1.jsxs(O6,{open:Z,onOpenChange:J,children:[$&&K1.jsx(w3,{render:$}),K1.jsx(Z20,{})]})}var OI=2;function e50({demoInstallUrl:$}){let Z=YJ.useRef(null);return K1.jsx("div",{className:"relative min-h-56 overflow-hidden md:min-h-full",onMouseMove:(Q)=>{if(!Z.current)return;let B=Q.currentTarget.getBoundingClientRect(),X=(Q.clientX-B.left)/B.width-0.5,z=(Q.clientY-B.top)/B.height-0.5;Z.current.style.setProperty("--floppy-x",`${X*-2*OI}px`),Z.current.style.setProperty("--floppy-y",`${z*-2*OI}px`)},onMouseLeave:()=>{Z.current?.style.removeProperty("--floppy-x"),Z.current?.style.removeProperty("--floppy-y")},children:K1.jsxs("a",{ref:Z,href:$,target:"_blank",rel:"noreferrer",className:"group absolute top-1/2 left-1/2 w-44 -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-40",children:[K1.jsx("img",{src:jI,alt:"",className:"w-full drop-shadow-xl"}),K1.jsxs("div",{className:A$({variant:"outline",className:"absolute -right-3 -bottom-2 -rotate-8"}),children:["About moi",K1.jsx(TI,{"data-icon":"inline-end",stroke:1.5})]})]})})}function $20(){let[$,Z]=YJ.useState(!1);return YJ.useEffect(()=>{if(!$)return;let H=setTimeout(()=>Z(!1),1500);return()=>clearTimeout(H)},[$]),{copied:$,copy:()=>{navigator.clipboard?.writeText(EI).then(()=>Z(!0)).catch(()=>{})}}}function Z20(){let{demoInstallUrl:$}=O8(),{copied:Z,copy:J}=$20();return K1.jsxs(zJ,{"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:[K1.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))]"}),K1.jsxs("svg",{className:"pointer-events-none absolute inset-0 size-full opacity-30 mix-blend-soft-light","aria-hidden":"true",children:[K1.jsx("filter",{id:"floppy-grain",children:K1.jsx("feTurbulence",{type:"fractalNoise",baseFrequency:"0.8",numOctaves:"2",stitchTiles:"stitch"})}),K1.jsx("rect",{width:"100%",height:"100%",filter:"url(#floppy-grain)"})]}),K1.jsxs("div",{className:"relative grid max-h-[calc(100dvh-2rem)] overflow-y-auto md:grid-cols-[3fr_2fr] md:overflow-visible",children:[K1.jsxs("div",{className:"rounded-xl bg-background p-6 text-foreground shadow-sm md:p-8",children:[K1.jsxs("div",{className:"flex flex-col gap-0.5",children:[K1.jsx(T6,{children:"Unlock all features"}),K1.jsx(GJ,{className:"mt-1",children:"This is a demo version with sample workspaces. Install moi locally and connect to your agent."})]}),K1.jsxs("ul",{className:"mt-4 flex flex-col gap-3",children:[K1.jsxs("li",{className:"flex items-center gap-3",children:[K1.jsx(CI,{stroke:0.75,className:"mt-0.5 size-8 shrink-0 text-muted-foreground"}),K1.jsx("span",{className:"text-sm text-foreground",children:"Connect your own data sources and work on existing projects"})]}),K1.jsxs("li",{className:"flex items-center gap-3",children:[K1.jsx(wI,{stroke:0.75,className:"mt-0.5 size-8 shrink-0 text-muted-foreground"}),K1.jsxs("span",{className:"flex flex-wrap items-center gap-x-1 gap-y-0.5 text-sm text-foreground",children:[K1.jsx("span",{children:"Build with"}),K1.jsxs("span",{className:"inline-flex items-center gap-1 font-medium",children:[K1.jsx("img",{src:cU,alt:"",className:"size-3.5 object-contain"}),"Claude Code,"]}),K1.jsxs("span",{className:"inline-flex items-center gap-1 font-medium",children:[K1.jsx("img",{src:lU,alt:"",className:"size-3.5 object-contain"}),"Codex,"]}),K1.jsxs("span",{className:"inline-flex items-center gap-1 font-medium",children:[K1.jsx("img",{src:dU,alt:"",className:"size-3.5 object-contain"}),"Hermes,"]}),K1.jsxs("span",{className:"inline-flex items-center gap-1 font-medium",children:[K1.jsx("img",{src:iU,alt:"",className:"size-3.5 object-contain"}),"OpenClaw,"]}),K1.jsx("span",{children:"and more"})]})]})]}),K1.jsxs("div",{className:"mt-8 flex flex-col gap-3 pb-4",children:[K1.jsx("p",{className:"text-sm text-muted-foreground",children:"Give this prompt to your agent:"}),K1.jsxs("div",{className:"relative rounded-lg bg-muted p-4 pb-8 ring-1 ring-border",children:[K1.jsx("code",{className:"block font-mono text-sm leading-relaxed text-foreground",children:EI}),K1.jsxs(j0,{type:"button",onClick:J,className:"absolute right-4 -bottom-4",children:[Z?K1.jsx(j8,{"data-icon":"inline-start",stroke:1.5}):K1.jsx(rU,{"data-icon":"inline-start",stroke:1.5}),Z?"Copied":"Copy prompt"]})]})]})]}),K1.jsx(e50,{demoInstallUrl:$})]}),K1.jsx(bQ,{render:K1.jsx(j0,{variant:"outline",size:"icon","aria-label":"Close",className:"absolute top-4 right-4",children:K1.jsx(o5,{stroke:1.5})})})]})}var nb=P(m(),1);var ab=P(m(),1);var vQ=["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"],J20=new Set(vQ);function SI($){return J20.has($)}var kk={rocket:Lk,sparkles:jk,bolt:gQ,flame:tI,star:Ok,heart:Qk,diamond:nI,trophy:Sk,target:Ck,bulb:gI,brain:xI,robot:Dk,wand:Rk,atom:kI,flask:eI,cpu:iI,code:dI,terminal:wk,api:II,database:aI,cube:rI,hexagon:Bk,plug:Vk,tool:Ek,settings:S6,dots:aU,bug:vI,activity:RI,chart:uI,briefcase:hI,folder:$k,file:WJ,book:yI,message:Kk,mail:Gk,bell:bI,paperclip:nU,key:oU,shield:Mk,user:eG,home:Xk,globe:Hk,world:Ik,planet:Ak,compass:lI,map:Uk,calendar:fI,cloud:cI,sun:Tk,moon:Yk,snowflake:_k,leaf:zk,mountain:Fk,feather:sI,ghost:Zk,music:Wk,piano:sU,camera:mI,photo:Nk,palette:qk,gamepad:oI,gift:Jk,cart:Pk,chef:pI},bk=vQ.map(($)=>({id:$,Icon:kk[$]}));function V$($){return $&&SI($)?kk[$]:null}var H20=($,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}},tU=H20;var Q20={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},yk=Q20;var B20=($)=>{return tU(yk[$.toLowerCase()],6)},xk=B20;var X20=/^#?([0-9a-f]{8}|[0-9a-f]{6}|[0-9a-f]{4}|[0-9a-f]{3})$/i,z20=($)=>{let Z;return(Z=$.match(X20))?tU(parseInt(Z[1],16),Z[1].length):void 0},hk=z20;var eU="([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)";var D$="([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%";var fQ="(?:([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%|([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?))";var vk="(?:([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)(deg|grad|rad|turn)|([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?))";var R6="\\s*,\\s*";var Xm0=new RegExp("^(?:([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%|([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)|none)$");var G20=new RegExp(`^rgba?\\(\\s*${eU}${R6}${eU}${R6}${eU}\\s*(?:,\\s*${fQ}\\s*)?\\)$`),U20=new RegExp(`^rgba?\\(\\s*${D$}${R6}${D$}${R6}${D$}\\s*(?:,\\s*${fQ}\\s*)?\\)$`),K20=($)=>{let Z={mode:"rgb"},J;if(J=$.match(G20)){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(U20)){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},gk=K20;var Y20=($,Z)=>$===void 0?void 0:typeof $!=="object"?mk($):$.mode!==void 0?$:Z?{...$,mode:Z}:void 0,fk=Y20;var F20=($="rgb")=>(Z)=>(Z=fk(Z,$))!==void 0?Z.mode===$?Z:e8[Z.mode][$]?e8[Z.mode][$](Z):$==="rgb"?e8[Z.mode].rgb(Z):e8.rgb[$](e8[Z.mode].rgb(Z)):void 0,$K=F20;var e8={},uk={},mQ=[],pV={},W20=($)=>$,$5=($)=>{if(e8[$.mode]={...e8[$.mode],...$.toMode},Object.keys($.fromMode||{}).forEach((Z)=>{if(!e8[Z])e8[Z]={};e8[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=W20}),uk[$.mode]=$,($.parse||[]).forEach((Z)=>{q20(Z,$.mode)}),$K($.mode)},pk=($)=>uk[$],q20=($,Z)=>{if(typeof $==="string"){if(!Z)throw Error("'mode' required when 'parser' is a string");pV[$]=Z}else if(typeof $==="function"){if(mQ.indexOf($)<0)mQ.push($)}};var cV=/[^\x00-\x7F]|[a-zA-Z_]/,N20=/[^\x00-\x7F]|[-\w]/,O0={Function:"function",Ident:"ident",Number:"number",Percentage:"percentage",ParenClose:")",None:"none",Hue:"hue",Alpha:"alpha"},Y1=0;function ZK($){let Z=$[Y1],J=$[Y1+1];if(Z==="-"||Z==="+")return/\d/.test(J)||J==="."&&/\d/.test($[Y1+2]);if(Z===".")return/\d/.test(J);return/\d/.test(Z)}function dV($){if(Y1>=$.length)return!1;let Z=$[Y1];if(cV.test(Z))return!0;if(Z==="-"){if($.length-Y1<2)return!1;let J=$[Y1+1];if(J==="-"||cV.test(J))return!0;return!1}return!1}var A20={deg:1,rad:180/Math.PI,grad:0.9,turn:360};function uQ($){let Z="";if($[Y1]==="-"||$[Y1]==="+")Z+=$[Y1++];if(Z+=JK($),$[Y1]==="."&&/\d/.test($[Y1+1]))Z+=$[Y1++]+JK($);if($[Y1]==="e"||$[Y1]==="E"){if(($[Y1+1]==="-"||$[Y1+1]==="+")&&/\d/.test($[Y1+2]))Z+=$[Y1++]+$[Y1++]+JK($);else if(/\d/.test($[Y1+1]))Z+=$[Y1++]+JK($)}if(dV($)){let J=HK($);if(J==="deg"||J==="rad"||J==="turn"||J==="grad")return{type:O0.Hue,value:Z*A20[J]};return}if($[Y1]==="%")return Y1++,{type:O0.Percentage,value:+Z};return{type:O0.Number,value:+Z}}function JK($){let Z="";while(/\d/.test($[Y1]))Z+=$[Y1++];return Z}function HK($){let Z="";while(Y1<$.length&&N20.test($[Y1]))Z+=$[Y1++];return Z}function V20($){let Z=HK($);if($[Y1]==="(")return Y1++,{type:O0.Function,value:Z};if(Z==="none")return{type:O0.None,value:void 0};return{type:O0.Ident,value:Z}}function D20($=""){let Z=$.trim(),J=[],H;Y1=0;while(Y1<Z.length){if(H=Z[Y1++],H===`
12
- `||H==="\t"||H===" "){while(Y1<Z.length&&(Z[Y1]===`
13
- `||Z[Y1]==="\t"||Z[Y1]===" "))Y1++;continue}if(H===",")return;if(H===")"){J.push({type:O0.ParenClose});continue}if(H==="+"){if(Y1--,ZK(Z)){J.push(uQ(Z));continue}return}if(H==="-"){if(Y1--,ZK(Z)){J.push(uQ(Z));continue}if(dV(Z)){J.push({type:O0.Ident,value:HK(Z)});continue}return}if(H==="."){if(Y1--,ZK(Z)){J.push(uQ(Z));continue}return}if(H==="/"){while(Y1<Z.length&&(Z[Y1]===`
14
- `||Z[Y1]==="\t"||Z[Y1]===" "))Y1++;let Q;if(ZK(Z)){if(Q=uQ(Z),Q.type!==O0.Hue){J.push({type:O0.Alpha,value:Q});continue}}if(dV(Z)){if(HK(Z)==="none"){J.push({type:O0.Alpha,value:{type:O0.None,value:void 0}});continue}}return}if(/\d/.test(H)){Y1--,J.push(uQ(Z));continue}if(cV.test(H)){Y1--,J.push(V20(Z));continue}return}return J}function L20($){$._i=0;let Z=$[$._i++];if(!Z||Z.type!==O0.Function||Z.value!=="color")return;if(Z=$[$._i++],Z.type!==O0.Ident)return;let J=pV[Z.value];if(!J)return;let H={mode:J},Q=ck($,!1);if(!Q)return;let B=pk(J).channels;for(let X=0,z,G;X<B.length;X++)if(z=Q[X],G=B[X],z.type!==O0.None){if(H[G]=z.type===O0.Number?z.value:z.value/100,G==="alpha")H[G]=Math.max(0,Math.min(1,H[G]))}return H}function ck($,Z){let J=[],H;while($._i<$.length){if(H=$[$._i++],H.type===O0.None||H.type===O0.Number||H.type===O0.Alpha||H.type===O0.Percentage||Z&&H.type===O0.Hue){J.push(H);continue}if(H.type===O0.ParenClose){if($._i<$.length)return;continue}return}if(J.length<3||J.length>4)return;if(J.length===4){if(J[3].type!==O0.Alpha)return;J[3]=J[3].value}if(J.length===3)J.push({type:O0.None,value:void 0});return J.every((Q)=>Q.type!==O0.Alpha)?J:void 0}function M20($,Z){$._i=0;let J=$[$._i++];if(!J||J.type!==O0.Function)return;let H=ck($,Z);if(!H)return;return H.unshift(J.value),H}var P20=($)=>{if(typeof $!=="string")return;let Z=D20($),J=Z?M20(Z,!0):void 0,H=void 0,Q=0,B=mQ.length;while(Q<B)if((H=mQ[Q++]($,J))!==void 0)return H;return Z?L20(Z):void 0},mk=P20;function _20($,Z){if(!Z||Z[0]!=="rgb"&&Z[0]!=="rgba")return;let J={mode:"rgb"},[,H,Q,B,X]=Z;if(H.type===O0.Hue||Q.type===O0.Hue||B.type===O0.Hue)return;if(H.type!==O0.None)J.r=H.type===O0.Number?H.value/255:H.value/100;if(Q.type!==O0.None)J.g=Q.type===O0.Number?Q.value/255:Q.value/100;if(B.type!==O0.None)J.b=B.type===O0.Number?B.value/255:B.value/100;if(X.type!==O0.None)J.alpha=Math.min(1,Math.max(0,X.type===O0.Number?X.value:X.value/100));return J}var dk=_20;var j20=($)=>$==="transparent"?{mode:"rgb",r:0,g:0,b:0,alpha:0}:void 0,lk=j20;var ik=($,Z,J)=>$+J*(Z-$);var O20=($)=>{let Z=[];for(let J=0;J<$.length-1;J++){let H=$[J],Q=$[J+1];if(H===void 0&&Q===void 0)Z.push(void 0);else if(H!==void 0&&Q!==void 0)Z.push([H,Q]);else Z.push(H!==void 0?[H,H]:[Q,Q])}return Z},rk=($)=>(Z)=>{let J=O20(Z);return(H)=>{let Q=H*J.length,B=H>=1?J.length-1:Math.max(Math.floor(Q),0),X=J[B];return X===void 0?void 0:$(X[0],X[1],Q-B)}};var w0=rk(ik);var y1=($)=>{let Z=!1,J=$.map((H)=>{if(H!==void 0)return Z=!0,H;return 1});return Z?J:$};var T20={mode:"rgb",channels:["r","g","b","alpha"],parse:[dk,hk,gk,xk,lk,"srgb"],serialize:"srgb",interpolate:{r:w0,g:w0,b:w0,alpha:{use:w0,fixup:y1}},gamut:!0,white:{r:1,g:1,b:1},black:{r:0,g:0,b:0}},T8=T20;var lV=($=0)=>Math.pow(Math.abs($),2.19921875)*Math.sign($),C20=($)=>{let Z=lV($.r),J=lV($.g),H=lV($.b),Q={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)Q.alpha=$.alpha;return Q},iV=C20;var rV=($)=>Math.pow(Math.abs($),0.4547069271758437)*Math.sign($),w20=({x:$,y:Z,z:J,alpha:H})=>{if($===void 0)$=0;if(Z===void 0)Z=0;if(J===void 0)J=0;let Q={mode:"a98",r:rV($*2.0415879038107465-Z*0.5650069742788597-0.3447313507783297*J),g:rV($*-0.9692436362808798+Z*1.8759675015077206+0.0415550574071756*J),b:rV($*0.0134442806320312-Z*0.1183623922310184+1.0151749943912058*J)};if(H!==void 0)Q.alpha=H;return Q},aV=w20;var oV=($=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)},E20=({r:$,g:Z,b:J,alpha:H})=>{let Q={mode:"lrgb",r:oV($),g:oV(Z),b:oV(J)};if(H!==void 0)Q.alpha=H;return Q},C8=E20;var S20=($)=>{let{r:Z,g:J,b:H,alpha:Q}=C8($),B={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(Q!==void 0)B.alpha=Q;return B},m4=S20;var nV=($=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},R20=({r:$,g:Z,b:J,alpha:H},Q="rgb")=>{let B={mode:Q,r:nV($),g:nV(Z),b:nV(J)};if(H!==void 0)B.alpha=H;return B},w8=R20;var I20=({x:$,y:Z,z:J,alpha:H})=>{if($===void 0)$=0;if(Z===void 0)Z=0;if(J===void 0)J=0;let Q=w8({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)Q.alpha=H;return Q},u4=I20;var k20={...T8,mode:"a98",parse:["a98-rgb"],serialize:"a98-rgb",fromMode:{rgb:($)=>aV(m4($)),xyz65:aV},toMode:{rgb:($)=>u4(iV($)),xyz65:iV}},ak=k20;var b20=($)=>($=$%360)<0?$+360:$,D5=b20;var y20=($,Z)=>{return $.map((J,H,Q)=>{if(J===void 0)return J;let B=D5(J);if(H===0||$[H-1]===void 0)return B;return Z(B-D5(Q[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},[])},E2=($)=>y20($,(Z)=>Math.abs(Z)<=180?Z:Z-360*Math.sign(Z));var z2=[-0.14861,1.78277,-0.29227,-0.90649,1.97294,0],ok=Math.PI/180,nk=180/Math.PI;var sk=z2[3]*z2[4],tk=z2[1]*z2[4],ek=z2[1]*z2[2]-z2[0]*z2[3],x20=({r:$,g:Z,b:J,alpha:H})=>{if($===void 0)$=0;if(Z===void 0)Z=0;if(J===void 0)J=0;let Q=(ek*J+$*sk-Z*tk)/(ek+sk-tk),B=J-Q,X=(z2[4]*(Z-Q)-z2[2]*B)/z2[3],z={mode:"cubehelix",l:Q,s:Q===0||Q===1?void 0:Math.sqrt(B*B+X*X)/(z2[4]*Q*(1-Q))};if(z.s)z.h=Math.atan2(X,B)*nk-120;if(H!==void 0)z.alpha=H;return z},$b=x20;var h20=({h:$,s:Z,l:J,alpha:H})=>{let Q={mode:"rgb"};if($=($===void 0?0:$+120)*ok,J===void 0)J=0;let B=Z===void 0?0:Z*J*(1-J),X=Math.cos($),z=Math.sin($);if(Q.r=J+B*(z2[0]*X+z2[1]*z),Q.g=J+B*(z2[2]*X+z2[3]*z),Q.b=J+B*(z2[4]*X+z2[5]*z),H!==void 0)Q.alpha=H;return Q},Zb=h20;var I6=($,Z)=>{if($.h===void 0||Z.h===void 0||!$.s||!Z.s)return 0;let J=D5($.h),H=D5(Z.h),Q=Math.sin((H-J+360)/2*Math.PI/180);return 2*Math.sqrt($.s*Z.s)*Q},Jb=($,Z)=>{if($.h===void 0||Z.h===void 0)return 0;let J=D5($.h),H=D5(Z.h);if(Math.abs(H-J)>180)return J-(H-360*Math.sign(H-J));return H-J},k6=($,Z)=>{if($.h===void 0||Z.h===void 0||!$.c||!Z.c)return 0;let J=D5($.h),H=D5(Z.h),Q=Math.sin((H-J+360)/2*Math.PI/180);return 2*Math.sqrt($.c*Z.c)*Q};var S2=($)=>{let Z=$.reduce((H,Q)=>{if(Q!==void 0){let B=Q*Math.PI/180;H.sin+=Math.sin(B),H.cos+=Math.cos(B)}return H},{sin:0,cos:0}),J=Math.atan2(Z.sin,Z.cos)*180/Math.PI;return J<0?360+J:J};var v20={mode:"cubehelix",channels:["h","s","l","alpha"],parse:["--cubehelix"],serialize:"--cubehelix",ranges:{h:[0,360],s:[0,4.614],l:[0,1]},fromMode:{rgb:$b},toMode:{rgb:Zb},interpolate:{h:{use:w0,fixup:E2},s:w0,l:w0,alpha:{use:w0,fixup:y1}},difference:{h:I6},average:{h:S2}},Hb=v20;var g20=({l:$,a:Z,b:J,alpha:H},Q="lch")=>{if(Z===void 0)Z=0;if(J===void 0)J=0;let B=Math.sqrt(Z*Z+J*J),X={mode:Q,l:$,c:B};if(B)X.h=D5(Math.atan2(J,Z)*180/Math.PI);if(H!==void 0)X.alpha=H;return X},H8=g20;var f20=({l:$,c:Z,h:J,alpha:H},Q="lab")=>{if(J===void 0)J=0;let B={mode:Q,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)B.alpha=H;return B},Q8=f20;var QK=Math.pow(29,3)/Math.pow(3,3),BK=Math.pow(6,3)/Math.pow(29,3);var f5={X:0.9642956764295677,Y:1,Z:0.8251046025104602},b6={X:0.9504559270516716,Y:1,Z:1.0890577507598784},Lu0=Math.pow(29,3)/Math.pow(3,3),Mu0=Math.pow(6,3)/Math.pow(29,3);var sV=($)=>Math.pow($,3)>BK?Math.pow($,3):(116*$-16)/QK,m20=({l:$,a:Z,b:J,alpha:H})=>{if($===void 0)$=0;if(Z===void 0)Z=0;if(J===void 0)J=0;let Q=($+16)/116,B=Z/500+Q,X=Q-J/200,z={mode:"xyz65",x:sV(B)*b6.X,y:sV(Q)*b6.Y,z:sV(X)*b6.Z};if(H!==void 0)z.alpha=H;return z},XK=m20;var u20=($)=>u4(XK($)),y6=u20;var tV=($)=>$>BK?Math.cbrt($):(QK*$+16)/116,p20=({x:$,y:Z,z:J,alpha:H})=>{if($===void 0)$=0;if(Z===void 0)Z=0;if(J===void 0)J=0;let Q=tV($/b6.X),B=tV(Z/b6.Y),X=tV(J/b6.Z),z={mode:"lab65",l:116*B-16,a:500*(Q-B),b:200*(B-X)};if(H!==void 0)z.alpha=H;return z},zK=p20;var c20=($)=>{let Z=zK(m4($));if($.r===$.b&&$.b===$.g)Z.a=Z.b=0;return Z},x6=c20;var qJ=1,GK=1,L$=0.14444444444444443*Math.PI,NJ=Math.cos(L$),AJ=Math.sin(L$),UK=100/Math.log(1.39);var d20=({l:$,c:Z,h:J,alpha:H})=>{if($===void 0)$=0;if(Z===void 0)Z=0;if(J===void 0)J=0;let Q={mode:"lab65",l:(Math.exp($*qJ/UK)-1)/0.0039},B=(Math.exp(0.0435*Z*GK*qJ)-1)/0.075,X=B*Math.cos(J/180*Math.PI-L$),z=B*Math.sin(J/180*Math.PI-L$);if(Q.a=X*NJ-z/0.83*AJ,Q.b=X*AJ+z/0.83*NJ,H!==void 0)Q.alpha=H;return Q},pQ=d20;var l20=({l:$,a:Z,b:J,alpha:H})=>{if($===void 0)$=0;if(Z===void 0)Z=0;if(J===void 0)J=0;let Q=Z*NJ+J*AJ,B=0.83*(J*NJ-Z*AJ),X=Math.sqrt(Q*Q+B*B),z={mode:"dlch",l:UK/qJ*Math.log(1+0.0039*$),c:Math.log(1+0.075*X)/(0.0435*GK*qJ)};if(z.c)z.h=D5((Math.atan2(B,Q)+L$)/Math.PI*180);if(H!==void 0)z.alpha=H;return z},cQ=l20;var Qb=($)=>pQ(H8($,"dlch")),Bb=($)=>Q8(cQ($),"dlab"),i20={mode:"dlab",parse:["--din99o-lab"],serialize:"--din99o-lab",toMode:{lab65:Qb,rgb:($)=>y6(Qb($))},fromMode:{lab65:Bb,rgb:($)=>Bb(x6($))},channels:["l","a","b","alpha"],ranges:{l:[0,100],a:[-40.09,45.501],b:[-40.469,44.344]},interpolate:{l:w0,a:w0,b:w0,alpha:{use:w0,fixup:y1}}},Xb=i20;var r20={mode:"dlch",parse:["--din99o-lch"],serialize:"--din99o-lch",toMode:{lab65:pQ,dlab:($)=>Q8($,"dlab"),rgb:($)=>y6(pQ($))},fromMode:{lab65:cQ,dlab:($)=>H8($,"dlch"),rgb:($)=>cQ(x6($))},channels:["l","c","h","alpha"],ranges:{l:[0,100],c:[0,51.484],h:[0,360]},interpolate:{l:w0,c:w0,h:{use:w0,fixup:E2},alpha:{use:w0,fixup:y1}},difference:{h:k6},average:{h:S2}},zb=r20;function eV({h:$,s:Z,i:J,alpha:H}){if($=D5($!==void 0?$:0),Z===void 0)Z=0;if(J===void 0)J=0;let Q=Math.abs($/60%2-1),B;switch(Math.floor($/60)){case 0:B={r:J*(1+Z*(3/(2-Q)-1)),g:J*(1+Z*(3*(1-Q)/(2-Q)-1)),b:J*(1-Z)};break;case 1:B={r:J*(1+Z*(3*(1-Q)/(2-Q)-1)),g:J*(1+Z*(3/(2-Q)-1)),b:J*(1-Z)};break;case 2:B={r:J*(1-Z),g:J*(1+Z*(3/(2-Q)-1)),b:J*(1+Z*(3*(1-Q)/(2-Q)-1))};break;case 3:B={r:J*(1-Z),g:J*(1+Z*(3*(1-Q)/(2-Q)-1)),b:J*(1+Z*(3/(2-Q)-1))};break;case 4:B={r:J*(1+Z*(3*(1-Q)/(2-Q)-1)),g:J*(1-Z),b:J*(1+Z*(3/(2-Q)-1))};break;case 5:B={r:J*(1+Z*(3/(2-Q)-1)),g:J*(1-Z),b:J*(1+Z*(3*(1-Q)/(2-Q)-1))};break;default:B={r:J*(1-Z),g:J*(1-Z),b:J*(1-Z)}}if(B.mode="rgb",H!==void 0)B.alpha=H;return B}function $D({r:$,g:Z,b:J,alpha:H}){if($===void 0)$=0;if(Z===void 0)Z=0;if(J===void 0)J=0;let Q=Math.max($,Z,J),B=Math.min($,Z,J),X={mode:"hsi",s:$+Z+J===0?0:1-3*B/($+Z+J),i:($+Z+J)/3};if(Q-B!==0)X.h=(Q===$?(Z-J)/(Q-B)+(Z<J)*6:Q===Z?(J-$)/(Q-B)+2:($-Z)/(Q-B)+4)*60;if(H!==void 0)X.alpha=H;return X}var a20={mode:"hsi",toMode:{rgb:eV},parse:["--hsi"],serialize:"--hsi",fromMode:{rgb:$D},channels:["h","s","i","alpha"],ranges:{h:[0,360]},gamut:"rgb",interpolate:{h:{use:w0,fixup:E2},s:w0,i:w0,alpha:{use:w0,fixup:y1}},difference:{h:I6},average:{h:S2}},Gb=a20;function ZD({h:$,s:Z,l:J,alpha:H}){if($=D5($!==void 0?$:0),Z===void 0)Z=0;if(J===void 0)J=0;let Q=J+Z*(J<0.5?J:1-J),B=Q-(Q-J)*2*Math.abs($/60%2-1),X;switch(Math.floor($/60)){case 0:X={r:Q,g:B,b:2*J-Q};break;case 1:X={r:B,g:Q,b:2*J-Q};break;case 2:X={r:2*J-Q,g:Q,b:B};break;case 3:X={r:2*J-Q,g:B,b:Q};break;case 4:X={r:B,g:2*J-Q,b:Q};break;case 5:X={r:Q,g:2*J-Q,b:B};break;default:X={r:2*J-Q,g:2*J-Q,b:2*J-Q}}if(X.mode="rgb",H!==void 0)X.alpha=H;return X}function JD({r:$,g:Z,b:J,alpha:H}){if($===void 0)$=0;if(Z===void 0)Z=0;if(J===void 0)J=0;let Q=Math.max($,Z,J),B=Math.min($,Z,J),X={mode:"hsl",s:Q===B?0:(Q-B)/(1-Math.abs(Q+B-1)),l:0.5*(Q+B)};if(Q-B!==0)X.h=(Q===$?(Z-J)/(Q-B)+(Z<J)*6:Q===Z?(J-$)/(Q-B)+2:($-Z)/(Q-B)+4)*60;if(H!==void 0)X.alpha=H;return X}var o20=($,Z)=>{switch(Z){case"deg":return+$;case"rad":return $/Math.PI*180;case"grad":return $/10*9;case"turn":return $*360}},Ub=o20;var n20=new RegExp(`^hsla?\\(\\s*${vk}${R6}${D$}${R6}${D$}\\s*(?:,\\s*${fQ}\\s*)?\\)$`),s20=($)=>{let Z=$.match(n20);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=Ub(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},Kb=s20;function t20($,Z){if(!Z||Z[0]!=="hsl"&&Z[0]!=="hsla")return;let J={mode:"hsl"},[,H,Q,B,X]=Z;if(H.type!==O0.None){if(H.type===O0.Percentage)return;J.h=H.value}if(Q.type!==O0.None){if(Q.type===O0.Hue)return;J.s=Q.value/100}if(B.type!==O0.None){if(B.type===O0.Hue)return;J.l=B.value/100}if(X.type!==O0.None)J.alpha=Math.min(1,Math.max(0,X.type===O0.Number?X.value:X.value/100));return J}var Yb=t20;var e20={mode:"hsl",toMode:{rgb:ZD},fromMode:{rgb:JD},channels:["h","s","l","alpha"],ranges:{h:[0,360]},gamut:"rgb",parse:[Yb,Kb],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:w0,fixup:E2},s:w0,l:w0,alpha:{use:w0,fixup:y1}},difference:{h:I6},average:{h:S2}},KK=e20;function dQ({h:$,s:Z,v:J,alpha:H}){if($=D5($!==void 0?$:0),Z===void 0)Z=0;if(J===void 0)J=0;let Q=Math.abs($/60%2-1),B;switch(Math.floor($/60)){case 0:B={r:J,g:J*(1-Z*Q),b:J*(1-Z)};break;case 1:B={r:J*(1-Z*Q),g:J,b:J*(1-Z)};break;case 2:B={r:J*(1-Z),g:J,b:J*(1-Z*Q)};break;case 3:B={r:J*(1-Z),g:J*(1-Z*Q),b:J};break;case 4:B={r:J*(1-Z*Q),g:J*(1-Z),b:J};break;case 5:B={r:J,g:J*(1-Z),b:J*(1-Z*Q)};break;default:B={r:J*(1-Z),g:J*(1-Z),b:J*(1-Z)}}if(B.mode="rgb",H!==void 0)B.alpha=H;return B}function lQ({r:$,g:Z,b:J,alpha:H}){if($===void 0)$=0;if(Z===void 0)Z=0;if(J===void 0)J=0;let Q=Math.max($,Z,J),B=Math.min($,Z,J),X={mode:"hsv",s:Q===0?0:1-B/Q,v:Q};if(Q-B!==0)X.h=(Q===$?(Z-J)/(Q-B)+(Z<J)*6:Q===Z?(J-$)/(Q-B)+2:($-Z)/(Q-B)+4)*60;if(H!==void 0)X.alpha=H;return X}var $40={mode:"hsv",toMode:{rgb:dQ},parse:["--hsv"],serialize:"--hsv",fromMode:{rgb:lQ},channels:["h","s","v","alpha"],ranges:{h:[0,360]},gamut:"rgb",interpolate:{h:{use:w0,fixup:E2},s:w0,v:w0,alpha:{use:w0,fixup:y1}},difference:{h:I6},average:{h:S2}},YK=$40;function HD({h:$,w:Z,b:J,alpha:H}){if(Z===void 0)Z=0;if(J===void 0)J=0;if(Z+J>1){let Q=Z+J;Z/=Q,J/=Q}return dQ({h:$,s:J===1?1:1-Z/(1-J),v:1-J,alpha:H})}function QD($){let Z=lQ($);if(Z===void 0)return;let J=Z.s!==void 0?Z.s:0,H=Z.v!==void 0?Z.v:0,Q={mode:"hwb",w:(1-J)*H,b:1-H};if(Z.h!==void 0)Q.h=Z.h;if(Z.alpha!==void 0)Q.alpha=Z.alpha;return Q}function Z40($,Z){if(!Z||Z[0]!=="hwb")return;let J={mode:"hwb"},[,H,Q,B,X]=Z;if(H.type!==O0.None){if(H.type===O0.Percentage)return;J.h=H.value}if(Q.type!==O0.None){if(Q.type===O0.Hue)return;J.w=Q.value/100}if(B.type!==O0.None){if(B.type===O0.Hue)return;J.b=B.value/100}if(X.type!==O0.None)J.alpha=Math.min(1,Math.max(0,X.type===O0.Number?X.value:X.value/100));return J}var Fb=Z40;var J40={mode:"hwb",toMode:{rgb:HD},fromMode:{rgb:QD},channels:["h","w","b","alpha"],ranges:{h:[0,360]},gamut:"rgb",parse:[Fb],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:w0,fixup:E2},w:w0,b:w0,alpha:{use:w0,fixup:y1}},difference:{h:Jb},average:{h:S2}},Wb=J40;var FK=203;var WK=0.1593017578125;var qK=0.8359375,NK=18.8515625,AK=18.6875;function VK($){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 DK($){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 BD=($)=>Math.max($/FK,0),H40=({i:$,t:Z,p:J,alpha:H})=>{if($===void 0)$=0;if(Z===void 0)Z=0;if(J===void 0)J=0;let Q=VK($+0.008609037037932761*Z+0.11102962500302593*J),B=VK($-0.00860903703793275*Z-0.11102962500302599*J),X=VK($+0.5600313357106791*Z-0.32062717498731885*J),z={mode:"xyz65",x:BD(2.070152218389422*Q-1.3263473389671556*B+0.2066510476294051*X),y:BD(0.3647385209748074*Q+0.680566024947227*B-0.0453045459220346*X),z:BD(-0.049747207535812*Q-0.0492609666966138*B+1.1880659249923042*X)};if(H!==void 0)z.alpha=H;return z},XD=H40;var zD=($=0)=>Math.max($*FK,0),Q40=({x:$,y:Z,z:J,alpha:H})=>{let Q=zD($),B=zD(Z),X=zD(J),z=DK(0.3592832590121217*Q+0.6976051147779502*B-0.0358915932320289*X),G=DK(-0.1920808463704995*Q+1.1004767970374323*B+0.0753748658519118*X),U=DK(0.0070797844607477*Q+0.0748396662186366*B+0.8433265453898765*X),K=0.5*z+0.5*G,Y=1.61376953125*z-3.323486328125*G+1.709716796875*U,F=4.378173828125*z-4.24560546875*G-0.132568359375*U,W={mode:"itp",i:K,t:Y,p:F};if(H!==void 0)W.alpha=H;return W},GD=Q40;var B40={mode:"itp",channels:["i","t","p","alpha"],parse:["--ictcp"],serialize:"--ictcp",toMode:{xyz65:XD,rgb:($)=>u4(XD($))},fromMode:{xyz65:GD,rgb:($)=>GD(m4($))},ranges:{i:[0,0.581],t:[-0.369,0.272],p:[-0.164,0.331]},interpolate:{i:w0,t:w0,p:w0,alpha:{use:w0,fixup:y1}}},qb=B40;var X40=134.03437499999998,z40=0.000000000016295499532821565,UD=($)=>{if($<0)return 0;let Z=Math.pow($/1e4,WK);return Math.pow((qK+NK*Z)/(1+AK*Z),X40)},KD=($=0)=>Math.max($*203,0),G40=({x:$,y:Z,z:J,alpha:H})=>{$=KD($),Z=KD(Z),J=KD(J);let Q=1.15*$-0.15*J,B=0.66*Z+0.34*$,X=UD(0.41478972*Q+0.579999*B+0.014648*J),z=UD(-0.20151*Q+1.120649*B+0.0531008*J),G=UD(-0.0166008*Q+0.2648*B+0.6684799*J),U=(X+z)/2,K={mode:"jab",j:0.44*U/(1-0.56*U)-z40,a:3.524*X-4.066708*z+0.542708*G,b:0.199076*X+1.096799*z-1.295875*G};if(H!==void 0)K.alpha=H;return K},LK=G40;var U40=134.03437499999998,Nb=0.000000000016295499532821565,YD=($)=>{if($<0)return 0;let Z=Math.pow($,1/U40);return 1e4*Math.pow((qK-Z)/(AK*Z-NK),1/WK)},FD=($)=>$/203,K40=({j:$,a:Z,b:J,alpha:H})=>{if($===void 0)$=0;if(Z===void 0)Z=0;if(J===void 0)J=0;let Q=($+Nb)/(0.44+0.56*($+Nb)),B=YD(Q+0.13860504*Z+0.058047316*J),X=YD(Q-0.13860504*Z-0.058047316*J),z=YD(Q-0.096019242*Z-0.8118919*J),G={mode:"xyz65",x:FD(1.661373024652174*B-0.914523081304348*X+0.23136208173913045*z),y:FD(-0.3250758611844533*B+1.571847026732543*X-0.21825383453227928*z),z:FD(-0.090982811*B-0.31272829*X+1.5227666*z)};if(H!==void 0)G.alpha=H;return G},MK=K40;var Y40=($)=>{let Z=LK(m4($));if($.r===$.b&&$.b===$.g)Z.a=Z.b=0;return Z},PK=Y40;var F40=($)=>u4(MK($)),_K=F40;var W40={mode:"jab",channels:["j","a","b","alpha"],parse:["--jzazbz"],serialize:"--jzazbz",fromMode:{rgb:PK,xyz65:LK},toMode:{rgb:_K,xyz65:MK},ranges:{j:[0,0.222],a:[-0.109,0.129],b:[-0.185,0.134]},interpolate:{j:w0,a:w0,b:w0,alpha:{use:w0,fixup:y1}}},Ab=W40;var q40=({j:$,a:Z,b:J,alpha:H})=>{if(Z===void 0)Z=0;if(J===void 0)J=0;let Q=Math.sqrt(Z*Z+J*J),B={mode:"jch",j:$,c:Q};if(Q)B.h=D5(Math.atan2(J,Z)*180/Math.PI);if(H!==void 0)B.alpha=H;return B},WD=q40;var N40=({j:$,c:Z,h:J,alpha:H})=>{if(J===void 0)J=0;let Q={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)Q.alpha=H;return Q},qD=N40;var A40={mode:"jch",parse:["--jzczhz"],serialize:"--jzczhz",toMode:{jab:qD,rgb:($)=>_K(qD($))},fromMode:{rgb:($)=>WD(PK($)),jab:WD},channels:["j","c","h","alpha"],ranges:{j:[0,0.221],c:[0,0.19],h:[0,360]},interpolate:{h:{use:w0,fixup:E2},c:w0,j:w0,alpha:{use:w0,fixup:y1}},difference:{h:k6},average:{h:S2}},Vb=A40;var h6=Math.pow(29,3)/Math.pow(3,3),VJ=Math.pow(6,3)/Math.pow(29,3);var ND=($)=>Math.pow($,3)>VJ?Math.pow($,3):(116*$-16)/h6,V40=({l:$,a:Z,b:J,alpha:H})=>{if($===void 0)$=0;if(Z===void 0)Z=0;if(J===void 0)J=0;let Q=($+16)/116,B=Z/500+Q,X=Q-J/200,z={mode:"xyz50",x:ND(B)*f5.X,y:ND(Q)*f5.Y,z:ND(X)*f5.Z};if(H!==void 0)z.alpha=H;return z},DJ=V40;var D40=({x:$,y:Z,z:J,alpha:H})=>{if($===void 0)$=0;if(Z===void 0)Z=0;if(J===void 0)J=0;let Q=w8({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)Q.alpha=H;return Q},g9=D40;var L40=($)=>g9(DJ($)),jK=L40;var M40=($)=>{let{r:Z,g:J,b:H,alpha:Q}=C8($),B={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(Q!==void 0)B.alpha=Q;return B},f9=M40;var AD=($)=>$>VJ?Math.cbrt($):(h6*$+16)/116,P40=({x:$,y:Z,z:J,alpha:H})=>{if($===void 0)$=0;if(Z===void 0)Z=0;if(J===void 0)J=0;let Q=AD($/f5.X),B=AD(Z/f5.Y),X=AD(J/f5.Z),z={mode:"lab",l:116*B-16,a:500*(Q-B),b:200*(B-X)};if(H!==void 0)z.alpha=H;return z},LJ=P40;var _40=($)=>{let Z=LJ(f9($));if($.r===$.b&&$.b===$.g)Z.a=Z.b=0;return Z},OK=_40;function j40($,Z){if(!Z||Z[0]!=="lab")return;let J={mode:"lab"},[,H,Q,B,X]=Z;if(H.type===O0.Hue||Q.type===O0.Hue||B.type===O0.Hue)return;if(H.type!==O0.None)J.l=Math.min(Math.max(0,H.value),100);if(Q.type!==O0.None)J.a=Q.type===O0.Number?Q.value:Q.value*125/100;if(B.type!==O0.None)J.b=B.type===O0.Number?B.value:B.value*125/100;if(X.type!==O0.None)J.alpha=Math.min(1,Math.max(0,X.type===O0.Number?X.value:X.value/100));return J}var Db=j40;var O40={mode:"lab",toMode:{xyz50:DJ,rgb:jK},fromMode:{xyz50:LJ,rgb:OK},channels:["l","a","b","alpha"],ranges:{l:[0,100],a:[-125,125],b:[-125,125]},parse:[Db],serialize:($)=>`lab(${$.l!==void 0?$.l:"none"} ${$.a!==void 0?$.a:"none"} ${$.b!==void 0?$.b:"none"}${$.alpha<1?` / ${$.alpha}`:""})`,interpolate:{l:w0,a:w0,b:w0,alpha:{use:w0,fixup:y1}}},MJ=O40;var T40={...MJ,mode:"lab65",parse:["--lab-d65"],serialize:"--lab-d65",toMode:{xyz65:XK,rgb:y6},fromMode:{xyz65:zK,rgb:x6},ranges:{l:[0,100],a:[-125,125],b:[-125,125]}},Lb=T40;function C40($,Z){if(!Z||Z[0]!=="lch")return;let J={mode:"lch"},[,H,Q,B,X]=Z;if(H.type!==O0.None){if(H.type===O0.Hue)return;J.l=Math.min(Math.max(0,H.value),100)}if(Q.type!==O0.None)J.c=Math.max(0,Q.type===O0.Number?Q.value:Q.value*150/100);if(B.type!==O0.None){if(B.type===O0.Percentage)return;J.h=B.value}if(X.type!==O0.None)J.alpha=Math.min(1,Math.max(0,X.type===O0.Number?X.value:X.value/100));return J}var Mb=C40;var w40={mode:"lch",toMode:{lab:Q8,rgb:($)=>jK(Q8($))},fromMode:{rgb:($)=>H8(OK($)),lab:H8},channels:["l","c","h","alpha"],ranges:{l:[0,100],c:[0,150],h:[0,360]},parse:[Mb],serialize:($)=>`lch(${$.l!==void 0?$.l:"none"} ${$.c!==void 0?$.c:"none"} ${$.h!==void 0?$.h:"none"}${$.alpha<1?` / ${$.alpha}`:""})`,interpolate:{h:{use:w0,fixup:E2},c:w0,l:w0,alpha:{use:w0,fixup:y1}},difference:{h:k6},average:{h:S2}},PJ=w40;var E40={...PJ,mode:"lch65",parse:["--lch-d65"],serialize:"--lch-d65",toMode:{lab65:($)=>Q8($,"lab65"),rgb:($)=>y6(Q8($,"lab65"))},fromMode:{rgb:($)=>H8(x6($),"lch65"),lab65:($)=>H8($,"lch65")},ranges:{l:[0,100],c:[0,150],h:[0,360]}},Pb=E40;var S40=({l:$,u:Z,v:J,alpha:H})=>{if(Z===void 0)Z=0;if(J===void 0)J=0;let Q=Math.sqrt(Z*Z+J*J),B={mode:"lchuv",l:$,c:Q};if(Q)B.h=D5(Math.atan2(J,Z)*180/Math.PI);if(H!==void 0)B.alpha=H;return B},VD=S40;var R40=({l:$,c:Z,h:J,alpha:H})=>{if(J===void 0)J=0;let Q={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)Q.alpha=H;return Q},DD=R40;var _b=($,Z,J)=>4*$/($+15*Z+3*J),jb=($,Z,J)=>9*Z/($+15*Z+3*J),I40=_b(f5.X,f5.Y,f5.Z),k40=jb(f5.X,f5.Y,f5.Z),b40=($)=>$<=VJ?h6*$:116*Math.cbrt($)-16,y40=({x:$,y:Z,z:J,alpha:H})=>{if($===void 0)$=0;if(Z===void 0)Z=0;if(J===void 0)J=0;let Q=b40(Z/f5.Y),B=_b($,Z,J),X=jb($,Z,J);if(!isFinite(B)||!isFinite(X))Q=B=X=0;else B=13*Q*(B-I40),X=13*Q*(X-k40);let z={mode:"luv",l:Q,u:B,v:X};if(H!==void 0)z.alpha=H;return z},iQ=y40;var x40=($,Z,J)=>4*$/($+15*Z+3*J),h40=($,Z,J)=>9*Z/($+15*Z+3*J),v40=x40(f5.X,f5.Y,f5.Z),g40=h40(f5.X,f5.Y,f5.Z),f40=({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 Q=Z/(13*$)+v40,B=J/(13*$)+g40,X=f5.Y*($<=8?$/h6:Math.pow(($+16)/116,3)),z=X*(9*Q)/(4*B),G=X*(12-3*Q-20*B)/(4*B),U={mode:"xyz50",x:z,y:X,z:G};if(H!==void 0)U.alpha=H;return U},rQ=f40;var m40=($)=>VD(iQ(f9($))),u40=($)=>g9(rQ(DD($))),p40={mode:"lchuv",toMode:{luv:DD,rgb:u40},fromMode:{rgb:m40,luv:VD},channels:["l","c","h","alpha"],parse:["--lchuv"],serialize:"--lchuv",ranges:{l:[0,100],c:[0,176.956],h:[0,360]},interpolate:{h:{use:w0,fixup:E2},c:w0,l:w0,alpha:{use:w0,fixup:y1}},difference:{h:k6},average:{h:S2}},Ob=p40;var c40={...T8,mode:"lrgb",toMode:{rgb:w8},fromMode:{rgb:C8},parse:["srgb-linear"],serialize:"srgb-linear"},Tb=c40;var d40={mode:"luv",toMode:{xyz50:rQ,rgb:($)=>g9(rQ($))},fromMode:{xyz50:iQ,rgb:($)=>iQ(f9($))},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:w0,u:w0,v:w0,alpha:{use:w0,fixup:y1}}},Cb=d40;var l40=({r:$,g:Z,b:J,alpha:H})=>{if($===void 0)$=0;if(Z===void 0)Z=0;if(J===void 0)J=0;let Q=Math.cbrt(0.412221469470763*$+0.5363325372617348*Z+0.0514459932675022*J),B=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*Q+0.7936177747023054*B-0.0040720430116193*X,a:1.9779985324311684*Q-2.42859224204858*B+0.450593709617411*X,b:0.0259040424655478*Q+0.7827717124575296*B-0.8086757549230774*X};if(H!==void 0)z.alpha=H;return z},TK=l40;var i40=($)=>{let Z=TK(C8($));if($.r===$.b&&$.b===$.g)Z.a=Z.b=0;return Z},v6=i40;var r40=({l:$,a:Z,b:J,alpha:H})=>{if($===void 0)$=0;if(Z===void 0)Z=0;if(J===void 0)J=0;let Q=Math.pow($+0.3963377773761749*Z+0.2158037573099136*J,3),B=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*Q-3.3077115392580616*B+0.2309699031821044*X,g:-1.2684379732850317*Q+2.6097573492876887*B-0.3413193760026573*X,b:-0.0041960761386756*Q-0.7034186179359362*B+1.7076146940746117*X};if(H!==void 0)z.alpha=H;return z},m9=r40;var a40=($)=>w8(m9($)),g6=a40;function aQ($){return 0.5*(1.170873786407767*$-0.206+Math.sqrt((1.170873786407767*$-0.206)*(1.170873786407767*$-0.206)+0.14050485436893204*$))}function M$($){return($*$+0.206*$)/(1.170873786407767*($+0.03))}function o40($,Z){let J,H,Q,B,X,z,G,U;if(-1.88170328*$-0.80936493*Z>1)J=1.19086277,H=1.76576728,Q=0.59662641,B=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,Q=0.08285427,B=0.1254107,X=0.14503204,z=-1.2684380046,G=2.6097574011,U=-0.3413193965;else J=1.35733652,H=-0.00915799,Q=-1.1513021,B=-0.50559606,X=0.00692167,z=-0.0041960863,G=-0.7034186147,U=1.707614701;let K=J+H*$+Q*Z+B*$*$+X*$*Z,Y=0.3963377774*$+0.2158037573*Z,F=-0.1055613458*$-0.0638541728*Z,W=-0.0894841775*$-1.291485548*Z;{let q=1+K*Y,N=1+K*F,V=1+K*W,A=q*q*q,D=N*N*N,L=V*V*V,j=3*Y*q*q,M=3*F*N*N,_=3*W*V*V,E=6*Y*Y*q,C=6*F*F*N,R=6*W*W*V,T=z*A+G*D+U*L,I=z*j+G*M+U*_,y=z*E+G*C+U*R;K=K-T*I/(I*I-0.5*T*y)}return K}function LD($,Z){let J=o40($,Z),H=m9({l:1,a:J*$,b:J*Z}),Q=Math.cbrt(1/Math.max(H.r,H.g,H.b)),B=Q*J;return[Q,B]}function n40($,Z,J,H,Q,B=null){if(!B)B=LD($,Z);let X;if((J-Q)*B[1]-(B[0]-Q)*H<=0)X=B[1]*Q/(H*B[0]+B[1]*(Q-J));else{X=B[1]*(Q-1)/(H*(B[0]-1)+B[1]*(Q-J));{let z=J-Q,G=H,U=0.3963377774*$+0.2158037573*Z,K=-0.1055613458*$-0.0638541728*Z,Y=-0.0894841775*$-1.291485548*Z,F=z+G*U,W=z+G*K,q=z+G*Y;{let N=Q*(1-X)+X*J,V=X*H,A=N+V*U,D=N+V*K,L=N+V*Y,j=A*A*A,M=D*D*D,_=L*L*L,E=3*F*A*A,C=3*W*D*D,R=3*q*L*L,T=6*F*F*A,I=6*W*W*D,y=6*q*q*L,S=4.0767416621*j-3.3077115913*M+0.2309699292*_-1,O=4.0767416621*E-3.3077115913*C+0.2309699292*R,b=4.0767416621*T-3.3077115913*I+0.2309699292*y,k=O/(O*O-0.5*S*b),h=-S*k,v=-1.2684380046*j+2.6097574011*M-0.3413193965*_-1,f=-1.2684380046*E+2.6097574011*C-0.3413193965*R,w=-1.2684380046*T+2.6097574011*I-0.3413193965*y,i=f/(f*f-0.5*v*w),r=-v*i,x=-0.0041960863*j-0.7034186147*M+1.707614701*_-1,l=-0.0041960863*E-0.7034186147*C+1.707614701*R,s=-0.0041960863*T-0.7034186147*I+1.707614701*y,p=l/(l*l-0.5*x*s),d=-x*p;h=k>=0?h:1e6,r=i>=0?r:1e6,d=p>=0?d:1e6,X+=Math.min(h,Math.min(r,d))}}}return X}function oQ($,Z,J=null){if(!J)J=LD($,Z);let H=J[0],Q=J[1];return[Q/H,Q/(1-H)]}function CK($,Z,J){let H=LD(Z,J),Q=n40(Z,J,$,1,$,H),B=oQ(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=Q/Math.min($*B[0],(1-$)*B[1]),U=$*X,K=(1-$)*z,Y=0.9*G*Math.sqrt(Math.sqrt(1/(1/(U*U*U*U)+1/(K*K*K*K))));return U=$*0.4,K=(1-$)*0.8,[Math.sqrt(1/(1/(U*U)+1/(K*K))),Y,Q]}function wK($){let Z=$.l!==void 0?$.l:0,J=$.a!==void 0?$.a:0,H=$.b!==void 0?$.b:0,Q={mode:"okhsl",l:aQ(Z)};if($.alpha!==void 0)Q.alpha=$.alpha;let B=Math.sqrt(J*J+H*H);if(!B)return Q.s=0,Q;let[X,z,G]=CK(Z,J/B,H/B),U;if(B<z){let K=0,Y=0.8*X,F=1-Y/z;U=(B-K)/(Y+F*(B-K))*0.8}else{let K=z,Y=0.2*z*z*1.25*1.25/X,F=1-Y/(G-z);U=0.8+0.2*((B-K)/(Y+F*(B-K)))}if(U)Q.s=U,Q.h=D5(Math.atan2(H,J)*180/Math.PI);return Q}function EK($){let Z=$.h!==void 0?$.h:0,J=$.s!==void 0?$.s:0,H=$.l!==void 0?$.l:0,Q={mode:"oklab",l:M$(H)};if($.alpha!==void 0)Q.alpha=$.alpha;if(!J||H===1)return Q.a=Q.b=0,Q;let B=Math.cos(Z/180*Math.PI),X=Math.sin(Z/180*Math.PI),[z,G,U]=CK(Q.l,B,X),K,Y,F,W;if(J<0.8)K=1.25*J,Y=0,F=0.8*z,W=1-F/G;else K=5*(J-0.8),Y=G,F=0.2*G*G*1.25*1.25/z,W=1-F/(U-G);let q=Y+K*F/(1-W*K);return Q.a=q*B,Q.b=q*X,Q}var s40={...KK,mode:"okhsl",channels:["h","s","l","alpha"],parse:["--okhsl"],serialize:"--okhsl",fromMode:{oklab:wK,rgb:($)=>wK(v6($))},toMode:{oklab:EK,rgb:($)=>g6(EK($))}},wb=s40;function SK($){let Z=$.l!==void 0?$.l:0,J=$.a!==void 0?$.a:0,H=$.b!==void 0?$.b:0,Q=Math.sqrt(J*J+H*H),B=Q?J/Q:1,X=Q?H/Q:1,[z,G]=oQ(B,X),U=0.5,K=1-U/z,Y=G/(Q+Z*G),F=Y*Z,W=Y*Q,q=M$(F),N=W*q/F,V=m9({l:q,a:B*N,b:X*N}),A=Math.cbrt(1/Math.max(V.r,V.g,V.b,0));Z=Z/A,Q=Q/A*aQ(Z)/Z,Z=aQ(Z);let D={mode:"okhsv",s:Q?(U+G)*W/(G*U+G*K*W):0,v:Z?Z/F:0};if(D.s)D.h=D5(Math.atan2(H,J)*180/Math.PI);if($.alpha!==void 0)D.alpha=$.alpha;return D}function RK($){let Z={mode:"oklab"};if($.alpha!==void 0)Z.alpha=$.alpha;let J=$.h!==void 0?$.h:0,H=$.s!==void 0?$.s:0,Q=$.v!==void 0?$.v:0,B=Math.cos(J/180*Math.PI),X=Math.sin(J/180*Math.PI),[z,G]=oQ(B,X),U=0.5,K=1-U/z,Y=1-H*U/(U+G-G*K*H),F=H*G*U/(U+G-G*K*H),W=M$(Y),q=F*W/Y,N=m9({l:W,a:B*q,b:X*q}),V=Math.cbrt(1/Math.max(N.r,N.g,N.b,0)),A=M$(Q*Y),D=F*A/Y;return Z.l=A*V,Z.a=D*B*V,Z.b=D*X*V,Z}var t40={...YK,mode:"okhsv",channels:["h","s","v","alpha"],parse:["--okhsv"],serialize:"--okhsv",fromMode:{oklab:SK,rgb:($)=>SK(v6($))},toMode:{oklab:RK,rgb:($)=>g6(RK($))}},Eb=t40;function e40($,Z){if(!Z||Z[0]!=="oklab")return;let J={mode:"oklab"},[,H,Q,B,X]=Z;if(H.type===O0.Hue||Q.type===O0.Hue||B.type===O0.Hue)return;if(H.type!==O0.None)J.l=Math.min(Math.max(0,H.type===O0.Number?H.value:H.value/100),1);if(Q.type!==O0.None)J.a=Q.type===O0.Number?Q.value:Q.value*0.4/100;if(B.type!==O0.None)J.b=B.type===O0.Number?B.value:B.value*0.4/100;if(X.type!==O0.None)J.alpha=Math.min(1,Math.max(0,X.type===O0.Number?X.value:X.value/100));return J}var Sb=e40;var $80={...MJ,mode:"oklab",toMode:{lrgb:m9,rgb:g6},fromMode:{lrgb:TK,rgb:v6},ranges:{l:[0,1],a:[-0.4,0.4],b:[-0.4,0.4]},parse:[Sb],serialize:($)=>`oklab(${$.l!==void 0?$.l:"none"} ${$.a!==void 0?$.a:"none"} ${$.b!==void 0?$.b:"none"}${$.alpha<1?` / ${$.alpha}`:""})`},Rb=$80;function Z80($,Z){if(!Z||Z[0]!=="oklch")return;let J={mode:"oklch"},[,H,Q,B,X]=Z;if(H.type!==O0.None){if(H.type===O0.Hue)return;J.l=Math.min(Math.max(0,H.type===O0.Number?H.value:H.value/100),1)}if(Q.type!==O0.None)J.c=Math.max(0,Q.type===O0.Number?Q.value:Q.value*0.4/100);if(B.type!==O0.None){if(B.type===O0.Percentage)return;J.h=B.value}if(X.type!==O0.None)J.alpha=Math.min(1,Math.max(0,X.type===O0.Number?X.value:X.value/100));return J}var Ib=Z80;var J80={...PJ,mode:"oklch",toMode:{oklab:($)=>Q8($,"oklab"),rgb:($)=>g6(Q8($,"oklab"))},fromMode:{rgb:($)=>H8(v6($),"oklch"),oklab:($)=>H8($,"oklch")},parse:[Ib],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]}},kb=J80;var H80=($)=>{let{r:Z,g:J,b:H,alpha:Q}=C8($),B={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(Q!==void 0)B.alpha=Q;return B},MD=H80;var Q80=({x:$,y:Z,z:J,alpha:H})=>{if($===void 0)$=0;if(Z===void 0)Z=0;if(J===void 0)J=0;let Q=w8({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)Q.alpha=H;return Q},PD=Q80;var B80={...T8,mode:"p3",parse:["display-p3"],serialize:"display-p3",fromMode:{rgb:($)=>PD(m4($)),xyz65:PD},toMode:{rgb:($)=>u4(MD($)),xyz65:MD}},bb=B80;var _D=($)=>{let Z=Math.abs($);if(Z>=0.001953125)return Math.sign($)*Math.pow(Z,0.5555555555555556);return 16*$},X80=({x:$,y:Z,z:J,alpha:H})=>{if($===void 0)$=0;if(Z===void 0)Z=0;if(J===void 0)J=0;let Q={mode:"prophoto",r:_D($*1.3457868816471585-Z*0.2555720873797946-0.0511018649755453*J),g:_D($*-0.5446307051249019+Z*1.5082477428451466+0.0205274474364214*J),b:_D($*0+Z*0+1.2119675456389452*J)};if(H!==void 0)Q.alpha=H;return Q},jD=X80;var OD=($=0)=>{let Z=Math.abs($);if(Z>=0.03125)return Math.sign($)*Math.pow(Z,1.8);return $/16},z80=($)=>{let Z=OD($.r),J=OD($.g),H=OD($.b),Q={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)Q.alpha=$.alpha;return Q},TD=z80;var G80={...T8,mode:"prophoto",parse:["prophoto-rgb"],serialize:"prophoto-rgb",fromMode:{xyz50:jD,rgb:($)=>jD(f9($))},toMode:{xyz50:TD,rgb:($)=>g9(TD($))}},yb=G80;var CD=($)=>{let Z=Math.abs($);if(Z>0.018053968510807)return(Math.sign($)||1)*(1.09929682680944*Math.pow(Z,0.45)-0.09929682680944008);return 4.5*$},U80=({x:$,y:Z,z:J,alpha:H})=>{if($===void 0)$=0;if(Z===void 0)Z=0;if(J===void 0)J=0;let Q={mode:"rec2020",r:CD($*1.7166511879712683-Z*0.3556707837763925-0.2533662813736599*J),g:CD($*-0.6666843518324893+Z*1.6164812366349395+0.0157685458139111*J),b:CD($*0.0176398574453108-Z*0.0427706132578085+0.9421031212354739*J)};if(H!==void 0)Q.alpha=H;return Q},wD=U80;var ED=($=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)},K80=($)=>{let Z=ED($.r),J=ED($.g),H=ED($.b),Q={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)Q.alpha=$.alpha;return Q},SD=K80;var Y80={...T8,mode:"rec2020",fromMode:{xyz65:wD,rgb:($)=>wD(m4($))},toMode:{xyz65:SD,rgb:($)=>u4(SD($))},parse:["rec2020"],serialize:"rec2020"},xb=Y80;var f6=0.0037930732552754493,IK=Math.cbrt(0.0037930732552754493);var RD=($)=>Math.cbrt($)-IK,F80=($)=>{let{r:Z,g:J,b:H,alpha:Q}=C8($),B=RD(0.3*Z+0.622*J+0.078*H+f6),X=RD(0.23*Z+0.692*J+0.078*H+f6),z=RD(0.2434226892454782*Z+0.2047674442449682*J+0.5518098665095535*H+f6),G={mode:"xyb",x:(B-X)/2,y:(B+X)/2,b:z-(B+X)/2};if(Q!==void 0)G.alpha=Q;return G},hb=F80;var ID=($)=>Math.pow($+IK,3),W80=({x:$,y:Z,b:J,alpha:H})=>{if($===void 0)$=0;if(Z===void 0)Z=0;if(J===void 0)J=0;let Q=ID($+Z)-f6,B=ID(Z-$)-f6,X=ID(J+Z)-f6,z=w8({r:11.031566904639861*Q-9.866943908131562*B-0.16462299650829934*X,g:-3.2541473810744237*Q+4.418770377582723*B-0.16462299650829934*X,b:-3.6588512867136815*Q+2.7129230459360922*B+1.9459282407775895*X});if(H!==void 0)z.alpha=H;return z},vb=W80;var q80={mode:"xyb",channels:["x","y","b","alpha"],parse:["--xyb"],serialize:"--xyb",toMode:{rgb:vb},fromMode:{rgb:hb},ranges:{x:[-0.0154,0.0281],y:[0,0.8453],b:[-0.2778,0.388]},interpolate:{x:w0,y:w0,b:w0,alpha:{use:w0,fixup:y1}}},gb=q80;var N80={mode:"xyz50",parse:["xyz-d50"],serialize:"xyz-d50",toMode:{rgb:g9,lab:LJ},fromMode:{rgb:f9,lab:DJ},channels:["x","y","z","alpha"],ranges:{x:[0,0.964],y:[0,0.999],z:[0,0.825]},interpolate:{x:w0,y:w0,z:w0,alpha:{use:w0,fixup:y1}}},fb=N80;var A80=($)=>{let{x:Z,y:J,z:H,alpha:Q}=$;if(Z===void 0)Z=0;if(J===void 0)J=0;if(H===void 0)H=0;let B={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(Q!==void 0)B.alpha=Q;return B},mb=A80;var V80=($)=>{let{x:Z,y:J,z:H,alpha:Q}=$;if(Z===void 0)Z=0;if(J===void 0)J=0;if(H===void 0)H=0;let B={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(Q!==void 0)B.alpha=Q;return B},ub=V80;var D80={mode:"xyz65",toMode:{rgb:u4,xyz50:mb},fromMode:{rgb:m4,xyz50:ub},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:w0,y:w0,z:w0,alpha:{use:w0,fixup:y1}}},pb=D80;var L80=({r:$,g:Z,b:J,alpha:H})=>{if($===void 0)$=0;if(Z===void 0)Z=0;if(J===void 0)J=0;let Q={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)Q.alpha=H;return Q},cb=L80;var M80=({y:$,i:Z,q:J,alpha:H})=>{if($===void 0)$=0;if(Z===void 0)Z=0;if(J===void 0)J=0;let Q={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)Q.alpha=H;return Q},db=M80;var P80={mode:"yiq",toMode:{rgb:db},fromMode:{rgb:cb},channels:["y","i","q","alpha"],parse:["--yiq"],serialize:"--yiq",ranges:{i:[-0.595,0.595],q:[-0.522,0.522]},interpolate:{y:w0,i:w0,q:w0,alpha:{use:w0,fixup:y1}}},lb=P80;function kD($){let Z=$K("lrgb")($);return 0.2126*Z.r+0.7152*Z.g+0.0722*Z.b}var Na0=$5(ak),Aa0=$5(Hb),Va0=$5(Xb),Da0=$5(zb),La0=$5(Gb),Ma0=$5(KK),Pa0=$5(YK),_a0=$5(Wb),ja0=$5(qb),Oa0=$5(Ab),Ta0=$5(Vb),Ca0=$5(MJ),wa0=$5(Lb),Ea0=$5(PJ),Sa0=$5(Pb),Ra0=$5(Ob),Ia0=$5(Tb),ka0=$5(Cb),ba0=$5(wb),ya0=$5(Eb),xa0=$5(Rb),ha0=$5(kb),va0=$5(bb),ga0=$5(yb),fa0=$5(xb),ma0=$5(T8),ua0=$5(gb),pa0=$5(fb),ca0=$5(pb),da0=$5(lb);var m6={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"}},nQ={squishy:{label:"Squishy",radius:"0.875rem"},soft:{label:"Soft",radius:"0.625rem"},subtle:{label:"Subtle",radius:"0.375rem"},square:{label:"Square",radius:"0"}},sQ={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}}},bD="oklch(0.205 0 0)";function ib($){return kD($)>0.3?"oklch(0 0 0)":"oklch(1 0 0)"}var rb={workspace:{primary:($)=>$,primaryForeground:($)=>ib($),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:($)=>ib($),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%)"}},yD=Object.keys(rb.workspace);function xD($,Z="workspace"){let J={},H=rb[Z];for(let Q of yD)J[Q]=H[Q]($);return J}var bK={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)"}},u9={font:"sans",color:"default",radius:"soft",agent:"boxy"};function kK($,Z,J){return typeof $==="string"&&Object.hasOwn(Z,$)?$:J}function $9($){return{font:kK($?.font,m6,u9.font),color:kK($?.color,bK,u9.color),radius:kK($?.radius,nQ,u9.radius),agent:kK($?.agent,sQ,u9.agent)}}function yK($,Z="workspace"){let J=$9($),Q=bK[J.color].primary??(Z==="widget"?bD:void 0);return Q?xD(Q,Z):void 0}var tQ=P(c(),1),eQ={"claude-code":cU,openclaw:iU,codex:lU,hermes:dU};function _80($,Z,J){switch($?.type){case"emoji":return tQ.jsx("span",{"aria-hidden":"true",className:B0("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 tQ.jsx("img",{src:$.value,alt:"",className:"size-full"});case"glyph":{let H=V$($.value);if(H)return ab.createElement(H,{"aria-hidden":!0,stroke:1.75,className:Z?"size-[70%]":"size-[95%] text-foreground"})}default:return tQ.jsx("img",{src:J,alt:"",className:"size-[95%]"})}}function u6({className:$,icon:Z,workspaceType:J,workspaceTheme:H}){let Q=Z?.type!=="upload"&&Z?.background==="theme",B=Q?yK(H)??xD(bD):void 0,X=eQ[J??"claude-code"];return tQ.jsx("span",{className:B0("@container inline-flex shrink-0 items-center justify-center overflow-hidden",Q&&"shadow-[inset_0_0_1rem_rgba(255,255,255,0.3)]",$),style:B?{backgroundColor:B.primary,color:B.primaryForeground}:void 0,children:_80(Z,Q,X)})}var hD=P(c(),1),vD={"claude-code":"Claude Code",openclaw:"OpenClaw",codex:"Codex",hermes:"Hermes"};function ob({types:$}){let Z=$.map((J)=>vD[J]).join(", ");return hD.jsx("span",{role:"img","aria-label":Z,className:"inline-flex shrink-0 items-center -space-x-0.5",children:$.map((J)=>hD.jsx("img",{src:eQ[J],alt:"",className:"size-4 shrink-0 rounded-full bg-muted ring-2 ring-muted"},J))})}function P$($){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 Z5=P(c(),1),j80="Choose which agent moi will use to build your workspace",O80={openclaw:"To connect an OpenClaw agent, run",hermes:"To connect a Hermes agent, run"},T80={openclaw:"moi openclaw init",hermes:"moi hermes init"},C80={"claude-code":"Anthropic",codex:"OpenAI",openclaw:"Open-source",hermes:"Nous Research"};function w80({availability:$,detectedTypes:Z=[]}){return KJ.map((J)=>{let H=$?.[J],Q=H&&H.status!=="available"?H.reason:void 0,B=!Z.includes(J)?O80[J]:void 0,X=!Z.includes(J)?T80[J]:void 0,z=Q??B;return{type:J,description:C80[J],disabled:Boolean(z),...z?{disabledReason:z}:{},...!Q&&X?{disabledCommand:X}:{}}})}function E80($,Z){let J=$.find((H)=>H.type===Z);if(J&&!J.disabled)return J.type;return $.find((H)=>!H.disabled)?.type}function hK({title:$,selectedType:Z,detectedTypes:J,availability:H,isPending:Q,errorMessage:B,secondaryAction:X,primaryLabel:z,pendingLabel:G,onTypeChange:U,onSubmit:K}){let Y=w5((V)=>V.hasSentMessageFromMoi),F=w80({availability:H,detectedTypes:J}),W=E80(F,Z),q=W!==Z,N=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 nb.useEffect(()=>{if(W&&q)U(W)},[U,W,q]),Z5.jsxs("div",{className:"flex flex-col gap-5",children:[Z5.jsxs("div",{className:"flex flex-col gap-0.5 pr-8",children:[Z5.jsx(T6,{children:$}),Z5.jsx(GJ,{children:j80})]}),Z5.jsxs("div",{className:"flex flex-col gap-4",children:[Z5.jsx(S80,{options:F,selectedType:q?void 0:Z,onTypeChange:U}),!Y&&N&&Z5.jsx("p",{className:"text-sm text-muted-foreground",children:N})]}),B&&Z5.jsx("p",{role:"alert",className:"text-xs text-destructive",children:B}),Z5.jsxs("div",{className:"flex items-center justify-end gap-2",children:[X,Z5.jsx(j0,{onClick:K,disabled:Q||q,children:Q&&G?G:z})]})]})}function S80({options:$,selectedType:Z,onTypeChange:J}){return Z5.jsx("div",{role:"group","aria-label":"Agent",className:B0("grid gap-2",$.length>2?"grid-cols-4":"grid-cols-2"),children:$.map((H)=>Z5.jsx(R80,{option:H,selected:Z===H.type,onSelect:J},H.type))})}function R80({option:$,selected:Z,onSelect:J}){let H=Boolean($.disabledReason),Q=Z5.jsxs("button",{type:"button",disabled:$.disabled&&!H,"aria-disabled":$.disabled||void 0,"aria-pressed":Z,onClick:(B)=>{if($.disabled){B.preventDefault();return}J($.type)},className:B0("relative flex w-full 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:[Z5.jsxs("span",{className:"relative inline-flex",children:[Z5.jsx(I80,{type:$.type}),Z&&Z5.jsx(xK,{size:16,stroke:1.75,"aria-hidden":"true",className:"absolute -top-1.5 -right-1.5"})]}),Z5.jsxs("span",{className:"flex min-w-0 flex-col gap-0.5",children:[Z5.jsx("span",{className:"text-sm font-medium text-foreground",children:vD[$.type]}),Z5.jsx("span",{className:"text-xs leading-4 text-muted-foreground",children:$.description})]})]});if(!H)return Q;return Z5.jsxs(Q5,{children:[Z5.jsx(B5,{render:Q}),Z5.jsx(X5,{className:B0("max-w-64",$.disabledCommand&&"max-w-none leading-5"),children:Z5.jsxs("span",{className:"text-center",children:[$.disabledReason,$.disabledCommand&&Z5.jsxs(Z5.Fragment,{children:[Z5.jsx("br",{}),Z5.jsx("code",{className:"rounded-xs bg-accent px-1 py-0.5 font-mono whitespace-nowrap",children:$.disabledCommand})]})]})})]})}function I80({type:$}){return Z5.jsx("img",{src:eQ[$],alt:"",className:"size-8 shrink-0"})}var sb=P(c(),1);function vK({children:$,showCloseButton:Z=!0}){return sb.jsx(zJ,{showCloseButton:Z,className:"block w-[calc(100%-2rem)] max-w-xl overflow-hidden p-6 sm:max-w-xl",children:$})}var E5=P(c(),1),tb=KJ[0];function ZB({trigger:$}){let[,Z]=W8(),J=O8(),H=NU(),Q=OR(),[B,X]=$B.useState(!1),[z,G]=$B.useState("agent"),[U,K]=$B.useState(tb),[Y,F]=$B.useState(""),W=Y.trim(),q=W?_I(W):null,N=Q.isPending;if(J.cloudDemo)return E5.jsx(FJ,{trigger:$});function V(j){X(!1),Z(`/workspace/${j}`)}function A(){G("agent"),K(tb),F(""),Q.reset()}function D(){Q.reset(),G("name")}function L(){if(!W||q||N)return;Q.reset(),Q.mutate({name:W,type:U},{onSuccess:(j)=>V(j.id)})}return E5.jsxs(O6,{open:B,onOpenChange:X,onOpenChangeComplete:(j)=>{if(!j)A()},children:[E5.jsx(w3,{render:$}),E5.jsx(vK,{children:z==="agent"?E5.jsx(hK,{title:"Create new workspace",selectedType:U,availability:H.data?.availability,isPending:!1,secondaryAction:E5.jsx(b80,{}),primaryLabel:"Next",onTypeChange:K,onSubmit:D}):E5.jsx(k80,{name:Y,validationError:q,requestError:Q.error?.message,isPending:N,onNameChange:F,onSubmit:L})})]})}function k80({name:$,validationError:Z,requestError:J,isPending:H,onNameChange:Q,onSubmit:B}){function X(z){z.preventDefault(),B()}return E5.jsxs("form",{className:"flex flex-col gap-5",onSubmit:X,children:[E5.jsxs("div",{className:"flex flex-col gap-0.5 pr-8",children:[E5.jsx(T6,{children:"Create new workspace"}),E5.jsx(GJ,{children:"Give it a short and recognizable name"})]}),E5.jsxs("div",{className:"flex flex-col gap-2",children:[E5.jsx("label",{htmlFor:"workspace-name",className:"sr-only",children:"Workspace name"}),E5.jsx(N$,{id:"workspace-name",value:$,onChange:(z)=>Q(z.target.value),placeholder:"my-workspace",autoFocus:!0,"aria-invalid":Boolean(Z),"aria-describedby":Z?"workspace-name-error":void 0,autoComplete:"off",spellCheck:!1}),Z&&E5.jsx("p",{id:"workspace-name-error",role:"alert",className:"text-xs text-destructive",children:Z})]}),J&&E5.jsx("p",{role:"alert",className:"text-xs text-destructive",children:J}),E5.jsx("div",{className:"flex items-center justify-end gap-2",children:E5.jsx(j0,{type:"submit",disabled:!$.trim()||Boolean(Z)||H,children:H?"Creating…":"Create workspace"})})]})}function b80(){return E5.jsxs(Q5,{children:[E5.jsx(B5,{render:E5.jsx(j0,{variant:"secondary","aria-disabled":!0,onClick:(Z)=>Z.preventDefault(),className:"cursor-not-allowed opacity-50",children:"Use existing folder"})}),E5.jsx(X5,{className:"max-w-64",children:E5.jsxs("span",{className:"text-center",children:["Not supported yet — run"," ",E5.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 c6=P(m(),1);var D0=P(m(),1),C$=P(e4(),1);var G2=P(m(),1);var JB=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function _$($){let Z=Object.prototype.toString.call($);return Z==="[object Window]"||Z==="[object global]"}function gK($){return"nodeType"in $}function H4($){var Z,J;if(!$)return window;if(_$($))return $;if(!gK($))return window;return(Z=(J=$.ownerDocument)==null?void 0:J.defaultView)!=null?Z:window}function fK($){let{Document:Z}=H4($);return $ instanceof Z}function jJ($){if(_$($))return!1;return $ instanceof H4($).HTMLElement}function fD($){return $ instanceof H4($).SVGElement}function j$($){if(!$)return document;if(_$($))return $.document;if(!gK($))return document;if(fK($))return $;if(jJ($)||fD($))return $.ownerDocument;return document}var p9=JB?G2.useLayoutEffect:G2.useEffect;function HB($){let Z=G2.useRef($);return p9(()=>{Z.current=$}),G2.useCallback(function(){for(var J=arguments.length,H=Array(J),Q=0;Q<J;Q++)H[Q]=arguments[Q];return Z.current==null?void 0:Z.current(...H)},[])}function $y(){let $=G2.useRef(null),Z=G2.useCallback((H,Q)=>{$.current=setInterval(H,Q)},[]),J=G2.useCallback(()=>{if($.current!==null)clearInterval($.current),$.current=null},[]);return[Z,J]}function OJ($,Z){if(Z===void 0)Z=[$];let J=G2.useRef($);return p9(()=>{if(J.current!==$)J.current=$},Z),J}function TJ($,Z){let J=G2.useRef();return G2.useMemo(()=>{let H=$(J.current);return J.current=H,H},[...Z])}function QB($){let Z=HB($),J=G2.useRef(null),H=G2.useCallback((Q)=>{if(Q!==J.current)Z==null||Z(Q,J.current);J.current=Q},[]);return[J,H]}function BB($){let Z=G2.useRef();return G2.useEffect(()=>{Z.current=$},[$]),Z.current}var gD={};function XB($,Z){return G2.useMemo(()=>{if(Z)return Z;let J=gD[$]==null?0:gD[$]+1;return gD[$]=J,$+"-"+J},[$,Z])}function Zy($){return function(Z){for(var J=arguments.length,H=Array(J>1?J-1:0),Q=1;Q<J;Q++)H[Q-1]=arguments[Q];return H.reduce((B,X)=>{let z=Object.entries(X);for(let[G,U]of z){let K=B[G];if(K!=null)B[G]=K+$*U}return B},{...Z})}}var O$=Zy(1),zB=Zy(-1);function y80($){return"clientX"in $&&"clientY"in $}function mK($){if(!$)return!1;let{KeyboardEvent:Z}=H4($.target);return Z&&$ instanceof Z}function x80($){if(!$)return!1;let{TouchEvent:Z}=H4($.target);return Z&&$ instanceof Z}function GB($){if(x80($)){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(y80($))return{x:$.clientX,y:$.clientY};return null}var _J=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[_J.Translate.toString($),_J.Scale.toString($)].join(" ")}},Transition:{toString($){let{property:Z,duration:J,easing:H}=$;return Z+" "+J+"ms "+H}}}),eb="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Jy($){if($.matches(eb))return $;return $.querySelector(eb)}var T$=P(m(),1),h80={display:"none"};function Hy($){let{id:Z,value:J}=$;return T$.default.createElement("div",{id:Z,style:h80},J)}function Qy($){let{id:Z,announcement:J,ariaLiveType:H="assertive"}=$,Q={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 T$.default.createElement("div",{id:Z,style:Q,role:"status","aria-live":H,"aria-atomic":!0},J)}function By(){let[$,Z]=T$.useState("");return{announce:T$.useCallback((H)=>{if(H!=null)Z(H)},[]),announcement:$}}var Dy=D0.createContext(null);function v80($){let Z=D0.useContext(Dy);D0.useEffect(()=>{if(!Z)throw Error("useDndMonitor must be used within a children of <DndContext>");return Z($)},[$,Z])}function g80(){let[$]=D0.useState(()=>new Set),Z=D0.useCallback((H)=>{return $.add(H),()=>$.delete(H)},[$]);return[D0.useCallback((H)=>{let{type:Q,event:B}=H;$.forEach((X)=>{var z;return(z=X[Q])==null?void 0:z.call(X,B)})},[$]),Z]}var f80={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
- `},m80={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 u80($){let{announcements:Z=m80,container:J,hiddenTextDescribedById:H,screenReaderInstructions:Q=f80}=$,{announce:B,announcement:X}=By(),z=XB("DndLiveRegion"),[G,U]=D0.useState(!1);if(D0.useEffect(()=>{U(!0)},[]),v80(D0.useMemo(()=>({onDragStart(Y){let{active:F}=Y;B(Z.onDragStart({active:F}))},onDragMove(Y){let{active:F,over:W}=Y;if(Z.onDragMove)B(Z.onDragMove({active:F,over:W}))},onDragOver(Y){let{active:F,over:W}=Y;B(Z.onDragOver({active:F,over:W}))},onDragEnd(Y){let{active:F,over:W}=Y;B(Z.onDragEnd({active:F,over:W}))},onDragCancel(Y){let{active:F,over:W}=Y;B(Z.onDragCancel({active:F,over:W}))}}),[B,Z])),!G)return null;let K=D0.default.createElement(D0.default.Fragment,null,D0.default.createElement(Hy,{id:H,value:Q.draggable}),D0.default.createElement(Qy,{id:z,announcement:X}));return J?C$.createPortal(K,J):K}var q2;(function($){$.DragStart="dragStart",$.DragMove="dragMove",$.DragEnd="dragEnd",$.DragCancel="dragCancel",$.DragOver="dragOver",$.RegisterDroppable="registerDroppable",$.SetDroppableDisabled="setDroppableDisabled",$.UnregisterDroppable="unregisterDroppable"})(q2||(q2={}));function pK(){}function iD($,Z){return D0.useMemo(()=>({sensor:$,options:Z!=null?Z:{}}),[$,Z])}function Ly(){for(var $=arguments.length,Z=Array($),J=0;J<$;J++)Z[J]=arguments[J];return D0.useMemo(()=>[...Z].filter((H)=>H!=null),[...Z])}var Z9=Object.freeze({x:0,y:0});function p80($,Z){return Math.sqrt(Math.pow($.x-Z.x,2)+Math.pow($.y-Z.y,2))}function c80($,Z){let J=GB($);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 d80($,Z){let{data:{value:J}}=$,{data:{value:H}}=Z;return J-H}function l80($,Z){let{data:{value:J}}=$,{data:{value:H}}=Z;return H-J}function i80($,Z){if(!$||$.length===0)return null;let[J]=$;return Z?J[Z]:J}function Xy($,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 My=($)=>{let{collisionRect:Z,droppableRects:J,droppableContainers:H}=$,Q=Xy(Z,Z.left,Z.top),B=[];for(let X of H){let{id:z}=X,G=J.get(z);if(G){let U=p80(Xy(G),Q);B.push({id:z,data:{droppableContainer:X,value:U}})}}return B.sort(d80)};function r80($,Z){let J=Math.max(Z.top,$.top),H=Math.max(Z.left,$.left),Q=Math.min(Z.left+Z.width,$.left+$.width),B=Math.min(Z.top+Z.height,$.top+$.height),X=Q-H,z=B-J;if(H<Q&&J<B){let G=Z.width*Z.height,U=$.width*$.height,K=X*z,Y=K/(G+U-K);return Number(Y.toFixed(4))}return 0}var a80=($)=>{let{collisionRect:Z,droppableRects:J,droppableContainers:H}=$,Q=[];for(let B of H){let{id:X}=B,z=J.get(X);if(z){let G=r80(z,Z);if(G>0)Q.push({id:X,data:{droppableContainer:B,value:G}})}}return Q.sort(l80)};function o80($,Z,J){return{...$,scaleX:Z&&J?Z.width/J.width:1,scaleY:Z&&J?Z.height/J.height:1}}function Py($,Z){return $&&Z?{x:$.left-Z.left,y:$.top-Z.top}:Z9}function n80($){return function(J){for(var H=arguments.length,Q=Array(H>1?H-1:0),B=1;B<H;B++)Q[B-1]=arguments[B];return Q.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 s80=n80(1);function _y($){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 t80($,Z,J){let H=_y(Z);if(!H)return $;let{scaleX:Q,scaleY:B,x:X,y:z}=H,G=$.left-X-(1-Q)*parseFloat(J),U=$.top-z-(1-B)*parseFloat(J.slice(J.indexOf(" ")+1)),K=Q?$.width/Q:$.width,Y=B?$.height/B:$.height;return{width:K,height:Y,top:U,right:G+K,bottom:U+Y,left:G}}var e80={ignoreTransform:!1};function YB($,Z){if(Z===void 0)Z=e80;let J=$.getBoundingClientRect();if(Z.ignoreTransform){let{transform:U,transformOrigin:K}=H4($).getComputedStyle($);if(U)J=t80(J,U,K)}let{top:H,left:Q,width:B,height:X,bottom:z,right:G}=J;return{top:H,left:Q,width:B,height:X,bottom:z,right:G}}function zy($){return YB($,{ignoreTransform:!0})}function $90($){let{innerWidth:Z,innerHeight:J}=$;return{top:0,left:0,right:Z,bottom:J,width:Z,height:J}}function Z90($,Z){if(Z===void 0)Z=H4($).getComputedStyle($);return Z.position==="fixed"}function J90($,Z){if(Z===void 0)Z=H4($).getComputedStyle($);let J=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some((Q)=>{let B=Z[Q];return typeof B==="string"?J.test(B):!1})}function rD($,Z){let J=[];function H(Q){if(Z!=null&&J.length>=Z)return J;if(!Q)return J;if(fK(Q)&&Q.scrollingElement!=null&&!J.includes(Q.scrollingElement))return J.push(Q.scrollingElement),J;if(!jJ(Q)||fD(Q))return J;if(J.includes(Q))return J;let B=H4($).getComputedStyle(Q);if(Q!==$){if(J90(Q,B))J.push(Q)}if(Z90(Q,B))return J;return H(Q.parentNode)}if(!$)return J;return H($)}function jy($){let[Z]=rD($,1);return Z!=null?Z:null}function mD($){if(!JB||!$)return null;if(_$($))return $;if(!gK($))return null;if(fK($)||$===j$($).scrollingElement)return window;if(jJ($))return $;return null}function Oy($){if(_$($))return $.scrollX;return $.scrollLeft}function Ty($){if(_$($))return $.scrollY;return $.scrollTop}function cD($){return{x:Oy($),y:Ty($)}}var R2;(function($){$[$.Forward=1]="Forward",$[$.Backward=-1]="Backward"})(R2||(R2={}));function Cy($){if(!JB||!$)return!1;return $===document.scrollingElement}function wy($){let Z={x:0,y:0},J=Cy($)?{height:window.innerHeight,width:window.innerWidth}:{height:$.clientHeight,width:$.clientWidth},H={x:$.scrollWidth-J.width,y:$.scrollHeight-J.height},Q=$.scrollTop<=Z.y,B=$.scrollLeft<=Z.x,X=$.scrollTop>=H.y,z=$.scrollLeft>=H.x;return{isTop:Q,isLeft:B,isBottom:X,isRight:z,maxScroll:H,minScroll:Z}}var H90={x:0.2,y:0.2};function Q90($,Z,J,H,Q){let{top:B,left:X,right:z,bottom:G}=J;if(H===void 0)H=10;if(Q===void 0)Q=H90;let{isTop:U,isBottom:K,isLeft:Y,isRight:F}=wy($),W={x:0,y:0},q={x:0,y:0},N={height:Z.height*Q.y,width:Z.width*Q.x};if(!U&&B<=Z.top+N.height)W.y=R2.Backward,q.y=H*Math.abs((Z.top+N.height-B)/N.height);else if(!K&&G>=Z.bottom-N.height)W.y=R2.Forward,q.y=H*Math.abs((Z.bottom-N.height-G)/N.height);if(!F&&z>=Z.right-N.width)W.x=R2.Forward,q.x=H*Math.abs((Z.right-N.width-z)/N.width);else if(!Y&&X<=Z.left+N.width)W.x=R2.Backward,q.x=H*Math.abs((Z.left+N.width-X)/N.width);return{direction:W,speed:q}}function B90($){if($===document.scrollingElement){let{innerWidth:B,innerHeight:X}=window;return{top:0,left:0,right:B,bottom:X,width:B,height:X}}let{top:Z,left:J,right:H,bottom:Q}=$.getBoundingClientRect();return{top:Z,left:J,right:H,bottom:Q,width:$.clientWidth,height:$.clientHeight}}function Ey($){return $.reduce((Z,J)=>{return O$(Z,cD(J))},Z9)}function X90($){return $.reduce((Z,J)=>{return Z+Oy(J)},0)}function z90($){return $.reduce((Z,J)=>{return Z+Ty(J)},0)}function Sy($,Z){if(Z===void 0)Z=YB;if(!$)return;let{top:J,left:H,bottom:Q,right:B}=Z($);if(!jy($))return;if(Q<=0||B<=0||J>=window.innerHeight||H>=window.innerWidth)$.scrollIntoView({block:"center",inline:"center"})}var G90=[["x",["left","right"],X90],["y",["top","bottom"],z90]];class dK{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=rD(Z),H=Ey(J);this.rect={...$},this.width=$.width,this.height=$.height;for(let[Q,B,X]of G90)for(let z of B)Object.defineProperty(this,z,{get:()=>{let G=X(J),U=H[Q]-G;return this.rect[z]+U},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class CJ{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 U90($){let{EventTarget:Z}=H4($);return $ instanceof Z?$:j$($)}function uD($,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 E8;(function($){$.Click="click",$.DragStart="dragstart",$.Keydown="keydown",$.ContextMenu="contextmenu",$.Resize="resize",$.SelectionChange="selectionchange",$.VisibilityChange="visibilitychange"})(E8||(E8={}));function Gy($){$.preventDefault()}function K90($){$.stopPropagation()}var o1;(function($){$.Space="Space",$.Down="ArrowDown",$.Right="ArrowRight",$.Left="ArrowLeft",$.Up="ArrowUp",$.Esc="Escape",$.Enter="Enter",$.Tab="Tab"})(o1||(o1={}));var Ry={start:[o1.Space,o1.Enter],cancel:[o1.Esc],end:[o1.Space,o1.Enter,o1.Tab]},Y90=($,Z)=>{let{currentCoordinates:J}=Z;switch($.code){case o1.Right:return{...J,x:J.x+25};case o1.Left:return{...J,x:J.x-25};case o1.Down:return{...J,y:J.y+25};case o1.Up:return{...J,y:J.y-25}}return};class FB{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 CJ(j$(Z)),this.windowListeners=new CJ(H4(Z)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(E8.Resize,this.handleCancel),this.windowListeners.add(E8.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(E8.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:$,onStart:Z}=this.props,J=$.node.current;if(J)Sy(J);Z(Z9)}handleKeyDown($){if(mK($)){let{active:Z,context:J,options:H}=this.props,{keyboardCodes:Q=Ry,coordinateGetter:B=Y90,scrollBehavior:X="smooth"}=H,{code:z}=$;if(Q.end.includes(z)){this.handleEnd($);return}if(Q.cancel.includes(z)){this.handleCancel($);return}let{collisionRect:G}=J.current,U=G?{x:G.left,y:G.top}:Z9;if(!this.referenceCoordinates)this.referenceCoordinates=U;let K=B($,{active:Z,context:J.current,currentCoordinates:U});if(K){let Y=zB(K,U),F={x:0,y:0},{scrollableAncestors:W}=J.current;for(let q of W){let N=$.code,{isTop:V,isRight:A,isLeft:D,isBottom:L,maxScroll:j,minScroll:M}=wy(q),_=B90(q),E={x:Math.min(N===o1.Right?_.right-_.width/2:_.right,Math.max(N===o1.Right?_.left:_.left+_.width/2,K.x)),y:Math.min(N===o1.Down?_.bottom-_.height/2:_.bottom,Math.max(N===o1.Down?_.top:_.top+_.height/2,K.y))},C=N===o1.Right&&!A||N===o1.Left&&!D,R=N===o1.Down&&!L||N===o1.Up&&!V;if(C&&E.x!==K.x){let T=q.scrollLeft+Y.x,I=N===o1.Right&&T<=j.x||N===o1.Left&&T>=M.x;if(I&&!Y.y){q.scrollTo({left:T,behavior:X});return}if(I)F.x=q.scrollLeft-T;else F.x=N===o1.Right?q.scrollLeft-j.x:q.scrollLeft-M.x;if(F.x)q.scrollBy({left:-F.x,behavior:X});break}else if(R&&E.y!==K.y){let T=q.scrollTop+Y.y,I=N===o1.Down&&T<=j.y||N===o1.Up&&T>=M.y;if(I&&!Y.x){q.scrollTo({top:T,behavior:X});return}if(I)F.y=q.scrollTop-T;else F.y=N===o1.Down?q.scrollTop-j.y:q.scrollTop-M.y;if(F.y)q.scrollBy({top:-F.y,behavior:X});break}}this.handleMove($,O$(zB(K,this.referenceCoordinates),F))}}}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()}}FB.activators=[{eventName:"onKeyDown",handler:($,Z,J)=>{let{keyboardCodes:H=Ry,onActivation:Q}=Z,{active:B}=J,{code:X}=$.nativeEvent;if(H.start.includes(X)){let z=B.activatorNode.current;if(z&&$.target!==z)return!1;return $.preventDefault(),Q==null||Q({event:$.nativeEvent}),!0}return!1}}];function Uy($){return Boolean($&&"distance"in $)}function Ky($){return Boolean($&&"delay"in $)}class lK{constructor($,Z,J){var H;if(J===void 0)J=U90($.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:Q}=$,{target:B}=Q;this.props=$,this.events=Z,this.document=j$(B),this.documentListeners=new CJ(this.document),this.listeners=new CJ(J),this.windowListeners=new CJ(H4(B)),this.initialCoordinates=(H=GB(Q))!=null?H:Z9,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(E8.Resize,this.handleCancel),this.windowListeners.add(E8.DragStart,Gy),this.windowListeners.add(E8.VisibilityChange,this.handleCancel),this.windowListeners.add(E8.ContextMenu,Gy),this.documentListeners.add(E8.Keydown,this.handleKeydown),Z){if(J!=null&&J({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Ky(Z)){this.timeoutId=setTimeout(this.handleStart,Z.delay),this.handlePending(Z);return}if(Uy(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(E8.Click,K90,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(E8.SelectionChange,this.removeTextSelection),Z($)}handleMove($){var Z;let{activated:J,initialCoordinates:H,props:Q}=this,{onMove:B,options:{activationConstraint:X}}=Q;if(!H)return;let z=(Z=GB($))!=null?Z:Z9,G=zB(H,z);if(!J&&X){if(Uy(X)){if(X.tolerance!=null&&uD(G,X.tolerance))return this.handleCancel();if(uD(G,X.distance))return this.handleStart()}if(Ky(X)){if(uD(G,X.tolerance))return this.handleCancel()}this.handlePending(X,G);return}if($.cancelable)$.preventDefault();B(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===o1.Esc)this.handleCancel()}removeTextSelection(){var $;($=this.document.getSelection())==null||$.removeAllRanges()}}var F90={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class WB extends lK{constructor($){let{event:Z}=$,J=j$(Z.target);super($,F90,J)}}WB.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 W90={move:{name:"mousemove"},end:{name:"mouseup"}},dD;(function($){$[$.RightClick=2]="RightClick"})(dD||(dD={}));class Iy extends lK{constructor($){super($,W90,j$($.event.target))}}Iy.activators=[{eventName:"onMouseDown",handler:($,Z)=>{let{nativeEvent:J}=$,{onActivation:H}=Z;if(J.button===dD.RightClick)return!1;return H==null||H({event:J}),!0}}];var pD={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class ky extends lK{constructor($){super($,pD)}static setup(){return window.addEventListener(pD.move.name,$,{capture:!1,passive:!1}),function(){window.removeEventListener(pD.move.name,$)};function $(){}}}ky.activators=[{eventName:"onTouchStart",handler:($,Z)=>{let{nativeEvent:J}=$,{onActivation:H}=Z,{touches:Q}=J;if(Q.length>1)return!1;return H==null||H({event:J}),!0}}];var UB;(function($){$[$.Pointer=0]="Pointer",$[$.DraggableRect=1]="DraggableRect"})(UB||(UB={}));var cK;(function($){$[$.TreeOrder=0]="TreeOrder",$[$.ReversedTreeOrder=1]="ReversedTreeOrder"})(cK||(cK={}));function q90($){let{acceleration:Z,activator:J=UB.Pointer,canScroll:H,draggingRect:Q,enabled:B,interval:X=5,order:z=cK.TreeOrder,pointerCoordinates:G,scrollableAncestors:U,scrollableAncestorRects:K,delta:Y,threshold:F}=$,W=A90({delta:Y,disabled:!B}),[q,N]=$y(),V=D0.useRef({x:0,y:0}),A=D0.useRef({x:0,y:0}),D=D0.useMemo(()=>{switch(J){case UB.Pointer:return G?{top:G.y,bottom:G.y,left:G.x,right:G.x}:null;case UB.DraggableRect:return Q}},[J,Q,G]),L=D0.useRef(null),j=D0.useCallback(()=>{let _=L.current;if(!_)return;let E=V.current.x*A.current.x,C=V.current.y*A.current.y;_.scrollBy(E,C)},[]),M=D0.useMemo(()=>z===cK.TreeOrder?[...U].reverse():U,[z,U]);D0.useEffect(()=>{if(!B||!U.length||!D){N();return}for(let _ of M){if((H==null?void 0:H(_))===!1)continue;let E=U.indexOf(_),C=K[E];if(!C)continue;let{direction:R,speed:T}=Q90(_,C,D,Z,F);for(let I of["x","y"])if(!W[I][R[I]])T[I]=0,R[I]=0;if(T.x>0||T.y>0){N(),L.current=_,q(j,X),V.current=T,A.current=R;return}}V.current={x:0,y:0},A.current={x:0,y:0},N()},[Z,j,H,N,B,X,JSON.stringify(D),JSON.stringify(W),q,U,M,K,JSON.stringify(F)])}var N90={x:{[R2.Backward]:!1,[R2.Forward]:!1},y:{[R2.Backward]:!1,[R2.Forward]:!1}};function A90($){let{delta:Z,disabled:J}=$,H=BB(Z);return TJ((Q)=>{if(J||!H||!Q)return N90;let B={x:Math.sign(Z.x-H.x),y:Math.sign(Z.y-H.y)};return{x:{[R2.Backward]:Q.x[R2.Backward]||B.x===-1,[R2.Forward]:Q.x[R2.Forward]||B.x===1},y:{[R2.Backward]:Q.y[R2.Backward]||B.y===-1,[R2.Forward]:Q.y[R2.Forward]||B.y===1}}},[J,Z,H])}function V90($,Z){let J=Z!=null?$.get(Z):void 0,H=J?J.node.current:null;return TJ((Q)=>{var B;if(Z==null)return null;return(B=H!=null?H:Q)!=null?B:null},[H,Z])}function D90($,Z){return D0.useMemo(()=>$.reduce((J,H)=>{let{sensor:Q}=H,B=Q.activators.map((X)=>({eventName:X.eventName,handler:Z(X.handler,H)}));return[...J,...B]},[]),[$,Z])}var KB;(function($){$[$.Always=0]="Always",$[$.BeforeDragging=1]="BeforeDragging",$[$.WhileDragging=2]="WhileDragging"})(KB||(KB={}));var lD;(function($){$.Optimized="optimized"})(lD||(lD={}));var Yy=new Map;function L90($,Z){let{dragging:J,dependencies:H,config:Q}=Z,[B,X]=D0.useState(null),{frequency:z,measure:G,strategy:U}=Q,K=D0.useRef($),Y=V(),F=OJ(Y),W=D0.useCallback(function(A){if(A===void 0)A=[];if(F.current)return;X((D)=>{if(D===null)return A;return D.concat(A.filter((L)=>!D.includes(L)))})},[F]),q=D0.useRef(null),N=TJ((A)=>{if(Y&&!J)return Yy;if(!A||A===Yy||K.current!==$||B!=null){let D=new Map;for(let L of $){if(!L)continue;if(B&&B.length>0&&!B.includes(L.id)&&L.rect.current){D.set(L.id,L.rect.current);continue}let j=L.node.current,M=j?new dK(G(j),j):null;if(L.rect.current=M,M)D.set(L.id,M)}return D}return A},[$,B,J,Y,G]);return D0.useEffect(()=>{K.current=$},[$]),D0.useEffect(()=>{if(Y)return;W()},[J,Y]),D0.useEffect(()=>{if(B&&B.length>0)X(null)},[JSON.stringify(B)]),D0.useEffect(()=>{if(Y||typeof z!=="number"||q.current!==null)return;q.current=setTimeout(()=>{W(),q.current=null},z)},[z,Y,W,...H]),{droppableRects:N,measureDroppableContainers:W,measuringScheduled:B!=null};function V(){switch(U){case KB.Always:return!1;case KB.BeforeDragging:return J;default:return!J}}}function aD($,Z){return TJ((J)=>{if(!$)return null;if(J)return J;return typeof Z==="function"?Z($):$},[Z,$])}function M90($,Z){return aD($,Z)}function P90($){let{callback:Z,disabled:J}=$,H=HB(Z),Q=D0.useMemo(()=>{if(J||typeof window>"u"||typeof window.MutationObserver>"u")return;let{MutationObserver:B}=window;return new B(H)},[H,J]);return D0.useEffect(()=>{return()=>Q==null?void 0:Q.disconnect()},[Q]),Q}function iK($){let{callback:Z,disabled:J}=$,H=HB(Z),Q=D0.useMemo(()=>{if(J||typeof window>"u"||typeof window.ResizeObserver>"u")return;let{ResizeObserver:B}=window;return new B(H)},[J]);return D0.useEffect(()=>{return()=>Q==null?void 0:Q.disconnect()},[Q]),Q}function _90($){return new dK(YB($),$)}function Fy($,Z,J){if(Z===void 0)Z=_90;let[H,Q]=D0.useState(null);function B(){Q((G)=>{if(!$)return null;if($.isConnected===!1){var U;return(U=G!=null?G:J)!=null?U:null}let K=Z($);if(JSON.stringify(G)===JSON.stringify(K))return G;return K})}let X=P90({callback(G){if(!$)return;for(let U of G){let{type:K,target:Y}=U;if(K==="childList"&&Y instanceof HTMLElement&&Y.contains($)){B();break}}}}),z=iK({callback:B});return p9(()=>{if(B(),$)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 j90($){let Z=aD($);return Py($,Z)}var Wy=[];function O90($){let Z=D0.useRef($),J=TJ((H)=>{if(!$)return Wy;if(H&&H!==Wy&&$&&Z.current&&$.parentNode===Z.current.parentNode)return H;return rD($)},[$]);return D0.useEffect(()=>{Z.current=$},[$]),J}function T90($){let[Z,J]=D0.useState(null),H=D0.useRef($),Q=D0.useCallback((B)=>{let X=mD(B.target);if(!X)return;J((z)=>{if(!z)return null;return z.set(X,cD(X)),new Map(z)})},[]);return D0.useEffect(()=>{let B=H.current;if($!==B){X(B);let z=$.map((G)=>{let U=mD(G);if(U)return U.addEventListener("scroll",Q,{passive:!0}),[U,cD(U)];return null}).filter((G)=>G!=null);J(z.length?new Map(z):null),H.current=$}return()=>{X($),X(B)};function X(z){z.forEach((G)=>{let U=mD(G);U==null||U.removeEventListener("scroll",Q)})}},[Q,$]),D0.useMemo(()=>{if($.length)return Z?Array.from(Z.values()).reduce((B,X)=>O$(B,X),Z9):Ey($);return Z9},[$,Z])}function qy($,Z){if(Z===void 0)Z=[];let J=D0.useRef(null);return D0.useEffect(()=>{J.current=null},Z),D0.useEffect(()=>{let H=$!==Z9;if(H&&!J.current)J.current=$;if(!H&&J.current)J.current=null},[$]),J.current?zB($,J.current):Z9}function C90($){D0.useEffect(()=>{if(!JB)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 w90($,Z){return D0.useMemo(()=>{return $.reduce((J,H)=>{let{eventName:Q,handler:B}=H;return J[Q]=(X)=>{B(X,Z)},J},{})},[$,Z])}function by($){return D0.useMemo(()=>$?$90($):null,[$])}var Ny=[];function E90($,Z){if(Z===void 0)Z=YB;let[J]=$,H=by(J?H4(J):null),[Q,B]=D0.useState(Ny);function X(){B(()=>{if(!$.length)return Ny;return $.map((G)=>Cy(G)?H:new dK(Z(G),G))})}let z=iK({callback:X});return p9(()=>{z==null||z.disconnect(),X(),$.forEach((G)=>z==null?void 0:z.observe(G))},[$]),Q}function yy($){if(!$)return null;if($.children.length>1)return $;let Z=$.children[0];return jJ(Z)?Z:$}function S90($){let{measure:Z}=$,[J,H]=D0.useState(null),Q=D0.useCallback((U)=>{for(let{target:K}of U)if(jJ(K)){H((Y)=>{let F=Z(K);return Y?{...Y,width:F.width,height:F.height}:F});break}},[Z]),B=iK({callback:Q}),X=D0.useCallback((U)=>{let K=yy(U);if(B==null||B.disconnect(),K)B==null||B.observe(K);H(K?Z(K):null)},[Z,B]),[z,G]=QB(X);return D0.useMemo(()=>({nodeRef:z,rect:J,setRef:G}),[J,z,G])}var R90=[{sensor:WB,options:{}},{sensor:FB,options:{}}],I90={current:{}},uK={draggable:{measure:zy},droppable:{measure:zy,strategy:KB.WhileDragging,frequency:lD.Optimized},dragOverlay:{measure:YB}};class wJ 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 k90={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new wJ,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:pK},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:uK,measureDroppableContainers:pK,windowRect:null,measuringScheduled:!1},xy={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:pK,draggableNodes:new Map,over:null,measureDroppableContainers:pK},qB=D0.createContext(xy),hy=D0.createContext(k90);function b90(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new wJ}}}function y90($,Z){switch(Z.type){case q2.DragStart:return{...$,draggable:{...$.draggable,initialCoordinates:Z.initialCoordinates,active:Z.active}};case q2.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 q2.DragEnd:case q2.DragCancel:return{...$,draggable:{...$.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case q2.RegisterDroppable:{let{element:J}=Z,{id:H}=J,Q=new wJ($.droppable.containers);return Q.set(H,J),{...$,droppable:{...$.droppable,containers:Q}}}case q2.SetDroppableDisabled:{let{id:J,key:H,disabled:Q}=Z,B=$.droppable.containers.get(J);if(!B||H!==B.key)return $;let X=new wJ($.droppable.containers);return X.set(J,{...B,disabled:Q}),{...$,droppable:{...$.droppable,containers:X}}}case q2.UnregisterDroppable:{let{id:J,key:H}=Z,Q=$.droppable.containers.get(J);if(!Q||H!==Q.key)return $;let B=new wJ($.droppable.containers);return B.delete(J),{...$,droppable:{...$.droppable,containers:B}}}default:return $}}function x90($){let{disabled:Z}=$,{active:J,activatorEvent:H,draggableNodes:Q}=D0.useContext(qB),B=BB(H),X=BB(J==null?void 0:J.id);return D0.useEffect(()=>{if(Z)return;if(!H&&B&&X!=null){if(!mK(B))return;if(document.activeElement===B.target)return;let z=Q.get(X);if(!z)return;let{activatorNode:G,node:U}=z;if(!G.current&&!U.current)return;requestAnimationFrame(()=>{for(let K of[G.current,U.current]){if(!K)continue;let Y=Jy(K);if(Y){Y.focus();break}}})}},[H,Z,Q,X,B]),null}function vy($,Z){let{transform:J,...H}=Z;return $!=null&&$.length?$.reduce((Q,B)=>{return B({transform:Q,...H})},J):J}function h90($){return D0.useMemo(()=>({draggable:{...uK.draggable,...$==null?void 0:$.draggable},droppable:{...uK.droppable,...$==null?void 0:$.droppable},dragOverlay:{...uK.dragOverlay,...$==null?void 0:$.dragOverlay}}),[$==null?void 0:$.draggable,$==null?void 0:$.droppable,$==null?void 0:$.dragOverlay])}function v90($){let{activeNode:Z,measure:J,initialRect:H,config:Q=!0}=$,B=D0.useRef(!1),{x:X,y:z}=typeof Q==="boolean"?{x:Q,y:Q}:Q;p9(()=>{if(!X&&!z||!Z){B.current=!1;return}if(B.current||!H)return;let U=Z==null?void 0:Z.node.current;if(!U||U.isConnected===!1)return;let K=J(U),Y=Py(K,H);if(!X)Y.x=0;if(!z)Y.y=0;if(B.current=!0,Math.abs(Y.x)>0||Math.abs(Y.y)>0){let F=jy(U);if(F)F.scrollBy({top:Y.y,left:Y.x})}},[Z,X,z,H,J])}var rK=D0.createContext({...Z9,scaleX:1,scaleY:1}),p6;(function($){$[$.Uninitialized=0]="Uninitialized",$[$.Initializing=1]="Initializing",$[$.Initialized=2]="Initialized"})(p6||(p6={}));var gy=D0.memo(function(Z){var J,H,Q,B;let{id:X,accessibility:z,autoScroll:G=!0,children:U,sensors:K=R90,collisionDetection:Y=a80,measuring:F,modifiers:W,...q}=Z,N=D0.useReducer(y90,void 0,b90),[V,A]=N,[D,L]=g80(),[j,M]=D0.useState(p6.Uninitialized),_=j===p6.Initialized,{draggable:{active:E,nodes:C,translate:R},droppable:{containers:T}}=V,I=E!=null?C.get(E):null,y=D0.useRef({initial:null,translated:null}),S=D0.useMemo(()=>{var C0;return E!=null?{id:E,data:(C0=I==null?void 0:I.data)!=null?C0:I90,rect:y}:null},[E,I]),O=D0.useRef(null),[b,k]=D0.useState(null),[h,v]=D0.useState(null),f=OJ(q,Object.values(q)),w=XB("DndDescribedBy",X),i=D0.useMemo(()=>T.getEnabled(),[T]),r=h90(F),{droppableRects:x,measureDroppableContainers:l,measuringScheduled:s}=L90(i,{dragging:_,dependencies:[R.x,R.y],config:r.droppable}),p=V90(C,E),d=D0.useMemo(()=>h?GB(h):null,[h]),o=s1(),Z0=M90(p,r.draggable.measure);v90({activeNode:E!=null?C.get(E):null,config:o.layoutShiftCompensation,initialRect:Z0,measure:r.draggable.measure});let H0=Fy(p,r.draggable.measure,Z0),G0=Fy(p?p.parentElement:null),X0=D0.useRef({activatorEvent:null,active:null,activeNode:p,collisionRect:null,collisions:null,droppableRects:x,draggableNodes:C,draggingNode:null,draggingNodeRect:null,droppableContainers:T,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Y0=T.getNodeFor((J=X0.current.over)==null?void 0:J.id),V0=S90({measure:r.dragOverlay.measure}),N0=(H=V0.nodeRef.current)!=null?H:p,F0=_?(Q=V0.rect)!=null?Q:H0:null,n=Boolean(V0.nodeRef.current&&V0.rect),a=j90(n?null:H0),e=by(N0?H4(N0):null),$0=O90(_?Y0!=null?Y0:p:null),Q0=E90($0),_0=vy(W,{transform:{x:R.x-a.x,y:R.y-a.y,scaleX:1,scaleY:1},activatorEvent:h,active:S,activeNodeRect:H0,containerNodeRect:G0,draggingNodeRect:F0,over:X0.current.over,overlayNodeRect:V0.rect,scrollableAncestors:$0,scrollableAncestorRects:Q0,windowRect:e}),M0=d?O$(d,R):null,A0=T90($0),L0=qy(A0),g=qy(A0,[H0]),u=O$(_0,L0),t=F0?s80(F0,_0):null,W0=S&&t?Y({active:S,collisionRect:t,droppableRects:x,droppableContainers:i,pointerCoordinates:M0}):null,I0=i80(W0,"id"),[c0,f0]=D0.useState(null),T0=n?_0:O$(_0,g),x0=o80(T0,(B=c0==null?void 0:c0.rect)!=null?B:null,H0),J1=D0.useRef(null),W1=D0.useCallback((C0,p0)=>{let{sensor:i0,options:o0}=p0;if(O.current==null)return;let V1=C.get(O.current);if(!V1)return;let D1=C0.nativeEvent,u1=new i0({active:O.current,activeNode:V1,event:D1,options:o0,context:X0,onAbort(P0){if(!C.get(P0))return;let{onDragAbort:z1}=f.current,O1={id:P0};z1==null||z1(O1),D({type:"onDragAbort",event:O1})},onPending(P0,l0,z1,O1){if(!C.get(P0))return;let{onDragPending:r0}=f.current,h0={id:P0,constraint:l0,initialCoordinates:z1,offset:O1};r0==null||r0(h0),D({type:"onDragPending",event:h0})},onStart(P0){let l0=O.current;if(l0==null)return;let z1=C.get(l0);if(!z1)return;let{onDragStart:O1}=f.current,b0={activatorEvent:D1,active:{id:l0,data:z1.data,rect:y}};C$.unstable_batchedUpdates(()=>{O1==null||O1(b0),M(p6.Initializing),A({type:q2.DragStart,initialCoordinates:P0,active:l0}),D({type:"onDragStart",event:b0}),k(J1.current),v(D1)})},onMove(P0){A({type:q2.DragMove,coordinates:P0})},onEnd:q0(q2.DragEnd),onCancel:q0(q2.DragCancel)});J1.current=u1;function q0(P0){return async function(){let{active:z1,collisions:O1,over:b0,scrollAdjustedTranslate:r0}=X0.current,h0=null;if(z1&&r0){let{cancelDrop:G1}=f.current;if(h0={activatorEvent:D1,active:z1,collisions:O1,delta:r0,over:b0},P0===q2.DragEnd&&typeof G1==="function"){if(await Promise.resolve(G1(h0)))P0=q2.DragCancel}}O.current=null,C$.unstable_batchedUpdates(()=>{A({type:P0}),M(p6.Uninitialized),f0(null),k(null),v(null),J1.current=null;let G1=P0===q2.DragEnd?"onDragEnd":"onDragCancel";if(h0){let S1=f.current[G1];S1==null||S1(h0),D({type:G1,event:h0})}})}}},[C]),d0=D0.useCallback((C0,p0)=>{return(i0,o0)=>{let V1=i0.nativeEvent,D1=C.get(o0);if(O.current!==null||!D1||V1.dndKit||V1.defaultPrevented)return;let u1={active:D1};if(C0(i0,p0.options,u1)===!0)V1.dndKit={capturedBy:p0.sensor},O.current=o0,W1(i0,p0)}},[C,W1]),v0=D90(K,d0);C90(K),p9(()=>{if(H0&&j===p6.Initializing)M(p6.Initialized)},[H0,j]),D0.useEffect(()=>{let{onDragMove:C0}=f.current,{active:p0,activatorEvent:i0,collisions:o0,over:V1}=X0.current;if(!p0||!i0)return;let D1={active:p0,activatorEvent:i0,collisions:o0,delta:{x:u.x,y:u.y},over:V1};C$.unstable_batchedUpdates(()=>{C0==null||C0(D1),D({type:"onDragMove",event:D1})})},[u.x,u.y]),D0.useEffect(()=>{let{active:C0,activatorEvent:p0,collisions:i0,droppableContainers:o0,scrollAdjustedTranslate:V1}=X0.current;if(!C0||O.current==null||!p0||!V1)return;let{onDragOver:D1}=f.current,u1=o0.get(I0),q0=u1&&u1.rect.current?{id:u1.id,rect:u1.rect.current,data:u1.data,disabled:u1.disabled}:null,P0={active:C0,activatorEvent:p0,collisions:i0,delta:{x:V1.x,y:V1.y},over:q0};C$.unstable_batchedUpdates(()=>{f0(q0),D1==null||D1(P0),D({type:"onDragOver",event:P0})})},[I0]),p9(()=>{X0.current={activatorEvent:h,active:S,activeNode:p,collisionRect:t,collisions:W0,droppableRects:x,draggableNodes:C,draggingNode:N0,draggingNodeRect:F0,droppableContainers:T,over:c0,scrollableAncestors:$0,scrollAdjustedTranslate:u},y.current={initial:F0,translated:t}},[S,p,W0,t,C,N0,F0,x,T,c0,$0,u]),q90({...o,delta:R,draggingRect:t,pointerCoordinates:M0,scrollableAncestors:$0,scrollableAncestorRects:Q0});let E1=D0.useMemo(()=>{return{active:S,activeNode:p,activeNodeRect:H0,activatorEvent:h,collisions:W0,containerNodeRect:G0,dragOverlay:V0,draggableNodes:C,droppableContainers:T,droppableRects:x,over:c0,measureDroppableContainers:l,scrollableAncestors:$0,scrollableAncestorRects:Q0,measuringConfiguration:r,measuringScheduled:s,windowRect:e}},[S,p,H0,h,W0,G0,V0,C,T,x,c0,l,$0,Q0,r,s,e]),B1=D0.useMemo(()=>{return{activatorEvent:h,activators:v0,active:S,activeNodeRect:H0,ariaDescribedById:{draggable:w},dispatch:A,draggableNodes:C,over:c0,measureDroppableContainers:l}},[h,v0,S,H0,A,w,C,c0,l]);return D0.default.createElement(Dy.Provider,{value:L},D0.default.createElement(qB.Provider,{value:B1},D0.default.createElement(hy.Provider,{value:E1},D0.default.createElement(rK.Provider,{value:x0},U)),D0.default.createElement(x90,{disabled:(z==null?void 0:z.restoreFocus)===!1})),D0.default.createElement(u80,{...z,hiddenTextDescribedById:w}));function s1(){let C0=(b==null?void 0:b.autoScrollEnabled)===!1,p0=typeof G==="object"?G.enabled===!1:G===!1,i0=_&&!C0&&!p0;if(typeof G==="object")return{...G,enabled:i0};return{enabled:i0}}}),g90=D0.createContext(null),Ay="button",f90="Draggable";function fy($){let{id:Z,data:J,disabled:H=!1,attributes:Q}=$,B=XB(f90),{activators:X,activatorEvent:z,active:G,activeNodeRect:U,ariaDescribedById:K,draggableNodes:Y,over:F}=D0.useContext(qB),{role:W=Ay,roleDescription:q="draggable",tabIndex:N=0}=Q!=null?Q:{},V=(G==null?void 0:G.id)===Z,A=D0.useContext(V?rK:g90),[D,L]=QB(),[j,M]=QB(),_=w90(X,Z),E=OJ(J);p9(()=>{return Y.set(Z,{id:Z,key:B,node:D,activatorNode:j,data:E}),()=>{let R=Y.get(Z);if(R&&R.key===B)Y.delete(Z)}},[Y,Z]);let C=D0.useMemo(()=>({role:W,tabIndex:N,"aria-disabled":H,"aria-pressed":V&&W===Ay?!0:void 0,"aria-roledescription":q,"aria-describedby":K.draggable}),[H,W,N,V,q,K.draggable]);return{active:G,activatorEvent:z,activeNodeRect:U,attributes:C,isDragging:V,listeners:H?void 0:_,node:D,over:F,setNodeRef:L,setActivatorNodeRef:M,transform:A}}function m90(){return D0.useContext(hy)}var u90="Droppable",p90={timeout:25};function my($){let{data:Z,disabled:J=!1,id:H,resizeObserverConfig:Q}=$,B=XB(u90),{active:X,dispatch:z,over:G,measureDroppableContainers:U}=D0.useContext(qB),K=D0.useRef({disabled:J}),Y=D0.useRef(!1),F=D0.useRef(null),W=D0.useRef(null),{disabled:q,updateMeasurementsFor:N,timeout:V}={...p90,...Q},A=OJ(N!=null?N:H),D=D0.useCallback(()=>{if(!Y.current){Y.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},V)},[V]),L=iK({callback:D,disabled:q||!X}),j=D0.useCallback((C,R)=>{if(!L)return;if(R)L.unobserve(R),Y.current=!1;if(C)L.observe(C)},[L]),[M,_]=QB(j),E=OJ(Z);return D0.useEffect(()=>{if(!L||!M.current)return;L.disconnect(),Y.current=!1,L.observe(M.current)},[M,L]),D0.useEffect(()=>{return z({type:q2.RegisterDroppable,element:{id:H,key:B,disabled:J,node:M,rect:F,data:E}}),()=>z({type:q2.UnregisterDroppable,key:B,id:H})},[H]),D0.useEffect(()=>{if(J!==K.current.disabled)z({type:q2.SetDroppableDisabled,id:H,key:B,disabled:J}),K.current.disabled=J},[H,B,J,z]),{active:X,rect:F,isOver:(G==null?void 0:G.id)===H,node:M,over:G,setNodeRef:_}}function c90($){let{animation:Z,children:J}=$,[H,Q]=D0.useState(null),[B,X]=D0.useState(null),z=BB(J);if(!J&&!H&&z)Q(z);return p9(()=>{if(!B)return;let G=H==null?void 0:H.key,U=H==null?void 0:H.props.id;if(G==null||U==null){Q(null);return}Promise.resolve(Z(U,B)).then(()=>{Q(null)})},[Z,H,B]),D0.default.createElement(D0.default.Fragment,null,J,H?D0.cloneElement(H,{ref:X}):null)}var d90={x:0,y:0,scaleX:1,scaleY:1};function l90($){let{children:Z}=$;return D0.default.createElement(qB.Provider,{value:xy},D0.default.createElement(rK.Provider,{value:d90},Z))}var i90={position:"fixed",touchAction:"none"},r90=($)=>{return mK($)?"transform 250ms ease":void 0},a90=D0.forwardRef(($,Z)=>{let{as:J,activatorEvent:H,adjustScale:Q,children:B,className:X,rect:z,style:G,transform:U,transition:K=r90}=$;if(!z)return null;let Y=Q?U:{...U,scaleX:1,scaleY:1},F={...i90,width:z.width,height:z.height,top:z.top,left:z.left,transform:_J.Transform.toString(Y),transformOrigin:Q&&H?c80(H,z):void 0,transition:typeof K==="function"?K(H):K,...G};return D0.default.createElement(J,{className:X,style:F,ref:Z},B)}),o90=($)=>(Z)=>{let{active:J,dragOverlay:H}=Z,Q={},{styles:B,className:X}=$;if(B!=null&&B.active)for(let[z,G]of Object.entries(B.active)){if(G===void 0)continue;Q[z]=J.node.style.getPropertyValue(z),J.node.style.setProperty(z,G)}if(B!=null&&B.dragOverlay)for(let[z,G]of Object.entries(B.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(Q))J.node.style.setProperty(G,U);if(X!=null&&X.active)J.node.classList.remove(X.active)}},n90=($)=>{let{transform:{initial:Z,final:J}}=$;return[{transform:_J.Transform.toString(Z)},{transform:_J.Transform.toString(J)}]},s90={duration:250,easing:"ease",keyframes:n90,sideEffects:o90({styles:{active:{opacity:"0"}}})};function t90($){let{config:Z,draggableNodes:J,droppableContainers:H,measuringConfiguration:Q}=$;return HB((B,X)=>{if(Z===null)return;let z=J.get(B);if(!z)return;let G=z.node.current;if(!G)return;let U=yy(X);if(!U)return;let{transform:K}=H4(X).getComputedStyle(X),Y=_y(K);if(!Y)return;let F=typeof Z==="function"?Z:e90(Z);return Sy(G,Q.draggable.measure),F({active:{id:B,data:z.data,node:G,rect:Q.draggable.measure(G)},draggableNodes:J,dragOverlay:{node:X,rect:Q.dragOverlay.measure(U)},droppableContainers:H,measuringConfiguration:Q,transform:Y})})}function e90($){let{duration:Z,easing:J,sideEffects:H,keyframes:Q}={...s90,...$};return(B)=>{let{active:X,dragOverlay:z,transform:G,...U}=B;if(!Z)return;let K={x:z.rect.left-X.rect.left,y:z.rect.top-X.rect.top},Y={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},F={x:G.x-K.x,y:G.y-K.y,...Y},W=Q({...U,active:X,dragOverlay:z,transform:{initial:G,final:F}}),[q]=W,N=W[W.length-1];if(JSON.stringify(q)===JSON.stringify(N))return;let V=H==null?void 0:H({active:X,dragOverlay:z,...U}),A=z.node.animate(W,{duration:Z,easing:J,fill:"forwards"});return new Promise((D)=>{A.onfinish=()=>{V==null||V(),D()}})}}var Vy=0;function $30($){return D0.useMemo(()=>{if($==null)return;return Vy++,Vy},[$])}var uy=D0.default.memo(($)=>{let{adjustScale:Z=!1,children:J,dropAnimation:H,style:Q,transition:B,modifiers:X,wrapperElement:z="div",className:G,zIndex:U=999}=$,{activatorEvent:K,active:Y,activeNodeRect:F,containerNodeRect:W,draggableNodes:q,droppableContainers:N,dragOverlay:V,over:A,measuringConfiguration:D,scrollableAncestors:L,scrollableAncestorRects:j,windowRect:M}=m90(),_=D0.useContext(rK),E=$30(Y==null?void 0:Y.id),C=vy(X,{activatorEvent:K,active:Y,activeNodeRect:F,containerNodeRect:W,draggingNodeRect:V.rect,over:A,overlayNodeRect:V.rect,scrollableAncestors:L,scrollableAncestorRects:j,transform:_,windowRect:M}),R=aD(F),T=t90({config:H,draggableNodes:q,droppableContainers:N,measuringConfiguration:D}),I=R?V.setRef:void 0;return D0.default.createElement(l90,null,D0.default.createElement(c90,{animation:T},Y&&E?D0.default.createElement(a90,{key:E,id:Y.id,ref:I,as:z,activatorEvent:K,adjustScale:Z,className:G,transition:B,rect:R,style:{zIndex:U,...Q},transform:C},J):null))});var w$=P(c(),1),Z30={start:[o1.Space],cancel:[o1.Esc],end:[o1.Space,o1.Tab]};function J30($,Z,J){let H=$.indexOf(Z),Q=$.indexOf(J);if(H<0||Q<0||H===Q)return $;let B=[...$],[X]=B.splice(H,1);return B.splice(Q,0,X),B}function aK({items:$,getId:Z,className:J,itemClassName:H,dragDisabled:Q=!1,isItemDragDisabled:B,onReorder:X,renderItem:z,renderPlaceholder:G,renderOverlay:U}){let K=Ly(iD(WB,{activationConstraint:{distance:4}}),iD(FB,{keyboardCodes:Z30})),[Y,F]=c6.useState(null),[W,q]=c6.useState(null),N=c6.useRef(null),V=c6.useMemo(()=>$.map(Z),[$,Z]),A=c6.useMemo(()=>new Map($.map((R)=>[Z(R),R])),[$,Z]),L=(Y&&W?W:V).map((R)=>A.get(R)).filter((R)=>Boolean(R)),j=Y?A.get(Y):void 0,M=B?$.filter((R)=>!B(R)).length:$.length,_=Q||M<2;return w$.jsxs(gy,{sensors:K,collisionDetection:My,onDragStart:(R)=>{let T=$.map(Z);F(String(R.active.id)),N.current=T,q(T)},onDragOver:(R)=>{let T=String(R.active.id),I=R.over?String(R.over.id):void 0,y=N.current;if(!I||I===T||!y)return;let S=J30(y,T,I);if(S===y)return;N.current=S,q(S)},onDragCancel:()=>{N.current=null,F(null),q(null)},onDragEnd:(R)=>{let T=String(R.active.id),I=N.current;if(N.current=null,F(null),q(null),!I||I.join("|")===V.join("|"))return;if(!I.includes(T))return;X(I)},children:[w$.jsx("div",{className:J,children:L.map((R)=>w$.jsx(H30,{id:Z(R),item:R,disabled:_||B?.(R)===!0,itemClassName:H,renderItem:z,renderPlaceholder:G},Z(R)))}),w$.jsx(uy,{dropAnimation:null,children:j&&U?U(j):null})]})}function H30({id:$,item:Z,disabled:J,itemClassName:H,renderItem:Q,renderPlaceholder:B}){let{setNodeRef:X,isOver:z}=my({id:$,disabled:J}),{attributes:G,listeners:U,setNodeRef:K,isDragging:Y}=fy({id:$,disabled:J,attributes:{roleDescription:"sortable item"}}),F=(q)=>{X(q),K(q)},W={isDragging:Y,isOver:z,dragDisabled:J,dragHandleProps:J?{}:{...G,...U}};return w$.jsxs(z5.div,{layout:!0,ref:F,className:B0("relative",H?.(Z,W)),transition:{type:"spring",duration:0.25,bounce:0},children:[Y&&B?.(Z),Q(Z,W)]})}var F1=P(c(),1),Q30="https://mlfrg.notion.site/3c678a44b6788042b734d775dd2e935e?pvs=105";function B30($){return B0(A$({variant:"ghost",size:"icon"}),$&&"bg-accent text-accent-foreground")}function oK({children:$,showWorkspaces:Z=!0}){let{data:J}=WU(),H=U1();return W2((Q)=>{if(Q.type==="workspace:updated"||Q.type==="theme:updated"||Q.type==="workspaces-list:updated")H.invalidateQueries({queryKey:S0.all,exact:!0})}),F1.jsxs("div",{className:"flex h-dvh bg-muted transition-colors duration-100 ease-out motion-reduce:transition-none",children:[F1.jsx(X30,{workspaces:Z?J??[]:[]}),F1.jsx("main",{className:"flex min-w-0 flex-1 flex-col",children:$})]})}function X30({workspaces:$}){let Z=TR();return F1.jsx(TG,{delay:500,children:F1.jsxs("aside",{className:"flex h-full shrink-0 flex-col items-center gap-4 px-2 py-5 [font-family:var(--default-sans)]",children:[F1.jsxs(Q5,{children:[F1.jsx(B5,{render:F1.jsx(y7,{href:"/","aria-label":"Home",className:B30,children:F1.jsx(dy,{stroke:1.5})})}),F1.jsx(X5,{side:"right",children:"Home"})]}),F1.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&&F1.jsxs(F1.Fragment,{children:[F1.jsx("div",{className:"no-scrollbar min-h-0 scroll-fade overflow-y-auto [--scroll-fade-reveal:16px]",children:F1.jsx(aK,{items:$,getId:(J)=>J.id,className:"flex flex-col gap-4",onReorder:(J)=>Z.mutate(J),renderPlaceholder:()=>F1.jsx("div",{className:"pointer-events-none absolute top-0 left-1 size-12 rounded-xl bg-accent"}),renderOverlay:(J)=>F1.jsx(py,{workspace:J,dragOverlay:!0}),renderItem:(J,H)=>F1.jsx(py,{workspace:J,dragState:H})})}),F1.jsx("div",{className:"shrink-0",children:F1.jsxs(Q5,{children:[F1.jsx(ZB,{trigger:F1.jsx(B5,{render:F1.jsx(j0,{type:"button",variant:"ghost",size:"icon-lg","aria-label":"Create new workspace",className:"text-muted-foreground hover:text-foreground",children:F1.jsx(f2,{"data-icon":"inline-start",stroke:1.5})})})}),F1.jsx(X5,{side:"right",children:"Create new workspace"})]})})]})}),F1.jsx("div",{className:"size-8 shrink-0",children:F1.jsx(z30,{})})]})})}function z30(){let{cloudDemo:$}=O8(),Z=bR();if($)return F1.jsx(FJ,{trigger:F1.jsx(j0,{size:"icon","aria-label":"Unlock all features",title:"Unlock all features",children:F1.jsx(ly,{stroke:1.5})})});if(Z.status==="loading")return null;if(Z.status==="available")return F1.jsx(yR,{...Z.button});return F1.jsx(G30,{})}function G30(){return F1.jsxs(Q5,{children:[F1.jsx(B5,{render:F1.jsx(j0,{render:F1.jsx("a",{href:Q30,target:"_blank",rel:"noreferrer"}),variant:"ghost",size:"icon","aria-label":"Leave feedback",className:"text-muted-foreground hover:text-foreground",children:F1.jsx(cy,{stroke:1.5})})}),F1.jsx(X5,{side:"right",children:"Leave feedback"})]})}function py({workspace:$,dragOverlay:Z=!1,dragState:J}){let[H]=W8(),Q=`/workspace/${$.id}`,B=P$($),X=H===Q||H.startsWith(`${Q}/`),z=F1.jsx("div",{className:B0(A$({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:F1.jsx(u6,{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=F1.jsx("span",{className:"mt-0.5 line-clamp-2 w-full text-center text-[11px] leading-snug font-medium text-ellipsis text-foreground",children:B});if(Z)return F1.jsxs("span",{className:"flex w-14 flex-col items-center",children:[z,G]});return F1.jsxs(y7,{href:Q,"aria-label":B,onClick:(U)=>{if(J?.isDragging)U.preventDefault()},className:B0("group flex w-14 flex-col items-center rounded-xl outline-none",J?.isDragging&&"invisible"),...J?.dragHandleProps,children:[z,F1.jsxs(Q5,{children:[F1.jsx(B5,{render:G}),F1.jsx(X5,{side:"right",children:B})]})]})}var dx=P(m(),1);var iy=P(m(),1);var E$=P(c(),1);function U30({choice:$,availability:Z,isPending:J,errorMessage:H,onTypeChange:Q,onSubmit:B}){return E$.jsx(hK,{title:`Import ${P$($.workspace)}`,selectedType:$.selectedType,detectedTypes:$.workspace.types,availability:Z,isPending:J,errorMessage:H,secondaryAction:E$.jsx(bQ,{render:E$.jsx(j0,{variant:"secondary"}),disabled:J,children:"Cancel"}),primaryLabel:"Add workspace",pendingLabel:"Adding…",onTypeChange:Q,onSubmit:B})}function ry({choice:$,availability:Z,isPending:J,errorMessage:H,onTypeChange:Q,onSubmit:B,onReset:X}){let[z,G]=iy.useState(!0);function U(Y){if(!Y&&J)return;G(Y)}function K(Y){if(!Y)X()}return E$.jsx(O6,{open:z,onOpenChange:U,onOpenChangeComplete:K,children:E$.jsx(vK,{showCloseButton:!J,children:E$.jsx(U30,{choice:$,availability:Z,isPending:J,errorMessage:H,onTypeChange:Q,onSubmit:B})})})}var ay=P(m(),1);function K30($){return $.types[0]??KJ[0]}function oy({onSuccess:$}){let Z=jR(),[J,H]=ay.useState(null);function Q(G){Z.reset(),H({workspace:G,selectedType:K30(G)})}function B(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:Q,selectType:B,submit:X,reset:z}}var AB=P(m(),1);var VB=P(c(),1),Y30=[["OOOOO","O.O.O","O.O.O"],["OOO","O.O","OOO"],["O","O","O"]],d6=10,nK=3,F30=2.5,W30={O:1,o:0.5,".":0},q30=3000,N30=2,ny=3,l6=3,sy=0.001,S$={courantSquared:0.14,damping:0.976,driveAmplitude:1.4,driveFrequency:0.027,gain:0.65,fadeIn:0.36,fadeOut:0.1};function A30($){let Z=Math.max(...$.map((B)=>B.length)),J=Z*d6+(Z-1)*nK,H=$.length*d6+($.length-1)*nK,Q=[];return $.forEach((B,X)=>{Array.from(B).forEach((z,G)=>{let U=W30[z];if(U===void 0)return;let K=G*(d6+nK),Y=X*(d6+nK);Q.push({x:K,y:Y,centerX:K+d6/2,centerY:Y+d6/2,targetOpacity:U})})}),{width:J,height:H,fieldColumns:Math.round(J/l6)+1,fieldRows:Math.round(H/l6)+1,pixels:Q}}var V30=Y30.map(A30);function NB($,Z,J){return $<Z?Z:$>J?J:$}function D30($){return $<0.5?2*$*$:1-(-2*$+2)**2/2}class ty{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/l6),Z=Math.round(this.geometry.height/2/l6),J=2*ny*ny;for(let H=0;H<this.geometry.fieldRows;H++)for(let Q=0;Q<this.geometry.fieldColumns;Q++){let B=(Q-$)**2+(H-Z)**2,X=N30*Math.exp(-B/J),z=H*this.geometry.fieldColumns+Q;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)/q30;if(this.activation=1-D30(Math.min(1,J)),J>=1)this.intro=!1}else{this.intro=!1;let J=this.pointerActive?1:0,H=this.pointerActive?S$.fadeIn:S$.fadeOut;this.activation+=(J-this.activation)*H}let Z=this.renderWave();if(this.intro||this.pointerActive||this.activation>sy||Z>sy){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 Q=1;Q<$-1;Q++){let B=H*$+Q,X=this.field[B-1]+this.field[B+1]+this.field[B-$]+this.field[B+$]-4*this.field[B];this.nextField[B]=(2*this.field[B]-this.previousField[B]+S$.courantSquared*X)*S$.damping}let J=this.previousField;this.previousField=this.field,this.field=this.nextField,this.nextField=J}driveWave($){let Z=NB(Math.round(this.pointerX/l6),1,this.geometry.fieldColumns-2),J=NB(Math.round(this.pointerY/l6),1,this.geometry.fieldRows-2);this.field[J*this.geometry.fieldColumns+Z]=S$.driveAmplitude*Math.sin($*S$.driveFrequency)}sampleField($,Z){let J=NB($/l6,0,this.geometry.fieldColumns-1),H=NB(Z/l6,0,this.geometry.fieldRows-1),Q=Math.floor(J),B=Math.floor(H),X=Math.min(Q+1,this.geometry.fieldColumns-1),z=Math.min(B+1,this.geometry.fieldRows-1),G=J-Q,U=H-B,{fieldColumns:K}=this.geometry,Y=this.field[B*K+Q],F=this.field[B*K+X],W=this.field[z*K+Q],q=this.field[z*K+X];return(Y*(1-G)+F*G)*(1-U)+(W*(1-G)+q*G)*U}renderWave(){let $=0;return this.geometry.pixels.forEach((Z,J)=>{let H=this.rects[J];if(!H)return;let Q=this.sampleField(Z.centerX,Z.centerY);$=Math.max($,Math.abs(Q));let B=NB(0.5+Q*S$.gain,0,1),X=Z.targetOpacity*(1-this.activation)+B*this.activation;H.setAttribute("opacity",X.toFixed(3))}),$}renderTargets(){this.geometry.pixels.forEach(($,Z)=>{this.rects[Z]?.setAttribute("opacity",String($.targetOpacity))})}}function L30({geometry:$}){let Z=AB.useRef([]),J=AB.useRef(null);return AB.useEffect(()=>{let H=J.current;if(!H||window.matchMedia("(prefers-reduced-motion: reduce)").matches)return;let Q=new ty(Z.current,H,$);return Q.start(),window.addEventListener("pointermove",Q.handlePointerMove),()=>{Q.stop(),window.removeEventListener("pointermove",Q.handlePointerMove)}},[$]),VB.jsx("svg",{ref:J,className:"h-8 w-auto",viewBox:`0 0 ${$.width} ${$.height}`,fill:"currentColor","aria-hidden":"true",children:$.pixels.map((H,Q)=>VB.jsx("rect",{ref:(B)=>{Z.current[Q]=B},x:H.x,y:H.y,width:d6,height:d6,rx:F30,opacity:H.targetOpacity},`${H.x}-${H.y}`))})}function ey({className:$}){return VB.jsx("div",{role:"img","aria-label":"moi",className:B0("flex items-center gap-2 text-accent",$),children:V30.map((Z,J)=>VB.jsx(L30,{geometry:Z},J))})}function oD({l:$,c:Z,h:J}){let H=J*Math.PI/180,Q=Z*Math.cos(H),B=Z*Math.sin(H),X=$+0.3963377774*Q+0.2158037573*B,z=$-0.1055613458*Q-0.0638541728*B,G=$-0.0894841775*Q-1.291485548*B,U=X*X*X,K=z*z*z,Y=G*G*G;return[4.0767416621*U-3.3077115913*K+0.2309699292*Y,-1.2684380046*U+2.6097574011*K-0.3413193965*Y,-0.0041960863*U-0.7034186147*K+1.707614701*Y]}var $x=($)=>$.every((Z)=>Z>=-0.0001&&Z<=1.0001);function Qx($){let Z=oD($);if(!$x(Z)){let J=0,H=$.c;for(let Q=0;Q<12;Q++){let B=(J+H)/2;if($x(oD({...$,c:B})))J=B;else H=B}Z=oD({...$,c:J})}return Z.map((J)=>Math.min(1,Math.max(0,J)))}function Zx($){let[Z,J,H]=Qx($);return 0.2126*Z+0.7152*J+0.0722*H}function DB($,Z){let J=Zx($),H=Zx(Z);return(Math.max(J,H)+0.05)/(Math.min(J,H)+0.05)}function Jx($,Z,J){if(DB($,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)),DB(z,Z)>=J)return z;if(z.l===0||z.l===1)break}}let Q={...$,l:0,c:0},B={...$,l:1,c:0};return DB(Q,Z)>=DB(B,Z)?Q:B}function sK($){return"#"+Qx($).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 EJ($){let Z=parseInt($.slice(1),16),[J,H,Q]=[Z>>16&255,Z>>8&255,Z&255].map((K)=>{let Y=K/255;return Y<=0.04045?Y/12.92:Math.pow((Y+0.055)/1.055,2.4)}),B=Math.cbrt(0.4122214708*J+0.5363325363*H+0.0514459929*Q),X=Math.cbrt(0.2119034982*J+0.6806995451*H+0.1073969566*Q),z=Math.cbrt(0.0883024619*J+0.2817188376*H+0.6299787005*Q),G=1.9779984951*B-2.428592205*X+0.4505937099*z,U=0.0259040371*B+0.7827717662*X-0.808675766*z;return{l:0.2104542553*B+0.793617785*X-0.0040720468*z,c:Math.hypot(G,U),h:Math.atan2(U,G)*180/Math.PI}}function M30($,Z,J){let H=(K)=>K*Math.PI/180,Q=$.c*Math.cos(H($.h)),B=$.c*Math.sin(H($.h)),X=Z.c*Math.cos(H(Z.h)),z=Z.c*Math.sin(H(Z.h)),G=Q+(X-Q)*J,U=B+(z-B)*J;return{l:$.l+(Z.l-$.l)*J,c:Math.hypot(G,U),h:Math.atan2(U,G)*180/Math.PI}}var tK=($,Z,J)=>sK(M30(EJ($),EJ(Z),J));var P30={h:12,l:0.84,pull:0.4,c:0.1};var Hx=4.55;function _30($,Z,J){let H=EJ($),Q=EJ(Z),B={l:H.l+(J.l-H.l)*J.pull,c:Math.max(H.c,J.c),h:J.h};B=Jx(B,j30,O30);let X=Jx(Q,B,Hx),z=X.l>=B.l?1:-1,G=sK(B);for(let U=0;U<40;U++){let K=sK(X),Y=1/0;for(let W=0;W<=10;W++){let q=W/10;Y=Math.min(Y,DB(EJ(tK(Z,K,q)),EJ(tK($,G,q))))}if(Y>=Hx)return[G,K];let F=Math.min(1,Math.max(0,X.l+z*0.02));if(F===X.l)return[G,K];X={...X,l:F}}return[G,sK(X)]}var j30={l:0.145,c:0,h:0},O30=1.5;var nD={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},Bx=($)=>String(Math.round($*1000)/1000);function c9($,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 ${Bx(Z.bdy)})`:""}}function d9($){let Z={};for(let J in nD){if(J==="heat")continue;let H=$[J];if(H!==nD[J])Z["--mo-"+J]=Bx(H)}return Z}function T30($,Z,J){let[H,Q]=_30($.head,$.eye,J);return{...$,head:tK($.head,H,Z.heat),eye:tK($.eye,Q,Z.heat)}}var Xx={p:nD,vars:d9,bake:c9},zx={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:d9,bake:c9},Gx={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:d9,bake:c9};var Ux={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:d9,bake:c9},Kx={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:d9,bake:c9},Yx={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:d9,bake:c9},Fx={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:d9,bake:c9},Wx={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:d9,bake:c9};var qx={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:d9,bake:c9,tint:($,Z)=>T30($,Z,P30)};var Nx={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:d9,bake:c9};var Ax=P(c(),1),C30="moi-agent",w30={default:{head:"var(--foreground)",eye:"var(--background)"},primary:{head:"var(--primary)",eye:"var(--primary-foreground)"},secondary:{head:"var(--accent)",eye:"var(--accent-foreground)"}},E30={idle:Xx,happy:zx,sad:Gx,surprised:Ux,wink:Kx,sleepy:Yx,smug:Fx,unsure:Wx,shy:qx,thinking:Nx};function l9({size:$=56,preset:Z=u9.agent,animated:J=!1,color:H="default",expression:Q="idle",className:B}){return Ax.jsx(aG,{name:C30,size:$,animate:J?"always":"hover",palette:w30[H],expression:Q?E30[Q]:void 0,className:B0("shrink-0",B),traits:sQ[Z].traits})}var RJ={};C5(RJ,{Trigger:()=>Ex,Root:()=>Cx,Panel:()=>yx});var LB=P(m(),1);var eK=P(m(),1);function Vx($){let{open:Z,defaultOpen:J=!1,onOpenChange:H,disabled:Q}=$,[B,X]=J4({controlled:Z,default:J,name:"Collapsible",state:"open"}),{mounted:z,setMounted:G,transitionStatus:U}=j2(B,!0,!0),K=t0(),[Y,F]=eK.useState(),W=Y===null?void 0:Y??K,q=U0((N)=>{let V=!B,A=R0(K0.triggerPress,N.nativeEvent);if(H(V,A),A.isCanceled)return;X(V)});return eK.useMemo(()=>({defaultPanelId:K,disabled:Q,handleTrigger:q,mounted:z,open:B,panelId:W,setMounted:G,setOpen:X,setPanelIdState:F,transitionStatus:U}),[K,Q,q,z,B,W,G,X,F,U])}var $Y=P(m(),1),sD=$Y.createContext(void 0);function ZY(){let $=$Y.useContext(sD);if($===void 0)throw Error(y0(15));return $}var Dx="data-open",Lx="data-closed",Mx=n4.startingStyle,Sn0=n4.endingStyle;var _x="data-panel-open";var R30={[Dx]:""},I30={[Lx]:""},jx={open($){if($)return{[_x]:""};return null}},Ox={open($){if($)return R30;return I30}};var JY={...Ox,...Q2};var Tx=P(c(),1),Cx=LB.forwardRef(function(Z,J){let{render:H,className:Q,defaultOpen:B=!1,disabled:X=!1,onOpenChange:z,open:G,style:U,...K}=Z,Y=U0(z),F=Vx({open:G,defaultOpen:B,onOpenChange:Y,disabled:X}),W=LB.useMemo(()=>({open:F.open,disabled:F.disabled,transitionStatus:F.transitionStatus}),[F.open,F.disabled,F.transitionStatus]),q=LB.useMemo(()=>({...F,onOpenChange:Y,state:W}),[F,Y,W]),N=z0("div",Z,{state:W,ref:J,props:K,stateAttributesMapping:JY});return Tx.jsx(sD.Provider,{value:q,children:N})});var wx=P(m(),1);var k30={...jx,...Q2},Ex=wx.forwardRef(function(Z,J){let{panelId:H,open:Q,handleTrigger:B,state:X,disabled:z}=ZY(),{className:G,disabled:U=z,render:K,nativeButton:Y=!0,style:F,...W}=Z,{getButtonProps:q,buttonRef:N}=T5({disabled:U,focusableWhenDisabled:!0,native:Y});return z0("button",Z,{state:X,ref:[J,N],props:[{"aria-controls":Q?H:void 0,"aria-expanded":Q,onClick:B},W,q],stateAttributesMapping:k30})});var tD=P(m(),1);var _4=P(m(),1);var MB={height:void 0,width:void 0};function Rx($){let{externalRef:Z,hiddenUntilFound:J,id:H,keepMounted:Q,mounted:B,onOpenChange:X,open:z,setMounted:G,setOpen:U,transitionStatus:K}=$,Y=_4.useRef(null),F=_4.useRef(null),[W,q]=_4.useState(MB),N=_4.useRef(MB),V=_4.useRef(!1),A=_4.useRef(z),D=_4.useRef(!1),[L,j]=_4.useState(!1),M=_4.useRef(null),_=x2(Z,Y),E=U5(z),C=h4(Y),R=!z&&!B,T=L?"idle":K,I=z&&(A.current||D.current),y=!z&&B&&F.current==="css-animation"&&W.height===void 0&&W.width===void 0?N.current:W,S=J&&R&&F.current!=="css-animation",O=U0((f,w=!0)=>{if(w)N.current=f;q(f)}),b=U0(()=>{M.current?.(),M.current=null}),k=U0((f)=>{b(),M.current=()=>{M.current=null,f()}}),h=U0(()=>{if(z&&B&&F.current==="css-animation")D.current=!0});J0(()=>{if(!L||K==="starting")return;j(!1)},[L,K]),_4.useEffect(()=>{return()=>{h(),b()}},[h,b]),J0(()=>{let f=Y.current;if(!f)return;if(!z&&M.current)b();let w=b30(f,I);if(F.current=w,z&&K==="idle"&&A.current&&w==="css-animation"){N.current=SJ(f);return}if(z&&K==="starting"){let x=V.current;if(V.current=!1,w==="none"){O(SJ(f)),j(!0);return}if(w==="css-transition"){let p=y30(f);if(O(SJ(f)),!x)return p;let d=HY(f,"transition-duration","0s");return k(d),j(!0),p}O(SJ(f));let l=HY(f,"animation-name","none");if(!x){l();return}let s=HY(f,"animation-duration","0s");l(),k(s),j(!0);return}if(!z&&B&&(K==="idle"||K==="starting")){if(A.current=!1,D.current=!1,w==="none"){O(MB,!1),G(!1);return}O(SJ(f));return}if(K!=="ending")return;if(w==="none"){G(!1);return}let i=SJ(f);if(!(i.height>0||i.width>0)){G(!1);return}if(O(i),w==="css-animation")HY(f,"animation-name","none")();return},[B,z,b,O,G,k,I,K]),W5({enabled:z&&B&&T==="idle",open:!0,ref:Y,onComplete(){if(!z)return;O(MB,!1)}}),_4.useEffect(()=>{if(z||!B||T!=="ending")return;if(!Y.current)return;let w=new AbortController,i=-1;function r(){if(E.current)return;G(!1),O(MB,!1)}return i=b2.request(()=>{C(r,w.signal)}),()=>{b2.cancel(i),w.abort()}},[E,B,z,T,C,O,G]),J0(()=>{let f=Y.current;if(!f||!J||!R)return;f.setAttribute("hidden","until-found")},[R,J]),_4.useEffect(function(){let w=Y.current;if(!w)return;function i(r){let x=R0(K0.none,r);if(X(!0,x),x.isCanceled)return;V.current=!0,U(!0)}return n0(w,"beforematch",i)},[X,U]);let v=Q||J||B||z;return{height:y.height,props:{...S?{[Mx]:""}:void 0,hidden:R,id:H},ref:_,shouldPreventOpenAnimation:I,shouldRender:v,transitionStatus:T,width:y.width}}function SJ($){return{height:$.scrollHeight,width:$.scrollWidth}}function b30($,Z){let J=R1($).getComputedStyle($),H=(J.animationName.split(",").map((B)=>B.trim()).some((B)=>B!==""&&B!=="none")||Z)&&Sx(J.animationDuration),Q=Sx(J.transitionDuration);if(H&&Q)return"css-transition";if(Q)return"css-transition";if(H)return"css-animation";return"none"}function Sx($){return $.split(",").map((Z)=>Z.trim()).some((Z)=>Z!==""&&Number.parseFloat(Z)>0)}function HY($,Z,J){let H=$.style.getPropertyValue(Z),Q=$.style.getPropertyPriority(Z);return $.style.setProperty(Z,J),()=>{if(H===""){$.style.removeProperty(Z);return}$.style.setProperty(Z,H,Q)}}function y30($){let Z={"justify-content":$.style.justifyContent,"align-items":$.style.alignItems,"align-content":$.style.alignContent,"justify-items":$.style.justifyItems};Object.keys(Z).forEach((Q)=>{$.style.setProperty(Q,"initial","important")});function J(){Object.entries(Z).forEach(([Q,B])=>{if(B===""){$.style.removeProperty(Q);return}$.style.setProperty(Q,B)})}let H=b2.request(J);return()=>{b2.cancel(H),J()}}var Ix="--collapsible-panel-height",kx="--collapsible-panel-width";var yx=tD.forwardRef(function(Z,J){let{className:H,hiddenUntilFound:Q,keepMounted:B,render:X,id:z,style:G,...U}=Z,{defaultPanelId:K,mounted:Y,onOpenChange:F,open:W,setMounted:q,setPanelIdState:N,setOpen:V,state:A,transitionStatus:D}=ZY(),L=Q??!1,j=B??!1,M=z||void 0,_=M??K;J0(()=>{return N((h)=>M??(h===null?void 0:h)),()=>{N((h)=>h===M?null:h)}},[M,N]);let{height:E,props:C,ref:R,shouldPreventOpenAnimation:T,shouldRender:I,transitionStatus:y,width:S}=Rx({externalRef:J,hiddenUntilFound:L,id:_,keepMounted:j,mounted:Y,onOpenChange:F,open:W,setMounted:q,setOpen:V,transitionStatus:D}),O={...A,transitionStatus:y},b=bx(G,O),k=z0("div",{...Z,style:void 0},{state:O,ref:R,props:[C,{style:{[Ix]:E===void 0?"auto":`${E}px`,[kx]:S===void 0?"auto":`${S}px`}},U,b?{style:b}:void 0,T?{style:{animationName:"none"}}:void 0],stateAttributesMapping:JY});if(!I)return null;return k});var zY=P(c(),1);function QY({...$}){return zY.jsx(RJ.Root,{"data-slot":"collapsible",...$})}function BY({...$}){return zY.jsx(RJ.Trigger,{"data-slot":"collapsible-trigger",...$})}function XY({...$}){return zY.jsx(RJ.Panel,{"data-slot":"collapsible-content",...$})}var GY=P(m(),1);var eD="moi-fonts",xx="moi-font-previews",h30=Object.values(m6).map(($)=>$.googleFontsQuery).filter(Boolean).join("&family="),vx=[["sans","--sans"],["mono","--mono"]],gx=yD.map(($)=>[$,v30($)]),fx="--radius",hx=[...vx.map(([,$])=>$),...gx.map(([,$])=>$),fx];function v30($){return`--${$.replace(/[A-Z]/g,(J)=>`-${J.toLowerCase()}`)}`}function g30($){let Z={},J=$9($),H=J.font===u9.font?void 0:m6[J.font];for(let[Q,B]of vx)Z[B]=H?.[Q];return Z}function $L($,Z="workspace"){let J={},H=yK($,Z);for(let[Q,B]of gx)J[B]=H?.[Q];return J}function f30($){let Z={},J=$9($),H=J.radius===u9.radius?void 0:nQ[J.radius];return Z[fx]=H?.radius,Z}function J9($,Z="workspace"){return{...g30($),...$L($,Z),...f30($)}}function UY(){GY.useEffect(()=>{if(document.getElementById(xx))return;let $=document.createElement("link");return $.id=xx,$.rel="stylesheet",$.crossOrigin="anonymous",$.href=`https://fonts.googleapis.com/css2?family=${h30}&display=swap`,document.head.appendChild($),()=>{$.remove()}},[])}function m30($){GY.useEffect(()=>{let Z=document.documentElement,J=J9($);for(let H of hx){let Q=J[H];if(Q)Z.style.setProperty(H,Q);else Z.style.removeProperty(H)}return()=>{for(let H of hx)Z.style.removeProperty(H)}},[$])}function mx($){let{font:Z}=$9($);m30($),GY.useEffect(()=>{let J=m6[Z]??m6[u9.font],H=document.getElementById(eD);if(!J.googleFontsQuery)H?.remove();else{let Q=`https://fonts.googleapis.com/css2?family=${J.googleFontsQuery}&display=swap`;if(H)H.href=Q;else{let B=document.createElement("link");B.id=eD,B.rel="stylesheet",B.crossOrigin="anonymous",B.href=Q,document.head.appendChild(B)}}return()=>{document.getElementById(eD)?.remove()}},[Z])}var IJ=P(m(),1);var N2=P(c(),1),PB={width:320,height:180,radius:32,topLeftRadius:18,bodyTop:24,tabEnd:124,shoulder:{width:48,roundness:20}};function u30($){let{width:Z,height:J,radius:H,topLeftRadius:Q,bodyTop:B,tabEnd:X,shoulder:z}=PB,G=Math.min(Z/2,H*$),U=Math.min(Z/2,Q*$),K=Math.max(0,z.width),Y=X+K,F=Math.max(0,Math.min(z.roundness,K/2));return[`M ${U} 0`,`H ${X}`,`C ${X+F} 0 ${Y-F} ${B} ${Y} ${B}`,`H ${Z-G}`,`Q ${Z} ${B} ${Z} ${B+H}`,`V ${J-H}`,`Q ${Z} ${J} ${Z-G} ${J}`,`H ${G}`,`Q 0 ${J} 0 ${J-H}`,`V ${Q}`,`Q 0 0 ${U} 0`,"Z"].join(" ")}function p30(){let $=IJ.useRef(null),[Z,J]=IJ.useState(1);return IJ.useLayoutEffect(()=>{let H=$.current;if(!H)return;let Q=(z,G)=>{if(z<=0||G<=0)return;let U=z/PB.width,Y=G/PB.height/U;J((F)=>Math.abs(F-Y)<0.001?F:Y)},B=H.getBoundingClientRect();Q(B.width,B.height);let X=new ResizeObserver(([z])=>{if(z)Q(z.contentRect.width,z.contentRect.height)});return X.observe(H),()=>X.disconnect()},[]),{ref:$,horizontalRadiusScale:Z}}var ux=[{frame:B0("-translate-x-3 translate-y-3 -rotate-6","group-focus-within:translate-y-2 group-hover:translate-y-2"),img:"opacity-40"},{frame:B0("translate-x-3 translate-y-2 rotate-5","group-focus-within:translate-y-1 group-hover:translate-y-1"),img:"opacity-50"},{frame:B0("-translate-x-1 translate-y-1 -rotate-2","group-focus-within:-translate-y-2 group-hover:-translate-y-2"),img:"opacity-100"}];function px({workspaceId:$}){let Z=qU($),J=Z.data?[...Z.data.thumbnails].reverse():[],H=ux.slice(ux.length-J.length),Q=Z.data?.firstUserMessage,B=Z.data?.theme,{ref:X,horizontalRadiusScale:z}=p30(),G=u30(z),U=`folder-noise-${$}`,K=J9(B),Y=$L(B);return N2.jsxs("div",{ref:X,style:Y,className:"relative h-45 w-full",children:[N2.jsxs("svg",{viewBox:`0 0 ${PB.width} ${PB.height}`,preserveAspectRatio:"none","aria-hidden":"true",className:"absolute inset-0 h-full w-full overflow-visible",children:[N2.jsx("defs",{children:N2.jsxs("filter",{id:U,x:"0%",y:"0%",width:"100%",height:"100%",colorInterpolationFilters:"sRGB",children:[N2.jsx("feTurbulence",{type:"fractalNoise",baseFrequency:"0.5",numOctaves:"3",seed:"7",result:"noise"}),N2.jsx("feColorMatrix",{in:"noise",type:"saturate",values:"0",result:"monochromeNoise"}),N2.jsx("feComponentTransfer",{in:"monochromeNoise",result:"faintNoise",children:N2.jsx("feFuncA",{type:"linear",slope:"0.24"})}),N2.jsx("feComposite",{in:"faintNoise",in2:"SourceAlpha",operator:"in",result:"clippedNoise"}),N2.jsx("feBlend",{in:"SourceGraphic",in2:"clippedNoise",mode:"soft-light"})]})}),N2.jsx("path",{d:G,filter:`url(#${U})`,className:"fill-accent"})]}),J.map((F,W)=>N2.jsx("div",{className:B0("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:N2.jsx("img",{src:F,alt:"",loading:"lazy",className:B0("block h-auto max-h-32 w-auto max-w-full object-contain",H[W].img)})},F)),J.length===0&&Q&&N2.jsx("div",{className:"absolute inset-x-[12%] top-[22%] flex justify-end",children:N2.jsx("div",{"aria-hidden":"true",style:K,className:B0("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:N2.jsx("p",{className:"line-clamp-3 text-sm leading-normal whitespace-normal",children:Q})})}),N2.jsx("div",{className:B0("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 H1=P(c(),1);function lx(){UY();let[,$]=W8(),Z=WU(),J=_R(),H=NU(),Q=oy({onSuccess:(q)=>$(`/workspace/${q.id}`)}),B=O8(),[X,z]=dx.useState(!1),G=w5((q)=>q.discoveredWorkspacesOpen),U=w5((q)=>q.setDiscoveredWorkspacesOpen);if(Z.isPending||J.isPending)return H1.jsx("div",{className:"flex min-h-[50vh] items-center justify-center",children:H1.jsx(b5,{size:20,stroke:1.5,className:"animate-spin text-muted-foreground"})});if(Z.isError||J.isError)return H1.jsx("div",{className:"flex min-h-[50vh] items-center justify-center",children:H1.jsx("p",{className:"text-sm text-muted-foreground",children:"Could not load spaces."})});let K=Z.data,Y=J.data,F=K.length;function W(q){if(B.cloudDemo){z(!0);return}Q.startImport(q)}return H1.jsxs("div",{className:"mx-auto w-full max-w-3xl px-8 pt-14 pb-16",children:[H1.jsx(ey,{className:"mb-10"}),F>0?H1.jsxs("section",{className:"mb-12",children:[H1.jsxs("div",{className:"mb-4 flex items-center justify-between gap-2",children:[H1.jsx("h1",{className:"text-sm font-medium text-foreground",children:"My workspaces"}),H1.jsx(ZB,{trigger:H1.jsxs(j0,{variant:"outline",size:"sm",children:[H1.jsx(f2,{"data-icon":"inline-start",stroke:1.75}),"New"]})})]}),H1.jsx("div",{className:"grid grid-cols-1 gap-x-4 gap-y-8 sm:grid-cols-2 md:grid-cols-3",children:K.map((q)=>H1.jsx(c30,{workspace:q},q.id))})]}):H1.jsxs("div",{className:"mb-10 flex flex-col items-center gap-4 px-8 pt-8 pb-16 text-center",children:[H1.jsx(cx,{size:32,stroke:1.5,className:"text-muted-foreground"}),H1.jsxs("div",{className:"flex flex-col gap-1.5",children:[H1.jsx("h2",{className:"font-medium",children:"Let’s start with creating your first workspace"}),H1.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."})]}),H1.jsx(ZB,{trigger:H1.jsx(j0,{children:"Create workspace"})})]}),Y.length>0&&H1.jsx("section",{children:H1.jsxs(QY,{open:G,onOpenChange:U,className:"group",children:[H1.jsxs(BY,{className:B0("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:[H1.jsx("span",{className:"text-sm font-medium",children:"Import from this computer"}),H1.jsx(R$,{size:16,stroke:2,className:B0("opacity-0 transition-[opacity,transform]","group-hover/trigger:opacity-100 group-focus-visible/trigger:opacity-100 group-data-open:rotate-90")})]}),H1.jsx(XY,{children:H1.jsx("ul",{className:"border-t border-border",children:Y.map((q)=>H1.jsx(d30,{suggestion:q,onAdd:W},q.path))})})]})}),Q.choice&&H1.jsx(ry,{choice:Q.choice,availability:H.data?.availability,isPending:Q.isPending,errorMessage:Q.error?.message,onTypeChange:Q.selectType,onSubmit:Q.submit,onReset:Q.reset}),H1.jsx(FJ,{open:X,onOpenChange:z})]})}function c30({workspace:$}){let Z=P$($),J=qU($.id),H=$.theme??J.data?.theme,Q=$9(H).agent,B=g2((G)=>EG(G.activity,$.id)),X=J.data?.updatedAt??new Date($.addedAt).getTime(),z=`/workspace/${$.id}`;return H1.jsxs("div",{className:"group flex min-w-0 flex-col gap-3",children:[H1.jsxs("div",{className:"relative",children:[H1.jsx(px,{workspaceId:$.id}),H1.jsx(y7,{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&&H1.jsxs(Q5,{children:[H1.jsx(B5,{render:H1.jsx(y7,{href:DE($.id,"agent"),"aria-label":`Chat in ${Z}`,style:J9(H),className:"absolute right-3 bottom-3 rounded-lg outline-none focus-visible:ring-3 focus-visible:ring-ring/50",children:H1.jsx(l9,{preset:Q,color:"primary",animated:B,expression:B?"thinking":void 0,size:48,className:"drop-shadow-sm drop-shadow-primary/20"})})}),H1.jsx(X5,{children:"Chat"})]})]}),H1.jsxs(y7,{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:[H1.jsxs("div",{className:"flex min-w-0 items-center gap-1.5 font-sans",style:J9(H),children:[H1.jsx(u6,{icon:$.icon,workspaceType:$.type,workspaceTheme:H,className:"size-4 shrink-0 rounded-xs"}),H1.jsx("span",{className:"truncate text-sm font-medium text-foreground",children:Z})]}),H1.jsx("span",{className:"text-xs text-muted-foreground",children:l30(X)})]})]})}function d30({suggestion:$,onAdd:Z}){let{path:J,types:H}=$,Q=P$($);return H1.jsxs("li",{className:"flex items-center gap-2 border-b border-border px-1 py-3",children:[H1.jsx(ob,{types:H}),H1.jsx("span",{className:"shrink-0 text-sm font-medium text-foreground",children:Q}),H1.jsx("span",{title:J,className:"min-w-0 flex-1 truncate text-xs text-muted-foreground",children:$.displayPath??J}),H1.jsxs(j0,{variant:"outline",size:"sm",onClick:()=>Z($),children:[H1.jsx(f2,{stroke:1.75}),"Add"]})]})}function l30($){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 Q=Math.floor(H/24);if(Q<30)return`Updated ${Q} day${Q===1?"":"s"} ago`;return`Updated ${new Date($).toLocaleDateString()}`}var KY=P(c(),1);function ix(){return KY.jsx(oK,{showWorkspaces:!1,children:KY.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:KY.jsx(lx,{})})})}var YY=P(m(),1);var ZL=P(c(),1),ox=($)=>$.map((Z)=>[...Z].map((J)=>J==="#"?1:0)),i30=["####.","#.#.#","#.#.#","#.#.#","#.#.#"],r30=["###.#","#.#.#","#.#.#","#.#.#","###.#"],a30=ox([".....","####.","#.#.#","#.#.#","#.#.#"]),o30=ox(i30.map(($,Z)=>`${$}.${r30[Z]}`)),n30={moi:a30,"moi-full":o30};function nx($,Z,J){let H=[];for(let Q=0;Q<Z;Q++){let B=[];for(let X=0;X<$;X++)B.push(J(X,Q));H.push(B)}return H}function rx($,Z,J){let H=Math.sin($*12.9898+Z*78.233+J*37.719)*43758.5453;return H-Math.floor(H)}function s30($,Z,J){return nx(Z,J,(H,Q)=>{let B=rx(H,Q,0)*Math.PI*2,X=5+rx(H,Q,1)*6,z=0.5+0.5*Math.sin($*X+B);return z*z})}function t30($,Z,J){return nx(Z,J,(Q,B)=>0.5+0.5*Math.sin(Q*0.5+B*0.32-$*6.5))}var sx=0.55;function e30($,Z){let J=$.length,H=$.reduce((G,U)=>Math.max(G,U.length),0),Q=Math.min(Z/sx,1),B=1-Math.pow(1-Q,3),X=Math.round((1-B)*J),z=[];for(let G=0;G<J;G++){let U=[];for(let K=0;K<H;K++)U.push($[G-X]?.[K]??0);z.push(U)}return z}function ax($,Z,J){let H=n30[$];if(Z===void 0)return e30(H,J);let Q=H.length,B=H[0]?.length??0;return Z==="wave"?t30(J,B,Q):s30(J,B,Q)}var $60=24;function Z60($,Z,J){let[H,Q]=YY.useState(()=>ax($,Z,0));return YY.useEffect(()=>{let B=0,X=null,z=0,G=1000/J,U=(K)=>{if(X===null)X=K;let Y=(K-X)/1000;if(K-z>=G){if(z=K,Q(ax($,Z,Y)),Z===void 0&&Y>=sx)return}B=requestAnimationFrame(U)};return B=requestAnimationFrame(U),()=>cancelAnimationFrame(B)},[$,Z,J]),H}function J60($){return`rgba(23, 23, 23, ${(0.1+Math.max(0,Math.min(1,$))*0.9).toFixed(3)})`}function tx({sprite:$="moi",effect:Z,fps:J=$60,pixelSize:H=3,gap:Q=1,className:B}){let X=Z60($,Z,J),z=X[0]?.length??0,G=Z!==void 0;return ZL.jsx("div",{className:B0("grid",B),style:{gridTemplateColumns:`repeat(${z}, ${H}px)`,gap:`${Q}px`},children:X.flatMap((U,K)=>U.map((Y,F)=>ZL.jsx("div",{className:"rounded-[2px]",style:{width:H,height:H,background:J60(Y),boxShadow:G?`0 0 ${(H*(0.4+Y)).toFixed(1)}px rgba(23, 23, 23, ${(Y*0.35).toFixed(3)})`:void 0}},`${K}-${F}`)))})}var bJ=P(m(),1);var FY=5000,WY=120;var H60="</moi-attachments>";function JL($){if(!x9($)||typeof $.label!=="string")return null;let Z=$.label.trim();if(!Z||Z.length>WY||typeof $.text!=="string"||!$.text.trim()||$.text.length>FY)return null;return{label:Z,text:$.text}}function ex($){return Array.isArray($)&&$.every((Z)=>x9(Z)&&Z.purpose===void 0&&(Z.source===void 0||typeof Z.source==="string"&&Z.source.length>0)&&JL(Z)!==null)}function $h($){return $==="annotation"||$==="sketch"}function Q60($){return Array.isArray($)&&$.every((Z)=>{if(!x9(Z))return!1;if(Z.type==="text")return ex([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&&(!$h(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 HL($){let Z=[],J=!1,H=$.replace(/<moi-attachments>([^<]*)<\/moi-attachments>/g,(Q,B)=>{try{let X=JSON.parse(B),z=x9(X)&&X.version===1&&Array.isArray(X.attachments)?X.attachments.map((G)=>x9(G)?{type:"text",source:G.source,label:G.label,text:G.text}:G):X;if(!Q60(z))return Q;return Z.push(...z),J=!0,""}catch{return Q}});return{text:J?H.trim():$,attachments:Z}}function QL($){return $.type==="file"?$.path.split(/[\\/]/).at(-1):$.label}function Zh($,Z){let{source:J}=$,H=QL($);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 B60($){return HL($).text}function Jh($){let Z=B60($),J=Z.search(/<moi-attachments>\s*(?:\[|\{"version":1,"attachments":\[)/);return(J<0||Z.includes(H60,J)?Z:Z.slice(0,J)).trimEnd()}var Hh=10;function qY($){return $.length>Hh?`A message can have at most ${Hh} attachments.`:null}var Qh=33554432;function Bh($){return typeof $==="string"&&$.length>0&&!/[\\:\0]/.test($)&&$.split("/").every((Z)=>Z.length>0&&!Z.startsWith("."))}var Uh=P(m(),1);var Xh=()=>({emit($,...Z){for(let J=this.events[$]||[],H=0,Q=J.length;H<Q;H++)J[H](...Z)},events:{},on($,Z){return(this.events[$]||=[]).push(Z),()=>{this.events[$]=this.events[$]?.filter((J)=>Z!==J)}}});var X60=({kind:$,name:Z})=>`${$}:${Z}`,z60=1000,BL={cooldownMs:2000,windowMs:60000,maxPerWindow:10,maxKeys:64};function G60($){let Z=Xh(),J=CG(BL),H=(X,z)=>{Z8($,{source:"runtime",kind:X.kind,name:X.name,message:z})},Q=(X,z,G,U,K)=>{let Y=X.admit(G);if(Y==="ok")return!0;return H(z,Y==="cooldown"?U:K),!1},B=(X,z,G)=>{return Q(J,X,`${z}\x00${G}`,`sendChatMessage() for "${G}" was dropped: the same message was already sent less than ${BL.cooldownMs/1000}s ago. Call it from an event handler, not during render.`,`sendChatMessage() for "${G}" was dropped: more than ${BL.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=X60(X),K={apiBase:`/api/workspaces/${encodeURIComponent($)}`,workspacePath:o8($,z)};return{bridge:{get collab(){return G?PV:void 0},addChatAttachment(F){if(!G)return;try{let W=zh(F,U);Z.emit("addChatAttachment",W)}catch(W){let q=XL(W);A5.add({title:"Couldn’t add attachment",description:q,type:"error"}),H(X,`addChatAttachment() was dropped: ${q}`)}},navigate(F){if(!G)return;try{if(typeof F!=="string")throw Error("Navigation needs a URL");B$(F,K),Z.emit("navigate",F)}catch(W){H(X,`navigate() was dropped: ${XL(W)}`)}},resolveUrl(F){if(!G)return"";if(typeof F!=="string")throw Error("A URL is required");return B$(F,K)},sendChatMessage(F,W){if(!G)return;try{if(typeof F==="string")F={message:F,attachments:W===void 0?[]:[{type:"text",label:"Context",text:JSON.stringify(W)}]};if(!x9(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 q=F.message.trim();if(!q)throw Error("The message is empty");if(q.length>z60)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??[],(V)=>zh(V,U));if(!B(X,U,q))return;Z.emit("sendChatMessage",{message:q,source:U,attachments:N})}catch(q){let N=XL(q);A5.add({title:"Couldn’t send message",description:N,type:"error"}),H(X,`sendChatMessage() was dropped: ${N}`)}}},dispose:()=>{G=!1}}}}}function zh($,Z){if(!x9($))throw Error("This attachment isn’t supported");if($.type==="text"){let J=JL($);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>WY)throw Error(`Attachment labels can be up to ${WY} characters`);if(typeof $.text!=="string"||!$.text.trim())throw Error("Add some text to this attachment");if($.text.length>FY)throw Error(`Text attachments can be up to ${FY.toLocaleString("en-US")} characters`)}else if($.type==="file"){if($.file instanceof File&&$.path===void 0){if($.file.size>Qh)throw Error("Files can be up to 32 MB");return{type:"file",file:$.file,source:Z}}if(typeof $.path==="string"&&$.file===void 0){if(!Bh($.path))throw Error("Choose a file from this workspace");return{type:"file",path:$.path,source:Z}}}throw Error("This attachment isn’t supported")}function XL($){return $ instanceof Error?$.message:String($)}var Gh=new Map;function AY($){let Z=Gh.get($);if(!Z)Z=G60($),Gh.set($,Z);return Z}function VY($,Z,J){let H=K5(J);Uh.useEffect(()=>{let Q=(...B)=>H.current(...B);return AY($).on(Z,Q)},[$,Z,H])}var NY=new Map;function Kh($,Z,J,H,Q=""){let B=$.__attachBridge;if(typeof B!=="function")return;NY.get(J)?.();let{bridge:X,dispose:z}=AY(Z).connect(H,Q);NY.set(J,z),B(X)}function zL($){let Z=NY.get($);if(!Z)return;NY.delete($),Z()}function DY($,Z,J){return`${$}/${Z}/${J}`}var kJ=new Map,_B=new Map;function U60($,Z,J){return kJ.get(DY($,Z,J))??0}var K60="module";function Yh($,Z,J){return`/api/workspaces/${Z}/${$}/${J}/${K60}?v=${U60($,Z,J)}`}function LY($,Z,J){return`/api/workspaces/${Z}/${$}/${J}`}function i6($,Z){return`${$}/${Z}`}function Fh($){return _B.get($)}function Wh($,Z){_B.set($,Z)}function MY($,Z,J){let H=DY($,Z,J);_B.delete(H),kJ.set(H,(kJ.get(H)??0)+1),zL(H)}function GL($){let Z=`${$}/`;for(let J of new Set([..._B.keys(),...kJ.keys()]))if(J.startsWith(Z))_B.delete(J),kJ.set(J,(kJ.get(J)??0)+1),zL(J)}var Y60={kind:"widget",segment:"widgets",shouldReload:($,Z)=>$.type==="widget:updated"&&$.name===Z||$.type==="applets:refresh"&&$.only!=="views"},F60={kind:"view",segment:"views",shouldReload:($,Z)=>$.type==="view:updated"&&$.name===Z||$.type==="applets:refresh"&&$.only!=="widgets"};function W60($,Z,J,H){let{segment:Q}=$,B=DY(Q,Z,J),X=Fh(B);if(X)return X;let z=import(Yh(Q,Z,J)).then((G)=>{if(!G.default)throw Error(`"${J}" has no default export`);return Kh(G,Z,B,{kind:$.kind,name:J},H),G.default});return Wh(B,z),z}function qh($,Z){let J=e1(),{base:H}=i2(),[Q,B]=bJ.useState({status:"loading",version:0}),X=bJ.useCallback(()=>{B((z)=>({status:"loading",version:z.version})),W60($,J,Z,H).then((z)=>B((G)=>({status:"ready",Component:z,version:G.version+1}))).catch((z)=>{Z8(J,{source:"load",kind:$.kind,name:Z,message:String(z),...z instanceof Error&&z.stack?{stack:z.stack}:{}}),B((G)=>({status:"error",error:String(z),version:G.version+1}))})},[H,$,J,Z]);return bJ.useEffect(()=>{X()},[X]),W2((z)=>{if($.shouldReload(z,Z))MY($.segment,J,Z),X()}),Q}function Nh($){return qh(Y60,$)}function Ah($){return qh(F60,$)}function Vh(){let $=e1();W2((Z)=>{if(Z.type==="view:updated")MY("views",$,Z.name);else if(Z.type==="widget:updated")MY("widgets",$,Z.name);else if(Z.type==="applets:refresh"){if(Z.only!=="views")GL("widgets");if(Z.only!=="widgets")GL("views")}})}var S8=P(m(),1);var Lh=P(m(),1);var p4={staleTime:0,gcTime:300000,refetchOnMount:!0,refetchOnWindowFocus:!0};function Mh($){return J5({queryKey:S0.layout($),queryFn:()=>q1(`/api/workspaces/${$}`),...p4})}function i9($){let Z=U1();return Lh.useEffect(()=>Dh(()=>{Z.invalidateQueries({queryKey:S0.agent($)})}),[Z,$]),W2((J)=>{if(J.type==="agent:updated"&&J.workspaceId===$)Z.setQueryData(S0.agent($),(H)=>H?{...H,availability:J.availability,login:J.login}:H);if(J.type==="env:updated"&&J.workspaceId===$)Z.invalidateQueries({queryKey:S0.agent($)})}),J5({queryKey:S0.agent($),queryFn:()=>q1(`/api/workspaces/${$}/agent`),staleTime:30000,refetchOnWindowFocus:!0})}function Ph($){return q1(`/api/workspaces/${$}/auth/login`,{method:"POST"},"Could not start sign-in")}function _h($){return J5({queryKey:S0.skills($),queryFn:()=>q1(`/api/workspaces/${$}/skills`),...p4})}async function q60($){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 Q=H&&"error"in H?H.error:J,B=Error(Q||"Failed to update workspace skill");if(H?.skills)B.status={skills:H.skills,updateAvailable:H.updateAvailable};throw B}if(!H)throw Error("Invalid workspace skill update response");return H}function jh($){let Z=U1();return H5({mutationFn:()=>q60($),onSuccess:(J)=>{Z.setQueryData(S0.skills($),J)},onError:(J)=>{if(J.status)Z.setQueryData(S0.skills($),J.status)}})}function Oh($){let Z=U1();return H5({mutationFn:(J)=>P4(`/api/workspaces/${$}`,g5("PUT",J),"Failed to save layout"),onSuccess:()=>{Z.invalidateQueries({queryKey:S0.preview($)})}})}var UL={id:"_moi_views",config:{colSpan:4,rowSpan:1},defaultPosition:{x:0,y:0}},KL=[UL],N60=new Set(KL.map(($)=>$.id));function r9($){return N60.has($)}function Th($){return[...KL,...$]}function Ch(){return KL.map(($)=>({i:$.id,...$.defaultPosition}))}function PY(){return{open:["overview","agent","scratchpad"],active:"overview"}}function _Y($){let Z=PY();if(!$||typeof $!=="object")return Z;let J=$,H=Array.isArray(J.open)?J.open.filter(NQ).filter((X,z,G)=>G.indexOf(X)===z):[];if(H.length===0)return Z;let Q=["overview",...H.filter((X)=>X!=="overview")],B=NQ(J.active)&&Q.includes(J.active)?J.active:"overview";return{open:Q,active:B}}function wh(){return{version:1,widgetGrid:Ch(),layoutMode:"split",tabs:PY()}}function Eh($,Z,J){let{tabs:H,...Q}=$,B=Z.tabs??J?.tabs;return B===void 0?Q:{...Q,tabs:B}}var kh=P(c(),1),YL=S8.createContext(null);function i1(){let $=S8.useContext(YL);if(!$)throw Error("useWorkspaceLayoutCtx must be used within <WorkspaceLayoutProvider>");return $}function Rh(){return S8.useContext(YL)?.layout.theme}function Sh($){let{cwd:Z,name:J,provider:H,agentId:Q,...B}=$;return B}function Ih({id:$,children:Z}){let J=U1(),H=Mh($),Q=Oh($),B=K5(Q.mutate),X=S8.useRef(null),z=S8.useRef(null),G=S8.useCallback((K)=>{let Y=S0.layout($),F=J.getQueryData(Y);if(!F)return;let W={...F,...K};if(J.setQueryData(Y,W),z.current=Eh(Sh(W),K,z.current),X.current)clearTimeout(X.current);X.current=setTimeout(()=>{X.current=null;let q=z.current;if(z.current=null,q)B.current(q)},600)},[$,J,B]),U=S8.useMemo(()=>({layout:H.data?Sh(H.data):wh(),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 kh.jsx(YL,{value:U,children:Z})}var F2=P(m(),1);var OY=P(c(),1);function jY({visible:$,editing:Z,canvasRef:J,width:H,height:Q,pointerProps:B,onKeyDown:X,children:z}){if(!$)return null;return OY.jsxs("div",{className:"absolute inset-0 animate-in duration-100 fade-in",onKeyDown:X,children:[OY.jsx("canvas",{ref:J,...B,width:H,height:Q,"aria-label":"Drawing area",tabIndex:0,className:"absolute inset-0 size-full cursor-pencil touch-none outline-none"}),Z&&z]})}var e0=P(m(),1);function WL($,Z,J){let H=Math.max($,Z);if(H<=0)return 1;return Math.min(Math.max(J,1),1568/H)}function A60($){return new Promise((Z,J)=>{setTimeout(()=>J(Error("Annotation capture timed out")),$)})}function V60($){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 bh($){let Z=$.getBoundingClientRect();if(Z.width<=0||Z.height<=0)throw Error("Annotation target is not visible");let{createContext:J,destroyContext:H,domToCanvas:Q}=await import("/chunk-efdyz6xp.js"),B=async()=>{let X=await J($,{width:Math.round(Z.width),height:Math.round(Z.height),scale:WL(Z.width,Z.height,window.devicePixelRatio),type:"image/png",backgroundColor:getComputedStyle($).backgroundColor,timeout:1000,features:{restoreScrollPosition:!0},style:{overflow:"hidden"},onCloneEachNode:V60});try{return await Q(X)}finally{H(X)}};return Promise.race([B(),A60(1e4)])}var qL={past:[],present:[],future:[]};function D60($,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 hh($,Z,J){let H=$.getBoundingClientRect();return{x:(Z-H.left)/H.width*$.width,y:(J-H.top)/H.height*$.height}}function yh($,Z){let J=Z.getCoalescedEvents?.()??[];return(J.length>0?J:[Z]).map((Q)=>hh($,Q.clientX,Q.clientY))}var L60={canUndo:!1,canRedo:!1,hasStrokes:!1};function jB($){return e0.useSyncExternalStore($.subscribeHistory,$.getHistoryState,$.getHistoryState)}function xh($,Z,J,H){let Q=Z.points[0];if(!Q)return;$.beginPath(),$.lineCap="round",$.lineJoin="round",$.lineWidth=H,$.strokeStyle=J,$.moveTo(Q.x,Q.y);for(let B=1;B<Z.points.length;B++){let X=Z.points[B];$.lineTo(X.x,X.y)}if(Z.points.length===1)$.lineTo(Q.x+0.01,Q.y+0.01);$.stroke()}function vh($,Z,J,H,Q,B=null){let X=Math.max(3,Math.min(Z,J)*0.005),z=X+Math.max(2,X*0.75),G=B?[...Q,B]:Q;for(let U of G)xh($,U,H.haloColor,z);for(let U of G)xh($,U,H.strokeColor,X)}function M60($,Z,J,H=null){let Q=$.getContext("2d");if(!Q)return;Q.clearRect(0,0,$.width,$.height),vh(Q,$.width,$.height,Z,J,H)}function P60($,Z,J){let H=$.getContext("2d");if(!H)return;H.clearRect(0,0,$.width,$.height),H.drawImage(Z.snapshot,0,0,$.width,$.height),vh(H,$.width,$.height,Z,J)}function _60($){return new Promise((Z,J)=>{$.toBlob((H)=>{if(H)Z(H);else J(Error("Could not export drawing"))},"image/png")})}function j60($,Z,J){let H=$.getBoundingClientRect();if(H.width<=0||H.height<=0)return null;let Q=getComputedStyle($),B=WL(H.width,H.height,window.devicePixelRatio),X=Math.max(1,Math.round(H.width*B)),z=Math.max(1,Math.round(H.height*B)),G=document.createElement("canvas");G.width=X,G.height=z;let U=Q.getPropertyValue("--background").trim()||"#ffffff",K=G.getContext("2d");if(K)K.fillStyle=U,K.fillRect(0,0,X,z);return Z.width=X,Z.height=z,{id:J,snapshot:G,strokeColor:Q.getPropertyValue("--primary").trim()||"#2563eb",haloColor:U,targetWidth:H.width,targetHeight:H.height}}function O60($){return $ instanceof HTMLInputElement||$ instanceof HTMLTextAreaElement||$ instanceof HTMLElement&&$.isContentEditable}function TY({mode:$="annotation",onChange:Z,onEditingStart:J,onFinish:H}={}){let Q=e0.useRef(null),B=e0.useRef(null),[X,z]=e0.useState(null),G=e0.useRef(X),[U,K]=e0.useState(!1),Y=e0.useRef(!1),F=e0.useRef(qL),W=e0.useRef(L60),q=e0.useRef(new Set),N=e0.useRef(0),V=e0.useRef(null),A=e0.useRef(null),D=e0.useRef(0),L=e0.useRef(0),j=e0.useRef(null),M=e0.useRef(null),[_,E]=e0.useState(!1),C=e0.useRef(!1),[R,T]=e0.useState(!1),I=e0.useRef(!1),y=K5(Z),S=K5(J),O=K5(H),b=e0.useCallback(()=>{let n=F.current,a=W.current,e={canUndo:n.past.length>0,canRedo:n.future.length>0,hasStrokes:n.present.length>0};if(e.canUndo===a.canUndo&&e.canRedo===a.canRedo&&e.hasStrokes===a.hasStrokes)return;W.current=e;for(let $0 of q.current)$0()},[]),k=e0.useCallback((n)=>{return q.current.add(n),()=>{q.current.delete(n)}},[]),h=e0.useCallback(()=>W.current,[]),v=e0.useCallback((n,a=null)=>{if(D.current)cancelAnimationFrame(D.current),D.current=0;let e=B.current,$0=G.current;if(e&&$0)M60(e,$0,n,a)},[]),f=e0.useCallback(()=>{if(D.current)return;D.current=requestAnimationFrame(()=>{D.current=0,v(F.current.present,V.current)})},[v]),w=e0.useCallback((n,a,e)=>{let $0=j.current;if($0?.sessionId===n.id&&$0.historyVersion===e)return Promise.resolve($0.blob);let Q0=M.current;if(Q0?.sessionId===n.id&&Q0.historyVersion===e)return Q0.promise;if(a.length===0)return j.current={sessionId:n.id,historyVersion:e,blob:null},y.current?.(null),Promise.resolve(null);let _0=document.createElement("canvas");_0.width=n.snapshot.width,_0.height=n.snapshot.height,P60(_0,n,a);let M0=_60(_0).then((A0)=>{if(G.current?.id!==n.id||N.current!==e)return A0;return j.current={sessionId:n.id,historyVersion:e,blob:A0},y.current?.(A0),A0}).catch(()=>{if(G.current?.id===n.id&&N.current===e)A5.add({title:"Couldn’t export the drawing",type:"error"});return null}).finally(()=>{if(M.current?.promise===M0)M.current=null});return M.current={sessionId:n.id,historyVersion:e,promise:M0},M0},[y]),i=e0.useCallback(()=>{if(!V.current)return;let n=B.current,a=A.current;if(n&&a!==null&&n.hasPointerCapture(a))n.releasePointerCapture(a);V.current=null,A.current=null,v(F.current.present)},[v]),r=e0.useCallback((n)=>{let a=G.current;if(!a||I.current)return;let e=D60(F.current,n);if(e===F.current)return;F.current=e,b(),V.current=null;let $0=++N.current;v(e.present),w(a,e.present,$0)},[w,b,v]),x=e0.useCallback((n)=>{F.current=qL,N.current=0,j.current=null,M.current=null,V.current=null,A.current=null,b(),G.current=n,z(n)},[b]),l=e0.useCallback(()=>{if(Y.current)return;Y.current=!0,K(!0),S.current?.()},[S]),s=e0.useCallback(async()=>{let n=Q.current;if(!n||G.current||C.current)return!1;let a=++L.current;C.current=!0,E(!0);try{let e=await bh(n);if(a!==L.current||Q.current!==n)return!1;let $0=n.getBoundingClientRect(),Q0=getComputedStyle(n),_0={id:a,snapshot:e,strokeColor:Q0.getPropertyValue("--primary").trim()||"#2563eb",haloColor:Q0.getPropertyValue("--background").trim()||"#ffffff",targetWidth:$0.width,targetHeight:$0.height};return x(_0),l(),!0}finally{if(a===L.current)C.current=!1,E(!1)}},[l,x]),p=e0.useCallback(()=>{let n=G.current;L.current+=1,C.current=!1,I.current=!1,E(!1),T(!1),Y.current=!1,K(!1),i(),z(null),F.current=qL,b();let a=M.current;if(!n||a?.sessionId!==n.id)return G.current=null,Promise.resolve();return a.promise.then(()=>{if(G.current?.id===n.id)G.current=null})},[i,b]),d=e0.useCallback(async()=>{let n=G.current;if(!n)return null;return i(),w(n,F.current.present,N.current)},[i,w]),o=e0.useCallback(async()=>{return Y.current=!1,K(!1),d()},[d]),Z0=e0.useCallback(async()=>{let n=G.current;if(!n||I.current)return null;I.current=!0,T(!0),i();let a=N.current,e=F.current.present,$0=null;if(e.length>0||a>0)$0=await w(n,e,a);if(G.current?.id!==n.id)return $0;try{await O.current?.($0)}finally{if(G.current?.id===n.id)L.current+=1,Y.current=!1,K(!1),G.current=null,z(null),I.current=!1,T(!1)}return $0},[i,w,O]),H0=e0.useCallback(()=>r({type:"undo"}),[r]),G0=e0.useCallback(()=>r({type:"redo"}),[r]),X0=e0.useCallback(()=>r({type:"clear"}),[r]),Y0=e0.useMemo(()=>({onPointerDown:(n)=>{if(I.current||!n.isPrimary||n.pointerType==="mouse"&&n.button!==0)return;if(!G.current&&$==="sketch"){let a=Q.current;if(!a)return;let e=j60(a,n.currentTarget,++L.current);if(!e)return;x(e)}if(!G.current)return;l(),A.current=n.pointerId,n.currentTarget.setPointerCapture(n.pointerId),V.current={points:[hh(n.currentTarget,n.clientX,n.clientY)]},v(F.current.present,V.current)},onPointerMove:(n)=>{if(n.pointerId!==A.current||!V.current)return;V.current.points.push(...yh(n.currentTarget,n.nativeEvent)),f()},onPointerUp:(n)=>{if(n.pointerId!==A.current||!V.current)return;let a=V.current;if(a.points.push(...yh(n.currentTarget,n.nativeEvent)),V.current=null,A.current=null,n.currentTarget.hasPointerCapture(n.pointerId))n.currentTarget.releasePointerCapture(n.pointerId);r({type:"commit",stroke:a})},onPointerCancel:(n)=>{if(n.pointerId===A.current)i()}}),[r,l,i,x,$,v,f]),V0=e0.useCallback((n)=>{if(O60(n.target))return;if(n.key==="Escape"&&$==="annotation"){n.preventDefault(),Z0();return}if(!(n.metaKey||n.ctrlKey)||n.key.toLowerCase()!=="z")return;if(n.preventDefault(),n.shiftKey)G0();else H0()},[Z0,$,G0,H0]);e0.useLayoutEffect(()=>{if(!X)return;if(v(F.current.present,V.current),U)B.current?.focus()},[U,v,X]),e0.useEffect(()=>{if(!X||$==="sketch")return;let n=Q.current;if(!n){p();return}let a=new ResizeObserver((e)=>{let $0=e[0]?.contentRect;if(!$0)return;if(Math.abs($0.width-X.targetWidth)>1||Math.abs($0.height-X.targetHeight)>1)p()});return a.observe(n),()=>a.disconnect()},[p,$,X]),e0.useEffect(()=>()=>{if(L.current+=1,Y.current=!1,G.current=null,D.current)cancelAnimationFrame(D.current)},[]);let N0=e0.useMemo(()=>({active:U,visible:$==="sketch"||X!==null,starting:_,finishing:R,open:s,undo:H0,redo:G0,clear:X0,flush:d,deactivate:o,finish:Z0,cancel:p,subscribeHistory:k,getHistoryState:h}),[U,$,X,_,R,s,H0,G0,X0,d,o,Z0,p,k,h]),F0=e0.useMemo(()=>({visible:N0.visible,editing:N0.active,canvasRef:B,width:X?.snapshot.width??1,height:X?.snapshot.height??1,pointerProps:Y0,onKeyDown:V0}),[N0.active,N0.visible,X,Y0,V0]);return e0.useMemo(()=>({targetRef:Q,controls:N0,layerProps:F0}),[N0,F0])}var s5=P(c(),1);function CY({controls:$,title:Z,busy:J,onComplete:H}){let{canUndo:Q,canRedo:B,hasStrokes:X}=jB($);return s5.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:[s5.jsx("span",{className:"mr-2 ml-2 text-sm font-medium",children:Z}),s5.jsxs("div",{className:"flex gap-1",children:[s5.jsxs(Q5,{children:[s5.jsx(B5,{render:s5.jsx(j0,{type:"button",variant:"outline",size:"icon-sm",onClick:$.undo,disabled:J||!Q,"aria-label":"Undo",children:s5.jsx(gh,{stroke:1.75})})}),s5.jsx(X5,{children:"Undo"})]}),s5.jsxs(Q5,{children:[s5.jsx(B5,{render:s5.jsx(j0,{type:"button",variant:"outline",size:"icon-sm",onClick:$.redo,disabled:J||!B,"aria-label":"Redo",children:s5.jsx(fh,{stroke:1.75})})}),s5.jsx(X5,{children:"Redo"})]}),s5.jsx(j0,{type:"button",variant:"outline",size:"sm",onClick:$.clear,disabled:J||!X,children:"Clear"})]}),s5.jsx(j4,{mode:"popLayout",initial:!1,children:s5.jsx(z5.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:s5.jsx(j0,{type:"button",variant:X?"default":"ghost",size:"icon-sm",onClick:H,disabled:J,"aria-label":"Complete",className:B0(!X&&"text-muted-foreground"),children:X?s5.jsx(j8,{stroke:1.75}):s5.jsx(o5,{stroke:1.75})})},X?"complete":"cancel")})]})}var U2=P(m(),1);async function OB($,Z){let J=`/api/workspaces/${$}/uploads`;if(typeof Z==="string")return q1(`${J}/from-path`,g5("POST",{path:Z}),"The file couldn’t be uploaded");let H=new FormData;H.append("files",Z);let[Q]=await q1(J,{method:"POST",body:H},"The file couldn’t be uploaded");if(!Q)throw Error("The upload didn’t finish");return Q}function mh($,Z){for(let J of Z)uh($,J)}async function uh({workspaceId:$,sessionId:Z},J,H,Q){let B=typeof J==="string"?null:J,X=typeof J==="string"?J.split("/").at(-1):J.name||"file",z=crypto.randomUUID();b1.getState().addAttachments($,Z,[{kind:"file",source:Q,localId:z,label:X,mediaType:B?.type||"application/octet-stream",previewUrl:B?.type.startsWith("image/")?URL.createObjectURL(B):void 0,status:"uploading"}]);try{let G=await OB($,J);b1.getState().updateAttachment($,z,{status:"ready",upload:G,label:G.filename,mediaType:G.mediaType,...G.kind==="image"&&!B?.type.startsWith("image/")?{previewUrl:`/api/workspaces/${$}/uploads/${G.id}`}:{}})}catch(G){let U=G instanceof Error?G.message:"The file couldn’t be uploaded";b1.getState().removeAttachment($,z),A5.add({title:`Couldn’t add ${X}`,description:U,type:"error"}),H?.(U)}}function ph($,Z){if(Z.type==="text"){let{source:J,label:H,text:Q}=Z;return T60($,{source:J,label:H,text:Q}),Promise.resolve()}return uh($,Z.file??Z.path,(J)=>{Z8($.workspaceId,{source:"runtime",message:`addChatAttachment() from ${Z.source}: ${J}`})},Z.source)}function TB({workspaceId:$,sessionId:Z,localId:J,purpose:H,source:Q,blob:B}){let X=H==="sketch"?"Sketch":"Annotation",z=URL.createObjectURL(B),G=b1.getState();if(wG(G.attachments,$,J))G.updateAttachment($,J,{previewUrl:z,status:"draft",upload:void 0});else G.addAttachments($,Z,[{kind:"drawing",purpose:H,localId:J,source:Q,label:`${X}.png`,mediaType:"image/png",previewUrl:z,status:"draft"}])}async function wY($){let{workspaceId:Z,localId:J,purpose:H,blob:Q,isCurrent:B}=$,X=H==="sketch"?"Sketch":"Annotation";TB($),b1.getState().updateAttachment(Z,J,{status:"uploading"});try{let z=await OB(Z,new File([Q],`${X}.png`,{type:"image/png"}));if(!B())return;b1.getState().updateAttachment(Z,J,{status:"ready",upload:z,mediaType:z.mediaType})}catch{if(!B())return;b1.getState().removeAttachment(Z,J)}}function T60({workspaceId:$,sessionId:Z},J){b1.getState().addAttachments($,Z,[{kind:"text",localId:crypto.randomUUID(),...J}])}function ch({workspaceId:$,sessionId:Z,activeTab:J,mode:H,available:Q,closePopup:B,openPopup:X}){let z=U2.useRef(null),G=U2.useRef(null),U=U2.useRef(new Map),K=K5(B),Y=K5(X),F=U2.useCallback((O)=>{let b=z.current;if(!b)return;if(G.current=O,!O){b1.getState().removeAttachment(b.workspaceId,b.attachmentId);return}TB({workspaceId:b.workspaceId,sessionId:b.sourceSessionId,localId:b.attachmentId,purpose:"annotation",source:b.source,blob:O})},[]),W=U2.useCallback((O,b)=>{let k=(U.current.get(O.attachmentId)??0)+1;return U.current.set(O.attachmentId,k),wY({workspaceId:O.workspaceId,sessionId:O.sourceSessionId,localId:O.attachmentId,purpose:"annotation",source:O.source,blob:b,isCurrent:()=>U.current.get(O.attachmentId)===k})},[]),q=U2.useCallback(async(O)=>{let b=z.current;if(z.current=null,G.current=null,b&&O)await W(b,O);if(b?.origin==="popup")Y.current()},[Y,W]),N=TY({onChange:F,onFinish:q}),{controls:V}=N,{active:A,starting:D,open:L,finish:j,cancel:M}=V,_=U2.useCallback(async(O)=>{if(!Q||A||D)return;let b={workspaceId:$,sourceSessionId:Z,source:J,origin:O,attachmentId:crypto.randomUUID()};z.current=b;try{if(!await L()){if(z.current===b)z.current=null;return}if(O==="popup")K.current()}catch{if(z.current!==b)return;z.current=null,A5.add({title:"Couldn’t capture this page",type:"error"})}},[A,J,Q,K,L,Z,D,$]),E=U2.useCallback(async()=>{let O=z.current;if(await M(),z.current!==O)return;z.current=null;let b=G.current;if(G.current=null,O&&b)W(O,b)},[M,W]),C=U2.useCallback((O)=>{let b=(U.current.get(O)??0)+1;if(U.current.set(O,b),b1.getState().removeAttachment($,O),z.current?.attachmentId===O)z.current=null,G.current=null,M()},[M,$]),R=U2.useCallback(async()=>{if(D){await E();return}await j()},[E,j,D]),T=U2.useCallback(()=>{if(A||D)R();else _("docked")},[A,R,_,D]),I=U2.useCallback(()=>{if(A||D)R();else _("popup")},[A,R,_,D]);U2.useEffect(()=>{let O=z.current;if(!O)return;let b=O.origin==="docked"?"split":"fullscreen";if(O.workspaceId!==$||O.sourceSessionId!==Z||O.source!==J||H!==b||!Q)E()},[J,Q,E,H,Z,$]);let y=U2.useMemo(()=>Q?{active:A||D,finish:R,onRemove:C,onToggle:T}:void 0,[Q,A,D,R,C,T]),S=U2.useMemo(()=>Q?{active:A||D,finish:R,onRemove:C,onToggle:I}:void 0,[Q,A,D,R,C,I]);return U2.useMemo(()=>({...N,docked:y,popup:S}),[N,y,S])}var l4=P(m(),1);var R8=P(c(),1);function NL($){if(!$)return;$.focus();let Z=$.value.length;$.setSelectionRange(Z,Z)}function lh({composerRef:$,className:Z,onMouseDown:J,children:H,...Q}){return R8.jsx("form",{...Q,onMouseDown:(B)=>{if(J?.(B),B.defaultPrevented)return;if(B.target instanceof Element&&B.target.closest('button, input, textarea, select, a, [contenteditable="true"]'))return;NL($.current)},className:B0("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 ih({textareaRef:$,className:Z,...J}){return R8.jsx("textarea",{...J,ref:$,className:B0("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 rh({className:$,children:Z,...J}){return R8.jsx("div",{...J,className:B0("flex items-center justify-end gap-3",$),children:Z})}function C60($){if($.status==="checking")return"Checking agent status…";return}function CB($,Z,J){return $&&!Z&&J.status==="available"}function ah({label:$,hasContent:Z,busy:J=!1,loading:H=!1,availability:Q}){let B=CB(Z,J||H,Q),X=C60(Q),z=R8.jsx(j0,{type:"submit",size:"icon",disabled:!B,"aria-label":$,children:H?R8.jsx(J8,{}):R8.jsx(dh,{stroke:1.5})});if(H||!X)return z;return R8.jsxs(Q5,{children:[R8.jsx(B5,{render:R8.jsx("span",{className:"inline-flex",children:z})}),R8.jsx(X5,{className:"max-w-64 text-center",children:X})]})}var B8=P(m(),1),w60=48;function oh($,Z){let J=B8.useRef(!0),[H,Q]=B8.useState(!0),B=B8.useCallback((G)=>{J.current=G,Q((U)=>U===G?U:G)},[]),X=B8.useCallback((G="auto")=>{let U=$.current;if(!U)return;B(!0),U.scrollTo({top:U.scrollHeight,behavior:G})},[$,B]),z=B8.useCallback(()=>{let G=$.current;if(!G)return;B(!1),G.scrollTo({top:0,behavior:"auto"})},[$,B]);return B8.useEffect(()=>{let G=$.current;if(!G)return;let U=()=>{let K=G.scrollHeight-G.scrollTop-G.clientHeight;B(K<=w60)};return G.addEventListener("scroll",U,{passive:!0}),()=>G.removeEventListener("scroll",U)},[$,B]),B8.useEffect(()=>{let G=$.current;if(!G)return;let U=G.firstElementChild??G,K=new ResizeObserver(()=>{if(J.current)G.scrollTop=G.scrollHeight});return K.observe(U),()=>K.disconnect()},[$]),B8.useLayoutEffect(()=>{X("auto")},[Z,X]),{atBottom:H,scrollToBottom:X,scrollToTop:z}}function E60($){return $.origin.kind!=="replay"&&$.origin.kind!=="synthetic"&&$.origin.kind!=="subagent-prompt"}function nh($,Z){let J=$.meta||Z.meta?{...$.meta,...Z.meta}:void 0;return{...$,parts:[...$.parts,...Z.parts],timestamp:Z.timestamp??$.timestamp,meta:J}}function sh($,Z){if(!Z)return $;let J=$.at(-1);if(J?.role==="assistant")return[...$.slice(0,-1),nh(J,Z)];return[...$,Z]}function th($){let Z=[];for(let J of $){if(!E60(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]=nh(H,J);else Z.push(J)}return Z.map((J,H)=>{let Q=Z[H-1];if(J.role!=="assistant"||J.meta?.durationMs!==void 0||Q?.role!=="user"||Q.origin.kind!=="user-input"||!Q.timestamp||!J.timestamp)return J;let B=Date.parse(Q.timestamp),X=Date.parse(J.timestamp);if(!Number.isFinite(B)||!Number.isFinite(X)||X<B)return J;return{...J,meta:{...J.meta,durationMs:X-B}}})}function AL($){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 eh($){if(!$)return;let Z=Date.parse($);return Number.isNaN(Z)?void 0:Z}function $v($,Z){let J=Z.filter((G)=>AL(G)!==null);if(J.length===0)return $.map((G)=>({kind:"turn",turn:G}));let H=[],Q=[];for(let G of J){let U=eh(G.at);if(U===void 0)Q.push(G);else H.push({notice:G,time:U})}H.sort((G,U)=>G.time-U.time);let B=[],X=0,z=Number.NEGATIVE_INFINITY;for(let G of $){z=Math.max(z,eh(G.timestamp)??z);while(X<H.length&&H[X].time<=z)B.push({kind:"notice",notice:H[X].notice}),X+=1;B.push({kind:"turn",turn:G})}for(;X<H.length;X+=1)B.push({kind:"notice",notice:H[X].notice});for(let G of Q)B.push({kind:"notice",notice:G});return B}var t5=P(c(),1);function yJ({label:$,icon:Z,onRemove:J,previewUrl:H,loading:Q,className:B,children:X,...z}){return t5.jsxs("div",{...z,className:B0("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",B),children:[Q&&t5.jsx("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center bg-background/70",children:t5.jsx(b5,{size:16,stroke:1.75,className:"animate-spin text-muted-foreground"})}),H?t5.jsx(R60,{label:$,previewUrl:H,onRemove:J}):t5.jsx(S60,{label:$,icon:Z,onRemove:J}),X]})}function S60({label:$,icon:Z,onRemove:J}){return t5.jsxs(t5.Fragment,{children:[J?t5.jsxs(j0,{type:"button",variant:"ghost",size:"icon-sm",onClick:J,"aria-label":`Remove ${$}`,className:"size-6 shrink-0 hover:bg-transparent hover:text-current",children:[t5.jsx(Z,{stroke:1.75,className:"group-focus-within:hidden group-hover:hidden"}),t5.jsx(o5,{stroke:1.75,className:"hidden group-focus-within:block group-hover:block"})]}):t5.jsx("span",{className:"flex size-6 shrink-0 items-center justify-center",children:t5.jsx(Z,{size:16,stroke:1.75})}),t5.jsx("span",{className:"truncate",children:$})]})}function R60({label:$,previewUrl:Z,onRemove:J}){return t5.jsxs(t5.Fragment,{children:[t5.jsx("img",{src:Z,alt:$,className:"size-full object-cover"}),J&&t5.jsx(j0,{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:t5.jsx(o5,{stroke:1.75})})]})}var Jv=P(c(),1);function wB({label:$,onRemove:Z}){return Jv.jsx(yJ,{label:$,icon:Zv,onRemove:Z})}var a6={};C5(a6,{createHandle:()=>wv,Viewport:()=>Cv,Trigger:()=>Av,Root:()=>Yv,Positioner:()=>Dv,Portal:()=>qv,Popup:()=>Mv,Handle:()=>kY,Backdrop:()=>Ov,Arrow:()=>_v});var Kv=P(m(),1);var EY=P(m(),1),VL=EY.createContext(void 0);function Q4($){let Z=EY.useContext(VL);if(Z===void 0&&!$)throw Error(y0(50));return Z}var Qv=P(m(),1);var Hv=600,SY=300;var Bv={...S9,instantType:($)=>$.instantType,adaptiveOrigin:($)=>$.adaptiveOrigin,closeDelay:($)=>$.closeDelay};class DL extends k2{constructor($,Z,J){let H=new O2;super(zv($,H,Z,J),Gv(H),Bv)}setOpen=($,Z)=>{let{inlineRectCoordsRef:J}=this.context;oz(this,$,Z,{onBeforeDispatch(){let H=Z.event;if($&&Z.reason===K0.triggerHover&&Z.trigger&&"clientX"in H&&"clientY"in H&&J.current?.element!==Z.trigger)FA(J,Z.trigger,H.clientX,H.clientY)}})}}function Xv(){let $=new O2;return new r8(Object.freeze(zv(void 0,$)),Object.freeze(Gv($)),Bv)}function zv($,Z,J,H=!1){return{...E9(Z,J,H),instantType:void 0,adaptiveOrigin:void 0,closeDelay:SY,...$}}function Gv($){return{popupRef:Qv.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:$,inlineRectCoordsRef:{current:void 0}}}var r6=P(c(),1);function Uv($){let{open:Z,defaultOpen:J=!1,onOpenChange:H,onOpenChangeComplete:Q,actionsRef:B,handle:X,triggerId:z,defaultTriggerId:G=null,children:U}=$,K=Q6((A,D)=>new DL({open:J,openProp:Z,activeTriggerId:G,triggerIdProp:z},A,D));K.useControlledProp("openProp",Z),K.useControlledProp("triggerIdProp",z),K.useContextCallback("onOpenChange",H),K.useContextCallback("onOpenChangeComplete",Q);let Y=K.useState("open"),F=K.useState("activeTriggerId"),W=K.useState("mounted"),q=K.useState("payload");T9(K,{closeOnActiveTriggerUnmount:!0});let{forceUnmount:N}=C9(Y,K,()=>{K.context.inlineRectCoordsRef.current=void 0});J0(()=>{if(Y){if(F==null)K.set("payload",void 0)}},[K,F,Y]),Kv.useImperativeHandle(B,()=>({unmount:N,close:()=>K.setOpen(!1,R0(K0.imperativeAction))}),[N,K]);let V=Y||W;return r6.jsxs(VL.Provider,{value:K,children:[X&&r6.jsx(j9,{handle:X,store:K}),V&&r6.jsx(I60,{store:K}),typeof U==="function"?U({payload:q}):U]})}function I60({store:$}){let Z=$.useState("floatingRootContext"),J=c8(Z);return w9($,{activeTriggerProps:J.reference,inactiveTriggerProps:J.trigger,popupProps:J.floating}),null}var Yv=v8(function(Z){if(Q4(!0))return r6.jsx(Uv,{...Z});return r6.jsx(a7,{children:r6.jsx(Uv,{...Z})})});var Wv=P(m(),1);var RY=P(m(),1),LL=RY.createContext(void 0);function Fv(){let $=RY.useContext(LL);if($===void 0)throw Error(y0(48));return $}var ML=P(c(),1),qv=Wv.forwardRef(function(Z,J){let{keepMounted:H=!1,...Q}=Z;if(!(Q4().useState("mounted")||H))return null;return ML.jsx(LL.Provider,{value:H,children:ML.jsx(OZ,{ref:J,...Q})})});var Nv=P(m(),1);var Av=A9(function(Z,J){let{render:H,className:Q,delay:B,closeDelay:X,id:z,payload:G,handle:U,style:K,...Y}=Z,F=Q4(!0),q=R9(U)??F;if(!q)throw Error(y0(89));let N=t0(z),V=q.useState("isTriggerActive",N),A=q.useState("isOpenedByTrigger",N),D=q.useState("floatingRootContext"),L=q.context.inlineRectCoordsRef,j=Nv.useRef(null),M=B??Hv,_=X??SY,{registerTrigger:E,isMountedByThisTrigger:C}=O9(N,j,q,{payload:G,closeDelay:_}),R=l8(D,{mouseOnly:!0,move:!1,handleClose:i8(),delay:()=>({open:M,close:_}),triggerElementRef:j,isActiveTrigger:V,isClosing:()=>q.select("transitionStatus")==="ending"}),T=t7(D,{delay:M}),I={open:A},y=q.useState("triggerProps",C),S=qC(L,A);return z0("a",Z,{state:I,ref:[J,E,j],props:[R,T.reference,y,S,{id:N},Y],stateAttributesMapping:V9})});var Vv=P(m(),1);var IY=P(m(),1),PL=IY.createContext(void 0);function xJ(){let $=IY.useContext(PL);if($===void 0)throw Error(y0(49));return $}var _L=P(c(),1),Dv=Vv.forwardRef(function(Z,J){let{render:H,className:Q,anchor:B,positionMethod:X="absolute",side:z="bottom",align:G="center",sideOffset:U=0,alignOffset:K=0,collisionBoundary:Y="clipping-ancestors",collisionPadding:F=5,arrowPadding:W=5,sticky:q=!1,disableAnchorTracking:N=!1,collisionAvoidance:V=P9,style:A,...D}=Z,L=Q4(),j=Fv(),M=V3(),_=L.useState("open"),E=L.useState("mounted"),C=L.useState("floatingRootContext"),R=L.useState("instantType"),T=L.useState("transitionStatus"),I=L.useState("adaptiveOrigin"),y=L.context.inlineRectCoordsRef,S=k9({anchor:B,floatingRootContext:C,positionMethod:X,mounted:E,side:z,sideOffset:U,align:G,alignOffset:K,arrowPadding:W,collisionBoundary:Y,collisionPadding:F,sticky:q,disableAnchorTracking:N,keepMounted:j,nodeId:M,collisionAvoidance:V,adaptiveOrigin:I,inline:NC(y)}),O=S.update;J0(()=>{if(_&&E)O()},[_,E,O]);let b={open:_,side:S.side,align:S.align,anchorHidden:S.anchorHidden,instant:R},k=y9(Z,b,{styles:S.positionerStyles,transitionStatus:T,props:D,refs:[J,L.useStateSetter("positionerElement")],hidden:!E,inert:!_});return _L.jsx(PL.Provider,{value:S,children:_L.jsx(r7,{id:M,children:k})})});var Lv=P(m(),1);var Mv=Lv.forwardRef(function(Z,J){let{className:H,render:Q,style:B,...X}=Z,z=Q4(),{side:G,align:U}=xJ(),K=z.useState("open"),Y=z.useState("instantType"),F=z.useState("transitionStatus"),W=z.useState("popupProps"),q=z.useState("floatingRootContext"),N=z.useState("closeDelay");return W5({open:K,ref:z.context.popupRef,onComplete(){if(K)z.context.onOpenChangeComplete?.(!0)}}),L3(q,{closeDelay:N}),z0("div",Z,{state:{open:K,side:G,align:U,instant:Y,transitionStatus:F},ref:[J,z.context.popupRef,z.useStateSetter("popupElement")],props:[_9,W,b9(F),X],stateAttributesMapping:a2})});var Pv=P(m(),1);var _v=Pv.forwardRef(function(Z,J){let{render:H,className:Q,style:B,...X}=Z,z=Q4(),{arrowRef:G,side:U,align:K,arrowUncentered:Y,arrowStyles:F}=xJ(),q={open:z.useState("open"),side:U,align:K,uncentered:Y};return z0("div",Z,{state:q,ref:[G,J],props:[{style:F,"aria-hidden":!0},X],stateAttributesMapping:s4})});var jv=P(m(),1);var Ov=jv.forwardRef(function(Z,J){let{render:H,className:Q,style:B,...X}=Z,z=Q4(),G=z.useState("open"),U=z.useState("mounted"),K=z.useState("transitionStatus");return z0("div",Z,{state:{open:G,transitionStatus:K},ref:[J],props:[{role:"presentation",hidden:!U,style:{pointerEvents:"none",userSelect:"none",WebkitUserSelect:"none"}},X],stateAttributesMapping:a2})});var Tv=P(m(),1);var Cv=Tv.forwardRef(function(Z,J){let{render:H,className:Q,style:B,children:X,...z}=Z,G=Q4(),U=xJ(),K=G.useState("instantType"),{children:Y,state:F}=z6({store:G,side:U.side,children:X}),W={activationDirection:F.activationDirection,transitioning:F.transitioning,instant:K};return z0("div",Z,{state:W,ref:J,props:[z,{children:Y}],stateAttributesMapping:X6})});class kY extends d8{constructor(){super(Xv(),"PreviewCard")}open($){this.openByTrigger($)}close(){this.closePopup()}get isOpen(){return this.attachedStore?.select("open")??!1}}function wv(){return new kY}var hJ=P(c(),1);function Ev({...$}){return hJ.jsx(a6.Root,{"data-slot":"hover-card",...$})}function Sv({...$}){return hJ.jsx(a6.Trigger,{"data-slot":"hover-card-trigger",...$})}function Rv({className:$,side:Z="bottom",sideOffset:J=4,align:H="center",alignOffset:Q=0,...B}){return hJ.jsx(_8,{portal:a6.Portal,"data-slot":"hover-card-portal",children:hJ.jsx(a6.Positioner,{align:H,alignOffset:Q,side:Z,sideOffset:J,className:"isolate z-50",children:hJ.jsx(a6.Popup,{"data-slot":"hover-card-content",className:a0("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",$),...B})})})}var I$=P(c(),1);function Iv({attachment:$,onRemove:Z}){let{previewUrl:J,purpose:H}=$,Q=H==="sketch"?"Sketch":"Annotation";return I$.jsxs(Ev,{children:[I$.jsx(Sv,{render:I$.jsx(yJ,{tabIndex:0,label:Q,icon:vJ,onRemove:Z})}),J&&I$.jsx(Rv,{side:"top",align:"start",className:"w-60 max-w-[calc(100vw-2rem)] rounded-xl",children:I$.jsx("img",{src:J,alt:`${Q} preview`,className:"max-h-72 w-full rounded-md object-contain"})})]})}var bv=P(c(),1);function kv({attachment:$,onRemove:Z}){return bv.jsx(yJ,{label:$.label,icon:WJ,onRemove:Z,previewUrl:$.previewUrl,loading:$.status==="uploading",title:$.label,className:"max-w-52"})}var bB=P(m(),1);var iJ=P(m(),1);function bY($){return J5({queryKey:S0.sessions($),queryFn:()=>q1(`/api/workspaces/${$}/sessions`),...p4})}function k60($,Z){return $?.filter((J)=>J.sessionId!==Z)}function yv($){let Z=U1();return H5({mutationFn:(J)=>P4(`/api/workspaces/${$}/sessions/${J}/archive`,{method:"POST"},"Couldn’t archive chat"),onSuccess:(J,H)=>{Z.setQueryData(S0.sessions($),(Q)=>k60(Q,H)),Z.removeQueries({queryKey:S0.events($,H)}),Z.removeQueries({queryKey:S0.sessionConfig($,H)}),Z.invalidateQueries({queryKey:S0.preview($)})}})}function xv($,Z){return J5({...AE($,Z??""),enabled:Boolean(Z)})}function yY($,Z){return J5({queryKey:S0.sessionConfig($,Z??""),queryFn:()=>q1(`/api/workspaces/${$}/sessions/${Z}/config`),enabled:Boolean(Z),staleTime:1/0,gcTime:300000,refetchOnMount:!1,refetchOnWindowFocus:!1})}function hv($){let Z=U1();return H5({mutationFn:({patch:J,sessionId:H})=>q1(`/api/workspaces/${$}/sessions/${H}/config`,g5("PUT",J),"Failed to save chat settings"),onSuccess:(J,{sessionId:H})=>{Z.setQueryData(S0.sessionConfig($,H),J)}})}var b60=["fable","opus","sonnet","haiku"];function xY($,Z,J=$.find((H)=>H.value==="default")?.resolvedModel){let H=$.filter((Q)=>Q.value!=="default");return H.find((Q)=>Q.value===Z)??H.find((Q)=>(Q.resolvedModel??Q.value)===J)??H[0]}function vv($){let Z=$.resolvedModel??$.value,J=b60.findIndex((H)=>Z===H||Z.startsWith(`${H}[`)||Z.includes(`-${H}-`));return J===-1?void 0:J}function y60($,Z){if($===void 0&&Z===void 0)return 0;if($===void 0)return-1;if(Z===void 0)return 1;return $-Z}function x60($,Z){return y60(vv($),vv(Z))}var h60={"claude-code":x60};function v60($,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 jL($,Z,J){if(Z&&$.includes(Z))return Z;if(J&&$.includes(J))return J;if($.includes("high"))return"high";return $[$.length-1]}function gv($,Z,J){let H=jL($,Z,J);return H?$.indexOf(H):-1}function fv($){return $.length>1}function mv($,Z){if($.supportsFastMode!==!0)return!1;return Z??$.defaultFastMode??!1}function uv($,Z){let J=h60[Z];return J?v60($,J):$}function pv($,Z){let J=[];for(let H of $){let Q=H.group??Z,B=J.find((X)=>X.label===Q);if(B)B.models.push(H);else J.push({label:Q,models:[H]})}return J}var O4={};C5(O4,{createHandle:()=>mg,Viewport:()=>xg,Trigger:()=>bg,SubmenuTrigger:()=>fg,SubmenuRoot:()=>Eg,Separator:()=>vg,Root:()=>HF,RadioItemIndicator:()=>_g,RadioItem:()=>Pg,RadioGroup:()=>Dg,Positioner:()=>Ag,Portal:()=>Wg,Popup:()=>Kg,LinkItem:()=>Gg,Item:()=>zg,Handle:()=>zF,GroupLabel:()=>Bg,Group:()=>Hg,CheckboxItemIndicator:()=>$g,CheckboxItem:()=>ev,Backdrop:()=>iv,Arrow:()=>dv});var cv=P(m(),1);var hY=P(m(),1),OL=hY.createContext(void 0);function B4($){let Z=hY.useContext(OL);if(Z===void 0&&!$)throw Error(y0(33));return Z}var vY=P(m(),1),TL=vY.createContext(void 0);function L5($){let Z=vY.useContext(TL);if(Z===void 0&&!$)throw Error(y0(36));return Z}var dv=cv.forwardRef(function(Z,J){let{render:H,className:Q,style:B,...X}=Z,{store:z}=L5(),{arrowRef:G,side:U,align:K,arrowUncentered:Y,arrowStyles:F}=B4(),q={open:z.useState("open"),side:U,align:K,uncentered:Y};return z0("div",Z,{ref:[G,J],stateAttributesMapping:s4,state:q,props:{style:F,"aria-hidden":!0,...X}})});var lv=P(m(),1);var gY=P(m(),1),g60=gY.createContext(void 0);function o6($=!0){let Z=gY.useContext(g60);if(Z===void 0&&!$)throw Error(y0(25));return Z}var iv=lv.forwardRef(function(Z,J){let{render:H,className:Q,style:B,...X}=Z,{store:z}=L5(),G=z.useState("open"),U=z.useState("mounted"),K=z.useState("transitionStatus"),Y=z.useState("lastOpenChangeReason"),F=o6(),W={open:G,transitionStatus:K};return z0("div",Z,{ref:F?.backdropRef?[J,F.backdropRef]:J,state:W,stateAttributesMapping:a2,props:[{role:"presentation",hidden:!U,style:{pointerEvents:Y===K0.triggerHover?"none":void 0,userSelect:"none",WebkitUserSelect:"none"}},X]})});var pY=P(m(),1);var fY=P(m(),1),CL=fY.createContext(void 0);function rv(){let $=fY.useContext(CL);if($===void 0)throw Error(y0(30));return $}var fJ=P(m(),1);var av=P(m(),1);function mY($){let{closeOnClick:Z,highlighted:J,id:H,nodeId:Q,store:B,typingRef:X,itemRef:z,itemMetadata:G}=$,{events:U}=B.useState("floatingTreeRoot"),K=B.useState("open"),Y=o6(!0),F=Y!==void 0;return av.useMemo(()=>({id:H,role:"menuitem",tabIndex:K&&J?0:-1,onKeyDown(W){if(W.key===" "&&X?.current)W.preventDefault()},onMouseMove(W){if(!Q)return;U.emit("itemhover",{nodeId:Q,target:W.currentTarget})},onClick(W){if(Z)U.emit("close",{domEvent:W,reason:K0.itemPress})},onMouseUp(W){if(Y){let q=Y.initialCursorPointRef.current;if(Y.initialCursorPointRef.current=null,F&&q&&Math.abs(W.clientX-q.x)<=1&&Math.abs(W.clientY-q.y)<=1)return;if(F&&!r1.os.mac&&W.button===2)return}if(z.current&&B.context.allowMouseUpTriggerRef.current&&(!F||W.button===2)){if(G.type==="regular-item")gJ(z.current,W,{detail:1})}}}),[Z,J,H,U,Q,K,B,X,z,Y,F,G])}var n6={type:"regular-item"};function s6($){let{closeOnClick:Z,disabled:J,highlighted:H,id:Q,store:B,typingRef:X=B.context.typingRef,nativeButton:z,itemMetadata:G,nodeId:U}=$,K=fJ.useRef(null),{getButtonProps:Y,buttonRef:F}=T5({disabled:J,focusableWhenDisabled:!0,native:z,composite:!0}),W=mY({closeOnClick:Z,highlighted:H,id:Q,nodeId:U,store:B,typingRef:X,itemRef:K,itemMetadata:G}),q=fJ.useCallback((V)=>{return X2(W,{onMouseEnter(){if(G.type!=="submenu-trigger")return;G.setActive()}},V,Y)},[W,Y,G]),N=x2(K,F);return fJ.useMemo(()=>({getItemProps:q,itemRef:N}),[q,N])}var k$=P(m(),1);var uY=P(m(),1),wL=uY.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},nextIndexRef:{current:0}});function ov(){return uY.useContext(wL)}function X4($={}){let{guess:Z,label:J,metadata:H,textRef:Q,index:B}=$,{register:X,unregister:z,subscribeMapChange:G,nextIndexRef:U}=ov(),K=k$.useRef(-1),[Y,F]=k$.useState(B==null&&Z?()=>{if(K.current===-1){let V=U.current;U.current+=1,K.current=V}return K.current}:-1),W=B??Y,q=k$.useRef(null),N=k$.useCallback((V)=>{let A=q.current;if(A)z(A);if(q.current=V,V)X(V,{metadata:H??null,index:B??null,label:J,textRef:Q})},[B,X,z,H,J,Q]);return J0(()=>{if(B!=null)return;return G((V)=>{let A=q.current?V.get(q.current)?.index:null;if(A!=null)F(A)})},[B,G]),{ref:N,index:W}}var nv="data-checked",sv="data-unchecked";var t6={checked($){if($)return{[nv]:""};return{[sv]:""}},...Q2};var tv=P(c(),1),ev=pY.forwardRef(function(Z,J){let{render:H,className:Q,id:B,label:X,nativeButton:z=!1,disabled:G=!1,closeOnClick:U=!1,checked:K,defaultChecked:Y,onCheckedChange:F,style:W,...q}=Z,N=X4({guess:!0,label:X}),V=B4(!0),A=t0(B),{store:D}=L5(),L=D.useState("disabled"),j=G||L,M=D.useState("isActive",N.index),_=D.useState("itemProps"),[E,C]=J4({controlled:K,default:Y??!1,name:"MenuCheckboxItem",state:"checked"}),{getItemProps:R,itemRef:T}=s6({closeOnClick:U,disabled:j,highlighted:M,id:A,store:D,nativeButton:z,nodeId:V?.context.nodeId,itemMetadata:n6}),I=pY.useMemo(()=>({disabled:j,highlighted:M,checked:E}),[j,M,E]);function y(O){let b=R0(K0.itemPress,O.nativeEvent,void 0,{preventUnmountOnClose:X1});if(F?.(!E,b),b.isCanceled)return;C((k)=>!k)}let S=z0("div",Z,{state:I,stateAttributesMapping:t6,props:[_,{role:"menuitemcheckbox","aria-checked":E,onClick:y},q,R],ref:[T,J,N.ref]});return tv.jsx(CL.Provider,{value:I,children:S})});var cY=P(m(),1);var $g=cY.forwardRef(function(Z,J){let{render:H,className:Q,style:B,keepMounted:X=!1,...z}=Z,G=rv(),U=cY.useRef(null),{transitionStatus:K,mounted:Y,setMounted:F}=j2(G.checked);W5({batch:!0,enabled:!G.checked,open:G.checked,ref:U,onComplete(){if(!G.checked)F(!1)}});let W={checked:G.checked,disabled:G.disabled,highlighted:G.highlighted,transitionStatus:K};return z0("span",Z,{state:W,ref:[J,U],stateAttributesMapping:t6,props:{"aria-hidden":!0,...z},enabled:X||Y})});var lY=P(m(),1);var dY=P(m(),1),EB=dY.createContext(void 0);function Zg(){let $=dY.useContext(EB);if($===void 0)throw Error(y0(31));return $}var Jg=P(c(),1),Hg=lY.forwardRef(function(Z,J){let{render:H,className:Q,style:B,...X}=Z,[z,G]=lY.useState(void 0),U=z0("div",Z,{ref:J,props:{role:"group","aria-labelledby":z,...X}});return Jg.jsx(EB.Provider,{value:G,children:U})});var Qg=P(m(),1);var Bg=Qg.forwardRef(function(Z,J){let{render:H,className:Q,style:B,id:X,...z}=Z,G=t0(X),U=Zg();return J0(()=>{return U(G),()=>{U((K)=>K===G?void 0:K)}},[U,G]),z0("div",Z,{ref:J,props:{id:G,"aria-hidden":!0,...z}})});var Xg=P(m(),1);var zg=Xg.forwardRef(function(Z,J){let{render:H,className:Q,id:B,label:X,nativeButton:z=!1,disabled:G=!1,closeOnClick:U=!0,style:K,...Y}=Z,F=X4({guess:!0,label:X}),W=B4(!0),q=t0(B),{store:N}=L5(),V=N.useState("disabled"),A=G||V,D=N.useState("isActive",F.index),L=N.useState("itemProps"),{getItemProps:j,itemRef:M}=s6({closeOnClick:U,disabled:A,highlighted:D,id:q,store:N,nativeButton:z,nodeId:W?.context.nodeId,itemMetadata:n6});return z0("div",Z,{state:{disabled:A,highlighted:D},props:[L,Y,j],ref:[M,J,F.ref]})});var iY=P(m(),1);var Gg=iY.forwardRef(function(Z,J){let{render:H,className:Q,id:B,label:X,closeOnClick:z=!1,style:G,...U}=Z,K=iY.useRef(null),Y=X4({guess:!0,label:X}),W=B4(!0)?.context.nodeId,q=t0(B),{store:N}=L5(),V=N.useState("isActive",Y.index),A=N.useState("itemProps"),D=N.context.typingRef,{getButtonProps:L,buttonRef:j}=T5({native:!1,composite:!0}),M=mY({closeOnClick:z,highlighted:V,id:q,nodeId:W,store:N,typingRef:D,itemRef:K,itemMetadata:n6});function _(C){return X2(M,C,L)}return z0("a",Z,{state:{highlighted:V},props:[A,U,_],ref:[K,j,J,Y.ref]})});var rY=P(m(),1);var Ug=P(c(),1),Kg=rY.forwardRef(function(Z,J){let{render:H,className:Q,style:B,finalFocus:X,...z}=Z,{store:G}=L5(),{side:U,align:K}=B4(),Y=dG(!0)!=null,F=G.useState("open"),W=G.useState("transitionStatus"),q=G.useState("popupProps"),N=G.useState("mounted"),V=G.useState("instantType"),A=G.useState("activeTriggerElement"),D=G.useState("parent"),L=G.useState("lastOpenChangeReason"),j=G.useState("rootId"),M=G.useState("floatingRootContext"),_=G.useState("floatingTreeRoot"),E=G.useState("closeDelay"),C=G.useState("hoverEnabled"),R=G.useState("disabled"),T=G.useState("openMethod"),I=D.type==="context-menu";W5({open:F,ref:G.context.popupRef,onComplete(){if(F)G.context.onOpenChangeComplete?.(!0)}}),rY.useEffect(()=>{function k(h){G.setOpen(!1,R0(h.reason,h.domEvent))}return _.events.on("close",k),()=>{_.events.off("close",k)}},[_.events,G]),L3(M,{enabled:C&&!R&&!I&&D.type!=="menubar",closeDelay:E});let y=G.useStateSetter("popupElement"),S={transitionStatus:W,side:U,align:K,open:F,nested:D.type==="menu",instant:V},O=z0("div",Z,{state:S,ref:[J,G.context.popupRef,y],stateAttributesMapping:a2,props:[q,{onKeyDown(k){if(Y&&n8.has(k.key))k.stopPropagation()}},b9(W),z,{"data-rootownerid":j}]}),b=D.type===void 0||I;if(A||D.type==="menubar"&&L!==K0.outsidePress)b=!0;return Ug.jsx(o7,{context:M,openInteractionType:T,modal:I,disabled:!N,returnFocus:X===void 0?b:X,initialFocus:D.type!=="menu",restoreFocus:!0,externalTree:D.type!=="menubar"?_:void 0,previousFocusableElement:A,nextFocusableElement:D.type===void 0?G.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:D.type===void 0?G.context.beforeContentFocusGuardRef:void 0,children:O})});var Fg=P(m(),1);var aY=P(m(),1),EL=aY.createContext(void 0);function Yg(){let $=aY.useContext(EL);if($===void 0)throw Error(y0(32));return $}var SL=P(c(),1),Wg=Fg.forwardRef(function(Z,J){let{keepMounted:H=!1,...Q}=Z,{store:B,parent:X}=L5();if(!(B.useState("mounted")||H))return null;let U=X.type==="menu"||X.type==="menubar"?"group":void 0;return SL.jsx(EL.Provider,{value:H,children:SL.jsx(l7,{ref:J,...Q,portalOwnerRole:U})})});var a9=P(m(),1);var S3=P(m(),1);var qg=P(c(),1);function e6($){let{children:Z,elementsRef:J,labelsRef:H,onMapChange:Q}=$,B=U0(Q),[,X]=S3.useState(!1),z=l1(u60).current,G=l1(m60).current,U=S3.useRef(0),K=S3.useRef(!0),Y=S3.useRef(null),F=S3.useRef(null),W=U0(()=>{if(K.current)return;K.current=!0,X((M)=>!M)}),q=U0((M,_)=>{G.set(M,_),W()}),N=U0((M)=>{G.delete(M),W()}),V=U0((M)=>{let _=new Map;if(J.current.length=0,H)H.current.length=0;return M.forEach((E)=>{if(_.set(E.element,{...E.registration.metadata??{},index:E.index}),J.current[E.index]=E.element,H)H.current[E.index]=E.registration.label!==void 0?E.registration.label:E.registration.textRef?.current?.textContent??E.element.textContent}),U.current=J.current.length,_});function A(M){if(F.current?.disconnect(),F.current=null,typeof MutationObserver!=="function"||M.length<2)return;let _=new MutationObserver((C)=>{if(!d60(C))return;let R=null;for(let T of M){if(!T.isConnected)continue;if(R&&Ng(R,T)>0){_.disconnect(),W();return}R=T}});F.current=_;let E=new Set;for(let C=1;C<M.length;C+=1){let R=c60(M[C-1],M[C]);if(R)E.add(R)}E.forEach((C)=>_.observe(C,{childList:!0}))}let D=U0(()=>{let[M,_]=p60(G),E=V(M),C=Y.current,R=!C||C.length!==M.length||M.some((T,I)=>{let y=C[I];return T.index!==y.index||T.element!==y.element||T.registration.index!==y.registration.index||T.registration.metadata!==y.registration.metadata});if(A(_),Y.current=M,K.current=!1,!R)return;z.forEach((T)=>T(E)),B(E)});J0(()=>{if(!K.current&&Y.current)V(Y.current);return()=>{if(J.current=[],H)H.current=[]}},[J,H,V]),J0(()=>{if(K.current)D()}),J0(()=>{return()=>{F.current?.disconnect(),K.current=!0}},[]);let L=U0((M)=>{return z.add(M),()=>{z.delete(M)}}),j=S3.useMemo(()=>({register:q,unregister:N,subscribeMapChange:L,nextIndexRef:U}),[q,N,L,U]);return qg.jsx(wL.Provider,{value:j,children:Z})}function m60(){return new Map}function u60(){return new Set}function p60($){let Z=new Set,J=[],H=[];$.forEach((B,X)=>{if(!X.isConnected)return;let z=B.index,G={index:z??-1,element:X,registration:B};if(z===null)H.push(G);else if(z>=0)Z.add(z),J.push(G)});let Q=0;if(H.sort((B,X)=>Ng(B.element,X.element)),H.forEach((B)=>{while(Z.has(Q))Q+=1;B.index=Q,J.push(B),Q+=1}),Z.size>0)J.sort((B,X)=>B.index-X.index);return[J,H.map((B)=>B.element)]}function c60($,Z){let J=$.parentElement;while(J&&!J.contains(Z))J=J.parentElement;return J}function d60($){for(let Z of $)for(let J=0;J<Z.removedNodes.length;J+=1)if(Z.removedNodes[J].isConnected)return!0;return!1}function Ng($,Z){return $.compareDocumentPosition(Z)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}var mJ=P(c(),1),Ag=a9.forwardRef(function(Z,J){let{anchor:H,positionMethod:Q="absolute",className:B,render:X,side:z,align:G,sideOffset:U=0,alignOffset:K=0,collisionBoundary:Y="clipping-ancestors",collisionPadding:F=5,arrowPadding:W=5,sticky:q=!1,disableAnchorTracking:N=!1,collisionAvoidance:V=VT,style:A,...D}=Z,{store:L}=L5(),j=Yg(),M=o6(!0),_=L.useState("parent"),E=L.useState("floatingRootContext"),C=L.useState("floatingTreeRoot"),R=L.useState("mounted"),T=L.useState("open"),I=L.useState("modal"),y=L.useState("openMethod"),S=L.useState("activeTriggerElement"),O=L.useState("transitionStatus"),b=L.useState("positionerElement"),k=L.useState("instantType"),h=L.useState("adaptiveOrigin"),v=L.useState("lastOpenChangeReason"),f=L.useState("floatingNodeId"),w=L.useState("floatingParentNodeId"),i=E.useState("domReferenceElement"),r=a9.useRef(null),x=h4(b),l=H,s=U,p=K,d=G,o=V;if(_.type==="context-menu"){if(l=H??_.context?.anchor,d=d??"start",!z&&d!=="center")p=Z.alignOffset??2,s=Z.sideOffset??-5}let Z0=z,H0=d;if(_.type==="menu")Z0=Z0??"inline-end",H0=H0??"start",o=Z.collisionAvoidance??P9;else if(_.type==="menubar")Z0=Z0??(_.context.orientation==="vertical"?"inline-end":"bottom"),H0=H0??"start";let G0=_.type==="context-menu",X0=k9({anchor:l,floatingRootContext:E,positionMethod:M?"fixed":Q,mounted:R,side:Z0,sideOffset:s,align:H0,alignOffset:p,arrowPadding:G0?0:W,collisionBoundary:Y,collisionPadding:F,sticky:q,nodeId:f,keepMounted:j,disableAnchorTracking:N,collisionAvoidance:o,shift:G0?{crossAxis:!(("side"in o)&&o.side==="flip"),rootBoundary:"layoutViewport"}:void 0,externalTree:C,adaptiveOrigin:h});a9.useEffect(()=>{function $0(Q0){if(Q0.open){if(Q0.parentNodeId===f)L.set("hoverEnabled",!1);if(Q0.nodeId!==f&&Q0.parentNodeId===L.select("floatingParentNodeId"))L.setOpen(!1,R0(K0.siblingOpen))}}return C.events.on("menuopenchange",$0),()=>{C.events.off("menuopenchange",$0)}},[L,C.events,f]),a9.useEffect(()=>{if(L.select("floatingParentNodeId")==null)return;function $0(Q0){if(Q0.open||Q0.nodeId!==L.select("floatingParentNodeId"))return;let _0=Q0.reason??K0.siblingOpen;L.setOpen(!1,R0(_0))}return C.events.on("menuopenchange",$0),()=>{C.events.off("menuopenchange",$0)}},[C.events,L]);let Y0=d1();a9.useEffect(()=>{if(!T)Y0.clear()},[T,Y0]),a9.useEffect(()=>{function $0(Q0){if(!T||Q0.nodeId!==L.select("floatingParentNodeId"))return;if(Q0.target&&S&&S!==Q0.target){let _0=L.select("closeDelay");if(_0>0){if(!Y0.isStarted())Y0.start(_0,()=>{L.setOpen(!1,R0(K0.siblingOpen))})}else L.setOpen(!1,R0(K0.siblingOpen))}else Y0.clear()}return C.events.on("itemhover",$0),()=>{C.events.off("itemhover",$0)}},[C.events,T,S,L,Y0]),a9.useEffect(()=>{let $0={open:T,nodeId:f,parentNodeId:w,reason:L.select("lastOpenChangeReason")};C.events.emit("menuopenchange",$0)},[C.events,T,L,f,w]),J0(()=>{let $0=i,Q0=r.current;if($0)r.current=$0;if(Q0&&$0&&$0!==Q0){L.set("instantType",void 0);let _0=new AbortController;return x(()=>{L.set("instantType","trigger-change")},_0.signal),()=>{_0.abort()}}return},[i,x,L]);let V0={open:T,side:X0.side,align:X0.align,anchorHidden:X0.anchorHidden,nested:_.type==="menu",instant:k},N0=_.type==="menubar"&&_.context.modal,F0=I&&v!==K0.triggerHover;mG(T&&(N0||F0),y==="touch",b,S);let n=y9(Z,V0,{styles:X0.positionerStyles,transitionStatus:O,props:D,refs:[J,L.useStateSetter("positionerElement")],hidden:!R,inert:!T}),a=R&&_.type!=="menu"&&(_.type!=="menubar"&&I&&v!==K0.triggerHover||_.type==="menubar"&&_.context.modal),e=null;if(_.type==="menubar")e=_.context.contentElement;else if(_.type===void 0)e=S;return mJ.jsxs(OL.Provider,{value:X0,children:[a&&mJ.jsx(uZ,{ref:_.type==="context-menu"||_.type==="nested-context-menu"?_.context.internalBackdropRef:null,inert:D8(!T),cutout:e}),mJ.jsx(r7,{id:f,children:mJ.jsx(e6,{elementsRef:L.context.itemDomElements,labelsRef:L.context.itemLabels,children:n})})]})});var $7=P(m(),1);var oY=P(m(),1),RL=oY.createContext(void 0);function Vg(){let $=oY.useContext(RL);if($===void 0)throw Error(y0(34));return $}var IL=P(c(),1),Dg=$7.memo($7.forwardRef(function(Z,J){let{render:H,className:Q,value:B,defaultValue:X,onValueChange:z,disabled:G=!1,style:U,"aria-labelledby":K,...Y}=Z,[F,W]=$7.useState(void 0),[q,N]=J4({controlled:B,default:X,name:"MenuRadioGroup"}),V=U0((j,M)=>{if(z?.(j,M),M.isCanceled)return;N(j)}),D=z0("div",Z,{state:{disabled:G},ref:J,props:{role:"group","aria-labelledby":K??F,"aria-disabled":G||void 0,...Y}}),L=$7.useMemo(()=>({value:q,setValue:V,disabled:G}),[q,V,G]);return IL.jsx(EB.Provider,{value:W,children:IL.jsx(RL.Provider,{value:L,children:D})})}));var sY=P(m(),1);var nY=P(m(),1),kL=nY.createContext(void 0);function Lg(){let $=nY.useContext(kL);if($===void 0)throw Error(y0(35));return $}var Mg=P(c(),1),Pg=sY.forwardRef(function(Z,J){let{render:H,className:Q,id:B,label:X,nativeButton:z=!1,disabled:G=!1,closeOnClick:U=!1,value:K,style:Y,...F}=Z,W=X4({guess:!0,label:X}),q=B4(!0),N=t0(B),{store:V}=L5(),A=V.useState("isActive",W.index),D=V.useState("itemProps"),{value:L,setValue:j,disabled:M}=Vg(),_=V.useState("disabled"),E=G||M||_,C=L===K,{getItemProps:R,itemRef:T}=s6({closeOnClick:U,disabled:E,highlighted:A,id:N,store:V,nativeButton:z,nodeId:q?.context.nodeId,itemMetadata:n6}),I=sY.useMemo(()=>({disabled:E,highlighted:A,checked:C}),[E,A,C]);function y(O){let b=R0(K0.itemPress,O.nativeEvent,void 0,{preventUnmountOnClose:X1});j(K,b)}let S=z0("div",Z,{state:I,stateAttributesMapping:t6,props:[D,{role:"menuitemradio","aria-checked":C,onClick:y},F,R],ref:[T,J,W.ref]});return Mg.jsx(kL.Provider,{value:I,children:S})});var tY=P(m(),1);var _g=tY.forwardRef(function(Z,J){let{render:H,className:Q,style:B,keepMounted:X=!1,...z}=Z,G=Lg(),U=tY.useRef(null),{transitionStatus:K,mounted:Y,setMounted:F}=j2(G.checked);W5({batch:!0,enabled:!G.checked,open:G.checked,ref:U,onComplete(){if(!G.checked)F(!1)}});let W={checked:G.checked,disabled:G.disabled,highlighted:G.highlighted,transitionStatus:K};return z0("span",Z,{state:W,stateAttributesMapping:t6,ref:[J,U],props:{"aria-hidden":!0,...z},enabled:X||Y})});var e5=P(m(),1);var eY=P(m(),1),l60=eY.createContext(null);function $F($){let Z=eY.useContext(l60);if(Z===null&&!$)throw Error(y0(5));return Z}var SB=P(m(),1);var jg={...S9,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 bL extends k2{constructor($,Z,J=!1){let H=new O2,Q=Cg(H,Z,J,$);super(Q,Tg(H),jg);this.unsubscribeParentListener=this.observe("parent",(B)=>{if(this.unsubscribeParentListener?.(),B.type==="menu"){let X=B.store.select("rootId"),z=B.store.select("floatingTreeRoot"),G=B.store.select("keyboardEventRelay");this.unsubscribeParentListener=B.store.subscribe(()=>{let U=B.store.select("rootId"),K=B.store.select("floatingTreeRoot"),Y=B.store.select("keyboardEventRelay");if(X===U&&z===K&&G===Y)return;X=U,z=K,G=Y,this.notifyAll()}),this.context.allowMouseUpTriggerRef=B.store.context.allowMouseUpTriggerRef;return}if(B.type!==void 0)this.context.allowMouseUpTriggerRef=B.context.allowMouseUpTriggerRef;this.unsubscribeParentListener=null})}setOpen($,Z){this.state.floatingRootContext.context.events.emit("setOpen",{open:$,eventDetails:Z})}unsubscribeParentListener=null}function Og(){let $=new O2,Z=new r8(Object.freeze(Cg($)),Object.freeze(Tg($)),jg);return Object.assign(Z,{setOpen:X1})}function Tg($){return{positionerRef:SB.createRef(),popupRef:SB.createRef(),typingRef:{current:!1},itemDomElements:{current:[]},itemLabels:{current:[]},allowMouseUpTriggerRef:{current:!1},triggerFocusTargetRef:SB.createRef(),beforeContentFocusGuardRef:SB.createRef(),onOpenChangeComplete:void 0,triggerElements:$}}function Cg($,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 i7,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:L1,keyboardEventRelay:void 0,closeDelay:0,adaptiveOrigin:void 0,...H}}var ZF=P(m(),1),yL=ZF.createContext(void 0);function JF(){return ZF.useContext(yL)}var RB=P(c(),1),HF=v8(function(Z){let{children:J,open:H,onOpenChange:Q,onOpenChangeComplete:B,defaultOpen:X=!1,disabled:z=!1,modal:G,loopFocus:U=!0,orientation:K="vertical",actionsRef:Y,closeParentOnEsc:F=!1,handle:W,triggerId:q,defaultTriggerId:N=null,highlightItemOnHover:V=!0}=Z,A=o6(!0),D=L5(!0),L=$F(!0),j=JF(),M=e5.useMemo(()=>{if(j&&D)return{type:"menu",store:D.store};if(L)return{type:"menubar",context:L};if(A&&!D)return{type:"context-menu",context:A};return{type:void 0}},[A,D,L,j]),_=A4(),E=A4(),C=D4(),R=M.type==="menu"?M.store:void 0,T=(H??X)&&R?.state.transitionStatus==="starting",I=l1(()=>T?R?.state.instantType:void 0).current,y=i60({open:X,openProp:H,activeTriggerId:N,triggerIdProp:q,parent:M,disabled:z,highlightItemOnHover:V,modal:M.type===void 0?G:void 0,rootId:_,instantType:I},E,C!=null);y.useControlledProp("openProp",H),y.useControlledProp("triggerIdProp",q),y.useContextCallback("onOpenChangeComplete",B);let S=y.useState("floatingTreeRoot"),O=V3(S),b=y.useState("open"),k=y.useState("activeTriggerElement"),h=y.useState("positionerElement"),v=y.useState("hoverEnabled"),f=y.useState("disabled"),w=y.useState("lastOpenChangeReason"),i=y.useState("parent"),r=y.useState("activeIndex"),x=y.useState("payload"),l=y.useState("floatingParentNodeId"),s=e5.useRef(null),p=e5.useRef(i.type!=="context-menu"),d=d1(),o=e5.useRef(!0),Z0=d1(),H0=l!=null,{openMethod:G0,triggerProps:X0}=gE(b);y.useSyncedValues({disabled:z,highlightItemOnHover:V,modal:i.type===void 0?G:void 0,openMethod:G0,rootId:_}),T9(y);let{forceUnmount:Y0,transitionStatus:V0}=C9(b,y,()=>{y.set("allowMouseEnter",!1)},T),N0=h4(y.context.popupRef);e5.useEffect(()=>{if(I===void 0)return;let T0=()=>{if(y.state.instantType===I)y.set("instantType",void 0)};if(!b){T0();return}if(V0!==void 0)return;if(y.context.popupRef.current==null){T0();return}let x0=new AbortController;return N0(T0,x0.signal),()=>{x0.abort()}},[I,b,V0,N0,y]),J0(()=>{if(A&&!D)y.update({parent:{type:"context-menu",context:A},floatingNodeId:O,floatingParentNodeId:C});else if(D)y.update({floatingNodeId:O,floatingParentNodeId:C})},[A,D,O,C,y]),e5.useEffect(()=>{if(!b)s.current=null;if(i.type!=="context-menu")return;if(!b){d.clear(),p.current=!1;return}d.start(500,()=>{p.current=!0})},[d,b,i.type]),J0(()=>{if(!b&&!v)y.set("hoverEnabled",!0)},[b,v,y]);let F0=U0((T0,x0)=>{let J1=x0.reason;if(!T0&&!y.select("open"))return;if(b===T0&&x0.trigger===k&&w===J1)return;let W1=BQ(x0);if(!T0&&x0.trigger==null)x0.trigger=k??void 0;if(Q?.(T0,x0),x0.isCanceled)return;y.state.floatingRootContext.dispatchOpenChange(T0,x0);let d0=x0.event;if(T0===!1&&d0?.type==="click"&&d0.pointerType==="touch"&&!o.current)return;if(T0&&J1===K0.triggerFocus)o.current=!1,Z0.start(300,()=>{o.current=!0});else o.current=!0,Z0.clear();let v0=(J1===K0.triggerPress||J1===K0.itemPress)&&d0.detail===0,E1=!T0&&(J1===K0.escapeKey||J1==null);s.current=x0.event;let B1=s7(y.state,T0,x0.trigger,W1());if(B1.openChangeReason=J1,i.type==="menubar"&&(J1===K0.triggerFocus||J1===K0.focusOut||J1===K0.triggerHover||J1===K0.listNavigation||J1===K0.siblingOpen))B1.instantType="group";else if(v0||E1)B1.instantType=v0?"click":"dismiss";else B1.instantType=void 0;y.update(B1)}),n=QQ({popupStore:y,floatingRootContext:y.state.floatingRootContext,floatingId:E,nested:C!=null,onOpenChange:F0}),a=n.context.events;J0(()=>{let T0=({open:x0,eventDetails:J1})=>F0(x0,J1);return a.on("setOpen",T0),()=>{a?.off("setOpen",T0)}},[a,F0]);let e=e5.useCallback(()=>{y.setOpen(!1,R0(K0.imperativeAction))},[y]);e5.useImperativeHandle(Y,()=>({unmount:Y0,close:e}),[Y0,e]);let $0;if(i.type==="context-menu")$0=i.context;e5.useImperativeHandle($0?.positionerRef,()=>h,[h]),e5.useImperativeHandle($0?.actionsRef,()=>({setOpen:F0}),[F0]);let Q0=c8(n,{enabled:!f,bubbles:{escapeKey:F&&i.type==="menu"},outsidePress(){if(i.type!=="context-menu"||s.current?.type==="contextmenu")return!0;return p.current},externalTree:H0?S:void 0}),_0=g4(),M0=e5.useCallback((T0)=>{if(y.select("activeIndex")===T0)return;y.set("activeIndex",T0)},[y]),A0=jA(n,{enabled:!f,listRef:y.context.itemDomElements,activeIndex:r,nested:i.type!==void 0,loopFocus:U,orientation:K,parentOrientation:i.type==="menubar"?i.context.orientation:void 0,rtl:_0==="rtl",disabledIndices:r2,onNavigate:M0,openOnArrowKeyDown:i.type!=="context-menu",externalTree:H0?S:void 0,focusItemOnHover:V}),L0=e5.useCallback((T0)=>{y.context.typingRef.current=T0},[y]),g=OA(n,{enabled:!f,listRef:y.context.itemLabels,elementsRef:y.context.itemDomElements,activeIndex:r,resetMs:WT,onMatch:(T0)=>{if(b&&T0!==r)y.set("activeIndex",T0)},onTyping:L0}),u=e5.useMemo(()=>{let T0=X2(g.reference,A0.reference,Q0.reference,{onMouseMove(){y.set("allowMouseEnter",!0)}},X0);return T0["aria-haspopup"]="menu",T0["aria-expanded"]=b,T0},[y,g.reference,A0.reference,Q0.reference,X0,b]),t=e5.useMemo(()=>{let T0=X2(A0.trigger,Q0.trigger,X0);return T0["aria-haspopup"]="menu",T0["aria-expanded"]=!1,T0},[A0.trigger,Q0.trigger,X0]);l1(()=>{return y.update({inactiveTriggerProps:t}),null});let W0=e5.useMemo(()=>X2(_9,{id:E,role:"menu","aria-orientation":K==="horizontal"?"horizontal":void 0,"aria-labelledby":k?.id,onMouseMove(){if(y.set("allowMouseEnter",!0),i.type==="menu")y.set("hoverEnabled",!1)},onClick(){if(y.select("hoverEnabled"))y.set("hoverEnabled",!1)},onKeyDown(T0){let x0=y.select("keyboardEventRelay");if(x0&&!T0.isPropagationStopped())x0(T0)}},g.floating,A0.floating,Q0.floating),[k,E,K,i.type,y,g.floating,A0.floating,Q0.floating]),I0=A0.item??L1;w9(y,{floatingRootContext:n,activeTriggerProps:u,inactiveTriggerProps:t,popupProps:W0,itemProps:I0});let c0=e5.useMemo(()=>({store:y,parent:M}),[y,M]),f0=RB.jsxs(TL.Provider,{value:c0,children:[W&&RB.jsx(j9,{handle:W,store:y}),typeof J==="function"?J({payload:x}):J]});if(i.type===void 0||i.type==="context-menu")return RB.jsx(a7,{externalTree:S,children:f0});return f0});function i60($,Z,J){return l1(()=>new bL($,Z,J)).current}var wg=P(m(),1);var xL=P(c(),1);function Eg($){let Z=L5().store,J=wg.useMemo(()=>({parentMenu:Z}),[Z]);return xL.jsx(yL.Provider,{value:J,children:xL.jsx(HF,{...$})})}var z4=P(m(),1);var QF=5;function Sg($,Z){let J=r60(Z);return $.clientX>=J.left-QF&&$.clientX<=J.right+QF&&$.clientY>=J.top-QF&&$.clientY<=J.bottom+QF}function r60($){let Z=$.getBoundingClientRect(),J=R1($);if(r1.env.jsdom)return Z;let H=J.getComputedStyle($,"::before"),Q=J.getComputedStyle($,"::after");if(!(H.content!=="none"||Q.content!=="none"))return Z;let X=parseFloat(H.width)||0,z=parseFloat(H.height)||0,G=parseFloat(Q.width)||0,U=parseFloat(Q.height)||0,K=Math.max(Z.width,X,G),Y=Math.max(Z.height,z,U),F=K-Z.width,W=Y-Z.height;return{left:Z.left-F/2,right:Z.right+F/2,top:Z.top-W/2,bottom:Z.bottom+W/2}}var Rg=P(m(),1);function BF($={}){let{highlightItemOnHover:Z,highlightedIndex:J,onHighlightedIndexChange:H}=uJ(),{ref:Q,index:B}=X4($),X=J===B,z=Rg.useRef(null),G=x2(Q,z);return{compositeProps:{tabIndex:X?0:-1,onFocus(){H(B)},onMouseMove(){let K=z.current;if(!Z||!K)return;let Y=K.hasAttribute("disabled")||K.ariaDisabled==="true";if(!X&&!Y)K.focus()}},compositeRef:G,index:B}}function Ig($){let{render:Z,className:J,style:H,state:Q=L1,props:B=r2,refs:X=r2,metadata:z,stateAttributesMapping:G,tag:U="div",...K}=$,{compositeProps:Y,compositeRef:F}=BF({metadata:z});return z0(U,$,{state:Q,ref:[F,...X],props:[Y,...B,K],stateAttributesMapping:G})}function hL($){if(P1($)&&$.hasAttribute("data-rootownerid"))return $.getAttribute("data-rootownerid");if(L8($))return;return hL(M8($))}var XF=P(m(),1);function kg($){let{enabled:Z=!0,mouseDownAction:J,open:H}=$,Q=XF.useRef(!1);return XF.useMemo(()=>{if(!Z)return L1;return{onMouseDown:(B)=>{if(J==="open"&&!H||J==="close"&&H)Q.current=!0,m0(B.currentTarget).addEventListener("click",()=>{Q.current=!1},{once:!0})},onClick:(B)=>{if(Q.current)Q.current=!1,B.preventBaseUIHandler()}}},[Z,J,H])}var Z7=P(c(),1),bg=A9(function(Z,J){let{render:H,className:Q,style:B,disabled:X=!1,nativeButton:z=!0,id:G,openOnHover:U,delay:K=100,closeDelay:Y=0,handle:F,payload:W,...q}=Z,N=L5(!0),A=R9(F)??N?.store;if(!A)throw Error(y0(85));let D=t0(G),L=A.useState("isTriggerActive",D),j=A.useState("floatingRootContext"),M=A.useState("isOpenedByTrigger",D),_=A.useState("triggerPopupId",D),E=z4.useRef(null),C=o60(),R=uJ(!0),T=n2(),I=z4.useMemo(()=>{return T??new i7},[T]),y=V3(I),S=D4(),{registerTrigger:O,isMountedByThisTrigger:b}=O9(D,E,A,{payload:W,closeDelay:Y,parent:C,floatingTreeRoot:I,floatingNodeId:y,floatingParentNodeId:S,keyboardEventRelay:R?.relayKeyboardEvent}),k=C.type==="menubar",h=A.useState("disabled"),v=X||h||k&&C.context.disabled,{getButtonProps:f,buttonRef:w}=T5({disabled:v,native:z});z4.useEffect(()=>{if(!M&&C.type===void 0)A.context.allowMouseUpTriggerRef.current=!1},[A,M,C.type]);let i=z4.useRef(null),r=d1(),x=U0(($0)=>{if(!i.current)return;r.clear(),A.context.allowMouseUpTriggerRef.current=!1;let Q0=$0.target;if(k0(i.current,Q0)||k0(A.select("positionerElement"),Q0)||Q0===i.current)return;if(Q0!=null&&hL(Q0)===A.select("rootId"))return;if(Sg($0,i.current))return;I.events.emit("close",{domEvent:$0,reason:K0.cancelOpen})});z4.useEffect(()=>{if(M&&A.select("lastOpenChangeReason")===K0.triggerHover)m0(i.current).addEventListener("mouseup",x,{once:!0})},[M,x,A]);let l=k&&C.context.hasSubmenuOpen,p=l8(j,{enabled:(U??l)&&!v&&(!k||l&&!b),handleClose:i8({blockPointerEvents:!k}),mouseOnly:!0,move:!1,restMs:C.type===void 0?K:void 0,delay:{close:Y},triggerElementRef:E,externalTree:I,isActiveTrigger:L,isClosing:()=>A.select("transitionStatus")==="ending"}),d=a60(M,A.select("lastOpenChangeReason")),o=D3(j,{enabled:!v,event:M&&k?"click":"mousedown",toggle:!0,ignoreMouse:!1,stickIfOpen:C.type===void 0?d:!1}),Z0=t7(j,{enabled:!v&&l}),H0=kg({open:M,enabled:k,mouseDownAction:"open"}),G0=z4.useMemo(()=>X2(Z0.reference,o.reference),[Z0.reference,o.reference]),X0=A.useState("triggerProps",b),{preFocusGuardRef:Y0,handlePreFocusGuardFocus:V0,handleFocusTargetFocus:N0}=xG(A,E),F0={disabled:v,open:M},n=[i,J,w,O,E],a=[G0,p??L1,X0,{"aria-haspopup":"menu","aria-controls":_,id:D,onMouseDown:($0)=>{if(A.select("open"))return;r.start(200,()=>{A.context.allowMouseUpTriggerRef.current=!0}),m0($0.currentTarget).addEventListener("mouseup",x,{once:!0})}},k?{role:"menuitem"}:{},H0,q,f],e=z0("button",Z,{enabled:!k,stateAttributesMapping:rH,state:F0,ref:n,props:a});if(k)return Z7.jsx(Ig,{tag:"button",render:H,className:Q,style:B,state:F0,refs:n,props:a,stateAttributesMapping:rH});if(M)return Z7.jsxs(z4.Fragment,{children:[Z7.jsx(x4,{ref:Y0,onFocus:V0},`${D}-pre-focus-guard`),Z7.jsx(z4.Fragment,{children:e},D),Z7.jsx(x4,{ref:A.context.triggerFocusTargetRef,onFocus:N0},`${D}-post-focus-guard`)]});return Z7.jsx(z4.Fragment,{children:e},D)});function a60($,Z){let J=d1(),[H,Q]=z4.useState(!1);return J0(()=>{if($&&Z===K0.triggerHover)Q(!0),J.start(Rz,()=>{Q(!1)});else if(!$)J.clear(),Q(!1)},[$,Z,J]),H}function o60(){let $=$F(!0);return z4.useMemo(()=>{if($)return{type:"menubar",context:$};return{type:void 0}},[$])}var yg=P(m(),1);var xg=yg.forwardRef(function(Z,J){let{render:H,className:Q,style:B,children:X,...z}=Z,{store:G}=L5(),{side:U}=B4(),K=G.useState("instantType"),{children:Y,state:F}=z6({store:G,side:U,children:X}),W={activationDirection:F.activationDirection,transitioning:F.transitioning,instant:K};return z0("div",Z,{state:W,ref:J,props:[z,{children:Y}],stateAttributesMapping:X6})});var hg=P(m(),1);var vg=hg.forwardRef(function(Z,J){let{className:H,render:Q,orientation:B="horizontal",style:X,...z}=Z;return z0("div",Z,{state:{orientation:B},ref:J,props:[{role:"separator","aria-orientation":B},z]})});var R3=P(m(),1);function gg($){return $==null||$.hasAttribute("disabled")||$.getAttribute("aria-disabled")==="true"}var n60={"aria-expanded":void 0},fg=R3.forwardRef(function(Z,J){let{render:H,className:Q,style:B,label:X,id:z,nativeButton:G=!1,openOnHover:U=!0,delay:K=100,closeDelay:Y=0,disabled:F=!1,...W}=Z,q=JF();if(!q?.parentMenu)throw Error(y0(37));let N=X4({guess:!0,label:X}),V=B4(),{store:A}=L5(),D=t0(z),L=A.useState("open"),j=A.useState("floatingRootContext"),M=A.useState("floatingTreeRoot"),_=A.useState("triggerPopupId",D),E=NA(D,A),C=U0((G0)=>{if(E(G0),G0!==null&&A.select("open")&&A.select("activeTriggerId")==null)A.update({activeTriggerId:D??null,activeTriggerElement:G0,closeDelay:Y})}),R=R3.useRef(null),T=R3.useCallback((G0)=>{R.current=G0,A.set("activeTriggerElement",G0)},[A]);J0(()=>{return C(R.current),()=>C(null)},[C,D,A]),A.useSyncedValue("closeDelay",Y);let I=q.parentMenu,y=A.useState("disabled"),S=I.useState("disabled"),O=F||y||S,b=I.useState("itemProps"),k=I.useState("isActive",N.index),h=R3.useMemo(()=>({type:"submenu-trigger",setActive(){if(I.select("highlightItemOnHover"))I.set("activeIndex",N.index)}}),[I,N.index]),{getItemProps:v,itemRef:f}=s6({closeOnClick:!1,disabled:O,highlighted:k,id:D,store:A,typingRef:I.context.typingRef,nativeButton:G,itemMetadata:h,nodeId:V?.context.nodeId}),w=A.useState("hoverEnabled"),i=l8(j,{enabled:w&&U&&!O,handleClose:i8({blockPointerEvents:!0}),mouseOnly:!0,move:!0,restMs:K,delay:{open:K,close:Y},shouldOpen:K>0?()=>I.select("allowMouseEnter"):void 0,triggerElementRef:R,externalTree:M,isClosing:()=>A.select("transitionStatus")==="ending",guardStaleOpen:!0}),x=D3(j,{enabled:!O,event:"mousedown",toggle:!U,ignoreMouse:U,stickIfOpen:!1}).reference??L1,l=A.useState("triggerProps",!0);delete l.id;let s={disabled:O,highlighted:k,open:L},p=A.useState("openMethod"),o=A.useState("lastOpenChangeReason")===K0.listNavigation||p==="keyboard",Z0=L&&o&&r1.screenReader.voiceOver;return z0("div",Z,{state:s,stateAttributesMapping:V9,props:[x,i,l,b,Z0?n60:void 0,{"aria-controls":_,tabIndex:L||k?0:-1,onBlur(){if(k)I.set("activeIndex",null)}},W,v],ref:[J,N.ref,f,C,T]})});class zF extends d8{constructor(){super(Og(),"Menu")}open($){this.openByTrigger($)}close(){this.closePopup()}get isOpen(){return this.attachedStore?.select("open")??!1}}function mg(){return new zF}var m2=P(c(),1);function o9({...$}){return m2.jsx(O4.Root,{"data-slot":"dropdown-menu",...$})}function s60({...$}){return m2.jsx(_8,{portal:O4.Portal,"data-slot":"dropdown-menu-portal",...$})}function n9({...$}){return m2.jsx(O4.Trigger,{"data-slot":"dropdown-menu-trigger",...$})}function s9({align:$="start",alignOffset:Z=0,side:J="bottom",sideOffset:H=4,className:Q,...B}){return m2.jsx(s60,{children:m2.jsx(O4.Positioner,{className:"isolate z-50 outline-none",align:$,alignOffset:Z,side:J,sideOffset:H,children:m2.jsx(O4.Popup,{"data-slot":"dropdown-menu-content",className:a0("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",Q),...B})})})}function J7({...$}){return m2.jsx(O4.Group,{"data-slot":"dropdown-menu-group",...$})}function GF({className:$,inset:Z,...J}){return m2.jsx(O4.GroupLabel,{"data-slot":"dropdown-menu-label","data-inset":Z,className:a0("px-2 pt-1.5 pb-0.5 text-xs text-muted-foreground data-inset:ps-7",$),...J})}function H9({className:$,inset:Z,variant:J="default",...H}){return m2.jsx(O4.Item,{"data-slot":"dropdown-menu-item","data-inset":Z,"data-variant":J,className:a0("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 ug({...$}){return m2.jsx(O4.RadioGroup,{"data-slot":"dropdown-menu-radio-group",...$})}function pg({className:$,children:Z,inset:J,...H}){return m2.jsxs(O4.RadioItem,{"data-slot":"dropdown-menu-radio-item","data-inset":J,className:a0("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:[m2.jsx("span",{className:"pointer-events-none absolute end-2 flex items-center justify-center","data-slot":"dropdown-menu-radio-item-indicator",children:m2.jsx(O4.RadioItemIndicator,{children:m2.jsx(j8,{stroke:1.75})})}),Z]})}function cg({className:$,...Z}){return m2.jsx(O4.Separator,{"data-slot":"dropdown-menu-separator",className:a0("mx-2 my-1 h-px bg-border",$),...Z})}var LF=P(m(),1);var H7={};C5(H7,{Value:()=>ng,Track:()=>$f,Thumb:()=>Xf,Root:()=>ig,Label:()=>ag,Indicator:()=>Gf,Control:()=>tg});var $2=P(m(),1);function vL($,Z,J=Object.is){let{length:H}=$;if(H!==Z.length)return!1;for(let Q=0;Q<H;Q+=1)if(!J($[Q],Z[Q]))return!1;return!0}function dg($){return $==null?void 0:`${$}-label`}function lg($,Z){return $??Z}function UF($,Z){return $-Z}function KF($,Z,J,H,Q,B){let X=_2($,J,H);if(!Q)return X;let z=B.slice();return z[Z]=_2(X,B[Z-1]??-1/0,B[Z+1]??1/0),z.sort(UF)}function YF($,Z,J){if(!Array.isArray($))return!0;let H=Z*J;for(let Q=0;Q<$.length-1;Q+=1)if(!(Math.abs($[Q]-$[Q+1])>=H))return!1;return!0}var pJ=()=>null,c4={activeThumbIndex:pJ,max:pJ,min:pJ,minStepsBetweenValues:pJ,step:pJ,values:pJ,...C2};var FF=P(m(),1),gL=FF.createContext(void 0);function I8(){let $=FF.useContext(gL);if($===void 0)throw Error(y0(62));return $}var fL=P(c(),1);function t60($,Z){return $===Z||Array.isArray($)&&Array.isArray(Z)&&vL($,Z)}var ig=$2.forwardRef(function(Z,J){let{"aria-labelledby":H,className:Q,defaultValue:B,disabled:X=!1,id:z,format:G,largeStep:U=10,locale:K,render:Y,max:F=100,min:W=0,minStepsBetweenValues:q=0,form:N,name:V,onValueChange:A,onValueCommitted:D,orientation:L="horizontal",step:j=1,thumbCollisionBehavior:M="push",thumbAlignment:_="center",value:E,style:C,...R}=Z,T=t0(z),I=dg(T),y=U0(A),S=U0(D),{clearErrors:O}=Z4(),{state:b,disabled:k,name:h,setTouched:v,setDirty:f,validityData:w,validation:i}=l5(),{labelId:r}=i5(),[x,l]=$2.useState(),s=H??lg(r,x),p=k||X,d=h??V,[o,Z0]=J4({controlled:E,default:B??W,name:"Slider"}),H0=$2.useRef(null),G0=$2.useRef(null),X0=$2.useRef([]),Y0=$2.useRef(null),V0=$2.useRef(-1),N0=$2.useRef(null),F0=$2.useRef(K0.none),[n,a]=$2.useState(-1),[e,$0]=$2.useState(-1),[Q0,_0]=$2.useState(!1),[M0,A0]=$2.useState(()=>new Map),[L0,g]=$2.useState([void 0,void 0]),u=U0((d0)=>{if(a(d0),d0!==-1)$0(d0)}),t=U0((d0)=>{if(d0)G0.current=d0}),W0=Array.isArray(o),I0=$2.useMemo(()=>{if(!W0)return[_2(o,W,F)];return o.map((d0)=>_2(d0,W,F)).sort(UF)},[F,W,W0,o]),c0=W0?I0:I0[0];w6(i.inputRef,T,c0,void 0,!p,V),h9(c0,()=>{O(d),i.change(c0);let d0=w.initialValue,v0;if(Array.isArray(c0)&&Array.isArray(d0))v0=!vL(c0,d0);else v0=c0!==d0;f(v0)});let f0=U0((d0,v0)=>{if(Number.isNaN(d0)||t60(d0,o))return!1;let E1=v0.event,s1=new E1.constructor(E1.type,E1);if(Object.defineProperty(s1,"target",{writable:!0,value:{value:d0,name:d}}),v0.event=s1,y(d0,v0),v0.isCanceled)return!1;return F0.current=v0.reason,Z0(d0),!0}),T0=U0((d0,v0,E1)=>{let B1=KF(d0,v0,W,F,W0,I0);if(YF(B1,j,q)){let s1="key"in E1?K0.keyboard:K0.inputChange,C0=f0(B1,R0(s1,E1.nativeEvent,void 0,{activeThumbIndex:v0}));if(v(!0),C0)S(B1,uz(s1,E1.nativeEvent))}});J0(()=>{if(!p)return;let d0=p1(m0(H0.current));if(k0(H0.current,d0))d0.blur();if(n!==-1)u(-1)},[n,p,u]);let x0=$2.useMemo(()=>({...b,activeThumbIndex:n,disabled:p,dragging:Q0,orientation:L,max:F,min:W,minStepsBetweenValues:q,step:j,values:I0}),[b,n,p,Q0,F,W,q,L,j,I0]),J1=$2.useMemo(()=>({active:n,controlRef:G0,disabled:p,dragging:Q0,validation:i,format:G,handleInputChange:T0,indicatorPosition:L0,inset:_!=="center",labelId:s,rootLabelId:I,largeStep:U,lastUsedThumbIndex:e,lastChangeReasonRef:F0,form:N,locale:K,max:F,min:W,minStepsBetweenValues:q,name:d,onValueCommitted:S,orientation:L,pressedThumbCenterOffsetRef:Y0,pressedThumbIndexRef:V0,pressedValuesRef:N0,registerFieldControlRef:t,renderBeforeHydration:_==="edge",setActive:u,setDragging:_0,setIndicatorPosition:g,setLabelId:l,setValue:f0,state:x0,step:j,thumbCollisionBehavior:M,thumbMap:M0,thumbRefs:X0,values:I0}),[n,s,I,p,Q0,i,G,T0,L0,U,e,N,K,F,W,q,d,S,L,t,u,f0,x0,j,M,_,M0,I0]),W1=z0("div",Z,{state:x0,ref:[J,H0],props:[{"aria-labelledby":s,id:T,role:"group"},R,(d0)=>i.getValidationProps(p,d0)],stateAttributesMapping:c4});return fL.jsx(gL.Provider,{value:J1,children:fL.jsx(e6,{elementsRef:X0,onMapChange:A0,children:W1})})});var rg=P(m(),1);var ag=rg.forwardRef(function(Z,J){let{render:H,className:Q,style:B,...X}=Z,z=X;delete z.id;let{state:G,setLabelId:U,controlRef:K,rootLabelId:Y}=I8();function F(q,N){if(N){let D=m0(q.currentTarget).getElementById(N);if(P1(D)){gU(D);return}}let V=K.current?.querySelectorAll('input[type="range"]'),A=V?.length===1?V[0]:null;if(P1(A))gU(A)}let W=vU({id:Y,setLabelId:U,focusControl:F});return z0("div",Z,{ref:J,state:G,props:[W,X],stateAttributesMapping:c4})});var WF=P(m(),1);function mL($){if(Array.isArray($))return $.map((Z)=>mL(Z)).join(",");if($==null)return"";return String($)}var og=new Map;function e60($,Z){let J=JSON.stringify({locale:mL($),options:Z}),H=og.get(J);if(H)return H;let Q=new Intl.NumberFormat($,Z);return og.set(J,Q),Q}function cJ($,Z,J){if($==null)return"";return e60(Z,J).format($)}var ng=WF.forwardRef(function(Z,J){let{"aria-live":H="off",render:Q,className:B,children:X,style:z,...G}=Z,{thumbMap:U,state:K,values:Y,format:F,locale:W}=I8(),q=Array.from(U.values(),({inputId:D})=>D).join(" ").trim()||void 0,N=WF.useMemo(()=>Y.map((D)=>cJ(D,W,F)),[F,W,Y]),V=N.join(" – ");return z0("output",Z,{state:K,ref:J,props:[{"aria-live":H,children:typeof X==="function"?X(N,Y):V,htmlFor:q},G],stateAttributesMapping:c4})});var k8=P(m(),1);function qF($,Z){let J=$.getBoundingClientRect();return Z?(J.top+J.bottom)/2:(J.left+J.right)/2}function dJ($){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 NF($,Z,J){let H=Math.round(($-J)/Z)*Z+J;return Number(H.toFixed(Math.max(dJ(Z),dJ(J))))}function uL($,Z,J,H,Q,B,X,z){let G=$.slice(),U=B*X,K=G.length-1,Y=z??$,F=H+Z*U,W=Q-(K-Z)*U;G[Z]=_2(J,F,W);for(let q=Z+1;q<=K;q+=1){let N=G[q-1]+U,V=Q-(K-q)*U,A=Y[q],D=Math.max(G[q],N);if(A<D)D=Math.max(A,N);G[q]=_2(D,N,V)}for(let q=Z-1;q>=0;q-=1){let N=G[q+1]-U,V=H+q*U,A=Y[q],D=Math.min(G[q],N);if(A>D)D=Math.min(A,N);G[q]=_2(D,V,N)}for(let q=0;q<=K;q+=1)G[q]=Number(G[q].toFixed(12));return G}function sg($,Z,J,H,Q,B,X,z,G,U){let K=J??Z,Y=H??Z;if(!(K.length>1))return{value:B,thumbIndex:0,didSwap:!1};let W=G*U;if($==="push")return{value:uL(K,Q,B,X,z,G,U),thumbIndex:Q,didSwap:!1};let q=K.slice(),N=q[Q-1],V=q[Q+1],A=N!=null?N+W:X,D=V!=null?V-W:z,L=Number(_2(B,A,D).toFixed(12));switch(q[Q]=L,$){case"swap":{let j=K[Q],M=0.0000001,_=B>j,E=B<j,C=_&&V!=null&&B>=V-0.0000001,R=E&&N!=null&&B<=N+0.0000001;if(!C&&!R)return{value:q,thumbIndex:Q,didSwap:!1};let T=C?Q+1:Q-1,I=q.map((w,i)=>{if(i===Q)return L;let r=Y[i];if(r!=null)return r;return K[i]}),y=B;if(C)y=Math.max(B,q[T]);else y=Math.min(B,q[T]);let S=uL(q,T,y,X,z,G,U,I),O=C?T-1:T+1,b=S[O-1],k=S[O+1],h=b!=null?b+W:X;h=Math.max(h,X+O*W);let v=k!=null?k-W:z;v=Math.min(v,z-(S.length-1-O)*W);let f=_2(L,h,v);return S[O]=Number(f.toFixed(12)),{value:S,thumbIndex:T,didSwap:!0}}case"none":default:return{value:q,thumbIndex:Q,didSwap:!1}}}var $70=2;function Z70($,Z){if(!$)return{start:0,end:0};function J(B){let X=B!=null?parseFloat(B):0;return Number.isNaN(X)?0:X}let H=!Z?"InlineStart":"Top",Q=!Z?"InlineEnd":"Bottom";return{start:J($[`border${H}Width`])+J($[`padding${H}`]),end:J($[`border${Q}Width`])+J($[`padding${Q}`])}}function J70($,Z){if(Z.current!=null&&$.changedTouches){let J=$;for(let H=0;H<J.changedTouches.length;H+=1){let Q=J.changedTouches[H];if(Q.identifier===Z.current)return{x:Q.clientX,y:Q.clientY}}return null}return{x:$.clientX,y:$.clientY}}var tg=k8.forwardRef(function(Z,J){let{render:H,className:Q,style:B,...X}=Z,{disabled:z,dragging:G,inset:U,lastChangeReasonRef:K,max:Y,min:F,minStepsBetweenValues:W,onValueCommitted:q,orientation:N,pressedThumbCenterOffsetRef:V,pressedThumbIndexRef:A,pressedValuesRef:D,registerFieldControlRef:L,renderBeforeHydration:j,setActive:M,setDragging:_,setValue:E,state:C,step:R,thumbCollisionBehavior:T,thumbRefs:I,values:y}=I8(),S=g4(),O=y.length>1,b=N==="vertical",k=k8.useRef(null),h=k8.useRef(null),v=U0((a)=>{if(a&&h.current==null)h.current=R1(a).getComputedStyle(a)}),f=k8.useRef(null),w=k8.useRef(0),i=k8.useRef(0),r=k8.useRef(null),x=U5(y);function l(a){return a?.querySelector('input[type="range"]')}function s(a){if(A.current=a,!I.current[a])V.current=null}function p(){A.current=-1,V.current=null}function d(a){if(!s0(a))return!1;return I.current.some((e)=>{if(!s0(e)||!k0(e,a))return!1;return l(e)?.disabled===!0})}function o(a){let e=k.current,$0=A.current;if(!e||$0<0||$0>=y.length){if($0>=y.length)r.current=null;return null}let{width:Q0,height:_0,bottom:M0,left:A0,right:L0}=e.getBoundingClientRect(),g=Z70(h.current,b),u=i.current,t=(b?_0:Q0)-g.start-g.end-u*2,W0=V.current??0,I0=a.x-W0,c0=a.y-W0,f0=b?M0-c0-g.end:(S==="rtl"?L0-I0:I0-A0)-g.start,T0=_2((f0-u)/t,0,1),x0=(Y-F)*T0+F;if(x0=NF(x0,R,F),x0=_2(x0,F,Y),!O)return{value:x0,thumbIndex:$0,didSwap:!1};return sg(T,y,x.current,D.current,$0,x0,F,Y,R,W)}function Z0(a){D.current=O?y.slice():null,r.current=null,x.current=y;let e=A.current,$0=e;if(e>-1&&e<y.length){if(y[e]===Y){let Q0=e;while(Q0>0&&y[Q0-1]===Y)Q0-=1;$0=Q0}}else{let Q0=!b?"x":"y",_0;$0=-1;for(let M0=0;M0<I.current.length;M0+=1){let A0=I.current[M0];if(s0(A0)&&!l(A0)?.disabled){let L0=qF(A0,b),g=Math.abs(a[Q0]-L0);if(_0===void 0||g<=_0)$0=M0,_0=g}}}if($0>-1&&$0!==e)s($0);if(U){let Q0=I.current[$0];if(s0(Q0)){let _0=Q0.getBoundingClientRect(),M0=!b?"width":"height";i.current=_0[M0]/2}}}function H0(a){let e=l(I.current?.[a]);if(!e)return;e.focus({preventScroll:!0,focusVisible:!1})}function G0(a,e,$0){let Q0=E(a.value,R0(e,$0,void 0,{activeThumbIndex:a.thumbIndex}));if(Q0){if(r.current=a.value,x.current=Array.isArray(a.value)?a.value:[a.value],a.didSwap)s(a.thumbIndex),H0(a.thumbIndex)}return Q0}let X0=U0((a)=>{let e=J70(a,f);if(e==null)return;if(w.current+=1,a.type==="pointermove"&&a.buttons===0){Y0(a);return}let $0=o(e);if($0==null)return;if(YF($0.value,R,W)){if(!G&&w.current>$70)_(!0);G0($0,K0.drag,a)}}),Y0=U0((a)=>{M(-1),_(!1),V.current=null;let e=r.current;if(Array.isArray(e)&&e.length!==y.length)r.current=null;if(r.current!=null){let $0=K.current;q(r.current,uz($0,a))}if("pointerType"in a&&k.current?.hasPointerCapture(a.pointerId))k.current?.releasePointerCapture(a.pointerId);A.current=-1,f.current=null,N0()}),V0=U0((a)=>{if(z)return;if(d(M1(a))){p();return}let e=a.changedTouches[0];if(e==null)return;f.current=e.identifier;let $0={x:e.clientX,y:e.clientY};Z0($0);let Q0=o($0);if(Q0==null)return;H0(Q0.thumbIndex),G0(Q0,K0.trackPress,a),w.current=0;let _0=m0(k.current);_0.addEventListener("touchmove",X0,{passive:!0}),_0.addEventListener("touchend",Y0,{passive:!0})}),N0=U0(()=>{let a=m0(k.current);a.removeEventListener("pointermove",X0),a.removeEventListener("pointerup",Y0),a.removeEventListener("touchmove",X0),a.removeEventListener("touchend",Y0),D.current=null,r.current=null}),F0=N4();return k8.useEffect(()=>{let a=k.current;if(!a)return()=>N0();let e=n0(a,"touchstart",V0,{passive:!0});return()=>{e(),F0.cancel(),N0()}},[N0,V0,k,F0]),k8.useEffect(()=>{if(z)N0()},[z,N0]),z0("div",Z,{state:C,ref:[J,L,k,v],props:[{["data-base-ui-slider-control"]:j?"":void 0,onPointerDown(a){let e=k.current,$0=M1(a.nativeEvent);if(!e||z||a.defaultPrevented||!s0($0)||a.button!==0)return;if(d($0)){p();return}let Q0={x:a.clientX,y:a.clientY};Z0(Q0);let _0=o(Q0);if(_0==null)return;if(k0(I.current[_0.thumbIndex],p1(m0(e))))a.preventDefault();else F0.request(()=>{H0(_0.thumbIndex)});if(_(!0),V.current==null)G0(_0,K0.trackPress,a.nativeEvent);if(a.nativeEvent.pointerId)e.setPointerCapture(a.nativeEvent.pointerId);w.current=0;let L0=m0(e);L0.addEventListener("pointermove",X0,{passive:!0}),L0.addEventListener("pointerup",Y0,{once:!0})}},X],stateAttributesMapping:c4})});var eg=P(m(),1);var $f=eg.forwardRef(function(Z,J){let{render:H,className:Q,style:B,...X}=Z,{state:z}=I8();return z0("div",Z,{state:z,ref:J,props:[{style:{position:"relative"}},X],stateAttributesMapping:c4})});var b8=P(m(),1);var AF="";var Zf=P(VZ(),1);function H70(){return X1}function Q70(){return!1}function B70(){return!0}function lJ(){return Zf.useSyncExternalStore(H70,Q70,B70)}function IB($,Z,J){return($-Z)*100/(J-Z)}var w61=P(m(),1);var VF=P(m(),1),X70=VF.createContext(void 0),z70={disableStyleElements:!1};function Jf(){return VF.useContext(X70)??z70}var Hf=P(c(),1);function DF($){let{script:Z}=$,{nonce:J}=Jf();if(!lJ())return null;return Hf.jsx("script",{nonce:J,dangerouslySetInnerHTML:{__html:Z},suppressHydrationWarning:!0})}var Qf="data-index";var kB=P(c(),1),Bf,U70=new Set([...n8,XV,zV]);function K70($,Z,J,H){if(Z<0)return;if($.length===2)return`${cJ($[Z],H,J)} ${Z===0?"start":"end"} range`;return J?cJ($[Z],H,J):void 0}function Y70($,Z,J,H,Q){let B=$+Z*J,X=Number(B.toFixed(Math.max(dJ($),dJ(Z),dJ(H))));return _2(X,H,Q)}var Xf=b8.forwardRef(function(Z,J){let{render:H,children:Q,className:B,"aria-describedby":X,"aria-label":z,"aria-labelledby":G,"aria-valuetext":U,disabled:K=!1,getAriaLabel:Y,getAriaValueText:F,id:W,index:q,inputRef:N,onBlur:V,onFocus:A,onKeyDown:D,tabIndex:L,style:j,...M}=Z,_=t0(W),{active:E,lastUsedThumbIndex:C,controlRef:R,disabled:T,validation:I,format:y,handleInputChange:S,inset:O,labelId:b,largeStep:k,locale:h,max:v,min:f,minStepsBetweenValues:w,form:i,name:r,orientation:x,pressedThumbCenterOffsetRef:l,pressedThumbIndexRef:s,renderBeforeHydration:p,setActive:d,setIndicatorPosition:o,state:Z0,step:H0,thumbRefs:G0,values:X0}=I8(),Y0=g4(),V0=K||T,N0=X0.length>1,F0=x==="vertical",n=Y0==="rtl",{setTouched:a,setFocused:e,validationMode:$0}=l5(),Q0=b8.useRef(null),_0=b8.useRef(null),M0=b8.useRef(!1),A0=U0((P0)=>{if(M0.current)return;A?.(P0)}),L0=U0((P0)=>{if(M0.current)return;V?.(P0)}),g=t0(),u=E6(),t=N0?g:u,W0=b8.useMemo(()=>({inputId:t}),[t]),{ref:I0,index:c0}=X4({metadata:W0}),f0=!N0?0:q??c0,T0=f0===X0.length-1,x0=X0[f0],J1=IB(x0,f,v),[W1,d0]=b8.useState(),v0=lJ(),E1=C>=0&&C<X0.length?C:-1,B1=U0(()=>{let P0=R.current,l0=Q0.current;if(!P0||!l0)return;let z1=l0.getBoundingClientRect(),O1=P0.getBoundingClientRect(),b0=F0?"height":"width",r0=O1[b0]-z1[b0],G1=(z1[b0]/2+r0*J1/100)/O1[b0]*100,S1=Number.isFinite(G1)?G1:void 0;if(d0(S1),f0===0)o((k1)=>[S1,k1[1]]);else if(T0)o((k1)=>[k1[0],S1])});J0(()=>{if(O)queueMicrotask(B1)},[B1,O]),J0(()=>{if(O)B1()},[B1,O,J1]),J0(()=>{if(!O)return;let P0=R.current,l0=Q0.current;if(!P0||!l0)return;let z1=R1(P0).ResizeObserver;if(typeof z1!=="function")return;let O1=new z1(B1);return O1.observe(P0),O1.observe(l0),()=>{O1.disconnect()}},[R,B1,O]);let s1=F0?"bottom":"insetInlineStart",C0=F0?"left":"top",p0;if(N0){if(E===f0)p0=2;else if(E1===f0)p0=1}else if(E===f0)p0=1;let i0;if(!O&&!Number.isFinite(J1))i0=m8;else i0={position:"absolute",[s1]:O?"var(--position)":`${J1}%`,[C0]:"50%",translate:`${(F0||!n?-1:1)*50}% ${(F0?1:-1)*50}%`,zIndex:p0,...O&&{["--position"]:`${W1??0}%`,visibility:p&&v0||W1===void 0?"hidden":void 0}};let o0;if(F0)o0=n?"vertical-rl":"vertical-lr";let V1=typeof Y==="function"?Y(f0):z,D1=X2({"aria-label":V1,"aria-labelledby":G??(V1==null?b:void 0),"aria-describedby":X,"aria-orientation":x,"aria-valuenow":x0,"aria-valuetext":typeof F==="function"?F(cJ(x0,h,y),x0,f0):U??K70(X0,f0,y,h),disabled:V0,form:i,id:t,max:v,min:f,name:r,onChange(P0){S(P0.currentTarget.valueAsNumber,f0,P0)},onFocus(P0){let l0=M0.current;if(M0.current=!1,d(f0),e(!0),l0)P0.stopPropagation()},onBlur(P0){if(M0.current){P0.stopPropagation();return}if(d(-1),G0.current.some((l0)=>k0(l0,P0.relatedTarget)))return;if(a(!0),e(!1),$0==="onBlur")I.commit(KF(x0,f0,f,v,N0,X0))},onKeyDown(P0){if(P0.defaultPrevented)return;if(!U70.has(P0.key))return;if(n8.has(P0.key))P0.stopPropagation();let l0=null,z1=0,O1=P0.shiftKey?k:H0,b0=NF(x0,H0,f);switch(P0.key){case pZ:z1=1;break;case lZ:z1=n?-1:1;break;case cZ:z1=-1;break;case dZ:z1=n?1:-1;break;case XV:O1=k,z1=1;break;case zV:O1=k,z1=-1;break;case rZ:l0=N0&&Number.isFinite(X0[f0+1])?X0[f0+1]-H0*w:v;break;case iZ:l0=N0&&Number.isFinite(X0[f0-1])?X0[f0-1]+H0*w:f;break;default:break}if(z1!==0)l0=Y70(b0,O1,z1,f,v);if(l0!==null){let r0=P0.currentTarget;if(!D9(r0))M0.current=!0,r0.blur(),r0.focus({preventScroll:!0,focusVisible:!0});S(l0,f0,P0),P0.preventDefault()}},step:H0,style:{...m8,width:"100%",height:"100%",writingMode:o0},tabIndex:L,type:"range",value:x0??""},(P0)=>I.getValidationProps(V0,P0),{onFocus:A0,onBlur:L0,onKeyDown:D}),u1=x2(_0,I.inputRef,N);return z0("div",Z,{state:Z0,ref:[J,I0,Q0],props:[{[Qf]:f0,children:kB.jsxs(b8.Fragment,{children:[Q,kB.jsx("input",{ref:u1,...D1,suppressHydrationWarning:!0}),O&&T0&&p&&(Bf||(Bf=kB.jsx(DF,{script:AF})))]}),id:_,onPointerDown(P0){if(V0)return;s.current=f0;let l0=qF(P0.currentTarget,F0);l.current=(F0?P0.clientY:P0.clientX)-l0},style:i0,suppressHydrationWarning:p||void 0},M],stateAttributesMapping:c4})});var zf=P(m(),1);function F70($,Z,J,H,Q,B){let X={visibility:B||J&&(H===void 0||Z&&Q===void 0)?"hidden":void 0,position:$?"absolute":"relative",[$?"width":"height"]:"inherit"},z=`${H??0}%`,G=`${(Q??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 Gf=zf.forwardRef(function(Z,J){let{render:H,className:Q,style:B,...X}=Z,{indicatorPosition:z,inset:G,max:U,min:K,orientation:Y,renderBeforeHydration:F,state:W,values:q}=I8(),N=lJ(),V=Y==="vertical",A=q.length>1,D=F70(V,A,G,G?z[0]:IB(q[0],K,U),G?z[1]:IB(q[q.length-1],K,U),G&&F&&N);return z0("div",Z,{state:W,ref:J,props:[{["data-base-ui-slider-indicator"]:F?"":void 0,style:D,suppressHydrationWarning:F||void 0},X],stateAttributesMapping:c4})});var b$=P(c(),1);function Uf({animate:$=!1,children:Z,className:J,defaultValue:H,value:Q,min:B=0,max:X=100,...z}){let[G,U]=LF.useState(!1),K=Array.isArray(Q)?Q:Array.isArray(H)?H:[B];return LF.useEffect(()=>{let Y=requestAnimationFrame(()=>U(!0));return()=>cancelAnimationFrame(Y)},[]),b$.jsx(H7.Root,{className:a0("data-horizontal:w-full data-vertical:h-full",J),"data-slot":"slider",defaultValue:H,value:Q,min:B,max:X,thumbAlignment:"edge",...z,children:b$.jsxs(H7.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:[b$.jsx(H7.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:b$.jsx(H7.Indicator,{"data-slot":"slider-range",className:a0("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:K.length},(Y,F)=>b$.jsx(H7.Thumb,{"data-slot":"slider-thumb",className:a0("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")},F))]})})}var _1=P(c(),1);function W70($){return $.charAt(0).toUpperCase()+$.slice(1)}function q70($){return $==="xhigh"?"Extra":W70($)}function Kf($){return typeof $==="number"?$:$[0]??0}var Yf={from:{opacity:0,filter:"blur(4px)"},to:{opacity:1,filter:"blur(0px)"}},Ff={type:"spring",duration:0.3,delay:0.1,bounce:0};function qf({label:$,leadingIcon:Z,className:J,...H}){return _1.jsxs(j0,{...H,variant:"ghost",className:B0("group/picker max-w-56 min-w-0 px-2 text-muted-foreground hover:text-muted-foreground",J),children:[Z,_1.jsx("span",{className:"truncate font-normal",children:$})]})}function N70({current:$,model:Z,models:J,onValueChange:H}){let Q=Z.displayName,B=pv(J,"Models");return _1.jsxs(o9,{children:[_1.jsx(n9,{render:_1.jsx(qf,{label:Q,className:"shrink","aria-label":`Model: ${Q}`})}),_1.jsx(s9,{align:"end",side:"top",className:"w-max max-w-64 min-w-40",children:_1.jsx(ug,{value:$,onValueChange:H,children:B.map((X)=>_1.jsxs(J7,{children:[_1.jsx(GF,{children:X.label}),X.models.map((z)=>_1.jsx(pg,{value:z.value,closeOnClick:!0,children:z.displayName},z.value))]},X.label))})})]})}function Nf({fastMode:$,onChange:Z}){return _1.jsxs(Q5,{children:[_1.jsx(B5,{render:_1.jsx(j0,{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:$?_1.jsx(Wf,{className:"text-primary",stroke:1.75}):_1.jsx(gQ,{className:"text-muted-foreground",stroke:1.75})})}),_1.jsxs(X5,{align:"center",className:"flex-col gap-0",children:[_1.jsx("span",{children:"Fast mode"}),_1.jsx("span",{className:"font-normal text-muted-foreground",children:"More usage"})]})]})}function A70({currentEffort:$,effortLevels:Z,fastMode:J,showFastMode:H,onFastModeChange:Q,onValueChange:B}){let X=gv(Z,$),[z,G]=iJ.useState(!1),[U,K]=iJ.useState(X),[Y,F]=iJ.useState(!1),q=Z[z?U:X]??$,N=q70(q),V=(D)=>{if(D)K(X);else F(!1);G(D)},A=(D)=>{let L=Z[D];if(L&&L!==$)B(L)};return _1.jsxs(q6,{open:z,onOpenChange:V,children:[_1.jsx(N6,{render:_1.jsx(qf,{label:N,leadingIcon:J?_1.jsx(gQ,{stroke:1.5}):void 0,"aria-label":`Effort: ${N}`})}),_1.jsxs(A6,{align:"end",side:"top",className:"w-64",children:[_1.jsx(VS,{className:"relative h-5 flex-row items-center",children:_1.jsx(j4,{mode:"popLayout",initial:!1,children:Y?_1.jsxs(z5.div,{className:"flex h-5 w-full items-center justify-between text-sm text-muted-foreground","aria-hidden":"true",variants:Yf,initial:"from",animate:"to",exit:"from",transition:Ff,children:[_1.jsx("span",{children:"Faster"}),_1.jsx("span",{children:"Smarter"})]},"range"):_1.jsxs(z5.div,{className:"flex h-5 w-full items-center justify-between gap-2",variants:Yf,initial:"from",animate:"to",exit:"from",transition:Ff,children:[_1.jsxs("div",{className:"flex items-center gap-1",children:[_1.jsx("span",{className:"text-muted-foreground",children:"Effort"}),_1.jsx("output",{"aria-live":"polite",children:N})]}),H&&_1.jsx(Nf,{fastMode:J,onChange:Q})]},"effort")})}),_1.jsxs("label",{className:"block",children:[_1.jsx("span",{className:"sr-only",children:"Reasoning effort"}),_1.jsx(Uf,{value:[U],min:0,max:Z.length-1,step:1,onPointerDown:(D)=>{if(D.button===0)F(!0)},onPointerCancel:()=>F(!1),onValueChange:(D)=>K(Kf(D)),onValueCommitted:(D)=>{F(!1),A(Kf(D))},className:B0("**: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:_1.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},(D,L)=>_1.jsx("span",{className:B0("size-1 rounded-full",L<=U?"bg-primary-foreground/30":"bg-foreground/30")},L))})})]})]})]})}var Af=iJ.memo(function({sessionId:Z}){let{workspaceId:J,layout:H,setLayout:Q}=i1(),{data:B}=i9(J),X=B?.models??[],z=X.find((_)=>_.value==="default"),G=B?uv(X.filter((_)=>_.value!=="default"),B.provider):[],U=yY(J,Z).data,K=hv(J),Y=(Z?U?.model:void 0)??H.selectedModel,F=(Z?U?.effort:void 0)??H.selectedEffort,W=(Z?U?.fastMode:void 0)??H.selectedFastMode,q=(_)=>{if(Z)K.mutate({sessionId:Z,patch:{model:_}});else Q({selectedModel:_})},N=(_)=>{if(Z)K.mutate({sessionId:Z,patch:{effort:_}});else Q({selectedEffort:_})},V=(_)=>{if(Z)K.mutate({sessionId:Z,patch:{fastMode:_}});else Q({selectedFastMode:_})},A=xY(G,Y,z?.resolvedModel);if(!A)return null;let D=A.supportsEffort?A.supportedEffortLevels??[]:[],L=jL(D,F,A.defaultEffort),j=fv(D)&&L!==void 0,M=mv(A,W);return _1.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[_1.jsx(N70,{current:A.value,model:A,models:G,onValueChange:q}),!j&&A.supportsFastMode&&_1.jsx(Nf,{fastMode:M,onChange:V}),j&&_1.jsx(A70,{currentEffort:L,effortLevels:D,fastMode:M,showFastMode:A.supportsFastMode===!0,onFastModeChange:V,onValueChange:N},A.value)]})});var M5=P(c(),1);function Lf({composerRef:$,onSend:Z,onStop:J,processing:H,sessionId:Q,modelSessionId:B,availability:X,annotation:z,onRemoveDrawing:G,allowFiles:U=!0,placeholder:K,draft:Y}){let F=bB.useRef(null),W=e1(),q=w5((O)=>O.composerDrafts[W]??""),N=w5((O)=>Y?(O.viewBuilderDrafts??{})[Y.id]:void 0),V=Y?N??Y.initialValue:q,A=K5(V),D=g2((O)=>O.attachments[a8(W,Q)]??V70),[L,j]=bB.useState(!1),M=D.some((O)=>O.kind!=="text"&&O.status==="uploading"),_=D.some((O)=>O.kind==="text"||O.status==="ready"||O.status==="draft"),E=V.trim().length>0||_,C=CB(E,M,X),R=(O)=>{if(A.current=O,Y)Y.onChange(O);else w5.getState().setComposerDraft(W,O)},T=(O)=>{if(U)mh({workspaceId:W,sessionId:Q},O)},I=bB.useRef(!1),y=(O)=>{if(O.kind==="drawing"&&G){G(O.localId);return}b1.getState().removeAttachment(W,O.localId)},S=async()=>{if(!C||I.current)return;I.current=!0;try{if(await z?.finish(),await Z(A.current),!Y)A.current="",w5.getState().setComposerDraft(W,"")}finally{I.current=!1}};return M5.jsxs(lh,{composerRef:$,onSubmit:(O)=>{O.preventDefault(),S()},onDragOver:(O)=>{if(!O.dataTransfer.types.includes("Files"))return;if(O.preventDefault(),U)j(!0)},onDragLeave:(O)=>{if(!U)return;if(O.currentTarget.contains(O.relatedTarget))return;j(!1)},onDrop:(O)=>{if(!O.dataTransfer.types.includes("Files"))return;O.preventDefault(),j(!1),T(Array.from(O.dataTransfer.files))},className:B0(L&&"ring-2 ring-ring/60"),children:[D.length>0&&M5.jsx("div",{className:"flex flex-wrap gap-2 px-1 pt-1 pb-1",children:D.toSorted((O,b)=>Vf[O.kind]-Vf[b.kind]).map((O)=>O.kind==="text"?M5.jsx(wB,{label:O.label,onRemove:()=>y(O)},O.localId):O.kind==="drawing"?M5.jsx(Iv,{attachment:O,onRemove:()=>y(O)},O.localId):M5.jsx(kv,{attachment:O,onRemove:()=>y(O)},O.localId))}),M5.jsx(ih,{textareaRef:$,id:"chat-input",name:"message",value:V,onChange:(O)=>R(O.target.value),onKeyDown:(O)=>{if(O.key==="Enter"&&!O.shiftKey)O.preventDefault(),S()},onPaste:(O)=>{let b=Array.from(O.clipboardData?.files??[]);if(b.length===0)return;O.preventDefault(),T(b)},placeholder:H?"Queue a follow-up":K??"Do anything",rows:1}),M5.jsxs(rh,{children:[U&&M5.jsx("input",{ref:F,type:"file",multiple:!0,hidden:!0,onChange:(O)=>{T(Array.from(O.target.files??[])),O.target.value=""}}),M5.jsxs("div",{className:"mr-auto flex shrink-0 items-center gap-0.5",children:[U&&M5.jsxs(Q5,{children:[M5.jsx(B5,{render:M5.jsx(j0,{type:"button",variant:"ghost",size:"icon",onClick:()=>F.current?.click(),"aria-label":"Attach files",children:M5.jsx(nU,{stroke:1.6,className:"size-4.5!"})})}),M5.jsx(X5,{children:"Attach files"})]}),z&&M5.jsxs(Q5,{children:[M5.jsx(B5,{render:M5.jsx(j0,{type:"button",variant:"ghost",size:"icon",onClick:z.onToggle,className:B0(z.active&&"bg-accent"),"aria-label":"Draw annotation","aria-pressed":z.active,children:M5.jsx(vJ,{stroke:1.5})})}),M5.jsx(X5,{children:"Draw annotation"})]})]}),M5.jsx(Af,{sessionId:B}),H?M5.jsxs(Q5,{children:[M5.jsx(B5,{render:M5.jsx(j0,{type:"button",size:"icon",onClick:J,"aria-label":"Stop agent",children:M5.jsx(Df,{})})}),M5.jsx(X5,{children:"Stop answering"})]}):M5.jsx(ah,{label:"Send message",hasContent:E,busy:M,availability:X})]})]})}var V70=[],Vf={file:0,drawing:1,text:2};var y$=P(c(),1);function pL({className:$,prompt:Z,disabled:J=!1,onSelect:H}){let Q=Z.icon;return y$.jsxs(j0,{type:"button",size:"sm",disabled:J,onClick:()=>H(Z),className:B0("h-auto items-start justify-start gap-2 rounded-lg p-2 px-3 text-left leading-snug whitespace-normal",$),children:[y$.jsx(Q,{stroke:2,"aria-hidden":!0,className:"mt-0.5"}),y$.jsx("span",{children:Z.label})]})}function Mf({prompts:$,disabled:Z=!1,onSelect:J}){return y$.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,Q)=>{return y$.jsx(pL,{prompt:H,disabled:Z,onSelect:J,className:B0("h-full w-fit @md:w-full",Q===0&&"@md:translate-y-3 @md:rotate-3 @md:hover:translate-y-2.5",Q===1&&"@md:-rotate-1",Q===2&&"@md:translate-y-3 @md:-rotate-4 @md:hover:translate-y-2.5")},H.prompt)})})}var G5=P(c(),1),cL="Keep the final reply brief and user-facing. Do not include file or storage links, file paths, or bundle, test, and runtime-log summaries.",D70=[{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.",cL],icon:Pf},{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.",cL],icon:_f},{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.",cL],icon:sU}],L70={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:PF};function jf({isViewBuilderDraft:$,hasSentMessageFromMoi:Z,isWorkspacePendingAnalysis:J}){if($)return"view-builder";if(!Z)return"welcome";if(J)return"explore-workspace";return"empty"}function Of({agent:$,kind:Z,hasWorkspaceApplets:J,disabled:H=!1,onSelectPrompt:Q,onNavigate:B}){switch(Z){case"view-builder":return G5.jsx(M70,{agent:$});case"welcome":return G5.jsx(P70,{agent:$,disabled:H,showExamples:!J,onSelectPrompt:Q,onNavigate:B});case"explore-workspace":return G5.jsx(_70,{agent:$,disabled:H,onSelectPrompt:Q});case"empty":return G5.jsx(j70,{agent:$})}}function jF({agent:$,children:Z,className:J}){return G5.jsxs("div",{className:B0("flex flex-1 flex-col items-center justify-center self-center",J),children:[G5.jsx(l9,{preset:$,color:"secondary",expression:"idle",className:"mb-2",animated:!0}),Z]})}function M70({agent:$}){return G5.jsx(jF,{agent:$,className:"text-center text-muted-foreground",children:G5.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 P70({agent:$,disabled:Z=!1,showExamples:J=!0,onSelectPrompt:H,onNavigate:Q}){return G5.jsx(jF,{agent:$,className:"@container w-full max-w-md min-w-0",children:G5.jsxs("div",{className:"mt-2 flex flex-col gap-4",children:[G5.jsxs("div",{className:"prose prose-sm min-w-0 wrap-anywhere prose-inherit",children:[G5.jsx("p",{children:"moi is the personal workspace built for you by your agent. It grows and adapts to your needs."}),G5.jsxs("p",{children:["Ask the"," ",G5.jsx(MF,{Icon:yB,destination:"agent",onNavigate:Q,children:"Agent"})," ","to build widgets on the"," ",G5.jsx(MF,{Icon:_F,destination:"overview",onNavigate:Q,children:"Overview"})," ","page, or more complex tools as separate"," ",G5.jsx(MF,{Icon:rJ,destination:"views",onNavigate:Q,children:"Views"}),". Use"," ",G5.jsx(MF,{Icon:xB,destination:"scratchpad",onNavigate:Q,children:"Scratchpad"})," ","for exploring and shaping ideas with your agent."]}),J&&G5.jsx("p",{children:"Try an example:"})]}),J&&G5.jsx(Mf,{prompts:D70,disabled:Z,onSelect:H})]})})}function _70({agent:$,disabled:Z=!1,onSelectPrompt:J}){return G5.jsx(jF,{agent:$,children:G5.jsxs("div",{className:"flex flex-col items-center gap-4",children:[G5.jsx("div",{className:"prose prose-sm max-w-xs min-w-0 text-center wrap-anywhere prose-inherit",children:G5.jsx("p",{children:"Your agent can explore this workspace and suggest useful widgets and views based on what’s already here"})}),G5.jsx(pL,{prompt:L70,disabled:Z,onSelect:J})]})})}function j70({agent:$}){return G5.jsx(jF,{agent:$,className:"text-center text-muted-foreground",children:G5.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 MF({Icon:$,children:Z,destination:J,onNavigate:H}){return G5.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:[G5.jsx($,{size:16,stroke:1.75,"aria-hidden":!0}),Z]})}var hB=P(m(),1);var g1=P(c(),1);function wf({label:$}){return g1.jsx("div",{className:"flex h-7 items-center px-2.5 text-sm font-medium",children:$})}function O70($){if($.flavor==="cron"||$.flavor==="subagent")return $.flavor;let Z=$.origin?.provider.trim().toLowerCase();return Z?Z:null}function T70({active:$,canArchive:Z,confirmingArchive:J,onArchive:H,onRequestArchive:Q,onSelect:B,session:X,workspaceId:z}){let G=hB.useRef(!1),[U,K]=hB.useState(!1),Y=g2((N)=>WQ(N.activity,z,X.sessionId)),F=O70(X);function W(){Q(X.sessionId)}async function q(){if(G.current)return;G.current=!0,K(!0);try{await H(X.sessionId)}catch{A5.add({title:"Couldn’t archive chat",type:"error"})}finally{G.current=!1,K(!1)}}return g1.jsxs("div",{className:"group/chat relative",children:[g1.jsx(H9,{className:B0("font-medium group-hover/chat:bg-accent group-hover/chat:text-accent-foreground",$&&"bg-accent text-accent-foreground"),onClick:()=>B(X.sessionId),children:g1.jsx("div",{className:B0("flex min-w-0 flex-1 overflow-hidden",(Y||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:g1.jsxs("span",{className:B0("flex min-w-0 items-baseline gap-1.5",(Y||U)&&"-mr-4",J?"-mr-14":Z&&"group-focus-within/chat:-mr-4 group-hover/chat:-mr-4 [@media(hover:none)]:-mr-4"),children:[g1.jsx("span",{className:"min-w-0 truncate",children:X.summary}),F&&g1.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:F})]})})}),Y&&g1.jsx(J8,{className:B0("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&&g1.jsx("div",{className:B0("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?g1.jsx(j0,{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:q,onPointerDown:(N)=>N.stopPropagation(),children:"Confirm"}):g1.jsxs(Q5,{children:[g1.jsx(B5,{render:g1.jsx(j0,{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:(N)=>N.stopPropagation(),children:g1.jsx(Cf,{stroke:1.75})})}),g1.jsx(X5,{side:"right",children:"Archive chat"})]})})]})}function C70($){return`${$.getFullYear()}-${$.getMonth()}-${$.getDate()}`}function Tf($){return Date.UTC($.getFullYear(),$.getMonth(),$.getDate())/86400000}function w70($,Z){let J=Tf(Z)-Tf($);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 E70($,Z=new Date){let J=new Map;for(let H of $.slice().sort((Q,B)=>B.lastModified-Q.lastModified)){let Q=new Date(H.lastModified),B=C70(Q),X=J.get(B);if(X){X.sessions.push(H);continue}J.set(B,{key:B,label:w70(Q,Z),sessions:[H]})}return[...J.values()]}function Ef({isViewBuilder:$=!1}){if($)return g1.jsx(wf,{label:"Build a new view"});return g1.jsx(S70,{})}function S70(){let $=e1(),[Z,J]=j6(),H=Z??null,[Q,B]=hB.useState(null),{data:X=[]}=bY($),z=i9($).data?.supportsArchiving===!0,G=yv($),U=g2((N)=>FE(N.activity,$,H));if(X.length===0)return g1.jsx(wf,{label:"New chat"});let Y=X.find((N)=>N.sessionId===H)?.summary??"New chat",F=E70(X);function W(N){if(!N)B(null)}async function q(N){B(null),await G.mutateAsync(N);let V=b1.getState();if(V.clearAttachments($,N),V.clearPreviewsForSession($,N),H===N)J(null)}return g1.jsxs(o9,{onOpenChange:W,children:[g1.jsx(n9,{render:g1.jsxs(j0,{className:"group max-w-full min-w-0 shrink",variant:"ghost",size:"sm",children:[g1.jsx("span",{className:"max-w-64 min-w-0 truncate",children:Y}),U?g1.jsx(J8,{className:"size-4!",stroke:2}):g1.jsx(ZJ,{className:"text-muted-foreground group-hover:text-foreground",stroke:1.75})]})}),g1.jsxs(s9,{align:"start",className:"flex max-h-100 w-max max-w-72 min-w-40 flex-col overflow-hidden",children:[g1.jsxs(H9,{className:"shrink-0 gap-1 font-medium text-muted-foreground! **:text-muted-foreground!",onClick:()=>J(null),children:[g1.jsx(OF,{size:16,stroke:1.75}),"New chat"]}),F.length>0&&g1.jsxs(g1.Fragment,{children:[g1.jsx(cg,{className:"shrink-0"}),g1.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:F.map((N)=>g1.jsxs(J7,{children:[g1.jsx(GF,{children:N.label}),N.sessions.map((V)=>g1.jsx(T70,{session:V,active:H===V.sessionId,canArchive:z,confirmingArchive:Q===V.sessionId,onSelect:J,onArchive:q,onRequestArchive:B,workspaceId:$},V.sessionId))]},N.key))})]})]})]})}var ol=P(m(),1);function n1(){}function TF(){}function Sf($,Z){let J=Z||{};return($[$.length-1]===""?[...$,""]:$).join((J.padRight?" ":"")+","+(J.padLeft===!1?"":" ")).trim()}var R70=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,I70=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,k70={};function CF($,Z){return((Z||k70).jsx?I70:R70).test($)}var b70=/[ \t\n\f\r]/g;function dL($){return typeof $==="object"?$.type==="text"?Rf($.value):!1:Rf($)}function Rf($){return $.replace(b70,"")===""}class Q7{constructor($,Z,J){if(this.normal=Z,this.property=$,J)this.space=J}}Q7.prototype.normal={};Q7.prototype.property={};Q7.prototype.space=void 0;function lL($,Z){let J={},H={};for(let Q of $)Object.assign(J,Q.property),Object.assign(H,Q.normal);return new Q7(J,H,Z)}function vB($){return $.toLowerCase()}class u2{constructor($,Z){this.attribute=Z,this.property=$}}u2.prototype.attribute="";u2.prototype.booleanish=!1;u2.prototype.boolean=!1;u2.prototype.commaOrSpaceSeparated=!1;u2.prototype.commaSeparated=!1;u2.prototype.defined=!1;u2.prototype.mustUseProperty=!1;u2.prototype.number=!1;u2.prototype.overloadedBoolean=!1;u2.prototype.property="";u2.prototype.spaceSeparated=!1;u2.prototype.space=void 0;var gB={};C5(gB,{spaceSeparated:()=>Y5,overloadedBoolean:()=>wF,number:()=>E0,commaSeparated:()=>B7,commaOrSpaceSeparated:()=>d4,booleanish:()=>r5,boolean:()=>T1});var y70=0,T1=x$(),r5=x$(),wF=x$(),E0=x$(),Y5=x$(),B7=x$(),d4=x$();function x$(){return 2**++y70}var iL=Object.keys(gB);class aJ extends u2{constructor($,Z,J,H){let Q=-1;super($,Z);if(If(this,"space",H),typeof J==="number")while(++Q<iL.length){let B=iL[Q];If(this,iL[Q],(J&gB[B])===gB[B])}}}aJ.prototype.defined=!0;function If($,Z,J){if(J)$[Z]=J}function y8($){let Z={},J={};for(let[H,Q]of Object.entries($.properties)){let B=new aJ(H,$.transform($.attributes||{},H),Q,$.space);if($.mustUseProperty&&$.mustUseProperty.includes(H))B.mustUseProperty=!0;Z[H]=B,J[vB(H)]=H,J[vB(B.attribute)]=H}return new Q7(Z,J,$.space)}var rL=y8({properties:{ariaActiveDescendant:null,ariaAtomic:r5,ariaAutoComplete:null,ariaBusy:r5,ariaChecked:r5,ariaColCount:E0,ariaColIndex:E0,ariaColSpan:E0,ariaControls:Y5,ariaCurrent:null,ariaDescribedBy:Y5,ariaDetails:null,ariaDisabled:r5,ariaDropEffect:Y5,ariaErrorMessage:null,ariaExpanded:r5,ariaFlowTo:Y5,ariaGrabbed:r5,ariaHasPopup:null,ariaHidden:r5,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Y5,ariaLevel:E0,ariaLive:null,ariaModal:r5,ariaMultiLine:r5,ariaMultiSelectable:r5,ariaOrientation:null,ariaOwns:Y5,ariaPlaceholder:null,ariaPosInSet:E0,ariaPressed:r5,ariaReadOnly:r5,ariaRelevant:null,ariaRequired:r5,ariaRoleDescription:Y5,ariaRowCount:E0,ariaRowIndex:E0,ariaRowSpan:E0,ariaSelected:r5,ariaSetSize:E0,ariaSort:null,ariaValueMax:E0,ariaValueMin:E0,ariaValueNow:E0,ariaValueText:null,role:null},transform($,Z){return Z==="role"?Z:"aria-"+Z.slice(4).toLowerCase()}});function EF($,Z){return Z in $?$[Z]:Z}function SF($,Z){return EF($,Z.toLowerCase())}var kf=y8({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:B7,acceptCharset:Y5,accessKey:Y5,action:null,allow:null,allowFullScreen:T1,allowPaymentRequest:T1,allowUserMedia:T1,alt:null,as:null,async:T1,autoCapitalize:null,autoComplete:Y5,autoFocus:T1,autoPlay:T1,blocking:Y5,capture:null,charSet:null,checked:T1,cite:null,className:Y5,cols:E0,colSpan:null,content:null,contentEditable:r5,controls:T1,controlsList:Y5,coords:E0|B7,crossOrigin:null,data:null,dateTime:null,decoding:null,default:T1,defer:T1,dir:null,dirName:null,disabled:T1,download:wF,draggable:r5,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:T1,formTarget:null,headers:Y5,height:E0,hidden:wF,high:E0,href:null,hrefLang:null,htmlFor:Y5,httpEquiv:Y5,id:null,imageSizes:null,imageSrcSet:null,inert:T1,inputMode:null,integrity:null,is:null,isMap:T1,itemId:null,itemProp:Y5,itemRef:Y5,itemScope:T1,itemType:Y5,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:T1,low:E0,manifest:null,max:null,maxLength:E0,media:null,method:null,min:null,minLength:E0,multiple:T1,muted:T1,name:null,nonce:null,noModule:T1,noValidate:T1,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:T1,optimum:E0,pattern:null,ping:Y5,placeholder:null,playsInline:T1,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:T1,referrerPolicy:null,rel:Y5,required:T1,reversed:T1,rows:E0,rowSpan:E0,sandbox:Y5,scope:null,scoped:T1,seamless:T1,selected:T1,shadowRootClonable:T1,shadowRootDelegatesFocus:T1,shadowRootMode:null,shape:null,size:E0,sizes:null,slot:null,span:E0,spellCheck:r5,src:null,srcDoc:null,srcLang:null,srcSet:null,start:E0,step:null,style:null,tabIndex:E0,target:null,title:null,translate:null,type:null,typeMustMatch:T1,useMap:null,value:r5,width:E0,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Y5,axis:null,background:null,bgColor:null,border:E0,borderColor:null,bottomMargin:E0,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:T1,declare:T1,event:null,face:null,frame:null,frameBorder:null,hSpace:E0,leftMargin:E0,link:null,longDesc:null,lowSrc:null,marginHeight:E0,marginWidth:E0,noResize:T1,noHref:T1,noShade:T1,noWrap:T1,object:null,profile:null,prompt:null,rev:null,rightMargin:E0,rules:null,scheme:null,scrolling:r5,standby:null,summary:null,text:null,topMargin:E0,valueType:null,version:null,vAlign:null,vLink:null,vSpace:E0,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:T1,disableRemotePlayback:T1,prefix:null,property:null,results:E0,security:null,unselectable:null},space:"html",transform:SF});var bf=y8({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:d4,accentHeight:E0,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:E0,amplitude:E0,arabicForm:null,ascent:E0,attributeName:null,attributeType:null,azimuth:E0,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:E0,by:null,calcMode:null,capHeight:E0,className:Y5,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:E0,diffuseConstant:E0,direction:null,display:null,dur:null,divisor:E0,dominantBaseline:null,download:T1,dx:null,dy:null,edgeMode:null,editable:null,elevation:E0,enableBackground:null,end:null,event:null,exponent:E0,externalResourcesRequired:null,fill:null,fillOpacity:E0,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:B7,g2:B7,glyphName:B7,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:E0,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:E0,horizOriginX:E0,horizOriginY:E0,id:null,ideographic:E0,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:E0,k:E0,k1:E0,k2:E0,k3:E0,k4:E0,kernelMatrix:d4,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:E0,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:E0,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:E0,overlineThickness:E0,paintOrder:null,panose1:null,path:null,pathLength:E0,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Y5,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:E0,pointsAtY:E0,pointsAtZ:E0,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:d4,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:d4,rev:d4,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:d4,requiredFeatures:d4,requiredFonts:d4,requiredFormats:d4,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:E0,specularExponent:E0,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:E0,strikethroughThickness:E0,string:null,stroke:null,strokeDashArray:d4,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:E0,strokeOpacity:E0,strokeWidth:null,style:null,surfaceScale:E0,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:d4,tabIndex:E0,tableValues:null,target:null,targetX:E0,targetY:E0,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:d4,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:E0,underlineThickness:E0,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:E0,values:null,vAlphabetic:E0,vMathematical:E0,vectorEffect:null,vHanging:E0,vIdeographic:E0,version:null,vertAdvY:E0,vertOriginX:E0,vertOriginY:E0,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:E0,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:EF});var aL=y8({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 oL=y8({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:SF});var nL=y8({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform($,Z){return"xml:"+Z.slice(3).toLowerCase()}});var sL={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 x70=/[A-Z]/g,yf=/-[a-z]/g,h70=/^data[-\w.:]+$/i;function tL($,Z){let J=vB(Z),H=Z,Q=u2;if(J in $.normal)return $.property[$.normal[J]];if(J.length>4&&J.slice(0,4)==="data"&&h70.test(Z)){if(Z.charAt(4)==="-"){let B=Z.slice(5).replace(yf,g70);H="data"+B.charAt(0).toUpperCase()+B.slice(1)}else{let B=Z.slice(4);if(!yf.test(B)){let X=B.replace(x70,v70);if(X.charAt(0)!=="-")X="-"+X;Z="data"+X}}Q=aJ}return new Q(H,Z)}function v70($){return"-"+$.toLowerCase()}function g70($){return $.charAt(1).toUpperCase()}var xf=lL([rL,kf,aL,oL,nL],"html"),RF=lL([rL,bf,aL,oL,nL],"svg");function hf($){return $.join(" ").trim()}var $m=P(nf(),1);var IF=sf("end"),oJ=sf("start");function sf($){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 ZM($){let Z=oJ($),J=IF($);if(Z&&J)return{start:Z,end:J}}function X7($){if(!$||typeof $!=="object")return"";if("position"in $||"type"in $)return tf($.position);if("start"in $||"end"in $)return tf($);if("line"in $||"column"in $)return JM($);return""}function JM($){return ef($&&$.line)+":"+ef($&&$.column)}function tf($){return JM($&&$.start)+"-"+JM($&&$.end)}function ef($){return $&&typeof $==="number"?$:1}class K2 extends Error{constructor($,Z,J){super();if(typeof Z==="string")J=Z,Z=void 0;let H="",Q={},B=!1;if(Z)if("line"in Z&&"column"in Z)Q={place:Z};else if("start"in Z&&"end"in Z)Q={place:Z};else if("type"in Z)Q={ancestors:[Z],place:Z.position};else Q={...Z};if(typeof $==="string")H=$;else if(!Q.cause&&$)B=!0,H=$.message,Q.cause=$;if(!Q.ruleId&&!Q.source&&typeof J==="string"){let z=J.indexOf(":");if(z===-1)Q.ruleId=J;else Q.source=J.slice(0,z),Q.ruleId=J.slice(z+1)}if(!Q.place&&Q.ancestors&&Q.ancestors){let z=Q.ancestors[Q.ancestors.length-1];if(z)Q.place=z.position}let X=Q.place&&"start"in Q.place?Q.place.start:Q.place;this.ancestors=Q.ancestors||void 0,this.cause=Q.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=X7(Q.place)||"1:1",this.place=Q.place||void 0,this.reason=this.message,this.ruleId=Q.ruleId||void 0,this.source=Q.source||void 0,this.stack=B&&Q.cause&&typeof Q.cause.stack==="string"?Q.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}K2.prototype.file="";K2.prototype.name="";K2.prototype.reason="";K2.prototype.message="";K2.prototype.stack="";K2.prototype.column=void 0;K2.prototype.line=void 0;K2.prototype.ancestors=void 0;K2.prototype.cause=void 0;K2.prototype.fatal=void 0;K2.prototype.place=void 0;K2.prototype.ruleId=void 0;K2.prototype.source=void 0;var HM={}.hasOwnProperty,K$0=new Map,Y$0=/[A-Z]/g,F$0=new Set(["table","tbody","thead","tfoot","tr"]),W$0=new Set(["td","th"]),Zm="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function QM($,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=P$0(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=M$0(J,Z.jsx,Z.jsxs)}let Q={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"?RF:xf,stylePropertyNameCase:Z.stylePropertyNameCase||"dom",tableCellAlignToStyle:Z.tableCellAlignToStyle!==!1},B=Jm(Q,$,void 0);if(B&&typeof B!=="string")return B;return Q.create($,Q.Fragment,{children:B||void 0},void 0)}function Jm($,Z,J){if(Z.type==="element")return q$0($,Z,J);if(Z.type==="mdxFlowExpression"||Z.type==="mdxTextExpression")return N$0($,Z);if(Z.type==="mdxJsxFlowElement"||Z.type==="mdxJsxTextElement")return V$0($,Z,J);if(Z.type==="mdxjsEsm")return A$0($,Z);if(Z.type==="root")return D$0($,Z,J);if(Z.type==="text")return L$0($,Z)}function q$0($,Z,J){let H=$.schema,Q=H;if(Z.tagName.toLowerCase()==="svg"&&H.space==="html")Q=RF,$.schema=Q;$.ancestors.push(Z);let B=Qm($,Z.tagName,!1),X=_$0($,Z),z=XM($,Z);if(F$0.has(Z.tagName))z=z.filter(function(G){return typeof G==="string"?!dL(G):!0});return Hm($,X,B,Z),BM(X,z),$.ancestors.pop(),$.schema=H,$.create(Z,B,X,J)}function N$0($,Z){if(Z.data&&Z.data.estree&&$.evaluater){let H=Z.data.estree.body[0];return n1(H.type==="ExpressionStatement"),$.evaluater.evaluateExpression(H.expression)}mB($,Z.position)}function A$0($,Z){if(Z.data&&Z.data.estree&&$.evaluater)return $.evaluater.evaluateProgram(Z.data.estree);mB($,Z.position)}function V$0($,Z,J){let H=$.schema,Q=H;if(Z.name==="svg"&&H.space==="html")Q=RF,$.schema=Q;$.ancestors.push(Z);let B=Z.name===null?$.Fragment:Qm($,Z.name,!0),X=j$0($,Z),z=XM($,Z);return Hm($,X,B,Z),BM(X,z),$.ancestors.pop(),$.schema=H,$.create(Z,B,X,J)}function D$0($,Z,J){let H={};return BM(H,XM($,Z)),$.create(Z,$.Fragment,H,J)}function L$0($,Z){return Z.value}function Hm($,Z,J,H){if(typeof J!=="string"&&J!==$.Fragment&&$.passNode)Z.node=H}function BM($,Z){if(Z.length>0){let J=Z.length>1?Z:Z[0];if(J)$.children=J}}function M$0($,Z,J){return H;function H(Q,B,X,z){let U=Array.isArray(X.children)?J:Z;return z?U(B,X,z):U(B,X)}}function P$0($,Z){return J;function J(H,Q,B,X){let z=Array.isArray(B.children),G=oJ(H);return Z(Q,B,X,z,{columnNumber:G?G.column-1:void 0,fileName:$,lineNumber:G?G.line:void 0},void 0)}}function _$0($,Z){let J={},H,Q;for(Q in Z.properties)if(Q!=="children"&&HM.call(Z.properties,Q)){let B=O$0($,Q,Z.properties[Q]);if(B){let[X,z]=B;if($.tableCellAlignToStyle&&X==="align"&&typeof z==="string"&&W$0.has(Z.tagName))H=z;else J[X]=z}}if(H){let B=J.style||(J.style={});B[$.stylePropertyNameCase==="css"?"text-align":"textAlign"]=H}return J}function j$0($,Z){let J={};for(let H of Z.attributes)if(H.type==="mdxJsxExpressionAttribute")if(H.data&&H.data.estree&&$.evaluater){let B=H.data.estree.body[0];n1(B.type==="ExpressionStatement");let X=B.expression;n1(X.type==="ObjectExpression");let z=X.properties[0];n1(z.type==="SpreadElement"),Object.assign(J,$.evaluater.evaluateExpression(z.argument))}else mB($,Z.position);else{let Q=H.name,B;if(H.value&&typeof H.value==="object")if(H.value.data&&H.value.data.estree&&$.evaluater){let z=H.value.data.estree.body[0];n1(z.type==="ExpressionStatement"),B=$.evaluater.evaluateExpression(z.expression)}else mB($,Z.position);else B=H.value===null?!0:H.value;J[Q]=B}return J}function XM($,Z){let J=[],H=-1,Q=$.passKeys?new Map:K$0;while(++H<Z.children.length){let B=Z.children[H],X;if($.passKeys){let G=B.type==="element"?B.tagName:B.type==="mdxJsxFlowElement"||B.type==="mdxJsxTextElement"?B.name:void 0;if(G){let U=Q.get(G)||0;X=G+"-"+U,Q.set(G,U+1)}}let z=Jm($,B,X);if(z!==void 0)J.push(z)}return J}function O$0($,Z,J){let H=tL($.schema,Z);if(J===null||J===void 0||typeof J==="number"&&Number.isNaN(J))return;if(Array.isArray(J))J=H.commaSeparated?Sf(J):hf(J);if(H.property==="style"){let Q=typeof J==="object"?J:T$0($,String(J));if($.stylePropertyNameCase==="css")Q=C$0(Q);return["style",Q]}return[$.elementAttributeNameCase==="react"&&H.space?sL[H.property]||H.property:H.attribute,J]}function T$0($,Z){try{return $m.default(Z,{reactCompat:!0})}catch(J){if($.ignoreInvalidStyle)return{};let H=J,Q=new K2("Cannot parse `style` attribute",{ancestors:$.ancestors,cause:H,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw Q.file=$.filePath||void 0,Q.url=Zm+"#cannot-parse-style-attribute",Q}}function Qm($,Z,J){let H;if(!J)H={type:"Literal",value:Z};else if(Z.includes(".")){let Q=Z.split("."),B=-1,X;while(++B<Q.length){let z=CF(Q[B])?{type:"Identifier",name:Q[B]}:{type:"Literal",value:Q[B]};X=X?{type:"MemberExpression",object:X,property:z,computed:Boolean(B&&z.type==="Literal"),optional:!1}:z}n1(X,"always a result"),H=X}else H=CF(Z)&&!/^[a-z]/.test(Z)?{type:"Identifier",name:Z}:{type:"Literal",value:Z};if(H.type==="Literal"){let Q=H.value;return HM.call($.components,Q)?$.components[Q]:Q}if($.evaluater)return $.evaluater.evaluateExpression(H);mB($)}function mB($,Z){let J=new K2("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=Zm+"#cannot-handle-mdx-estrees-without-createevaluater",J}function C$0($){let Z={},J;for(J in $)if(HM.call($,J))Z[w$0(J)]=$[J];return Z}function w$0($){let Z=$.replace(Y$0,E$0);if(Z.slice(0,3)==="ms-")Z="-"+Z;return Z}function E$0($){return"-"+$.toLowerCase()}var uB={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 HH=P(c(),1),wu=P(m(),1);var S$0={};function v$($,Z){let J=Z||S$0,H=typeof J.includeImageAlt==="boolean"?J.includeImageAlt:!0,Q=typeof J.includeHtml==="boolean"?J.includeHtml:!0;return Xm($,H,Q)}function Xm($,Z,J){if(R$0($)){if("value"in $)return $.type==="html"&&!J?"":$.value;if(Z&&"alt"in $&&$.alt)return $.alt;if("children"in $)return Bm($.children,Z,J)}if(Array.isArray($))return Bm($,Z,J);return""}function Bm($,Z,J){let H=[],Q=-1;while(++Q<$.length)H[Q]=Xm($[Q],Z,J);return H.join("")}function R$0($){return Boolean($&&typeof $==="object")}var zm=document.createElement("i");function nJ($){let Z="&"+$+";";zm.innerHTML=Z;let J=zm.textContent;if(J.charCodeAt(J.length-1)===59&&$!=="semi")return!1;return J===Z?!1:J}function Z2($,Z,J,H){let Q=$.length,B=0,X;if(Z<0)Z=-Z>Q?0:Q+Z;else Z=Z>Q?Q: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(B<H.length)X=H.slice(B,B+1e4),X.unshift(Z,0),$.splice(...X),B+=1e4,Z+=1e4}}function T4($,Z){if($.length>0)return Z2($,$.length,0,Z),$;return Z}var Gm={}.hasOwnProperty;function kF($){let Z={},J=-1;while(++J<$.length)I$0(Z,$[J]);return Z}function I$0($,Z){let J;for(J in Z){let Q=(Gm.call($,J)?$[J]:void 0)||($[J]={}),B=Z[J],X;if(B)for(X in B){if(!Gm.call(Q,X))Q[X]=[];let z=B[X];k$0(Q[X],Array.isArray(z)?z:z?[z]:[])}}}function k$0($,Z){let J=-1,H=[];while(++J<Z.length)(Z[J].add==="after"?$:H).push(Z[J]);Z2($,0,0,H)}function bF($,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 G4($){return $.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}var A2=z7(/[A-Za-z]/),a5=z7(/[\dA-Za-z]/),Um=z7(/[#-'*+\--9=?A-Z^-~]/);function g$($){return $!==null&&($<32||$===127)}var pB=z7(/\d/),Km=z7(/[\dA-Fa-f]/),Ym=z7(/[!-/:-@[-`{-~]/);function u0($){return $!==null&&$<-2}function x1($){return $!==null&&($<0||$===32)}function Q1($){return $===-2||$===-1||$===32}var f$=z7(/\p{P}|\p{S}/u),t9=z7(/\s/);function z7($){return Z;function Z(J){return J!==null&&J>-1&&$.test(String.fromCharCode(J))}}function x8($){let Z=[],J=-1,H=0,Q=0;while(++J<$.length){let B=$.charCodeAt(J),X="";if(B===37&&a5($.charCodeAt(J+1))&&a5($.charCodeAt(J+2)))Q=2;else if(B<128){if(!/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(B)))X=String.fromCharCode(B)}else if(B>55295&&B<57344){let z=$.charCodeAt(J+1);if(B<56320&&z>56319&&z<57344)X=String.fromCharCode(B,z),Q=1;else X="�"}else X=String.fromCharCode(B);if(X)Z.push($.slice(H,J),encodeURIComponent(X)),H=J+Q+1,X="";if(Q)J+=Q,Q=0}return Z.join("")+$.slice(H)}function $1($,Z,J,H){let Q=H?H-1:Number.POSITIVE_INFINITY,B=0;return X;function X(G){if(Q1(G))return $.enter(J),z(G);return Z(G)}function z(G){if(Q1(G)&&B++<Q)return $.consume(G),z;return $.exit(J),Z(G)}}var Fm={tokenize:b$0};function b$0($){let Z=$.attempt(this.parser.constructs.contentInitial,H,Q),J;return Z;function H(z){if(z===null){$.consume(z);return}return $.enter("lineEnding"),$.consume(z),$.exit("lineEnding"),$1($,Z,"linePrefix")}function Q(z){return $.enter("paragraph"),B(z)}function B(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"),B;return $.consume(z),X}}var qm={tokenize:y$0},Wm={tokenize:x$0};function y$0($){let Z=this,J=[],H=0,Q,B,X;return z;function z(L){if(H<J.length){let j=J[H];return Z.containerState=j[1],$.attempt(j[0].continuation,G,U)(L)}return U(L)}function G(L){if(H++,Z.containerState._closeFlow){if(Z.containerState._closeFlow=void 0,Q)D();let j=Z.events.length,M=j,_;while(M--)if(Z.events[M][0]==="exit"&&Z.events[M][1].type==="chunkFlow"){_=Z.events[M][1].end;break}A(H);let E=j;while(E<Z.events.length)Z.events[E][1].end={..._},E++;return Z2(Z.events,M+1,0,Z.events.slice(j)),Z.events.length=E,U(L)}return z(L)}function U(L){if(H===J.length){if(!Q)return F(L);if(Q.currentConstruct&&Q.currentConstruct.concrete)return q(L);Z.interrupt=Boolean(Q.currentConstruct&&!Q._gfmTableDynamicInterruptHack)}return Z.containerState={},$.check(Wm,K,Y)(L)}function K(L){if(Q)D();return A(H),F(L)}function Y(L){return Z.parser.lazy[Z.now().line]=H!==J.length,X=Z.now().offset,q(L)}function F(L){return Z.containerState={},$.attempt(Wm,W,q)(L)}function W(L){return H++,J.push([Z.currentConstruct,Z.containerState]),F(L)}function q(L){if(L===null){if(Q)D();A(0),$.consume(L);return}return Q=Q||Z.parser.flow(Z.now()),$.enter("chunkFlow",{_tokenizer:Q,contentType:"flow",previous:B}),N(L)}function N(L){if(L===null){V($.exit("chunkFlow"),!0),A(0),$.consume(L);return}if(u0(L))return $.consume(L),V($.exit("chunkFlow")),H=0,Z.interrupt=void 0,z;return $.consume(L),N}function V(L,j){let M=Z.sliceStream(L);if(j)M.push(null);if(L.previous=B,B)B.next=L;if(B=L,Q.defineSkip(L.start),Q.write(M),Z.parser.lazy[L.start.line]){let _=Q.events.length;while(_--)if(Q.events[_][1].start.offset<X&&(!Q.events[_][1].end||Q.events[_][1].end.offset>X))return;let E=Z.events.length,C=E,R,T;while(C--)if(Z.events[C][0]==="exit"&&Z.events[C][1].type==="chunkFlow"){if(R){T=Z.events[C][1].end;break}R=!0}A(H),_=E;while(_<Z.events.length)Z.events[_][1].end={...T},_++;Z2(Z.events,C+1,0,Z.events.slice(E)),Z.events.length=_}}function A(L){let j=J.length;while(j-- >L){let M=J[j];Z.containerState=M[1],M[0].exit.call(Z,$)}J.length=L}function D(){Q.write([null]),B=void 0,Q=void 0,Z.containerState._closeFlow=void 0}}function x$0($,Z,J){return $1($,$.attempt(this.parser.constructs.document,Z,J),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function I3($){if($===null||x1($)||t9($))return 1;if(f$($))return 2}function G7($,Z,J){let H=[],Q=-1;while(++Q<$.length){let B=$[Q].resolveAll;if(B&&!H.includes(B))Z=B(Z,J),H.push(B)}return Z}var cB={name:"attention",resolveAll:h$0,tokenize:v$0};function h$0($,Z){let J=-1,H,Q,B,X,z,G,U,K;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 Y={...$[H][1].end},F={...$[J][1].start};if(Nm(Y,-G),Nm(F,G),X={type:G>1?"strongSequence":"emphasisSequence",start:Y,end:{...$[H][1].end}},z={type:G>1?"strongSequence":"emphasisSequence",start:{...$[J][1].start},end:F},B={type:G>1?"strongText":"emphasisText",start:{...$[H][1].end},end:{...$[J][1].start}},Q={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=T4(U,[["enter",$[H][1],Z],["exit",$[H][1],Z]]);if(U=T4(U,[["enter",Q,Z],["enter",X,Z],["exit",X,Z],["enter",B,Z]]),U=T4(U,G7(Z.parser.constructs.insideSpan.null,$.slice(H+1,J),Z)),U=T4(U,[["exit",B,Z],["enter",z,Z],["exit",z,Z],["exit",Q,Z]]),$[J][1].end.offset-$[J][1].start.offset)K=2,U=T4(U,[["enter",$[J][1],Z],["exit",$[J][1],Z]]);else K=0;Z2($,H-1,J-H+3,U),J=H+U.length-K-2;break}}J=-1;while(++J<$.length)if($[J][1].type==="attentionSequence")$[J][1].type="data";return $}function v$0($,Z){let J=this.parser.constructs.attentionMarkers.null,H=this.previous,Q=I3(H),B;return X;function X(G){return B=G,$.enter("attentionSequence"),z(G)}function z(G){if(G===B)return $.consume(G),z;let U=$.exit("attentionSequence"),K=I3(G),Y=!K||K===2&&Q||J.includes(G),F=!Q||Q===2&&K||J.includes(H);return U._open=Boolean(B===42?Y:Y&&(Q||!F)),U._close=Boolean(B===42?F:F&&(K||!Y)),Z(G)}}function Nm($,Z){$.column+=Z,$.offset+=Z,$._bufferIndex+=Z}var zM={name:"autolink",tokenize:g$0};function g$0($,Z,J){let H=0;return Q;function Q(W){return $.enter("autolink"),$.enter("autolinkMarker"),$.consume(W),$.exit("autolinkMarker"),$.enter("autolinkProtocol"),B}function B(W){if(A2(W))return $.consume(W),X;if(W===64)return J(W);return U(W)}function X(W){if(W===43||W===45||W===46||a5(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||a5(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||g$(W))return J(W);return $.consume(W),G}function U(W){if(W===64)return $.consume(W),K;if(Um(W))return $.consume(W),U;return J(W)}function K(W){return a5(W)?Y(W):J(W)}function Y(W){if(W===46)return $.consume(W),H=0,K;if(W===62)return $.exit("autolinkProtocol").type="autolinkEmail",$.enter("autolinkMarker"),$.consume(W),$.exit("autolinkMarker"),$.exit("autolink"),Z;return F(W)}function F(W){if((W===45||a5(W))&&H++<63){let q=W===45?F:Y;return $.consume(W),q}return J(W)}}var e9={partial:!0,tokenize:f$0};function f$0($,Z,J){return H;function H(B){return Q1(B)?$1($,Q,"linePrefix")(B):Q(B)}function Q(B){return B===null||u0(B)?Z(B):J(B)}}var yF={continuation:{tokenize:u$0},exit:p$0,name:"blockQuote",tokenize:m$0};function m$0($,Z,J){let H=this;return Q;function Q(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"),B}return J(X)}function B(X){if(Q1(X))return $.enter("blockQuotePrefixWhitespace"),$.consume(X),$.exit("blockQuotePrefixWhitespace"),$.exit("blockQuotePrefix"),Z;return $.exit("blockQuotePrefix"),Z(X)}}function u$0($,Z,J){let H=this;return Q;function Q(X){if(Q1(X))return $1($,B,"linePrefix",H.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(X);return B(X)}function B(X){return $.attempt(yF,Z,J)(X)}}function p$0($){$.exit("blockQuote")}var xF={name:"characterEscape",tokenize:c$0};function c$0($,Z,J){return H;function H(B){return $.enter("characterEscape"),$.enter("escapeMarker"),$.consume(B),$.exit("escapeMarker"),Q}function Q(B){if(Ym(B))return $.enter("characterEscapeValue"),$.consume(B),$.exit("characterEscapeValue"),$.exit("characterEscape"),Z;return J(B)}}var hF={name:"characterReference",tokenize:d$0};function d$0($,Z,J){let H=this,Q=0,B,X;return z;function z(Y){return $.enter("characterReference"),$.enter("characterReferenceMarker"),$.consume(Y),$.exit("characterReferenceMarker"),G}function G(Y){if(Y===35)return $.enter("characterReferenceMarkerNumeric"),$.consume(Y),$.exit("characterReferenceMarkerNumeric"),U;return $.enter("characterReferenceValue"),B=31,X=a5,K(Y)}function U(Y){if(Y===88||Y===120)return $.enter("characterReferenceMarkerHexadecimal"),$.consume(Y),$.exit("characterReferenceMarkerHexadecimal"),$.enter("characterReferenceValue"),B=6,X=Km,K;return $.enter("characterReferenceValue"),B=7,X=pB,K(Y)}function K(Y){if(Y===59&&Q){let F=$.exit("characterReferenceValue");if(X===a5&&!nJ(H.sliceSerialize(F)))return J(Y);return $.enter("characterReferenceMarker"),$.consume(Y),$.exit("characterReferenceMarker"),$.exit("characterReference"),Z}if(X(Y)&&Q++<B)return $.consume(Y),K;return J(Y)}}var Am={partial:!0,tokenize:i$0},vF={concrete:!0,name:"codeFenced",tokenize:l$0};function l$0($,Z,J){let H=this,Q={partial:!0,tokenize:M},B=0,X=0,z;return G;function G(_){return U(_)}function U(_){let E=H.events[H.events.length-1];return B=E&&E[1].type==="linePrefix"?E[2].sliceSerialize(E[1],!0).length:0,z=_,$.enter("codeFenced"),$.enter("codeFencedFence"),$.enter("codeFencedFenceSequence"),K(_)}function K(_){if(_===z)return X++,$.consume(_),K;if(X<3)return J(_);return $.exit("codeFencedFenceSequence"),Q1(_)?$1($,Y,"whitespace")(_):Y(_)}function Y(_){if(_===null||u0(_))return $.exit("codeFencedFence"),H.interrupt?Z(_):$.check(Am,N,j)(_);return $.enter("codeFencedFenceInfo"),$.enter("chunkString",{contentType:"string"}),F(_)}function F(_){if(_===null||u0(_))return $.exit("chunkString"),$.exit("codeFencedFenceInfo"),Y(_);if(Q1(_))return $.exit("chunkString"),$.exit("codeFencedFenceInfo"),$1($,W,"whitespace")(_);if(_===96&&_===z)return J(_);return $.consume(_),F}function W(_){if(_===null||u0(_))return Y(_);return $.enter("codeFencedFenceMeta"),$.enter("chunkString",{contentType:"string"}),q(_)}function q(_){if(_===null||u0(_))return $.exit("chunkString"),$.exit("codeFencedFenceMeta"),Y(_);if(_===96&&_===z)return J(_);return $.consume(_),q}function N(_){return $.attempt(Q,j,V)(_)}function V(_){return $.enter("lineEnding"),$.consume(_),$.exit("lineEnding"),A}function A(_){return B>0&&Q1(_)?$1($,D,"linePrefix",B+1)(_):D(_)}function D(_){if(_===null||u0(_))return $.check(Am,N,j)(_);return $.enter("codeFlowValue"),L(_)}function L(_){if(_===null||u0(_))return $.exit("codeFlowValue"),D(_);return $.consume(_),L}function j(_){return $.exit("codeFenced"),Z(_)}function M(_,E,C){let R=0;return T;function T(b){return _.enter("lineEnding"),_.consume(b),_.exit("lineEnding"),I}function I(b){return _.enter("codeFencedFence"),Q1(b)?$1(_,y,"linePrefix",H.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(b):y(b)}function y(b){if(b===z)return _.enter("codeFencedFenceSequence"),S(b);return C(b)}function S(b){if(b===z)return R++,_.consume(b),S;if(R>=X)return _.exit("codeFencedFenceSequence"),Q1(b)?$1(_,O,"whitespace")(b):O(b);return C(b)}function O(b){if(b===null||u0(b))return _.exit("codeFencedFence"),E(b);return C(b)}}}function i$0($,Z,J){let H=this;return Q;function Q(X){if(X===null)return J(X);return $.enter("lineEnding"),$.consume(X),$.exit("lineEnding"),B}function B(X){return H.parser.lazy[H.now().line]?J(X):Z(X)}}var dB={name:"codeIndented",tokenize:a$0},r$0={partial:!0,tokenize:o$0};function a$0($,Z,J){let H=this;return Q;function Q(U){return $.enter("codeIndented"),$1($,B,"linePrefix",5)(U)}function B(U){let K=H.events[H.events.length-1];return K&&K[1].type==="linePrefix"&&K[2].sliceSerialize(K[1],!0).length>=4?X(U):J(U)}function X(U){if(U===null)return G(U);if(u0(U))return $.attempt(r$0,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 o$0($,Z,J){let H=this;return Q;function Q(X){if(H.parser.lazy[H.now().line])return J(X);if(u0(X))return $.enter("lineEnding"),$.consume(X),$.exit("lineEnding"),Q;return $1($,B,"linePrefix",5)(X)}function B(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)?Q(X):J(X)}}var GM={name:"codeText",previous:s$0,resolve:n$0,tokenize:t$0};function n$0($){let Z=$.length-4,J=3,H,Q;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(Q===void 0){if(H!==Z&&$[H][1].type!=="lineEnding")Q=H}else if(H===Z||$[H][1].type==="lineEnding"){if($[Q][1].type="codeTextData",H!==Q+2)$[Q][1].end=$[H-1][1].end,$.splice(Q+2,H-Q-2),Z-=H-Q-2,H=Q+2;Q=void 0}return $}function s$0($){return $!==96||this.events[this.events.length-1][1].type==="characterEscape"}function t$0($,Z,J){let H=this,Q=0,B,X;return z;function z(F){return $.enter("codeText"),$.enter("codeTextSequence"),G(F)}function G(F){if(F===96)return $.consume(F),Q++,G;return $.exit("codeTextSequence"),U(F)}function U(F){if(F===null)return J(F);if(F===32)return $.enter("space"),$.consume(F),$.exit("space"),U;if(F===96)return X=$.enter("codeTextSequence"),B=0,Y(F);if(u0(F))return $.enter("lineEnding"),$.consume(F),$.exit("lineEnding"),U;return $.enter("codeTextData"),K(F)}function K(F){if(F===null||F===32||F===96||u0(F))return $.exit("codeTextData"),U(F);return $.consume(F),K}function Y(F){if(F===96)return $.consume(F),B++,Y;if(B===Q)return $.exit("codeTextSequence"),$.exit("codeText"),Z(F);return X.type="codeTextData",K(F)}}class UM{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 Q=this.right.splice(this.right.length-H,Number.POSITIVE_INFINITY);if(J)lB(this.left,J);return Q.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),lB(this.left,$)}unshift($){this.setCursor(0),this.right.push($)}unshiftMany($){this.setCursor(0),lB(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);lB(this.right,Z.reverse())}else{let Z=this.right.splice(this.left.length+this.right.length-$,Number.POSITIVE_INFINITY);lB(this.left,Z.reverse())}}}function lB($,Z){let J=0;if(Z.length<1e4)$.push(...Z);else while(J<Z.length)$.push(...Z.slice(J,J+1e4)),J+=1e4}function gF($){let Z={},J=-1,H,Q,B,X,z,G,U,K=new UM($);while(++J<K.length){while(J in Z)J=Z[J];if(H=K.get(J),J&&H[1].type==="chunkFlow"&&K.get(J-1)[1].type==="listItemPrefix"){if(G=H[1]._tokenizer.events,B=0,B<G.length&&G[B][1].type==="lineEndingBlank")B+=2;if(B<G.length&&G[B][1].type==="content")while(++B<G.length){if(G[B][1].type==="content")break;if(G[B][1].type==="chunkText")G[B][1]._isInFirstContentOfListItem=!0,B++}}if(H[0]==="enter"){if(H[1].contentType)Object.assign(Z,e$0(K,J)),J=Z[J],U=!0}else if(H[1]._container){B=J,Q=void 0;while(B--)if(X=K.get(B),X[1].type==="lineEnding"||X[1].type==="lineEndingBlank"){if(X[0]==="enter"){if(Q)K.get(Q)[1].type="lineEndingBlank";X[1].type="lineEnding",Q=B}}else if(X[1].type==="linePrefix"||X[1].type==="listItemIndent");else break;if(Q)H[1].end={...K.get(Q)[1].start},z=K.slice(Q,J),z.unshift(H),K.splice(Q,J-Q+1,z)}}return Z2($,0,Number.POSITIVE_INFINITY,K.slice(0)),!U}function e$0($,Z){let J=$.get(Z)[1],H=$.get(Z)[2],Q=Z-1,B=[],X=J._tokenizer;if(!X){if(X=H.parser[J.contentType](J.start),J._contentTypeTextTrailing)X._contentTypeTextTrailing=!0}let z=X.events,G=[],U={},K,Y,F=-1,W=J,q=0,N=0,V=[N];while(W){while($.get(++Q)[1]!==W);if(B.push(Q),!W._tokenizer){if(K=H.sliceStream(W),!W.next)K.push(null);if(Y)X.defineSkip(W.start);if(W._isInFirstContentOfListItem)X._gfmTasklistFirstContentOfListItem=!0;if(X.write(K),W._isInFirstContentOfListItem)X._gfmTasklistFirstContentOfListItem=void 0}Y=W,W=W.next}W=J;while(++F<z.length)if(z[F][0]==="exit"&&z[F-1][0]==="enter"&&z[F][1].type===z[F-1][1].type&&z[F][1].start.line!==z[F][1].end.line)N=F+1,V.push(N),W._tokenizer=void 0,W.previous=void 0,W=W.next;if(X.events=[],W)W._tokenizer=void 0,W.previous=void 0;else V.pop();F=V.length;while(F--){let A=z.slice(V[F],V[F+1]),D=B.pop();G.push([D,D+A.length-1]),$.splice(D,2,A)}G.reverse(),F=-1;while(++F<G.length)U[q+G[F][0]]=q+G[F][1],q+=G[F][1]-G[F][0]-1;return U}var KM={resolve:ZZ0,tokenize:JZ0},$Z0={partial:!0,tokenize:HZ0};function ZZ0($){return gF($),$}function JZ0($,Z){let J;return H;function H(z){return $.enter("content"),J=$.enter("chunkContent",{contentType:"content"}),Q(z)}function Q(z){if(z===null)return B(z);if(u0(z))return $.check($Z0,X,B)(z);return $.consume(z),Q}function B(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,Q}}function HZ0($,Z,J){let H=this;return Q;function Q(X){return $.exit("chunkContent"),$.enter("lineEnding"),$.consume(X),$.exit("lineEnding"),$1($,B,"linePrefix")}function B(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 fF($,Z,J,H,Q,B,X,z,G){let U=G||Number.POSITIVE_INFINITY,K=0;return Y;function Y(A){if(A===60)return $.enter(H),$.enter(Q),$.enter(B),$.consume(A),$.exit(B),F;if(A===null||A===32||A===41||g$(A))return J(A);return $.enter(H),$.enter(X),$.enter(z),$.enter("chunkString",{contentType:"string"}),N(A)}function F(A){if(A===62)return $.enter(B),$.consume(A),$.exit(B),$.exit(Q),$.exit(H),Z;return $.enter(z),$.enter("chunkString",{contentType:"string"}),W(A)}function W(A){if(A===62)return $.exit("chunkString"),$.exit(z),F(A);if(A===null||A===60||u0(A))return J(A);return $.consume(A),A===92?q:W}function q(A){if(A===60||A===62||A===92)return $.consume(A),W;return W(A)}function N(A){if(!K&&(A===null||A===41||x1(A)))return $.exit("chunkString"),$.exit(z),$.exit(X),$.exit(H),Z(A);if(K<U&&A===40)return $.consume(A),K++,N;if(A===41)return $.consume(A),K--,N;if(A===null||A===32||A===40||g$(A))return J(A);return $.consume(A),A===92?V:N}function V(A){if(A===40||A===41||A===92)return $.consume(A),N;return N(A)}}function mF($,Z,J,H,Q,B){let X=this,z=0,G;return U;function U(W){return $.enter(H),$.enter(Q),$.consume(W),$.exit(Q),$.enter(B),K}function K(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(B),$.enter(Q),$.consume(W),$.exit(Q),$.exit(H),Z;if(u0(W))return $.enter("lineEnding"),$.consume(W),$.exit("lineEnding"),K;return $.enter("chunkString",{contentType:"string"}),Y(W)}function Y(W){if(W===null||W===91||W===93||u0(W)||z++>999)return $.exit("chunkString"),K(W);if($.consume(W),!G)G=!Q1(W);return W===92?F:Y}function F(W){if(W===91||W===92||W===93)return $.consume(W),z++,Y;return Y(W)}}function uF($,Z,J,H,Q,B){let X;return z;function z(F){if(F===34||F===39||F===40)return $.enter(H),$.enter(Q),$.consume(F),$.exit(Q),X=F===40?41:F,G;return J(F)}function G(F){if(F===X)return $.enter(Q),$.consume(F),$.exit(Q),$.exit(H),Z;return $.enter(B),U(F)}function U(F){if(F===X)return $.exit(B),G(X);if(F===null)return J(F);if(u0(F))return $.enter("lineEnding"),$.consume(F),$.exit("lineEnding"),$1($,U,"linePrefix");return $.enter("chunkString",{contentType:"string"}),K(F)}function K(F){if(F===X||F===null||u0(F))return $.exit("chunkString"),U(F);return $.consume(F),F===92?Y:K}function Y(F){if(F===X||F===92)return $.consume(F),K;return K(F)}}function m$($,Z){let J;return H;function H(Q){if(u0(Q))return $.enter("lineEnding"),$.consume(Q),$.exit("lineEnding"),J=!0,H;if(Q1(Q))return $1($,H,J?"linePrefix":"lineSuffix")(Q);return Z(Q)}}var YM={name:"definition",tokenize:BZ0},QZ0={partial:!0,tokenize:XZ0};function BZ0($,Z,J){let H=this,Q;return B;function B(W){return $.enter("definition"),X(W)}function X(W){return mF.call(H,$,z,J,"definitionLabel","definitionLabelMarker","definitionLabelString")(W)}function z(W){if(Q=G4(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 x1(W)?m$($,U)(W):U(W)}function U(W){return fF($,K,J,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(W)}function K(W){return $.attempt(QZ0,Y,Y)(W)}function Y(W){return Q1(W)?$1($,F,"whitespace")(W):F(W)}function F(W){if(W===null||u0(W))return $.exit("definition"),H.parser.defined.push(Q),Z(W);return J(W)}}function XZ0($,Z,J){return H;function H(z){return x1(z)?m$($,Q)(z):J(z)}function Q(z){return uF($,B,J,"definitionTitle","definitionTitleMarker","definitionTitleString")(z)}function B(z){return Q1(z)?$1($,X,"whitespace")(z):X(z)}function X(z){return z===null||u0(z)?Z(z):J(z)}}var FM={name:"hardBreakEscape",tokenize:zZ0};function zZ0($,Z,J){return H;function H(B){return $.enter("hardBreakEscape"),$.consume(B),Q}function Q(B){if(u0(B))return $.exit("hardBreakEscape"),Z(B);return J(B)}}var WM={name:"headingAtx",resolve:GZ0,tokenize:UZ0};function GZ0($,Z){let J=$.length-2,H=3,Q,B;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)Q={type:"atxHeadingText",start:$[H][1].start,end:$[J][1].end},B={type:"chunkText",start:$[H][1].start,end:$[J][1].end,contentType:"text"},Z2($,H,J-H+1,[["enter",Q,Z],["enter",B,Z],["exit",B,Z],["exit",Q,Z]]);return $}function UZ0($,Z,J){let H=0;return Q;function Q(K){return $.enter("atxHeading"),B(K)}function B(K){return $.enter("atxHeadingSequence"),X(K)}function X(K){if(K===35&&H++<6)return $.consume(K),X;if(K===null||x1(K))return $.exit("atxHeadingSequence"),z(K);return J(K)}function z(K){if(K===35)return $.enter("atxHeadingSequence"),G(K);if(K===null||u0(K))return $.exit("atxHeading"),Z(K);if(Q1(K))return $1($,z,"whitespace")(K);return $.enter("atxHeadingText"),U(K)}function G(K){if(K===35)return $.consume(K),G;return $.exit("atxHeadingSequence"),z(K)}function U(K){if(K===null||K===35||x1(K))return $.exit("atxHeadingText"),z(K);return $.consume(K),U}}var Vm=["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"],qM=["pre","script","style","textarea"];var NM={concrete:!0,name:"htmlFlow",resolveTo:FZ0,tokenize:WZ0},KZ0={partial:!0,tokenize:NZ0},YZ0={partial:!0,tokenize:qZ0};function FZ0($){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 WZ0($,Z,J){let H=this,Q,B,X,z,G;return U;function U(x){return K(x)}function K(x){return $.enter("htmlFlow"),$.enter("htmlFlowData"),$.consume(x),Y}function Y(x){if(x===33)return $.consume(x),F;if(x===47)return $.consume(x),B=!0,N;if(x===63)return $.consume(x),Q=3,H.interrupt?Z:w;if(A2(x))return $.consume(x),X=String.fromCharCode(x),V;return J(x)}function F(x){if(x===45)return $.consume(x),Q=2,W;if(x===91)return $.consume(x),Q=5,z=0,q;if(A2(x))return $.consume(x),Q=4,H.interrupt?Z:w;return J(x)}function W(x){if(x===45)return $.consume(x),H.interrupt?Z:w;return J(x)}function q(x){if(x==="CDATA[".charCodeAt(z++)){if($.consume(x),z===6)return H.interrupt?Z:y;return q}return J(x)}function N(x){if(A2(x))return $.consume(x),X=String.fromCharCode(x),V;return J(x)}function V(x){if(x===null||x===47||x===62||x1(x)){let l=x===47,s=X.toLowerCase();if(!l&&!B&&qM.includes(s))return Q=1,H.interrupt?Z(x):y(x);if(Vm.includes(X.toLowerCase())){if(Q=6,l)return $.consume(x),A;return H.interrupt?Z(x):y(x)}return Q=7,H.interrupt&&!H.parser.lazy[H.now().line]?J(x):B?D(x):L(x)}if(x===45||a5(x))return $.consume(x),X+=String.fromCharCode(x),V;return J(x)}function A(x){if(x===62)return $.consume(x),H.interrupt?Z:y;return J(x)}function D(x){if(Q1(x))return $.consume(x),D;return T(x)}function L(x){if(x===47)return $.consume(x),T;if(x===58||x===95||A2(x))return $.consume(x),j;if(Q1(x))return $.consume(x),L;return T(x)}function j(x){if(x===45||x===46||x===58||x===95||a5(x))return $.consume(x),j;return M(x)}function M(x){if(x===61)return $.consume(x),_;if(Q1(x))return $.consume(x),M;return L(x)}function _(x){if(x===null||x===60||x===61||x===62||x===96)return J(x);if(x===34||x===39)return $.consume(x),G=x,E;if(Q1(x))return $.consume(x),_;return C(x)}function E(x){if(x===G)return $.consume(x),G=null,R;if(x===null||u0(x))return J(x);return $.consume(x),E}function C(x){if(x===null||x===34||x===39||x===47||x===60||x===61||x===62||x===96||x1(x))return M(x);return $.consume(x),C}function R(x){if(x===47||x===62||Q1(x))return L(x);return J(x)}function T(x){if(x===62)return $.consume(x),I;return J(x)}function I(x){if(x===null||u0(x))return y(x);if(Q1(x))return $.consume(x),I;return J(x)}function y(x){if(x===45&&Q===2)return $.consume(x),k;if(x===60&&Q===1)return $.consume(x),h;if(x===62&&Q===4)return $.consume(x),i;if(x===63&&Q===3)return $.consume(x),w;if(x===93&&Q===5)return $.consume(x),f;if(u0(x)&&(Q===6||Q===7))return $.exit("htmlFlowData"),$.check(KZ0,r,S)(x);if(x===null||u0(x))return $.exit("htmlFlowData"),S(x);return $.consume(x),y}function S(x){return $.check(YZ0,O,r)(x)}function O(x){return $.enter("lineEnding"),$.consume(x),$.exit("lineEnding"),b}function b(x){if(x===null||u0(x))return S(x);return $.enter("htmlFlowData"),y(x)}function k(x){if(x===45)return $.consume(x),w;return y(x)}function h(x){if(x===47)return $.consume(x),X="",v;return y(x)}function v(x){if(x===62){let l=X.toLowerCase();if(qM.includes(l))return $.consume(x),i;return y(x)}if(A2(x)&&X.length<8)return $.consume(x),X+=String.fromCharCode(x),v;return y(x)}function f(x){if(x===93)return $.consume(x),w;return y(x)}function w(x){if(x===62)return $.consume(x),i;if(x===45&&Q===2)return $.consume(x),w;return y(x)}function i(x){if(x===null||u0(x))return $.exit("htmlFlowData"),r(x);return $.consume(x),i}function r(x){return $.exit("htmlFlow"),Z(x)}}function qZ0($,Z,J){let H=this;return Q;function Q(X){if(u0(X))return $.enter("lineEnding"),$.consume(X),$.exit("lineEnding"),B;return J(X)}function B(X){return H.parser.lazy[H.now().line]?J(X):Z(X)}}function NZ0($,Z,J){return H;function H(Q){return $.enter("lineEnding"),$.consume(Q),$.exit("lineEnding"),$.attempt(e9,Z,J)}}var AM={name:"htmlText",tokenize:AZ0};function AZ0($,Z,J){let H=this,Q,B,X;return z;function z(w){return $.enter("htmlText"),$.enter("htmlTextData"),$.consume(w),G}function G(w){if(w===33)return $.consume(w),U;if(w===47)return $.consume(w),M;if(w===63)return $.consume(w),L;if(A2(w))return $.consume(w),C;return J(w)}function U(w){if(w===45)return $.consume(w),K;if(w===91)return $.consume(w),B=0,q;if(A2(w))return $.consume(w),D;return J(w)}function K(w){if(w===45)return $.consume(w),W;return J(w)}function Y(w){if(w===null)return J(w);if(w===45)return $.consume(w),F;if(u0(w))return X=Y,h(w);return $.consume(w),Y}function F(w){if(w===45)return $.consume(w),W;return Y(w)}function W(w){return w===62?k(w):w===45?F(w):Y(w)}function q(w){if(w==="CDATA[".charCodeAt(B++))return $.consume(w),B===6?N:q;return J(w)}function N(w){if(w===null)return J(w);if(w===93)return $.consume(w),V;if(u0(w))return X=N,h(w);return $.consume(w),N}function V(w){if(w===93)return $.consume(w),A;return N(w)}function A(w){if(w===62)return k(w);if(w===93)return $.consume(w),A;return N(w)}function D(w){if(w===null||w===62)return k(w);if(u0(w))return X=D,h(w);return $.consume(w),D}function L(w){if(w===null)return J(w);if(w===63)return $.consume(w),j;if(u0(w))return X=L,h(w);return $.consume(w),L}function j(w){return w===62?k(w):L(w)}function M(w){if(A2(w))return $.consume(w),_;return J(w)}function _(w){if(w===45||a5(w))return $.consume(w),_;return E(w)}function E(w){if(u0(w))return X=E,h(w);if(Q1(w))return $.consume(w),E;return k(w)}function C(w){if(w===45||a5(w))return $.consume(w),C;if(w===47||w===62||x1(w))return R(w);return J(w)}function R(w){if(w===47)return $.consume(w),k;if(w===58||w===95||A2(w))return $.consume(w),T;if(u0(w))return X=R,h(w);if(Q1(w))return $.consume(w),R;return k(w)}function T(w){if(w===45||w===46||w===58||w===95||a5(w))return $.consume(w),T;return I(w)}function I(w){if(w===61)return $.consume(w),y;if(u0(w))return X=I,h(w);if(Q1(w))return $.consume(w),I;return R(w)}function y(w){if(w===null||w===60||w===61||w===62||w===96)return J(w);if(w===34||w===39)return $.consume(w),Q=w,S;if(u0(w))return X=y,h(w);if(Q1(w))return $.consume(w),y;return $.consume(w),O}function S(w){if(w===Q)return $.consume(w),Q=void 0,b;if(w===null)return J(w);if(u0(w))return X=S,h(w);return $.consume(w),S}function O(w){if(w===null||w===34||w===39||w===60||w===61||w===96)return J(w);if(w===47||w===62||x1(w))return R(w);return $.consume(w),O}function b(w){if(w===47||w===62||x1(w))return R(w);return J(w)}function k(w){if(w===62)return $.consume(w),$.exit("htmlTextData"),$.exit("htmlText"),Z;return J(w)}function h(w){return $.exit("htmlTextData"),$.enter("lineEnding"),$.consume(w),$.exit("lineEnding"),v}function v(w){return Q1(w)?$1($,f,"linePrefix",H.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(w):f(w)}function f(w){return $.enter("htmlTextData"),X(w)}}var u$={name:"labelEnd",resolveAll:MZ0,resolveTo:PZ0,tokenize:_Z0},VZ0={tokenize:jZ0},DZ0={tokenize:OZ0},LZ0={tokenize:TZ0};function MZ0($){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 Q=H.type==="labelImage"?4:2;H.type="data",Z+=Q}}if($.length!==J.length)Z2($,0,$.length,J);return $}function PZ0($,Z){let J=$.length,H=0,Q,B,X,z;while(J--)if(Q=$[J][1],B){if(Q.type==="link"||Q.type==="labelLink"&&Q._inactive)break;if($[J][0]==="enter"&&Q.type==="labelLink")Q._inactive=!0}else if(X){if($[J][0]==="enter"&&(Q.type==="labelImage"||Q.type==="labelLink")&&!Q._balanced){if(B=J,Q.type!=="labelLink"){H=2;break}}}else if(Q.type==="labelEnd")X=J;let G={type:$[B][1].type==="labelLink"?"link":"image",start:{...$[B][1].start},end:{...$[$.length-1][1].end}},U={type:"label",start:{...$[B][1].start},end:{...$[X][1].end}},K={type:"labelText",start:{...$[B+H+2][1].end},end:{...$[X-2][1].start}};return z=[["enter",G,Z],["enter",U,Z]],z=T4(z,$.slice(B+1,B+H+3)),z=T4(z,[["enter",K,Z]]),z=T4(z,G7(Z.parser.constructs.insideSpan.null,$.slice(B+H+4,X-3),Z)),z=T4(z,[["exit",K,Z],$[X-2],$[X-1],["exit",U,Z]]),z=T4(z,$.slice(X+1)),z=T4(z,[["exit",G,Z]]),Z2($,B,$.length,z),$}function _Z0($,Z,J){let H=this,Q=H.events.length,B,X;while(Q--)if((H.events[Q][1].type==="labelImage"||H.events[Q][1].type==="labelLink")&&!H.events[Q][1]._balanced){B=H.events[Q][1];break}return z;function z(F){if(!B)return J(F);if(B._inactive)return Y(F);return X=H.parser.defined.includes(G4(H.sliceSerialize({start:B.end,end:H.now()}))),$.enter("labelEnd"),$.enter("labelMarker"),$.consume(F),$.exit("labelMarker"),$.exit("labelEnd"),G}function G(F){if(F===40)return $.attempt(VZ0,K,X?K:Y)(F);if(F===91)return $.attempt(DZ0,K,X?U:Y)(F);return X?K(F):Y(F)}function U(F){return $.attempt(LZ0,K,Y)(F)}function K(F){return Z(F)}function Y(F){return B._balanced=!0,J(F)}}function jZ0($,Z,J){return H;function H(Y){return $.enter("resource"),$.enter("resourceMarker"),$.consume(Y),$.exit("resourceMarker"),Q}function Q(Y){return x1(Y)?m$($,B)(Y):B(Y)}function B(Y){if(Y===41)return K(Y);return fF($,X,z,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(Y)}function X(Y){return x1(Y)?m$($,G)(Y):K(Y)}function z(Y){return J(Y)}function G(Y){if(Y===34||Y===39||Y===40)return uF($,U,J,"resourceTitle","resourceTitleMarker","resourceTitleString")(Y);return K(Y)}function U(Y){return x1(Y)?m$($,K)(Y):K(Y)}function K(Y){if(Y===41)return $.enter("resourceMarker"),$.consume(Y),$.exit("resourceMarker"),$.exit("resource"),Z;return J(Y)}}function OZ0($,Z,J){let H=this;return Q;function Q(z){return mF.call(H,$,B,X,"reference","referenceMarker","referenceString")(z)}function B(z){return H.parser.defined.includes(G4(H.sliceSerialize(H.events[H.events.length-1][1]).slice(1,-1)))?Z(z):J(z)}function X(z){return J(z)}}function TZ0($,Z,J){return H;function H(B){return $.enter("reference"),$.enter("referenceMarker"),$.consume(B),$.exit("referenceMarker"),Q}function Q(B){if(B===93)return $.enter("referenceMarker"),$.consume(B),$.exit("referenceMarker"),$.exit("reference"),Z;return J(B)}}var VM={name:"labelStartImage",resolveAll:u$.resolveAll,tokenize:CZ0};function CZ0($,Z,J){let H=this;return Q;function Q(z){return $.enter("labelImage"),$.enter("labelImageMarker"),$.consume(z),$.exit("labelImageMarker"),B}function B(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 DM={name:"labelStartLink",resolveAll:u$.resolveAll,tokenize:wZ0};function wZ0($,Z,J){let H=this;return Q;function Q(X){return $.enter("labelLink"),$.enter("labelMarker"),$.consume(X),$.exit("labelMarker"),$.exit("labelLink"),B}function B(X){return X===94&&"_hiddenFootnoteSupport"in H.parser.constructs?J(X):Z(X)}}var iB={name:"lineEnding",tokenize:EZ0};function EZ0($,Z){return J;function J(H){return $.enter("lineEnding"),$.consume(H),$.exit("lineEnding"),$1($,Z,"linePrefix")}}var p$={name:"thematicBreak",tokenize:SZ0};function SZ0($,Z,J){let H=0,Q;return B;function B(U){return $.enter("thematicBreak"),X(U)}function X(U){return Q=U,z(U)}function z(U){if(U===Q)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===Q)return $.consume(U),H++,G;return $.exit("thematicBreakSequence"),Q1(U)?$1($,z,"whitespace")(U):z(U)}}var U4={continuation:{tokenize:bZ0},exit:xZ0,name:"list",tokenize:kZ0},RZ0={partial:!0,tokenize:hZ0},IZ0={partial:!0,tokenize:yZ0};function kZ0($,Z,J){let H=this,Q=H.events[H.events.length-1],B=Q&&Q[1].type==="linePrefix"?Q[2].sliceSerialize(Q[1],!0).length:0,X=0;return z;function z(W){let q=H.containerState.type||(W===42||W===43||W===45?"listUnordered":"listOrdered");if(q==="listUnordered"?!H.containerState.marker||W===H.containerState.marker:pB(W)){if(!H.containerState.type)H.containerState.type=q,$.enter(q,{_container:!0});if(q==="listUnordered")return $.enter("listItemPrefix"),W===42||W===45?$.check(p$,J,U)(W):U(W);if(!H.interrupt||W===49)return $.enter("listItemPrefix"),$.enter("listItemValue"),G(W)}return J(W)}function G(W){if(pB(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(e9,H.interrupt?J:K,$.attempt(RZ0,F,Y))}function K(W){return H.containerState.initialBlankLine=!0,B++,F(W)}function Y(W){if(Q1(W))return $.enter("listItemPrefixWhitespace"),$.consume(W),$.exit("listItemPrefixWhitespace"),F;return J(W)}function F(W){return H.containerState.size=B+H.sliceSerialize($.exit("listItemPrefix"),!0).length,Z(W)}}function bZ0($,Z,J){let H=this;return H.containerState._closeFlow=void 0,$.check(e9,Q,B);function Q(z){return H.containerState.furtherBlankLines=H.containerState.furtherBlankLines||H.containerState.initialBlankLine,$1($,Z,"listItemIndent",H.containerState.size+1)(z)}function B(z){if(H.containerState.furtherBlankLines||!Q1(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(IZ0,Z,X)(z)}function X(z){return H.containerState._closeFlow=!0,H.interrupt=void 0,$1($,$.attempt(U4,Z,J),"linePrefix",H.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(z)}}function yZ0($,Z,J){let H=this;return $1($,Q,"listItemIndent",H.containerState.size+1);function Q(B){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(B):J(B)}}function xZ0($){$.exit(this.containerState.type)}function hZ0($,Z,J){let H=this;return $1($,Q,"listItemPrefixWhitespace",H.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function Q(B){let X=H.events[H.events.length-1];return!Q1(B)&&X&&X[1].type==="listItemPrefixWhitespace"?Z(B):J(B)}}var pF={name:"setextUnderline",resolveTo:vZ0,tokenize:gZ0};function vZ0($,Z){let J=$.length,H,Q,B;while(J--)if($[J][0]==="enter"){if($[J][1].type==="content"){H=J;break}if($[J][1].type==="paragraph")Q=J}else{if($[J][1].type==="content")$.splice(J,1);if(!B&&$[J][1].type==="definition")B=J}let X={type:"setextHeading",start:{...$[H][1].start},end:{...$[$.length-1][1].end}};if($[Q][1].type="setextHeadingText",B)$.splice(Q,0,["enter",X,Z]),$.splice(B+1,0,["exit",$[H][1],Z]),$[H][1].end={...$[B][1].end};else $[H][1]=X;return $.push(["exit",X,Z]),$}function gZ0($,Z,J){let H=this,Q;return B;function B(U){let K=H.events.length,Y;while(K--)if(H.events[K][1].type!=="lineEnding"&&H.events[K][1].type!=="linePrefix"&&H.events[K][1].type!=="content"){Y=H.events[K][1].type==="paragraph";break}if(!H.parser.lazy[H.now().line]&&(H.interrupt||Y))return $.enter("setextHeadingLine"),Q=U,X(U);return J(U)}function X(U){return $.enter("setextHeadingLineSequence"),z(U)}function z(U){if(U===Q)return $.consume(U),z;return $.exit("setextHeadingLineSequence"),Q1(U)?$1($,G,"lineSuffix")(U):G(U)}function G(U){if(U===null||u0(U))return $.exit("setextHeadingLine"),Z(U);return J(U)}}var Dm={tokenize:fZ0};function fZ0($){let Z=this,J=$.attempt(e9,H,$.attempt(this.parser.constructs.flowInitial,Q,$1($,$.attempt(this.parser.constructs.flow,Q,$.attempt(KM,Q)),"linePrefix")));return J;function H(B){if(B===null){$.consume(B);return}return $.enter("lineEndingBlank"),$.consume(B),$.exit("lineEndingBlank"),Z.currentConstruct=void 0,J}function Q(B){if(B===null){$.consume(B);return}return $.enter("lineEnding"),$.consume(B),$.exit("lineEnding"),Z.currentConstruct=void 0,J}}var Lm={resolveAll:jm()},Mm=_m("string"),Pm=_m("text");function _m($){return{resolveAll:jm($==="text"?mZ0:void 0),tokenize:Z};function Z(J){let H=this,Q=this.parser.constructs[$],B=J.attempt(Q,X,z);return X;function X(K){return U(K)?B(K):z(K)}function z(K){if(K===null){J.consume(K);return}return J.enter("data"),J.consume(K),G}function G(K){if(U(K))return J.exit("data"),B(K);return J.consume(K),G}function U(K){if(K===null)return!0;let Y=Q[K],F=-1;if(Y)while(++F<Y.length){let W=Y[F];if(!W.previous||W.previous.call(H,H.previous))return!0}return!1}}}function jm($){return Z;function Z(J,H){let Q=-1,B;while(++Q<=J.length)if(B===void 0){if(J[Q]&&J[Q][1].type==="data")B=Q,Q++}else if(!J[Q]||J[Q][1].type!=="data"){if(Q!==B+2)J[B][1].end=J[Q-1][1].end,J.splice(B+2,Q-B-2),Q=B+2;B=void 0}return $?$(J,H):J}}function mZ0($,Z){let J=0;while(++J<=$.length)if((J===$.length||$[J][1].type==="lineEnding")&&$[J-1][1].type==="data"){let H=$[J-1][1],Q=Z.sliceStream(H),B=Q.length,X=-1,z=0,G;while(B--){let U=Q[B];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{B++;break}}if(Z._contentTypeTextTrailing&&J===$.length)z=0;if(z){let U={type:J===$.length||G||z<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:B?X:H.start._bufferIndex+X,_index:H.start._index+B,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 LM={};C5(LM,{text:()=>iZ0,string:()=>lZ0,insideSpan:()=>rZ0,flowInitial:()=>cZ0,flow:()=>dZ0,document:()=>uZ0,disable:()=>oZ0,contentInitial:()=>pZ0,attentionMarkers:()=>aZ0});var uZ0={[42]:U4,[43]:U4,[45]:U4,[48]:U4,[49]:U4,[50]:U4,[51]:U4,[52]:U4,[53]:U4,[54]:U4,[55]:U4,[56]:U4,[57]:U4,[62]:yF},pZ0={[91]:YM},cZ0={[-2]:dB,[-1]:dB,[32]:dB},dZ0={[35]:WM,[42]:p$,[45]:[pF,p$],[60]:NM,[61]:pF,[95]:p$,[96]:vF,[126]:vF},lZ0={[38]:hF,[92]:xF},iZ0={[-5]:iB,[-4]:iB,[-3]:iB,[33]:VM,[38]:hF,[42]:cB,[60]:[zM,AM],[91]:DM,[92]:[FM,xF],[93]:u$,[95]:cB,[96]:GM},rZ0={null:[cB,Lm]},aZ0={null:[42,95]},oZ0={null:[]};function Om($,Z,J){let H={_bufferIndex:-1,_index:0,line:J&&J.line||1,column:J&&J.column||1,offset:J&&J.offset||0},Q={},B=[],X=[],z=[],G=!0,U={attempt:R(E),check:R(C),consume:j,enter:M,exit:_,interrupt:R(C,{interrupt:!0})},K={code:null,containerState:{},defineSkip:A,events:[],now:V,parser:$,previous:null,sliceSerialize:q,sliceStream:N,write:W},Y=Z.tokenize.call(K,U),F;if(Z.resolveAll)B.push(Z);return K;function W(S){if(X=T4(X,S),D(),X[X.length-1]!==null)return[];return T(Z,0),K.events=G7(B,K.events,K),K.events}function q(S,O){return sZ0(N(S),O)}function N(S){return nZ0(X,S)}function V(){let{_bufferIndex:S,_index:O,line:b,column:k,offset:h}=H;return{_bufferIndex:S,_index:O,line:b,column:k,offset:h}}function A(S){Q[S.line]=S.column,y()}function D(){let S;while(H._index<X.length){let O=X[H._index];if(typeof O==="string"){if(S=H._index,H._bufferIndex<0)H._bufferIndex=0;while(H._index===S&&H._bufferIndex<O.length)L(O.charCodeAt(H._bufferIndex))}else L(O)}}function L(S){G=void 0,F=S,Y=Y(S)}function j(S){if(u0(S))H.line++,H.column=1,H.offset+=S===-3?2:1,y();else if(S!==-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++;K.previous=S,G=!0}function M(S,O){let b=O||{};return b.type=S,b.start=V(),K.events.push(["enter",b,K]),z.push(b),b}function _(S){let O=z.pop();return O.end=V(),K.events.push(["exit",O,K]),O}function E(S,O){T(S,O.from)}function C(S,O){O.restore()}function R(S,O){return b;function b(k,h,v){let f,w,i,r;return Array.isArray(k)?l(k):("tokenize"in k)?l([k]):x(k);function x(o){return Z0;function Z0(H0){let G0=H0!==null&&o[H0],X0=H0!==null&&o.null,Y0=[...Array.isArray(G0)?G0:G0?[G0]:[],...Array.isArray(X0)?X0:X0?[X0]:[]];return l(Y0)(H0)}}function l(o){if(f=o,w=0,o.length===0)return v;return s(o[w])}function s(o){return Z0;function Z0(H0){if(r=I(),i=o,!o.partial)K.currentConstruct=o;if(o.name&&K.parser.constructs.disable.null.includes(o.name))return d(H0);return o.tokenize.call(O?Object.assign(Object.create(K),O):K,U,p,d)(H0)}}function p(o){return G=!0,S(i,r),h}function d(o){if(G=!0,r.restore(),++w<f.length)return s(f[w]);return v}}}function T(S,O){if(S.resolveAll&&!B.includes(S))B.push(S);if(S.resolve)Z2(K.events,O,K.events.length-O,S.resolve(K.events.slice(O),K));if(S.resolveTo)K.events=S.resolveTo(K.events,K)}function I(){let S=V(),O=K.previous,b=K.currentConstruct,k=K.events.length,h=Array.from(z);return{from:k,restore:v};function v(){H=S,K.previous=O,K.currentConstruct=b,K.events.length=k,z=h,y()}}function y(){if(H.line in Q&&H.column<2)H.column=Q[H.line],H.offset+=Q[H.line]-1}}function nZ0($,Z){let J=Z.start._index,H=Z.start._bufferIndex,Q=Z.end._index,B=Z.end._bufferIndex,X;if(J===Q)X=[$[J].slice(H,B)];else{if(X=$.slice(J,Q),H>-1){let z=X[0];if(typeof z==="string")X[0]=z.slice(H);else X.shift()}if(B>0)X.push($[Q].slice(0,B))}return X}function sZ0($,Z){let J=-1,H=[],Q;while(++J<$.length){let B=$[J],X;if(typeof B==="string")X=B;else switch(B){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&&Q)continue;X=" ";break}default:X=String.fromCharCode(B)}Q=B===-2,H.push(X)}return H.join("")}function MM($){let H={constructs:kF([LM,...($||{}).extensions||[]]),content:Q(Fm),defined:[],document:Q(qm),flow:Q(Dm),lazy:{},string:Q(Mm),text:Q(Pm)};return H;function Q(B){return X;function X(z){return Om(H,B,z)}}}function PM($){while(!gF($));return $}var Tm=/[\0\t\n\r]/g;function _M(){let $=1,Z="",J=!0,H;return Q;function Q(B,X,z){let G=[],U,K,Y,F,W;if(B=Z+(typeof B==="string"?B.toString():new TextDecoder(X||void 0).decode(B)),Y=0,Z="",J){if(B.charCodeAt(0)===65279)Y++;J=void 0}while(Y<B.length){if(Tm.lastIndex=Y,U=Tm.exec(B),F=U&&U.index!==void 0?U.index:B.length,W=B.charCodeAt(F),!U){Z=B.slice(Y);break}if(W===10&&Y===F&&H)G.push(-3),H=void 0;else{if(H)G.push(-5),H=void 0;if(Y<F)G.push(B.slice(Y,F)),$+=F-Y;switch(W){case 0:{G.push(65533),$++;break}case 9:{K=Math.ceil($/4)*4,G.push(-2);while($++<K)G.push(-1);break}case 10:{G.push(-4),$=1;break}default:H=!0,$=1}}Y=F+1}if(z){if(H)G.push(-5);if(Z)G.push(Z);G.push(null)}return G}}var tZ0=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Cm($){return $.replace(tZ0,eZ0)}function eZ0($,Z,J){if(Z)return Z;if(J.charCodeAt(0)===35){let Q=J.charCodeAt(1),B=Q===120||Q===88;return bF(J.slice(B?2:1),B?16:10)}return nJ(J)||$}var Em={}.hasOwnProperty;function jM($,Z,J){if(Z&&typeof Z==="object")J=Z,Z=void 0;return $J0(J)(PM(MM(J).document().write(_M()($,Z,!0))))}function $J0($){let Z={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:B(e),autolinkProtocol:R,autolinkEmail:R,atxHeading:B(N0),blockQuote:B(H0),characterEscape:R,characterReference:R,codeFenced:B(G0),codeFencedFenceInfo:X,codeFencedFenceMeta:X,codeIndented:B(G0,X),codeText:B(X0,X),codeTextData:R,data:R,codeFlowValue:R,definition:B(Y0),definitionDestinationString:X,definitionLabelString:X,definitionTitleString:X,emphasis:B(V0),hardBreakEscape:B(F0),hardBreakTrailing:B(F0),htmlFlow:B(n,X),htmlFlowData:R,htmlText:B(n,X),htmlTextData:R,image:B(a),label:X,link:B(e),listItem:B(Q0),listItemValue:F,listOrdered:B($0,Y),listUnordered:B($0),paragraph:B(_0),reference:x,referenceString:X,resourceDestinationString:X,resourceTitleString:X,setextHeading:B(N0),strong:B(M0),thematicBreak:B(L0)},exit:{atxHeading:G(),atxHeadingSequence:M,autolink:G(),autolinkEmail:Z0,autolinkProtocol:o,blockQuote:G(),characterEscapeValue:T,characterReferenceMarkerHexadecimal:s,characterReferenceMarkerNumeric:s,characterReferenceValue:p,characterReference:d,codeFenced:G(V),codeFencedFence:N,codeFencedFenceInfo:W,codeFencedFenceMeta:q,codeFlowValue:T,codeIndented:G(A),codeText:G(b),codeTextData:T,data:T,definition:G(),definitionDestinationString:j,definitionLabelString:D,definitionTitleString:L,emphasis:G(),hardBreakEscape:G(y),hardBreakTrailing:G(y),htmlFlow:G(S),htmlFlowData:T,htmlText:G(O),htmlTextData:T,image:G(h),label:f,labelText:v,lineEnding:I,link:G(k),listItem:G(),listOrdered:G(),listUnordered:G(),paragraph:G(),referenceString:l,resourceDestinationString:w,resourceTitleString:i,resource:r,setextHeading:G(C),setextHeadingLineSequence:E,setextHeadingText:_,strong:G(),thematicBreak:G()}};Sm(Z,($||{}).mdastExtensions||[]);let J={};return H;function H(g){let u={type:"root",children:[]},t={stack:[u],tokenStack:[],config:Z,enter:z,exit:U,buffer:X,resume:K,data:J},W0=[],I0=-1;while(++I0<g.length)if(g[I0][1].type==="listOrdered"||g[I0][1].type==="listUnordered")if(g[I0][0]==="enter")W0.push(I0);else{let c0=W0.pop();I0=Q(g,c0,I0)}I0=-1;while(++I0<g.length){let c0=Z[g[I0][0]];if(Em.call(c0,g[I0][1].type))c0[g[I0][1].type].call(Object.assign({sliceSerialize:g[I0][2].sliceSerialize},t),g[I0][1])}if(t.tokenStack.length>0){let c0=t.tokenStack[t.tokenStack.length-1];(c0[1]||wm).call(t,void 0,c0[0])}u.position={start:U7(g.length>0?g[0][1].start:{line:1,column:1,offset:0}),end:U7(g.length>0?g[g.length-2][1].end:{line:1,column:1,offset:0})},I0=-1;while(++I0<Z.transforms.length)u=Z.transforms[I0](u)||u;return u}function Q(g,u,t){let W0=u-1,I0=-1,c0=!1,f0,T0,x0,J1;while(++W0<=t){let W1=g[W0];switch(W1[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{if(W1[0]==="enter")I0++;else I0--;J1=void 0;break}case"lineEndingBlank":{if(W1[0]==="enter"){if(f0&&!J1&&!I0&&!x0)x0=W0;J1=void 0}break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:J1=void 0}if(!I0&&W1[0]==="enter"&&W1[1].type==="listItemPrefix"||I0===-1&&W1[0]==="exit"&&(W1[1].type==="listUnordered"||W1[1].type==="listOrdered")){if(f0){let d0=W0;T0=void 0;while(d0--){let v0=g[d0];if(v0[1].type==="lineEnding"||v0[1].type==="lineEndingBlank"){if(v0[0]==="exit")continue;if(T0)g[T0][1].type="lineEndingBlank",c0=!0;v0[1].type="lineEnding",T0=d0}else if(v0[1].type==="linePrefix"||v0[1].type==="blockQuotePrefix"||v0[1].type==="blockQuotePrefixWhitespace"||v0[1].type==="blockQuoteMarker"||v0[1].type==="listItemIndent");else break}if(x0&&(!T0||x0<T0))f0._spread=!0;f0.end=Object.assign({},T0?g[T0][1].start:W1[1].end),g.splice(T0||W0,0,["exit",f0,W1[2]]),W0++,t++}if(W1[1].type==="listItemPrefix"){let d0={type:"listItem",_spread:!1,start:Object.assign({},W1[1].start),end:void 0};f0=d0,g.splice(W0,0,["enter",d0,W1[2]]),W0++,t++,x0=void 0,J1=!0}}}return g[u][1]._spread=c0,t}function B(g,u){return t;function t(W0){if(z.call(this,g(W0),W0),u)u.call(this,W0)}}function X(){this.stack.push({type:"fragment",children:[]})}function z(g,u,t){this.stack[this.stack.length-1].children.push(g),this.stack.push(g),this.tokenStack.push([u,t||void 0]),g.position={start:U7(u.start),end:void 0}}function G(g){return u;function u(t){if(g)g.call(this,t);U.call(this,t)}}function U(g,u){let t=this.stack.pop(),W0=this.tokenStack.pop();if(!W0)throw Error("Cannot close `"+g.type+"` ("+X7({start:g.start,end:g.end})+"): it’s not open");else if(W0[0].type!==g.type)if(u)u.call(this,g,W0[0]);else(W0[1]||wm).call(this,g,W0[0]);t.position.end=U7(g.end)}function K(){return v$(this.stack.pop())}function Y(){this.data.expectingFirstListItemValue=!0}function F(g){if(this.data.expectingFirstListItemValue){let u=this.stack[this.stack.length-2];u.start=Number.parseInt(this.sliceSerialize(g),10),this.data.expectingFirstListItemValue=void 0}}function W(){let g=this.resume(),u=this.stack[this.stack.length-1];u.lang=g}function q(){let g=this.resume(),u=this.stack[this.stack.length-1];u.meta=g}function N(){if(this.data.flowCodeInside)return;this.buffer(),this.data.flowCodeInside=!0}function V(){let g=this.resume(),u=this.stack[this.stack.length-1];u.value=g.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function A(){let g=this.resume(),u=this.stack[this.stack.length-1];u.value=g.replace(/(\r?\n|\r)$/g,"")}function D(g){let u=this.resume(),t=this.stack[this.stack.length-1];t.label=u,t.identifier=G4(this.sliceSerialize(g)).toLowerCase()}function L(){let g=this.resume(),u=this.stack[this.stack.length-1];u.title=g}function j(){let g=this.resume(),u=this.stack[this.stack.length-1];u.url=g}function M(g){let u=this.stack[this.stack.length-1];if(!u.depth){let t=this.sliceSerialize(g).length;u.depth=t}}function _(){this.data.setextHeadingSlurpLineEnding=!0}function E(g){let u=this.stack[this.stack.length-1];u.depth=this.sliceSerialize(g).codePointAt(0)===61?1:2}function C(){this.data.setextHeadingSlurpLineEnding=void 0}function R(g){let t=this.stack[this.stack.length-1].children,W0=t[t.length-1];if(!W0||W0.type!=="text")W0=A0(),W0.position={start:U7(g.start),end:void 0},t.push(W0);this.stack.push(W0)}function T(g){let u=this.stack.pop();u.value+=this.sliceSerialize(g),u.position.end=U7(g.end)}function I(g){let u=this.stack[this.stack.length-1];if(this.data.atHardBreak){let t=u.children[u.children.length-1];t.position.end=U7(g.end),this.data.atHardBreak=void 0;return}if(!this.data.setextHeadingSlurpLineEnding&&Z.canContainEols.includes(u.type))R.call(this,g),T.call(this,g)}function y(){this.data.atHardBreak=!0}function S(){let g=this.resume(),u=this.stack[this.stack.length-1];u.value=g}function O(){let g=this.resume(),u=this.stack[this.stack.length-1];u.value=g}function b(){let g=this.resume(),u=this.stack[this.stack.length-1];u.value=g}function k(){let g=this.stack[this.stack.length-1];if(this.data.inReference){let u=this.data.referenceType||"shortcut";g.type+="Reference",g.referenceType=u,delete g.url,delete g.title}else delete g.identifier,delete g.label;this.data.referenceType=void 0}function h(){let g=this.stack[this.stack.length-1];if(this.data.inReference){let u=this.data.referenceType||"shortcut";g.type+="Reference",g.referenceType=u,delete g.url,delete g.title}else delete g.identifier,delete g.label;this.data.referenceType=void 0}function v(g){let u=this.sliceSerialize(g),t=this.stack[this.stack.length-2];t.label=Cm(u),t.identifier=G4(u).toLowerCase()}function f(){let g=this.stack[this.stack.length-1],u=this.resume(),t=this.stack[this.stack.length-1];if(this.data.inReference=!0,t.type==="link"){let W0=g.children;t.children=W0}else t.alt=u}function w(){let g=this.resume(),u=this.stack[this.stack.length-1];u.url=g}function i(){let g=this.resume(),u=this.stack[this.stack.length-1];u.title=g}function r(){this.data.inReference=void 0}function x(){this.data.referenceType="collapsed"}function l(g){let u=this.resume(),t=this.stack[this.stack.length-1];t.label=u,t.identifier=G4(this.sliceSerialize(g)).toLowerCase(),this.data.referenceType="full"}function s(g){this.data.characterReferenceType=g.type}function p(g){let u=this.sliceSerialize(g),t=this.data.characterReferenceType,W0;if(t)W0=bF(u,t==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0;else W0=nJ(u);let I0=this.stack[this.stack.length-1];I0.value+=W0}function d(g){let u=this.stack.pop();u.position.end=U7(g.end)}function o(g){T.call(this,g);let u=this.stack[this.stack.length-1];u.url=this.sliceSerialize(g)}function Z0(g){T.call(this,g);let u=this.stack[this.stack.length-1];u.url="mailto:"+this.sliceSerialize(g)}function H0(){return{type:"blockquote",children:[]}}function G0(){return{type:"code",lang:null,meta:null,value:""}}function X0(){return{type:"inlineCode",value:""}}function Y0(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function V0(){return{type:"emphasis",children:[]}}function N0(){return{type:"heading",depth:0,children:[]}}function F0(){return{type:"break"}}function n(){return{type:"html",value:""}}function a(){return{type:"image",title:null,url:"",alt:null}}function e(){return{type:"link",title:null,url:"",children:[]}}function $0(g){return{type:"list",ordered:g.type==="listOrdered",start:null,spread:g._spread,children:[]}}function Q0(g){return{type:"listItem",spread:g._spread,checked:null,children:[]}}function _0(){return{type:"paragraph",children:[]}}function M0(){return{type:"strong",children:[]}}function A0(){return{type:"text",value:""}}function L0(){return{type:"thematicBreak"}}}function U7($){return{line:$.line,column:$.column,offset:$.offset}}function Sm($,Z){let J=-1;while(++J<Z.length){let H=Z[J];if(Array.isArray(H))Sm($,H);else ZJ0($,H)}}function ZJ0($,Z){let J;for(J in Z)if(Em.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 wm($,Z){if($)throw Error("Cannot close `"+$.type+"` ("+X7({start:$.start,end:$.end})+"): a different token (`"+Z.type+"`, "+X7({start:Z.start,end:Z.end})+") is open");else throw Error("Cannot close document, a token (`"+Z.type+"`, "+X7({start:Z.start,end:Z.end})+") is still open")}function cF($){let Z=this;Z.parser=J;function J(H){return jM(H,{...Z.data("settings"),...$,extensions:Z.data("micromarkExtensions")||[],mdastExtensions:Z.data("fromMarkdownExtensions")||[]})}}var dF=-1,sJ=0,c$=1,tJ=2,rB=3,aB=4,oB=5,nB=6,lF=7,iF=8;var Rm=typeof self==="object"?self:globalThis,JJ0=($,Z)=>{let J=(Q,B)=>{return $.set(B,Q),Q},H=(Q)=>{if($.has(Q))return $.get(Q);let[B,X]=Z[Q];switch(B){case sJ:case dF:return J(X,Q);case c$:{let z=J([],Q);for(let G of X)z.push(H(G));return z}case tJ:{let z=J({},Q);for(let[G,U]of X)z[H(G)]=H(U);return z}case rB:return J(new Date(X),Q);case aB:{let{source:z,flags:G}=X;return J(new RegExp(z,G),Q)}case oB:{let z=J(new Map,Q);for(let[G,U]of X)z.set(H(G),H(U));return z}case nB:{let z=J(new Set,Q);for(let G of X)z.add(H(G));return z}case lF:{let{name:z,message:G}=X;return J(new Rm[z](G),Q)}case iF:return J(BigInt(X),Q);case"BigInt":return J(Object(BigInt(X)),Q);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 Rm[B](X),Q)};return H},OM=($)=>JJ0(new Map,$)(0);var eJ="",{toString:HJ0}={},{keys:QJ0}=Object,sB=($)=>{let Z=typeof $;if(Z!=="object"||!$)return[sJ,Z];let J=HJ0.call($).slice(8,-1);switch(J){case"Array":return[c$,eJ];case"Object":return[tJ,eJ];case"Date":return[rB,eJ];case"RegExp":return[aB,eJ];case"Map":return[oB,eJ];case"Set":return[nB,eJ];case"DataView":return[c$,J]}if(J.includes("Array"))return[c$,J];if(J.includes("Error"))return[lF,J];return[tJ,J]},rF=([$,Z])=>$===sJ&&(Z==="function"||Z==="symbol"),BJ0=($,Z,J,H)=>{let Q=(X,z)=>{let G=H.push(X)-1;return J.set(z,G),G},B=(X)=>{if(J.has(X))return J.get(X);let[z,G]=sB(X);switch(z){case sJ:{let K=X;switch(G){case"bigint":z=iF,K=X.toString();break;case"function":case"symbol":if($)throw TypeError("unable to serialize "+G);K=null;break;case"undefined":return Q([dF],X)}return Q([z,K],X)}case c$:{if(G){let F=X;if(G==="DataView")F=new Uint8Array(X.buffer);else if(G==="ArrayBuffer")F=new Uint8Array(X);return Q([G,[...F]],X)}let K=[],Y=Q([z,K],X);for(let F of X)K.push(B(F));return Y}case tJ:{if(G)switch(G){case"BigInt":return Q([G,X.toString()],X);case"Boolean":case"Number":case"String":return Q([G,X.valueOf()],X)}if(Z&&"toJSON"in X)return B(X.toJSON());let K=[],Y=Q([z,K],X);for(let F of QJ0(X))if($||!rF(sB(X[F])))K.push([B(F),B(X[F])]);return Y}case rB:return Q([z,X.toISOString()],X);case aB:{let{source:K,flags:Y}=X;return Q([z,{source:K,flags:Y}],X)}case oB:{let K=[],Y=Q([z,K],X);for(let[F,W]of X)if($||!(rF(sB(F))||rF(sB(W))))K.push([B(F),B(W)]);return Y}case nB:{let K=[],Y=Q([z,K],X);for(let F of X)if($||!rF(sB(F)))K.push(B(F));return Y}}let{message:U}=X;return Q([z,{name:G,message:U}],X)};return B},TM=($,{json:Z,lossy:J}={})=>{let H=[];return BJ0(!(Z||J),!!Z,new Map,H)($),H};var $H=typeof structuredClone==="function"?($,Z)=>Z&&(("json"in Z)||("lossy"in Z))?OM(TM($,Z)):structuredClone($):($,Z)=>OM(TM($,Z));function XJ0($,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 zJ0($,Z){return"Back to reference "+($+1)+(Z>1?"-"+Z:"")}function Im($){let Z=typeof $.options.clobberPrefix==="string"?$.options.clobberPrefix:"user-content-",J=$.options.footnoteBackContent||XJ0,H=$.options.footnoteBackLabel||zJ0,Q=$.options.footnoteLabel||"Footnotes",B=$.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 K=$.all(U),Y=String(U.identifier).toUpperCase(),F=x8(Y.toLowerCase()),W=0,q=[],N=$.footnoteCounts.get(Y);while(N!==void 0&&++W<=N){if(q.length>0)q.push({type:"text",value:" "});let D=typeof J==="string"?J:J(G,W);if(typeof D==="string")D={type:"text",value:D};q.push({type:"element",tagName:"a",properties:{href:"#"+Z+"fnref-"+F+(W>1?"-"+W:""),dataFootnoteBackref:"",ariaLabel:typeof H==="string"?H:H(G,W),className:["data-footnote-backref"]},children:Array.isArray(D)?D:[D]})}let V=K[K.length-1];if(V&&V.type==="element"&&V.tagName==="p"){let D=V.children[V.children.length-1];if(D&&D.type==="text")D.value+=" ";else V.children.push({type:"text",value:" "});V.children.push(...q)}else K.push(...q);let A={type:"element",tagName:"li",properties:{id:Z+"fn-"+F},children:$.wrap(K,!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:B,properties:{...$H(X),id:"footnote-label"},children:[{type:"text",value:Q}]},{type:"text",value:`
21
- `},{type:"element",tagName:"ol",properties:{},children:$.wrap(z,!0)},{type:"text",value:`
22
- `}]}}var $3=function($){if($===null||$===void 0)return YJ0;if(typeof $==="function")return aF($);if(typeof $==="object")return Array.isArray($)?GJ0($):UJ0($);if(typeof $==="string")return KJ0($);throw Error("Expected function, string, or object as test")};function GJ0($){let Z=[],J=-1;while(++J<$.length)Z[J]=$3($[J]);return aF(H);function H(...Q){let B=-1;while(++B<Z.length)if(Z[B].apply(this,Q))return!0;return!1}}function UJ0($){let Z=$;return aF(J);function J(H){let Q=H,B;for(B in $)if(Q[B]!==Z[B])return!1;return!0}}function KJ0($){return aF(Z);function Z(J){return J&&J.type===$}}function aF($){return Z;function Z(J,H,Q){return Boolean(FJ0(J)&&$.call(this,J,typeof H==="number"?H:void 0,Q||void 0))}}function YJ0(){return!0}function FJ0($){return $!==null&&typeof $==="object"&&"type"in $}function km($){return $}var bm=[],oF=!0,d$=!1,nF="skip";function tB($,Z,J,H){let Q;if(typeof Z==="function"&&typeof J!=="function")H=J,J=Z;else Q=Z;let B=$3(Q),X=H?-1:1;z($,void 0,[])();function z(G,U,K){let Y=G&&typeof G==="object"?G:{};if(typeof Y.type==="string"){let W=typeof Y.tagName==="string"?Y.tagName:typeof Y.name==="string"?Y.name:void 0;Object.defineProperty(F,"name",{value:"node ("+km(G.type+(W?"<"+W+">":""))+")"})}return F;function F(){let W=bm,q,N,V;if(!Z||B(G,U,K[K.length-1]||void 0)){if(W=WJ0(J(G,K)),W[0]===d$)return W}if("children"in G&&G.children){let A=G;if(A.children&&W[0]!==nF){N=(H?A.children.length:-1)+X,V=K.concat(A);while(N>-1&&N<A.children.length){let D=A.children[N];if(q=z(D,N,V)(),q[0]===d$)return q;N=typeof q[1]==="number"?q[1]:N+X}}}return W}}}function WJ0($){if(Array.isArray($))return $;if(typeof $==="number")return[oF,$];return $===null||$===void 0?bm:[$]}function k3($,Z,J,H){let Q,B,X;if(typeof Z==="function"&&typeof J!=="function")B=void 0,X=Z,Q=J;else B=Z,X=J,Q=H;tB($,B,z,Q);function z(G,U){let K=U[U.length-1],Y=K?K.children.indexOf(G):void 0;return X(G,Y,K)}}function ym($,Z){let J={type:"element",tagName:"blockquote",properties:{},children:$.wrap($.all(Z),!0)};return $.patch(Z,J),$.applyData(Z,J)}function xm($,Z){let J={type:"element",tagName:"br",properties:{},children:[]};return $.patch(Z,J),[$.applyData(Z,J),{type:"text",value:`
23
- `}]}function hm($,Z){let J=Z.value?Z.value+`
24
- `:"",H={},Q=Z.lang?Z.lang.split(/\s+/):[];if(Q.length>0)H.className=["language-"+Q[0]];let B={type:"element",tagName:"code",properties:H,children:[{type:"text",value:J}]};if(Z.meta)B.data={meta:Z.meta};return $.patch(Z,B),B=$.applyData(Z,B),B={type:"element",tagName:"pre",properties:{},children:[B]},$.patch(Z,B),B}function vm($,Z){let J={type:"element",tagName:"del",properties:{},children:$.all(Z)};return $.patch(Z,J),$.applyData(Z,J)}function gm($,Z){let J={type:"element",tagName:"em",properties:{},children:$.all(Z)};return $.patch(Z,J),$.applyData(Z,J)}function fm($,Z){let J=typeof $.options.clobberPrefix==="string"?$.options.clobberPrefix:"user-content-",H=String(Z.identifier).toUpperCase(),Q=x8(H.toLowerCase()),B=$.footnoteOrder.indexOf(H),X,z=$.footnoteCounts.get(H);if(z===void 0)z=0,$.footnoteOrder.push(H),X=$.footnoteOrder.length;else X=B+1;z+=1,$.footnoteCounts.set(H,z);let G={type:"element",tagName:"a",properties:{href:"#"+J+"fn-"+Q,id:J+"fnref-"+Q+(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 mm($,Z){let J={type:"element",tagName:"h"+Z.depth,properties:{},children:$.all(Z)};return $.patch(Z,J),$.applyData(Z,J)}function um($,Z){if($.options.allowDangerousHtml){let J={type:"raw",value:Z.value};return $.patch(Z,J),$.applyData(Z,J)}return}function sF($,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 Q=$.all(Z),B=Q[0];if(B&&B.type==="text")B.value="["+B.value;else Q.unshift({type:"text",value:"["});let X=Q[Q.length-1];if(X&&X.type==="text")X.value+=H;else Q.push({type:"text",value:H});return Q}function pm($,Z){let J=String(Z.identifier).toUpperCase(),H=$.definitionById.get(J);if(!H)return sF($,Z);let Q={src:x8(H.url||""),alt:Z.alt};if(H.title!==null&&H.title!==void 0)Q.title=H.title;let B={type:"element",tagName:"img",properties:Q,children:[]};return $.patch(Z,B),$.applyData(Z,B)}function cm($,Z){let J={src:x8(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 dm($,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 lm($,Z){let J=String(Z.identifier).toUpperCase(),H=$.definitionById.get(J);if(!H)return sF($,Z);let Q={href:x8(H.url||"")};if(H.title!==null&&H.title!==void 0)Q.title=H.title;let B={type:"element",tagName:"a",properties:Q,children:$.all(Z)};return $.patch(Z,B),$.applyData(Z,B)}function im($,Z){let J={href:x8(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 rm($,Z,J){let H=$.all(Z),Q=J?qJ0(J):am(Z),B={},X=[];if(typeof Z.checked==="boolean"){let K=H[0],Y;if(K&&K.type==="element"&&K.tagName==="p")Y=K;else Y={type:"element",tagName:"p",properties:{},children:[]},H.unshift(Y);if(Y.children.length>0)Y.children.unshift({type:"text",value:" "});Y.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:Z.checked,disabled:!0},children:[]}),B.className=["task-list-item"]}let z=-1;while(++z<H.length){let K=H[z];if(Q||z!==0||K.type!=="element"||K.tagName!=="p")X.push({type:"text",value:`
25
- `});if(K.type==="element"&&K.tagName==="p"&&!Q)X.push(...K.children);else X.push(K)}let G=H[H.length-1];if(G&&(Q||G.type!=="element"||G.tagName!=="p"))X.push({type:"text",value:`
26
- `});let U={type:"element",tagName:"li",properties:B,children:X};return $.patch(Z,U),$.applyData(Z,U)}function qJ0($){let Z=!1;if($.type==="list"){Z=$.spread||!1;let J=$.children,H=-1;while(!Z&&++H<J.length)Z=am(J[H])}return Z}function am($){let Z=$.spread;return Z===null||Z===void 0?$.children.length>1:Z}function om($,Z){let J={},H=$.all(Z),Q=-1;if(typeof Z.start==="number"&&Z.start!==1)J.start=Z.start;while(++Q<H.length){let X=H[Q];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 B={type:"element",tagName:Z.ordered?"ol":"ul",properties:J,children:$.wrap(H,!0)};return $.patch(Z,B),$.applyData(Z,B)}function nm($,Z){let J={type:"element",tagName:"p",properties:{},children:$.all(Z)};return $.patch(Z,J),$.applyData(Z,J)}function sm($,Z){let J={type:"root",children:$.wrap($.all(Z))};return $.patch(Z,J),$.applyData(Z,J)}function tm($,Z){let J={type:"element",tagName:"strong",properties:{},children:$.all(Z)};return $.patch(Z,J),$.applyData(Z,J)}function em($,Z){let J=$.all(Z),H=J.shift(),Q=[];if(H){let X={type:"element",tagName:"thead",properties:{},children:$.wrap([H],!0)};$.patch(Z.children[0],X),Q.push(X)}if(J.length>0){let X={type:"element",tagName:"tbody",properties:{},children:$.wrap(J,!0)},z=oJ(Z.children[1]),G=IF(Z.children[Z.children.length-1]);if(z&&G)X.position={start:z,end:G};Q.push(X)}let B={type:"element",tagName:"table",properties:{},children:$.wrap(Q,!0)};return $.patch(Z,B),$.applyData(Z,B)}function $u($,Z,J){let H=J?J.children:void 0,B=(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 Y=Z.children[G],F={},W=X?X[G]:void 0;if(W)F.align=W;let q={type:"element",tagName:B,properties:F,children:[]};if(Y)q.children=$.all(Y),$.patch(Y,q),q=$.applyData(Y,q);U.push(q)}let K={type:"element",tagName:"tr",properties:{},children:$.wrap(U,!0)};return $.patch(Z,K),$.applyData(Z,K)}function Zu($,Z){let J={type:"element",tagName:"td",properties:{},children:$.all(Z)};return $.patch(Z,J),$.applyData(Z,J)}function Hu($){let Z=String($),J=/\r?\n|\r/g,H=J.exec(Z),Q=0,B=[];while(H)B.push(Ju(Z.slice(Q,H.index),Q>0,!0),H[0]),Q=H.index+H[0].length,H=J.exec(Z);return B.push(Ju(Z.slice(Q),Q>0,!1)),B.join("")}function Ju($,Z,J){let H=0,Q=$.length;if(Z){let B=$.codePointAt(H);while(B===9||B===32)H++,B=$.codePointAt(H)}if(J){let B=$.codePointAt(Q-1);while(B===9||B===32)Q--,B=$.codePointAt(Q-1)}return Q>H?$.slice(H,Q):""}function Qu($,Z){let J={type:"text",value:Hu(String(Z.value))};return $.patch(Z,J),$.applyData(Z,J)}function Bu($,Z){let J={type:"element",tagName:"hr",properties:{},children:[]};return $.patch(Z,J),$.applyData(Z,J)}var Xu={blockquote:ym,break:xm,code:hm,delete:vm,emphasis:gm,footnoteReference:fm,heading:mm,html:um,imageReference:pm,image:cm,inlineCode:dm,linkReference:lm,link:im,listItem:rm,list:om,paragraph:nm,root:sm,strong:tm,table:em,tableCell:Zu,tableRow:$u,text:Qu,thematicBreak:Bu,toml:tF,yaml:tF,definition:tF,footnoteDefinition:tF};function tF(){return}var CM={}.hasOwnProperty,NJ0={};function Gu($,Z){let J=Z||NJ0,H=new Map,Q=new Map,B=new Map,X={...Xu,...J.handlers},z={all:U,applyData:VJ0,definitionById:H,footnoteById:Q,footnoteCounts:B,footnoteOrder:[],handlers:X,one:G,options:J,patch:AJ0,wrap:LJ0};return k3($,function(K){if(K.type==="definition"||K.type==="footnoteDefinition"){let Y=K.type==="definition"?H:Q,F=String(K.identifier).toUpperCase();if(!Y.has(F))Y.set(F,K)}}),z;function G(K,Y){let F=K.type,W=z.handlers[F];if(CM.call(z.handlers,F)&&W)return W(z,K,Y);if(z.options.passThrough&&z.options.passThrough.includes(F)){if("children"in K){let{children:N,...V}=K,A=$H(V);return A.children=z.all(K),A}return $H(K)}return(z.options.unknownHandler||DJ0)(z,K,Y)}function U(K){let Y=[];if("children"in K){let F=K.children,W=-1;while(++W<F.length){let q=z.one(F[W],K);if(q){if(W&&F[W-1].type==="break"){if(!Array.isArray(q)&&q.type==="text")q.value=zu(q.value);if(!Array.isArray(q)&&q.type==="element"){let N=q.children[0];if(N&&N.type==="text")N.value=zu(N.value)}}if(Array.isArray(q))Y.push(...q);else Y.push(q)}}}return Y}}function AJ0($,Z){if($.position)Z.position=ZM($)}function VJ0($,Z){let J=Z;if($&&$.data){let H=$.data.hName,Q=$.data.hChildren,B=$.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"&&B)Object.assign(J.properties,$H(B));if("children"in J&&J.children&&Q!==null&&Q!==void 0)J.children=Q}return J}function DJ0($,Z){let J=Z.data||{},H="value"in Z&&!(CM.call(J,"hProperties")||CM.call(J,"hChildren"))?{type:"text",value:Z.value}:{type:"element",tagName:"div",properties:{},children:$.all(Z)};return $.patch(Z,H),$.applyData(Z,H)}function LJ0($,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 zu($){let Z=0,J=$.charCodeAt(Z);while(J===9||J===32)Z++,J=$.charCodeAt(Z);return $.slice(Z)}function eF($,Z){let J=Gu($,Z),H=J.one($,void 0),Q=Im(J),B=Array.isArray(H)?{type:"root",children:H}:H||{type:"root",children:[]};if(Q)n1("children"in B),B.children.push({type:"text",value:`
30
- `},Q);return B}function $W($,Z){if($&&"run"in $)return async function(J,H){let Q=eF(J,{file:H,...Z});await $.run(Q,H)};return function(J,H){return eF(J,{file:H,...$||Z})}}function wM($){if($)throw $}var HW=P(Vu(),1);function eB($){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 EM(){let $=[],Z={run:J,use:H};return Z;function J(...Q){let B=-1,X=Q.pop();if(typeof X!=="function")throw TypeError("Expected function as last argument, not "+X);z(null,...Q);function z(G,...U){let K=$[++B],Y=-1;if(G){X(G);return}while(++Y<Q.length)if(U[Y]===null||U[Y]===void 0)U[Y]=Q[Y];if(Q=U,K)Du(K,z)(...U);else X(null,...U)}}function H(Q){if(typeof Q!=="function")throw TypeError("Expected `middelware` to be a function, not "+Q);return $.push(Q),Z}}function Du($,Z){let J;return H;function H(...X){let z=$.length>X.length,G;if(z)X.push(Q);try{G=$.apply(this,X)}catch(U){let K=U;if(z&&J)throw K;return Q(K)}if(!z)if(G&&G.then&&typeof G.then==="function")G.then(B,Q);else if(G instanceof Error)Q(G);else B(G)}function Q(X,...z){if(!J)J=!0,Z(X,...z)}function B(X){Q(null,X)}}var Q9={basename:MJ0,dirname:PJ0,extname:_J0,join:jJ0,sep:"/"};function MJ0($,Z){if(Z!==void 0&&typeof Z!=="string")throw TypeError('"ext" argument must be a string');$X($);let J=0,H=-1,Q=$.length,B;if(Z===void 0||Z.length===0||Z.length>$.length){while(Q--)if($.codePointAt(Q)===47){if(B){J=Q+1;break}}else if(H<0)B=!0,H=Q+1;return H<0?"":$.slice(J,H)}if(Z===$)return"";let X=-1,z=Z.length-1;while(Q--)if($.codePointAt(Q)===47){if(B){J=Q+1;break}}else{if(X<0)B=!0,X=Q+1;if(z>-1)if($.codePointAt(Q)===Z.codePointAt(z--)){if(z<0)H=Q}else z=-1,H=X}if(J===H)H=X;else if(H<0)H=$.length;return $.slice(J,H)}function PJ0($){if($X($),$.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 _J0($){$X($);let Z=$.length,J=-1,H=0,Q=-1,B=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(Q<0)Q=Z;else if(B!==1)B=1}else if(Q>-1)B=-1}if(Q<0||J<0||B===0||B===1&&Q===J-1&&Q===H+1)return"";return $.slice(Q,J)}function jJ0(...$){let Z=-1,J;while(++Z<$.length)if($X($[Z]),$[Z])J=J===void 0?$[Z]:J+"/"+$[Z];return J===void 0?".":OJ0(J)}function OJ0($){$X($);let Z=$.codePointAt(0)===47,J=TJ0($,!Z);if(J.length===0&&!Z)J=".";if(J.length>0&&$.codePointAt($.length-1)===47)J+="/";return Z?"/"+J:J}function TJ0($,Z){let J="",H=0,Q=-1,B=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(Q===X-1||B===1);else if(Q!==X-1&&B===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("/");Q=X,B=0;continue}}else if(J.length>0){J="",H=0,Q=X,B=0;continue}}if(Z)J=J.length>0?J+"/..":"..",H=2}else{if(J.length>0)J+="/"+$.slice(Q+1,X);else J=$.slice(Q+1,X);H=X-Q-1}Q=X,B=0}else if(z===46&&B>-1)B++;else B=-1}return J}function $X($){if(typeof $!=="string")throw TypeError("Path must be a string. Received "+JSON.stringify($))}var Lu={cwd:CJ0};function CJ0(){return"/"}function ZH($){return Boolean($!==null&&typeof $==="object"&&"href"in $&&$.href&&"protocol"in $&&$.protocol&&$.auth===void 0)}function Mu($){if(typeof $==="string")$=new URL($);else if(!ZH($)){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 wJ0($)}function wJ0($){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 Q=TypeError("File URL path must not include encoded / characters");throw Q.code="ERR_INVALID_FILE_URL_PATH",Q}}return decodeURIComponent(Z)}var SM=["history","path","basename","stem","extname","dirname"];class JH{constructor($){let Z;if(!$)Z={};else if(ZH($))Z={path:$};else if(typeof $==="string"||EJ0($))Z={value:$};else Z=$;this.cwd="cwd"in Z?"":Lu.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let J=-1;while(++J<SM.length){let Q=SM[J];if(Q in Z&&Z[Q]!==void 0&&Z[Q]!==null)this[Q]=Q==="history"?[...Z[Q]]:Z[Q]}let H;for(H in Z)if(!SM.includes(H))this[H]=Z[H]}get basename(){return typeof this.path==="string"?Q9.basename(this.path):void 0}set basename($){IM($,"basename"),RM($,"basename"),this.path=Q9.join(this.dirname||"",$)}get dirname(){return typeof this.path==="string"?Q9.dirname(this.path):void 0}set dirname($){Pu(this.basename,"dirname"),this.path=Q9.join($||"",this.basename)}get extname(){return typeof this.path==="string"?Q9.extname(this.path):void 0}set extname($){if(RM($,"extname"),Pu(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=Q9.join(this.dirname,this.stem+($||""))}get path(){return this.history[this.history.length-1]}set path($){if(ZH($))$=Mu($);if(IM($,"path"),this.path!==$)this.history.push($)}get stem(){return typeof this.path==="string"?Q9.basename(this.path,this.extname):void 0}set stem($){IM($,"stem"),RM($,"stem"),this.path=Q9.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 K2($,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 RM($,Z){if($&&$.includes(Q9.sep))throw Error("`"+Z+"` cannot be a path: did not expect `"+Q9.sep+"`")}function IM($,Z){if(!$)throw Error("`"+Z+"` cannot be empty")}function Pu($,Z){if(!$)throw Error("Setting `"+Z+"` requires `path` to be set too")}function EJ0($){return Boolean($&&typeof $==="object"&&"byteLength"in $&&"byteOffset"in $)}var _u=function($){let H=this.constructor.prototype,Q=H[$],B=function(){return Q.apply(B,arguments)};return Object.setPrototypeOf(B,H),B};var SJ0={}.hasOwnProperty;class xM extends _u{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=EM()}copy(){let $=new xM,Z=-1;while(++Z<this.attachers.length){let J=this.attachers[Z];$.use(...J)}return $.data(HW.default(!0,{},this.namespace)),$}data($,Z){if(typeof $==="string"){if(arguments.length===2)return yM("data",this.frozen),this.namespace[$]=Z,this;return SJ0.call(this.namespace,$)&&this.namespace[$]||void 0}if($)return yM("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=JW($),J=this.parser||this.Parser;return kM("parse",J),J(String(Z),Z)}process($,Z){let J=this;return this.freeze(),kM("process",this.parser||this.Parser),bM("process",this.compiler||this.Compiler),Z?H(void 0,Z):new Promise(H);function H(Q,B){let X=JW($),z=J.parse(X);J.run(z,X,function(U,K,Y){if(U||!K||!Y)return G(U);let F=K,W=J.stringify(F,Y);if(IJ0(W))Y.value=W;else Y.result=W;G(U,Y)});function G(U,K){if(U||!K)B(U);else if(Q)Q(K);else n1(Z,"`done` is defined if `resolve` is not"),Z(void 0,K)}}}processSync($){let Z=!1,J;return this.freeze(),kM("processSync",this.parser||this.Parser),bM("processSync",this.compiler||this.Compiler),this.process($,H),Ou("processSync","process",Z),n1(J,"we either bailed on an error or have a tree"),J;function H(Q,B){Z=!0,wM(Q),J=B}}run($,Z,J){ju($),this.freeze();let H=this.transformers;if(!J&&typeof Z==="function")J=Z,Z=void 0;return J?Q(void 0,J):new Promise(Q);function Q(B,X){n1(typeof Z!=="function","`file` can’t be a `done` anymore, we checked");let z=JW(Z);H.run($,z,G);function G(U,K,Y){let F=K||$;if(U)X(U);else if(B)B(F);else n1(J,"`done` is defined if `resolve` is not"),J(void 0,F,Y)}}}runSync($,Z){let J=!1,H;return this.run($,Z,Q),Ou("runSync","run",J),n1(H,"we either bailed on an error or have a tree"),H;function Q(B,X){wM(B),H=X,J=!0}}stringify($,Z){this.freeze();let J=JW(Z),H=this.compiler||this.Compiler;return bM("stringify",H),ju($),H($,J)}use($,...Z){let J=this.attachers,H=this.namespace;if(yM("use",this.frozen),$===null||$===void 0);else if(typeof $==="function")z($,Z);else if(typeof $==="object")if(Array.isArray($))X($);else B($);else throw TypeError("Expected usable value, not `"+$+"`");return this;function Q(G){if(typeof G==="function")z(G,[]);else if(typeof G==="object")if(Array.isArray(G)){let[U,...K]=G;z(U,K)}else B(G);else throw TypeError("Expected usable value, not `"+G+"`")}function B(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=HW.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 K=G[U];Q(K)}else throw TypeError("Expected a list of plugins, not `"+G+"`")}function z(G,U){let K=-1,Y=-1;while(++K<J.length)if(J[K][0]===G){Y=K;break}if(Y===-1)J.push([G,...U]);else if(U.length>0){let[F,...W]=U,q=J[Y][1];if(eB(q)&&eB(F))F=HW.default(!0,q,F);J[Y]=[G,F,...W]}}}}var hM=new xM().freeze();function kM($,Z){if(typeof Z!=="function")throw TypeError("Cannot `"+$+"` without `parser`")}function bM($,Z){if(typeof Z!=="function")throw TypeError("Cannot `"+$+"` without `compiler`")}function yM($,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 ju($){if(!eB($)||typeof $.type!=="string")throw TypeError("Expected node, got `"+$+"`")}function Ou($,Z,J){if(!J)throw Error("`"+$+"` finished async. Use `"+Z+"` instead")}function JW($){return RJ0($)?$:new JH($)}function RJ0($){return Boolean($&&typeof $==="object"&&"message"in $&&"messages"in $)}function IJ0($){return typeof $==="string"||kJ0($)}function kJ0($){return Boolean($&&typeof $==="object"&&"byteLength"in $&&"byteOffset"in $)}var bJ0="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Tu=[],Cu={allowDangerousHtml:!0},yJ0=/^(https?|ircs?|mailto|xmpp)$/i,xJ0=[{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 QW($){let Z=hJ0($),J=vJ0($);return gJ0(Z.runSync(Z.parse(J),J),$)}function hJ0($){let Z=$.rehypePlugins||Tu,J=$.remarkPlugins||Tu,H=$.remarkRehypeOptions?{...$.remarkRehypeOptions,...Cu}:Cu;return hM().use(cF).use(J).use($W,H).use(Z)}function vJ0($){let Z=$.children||"",J=new JH;if(typeof Z==="string")J.value=Z;else TF("Unexpected value `"+Z+"` for `children` prop, expected `string`");return J}function gJ0($,Z){let{allowedElements:J,allowElement:H,components:Q,disallowedElements:B,skipHtml:X,unwrapDisallowed:z}=Z,G=Z.urlTransform||BW;for(let K of xJ0)if(Object.hasOwn(Z,K.from))TF("Unexpected `"+K.from+"` prop, "+(K.to?"use `"+K.to+"` instead":"remove it")+" (see <"+bJ0+"#"+K.id+"> for more info)");if(J&&B)TF("Unexpected combined `allowedElements` and `disallowedElements`, expected one or the other");return k3($,U),QM($,{Fragment:HH.Fragment,components:Q,ignoreInvalidStyle:!0,jsx:HH.jsx,jsxs:HH.jsxs,passKeys:!0,passNode:!0});function U(K,Y,F){if(K.type==="raw"&&F&&typeof Y==="number"){if(X)F.children.splice(Y,1);else F.children[Y]={type:"text",value:K.value};return Y}if(K.type==="element"){let W;for(W in uB)if(Object.hasOwn(uB,W)&&Object.hasOwn(K.properties,W)){let q=K.properties[W],N=uB[W];if(N===null||N.includes(K.tagName))K.properties[W]=G(String(q||""),W,K)}}if(K.type==="element"){let W=J?!J.includes(K.tagName):B?B.includes(K.tagName):!1;if(!W&&H&&typeof Y==="number")W=!H(K,Y,F);if(W&&F&&typeof Y==="number"){if(z&&K.children)F.children.splice(Y,1,...K.children);else F.children.splice(Y,1);return Y}}}}function BW($){let Z=$.indexOf(":"),J=$.indexOf("?"),H=$.indexOf("#"),Q=$.indexOf("/");if(Z===-1||Q!==-1&&Z>Q||J!==-1&&Z>J||H!==-1&&Z>H||yJ0.test($.slice(0,Z)))return $;return""}var XW=function($,Z,J){let H=$3(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 b3=function($){if($===null||$===void 0)return uJ0;if(typeof $==="string")return mJ0($);if(typeof $==="object")return fJ0($);if(typeof $==="function")return vM($);throw Error("Expected function, string, or array as `test`")};function fJ0($){let Z=[],J=-1;while(++J<$.length)Z[J]=b3($[J]);return vM(H);function H(...Q){let B=-1;while(++B<Z.length)if(Z[B].apply(this,Q))return!0;return!1}}function mJ0($){return vM(Z);function Z(J){return J.tagName===$}}function vM($){return Z;function Z(J,H,Q){return Boolean(pJ0(J)&&$.call(this,J,typeof H==="number"?H:void 0,Q||void 0))}}function uJ0($){return Boolean($&&typeof $==="object"&&"type"in $&&$.type==="element"&&"tagName"in $&&typeof $.tagName==="string")}function pJ0($){return $!==null&&typeof $==="object"&&"type"in $&&"tagName"in $}var Eu=/\n/g,Su=/[\t ]+/g,gM=b3("br"),Ru=b3(oJ0),cJ0=b3("p"),Iu=b3("tr"),dJ0=b3(["datalist","head","noembed","noframes","noscript","rp","script","style","template","title",aJ0,nJ0]),ku=b3(["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 fM($,Z){let J=Z||{},H="children"in $?$.children:[],Q=ku($),B=xu($,{whitespace:J.whitespace||"normal",breakBefore:!1,breakAfter:!1}),X=[];if($.type==="text"||$.type==="comment")X.push(...yu($,{whitespace:B,breakBefore:!0,breakAfter:!0}));let z=-1;while(++z<H.length)X.push(...bu(H[z],$,{whitespace:B,breakBefore:z?void 0:Q,breakAfter:z<H.length-1?gM(H[z+1]):Q}));let G=[],U;z=-1;while(++z<X.length){let K=X[z];if(typeof K==="number"){if(U!==void 0&&K>U)U=K}else if(K){if(U!==void 0&&U>-1)G.push(`
31
- `.repeat(U)||" ");U=-1,G.push(K)}}return G.join("")}function bu($,Z,J){if($.type==="element")return lJ0($,Z,J);if($.type==="text")return J.whitespace==="normal"?yu($,J):iJ0($);return[]}function lJ0($,Z,J){let H=xu($,J),Q=$.children||[],B=-1,X=[];if(dJ0($))return X;let z,G;if(gM($))G=`
32
- `;else if(Iu($)&&XW(Z,$,Iu))G=`
33
- `;else if(cJ0($))z=2,G=2;else if(ku($))z=1,G=1;while(++B<Q.length)X=X.concat(bu(Q[B],$,{whitespace:H,breakBefore:B?void 0:z,breakAfter:B<Q.length-1?gM(Q[B+1]):G}));if(Ru($)&&XW(Z,$,Ru))X.push("\t");if(z)X.unshift(z);if(G)X.push(G);return X}function yu($,Z){let J=String($.value),H=[],Q=[],B=0;while(B<=J.length){Eu.lastIndex=B;let G=Eu.exec(J),U=G&&"index"in G?G.index:J.length;H.push(rJ0(J.slice(B,U).replace(/[\u061C\u200E\u200F\u202A-\u202E\u2066-\u2069]/g,""),B===0?Z.breakBefore:!0,U===J.length?Z.breakAfter:!0)),B=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)Q.push(H[X]),z=void 0;else if(H[X]){if(typeof z==="number")Q.push(z);Q.push(H[X]),z=0}else if(X===0||X===H.length-1)Q.push(0);return Q}function iJ0($){return[String($.value)]}function rJ0($,Z,J){let H=[],Q=0,B;while(Q<$.length){Su.lastIndex=Q;let X=Su.exec($);if(B=X?X.index:$.length,!Q&&!B&&X&&!Z)H.push("");if(Q!==B)H.push($.slice(Q,B));Q=X?B+X[0].length:B}if(Q!==B&&!J)H.push("");return H.join(" ")}function xu($,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 aJ0($){return Boolean(($.properties||{}).hidden)}function oJ0($){return $.tagName==="td"||$.tagName==="th"}function nJ0($){return $.tagName==="dialog"&&!($.properties||{}).open}function sJ0($){let Z=$.regex,J=$.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),H="decltype\\(auto\\)",Q="[a-zA-Z_]\\w*::",B="<[^<>]+>",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})"/})]},K={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},Y={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]},F={className:"title",begin:Z.optional("[a-zA-Z_]\\w*::")+$.IDENT_RE,relevance:0},W=Z.optional("[a-zA-Z_]\\w*::")+$.IDENT_RE+"\\s*\\(",q=["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"],N=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],V=["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"],j={type:N,keyword:q,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:V},M={className:"function.dispatch",relevance:0,keywords:{_hint:A},begin:Z.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,$.IDENT_RE,Z.lookahead(/(<[^<>]+>|)\s*\(/))},_=[M,Y,z,J,$.C_BLOCK_COMMENT_MODE,K,U],E={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:j,contains:_.concat([{begin:/\(/,end:/\)/,keywords:j,contains:_.concat(["self"]),relevance:0}]),relevance:0},C={className:"function",begin:"("+X+"[\\*&\\s]+)+"+W,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:j,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:"decltype\\(auto\\)",keywords:j,relevance:0},{begin:W,returnBegin:!0,contains:[F],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[U,K]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:j,relevance:0,contains:[J,$.C_BLOCK_COMMENT_MODE,U,K,z,{begin:/\(/,end:/\)/,keywords:j,relevance:0,contains:["self",J,$.C_BLOCK_COMMENT_MODE,U,K,z]}]},z,J,$.C_BLOCK_COMMENT_MODE,Y]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:j,illegal:"</",classNameAliases:{"function.dispatch":"built_in"},contains:[].concat(E,C,M,_,[Y,{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:j,contains:["self",z]},{begin:$.IDENT_RE+"::",keywords:j},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function hu($){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=sJ0($),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 vu($){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 Q={className:"subst",begin:/\$\(/,end:/\)/,contains:[$.BACKSLASH_ESCAPE]},B=$.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,Q]};Q.contains.push(z);let G={match:/\\"/},U={className:"string",begin:/'/,end:/'/},K={match:/\\'/},Y={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},$.NUMBER_MODE,J]},F=["fish","bash","zsh","sh","csh","ksh","tcsh","dash","scsh"],W=$.SHEBANG({binary:`(${F.join("|")})`,relevance:10}),q={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[$.inherit($.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0},N=["if","then","else","elif","fi","time","for","while","until","in","do","done","case","esac","coproc","function","select"],V=["true","false"],A={match:/(\/[a-z._-]+)+/},D=["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"],j=["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:N,literal:V,built_in:[...D,...L,"set","shopt",...j,...M]},contains:[W,$.SHEBANG(),q,Y,B,X,A,z,G,U,K,J]}}function gu($){let Z=$.regex,J=$.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),H="decltype\\(auto\\)",Q="[a-zA-Z_]\\w*::",B="<[^<>]+>",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})"/})]},K={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},Y={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]},F={className:"title",begin:Z.optional("[a-zA-Z_]\\w*::")+$.IDENT_RE,relevance:0},W=Z.optional("[a-zA-Z_]\\w*::")+$.IDENT_RE+"\\s*\\(",V={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=[Y,z,J,$.C_BLOCK_COMMENT_MODE,K,U],D={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:V,contains:A.concat([{begin:/\(/,end:/\)/,keywords:V,contains:A.concat(["self"]),relevance:0}]),relevance:0},L={begin:"("+X+"[\\*&\\s]+)+"+W,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:V,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:"decltype\\(auto\\)",keywords:V,relevance:0},{begin:W,returnBegin:!0,contains:[$.inherit(F,{className:"title.function"})],relevance:0},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:V,relevance:0,contains:[J,$.C_BLOCK_COMMENT_MODE,U,K,z,{begin:/\(/,end:/\)/,keywords:V,relevance:0,contains:["self",J,$.C_BLOCK_COMMENT_MODE,U,K,z]}]},z,J,$.C_BLOCK_COMMENT_MODE,Y]};return{name:"C",aliases:["h"],keywords:V,disableAutodetect:!0,illegal:"</",contains:[].concat(D,L,A,[Y,{begin:$.IDENT_RE+"::",keywords:V},{className:"class",beginKeywords:"enum class struct union",end:/[{;:<>=]/,contains:[{beginKeywords:"final class struct"},$.TITLE_MODE]}]),exports:{preprocessor:Y,strings:U,keywords:V}}}function fu($){let Z=$.regex,J=$.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),H="decltype\\(auto\\)",Q="[a-zA-Z_]\\w*::",B="<[^<>]+>",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})"/})]},K={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},Y={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]},F={className:"title",begin:Z.optional("[a-zA-Z_]\\w*::")+$.IDENT_RE,relevance:0},W=Z.optional("[a-zA-Z_]\\w*::")+$.IDENT_RE+"\\s*\\(",q=["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"],N=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],V=["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"],j={type:N,keyword:q,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:V},M={className:"function.dispatch",relevance:0,keywords:{_hint:A},begin:Z.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,$.IDENT_RE,Z.lookahead(/(<[^<>]+>|)\s*\(/))},_=[M,Y,z,J,$.C_BLOCK_COMMENT_MODE,K,U],E={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:j,contains:_.concat([{begin:/\(/,end:/\)/,keywords:j,contains:_.concat(["self"]),relevance:0}]),relevance:0},C={className:"function",begin:"("+X+"[\\*&\\s]+)+"+W,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:j,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:"decltype\\(auto\\)",keywords:j,relevance:0},{begin:W,returnBegin:!0,contains:[F],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[U,K]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:j,relevance:0,contains:[J,$.C_BLOCK_COMMENT_MODE,U,K,z,{begin:/\(/,end:/\)/,keywords:j,relevance:0,contains:["self",J,$.C_BLOCK_COMMENT_MODE,U,K,z]}]},z,J,$.C_BLOCK_COMMENT_MODE,Y]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:j,illegal:"</",classNameAliases:{"function.dispatch":"built_in"},contains:[].concat(E,C,M,_,[Y,{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:j,contains:["self",z]},{begin:$.IDENT_RE+"::",keywords:j},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function mu($){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"],Q=["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"],B=["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:Q.concat(B),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},K={className:"string",begin:'@"',end:'"',contains:[{begin:'""'}]},Y=$.inherit(K,{illegal:/\n/}),F={className:"subst",begin:/\{/,end:/\}/,keywords:X},W=$.inherit(F,{illegal:/\n/}),q={className:"string",begin:/\$"/,end:'"',illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},$.BACKSLASH_ESCAPE,W]},N={className:"string",begin:/\$@"/,end:'"',contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},F]},V=$.inherit(N,{illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},W]});F.contains=[N,q,K,$.APOS_STRING_MODE,$.QUOTE_STRING_MODE,G,$.C_BLOCK_COMMENT_MODE],W.contains=[V,q,Y,$.APOS_STRING_MODE,$.QUOTE_STRING_MODE,G,$.inherit($.C_BLOCK_COMMENT_MODE,{illegal:/\n/})];let A={variants:[U,N,q,K,$.APOS_STRING_MODE,$.QUOTE_STRING_MODE]},D={begin:"<",end:">",contains:[{beginKeywords:"in out"},z]},L=$.IDENT_RE+"(<"+$.IDENT_RE+"(\\s*,\\s*"+$.IDENT_RE+")*>)?(\\[\\])?",j={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,D,$.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,D,$.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,D],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]},j]}}var tJ0=($)=>{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_-]*/}}},eJ0=["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"],$H0=["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"],ZH0=[...eJ0,...$H0],JH0=["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(),HH0=["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(),QH0=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),BH0=["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 uu($){let Z=$.regex,J=tJ0($),H={begin:/-(webkit|moz|ms|o)-(?=[a-z])/},Q="and or not only",B=/@-?\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:":("+HH0.join("|")+")"},{begin:":(:)?("+QH0.join("|")+")"}]},J.CSS_VARIABLE,{className:"attribute",begin:"\\b("+BH0.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:B},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{$pattern:/[a-z-]+/,keyword:"and or not only",attribute:JH0.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...z,J.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+ZH0.join("|")+")\\b"}]}}function pu($){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 cu($){let B={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:B,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:B,illegal:/["']/}]}]}}function du($){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 lu($){let Z=$.regex,J={className:"number",relevance:0,variants:[{begin:/([+-]+)?[\d]+_[\d_]+/},{begin:$.NUMBER_RE}]},H=$.COMMENT();H.variants=[{begin:/;/,end:/$/},{begin:/#/,end:/$/}];let Q={className:"variable",variants:[{begin:/\$[\w\d"][\w\d_]*/},{begin:/\$\{(.*?)\}/}]},B={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,B,Q,X,J,"self"],relevance:0},G=/[A-Za-z0-9_-]+/,U=/"(\\"|[^"])*"/,K=/'[^']*'/,Y=Z.either(G,U,K),F=Z.concat(Y,"(\\s*\\.\\s*",Y,")*",Z.lookahead(/\s*=\s*[^#\s]/));return{name:"TOML, also INI",aliases:["toml"],case_insensitive:!0,illegal:/\S/,contains:[H,{className:"section",begin:/\[+/,end:/\]+/},{begin:F,className:"attr",starts:{end:/$/,contains:[H,z,B,Q,X,J]}}]}}var QH="[0-9](_*[0-9])*",zW=`\\.(${QH})`,GW="[0-9a-fA-F](_*[0-9a-fA-F])*",iu={className:"number",variants:[{begin:`(\\b(${QH})((${zW})|\\.)?|(${zW}))[eE][+-]?(${QH})[fFdD]?\\b`},{begin:`\\b(${QH})((${zW})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${zW})[fFdD]?\\b`},{begin:`\\b(${QH})[fFdD]\\b`},{begin:`\\b0[xX]((${GW})\\.?|(${GW})?\\.(${GW}))[pP][+-]?(${QH})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${GW})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function ru($,Z,J){if(J===-1)return"";return $.replace(Z,(H)=>{return ru($,Z,J-1)})}function au($){let Z=$.regex,J="[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*",H="[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*"+ru("(?:<"+"[À-ʸ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"]}]},K={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:[K,$.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,iu,$.C_BLOCK_COMMENT_MODE]},$.C_LINE_COMMENT_MODE,$.C_BLOCK_COMMENT_MODE]},iu,U]}}var XH0=["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"],zH0=["true","false","null","undefined","NaN","Infinity"],ou=["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"],nu=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],su=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],GH0=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],UH0=[].concat(su,ou,nu);function tu($){let Z=$.regex,J=(v,{after:f})=>{let w="</"+v[0].slice(1);return v.input.indexOf(w,f)!==-1},H="[A-Za-z$_][0-9A-Za-z$_]*",Q={begin:"<>",end:"</>"},B=/<[A-Za-z0-9\\._:-]+\s*\/>/,X={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(v,f)=>{let w=v[0].length+v.index,i=v.input[w];if(i==="<"||i===","){f.ignoreMatch();return}if(i===">"){if(!J(v,{after:w}))f.ignoreMatch()}let r,x=v.input.substring(w);if(r=x.match(/^\s*=/)){f.ignoreMatch();return}if(r=x.match(/^\s+extends\s+/)){if(r.index===0){f.ignoreMatch();return}}}},z={$pattern:"[A-Za-z$_][0-9A-Za-z$_]*",keyword:XH0,literal:zH0,built_in:UH0,"variable.language":GH0},G="[0-9](_?[0-9])*",U="\\.([0-9](_?[0-9])*)",K="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",Y={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},F={className:"subst",begin:"\\$\\{",end:"\\}",keywords:z,contains:[]},W={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[$.BACKSLASH_ESCAPE,F],subLanguage:"xml"}},q={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[$.BACKSLASH_ESCAPE,F],subLanguage:"css"}},N={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[$.BACKSLASH_ESCAPE,F],subLanguage:"graphql"}},V={className:"string",begin:"`",end:"`",contains:[$.BACKSLASH_ESCAPE,F]},D={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,q,N,V,{match:/\$\d+/},Y];F.contains=L.concat({begin:/\{/,end:/\}/,keywords:z,contains:["self"].concat(L)});let j=[].concat(D,F.contains),M=j.concat([{begin:/(\s*)\(/,end:/\)/,keywords:z,contains:["self"].concat(j)}]),_={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:z,contains:M},E={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:{_:[...ou,...nu]}},R={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:/%/},I={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function y(v){return Z.concat("(?!",v.join("|"),")")}let S={match:Z.concat(/\b/,y([...su,"super","import"].map((v)=>`${v}\\s*\\(`)),"[A-Za-z$_][0-9A-Za-z$_]*",Z.lookahead(/\s*\(/)),className:"title.function",relevance:0},O={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},b={match:[/get|set/,/\s+/,"[A-Za-z$_][0-9A-Za-z$_]*",/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},_]},k="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+$.UNDERSCORE_IDENT_RE+")\\s*=>",h={match:[/const|var|let/,/\s+/,"[A-Za-z$_][0-9A-Za-z$_]*",/\s*/,/=\s*/,/(async\s*)?/,Z.lookahead(k)],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}),R,$.APOS_STRING_MODE,$.QUOTE_STRING_MODE,W,q,N,V,D,{match:/\$\d+/},Y,C,{scope:"attr",match:"[A-Za-z$_][0-9A-Za-z$_]*"+Z.lookahead(":"),relevance:0},h,{begin:"("+$.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[D,$.REGEXP_MODE,{className:"function",begin:k,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:Q.begin,end:Q.end},{match:B},{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},O,{match:"\\$[A-Za-z$_][0-9A-Za-z$_]*",relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[_]},S,I,E,b,{match:/\$[(.]/}]}}function eu($){let Z={className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},J={match:/[{}[\],:]/,className:"punctuation",relevance:0},H=["true","false","null"],Q={scope:"literal",beginKeywords:H.join(" ")};return{name:"JSON",aliases:["jsonc"],keywords:{literal:H},contains:[Z,J,$.QUOTE_STRING_MODE,Q,$.C_NUMBER_MODE,$.C_LINE_COMMENT_MODE,$.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}var BH="[0-9](_*[0-9])*",UW=`\\.(${BH})`,KW="[0-9a-fA-F](_*[0-9a-fA-F])*",KH0={className:"number",variants:[{begin:`(\\b(${BH})((${UW})|\\.)?|(${UW}))[eE][+-]?(${BH})[fFdD]?\\b`},{begin:`\\b(${BH})((${UW})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${UW})[fFdD]?\\b`},{begin:`\\b(${BH})[fFdD]\\b`},{begin:`\\b0[xX]((${KW})\\.?|(${KW})?\\.(${KW}))[pP][+-]?(${BH})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${KW})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function $p($){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+"@"},Q={className:"subst",begin:/\$\{/,end:/\}/,contains:[$.C_NUMBER_MODE]},B={className:"variable",begin:"\\$"+$.UNDERSCORE_IDENT_RE},X={className:"string",variants:[{begin:'"""',end:'"""(?=[^"])',contains:[B,Q]},{begin:"'",end:"'",illegal:/\n/,contains:[$.BACKSLASH_ESCAPE]},{begin:'"',end:'"',illegal:/\n/,contains:[$.BACKSLASH_ESCAPE,B,Q]}]};Q.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=KH0,K=$.COMMENT("/\\*","\\*/",{contains:[$.C_BLOCK_COMMENT_MODE]}),Y={variants:[{className:"type",begin:$.UNDERSCORE_IDENT_RE},{begin:/\(/,end:/\)/,contains:[]}]},F=Y;return F.variants[1].contains=[Y],Y.variants[1].contains=[F],{name:"Kotlin",aliases:["kt","kts"],keywords:Z,contains:[$.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"}]}),$.C_LINE_COMMENT_MODE,K,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:[Y,$.C_LINE_COMMENT_MODE,K],relevance:0},$.C_LINE_COMMENT_MODE,K,z,G,X,$.C_NUMBER_MODE]},K]},{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 YH0=($)=>{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_-]*/}}},FH0=["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"],WH0=["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"],qH0=[...FH0,...WH0],NH0=["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(),Zp=["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(),Jp=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),AH0=["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(),VH0=Zp.concat(Jp).sort().reverse();function Hp($){let Z=YH0($),J=VH0,H="and or not only",Q="[\\w-]+",B="([\\w-]+|@\\{[\\w-]+\\})",X=[],z=[],G=function(L){return{className:"string",begin:"~?"+L+".*?"+L}},U=function(L,j,M){return{className:L,begin:j,relevance:M}},K={$pattern:/[a-z-]+/,keyword:"and or not only",attribute:NH0.join(" ")},Y={begin:"\\(",end:"\\)",contains:z,keywords:K,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,Y,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 F=z.concat({begin:/\{/,end:/\}/,contains:X}),W={beginKeywords:"when",endsWithParent:!0,contains:[{beginKeywords:"and not"}].concat(z)},q={begin:B+"\\s*:",returnBegin:!0,end:/[;}]/,relevance:0,contains:[{begin:/-(webkit|moz|ms|o)-/},Z.CSS_VARIABLE,{className:"attribute",begin:"\\b("+AH0.join("|")+")\\b",end:/(?=:)/,starts:{endsWithParent:!0,illegal:"[<=$]",relevance:0,contains:z}}]},N={className:"keyword",begin:"@(import|media|charset|font-face|(-[a-z]+-)?keyframes|supports|document|namespace|page|viewport|host)\\b",starts:{end:"[;{}]",keywords:K,returnEnd:!0,contains:z,relevance:0}},V={className:"variable",variants:[{begin:"@[\\w-]+\\s*:",relevance:15},{begin:"@[\\w-]+"}],starts:{end:"[;}]",returnEnd:!0,contains:F}},A={variants:[{begin:"[\\.#:&\\[>]",end:"[;{}]"},{begin:B,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("+qH0.join("|")+")\\b",className:"selector-tag"},Z.CSS_NUMBER_MODE,U("selector-tag",B,0),U("selector-id","#"+B),U("selector-class","\\."+B,0),U("selector-tag","&",0),Z.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",begin:":("+Zp.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+Jp.join("|")+")"},{begin:/\(/,end:/\)/,relevance:0,contains:F},{begin:"!important"},Z.FUNCTION_DISPATCH]},D={begin:`[\\w-]+:(:)?(${J.join("|")})`,returnBegin:!0,contains:[A]};return X.push($.C_LINE_COMMENT_MODE,$.C_BLOCK_COMMENT_MODE,N,V,D,q,A,W,Z.FUNCTION_DISPATCH),{name:"Less",case_insensitive:!0,illegal:`[=>'/<($"]`,contains:X}}function Qp($){let H={begin:"\\[=*\\[",end:"\\]=*\\]",contains:["self"]},Q=[$.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:Q.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:Q}].concat(Q)},$.C_NUMBER_MODE,$.APOS_STRING_MODE,$.QUOTE_STRING_MODE,{className:"string",begin:"\\[=*\\[",end:"\\]=*\\]",contains:[H],relevance:5}])}}function Bp($){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]},Q={begin:"^"+$.UNDERSCORE_IDENT_RE+"\\s*(?=[:+?]?=)"},B={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,Q,B,X]}}function Xp($){let Z=$.regex,J={begin:/<\/?[A-Za-z_]/,end:">",subLanguage:"xml",relevance:0},H={begin:"^[-\\*]{3,}",end:"$"},Q={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}]},B={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}/}]},K={className:"emphasis",contains:[],variants:[{begin:/\*(?![*\s])/,end:/\*/},{begin:/_(?![_\s])/,end:/_/,relevance:0}]},Y=$.inherit(U,{contains:[]}),F=$.inherit(K,{contains:[]});U.contains.push(F),K.contains.push(Y);let W=[J,G];return[U,K,Y,F].forEach((A)=>{A.contains=A.contains.concat(W)}),W=W.concat(U,K),{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,B,U,K,{className:"quote",begin:"^>\\s+",contains:W,end:"$"},Q,H,G,X,{scope:"literal",match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}function zp($){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 Gp($){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}/,Q={$pattern:/[\w.]+/,keyword:J.join(" ")},B={className:"subst",begin:"[$@]\\{",end:"\\}",keywords:Q},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},K=[$.BACKSLASH_ESCAPE,B,G],Y=[/!/,/\//,/\|/,/\?/,/'/,/"/,/#/],F=(N,V,A="\\1")=>{let D=A==="\\1"?A:Z.concat(A,V);return Z.concat(Z.concat("(?:",N,")"),V,/(?:\\.|[^\\\/])*?/,D,/(?:\\.|[^\\\/])*?/,A,H)},W=(N,V,A)=>{return Z.concat(Z.concat("(?:",N,")"),V,/(?:\\.|[^\\\/])*?/,A,H)},q=[G,$.HASH_COMMENT_MODE,$.COMMENT(/^=\w/,/=cut/,{endsWithParent:!0}),X,{className:"string",contains:K,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:F("s|tr|y",Z.either(...Y,{capture:!0}))},{begin:F("s|tr|y","\\(","\\)")},{begin:F("s|tr|y","\\[","\\]")},{begin:F("s|tr|y","\\{","\\}")}],relevance:2},{className:"regexp",variants:[{begin:/(m|qr)\/\//,relevance:0},{begin:W("(?:m|qr)?",/\//,/\//)},{begin:W("m|qr",Z.either(...Y,{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 B.contains=q,X.contains=q,{name:"Perl",aliases:["pl","pm"],keywords:Q,contains:q}}function Up($){let Z=$.regex,J=/(?![A-Za-z0-9])(?![$])/,H=Z.concat(/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/,J),Q=Z.concat(/(\\?[A-Z][a-z0-9_\x7f-\xff]+|\\?[A-Z]+(?=[A-Z][a-z0-9_\x7f-\xff])){1,}/,J),B=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}),K=$.inherit($.QUOTE_STRING_MODE,{illegal:null,contains:$.QUOTE_STRING_MODE.contains.concat(G)}),Y={begin:/<<<[ \t]*(?:(\w+)|"(\w+)")\n/,end:/[ \t]*(\w+)\b/,contains:$.QUOTE_STRING_MODE.contains.concat(G),"on:begin":(O,b)=>{b.data._beginMatch=O[1]||O[2]},"on:end":(O,b)=>{if(b.data._beginMatch!==O[1])b.ignoreMatch()}},F=$.END_SAME_AS_BEGIN({begin:/<<<[ \t]*'(\w+)'\n/,end:/[ \t]*(\w+)\b/}),W=`[
35
- ]`,q={scope:"string",variants:[K,U,Y,F]},N={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},V=["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"],D=["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"],j={keyword:A,literal:((O)=>{let b=[];return O.forEach((k)=>{if(b.push(k),k.toLowerCase()===k)b.push(k.toUpperCase());else b.push(k.toLowerCase())}),b})(V),built_in:D},M=(O)=>{return O.map((b)=>{return b.replace(/\|\d+$/,"")})},_={variants:[{match:[/new/,Z.concat(`[
36
- ]`,"+"),Z.concat("(?!",M(D).join("\\b|"),"\\b)"),Q],scope:{1:"keyword",4:"title.class"}}]},E=Z.concat(H,"\\b(?!\\()"),C={variants:[{match:[Z.concat(/::/,Z.lookahead(/(?!class\b)/)),E],scope:{2:"variable.constant"}},{match:[/::/,/class/],scope:{2:"variable.language"}},{match:[Q,Z.concat(/::/,Z.lookahead(/(?!class\b)/)),E],scope:{1:"title.class",3:"variable.constant"}},{match:[Q,Z.concat("::",Z.lookahead(/(?!class\b)/))],scope:{1:"title.class"}},{match:[Q,/::/,/class/],scope:{1:"title.class",3:"variable.language"}}]},R={scope:"attr",match:Z.concat(H,Z.lookahead(":"),Z.lookahead(/(?!::)/))},T={relevance:0,begin:/\(/,end:/\)/,keywords:j,contains:[R,X,C,$.C_BLOCK_COMMENT_MODE,q,N,_]},I={relevance:0,match:[/\b/,Z.concat("(?!fn\\b|function\\b|",M(A).join("\\b|"),"|",M(D).join("\\b|"),"\\b)"),H,Z.concat(`[
37
- ]`,"*"),Z.lookahead(/(?=\()/)],scope:{3:"title.function.invoke"},contains:[T]};T.contains.push(I);let y=[R,C,$.C_BLOCK_COMMENT_MODE,q,N,_],S={begin:Z.concat(/#\[\s*\\?/,Z.either(Q,B)),beginScope:"meta",end:/]/,endScope:"meta",keywords:{literal:V,keyword:["new","array"]},contains:[{begin:/\[/,end:/]/,keywords:{literal:V,keyword:["new","array"]},contains:["self",...y]},...y,{scope:"meta",variants:[{match:Q},{match:B}]}]};return{case_insensitive:!1,keywords:j,contains:[S,$.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,I,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:j,contains:["self",S,X,C,$.C_BLOCK_COMMENT_MODE,q,N]}]},{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]},q,N]}}function Kp($){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 Yp($){return{name:"Plain text",aliases:["text","txt"],disableAutodetect:!0}}function Fp($){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:/#/},K={begin:/\{\{/,relevance:0},Y={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,K,U]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[$.BACKSLASH_ESCAPE,G,K,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,K,U]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[$.BACKSLASH_ESCAPE,K,U]},$.APOS_STRING_MODE,$.QUOTE_STRING_MODE]},F="[0-9](_?[0-9])*",W="(\\b([0-9](_?[0-9])*))?\\.([0-9](_?[0-9])*)|\\b([0-9](_?[0-9])*)\\.",q=`\\b|${H.join("|")}`,N={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]?(?=${q})`},{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]?(?=${q})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${q})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${q})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${q})`},{begin:`\\b([0-9](_?[0-9])*)[jJ](?=${q})`}]},V={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,N,Y,$.HASH_COMMENT_MODE]}]};return U.contains=[Y,N,G],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:z,illegal:/(<\/|\?)|=>/,contains:[G,N,{scope:"variable.language",match:/\bself\b/},{beginKeywords:"if",relevance:0},{match:/\bor\b/,scope:"keyword"},Y,V,$.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:[N,A,Y]}]}}function Wp($){return{aliases:["pycon"],contains:[{className:"meta.prompt",starts:{end:/ |$/,starts:{end:"$",subLanguage:"python"}},variants:[{begin:/^>>>(?=[ ]|$)/},{begin:/^\.\.\.(?=[ ]|$)/}]}]}}function qp($){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]?/),Q=/[=!<>:]=|\|\||&&|:::?|<-|<<-|->>|->|\|>|[-+*\/?!$&|:<=>@^~]|\*\*/,B=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:[Q,H]},{scope:{1:"operator",2:"number"},match:[/%[^%]*%/,H]},{scope:{1:"punctuation",2:"number"},match:[B,H]},{scope:{2:"number"},match:[/[^a-zA-Z0-9._]|^/,H]}]},{scope:{3:"operator"},match:[J,/\s+/,/<-/,/\s+/]},{scope:"operator",relevance:0,variants:[{match:Q},{match:/%[^%]*%/}]},{scope:"punctuation",relevance:0,match:B},{begin:"`",end:"`",contains:[{begin:/\\./}]}]}}function Np($){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]+/),Q=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)],K={className:"subst",begin:/#\{/,end:/\}/,keywords:X},Y={className:"string",contains:[$.BACKSLASH_ESCAPE,K],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,K]})]}]},F="[1-9](_?[0-9])*|0",W="[0-9](_?[0-9])*",q={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"}]},N={variants:[{match:/\(\)/},{className:"params",begin:/\(/,end:/(?=\))/,excludeBegin:!0,endsParent:!0,keywords:X}]},_=[Y,{variants:[{match:[/class\s+/,Q,/\s+<\s+/,Q]},{match:[/\b(class|module)\s+/,Q]}],scope:{2:"title.class",4:"title.class.inherited"},keywords:X},{match:[/(include|extend)\s+/,Q],scope:{2:"title.class"},keywords:X},{relevance:0,match:[Q,/\.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:[N]},{begin:$.IDENT_RE+"::"},{className:"symbol",begin:$.UNDERSCORE_IDENT_RE+"(!|\\?)?:",relevance:0},{className:"symbol",begin:":(?!\\s)",contains:[Y,{begin:"([a-zA-Z_]\\w*[!?=]?|[-+~]@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?)"}],relevance:0},q,{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,K],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);K.contains=_,N.contains=_;let E="[>?]>",C="[\\w#]+\\(\\w+\\):\\d+:\\d+[>*]",R="(\\w+-)?\\d+\\.\\d+\\.\\d+(p\\d+)?[^\\d][^>]+>",T=[{begin:/^\s*=>/,starts:{end:"$",contains:_}},{className:"meta.prompt",begin:"^("+E+"|"+C+"|"+R+")(?=[ ])",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 Ap($){let Z=$.regex,J=/(r#)?/,H=Z.concat(J,$.UNDERSCORE_IDENT_RE),Q=Z.concat(J,$.IDENT_RE),B={className:"title.function.invoke",relevance:0,begin:Z.concat(/\b/,/(?!let|for|while|if|else|match\b)/,Q,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!"],K=["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:K,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:K}},{className:"punctuation",begin:"->"},B]}}var DH0=($)=>{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_-]*/}}},LH0=["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"],MH0=["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"],PH0=[...LH0,...MH0],_H0=["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(),jH0=["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(),OH0=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),TH0=["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 Vp($){let Z=DH0($),J=OH0,H=jH0,Q="@[a-z-]+",B="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("+PH0.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("+TH0.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:_H0.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 Dp($){return{name:"Shell Session",aliases:["console","shellsession"],contains:[{className:"meta.prompt",begin:/^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/,starts:{end:/[^\\](?=\s*$)/,subLanguage:"bash"}}]}}function Lp($){let Z=$.regex,J=$.COMMENT("--","$"),H={scope:"string",variants:[{begin:/'/,end:/'/,contains:[{match:/''/}]}]},Q={begin:/"/,end:/"/,contains:[{match:/""/}]},B=["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"],K=["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"],Y=["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"],F=["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=K,q=[...U,...G].filter((M)=>{return!K.includes(M)}),N={scope:"variable",match:/@[a-z0-9][a-z0-9_]*/},V={scope:"operator",match:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0},A={match:Z.concat(/\b/,Z.either(...W),/\s*\(/),relevance:0,keywords:{built_in:W}};function D(M){return Z.concat(/\b/,Z.either(...M.map((_)=>{return _.replace(/\s+/,"\\s+")})),/\b/)}let L={scope:"keyword",match:D(F),relevance:0};function j(M,{exceptions:_,when:E}={}){let C=E;return _=_||[],M.map((R)=>{if(R.match(/\|\d+$/)||_.includes(R))return R;else if(C(R))return`${R}|0`;else return R})}return{name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:j(q,{when:(M)=>M.length<3}),literal:B,type:z,built_in:Y},contains:[{scope:"type",match:D(X)},L,A,N,H,Q,$.C_NUMBER_MODE,$.C_BLOCK_COMMENT_MODE,J,V]}}function jp($){if(!$)return null;if(typeof $==="string")return $;return $.source}function ZX($){return P5("(?=",$,")")}function P5(...$){return $.map((J)=>jp(J)).join("")}function CH0($){let Z=$[$.length-1];if(typeof Z==="object"&&Z.constructor===Object)return $.splice($.length-1,1),Z;else return{}}function C4(...$){return"("+(CH0($).capture?"":"?:")+$.map((H)=>jp(H)).join("|")+")"}var pM=($)=>P5(/\b/,$,/\w$/.test($)?/\b/:/\B/),wH0=["Protocol","Type"].map(pM),Mp=["init","self"].map(pM),EH0=["Any","Self"],mM=["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"],Pp=["false","nil","true"],SH0=["assignment","associativity","higherThan","left","lowerThan","none","right"],RH0=["#colorLiteral","#column","#dsohandle","#else","#elseif","#endif","#error","#file","#fileID","#fileLiteral","#filePath","#function","#if","#imageLiteral","#keyPath","#line","#selector","#sourceLocation","#warning"],_p=["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"],Op=C4(/[/=\-+!*%<>&|^~?]/,/[\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]/),Tp=C4(Op,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),uM=P5(Op,Tp,"*"),Cp=C4(/[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]/),FW=C4(Cp,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),Z3=P5(Cp,FW,"*"),YW=P5(/[A-Z]/,FW,"*"),IH0=["attached","autoclosure",P5(/convention\(/,C4("swift","block","c"),/\)/),"discardableResult","dynamicCallable","dynamicMemberLookup","escaping","freestanding","frozen","GKInspectable","IBAction","IBDesignable","IBInspectable","IBOutlet","IBSegueAction","inlinable","main","nonobjc","NSApplicationMain","NSCopying","NSManaged",P5(/objc\(/,Z3,/\)/),"objc","objcMembers","propertyWrapper","requires_stored_property_inits","resultBuilder","Sendable","testable","UIApplicationMain","unchecked","unknown","usableFromInline","warn_unqualified_access"],kH0=["iOS","iOSApplicationExtension","macOS","macOSApplicationExtension","macCatalyst","macCatalystApplicationExtension","watchOS","watchOSApplicationExtension","tvOS","tvOSApplicationExtension","swift"];function wp($){let Z={match:/\s+/,relevance:0},J=$.COMMENT("/\\*","\\*/",{contains:["self"]}),H=[$.C_LINE_COMMENT_MODE,J],Q={match:[/\./,C4(...wH0,...Mp)],className:{2:"keyword"}},B={match:P5(/\./,C4(...mM)),relevance:0},X=mM.filter((F0)=>typeof F0==="string").concat(["_|0"]),z=mM.filter((F0)=>typeof F0!=="string").concat(EH0).map(pM),G={variants:[{className:"keyword",match:C4(...z,...Mp)}]},U={$pattern:C4(/\b\w+/,/#\w+/),keyword:X.concat(RH0),literal:Pp},K=[Q,B,G],Y={match:P5(/\./,C4(..._p)),relevance:0},F={className:"built_in",match:P5(/\b/,C4(..._p),/(?=\()/)},W=[Y,F],q={match:/->/,relevance:0},N={className:"operator",relevance:0,variants:[{match:uM},{match:`\\.(\\.|${Tp})+`}]},V=[q,N],A="([0-9]_*)+",D="([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/}]},j=(F0="")=>({className:"subst",variants:[{match:P5(/\\/,F0,/[0\\tnr"']/)},{match:P5(/\\/,F0,/u\{[0-9a-fA-F]{1,8}\}/)}]}),M=(F0="")=>({className:"subst",match:P5(/\\/,F0,/[\t ]*(?:[\r\n]|\r\n)/)}),_=(F0="")=>({className:"subst",label:"interpol",begin:P5(/\\/,F0,/\(/),end:/\)/}),E=(F0="")=>({begin:P5(F0,/"""/),end:P5(/"""/,F0),contains:[j(F0),M(F0),_(F0)]}),C=(F0="")=>({begin:P5(F0,/"/),end:P5(/"/,F0),contains:[j(F0),_(F0)]}),R={className:"string",variants:[E(),E("#"),E("##"),E("###"),C(),C("#"),C("##"),C("###")]},T=[$.BACKSLASH_ESCAPE,{begin:/\[/,end:/\]/,relevance:0,contains:[$.BACKSLASH_ESCAPE]}],I={begin:/\/[^\s](?=[^/\n]*\/)/,end:/\//,contains:T},y=(F0)=>{let n=P5(F0,/\//),a=P5(/\//,F0);return{begin:n,end:a,contains:[...T,{scope:"comment",begin:`#(?!.*${a})`,end:/$/}]}},S={scope:"regexp",variants:[y("###"),y("##"),y("#"),I]},O={match:P5(/`/,Z3,/`/)},b={className:"variable",match:/\$\d+/},k={className:"variable",match:`\\$${FW}+`},h=[O,b,k],v={match:/(@|#(un)?)available/,scope:"keyword",starts:{contains:[{begin:/\(/,end:/\)/,keywords:kH0,contains:[...V,L,R]}]}},f={scope:"keyword",match:P5(/@/,C4(...IH0),ZX(C4(/\(/,/\s+/)))},w={scope:"meta",match:P5(/@/,Z3)},i=[v,f,w],r={match:ZX(/\b[A-Z]/),relevance:0,contains:[{className:"type",match:P5(/(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)/,FW,"+")},{className:"type",match:YW,relevance:0},{match:/[?!]+/,relevance:0},{match:/\.\.\./,relevance:0},{match:P5(/\s+&\s+/,ZX(YW)),relevance:0}]},x={begin:/</,end:/>/,keywords:U,contains:[...H,...K,...i,q,r]};r.contains.push(x);let l={match:P5(Z3,/\s*:/),keywords:"_|0",relevance:0},s={begin:/\(/,end:/\)/,relevance:0,keywords:U,contains:["self",l,...H,S,...K,...W,...V,L,R,...h,...i,r]},p={begin:/</,end:/>/,keywords:"repeat each",contains:[...H,r]},d={begin:C4(ZX(P5(Z3,/\s*:/)),ZX(P5(Z3,/\s+/,Z3,/\s*:/))),end:/:/,relevance:0,contains:[{className:"keyword",match:/\b_\b/},{className:"params",match:Z3}]},o={begin:/\(/,end:/\)/,keywords:U,contains:[d,...H,...K,...V,L,R,...i,r,s],endsParent:!0,illegal:/["']/},Z0={match:[/(func|macro)/,/\s+/,C4(O.match,Z3,uM)],className:{1:"keyword",3:"title.function"},contains:[p,o,Z],illegal:[/\[/,/%/]},H0={match:[/\b(?:subscript|init[?!]?)/,/\s*(?=[<(])/],className:{1:"keyword"},contains:[p,o,Z],illegal:/\[|%/},G0={match:[/operator/,/\s+/,uM],className:{1:"keyword",3:"title"}},X0={begin:[/precedencegroup/,/\s+/,YW],className:{1:"keyword",3:"title"},contains:[r],keywords:[...SH0,...Pp],end:/}/},Y0={match:[/class\b/,/\s+/,/func\b/,/\s+/,/\b[A-Za-z_][A-Za-z0-9_]*\b/],scope:{1:"keyword",3:"keyword",5:"title.function"}},V0={match:[/class\b/,/\s+/,/var\b/],scope:{1:"keyword",3:"keyword"}},N0={begin:[/(struct|protocol|class|extension|enum|actor)/,/\s+/,Z3,/\s*/],beginScope:{1:"keyword",3:"title.class"},keywords:U,contains:[p,...K,{begin:/:/,end:/\{/,keywords:U,contains:[{scope:"title.class.inherited",match:YW},...K],relevance:0}]};for(let F0 of R.variants){let n=F0.contains.find((e)=>e.label==="interpol");n.keywords=U;let a=[...K,...W,...V,L,R,...h];n.contains=[...a,{begin:/\(/,end:/\)/,contains:["self",...a]}]}return{name:"Swift",keywords:U,contains:[...H,Z0,H0,Y0,V0,N0,G0,X0,{beginKeywords:"import",end:/$/,contains:[...H],relevance:0},S,...K,...W,...V,L,R,...h,...i,r,s]}}var Ep=["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"],Sp=["true","false","null","undefined","NaN","Infinity"],Rp=["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"],Ip=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],kp=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],bp=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],yp=[].concat(kp,Rp,Ip);function bH0($){let Z=$.regex,J=(v,{after:f})=>{let w="</"+v[0].slice(1);return v.input.indexOf(w,f)!==-1},H="[A-Za-z$_][0-9A-Za-z$_]*",Q={begin:"<>",end:"</>"},B=/<[A-Za-z0-9\\._:-]+\s*\/>/,X={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(v,f)=>{let w=v[0].length+v.index,i=v.input[w];if(i==="<"||i===","){f.ignoreMatch();return}if(i===">"){if(!J(v,{after:w}))f.ignoreMatch()}let r,x=v.input.substring(w);if(r=x.match(/^\s*=/)){f.ignoreMatch();return}if(r=x.match(/^\s+extends\s+/)){if(r.index===0){f.ignoreMatch();return}}}},z={$pattern:"[A-Za-z$_][0-9A-Za-z$_]*",keyword:Ep,literal:Sp,built_in:yp,"variable.language":bp},G="[0-9](_?[0-9])*",U="\\.([0-9](_?[0-9])*)",K="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",Y={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},F={className:"subst",begin:"\\$\\{",end:"\\}",keywords:z,contains:[]},W={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[$.BACKSLASH_ESCAPE,F],subLanguage:"xml"}},q={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[$.BACKSLASH_ESCAPE,F],subLanguage:"css"}},N={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[$.BACKSLASH_ESCAPE,F],subLanguage:"graphql"}},V={className:"string",begin:"`",end:"`",contains:[$.BACKSLASH_ESCAPE,F]},D={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,q,N,V,{match:/\$\d+/},Y];F.contains=L.concat({begin:/\{/,end:/\}/,keywords:z,contains:["self"].concat(L)});let j=[].concat(D,F.contains),M=j.concat([{begin:/(\s*)\(/,end:/\)/,keywords:z,contains:["self"].concat(j)}]),_={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:z,contains:M},E={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:{_:[...Rp,...Ip]}},R={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:/%/},I={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function y(v){return Z.concat("(?!",v.join("|"),")")}let S={match:Z.concat(/\b/,y([...kp,"super","import"].map((v)=>`${v}\\s*\\(`)),"[A-Za-z$_][0-9A-Za-z$_]*",Z.lookahead(/\s*\(/)),className:"title.function",relevance:0},O={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},b={match:[/get|set/,/\s+/,"[A-Za-z$_][0-9A-Za-z$_]*",/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},_]},k="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+$.UNDERSCORE_IDENT_RE+")\\s*=>",h={match:[/const|var|let/,/\s+/,"[A-Za-z$_][0-9A-Za-z$_]*",/\s*/,/=\s*/,/(async\s*)?/,Z.lookahead(k)],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}),R,$.APOS_STRING_MODE,$.QUOTE_STRING_MODE,W,q,N,V,D,{match:/\$\d+/},Y,C,{scope:"attr",match:"[A-Za-z$_][0-9A-Za-z$_]*"+Z.lookahead(":"),relevance:0},h,{begin:"("+$.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[D,$.REGEXP_MODE,{className:"function",begin:k,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:Q.begin,end:Q.end},{match:B},{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},O,{match:"\\$[A-Za-z$_][0-9A-Za-z$_]*",relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[_]},S,I,E,b,{match:/\$[(.]/}]}}function xp($){let Z=$.regex,J=bH0($),H="[A-Za-z$_][0-9A-Za-z$_]*",Q=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],B={begin:[/namespace/,/\s+/,$.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},X={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:Q},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:Ep.concat(G),literal:Sp,built_in:yp.concat(Q),"variable.language":bp},K={className:"meta",begin:"@[A-Za-z$_][0-9A-Za-z$_]*"},Y=(N,V,A)=>{let D=N.contains.findIndex((L)=>L.label===V);if(D===-1)throw Error("can not find mode to replace");N.contains.splice(D,1,A)};Object.assign(J.keywords,U),J.exports.PARAMS_CONTAINS.push(K);let F=J.contains.find((N)=>N.scope==="attr"),W=Object.assign({},F,{match:Z.concat("[A-Za-z$_][0-9A-Za-z$_]*",Z.lookahead(/\s*\?:/))});J.exports.PARAMS_CONTAINS.push([J.exports.CLASS_REFERENCE,F,W]),J.contains=J.contains.concat([K,B,X,W]),Y(J,"shebang",$.SHEBANG()),Y(J,"use_strict",z);let q=J.contains.find((N)=>N.label==="func.def");return q.relevance=0,Object.assign(J,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),J}function hp($){let Z=$.regex,J={className:"string",begin:/"(""|[^/n])"C\b/},H={className:"string",begin:/"/,end:/"/,illegal:/\n/,contains:[{begin:/""/}]},Q=/\d{1,2}\/\d{1,2}\/\d{4}/,B=/\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(B,Q),/ *#/)},{begin:Z.concat(/# */,z,/ *#/)},{begin:Z.concat(/# */,X,/ *#/)},{begin:Z.concat(/# */,Z.either(B,Q),/ +/,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])|[%&])?/}]},K={className:"label",begin:/^\w+:/},Y=$.COMMENT(/'''/,/$/,{contains:[{className:"doctag",begin:/<\/?/,end:/>/}]}),F=$.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,K,Y,F,{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:[F]}]}}function vp($){$.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"],Q={begin:[/(?:func|call|call_indirect)/,/\s+/,/\$[^\s)]+/],className:{1:"keyword",3:"title.function"}},B={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"}},B,X,Q,$.QUOTE_STRING_MODE,G,U,z]}}function gp($){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,Q={className:"symbol",begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},B={begin:/\s/,contains:[{className:"keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},X=$.inherit(B,{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:[Q]},{begin:/'/,end:/'/,contains:[Q]},{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:[B,G,z,X,{begin:/\[/,end:/\]/,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,contains:[B,X,G,z]}]}]},$.COMMENT(/<!--/,/-->/,{relevance:10}),{begin:/<!\[CDATA\[/,end:/\]\]>/,relevance:10},Q,{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 fp($){let H={className:"attr",variants:[{begin:/[\w*@][\w*@ :()\./-]*:(?=[ \t]|$)/},{begin:/"[\w*@][\w*@ :()\./-]*":(?=[ \t]|$)/},{begin:/'[\w*@][\w*@ :()\./-]*':(?=[ \t]|$)/}]},Q={className:"template-variable",variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]},B={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,Q]},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})?",K="(\\.[0-9]*)?",Y="([ \\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?",F={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},q={begin:/\{/,end:/\}/,contains:[W],illegal:"\\n",relevance:0},N={begin:"\\[",end:"\\]",contains:[W],illegal:"\\n",relevance:0},V=[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"}},F,{className:"number",begin:$.C_NUMBER_RE+"\\b",relevance:0},q,N,B,X],A=[...V];return A.pop(),A.push(z),W.contains=A,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:V}}var cM={arduino:hu,bash:vu,c:gu,cpp:fu,csharp:mu,css:uu,diff:pu,go:cu,graphql:du,ini:lu,java:au,javascript:tu,json:eu,kotlin:$p,less:Hp,lua:Qp,makefile:Bp,markdown:Xp,objectivec:zp,perl:Gp,php:Up,"php-template":Kp,plaintext:Yp,python:Fp,"python-repl":Wp,r:qp,ruby:Np,rust:Ap,scss:Vp,shell:Dp,sql:Lp,swift:wp,typescript:xp,vbnet:hp,wasm:vp,xml:gp,yaml:fp};var Uc=P(Gc(),1);var Kc=Uc.default;var Yc={},jQ0="hljs-";function nM($){let Z=Kc.newInstance();if($)B($);return{highlight:J,highlightAuto:H,listLanguages:Q,register:B,registerAlias:X,registered:z};function J(G,U,K){n1(typeof G==="string","expected `string` as `name`"),n1(typeof U==="string","expected `string` as `value`");let Y=K||Yc,F=typeof Y.prefix==="string"?Y.prefix:jQ0;if(!Z.getLanguage(G))throw Error("Unknown language: `"+G+"` is not registered");Z.configure({__emitter:Fc,classPrefix:F});let W=Z.highlight(U,{ignoreIllegals:!0,language:G});if(W.errorRaised)throw Error("Could not highlight with `Highlight.js`",{cause:W.errorRaised});let q=W._emitter.root,N=q.data;return N.language=W.language,N.relevance=W.relevance,q}function H(G,U){n1(typeof G==="string","expected `string` as `value`");let Y=(U||Yc).subset||Q(),F=-1,W=0,q;while(++F<Y.length){let N=Y[F];if(!Z.getLanguage(N))continue;let V=J(N,G,U);if(V.data&&V.data.relevance!==void 0&&V.data.relevance>W)W=V.data.relevance,q=V}return q||{type:"root",children:[],data:{language:void 0,relevance:W}}}function Q(){return Z.listLanguages()}function B(G,U){if(typeof G==="string")n1(U!==void 0,"expected `grammar`"),Z.registerLanguage(G,U);else{let K;for(K in G)if(Object.hasOwn(G,K))Z.registerLanguage(K,G[K])}}function X(G,U){if(typeof G==="string")n1(U!==void 0),Z.registerAliases(typeof U==="string"?U:[...U],{languageName:G});else{let K;for(K in G)if(Object.hasOwn(G,K)){let Y=G[K];Z.registerAliases(typeof Y==="string"?Y:[...Y],{languageName:K})}}}function z(G){return Boolean(Z.getLanguage(G))}}class Fc{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(B,X){return X?B+"_".repeat(X):Z.options.classPrefix+B}),H=this.stack[this.stack.length-1],Q={type:"element",tagName:"span",properties:{className:J},children:[]};H.children.push(Q),this.stack.push(Q)}closeNode(){this.stack.pop()}finalize(){}toHTML(){return""}}var OQ0={};function AW($){let Z=$||OQ0,J=Z.aliases,H=Z.detect||!1,Q=Z.languages||cM,B=Z.plainText,X=Z.prefix,z=Z.subset,G="hljs",U=nM(Q);if(J)U.registerAlias(J);if(X){let K=X.indexOf("-");G=K===-1?X:X.slice(0,K)}return function(K,Y){k3(K,"element",function(F,W,q){if(F.tagName!=="code"||!q||q.type!=="element"||q.tagName!=="pre")return;let N=TQ0(F);if(N===!1||!N&&!H||N&&B&&B.includes(N))return;if(!Array.isArray(F.properties.className))F.properties.className=[];if(!F.properties.className.includes(G))F.properties.className.unshift(G);let V=fM(F,{whitespace:"pre"}),A;try{A=N?U.highlight(N,V,{prefix:X}):U.highlightAuto(V,{prefix:X,subset:z})}catch(D){let L=D;if(N&&/Unknown language/.test(L.message)){Y.message("Cannot highlight as `"+N+"`, it’s not registered",{ancestors:[q,F],cause:L,place:F.position,ruleId:"missing-language",source:"rehype-highlight"});return}throw L}if(!N&&A.data&&A.data.language)F.properties.className.push("language-"+A.data.language);if(A.children.length>0)F.children=A.children})}}function TQ0($){let Z=$.properties.className,J=-1;if(!Array.isArray(Z))return;let H;while(++J<Z.length){let Q=String(Z[J]);if(Q==="no-highlight"||Q==="nohighlight")return!1;if(!H&&Q.slice(0,5)==="lang-")H=Q.slice(5);if(!H&&Q.slice(0,9)==="language-")H=Q.slice(9)}return H}function sM($,Z){let J=String($);if(typeof Z!=="string")throw TypeError("Expected character");let H=0,Q=J.indexOf(Z);while(Q!==-1)H++,Q=J.indexOf(Z,Q+Z.length);return H}function tM($){if(typeof $!=="string")throw TypeError("Expected a string");return $.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function eM($,Z,J){let Q=$3((J||{}).ignore||[]),B=CQ0(Z),X=-1;while(++X<B.length)tB($,"text",z);function z(U,K){let Y=-1,F;while(++Y<K.length){let W=K[Y],q=F?F.children:void 0;if(Q(W,q?q.indexOf(W):void 0,F))return;F=W}if(F)return G(U,K)}function G(U,K){let Y=K[K.length-1],F=B[X][0],W=B[X][1],q=0,V=Y.children.indexOf(U),A=!1,D=[];F.lastIndex=0;let L=F.exec(U.value);while(L){let j=L.index,M={index:L.index,input:L.input,stack:[...K,U]},_=W(...L,M);if(typeof _==="string")_=_.length>0?{type:"text",value:_}:void 0;if(_===!1)F.lastIndex=j+1;else{if(q!==j)D.push({type:"text",value:U.value.slice(q,j)});if(Array.isArray(_))D.push(..._);else if(_)D.push(_);q=j+L[0].length,A=!0}if(!F.global)break;L=F.exec(U.value)}if(A){if(q<U.value.length)D.push({type:"text",value:U.value.slice(q)});Y.children.splice(V,1,...D)}else D=[U];return V+D.length}}function CQ0($){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 Q=J[H];Z.push([wQ0(Q[0]),EQ0(Q[1])])}return Z}function wQ0($){return typeof $==="string"?new RegExp(tM($),"g"):$}function EQ0($){return typeof $==="function"?$:function(){return $}}var $P="phrasing",ZP=["autolink","link","image","label"];function HP(){return{transforms:[yQ0],enter:{literalAutolink:SQ0,literalAutolinkEmail:JP,literalAutolinkHttp:JP,literalAutolinkWww:JP},exit:{literalAutolink:bQ0,literalAutolinkEmail:kQ0,literalAutolinkHttp:RQ0,literalAutolinkWww:IQ0}}}function QP(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:$P,notInConstruct:ZP},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:$P,notInConstruct:ZP},{character:":",before:"[ps]",after:"\\/",inConstruct:$P,notInConstruct:ZP}]}}function SQ0($){this.enter({type:"link",title:null,url:"",children:[]},$)}function JP($){this.config.enter.autolinkProtocol.call(this,$)}function RQ0($){this.config.exit.autolinkProtocol.call(this,$)}function IQ0($){this.config.exit.data.call(this,$);let Z=this.stack[this.stack.length-1];n1(Z.type==="link"),Z.url="http://"+this.sliceSerialize($)}function kQ0($){this.config.exit.autolinkEmail.call(this,$)}function bQ0($){this.exit($)}function yQ0($){eM($,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,xQ0],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,hQ0]],{ignore:["link","linkReference"]})}function xQ0($,Z,J,H,Q){let B="";if(!Wc(Q))return!1;if(/^w/i.test(Z))J=Z+J,Z="",B="http://";if(!vQ0(J))return!1;let X=gQ0(J+H);if(!X[0])return!1;let z={type:"link",title:null,url:B+Z+X[0],children:[{type:"text",value:Z+X[0]}]};if(X[1])return[z,{type:"text",value:X[1]}];return z}function hQ0($,Z,J,H){if(!Wc(H,!0)||/[-\d_]$/.test(J))return!1;return{type:"link",title:null,url:"mailto:"+Z+"@"+J,children:[{type:"text",value:Z+"@"+J}]}}function vQ0($){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 gQ0($){let Z=/[!"&'),.:;<>?\]}]+$/.exec($);if(!Z)return[$,void 0];$=$.slice(0,Z.index);let J=Z[0],H=J.indexOf(")"),Q=sM($,"("),B=sM($,")");while(H!==-1&&Q>B)$+=J.slice(0,H+1),J=J.slice(H+1),H=J.indexOf(")"),B++;return[$,J]}function Wc($,Z){let J=$.input.charCodeAt($.index-1);return($.index===0||t9(J)||f$(J))&&(!Z||J!==47)}qc.peek=rQ0;function fQ0(){this.buffer()}function mQ0($){this.enter({type:"footnoteReference",identifier:"",label:""},$)}function uQ0(){this.buffer()}function pQ0($){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},$)}function cQ0($){let Z=this.resume(),J=this.stack[this.stack.length-1];n1(J.type==="footnoteReference"),J.identifier=G4(this.sliceSerialize($)).toLowerCase(),J.label=Z}function dQ0($){this.exit($)}function lQ0($){let Z=this.resume(),J=this.stack[this.stack.length-1];n1(J.type==="footnoteDefinition"),J.identifier=G4(this.sliceSerialize($)).toLowerCase(),J.label=Z}function iQ0($){this.exit($)}function rQ0(){return"["}function qc($,Z,J,H){let Q=J.createTracker(H),B=Q.move("[^"),X=J.enter("footnoteReference"),z=J.enter("reference");return B+=Q.move(J.safe(J.associationId($),{after:"]",before:B})),z(),X(),B+=Q.move("]"),B}function BP(){return{enter:{gfmFootnoteCallString:fQ0,gfmFootnoteCall:mQ0,gfmFootnoteDefinitionLabelString:uQ0,gfmFootnoteDefinition:pQ0},exit:{gfmFootnoteCallString:cQ0,gfmFootnoteCall:dQ0,gfmFootnoteDefinitionLabelString:lQ0,gfmFootnoteDefinition:iQ0}}}function XP($){let Z=!1;if($&&$.firstLineBlank)Z=!0;return{handlers:{footnoteDefinition:J,footnoteReference:qc},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function J(H,Q,B,X){let z=B.createTracker(X),G=z.move("[^"),U=B.enter("footnoteDefinition"),K=B.enter("label");if(G+=z.move(B.safe(B.associationId(H),{before:G,after:"]"})),K(),G+=z.move("]:"),H.children&&H.children.length>0)z.shift(4),G+=z.move((Z?`
38
- `:" ")+B.indentLines(B.containerFlow(H,z.current()),Z?Nc:aQ0));return U(),G}}function aQ0($,Z,J){return Z===0?$:Nc($,Z,J)}function Nc($,Z,J){return(J?"":" ")+$}var oQ0=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];Ac.peek=tQ0;function zP(){return{canContainEols:["delete"],enter:{strikethrough:nQ0},exit:{strikethrough:sQ0}}}function GP(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:oQ0}],handlers:{delete:Ac}}}function nQ0($){this.enter({type:"delete",children:[]},$)}function sQ0($){this.exit($)}function Ac($,Z,J,H){let Q=J.createTracker(H),B=J.enter("strikethrough"),X=Q.move("~~");return X+=J.containerPhrasing($,{...Q.current(),before:X,after:"~"}),X+=Q.move("~~"),B(),X}function tQ0(){return"~"}function eQ0($){return $.length}function Dc($,Z){let J=Z||{},H=(J.align||[]).concat(),Q=J.stringLength||eQ0,B=[],X=[],z=[],G=[],U=0,K=-1;while(++K<$.length){let N=[],V=[],A=-1;if($[K].length>U)U=$[K].length;while(++A<$[K].length){let D=$B0($[K][A]);if(J.alignDelimiters!==!1){let L=Q(D);if(V[A]=L,G[A]===void 0||L>G[A])G[A]=L}N.push(D)}X[K]=N,z[K]=V}let Y=-1;if(typeof H==="object"&&"length"in H)while(++Y<U)B[Y]=Vc(H[Y]);else{let N=Vc(H);while(++Y<U)B[Y]=N}Y=-1;let F=[],W=[];while(++Y<U){let N=B[Y],V="",A="";if(N===99)V=":",A=":";else if(N===108)V=":";else if(N===114)A=":";let D=J.alignDelimiters===!1?1:Math.max(1,G[Y]-V.length-A.length),L=V+"-".repeat(D)+A;if(J.alignDelimiters!==!1){if(D=V.length+D+A.length,D>G[Y])G[Y]=D;W[Y]=D}F[Y]=L}X.splice(1,0,F),z.splice(1,0,W),K=-1;let q=[];while(++K<X.length){let N=X[K],V=z[K];Y=-1;let A=[];while(++Y<U){let D=N[Y]||"",L="",j="";if(J.alignDelimiters!==!1){let M=G[Y]-(V[Y]||0),_=B[Y];if(_===114)L=" ".repeat(M);else if(_===99)if(M%2)L=" ".repeat(M/2+0.5),j=" ".repeat(M/2-0.5);else L=" ".repeat(M/2),j=L;else j=" ".repeat(M)}if(J.delimiterStart!==!1&&!Y)A.push("|");if(J.padding!==!1&&!(J.alignDelimiters===!1&&D==="")&&(J.delimiterStart!==!1||Y))A.push(" ");if(J.alignDelimiters!==!1)A.push(L);if(A.push(D),J.alignDelimiters!==!1)A.push(j);if(J.padding!==!1)A.push(" ");if(J.delimiterEnd!==!1||Y!==U-1)A.push("|")}q.push(J.delimiterEnd===!1?A.join("").replace(/ +$/,""):A.join(""))}return q.join(`
39
- `)}function $B0($){return $===null||$===void 0?"":String($)}function Vc($){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 Lc($,Z,J,H){let Q=J.enter("blockquote"),B=J.createTracker(H);B.move("> "),B.shift(2);let X=J.indentLines(J.containerFlow($,B.current()),ZB0);return Q(),X}function ZB0($,Z,J){return">"+(J?"":" ")+$}function Pc($,Z){return Mc($,Z.inConstruct,!0)&&!Mc($,Z.notInConstruct,!1)}function Mc($,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 UP($,Z,J,H){let Q=-1;while(++Q<J.unsafe.length)if(J.unsafe[Q].character===`
40
- `&&Pc(J.stack,J.unsafe[Q]))return/[ \t]/.test(H.before)?"":" ";return"\\\n"}function _c($,Z){let J=String($),H=J.indexOf(Z),Q=H,B=0,X=0;if(typeof Z!=="string")throw TypeError("Expected substring");while(H!==-1){if(H===Q){if(++B>X)X=B}else B=1;Q=H+Z.length,H=J.indexOf(Z,Q)}return X}function jc($,Z){return Boolean(Z.options.fences===!1&&$.value&&!$.lang&&/[^ \r\n]/.test($.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test($.value))}function Oc($){let Z=$.options.fence||"`";if(Z!=="`"&&Z!=="~")throw Error("Cannot serialize code with `"+Z+"` for `options.fence`, expected `` ` `` or `~`");return Z}function Tc($,Z,J,H){let Q=Oc(J),B=$.value||"",X=Q==="`"?"GraveAccent":"Tilde";if(jc($,J)){let Y=J.enter("codeIndented"),F=J.indentLines(B,JB0);return Y(),F}let z=J.createTracker(H),G=Q.repeat(Math.max(_c(B,Q)+1,3)),U=J.enter("codeFenced"),K=z.move(G);if($.lang){let Y=J.enter(`codeFencedLang${X}`);K+=z.move(J.safe($.lang,{before:K,after:" ",encode:["`"],...z.current()})),Y()}if($.lang&&$.meta){let Y=J.enter(`codeFencedMeta${X}`);K+=z.move(" "),K+=z.move(J.safe($.meta,{before:K,after:`
41
- `,encode:["`"],...z.current()})),Y()}if(K+=z.move(`
42
- `),B)K+=z.move(B+`
43
- `);return K+=z.move(G),U(),K}function JB0($,Z,J){return(J?"":" ")+$}function GH($){let Z=$.options.quote||'"';if(Z!=='"'&&Z!=="'")throw Error("Cannot serialize title with `"+Z+"` for `options.quote`, expected `\"`, or `'`");return Z}function Cc($,Z,J,H){let Q=GH(J),B=Q==='"'?"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${B}`),U+=G.move(" "+Q),U+=G.move(J.safe($.title,{before:U,after:Q,...G.current()})),U+=G.move(Q),z();return X(),U}function wc($){let Z=$.options.emphasis||"*";if(Z!=="*"&&Z!=="_")throw Error("Cannot serialize emphasis with `"+Z+"` for `options.emphasis`, expected `*`, or `_`");return Z}function Y7($){return"&#x"+$.toString(16).toUpperCase()+";"}function UH($,Z,J){let H=I3($),Q=I3(Z);if(H===void 0)return Q===void 0?J==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:Q===1?{inside:!0,outside:!0}:{inside:!1,outside:!0};if(H===1)return Q===void 0?{inside:!1,outside:!1}:Q===1?{inside:!0,outside:!0}:{inside:!1,outside:!1};return Q===void 0?{inside:!1,outside:!1}:Q===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}KP.peek=HB0;function KP($,Z,J,H){let Q=wc(J),B=J.enter("emphasis"),X=J.createTracker(H),z=X.move(Q),G=X.move(J.containerPhrasing($,{after:Q,before:z,...X.current()})),U=G.charCodeAt(0),K=UH(H.before.charCodeAt(H.before.length-1),U,Q);if(K.inside)G=Y7(U)+G.slice(1);let Y=G.charCodeAt(G.length-1),F=UH(H.after.charCodeAt(0),Y,Q);if(F.inside)G=G.slice(0,-1)+Y7(Y);let W=X.move(Q);return B(),J.attentionEncodeSurroundingInfo={after:F.outside,before:K.outside},z+G+W}function HB0($,Z,J){return J.options.emphasis||"*"}function Ec($,Z){let J=!1;return k3($,function(H){if("value"in H&&/\r?\n|\r/.test(H.value)||H.type==="break")return J=!0,d$}),Boolean((!$.depth||$.depth<3)&&v$($)&&(Z.options.setext||J))}function Sc($,Z,J,H){let Q=Math.max(Math.min(6,$.depth||1),1),B=J.createTracker(H);if(Ec($,J)){let K=J.enter("headingSetext"),Y=J.enter("phrasing"),F=J.containerPhrasing($,{...B.current(),before:`
45
- `,after:`
46
- `});return Y(),K(),F+`
47
- `+(Q===1?"=":"-").repeat(F.length-(Math.max(F.lastIndexOf("\r"),F.lastIndexOf(`
48
- `))+1))}let X="#".repeat(Q),z=J.enter("headingAtx"),G=J.enter("phrasing");B.move(X+" ");let U=J.containerPhrasing($,{before:"# ",after:`
49
- `,...B.current()});if(/^[\t ]/.test(U))U=Y7(U.charCodeAt(0))+U.slice(1);if(U=U?X+" "+U:X,J.options.closeAtx)U+=" "+X;return G(),z(),U}YP.peek=QB0;function YP($){return $.value||""}function QB0(){return"<"}FP.peek=BB0;function FP($,Z,J,H){let Q=GH(J),B=Q==='"'?"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${B}`),U+=G.move(" "+Q),U+=G.move(J.safe($.title,{before:U,after:Q,...G.current()})),U+=G.move(Q),z();return U+=G.move(")"),X(),U}function BB0(){return"!"}WP.peek=XB0;function WP($,Z,J,H){let Q=$.referenceType,B=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 K=J.stack;J.stack=[],X=J.enter("reference");let Y=J.safe(J.associationId($),{before:G,after:"]",...z.current()});if(X(),J.stack=K,B(),Q==="full"||!U||U!==Y)G+=z.move(Y+"]");else if(Q==="shortcut")G=G.slice(0,-1);else G+=z.move("]");return G}function XB0(){return"!"}qP.peek=zB0;function qP($,Z,J){let H=$.value||"",Q="`",B=-1;while(new RegExp("(^|[^`])"+Q+"([^`]|$)").test(H))Q+="`";if(/[^ \r\n]/.test(H)&&(/^[ \r\n]/.test(H)&&/[ \r\n]$/.test(H)||/^`|`$/.test(H)))H=" "+H+" ";while(++B<J.unsafe.length){let X=J.unsafe[B],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 Q+H+Q}function zB0(){return"`"}function NP($,Z){let J=v$($);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))}AP.peek=GB0;function AP($,Z,J,H){let Q=GH(J),B=Q==='"'?"Quote":"Apostrophe",X=J.createTracker(H),z,G;if(NP($,J)){let K=J.stack;J.stack=[],z=J.enter("autolink");let Y=X.move("<");return Y+=X.move(J.containerPhrasing($,{before:Y,after:">",...X.current()})),Y+=X.move(">"),z(),J.stack=K,Y}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${B}`),U+=X.move(" "+Q),U+=X.move(J.safe($.title,{before:U,after:Q,...X.current()})),U+=X.move(Q),G();return U+=X.move(")"),z(),U}function GB0($,Z,J){return NP($,J)?"<":"["}VP.peek=UB0;function VP($,Z,J,H){let Q=$.referenceType,B=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 K=J.stack;J.stack=[],X=J.enter("reference");let Y=J.safe(J.associationId($),{before:G,after:"]",...z.current()});if(X(),J.stack=K,B(),Q==="full"||!U||U!==Y)G+=z.move(Y+"]");else if(Q==="shortcut")G=G.slice(0,-1);else G+=z.move("]");return G}function UB0(){return"["}function KH($){let Z=$.options.bullet||"*";if(Z!=="*"&&Z!=="+"&&Z!=="-")throw Error("Cannot serialize items with `"+Z+"` for `options.bullet`, expected `*`, `+`, or `-`");return Z}function Rc($){let Z=KH($),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 Ic($){let Z=$.options.bulletOrdered||".";if(Z!=="."&&Z!==")")throw Error("Cannot serialize items with `"+Z+"` for `options.bulletOrdered`, expected `.` or `)`");return Z}function VW($){let Z=$.options.rule||"*";if(Z!=="*"&&Z!=="-"&&Z!=="_")throw Error("Cannot serialize rules with `"+Z+"` for `options.rule`, expected `*`, `-`, or `_`");return Z}function kc($,Z,J,H){let Q=J.enter("list"),B=J.bulletCurrent,X=$.ordered?Ic(J):KH(J),z=$.ordered?X==="."?")":".":Rc(J),G=Z&&J.bulletLastUsed?X===J.bulletLastUsed:!1;if(!$.ordered){let K=$.children?$.children[0]:void 0;if((X==="*"||X==="-")&&K&&(!K.children||!K.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(VW(J)===X&&K){let Y=-1;while(++Y<$.children.length){let F=$.children[Y];if(F&&F.type==="listItem"&&F.children&&F.children[0]&&F.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=B,Q(),U}function bc($){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 yc($,Z,J,H){let Q=bc(J),B=J.bulletCurrent||KH(J);if(Z&&Z.type==="list"&&Z.ordered)B=(typeof Z.start==="number"&&Z.start>-1?Z.start:1)+(J.options.incrementListMarker===!1?0:Z.children.indexOf($))+B;let X=B.length+1;if(Q==="tab"||Q==="mixed"&&(Z&&Z.type==="list"&&Z.spread||$.spread))X=Math.ceil(X/4)*4;let z=J.createTracker(H);z.move(B+" ".repeat(X-B.length)),z.shift(X);let G=J.enter("listItem"),U=J.indentLines(J.containerFlow($,z.current()),K);return G(),U;function K(Y,F,W){if(F)return(W?"":" ".repeat(X))+Y;return(W?B:B+" ".repeat(X-B.length))+Y}}function xc($,Z,J,H){let Q=J.enter("paragraph"),B=J.enter("phrasing"),X=J.containerPhrasing($,H);return B(),Q(),X}var DP=$3(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function hc($,Z,J,H){return($.children.some(function(X){return DP(X)})?J.containerPhrasing:J.containerFlow).call(J,$,H)}function vc($){let Z=$.options.strong||"*";if(Z!=="*"&&Z!=="_")throw Error("Cannot serialize strong with `"+Z+"` for `options.strong`, expected `*`, or `_`");return Z}LP.peek=KB0;function LP($,Z,J,H){let Q=vc(J),B=J.enter("strong"),X=J.createTracker(H),z=X.move(Q+Q),G=X.move(J.containerPhrasing($,{after:Q,before:z,...X.current()})),U=G.charCodeAt(0),K=UH(H.before.charCodeAt(H.before.length-1),U,Q);if(K.inside)G=Y7(U)+G.slice(1);let Y=G.charCodeAt(G.length-1),F=UH(H.after.charCodeAt(0),Y,Q);if(F.inside)G=G.slice(0,-1)+Y7(Y);let W=X.move(Q+Q);return B(),J.attentionEncodeSurroundingInfo={after:F.outside,before:K.outside},z+G+W}function KB0($,Z,J){return J.options.strong||"*"}function gc($,Z,J,H){return J.safe($.value,H)}function fc($){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 mc($,Z,J){let H=(VW(J)+(J.options.ruleSpaces?" ":"")).repeat(fc(J));return J.options.ruleSpaces?H.slice(0,-1):H}var QX={blockquote:Lc,break:UP,code:Tc,definition:Cc,emphasis:KP,hardBreak:UP,heading:Sc,html:YP,image:FP,imageReference:WP,inlineCode:qP,link:AP,linkReference:VP,list:kc,listItem:yc,paragraph:xc,root:hc,strong:LP,text:gc,thematicBreak:mc};function PP(){return{enter:{table:YB0,tableData:uc,tableHeader:uc,tableRow:WB0},exit:{codeText:qB0,table:FB0,tableData:MP,tableHeader:MP,tableRow:MP}}}function YB0($){let Z=$._align;n1(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 FB0($){this.exit($),this.data.inTable=void 0}function WB0($){this.enter({type:"tableRow",children:[]},$)}function MP($){this.exit($)}function uc($){this.enter({type:"tableCell",children:[]},$)}function qB0($){let Z=this.resume();if(this.data.inTable)Z=Z.replace(/\\([\\|])/g,NB0);let J=this.stack[this.stack.length-1];n1(J.type==="inlineCode"),J.value=Z,this.exit($)}function NB0($,Z){return Z==="|"?Z:$}function _P($){let Z=$||{},J=Z.tableCellPadding,H=Z.tablePipeAlign,Q=Z.stringLength,B=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:F,table:X,tableCell:G,tableRow:z}};function X(W,q,N,V){return U(K(W,N,V),W.align)}function z(W,q,N,V){let A=Y(W,N,V),D=U([A]);return D.slice(0,D.indexOf(`
51
- `))}function G(W,q,N,V){let A=N.enter("tableCell"),D=N.enter("phrasing"),L=N.containerPhrasing(W,{...V,before:B,after:B});return D(),A(),L}function U(W,q){return Dc(W,{align:q,alignDelimiters:H,padding:J,stringLength:Q})}function K(W,q,N){let V=W.children,A=-1,D=[],L=q.enter("table");while(++A<V.length)D[A]=Y(V[A],q,N);return L(),D}function Y(W,q,N){let V=W.children,A=-1,D=[],L=q.enter("tableRow");while(++A<V.length)D[A]=G(V[A],W,q,N);return L(),D}function F(W,q,N){let V=QX.inlineCode(W,q,N);if(N.stack.includes("tableCell"))V=V.replace(/\|/g,"\\$&");return V}}function jP(){return{exit:{taskListCheckValueChecked:pc,taskListCheckValueUnchecked:pc,paragraph:AB0}}}function OP(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:VB0}}}function pc($){let Z=this.stack[this.stack.length-2];n1(Z.type==="listItem"),Z.checked=$.type==="taskListCheckValueChecked"}function AB0($){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];n1(J.type==="paragraph");let H=J.children[0];if(H&&H.type==="text"){let Q=Z.children,B=-1,X;while(++B<Q.length){let z=Q[B];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 VB0($,Z,J,H){let Q=$.children[0],B=typeof $.checked==="boolean"&&Q&&Q.type==="paragraph",X="["+($.checked?"x":" ")+"] ",z=J.createTracker(H);if(B)z.move(X);let G=QX.listItem($,Z,J,{...H,...z.current()});if(B)G=G.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,U);return G;function U(K){return K+X}}function TP(){return[HP(),BP(),zP(),PP(),jP()]}function CP($){return{extensions:[QP(),XP($),GP(),_P($),OP()]}}var DB0={tokenize:jB0,partial:!0},cc={tokenize:OB0,partial:!0},dc={tokenize:TB0,partial:!0},lc={tokenize:CB0,partial:!0},LB0={tokenize:wB0,partial:!0},ic={name:"wwwAutolink",tokenize:PB0,previous:ac},rc={name:"protocolAutolink",tokenize:_B0,previous:oc},y3={name:"emailAutolink",tokenize:MB0,previous:nc},J3={};function EP(){return{text:J3}}var r$=48;while(r$<123)if(J3[r$]=y3,r$++,r$===58)r$=65;else if(r$===91)r$=97;J3[43]=y3;J3[45]=y3;J3[46]=y3;J3[95]=y3;J3[72]=[y3,rc];J3[104]=[y3,rc];J3[87]=[y3,ic];J3[119]=[y3,ic];function MB0($,Z,J){let H=this,Q,B;return X;function X(Y){if(!wP(Y)||!nc.call(H,H.previous)||SP(H.events))return J(Y);return $.enter("literalAutolink"),$.enter("literalAutolinkEmail"),z(Y)}function z(Y){if(wP(Y))return $.consume(Y),z;if(Y===64)return $.consume(Y),G;return J(Y)}function G(Y){if(Y===46)return $.check(LB0,K,U)(Y);if(Y===45||Y===95||a5(Y))return B=!0,$.consume(Y),G;return K(Y)}function U(Y){return $.consume(Y),Q=!0,G}function K(Y){if(B&&Q&&A2(H.previous))return $.exit("literalAutolinkEmail"),$.exit("literalAutolink"),Z(Y);return J(Y)}}function PB0($,Z,J){let H=this;return Q;function Q(X){if(X!==87&&X!==119||!ac.call(H,H.previous)||SP(H.events))return J(X);return $.enter("literalAutolink"),$.enter("literalAutolinkWww"),$.check(DB0,$.attempt(cc,$.attempt(dc,B),J),J)(X)}function B(X){return $.exit("literalAutolinkWww"),$.exit("literalAutolink"),Z(X)}}function _B0($,Z,J){let H=this,Q="",B=!1;return X;function X(Y){if((Y===72||Y===104)&&oc.call(H,H.previous)&&!SP(H.events))return $.enter("literalAutolink"),$.enter("literalAutolinkHttp"),Q+=String.fromCodePoint(Y),$.consume(Y),z;return J(Y)}function z(Y){if(A2(Y)&&Q.length<5)return Q+=String.fromCodePoint(Y),$.consume(Y),z;if(Y===58){let F=Q.toLowerCase();if(F==="http"||F==="https")return $.consume(Y),G}return J(Y)}function G(Y){if(Y===47){if($.consume(Y),B)return U;return B=!0,G}return J(Y)}function U(Y){return Y===null||g$(Y)||x1(Y)||t9(Y)||f$(Y)?J(Y):$.attempt(cc,$.attempt(dc,K),J)(Y)}function K(Y){return $.exit("literalAutolinkHttp"),$.exit("literalAutolink"),Z(Y)}}function jB0($,Z,J){let H=0;return Q;function Q(X){if((X===87||X===119)&&H<3)return H++,$.consume(X),Q;if(X===46&&H===3)return $.consume(X),B;return J(X)}function B(X){return X===null?J(X):Z(X)}}function OB0($,Z,J){let H,Q,B;return X;function X(U){if(U===46||U===95)return $.check(lc,G,z)(U);if(U===null||x1(U)||t9(U)||U!==45&&f$(U))return G(U);return B=!0,$.consume(U),X}function z(U){if(U===95)H=!0;else Q=H,H=void 0;return $.consume(U),X}function G(U){if(Q||H||!B)return J(U);return Z(U)}}function TB0($,Z){let J=0,H=0;return Q;function Q(X){if(X===40)return J++,$.consume(X),Q;if(X===41&&H<J)return B(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(lc,Z,B)(X);if(X===null||x1(X)||t9(X))return Z(X);return $.consume(X),Q}function B(X){if(X===41)H++;return $.consume(X),Q}}function CB0($,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),B;if(z===93)return $.consume(z),Q;if(z===60||z===null||x1(z)||t9(z))return Z(z);return J(z)}function Q(z){if(z===null||z===40||z===91||x1(z)||t9(z))return Z(z);return H(z)}function B(z){return A2(z)?X(z):J(z)}function X(z){if(z===59)return $.consume(z),H;if(A2(z))return $.consume(z),X;return J(z)}}function wB0($,Z,J){return H;function H(B){return $.consume(B),Q}function Q(B){return a5(B)?J(B):Z(B)}}function ac($){return $===null||$===40||$===42||$===95||$===91||$===93||$===126||x1($)}function oc($){return!A2($)}function nc($){return!($===47||wP($))}function wP($){return $===43||$===45||$===46||$===95||a5($)}function SP($){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 EB0={tokenize:xB0,partial:!0};function RP(){return{document:{[91]:{name:"gfmFootnoteDefinition",tokenize:kB0,continuation:{tokenize:bB0},exit:yB0}},text:{[91]:{name:"gfmFootnoteCall",tokenize:IB0},[93]:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:SB0,resolveTo:RB0}}}}function SB0($,Z,J){let H=this,Q=H.events.length,B=H.parser.gfmFootnotes||(H.parser.gfmFootnotes=[]),X;while(Q--){let G=H.events[Q][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=G4(H.sliceSerialize({start:X.end,end:H.now()}));if(U.codePointAt(0)!==94||!B.includes(U.slice(1)))return J(G);return $.enter("gfmFootnoteCallLabelMarker"),$.consume(G),$.exit("gfmFootnoteCallLabelMarker"),Z(G)}}function RB0($,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 Q={type:"gfmFootnoteCall",start:Object.assign({},$[J+3][1].start),end:Object.assign({},$[$.length-1][1].end)},B={type:"gfmFootnoteCallMarker",start:Object.assign({},$[J+3][1].end),end:Object.assign({},$[J+3][1].end)};B.end.column++,B.end.offset++,B.end._bufferIndex++;let X={type:"gfmFootnoteCallString",start:Object.assign({},B.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",Q,Z],$[J+3],$[J+4],["enter",B,Z],["exit",B,Z],["enter",X,Z],["enter",z,Z],["exit",z,Z],["exit",X,Z],$[$.length-2],$[$.length-1],["exit",Q,Z]];return $.splice(J,$.length-J+1,...G),$}function IB0($,Z,J){let H=this,Q=H.parser.gfmFootnotes||(H.parser.gfmFootnotes=[]),B=0,X;return z;function z(Y){return $.enter("gfmFootnoteCall"),$.enter("gfmFootnoteCallLabelMarker"),$.consume(Y),$.exit("gfmFootnoteCallLabelMarker"),G}function G(Y){if(Y!==94)return J(Y);return $.enter("gfmFootnoteCallMarker"),$.consume(Y),$.exit("gfmFootnoteCallMarker"),$.enter("gfmFootnoteCallString"),$.enter("chunkString").contentType="string",U}function U(Y){if(B>999||Y===93&&!X||Y===null||Y===91||x1(Y))return J(Y);if(Y===93){$.exit("chunkString");let F=$.exit("gfmFootnoteCallString");if(!Q.includes(G4(H.sliceSerialize(F))))return J(Y);return $.enter("gfmFootnoteCallLabelMarker"),$.consume(Y),$.exit("gfmFootnoteCallLabelMarker"),$.exit("gfmFootnoteCall"),Z}if(!x1(Y))X=!0;return B++,$.consume(Y),Y===92?K:U}function K(Y){if(Y===91||Y===92||Y===93)return $.consume(Y),B++,U;return U(Y)}}function kB0($,Z,J){let H=this,Q=H.parser.gfmFootnotes||(H.parser.gfmFootnotes=[]),B,X=0,z;return G;function G(q){return $.enter("gfmFootnoteDefinition")._container=!0,$.enter("gfmFootnoteDefinitionLabel"),$.enter("gfmFootnoteDefinitionLabelMarker"),$.consume(q),$.exit("gfmFootnoteDefinitionLabelMarker"),U}function U(q){if(q===94)return $.enter("gfmFootnoteDefinitionMarker"),$.consume(q),$.exit("gfmFootnoteDefinitionMarker"),$.enter("gfmFootnoteDefinitionLabelString"),$.enter("chunkString").contentType="string",K;return J(q)}function K(q){if(X>999||q===93&&!z||q===null||q===91||x1(q))return J(q);if(q===93){$.exit("chunkString");let N=$.exit("gfmFootnoteDefinitionLabelString");return B=G4(H.sliceSerialize(N)),$.enter("gfmFootnoteDefinitionLabelMarker"),$.consume(q),$.exit("gfmFootnoteDefinitionLabelMarker"),$.exit("gfmFootnoteDefinitionLabel"),F}if(!x1(q))z=!0;return X++,$.consume(q),q===92?Y:K}function Y(q){if(q===91||q===92||q===93)return $.consume(q),X++,K;return K(q)}function F(q){if(q===58){if($.enter("definitionMarker"),$.consume(q),$.exit("definitionMarker"),!Q.includes(B))Q.push(B);return $1($,W,"gfmFootnoteDefinitionWhitespace")}return J(q)}function W(q){return Z(q)}}function bB0($,Z,J){return $.check(e9,Z,$.attempt(EB0,Z,J))}function yB0($){$.exit("gfmFootnoteDefinition")}function xB0($,Z,J){let H=this;return $1($,Q,"gfmFootnoteDefinitionIndent",5);function Q(B){let X=H.events[H.events.length-1];return X&&X[1].type==="gfmFootnoteDefinitionIndent"&&X[2].sliceSerialize(X[1],!0).length===4?Z(B):J(B)}}function IP($){let J=($||{}).singleTilde,H={name:"strikethrough",tokenize:B,resolveAll:Q};if(J===null||J===void 0)J=!0;return{text:{[126]:H},insideSpan:{null:[H]},attentionMarkers:{null:[126]}};function Q(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 K={type:"strikethrough",start:Object.assign({},X[U][1].start),end:Object.assign({},X[G][1].end)},Y={type:"strikethroughText",start:Object.assign({},X[U][1].end),end:Object.assign({},X[G][1].start)},F=[["enter",K,z],["enter",X[U][1],z],["exit",X[U][1],z],["enter",Y,z]],W=z.parser.constructs.insideSpan.null;if(W)Z2(F,F.length,0,G7(W,X.slice(U+1,G),z));Z2(F,F.length,0,[["exit",Y,z],["enter",X[G][1],z],["exit",X[G][1],z],["exit",K,z]]),Z2(X,U-1,G-U+3,F),G=U+F.length-2;break}}G=-1;while(++G<X.length)if(X[G][1].type==="strikethroughSequenceTemporary")X[G][1].type="data";return X}function B(X,z,G){let U=this.previous,K=this.events,Y=0;return F;function F(q){if(U===126&&K[K.length-1][1].type!=="characterEscape")return G(q);return X.enter("strikethroughSequenceTemporary"),W(q)}function W(q){let N=I3(U);if(q===126){if(Y>1)return G(q);return X.consume(q),Y++,W}if(Y<2&&!J)return G(q);let V=X.exit("strikethroughSequenceTemporary"),A=I3(q);return V._open=!A||A===2&&Boolean(N),V._close=!N||N===2&&Boolean(A),z(q)}}}class kP{constructor(){this.map=[]}add($,Z,J){hB0(this,$,Z,J)}consume($){if(this.map.sort(function(Q,B){return Q[0]-B[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 Q of H)$.push(Q);H=J.pop()}this.map.length=0}}function hB0($,Z,J,H){let Q=0;if(J===0&&H.length===0)return;while(Q<$.map.length){if($.map[Q][0]===Z){$.map[Q][1]+=J,$.map[Q][2].push(...H);return}Q+=1}$.map.push([Z,J,H])}function sc($,Z){let J=!1,H=[];while(Z<$.length){let Q=$[Z];if(J){if(Q[0]==="enter"){if(Q[1].type==="tableContent")H.push($[Z+1][1].type==="tableDelimiterMarker"?"left":"none")}else if(Q[1].type==="tableContent"){if($[Z-1][1].type==="tableDelimiterMarker"){let B=H.length-1;H[B]=H[B]==="left"?"center":"right"}}else if(Q[1].type==="tableDelimiterRow")break}else if(Q[0]==="enter"&&Q[1].type==="tableDelimiterRow")J=!0;Z+=1}return H}function bP(){return{flow:{null:{name:"table",tokenize:vB0,resolveAll:gB0}}}}function vB0($,Z,J){let H=this,Q=0,B=0,X;return z;function z(T){let I=H.events.length-1;while(I>-1){let O=H.events[I][1].type;if(O==="lineEnding"||O==="linePrefix")I--;else break}let y=I>-1?H.events[I][1].type:null,S=y==="tableHead"||y==="tableRow"?_:G;if(S===_&&H.parser.lazy[H.now().line])return J(T);return S(T)}function G(T){return $.enter("tableHead"),$.enter("tableRow"),U(T)}function U(T){if(T===124)return K(T);return X=!0,B+=1,K(T)}function K(T){if(T===null)return J(T);if(u0(T)){if(B>1)return B=0,H.interrupt=!0,$.exit("tableRow"),$.enter("lineEnding"),$.consume(T),$.exit("lineEnding"),W;return J(T)}if(Q1(T))return $1($,K,"whitespace")(T);if(B+=1,X)X=!1,Q+=1;if(T===124)return $.enter("tableCellDivider"),$.consume(T),$.exit("tableCellDivider"),X=!0,K;return $.enter("data"),Y(T)}function Y(T){if(T===null||T===124||x1(T))return $.exit("data"),K(T);return $.consume(T),T===92?F:Y}function F(T){if(T===92||T===124)return $.consume(T),Y;return Y(T)}function W(T){if(H.interrupt=!1,H.parser.lazy[H.now().line])return J(T);if($.enter("tableDelimiterRow"),X=!1,Q1(T))return $1($,q,"linePrefix",H.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(T);return q(T)}function q(T){if(T===45||T===58)return V(T);if(T===124)return X=!0,$.enter("tableCellDivider"),$.consume(T),$.exit("tableCellDivider"),N;return M(T)}function N(T){if(Q1(T))return $1($,V,"whitespace")(T);return V(T)}function V(T){if(T===58)return B+=1,X=!0,$.enter("tableDelimiterMarker"),$.consume(T),$.exit("tableDelimiterMarker"),A;if(T===45)return B+=1,A(T);if(T===null||u0(T))return j(T);return M(T)}function A(T){if(T===45)return $.enter("tableDelimiterFiller"),D(T);return M(T)}function D(T){if(T===45)return $.consume(T),D;if(T===58)return X=!0,$.exit("tableDelimiterFiller"),$.enter("tableDelimiterMarker"),$.consume(T),$.exit("tableDelimiterMarker"),L;return $.exit("tableDelimiterFiller"),L(T)}function L(T){if(Q1(T))return $1($,j,"whitespace")(T);return j(T)}function j(T){if(T===124)return q(T);if(T===null||u0(T)){if(!X||Q!==B)return M(T);return $.exit("tableDelimiterRow"),$.exit("tableHead"),Z(T)}return M(T)}function M(T){return J(T)}function _(T){return $.enter("tableRow"),E(T)}function E(T){if(T===124)return $.enter("tableCellDivider"),$.consume(T),$.exit("tableCellDivider"),E;if(T===null||u0(T))return $.exit("tableRow"),Z(T);if(Q1(T))return $1($,E,"whitespace")(T);return $.enter("data"),C(T)}function C(T){if(T===null||T===124||x1(T))return $.exit("data"),E(T);return $.consume(T),T===92?R:C}function R(T){if(T===92||T===124)return $.consume(T),C;return C(T)}}function gB0($,Z){let J=-1,H=!0,Q=0,B=[0,0,0,0],X=[0,0,0,0],z=!1,G=0,U,K,Y,F=new kP;while(++J<$.length){let W=$[J],q=W[1];if(W[0]==="enter"){if(q.type==="tableHead"){if(z=!1,G!==0)tc(F,Z,G,U,K),K=void 0,G=0;U={type:"table",start:Object.assign({},q.start),end:Object.assign({},q.end)},F.add(J,0,[["enter",U,Z]])}else if(q.type==="tableRow"||q.type==="tableDelimiterRow"){if(H=!0,Y=void 0,B=[0,0,0,0],X=[0,J+1,0,0],z)z=!1,K={type:"tableBody",start:Object.assign({},q.start),end:Object.assign({},q.end)},F.add(J,0,[["enter",K,Z]]);Q=q.type==="tableDelimiterRow"?2:K?3:1}else if(Q&&(q.type==="data"||q.type==="tableDelimiterMarker"||q.type==="tableDelimiterFiller")){if(H=!1,X[2]===0){if(B[1]!==0)X[0]=X[1],Y=DW(F,Z,B,Q,void 0,Y),B=[0,0,0,0];X[2]=J}}else if(q.type==="tableCellDivider")if(H)H=!1;else{if(B[1]!==0)X[0]=X[1],Y=DW(F,Z,B,Q,void 0,Y);B=X,X=[B[1],J,0,0]}}else if(q.type==="tableHead")z=!0,G=J;else if(q.type==="tableRow"||q.type==="tableDelimiterRow"){if(G=J,B[1]!==0)X[0]=X[1],Y=DW(F,Z,B,Q,J,Y);else if(X[1]!==0)Y=DW(F,Z,X,Q,J,Y);Q=0}else if(Q&&(q.type==="data"||q.type==="tableDelimiterMarker"||q.type==="tableDelimiterFiller"))X[3]=J}if(G!==0)tc(F,Z,G,U,K);F.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=sc(Z.events,J)}return $}function DW($,Z,J,H,Q,B){let X=H===1?"tableHeader":H===2?"tableDelimiter":"tableData",z="tableContent";if(J[0]!==0)B.end=Object.assign({},YH(Z.events,J[0])),$.add(J[0],0,[["exit",B,Z]]);let G=YH(Z.events,J[1]);if(B={type:X,start:Object.assign({},G),end:Object.assign({},G)},$.add(J[1],0,[["enter",B,Z]]),J[2]!==0){let U=YH(Z.events,J[2]),K=YH(Z.events,J[3]),Y={type:"tableContent",start:Object.assign({},U),end:Object.assign({},K)};if($.add(J[2],0,[["enter",Y,Z]]),H!==2){let F=Z.events[J[2]],W=Z.events[J[3]];if(F[1].end=Object.assign({},W[1].end),F[1].type="chunkText",F[1].contentType="text",J[3]>J[2]+1){let q=J[2]+1,N=J[3]-J[2]-1;$.add(q,N,[])}}$.add(J[3]+1,0,[["exit",Y,Z]])}if(Q!==void 0)B.end=Object.assign({},YH(Z.events,Q)),$.add(Q,0,[["exit",B,Z]]),B=void 0;return B}function tc($,Z,J,H,Q){let B=[],X=YH(Z.events,J);if(Q)Q.end=Object.assign({},X),B.push(["exit",Q,Z]);H.end=Object.assign({},X),B.push(["exit",H,Z]),$.add(J+1,0,B)}function YH($,Z){let J=$[Z],H=J[0]==="enter"?"start":"end";return J[1][H]}var fB0={name:"tasklistCheck",tokenize:mB0};function yP(){return{text:{[91]:fB0}}}function mB0($,Z,J){let H=this;return Q;function Q(G){if(H.previous!==null||!H._gfmTasklistFirstContentOfListItem)return J(G);return $.enter("taskListCheck"),$.enter("taskListCheckMarker"),$.consume(G),$.exit("taskListCheckMarker"),B}function B(G){if(x1(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(Q1(G))return $.check({tokenize:uB0},Z,J)(G);return J(G)}}function uB0($,Z,J){return $1($,H,"whitespace");function H(Q){return Q===null?J(Q):Z(Q)}}function ec($){return kF([EP(),RP(),IP($),bP(),yP()])}var pB0={};function LW($){let Z=this,J=$||pB0,H=Z.data(),Q=H.micromarkExtensions||(H.micromarkExtensions=[]),B=H.fromMarkdownExtensions||(H.fromMarkdownExtensions=[]),X=H.toMarkdownExtensions||(H.toMarkdownExtensions=[]);Q.push(ec(J)),B.push(TP()),X.push(CP(J))}var a$=P(c(),1),cB0=[LW],dB0=[AW],lB0={code({node:$,className:Z,children:J,...H}){return a$.jsx("code",{className:B0("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 a$.jsx("div",{className:"not-prose my-2 rounded-lg border border-border bg-accent px-3 py-2.5",children:a$.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 $d({size:$="sm",content:Z}){let J=e1(),{base:H}=i2();return a$.jsx("div",{className:B0("prose max-w-full min-w-0 wrap-anywhere prose-inherit",$==="sm"&&"prose-sm"),children:a$.jsx(QW,{remarkPlugins:cB0,rehypePlugins:dB0,components:lB0,urlTransform:(Q,B,X)=>{if(X.tagName==="a"&&B==="href"&&Q.startsWith("moi:"))try{return B$(Q,{apiBase:`/api/workspaces/${encodeURIComponent(J)}`,workspacePath:o8(J,H)})}catch{return""}return BW(Q)},children:Z})})}function Zd({content:$}){return a$.jsx(QW,{allowedElements:[],skipHtml:!0,unwrapDisallowed:!0,children:$})}var J_=P(m(),1);var Jd="/airtable-hsa66v6q.png";var Hd="/apollo-2ed5dy2d.png";var Qd="/asana-tvgtwbx2.png";var Bd="/atlassian-b3tq39hs.png";var Xd="/box-w3n36t5g.png";var xP="/chrome-tspm94rw.svg";var zd="/clickup-qqrqqvqb.png";var Gd="/cloudflare-j9p931v6.png";var Ud="/context7-8ht0xjfy.png";var Kd="/datadog-70ne3yzt.png";var Yd="/discord-vejhptwx.png";var Fd="/dropbox-4m5s9mgr.png";var Wd="/elevenlabs-2nzzej1t.png";var qd="/exa-qqj3vr0x.png";var Nd="/figma-y9898rry.png";var Ad="/firecrawl-w2t8nehx.png";var Vd="/github-av5r5y3e.png";var Dd="/gitlab-4pv5vm6b.png";var Ld="/gmail-sg6a5v3x.png";var Md="/googlecalendar-nqhh2v7r.png";var Pd="/googledrive-6s8xyab7.png";var _d="/grafana-1yfsnwr6.png";var jd="/granola-7j3b0nk2.png";var Od="/hubspot-hghcmc2t.png";var Td="/huggingface-kxzaxj83.png";var Cd="/intercom-td763jt8.png";var wd="/linear-v9s3az2d.png";var Ed="/monday-jdbs4wwf.png";var Sd="/mongodb-emzxvhd5.png";var Rd="/neon-zj4qar44.png";var Id="/notion-w034c0b8.png";var kd="/paper-zbt34fab.png";var bd="/paypal-kwwf7xsc.png";var yd="/perplexity-4y63rxvj.png";var xd="/postgresql-qsspbsr1.png";var hd="/posthog-sphppc4w.png";var vd="/puppeteer-2xjt1a9b.png";var gd="/railway-834de8d2.png";var fd="/redis-spm6w2m1.png";var md="/salesforce-1mk56v4z.png";var ud="/sentry-hdwpmvek.png";var pd="/shopify-90dadaav.png";var cd="/slack-1c1wj62s.png";var dd="/snowflake-hfpykpgy.png";var ld="/stripe-zrfaqbj3.png";var id="/supabase-4vg33zf2.png";var rd="/telegram-v6tjyrs7.png";var ad="/twilio-dpyjdwpj.png";var od="/vercel-7d0ssw28.png";var nd="/zapier-p67qfch0.png";var pX0={airtable:Jd,apollo:Hd,asana:Qd,atlassian:Bd,box:Xd,chrome:xP,"chrome-devtools":xP,clickup:zd,cloudflare:Gd,context7:Ud,datadog:Kd,discord:Yd,dropbox:Fd,elevenlabs:Wd,exa:qd,figma:Nd,firecrawl:Ad,github:Vd,gitlab:Dd,gmail:Ld,googlecalendar:Md,googledrive:Pd,grafana:_d,granola:jd,hubspot:Od,huggingface:Td,intercom:Cd,linear:wd,monday:Ed,mongodb:Sd,neon:Rd,notion:Id,paper:kd,paypal:bd,perplexity:yd,postgresql:xd,posthog:hd,puppeteer:vd,railway:gd,redis:fd,salesforce:md,sentry:ud,shopify:pd,slack:cd,snowflake:dd,stripe:ld,supabase:id,telegram:rd,twilio:ad,vercel:od,zapier:nd},cX0={"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 sd($){let Z=$.match(/^claude[._]ai[._\s]+(.+)$/i);if(!Z)return $;return Z[1].replace(/_/g," ")}function MW($){return $.toLowerCase().replace(/[\s._-]+/g,"")}var dX0=new Map(Object.entries(pX0).map(([$,Z])=>[MW($),Z])),lX0=new Map(Object.entries(cX0).map(([$,Z])=>[MW($),MW(Z)]));function PW($){let Z=MW(sd($));return dX0.get(lX0.get(Z)??Z)}function _W($){return sd($).split(/[\s._-]+/).filter(Boolean).map((Z)=>Z[0].toUpperCase()+Z.slice(1)).join(" ")}var hP=P(c(),1);function BX({open:$,children:Z}){return hP.jsx(j4,{initial:!1,children:$&&hP.jsx(z5.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 td=P(m(),1);var Zl=P(c(),1),iX0=/\.(png|jpe?g|gif|webp|avif|svg)$/i;function ed($,Z){if($.name!=="Read"||!Z)return null;let J=$.input,H=typeof J.file_path==="string"?J.file_path:null;if(!H||!iX0.test(H))return null;let Q=Z.endsWith("/")?Z:`${Z}/`;if(!H.startsWith(Q))return null;return H.slice(Q.length)}function $l({relPath:$}){let Z=e1(),[J,H]=td.useState(!1);if(J)return null;let Q=`/api/workspaces/${Z}/preview/${$.split("/").map(encodeURIComponent).join("/")}`;return Zl.jsx("img",{src:Q,alt:$,loading:"lazy",onError:()=>H(!0),className:"max-h-64 max-w-full self-start rounded-lg border border-border object-contain"})}var UX=P(m(),1);var Hl=P(c(),1),rX0=B0("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 Jl({children:$,active:Z=!0,className:J}){return Hl.jsx("span",{className:B0(J,Z&&rX0),children:$})}var XX=P(c(),1);function jW({className:$}){return XX.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:[XX.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"}),XX.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 V2=P(c(),1),OW="group/row flex w-full items-center gap-2 py-1.5 text-left select-none";function WH({isFirst:$,isLast:Z,marker:J,loading:H=!1,isError:Q=!1,children:B}){let X=J!=null||H;return V2.jsxs("div",{className:"relative flex gap-2.5",children:[V2.jsxs("div",{className:"relative w-[13px] shrink-0",children:[!$&&V2.jsx("span",{className:B0("absolute top-0 left-1/2 w-px -translate-x-1/2 bg-border",X?"h-1":"h-2.5")}),!Z&&V2.jsx("span",{className:B0("absolute bottom-0 left-1/2 w-px -translate-x-1/2 bg-border",X?"top-[26px]":"top-5")}),J?V2.jsx("span",{className:"absolute top-[15px] left-1/2 z-10 -translate-x-1/2 -translate-y-1/2",children:J}):H?V2.jsx("span",{className:"absolute top-[15px] left-1/2 z-10 flex -translate-x-1/2 -translate-y-1/2 p-0.5",children:V2.jsx(b5,{size:12,stroke:1.75,className:"animate-spin text-muted-foreground"})}):V2.jsx("span",{className:B0("absolute top-[15px] left-1/2 z-10 size-[5px] -translate-x-1/2 -translate-y-1/2 rounded-full",Q?"bg-destructive":"bg-border")})]}),B]})}function zX({open:$}){return V2.jsx(z5.span,{animate:{rotate:$?90:0},transition:{type:"spring",duration:0.2,bounce:0.1},className:B0("flex shrink-0",$?"opacity-100":"opacity-0 group-hover/row:opacity-100"),children:V2.jsx(R$,{size:12,stroke:1.75})})}function FH({children:$,className:Z}){return V2.jsx("span",{className:B0("flex size-4 items-center justify-center overflow-hidden rounded-xs bg-muted",Z),children:$})}function Ql({icon:$,size:Z=12,stroke:J=1.75}){return V2.jsx(FH,{children:V2.jsx($,{size:Z,stroke:J,className:"text-muted-foreground"})})}function Bl({src:$}){if(!$)return V2.jsx(FH,{children:V2.jsx(jW,{className:"size-3 text-muted-foreground"})});return V2.jsx(FH,{children:V2.jsx("img",{src:$,alt:"",className:"size-full object-cover"})})}var Qz0=Gl(),vP=Nl();function Bz0($){if(!$)return"$";return/^[A-Za-z_][A-Za-z0-9_]*$/.test($)?`$${$}`:`\${${$}}`}function Xz0($){try{return vP($,Bz0)}catch{return null}}function Al($){return $.split("/").pop()??$}var zz0=new Set(["bash","sh","zsh","fish","dash","ash","ksh","mksh","csh","tcsh","nu","pwsh","powershell"]),Gz0=new Set(["-o","+o","-O","+O","--rcfile","--init-file"]),Uz0=/^[A-Za-z_][A-Za-z0-9_]*=/;function Kz0($){if(/^-[a-zA-Z]*c$/.test($))return!0;let Z=$.toLowerCase();return Z==="--command"||Z==="-command"}function Yz0($){let Z=Xz0($);if(!Z||Z.length<3)return null;let J=(B)=>{let X=Z[B];return typeof X==="string"?X:null},H=0,Q=()=>{while(Uz0.test(J(H)??""))H++};if(Q(),Al(J(H)??"")==="env")H++,Q();if(!zz0.has(Al(J(H)??"")))return null;H++;while(H<Z.length){let B=J(H);if(B===null)return null;if(Kz0(B)){if(H+2!==Z.length)return null;return J(H+1)?.trim()||null}if(!B.startsWith("-")&&!B.startsWith("+"))return null;H+=Gz0.has(B)?2:1}return null}function Fz0($){let Z=$;for(let J=0;J<3;J++){let H=Yz0(Z);if(H===null)return Z;Z=H}return Z}function Wz0($){return $.replace(/\\\r?\n[ \t]*/g," ").replace(/[ \t]*\r?\n[ \t]*/g," ").replace(/[ \t]{2,}/g," ").trim()}function n$($){return Wz0(Fz0($))}function qH($,Z){let J=n$($);return J?Z(`$ ${J}`):""}var qz0=/^[A-Za-z]:\//;function Nz0($=""){if(!$)return $;return $.replace(/\\/g,"/").replace(qz0,(Z)=>Z.toUpperCase())}var Az0=/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;var Vl=/^\/([A-Za-z]:)?$/;function Vz0(){if(typeof process<"u"&&typeof process.cwd==="function")return process.cwd().replace(/\\/g,"/");return"/"}var gP=function(...$){$=$.map((H)=>Nz0(H));let Z="",J=!1;for(let H=$.length-1;H>=-1&&!J;H--){let Q=H>=0?$[H]:Vz0();if(!Q||Q.length===0)continue;Z=`${Q}/${Z}`,J=fP(Q)}if(Z=Dl(Z,!J),J&&!fP(Z))return`/${Z}`;return Z.length>0?Z:"."};function Dl($,Z){let J="",H=0,Q=-1,B=0,X=null;for(let z=0;z<=$.length;++z){if(z<$.length)X=$[z];else if(X==="/")break;else X="/";if(X==="/"){if(Q===z-1||B===1);else if(B===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("/");Q=z,B=0;continue}else if(J.length>0){J="",H=0,Q=z,B=0;continue}}if(Z)J+=J.length>0?"/..":"..",H=2}else{if(J.length>0)J+=`/${$.slice(Q+1,z)}`;else J=$.slice(Q+1,z);H=z-Q-1}Q=z,B=0}else if(X==="."&&B!==-1)++B;else B=-1}return J}var fP=function($){return Az0.test($)};var mP=function($,Z){let J=gP($).replace(Vl,"$1").split("/"),H=gP(Z).replace(Vl,"$1").split("/");if(H[0][1]===":"&&J[0][1]===":"&&J[0]!==H[0])return H.join("/");let Q=[...J];for(let B of Q){if(H[0]!==B)break;J.shift(),H.shift()}return[...J.map(()=>".."),...H].join("/")};function NH($){return $.input??{}}function N1($,Z){let J=$[Z];return typeof J==="string"?J:""}function Ll($){return(Z)=>Z.replace(/\/[^\s"']+/g,(J)=>{if(!$)return J;let H=mP($,J);return H.startsWith("..")?J:H})}function s$($){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 Dz0={ToolSearch:"Tool search",WebSearch:"Web search",WebFetch:"Web fetch"};function Lz0($){if(!$.startsWith("mcp__"))return $;let Z=$.slice(5).split("__");return Z.length>=2?Z.slice(1).join("__"):Z[0]}function Mz0($,Z){let J=$.name,H=NH($);if(J==="Bash")return qH(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 Q=N1(H,"query");if(Q.startsWith("select:"))return Q.slice(7).split(",").map(Lz0).join(", ");return Q}return""}var GX={displayName:($)=>Dz0[$.name]??$.name,brief:Mz0};var uP={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"},Pl={read:"Read",listFiles:"List files",search:"Search"};function _l($){let Z=$?.commandActions;if(!Array.isArray(Z)||Z.length===0)return null;let J=Z[0],H=J?.type;if(!H||!(H in Pl))return null;if(Z.some((Q)=>Q?.type!==H))return null;return J}var Ml={spawn_agent:"Run sub-agent",send_input:"Message the agent",resume_agent:"Resume the agent",close_agent:"Stopping the agent"};function Pz0($){if($.name==="exec"){let Z=_l($.input);if(Z?.type)return Pl[Z.type]}if($.name==="subagent"){let Z=$.input?.action;if(typeof Z==="string"&&Z in Ml)return Ml[Z]}return uP[$.name]??$.name}function _z0($,Z){let J=$.name,H=NH($);if(J==="exec"){let Q=_l(H);if(Q?.type==="read")return Z(Q.path||Q.name||"");if(Q?.type==="search")return[Q.query&&`/${Q.query}/`,Q.path&&Z(Q.path)].filter(Boolean).join(" ");if(Q?.type==="listFiles")return Q.path?Z(Q.path):"";return qH(N1(H,"command"),Z)}if(J==="apply_patch"){let Q=H.changes;if(Array.isArray(Q))return Q.map((X)=>X&&typeof X==="object"?X.path:void 0).filter((X)=>typeof X==="string").map(Z).join(", ");return""}if(J==="web_search"){let Q=H.queries;if(Array.isArray(Q)&&Q.length>0)return Q.filter((B)=>typeof B==="string").join(" · ");return N1(H,"query")||[N1(H,"url"),N1(H,"pattern")].filter(Boolean).join(" · ")}if(J==="update_plan"){let Q=H.plan;return typeof Q==="string"?Q.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 jl={displayName:Pz0,brief:_z0};function Ol($){let Z=$.indexOf(":"),J=(Z>0?$.slice(0,Z):$).trim(),H=Z>0?$.slice(Z+1).trim():"",Q=J.match(/^(.*?)\s*\(([^)]*)\)$/);if(!Q)return{action:J,qualifier:"",detail:H};return{action:Q[1].trim(),qualifier:Q[2].trim(),detail:H}}var jz0={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 Oz0($){let{action:Z}=Ol($.name),J=jz0[Z];if(J)return J;let H=Z.replace(/_/g," ");return H.charAt(0).toUpperCase()+H.slice(1)}function Tz0($,Z){let{action:J,qualifier:H,detail:Q}=Ol($.name),B=Q||H;if(!B)return"";return J==="terminal"?`$ ${n$(B)}`:Z(B)}var Tl={displayName:Oz0,brief:Tz0};var Cz0={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 wz0($,Z){let J=$.name,H=NH($);if(J==="read"||J==="write"||J==="edit")return Z(N1(H,"path"));if(J==="apply_patch"){let Q=H.changes;if(Array.isArray(Q)&&Q.length>0){let z=Q.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 B=N1(H,"patch")||N1(H,"input"),X=B.split(`
54
- `).find((z)=>z.startsWith("*** "))??B.split(`
55
- `)[0];return Z(X??"")}if(J==="exec"||J==="bash"){let Q=N1(H,"command")||N1(H,"code");return qH(Q,Z)}if(J==="ls"||J==="find"||J==="grep")return Z(N1(H,"path")||N1(H,"pattern"));if(J==="process"){let Q=N1(H,"action"),B=N1(H,"name");return[Q,B].filter(Boolean).join(" ")||Z(n$(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 Q=H.plan;if(Array.isArray(Q)){let X=Q.find((z)=>!!z&&typeof z==="object"&&z.status==="in_progress")?.step??Q[0]?.step;if(typeof X==="string")return X}return""}return""}var Cl={displayName:($)=>Cz0[$.name]??GX.displayName($),brief:($,Z)=>wz0($,Z)||GX.brief($,Z)};function pP($){if(!($.name==="Bash"||$.name==="exec"||$.name==="bash"))return null;let J=$.input??{},H=typeof J.command==="string"?J.command:"";if(!H)return null;let B=n$(H).match(/(?:^|\s|\$\()mcporter(?:\)?)\s+call\s+([A-Za-z0-9_-]+)\.([A-Za-z0-9_-]+)((?:\s+(?!&&|\|\||;|\|)\S+)*)/);if(!B)return null;return{server:B[1],tool:B[2],rest:(B[3]??"").trim()}}function cP($){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 dP($){if($.provider!=="codex"||!$.mcpServer)return null;if($.name in uP)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 lP($,Z){let J=Z.toLowerCase();return["-","_","."].find((Q)=>J.startsWith($.toLowerCase()+Q))?Z.slice($.length+1):Z}var Ez0={"claude-code":GX,openclaw:Cl,codex:jl,hermes:Tl};function wl($){return Ez0[$.provider??"claude-code"]}function El($){return wl($).displayName($)}function Sl($,Z){return wl($).brief($,Ll(Z))}var J2=P(c(),1),Rl=[Il,kl,iP];function Sz0(){let[$,Z]=UX.useState(0);UX.useEffect(()=>{let H=setInterval(()=>Z((Q)=>(Q+1)%Rl.length),600);return()=>clearInterval(H)},[]);let J=Rl[$];return J2.jsx(FH,{className:"size-5",children:J2.jsx(J,{size:16,stroke:1.75,className:"text-foreground"})})}function bl({call:$,cwd:Z,isFirst:J,isLast:H,renderNestedParts:Q}){let[B,X]=UX.useState(!1),z=$.subagent,G=$.input??{},U=z?.description??G.description??"Subtask",K=z?.status,Y=$.state==="error"||K==="failed",F=$.state==="running"||K==="running",W=z?.usage?.toolUses,q=z?.usage?.durationMs,V=(F&&z?.progress?.length?z.progress[z.progress.length-1]:null)??(W!=null?`Took ${W} step${W===1?"":"s"}`:null),A=(z?.transcript??[]).flatMap((j)=>j.parts),D=typeof $.output==="string"?$.output:"",L=A.length>0||!!D;return J2.jsx(WH,{isFirst:J,isLast:H,marker:F?J2.jsx(Sz0,{}):J2.jsx(FH,{className:"size-5",children:J2.jsx(iP,{size:16,stroke:1.75,className:"text-foreground"})}),isError:Y,children:J2.jsxs("div",{className:"min-w-0 flex-1",children:[J2.jsxs("button",{type:"button",title:`Agent: ${U}`,onClick:()=>L&&X((j)=>!j),className:B0("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:[J2.jsxs("span",{className:"flex w-full items-center gap-2",children:[J2.jsxs(Jl,{active:F,className:"min-w-0 flex-1 truncate text-xs font-medium",children:["Agent: ",U]}),!F&&q!=null&&J2.jsx("span",{className:"shrink-0 rounded-full border border-border px-1.5 text-[10px] font-medium text-muted-foreground tabular-nums",children:s$(q)}),K==="failed"&&J2.jsx("span",{className:"shrink-0 text-xs text-destructive",children:"✗"}),K==="stopped"&&J2.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:"✗"}),L&&J2.jsx(zX,{open:B})]}),V&&J2.jsx("span",{className:"w-full truncate text-xs text-muted-foreground",children:V})]}),L&&J2.jsx(BX,{open:B,children:J2.jsxs("div",{className:"mt-1 mb-1 overflow-hidden rounded-lg border border-border",children:[A.length>0&&J2.jsx("div",{className:"py-1.5 pr-2 pl-3",children:Q(A,Z)}),D&&J2.jsx("div",{className:B0("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:D})]})})]})})}var t$=P(m(),1);var cl=P(m(),1);var aP=new Set(["<",">","{","}","[","]"]),tP=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"]),Rz0=new Set([...tP,"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"]),vl=new Set(["+","-","*","/","%","=","!","&","|","^","~","!","?",":",".",",",";","'",'"',".","(",")","[","]","#","@","\\",...aP]),Iz0={keywords:tP,onCommentStart:ul,onCommentEnd:uz0};function kz0($){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 bz0($,Z){if($[Z]!=="<")return!1;let J=0,H=!1;for(let Q=Z;Q<$.length;Q++){let B=$[Q];if(B==="<"){J++;continue}if(B===">"){if(J--,J===0){let X=Q+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(B)){H=!0;continue}if(/[\s,\.\=\?\:\|\&\[\]]/.test(B))continue;return!1}return!1}var EW=["identifier","keyword","string","class","property","entity","jsxliterals","sign","comment","break","space"],[AH,yz0,F7,rP,wW,xz0,hz0,H3,yl,oP,xl]=EW.map(($,Z)=>Z);function KX($){return/^[^\S\r\n]+$/g.test($)}function vz0($){return vl.has($)}var gz0={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#039;"};function fz0($){if(!/[&<>"']/.test($))return $;return $.replace(/[&<>"']/g,(Z)=>gz0[Z])}function SW($){return/^[\w_]+$/.test($)||gl($)}function hl($){let Z=$[0];return SW(Z)&&Z===Z.toUpperCase()||$==="null"}function gl($){return/[^\u0000-\u007f]/.test($)}function fl($){return/^[a-zA-Z]$/.test($)}function ml($){return fl($)||gl($)}function VH($){return ml($[0])&&($.length===1||SW($.slice(1)))}function nP($){return $==="`"}function sP($){return $==='"'||$==="'"}function mz0($){return sP($)||nP($)}function ul($,Z){let J=$+Z;if(J==="/*")return 2;return J==="//"?1:0}function uz0($,Z){return $+Z==="*/"?2:Z===`
56
- `?1:0}function pz0($){return $[0]==="/"&&!ul($[0],$[1])}function cz0($,Z){let J=Z+1;while(J<$.length&&/\s/.test($[J]))J++;return $[J]===":"}function dz0($,Z){let J={...Iz0,...Z},H=!!(Z&&Z.keywords instanceof Set),Q=kz0($),B=H?J.keywords:Q?Rz0:tP,{onCommentStart:X,onCommentEnd:z}=J,G=J.typeKeywords instanceof Set?J.typeKeywords:null,U="",K=-1,Y=[-1,""],F=[-2,""],W=[],q=!1,N=0,V=!1,A=0,D=()=>q&&!V&&!N,L=()=>N&&!D(),j=()=>!N&&D()&&!V&&A>0,M=null,_=0,E=!1,C=0,R=0,T=()=>M!==null,I=()=>E,y=()=>R>C,S=()=>R>0&&R===C,O=()=>T()||y();function b(h){let v=h===`
57
- `;if(L()){if(T())return F7;let[,w]=Y;if(VH(h)){if(w==="<"||w==="</")return xz0}}if(j())return hz0;if(T()||y())return F7;else if(G&&G.has(h))return Y[1]==="."?AH:rP;else if(B.has(h))return Y[1]==="."?AH:yz0;else if(v)return oP;else if(KX(h))return xl;else if(h.split("").every(vz0))return H3;else if(hl(h))return L()?AH:rP;else{if(VH(h)){let w=Y[1]==="."&&VH(F[1]);if(!O()&&!w)return AH;if(w)return wW}return F7}}let k=(h,v)=>{if(v)U=v;if(U){K=typeof h==="number"?h:b(U);let f=[K,U];if(K!==xl&&K!==oP)F=Y,Y=f;W.push(f)}U=""};for(let h=0;h<$.length;h++){let v=$[h],f=$[h-1],w=$[h+1],i=f+v,r=v+w;if(typeof J.onQuote==="function"&&v==="'"&&!T()&&!j()&&!y()){let d=J.onQuote(v,h,$);if(typeof d==="number"&&d>=1&&!Number.isNaN(d)){let o=Math.min(d,$.length-h),Z0=h+o;k(),U=$.slice(h,Z0),k(AH),h=Z0-1;continue}}if(sP(v)&&!j()&&!y()){k();let d=!1;if(f!=="\\"){if(M&&v===M)M=null,d=!0;else if(!M)M=v,_=W.length}if(k(F7,v),J.quotedKeys&&d&&cz0($,h))for(let o=_;o<W.length;o++)W[o][0]=wW;continue}if(!y()){if(f!=="\\n"&&nP(v)){k(),k(F7,v),R++;continue}}if(y()){if(f!=="\\n"&&nP(v)){if(R>0){k(),R--,k(F7,v);continue}}if(r==="${"){C++,k(F7),k(H3,r),h++;continue}}if(S()&&v==="}"){k(),C--,k(H3,v);continue}if(D()){if(v==="{"){k(),k(H3,v),V=!0;continue}}if(q){if(!N&&v==="<"){if(k(),w==="/")N=2,U=r,h++;else N=1,U=v;k(H3);continue}if(N){if(v===">"&&!"/=".includes(f)){if(k(),N===1)N=0,A++;else N=0,q=!1;k(H3,v);continue}if(r==="/>"||r==="</"){if(U!=="<"&&U!=="/")k();if(r==="/>")N=0;else A--;if(!A)q=!1;U=r,h++,k(H3);continue}if(v==="<"){k(),U=v,k(H3);continue}if(w==="-"&&!O()&&!j()){if(U){k(wW,U+v+w),h++;continue}}if(w==="="&&!O()){if(!KX(v)){if(KX(U))k();let d=U+v;if(VH(d)){k(wW,d);continue}}}}}if(!N&&(v==="<"&&ml(w)||r==="</")){let d=h-1;while(d>=0&&/\s/.test($[d]))d--;let o=d>=0?$[d]:"",[Z0,H0]=Y,G0=!1,X0=!1;if(U&&!KX(U)){let N0=U;if(hl(N0)||N0==="true"||N0==="false")G0=!0;else if(B.has(N0)&&VH(N0))X0=!0;else if(VH(N0))G0=!0}let Y0=v==="<"&&/[$\w\]\)]/.test(o)&&(G0||!X0&&(Z0===AH||Z0===rP||Z0===H3&&(H0===")"||H0==="]"))),V0=v==="<"&&bz0($,h);if(!Y0&&!V0)N=w==="/"?2:1;if(v==="<"&&(w==="/"||fl(w))){if(!Y0&&!V0&&!O()&&!j()&&!I())q=!0}}let x=mz0(v),l=y(),s=!q&&pz0(r),p=j();if(x||l||sP(M))U+=v;else if(s){k();let[d,o]=Y;if(s&&d!==-1&&!(d===H3&&o!==")"||d===yl)){U=v,k();continue}E=!0;let Z0=h++,H0=()=>h>=$.length,G0=()=>H0()||$[h]===`
58
- `,X0=!1,Y0=!1;for(;!G0();h++){let V0=$[h],N0=$[h-1]==="\\";if(!N0&&V0==="[")Y0=!0;if(!N0&&V0==="]")Y0=!1;if(V0==="/"&&!Y0&&!N0){X0=!0;while(Z0!==h&&/^[a-z]$/.test($[h+1])&&!G0())h++;break}}if(E=!1,Z0!==h&&X0)U=$.slice(Z0,h+1),k(F7);else U=v,k(),h=Z0}else if(X(v,w)){k();let d=h,o=X(v,w);if(o){for(;h<$.length;h++)if(z($[h-1],$[h])==o)break}U=$.slice(d,h+1),k(yl)}else if(v===" "||v===`
59
- `)if(v===" "&&(KX(U)||!U||p)){let d=h+1;while($[d]===" ")d++;if(U+=$.slice(h,d),h=d-1,$[d]==="<")k()}else k(),U=v,k();else if(V&&v==="}")k(),U=v,k(),V=!1;else if(p&&!aP.has(v)||y()||(SW(v)===SW(U[U.length-1])||D())&&!vl.has(v))U+=v;else{if(i==="</")U=i;if(k(),i!=="</")U=v;if(r==="</"||r==="/>")U=r,k(),h++;else if(aP.has(v))k()}}return k(),W}function lz0($,Z){let J=[],H=Z&&typeof Z.lineClassName==="function"?Z.lineClassName:null,Q=0,B=(U,K)=>{let Y=H?H(K,Q):"";return Q++,{type:"element",tagName:"span",children:U,properties:{className:Y?`sh__line ${Y}`:"sh__line"}}};function X(U){let K=U.map(([,F])=>F).join(""),Y=U.map(([F,W])=>{let q=EW[F];return{type:"element",tagName:"span",children:[{type:"text",value:W}],properties:{className:`sh__token--${q}`,style:{color:`var(--sh-${q})`}}}});J.push(B(Y,K))}let z=[],G=!1;for(let U=0;U<$.length;U++){let K=$[U],[Y,F]=K,W=U===$.length-1;if(Y!==oP){if(F.includes(`
60
- `)){let q=F.split(`
61
- `);for(let N=0;N<q.length;N++)if(z.push([Y,q[N]]),N<q.length-1)X(z),z.length=0}else z.push(K);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 iz0=($)=>{let Z=`class="${$.className}"`;if($.style){let J=Object.entries($.style).map(([H,Q])=>`${H}:${Q}`).join(";");Z+=` style="${J}"`}return Z};function rz0($){return $.map((Z)=>{let{tagName:J}=Z,H=Z.children.map((Q)=>{let{tagName:B,children:X,properties:z}=Q;return`<${B} ${iz0(z)}>${fz0(X[0].value)}</${B}>`}).join("");return`<${J} class="${Z.properties.className}">${H}</${J}>`}).join(`
62
- `)}function pl($,Z){let J=dz0($,Z),H=lz0(J,Z);return rz0(H)}var SA1={TokenTypes:EW,TokenMap:new Map(EW.map(($,Z)=>[$,Z]))};var eP=P(c(),1),az0=B0("[--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 dl({code:$,className:Z}){let J=cl.useMemo(()=>pl($),[$]);return eP.jsx("pre",{className:B0("overflow-auto font-mono text-xs leading-relaxed whitespace-pre",az0,Z),children:eP.jsx("code",{className:"font-mono",dangerouslySetInnerHTML:{__html:J}})})}var oz0={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 nz0($){let Z=$.split(/[\\/]/).pop()??"",J=Z.lastIndexOf("."),H=J>0?Z.slice(J+1).toLowerCase():"";return oz0[H]??null}function sz0($){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 tz0($){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 ll($,Z){let J=$.input??{},H=typeof J.file_path==="string"?J.file_path:typeof J.path==="string"?J.path:"",Q=H?nz0(H):null,B=$.name==="Read"||$.name==="read",X=$.name==="Write"||$.name==="write";if(Q&&B&&Z)return{kind:"highlight",code:tz0(Z),label:Q};if(Q&&X&&typeof J.content==="string"&&J.content)return{kind:"highlight",code:J.content,label:Q};let z=sz0(Z);if(z)return{kind:"highlight",code:z,label:"json"};return{kind:"plain"}}var w4=P(c(),1),$_="max-h-[280px] overflow-auto px-3 py-2.5 font-mono text-xs leading-relaxed";function il({call:$,output:Z,isError:J}){let[H,Q]=t$.useState(!1),B=t$.useMemo(()=>J?{kind:"plain"}:ll($,Z),[$,Z,J]);if(B.kind==="plain")return w4.jsx("div",{className:B0("rounded-lg border",J?"border-destructive/30 bg-destructive/10":"border-border bg-muted"),children:w4.jsx("pre",{className:B0($_,"break-all whitespace-pre-wrap",J?"text-destructive":"text-muted-foreground"),children:Z||"(empty)"})});return w4.jsxs("div",{className:"overflow-hidden rounded-lg border border-border bg-muted",children:[w4.jsx(ez0,{raw:H,onRaw:Q,label:B.label,copyText:H?Z:B.code}),H?w4.jsx("pre",{className:B0($_,"break-all whitespace-pre-wrap text-muted-foreground"),children:Z||"(empty)"}):w4.jsx(dl,{code:B.code,className:B0($_,"text-muted-foreground")})]})}function ez0({raw:$,onRaw:Z,label:J,copyText:H}){return w4.jsxs("div",{className:"flex items-center gap-1 border-b border-border p-2",children:[[[!1,J],[!0,"raw"]].map(([B,X])=>w4.jsx(j0,{type:"button",variant:$===B?"outline":"ghost",size:"sm",onClick:()=>Z(B),className:"rounded-full text-xs uppercase",children:X},X)),w4.jsx("div",{className:"flex-1"}),w4.jsx($G0,{text:H})]})}function $G0({text:$}){let[Z,J]=t$.useState(!1);return t$.useEffect(()=>{if(!Z)return;let Q=setTimeout(()=>J(!1),1500);return()=>clearTimeout(Q)},[Z]),w4.jsx(j0,{type:"button",variant:"ghost",size:"icon-sm",onClick:()=>{navigator.clipboard?.writeText($).then(()=>J(!0)).catch(()=>{})},"aria-label":Z?"Copied":"Copy",children:Z?w4.jsx(j8,{stroke:1.75}):w4.jsx(rU,{stroke:1.75})})}var m1=P(c(),1);function RW({parts:$,cwd:Z=null,processing:J=!1}){let H=$.filter((Q)=>Q.type==="reasoning"||Q.type==="tool-call");return m1.jsx("div",{className:"flex flex-col",children:H.map((Q,B)=>{let X=B===H.length-1,z={isFirst:B===0,isLast:X};if(Q.type==="reasoning")return m1.jsx(ZG0,{text:Q.text,durationMs:Q.durationMs,inProgress:J&&X,...z},B);return m1.jsx(JG0,{call:Q.call,cwd:Z,...z},Q.call.toolCallId||B)})})}function Z_({isFirst:$,isLast:Z,call:J,leading:H,marker:Q,name:B,brief:X,preview:z}){let[G,U]=J_.useState(!1),K=J.state==="error",Y=J.state==="running"||J.state==="pending",F=K?J.errorText??"":typeof J.output==="string"?J.output:"",W=!!(F||K||z),q=X?`${B}: ${X}`:B;return m1.jsx(WH,{isFirst:$,isLast:Z,marker:Q,loading:Y,isError:K,children:m1.jsxs("div",{className:"min-w-0 flex-1",children:[m1.jsxs("button",{type:"button",title:q,onClick:()=>W&&U((N)=>!N),className:B0(OW,W?"cursor-pointer":"cursor-default"),children:[H,m1.jsx("span",{className:"shrink-0 text-xs font-medium whitespace-nowrap",children:B}),X&&m1.jsx("span",{className:"min-w-0 self-baseline truncate text-[12px] text-muted-foreground",children:X}),Y&&Q&&m1.jsx(b5,{size:12,stroke:1.75,className:"shrink-0 animate-spin text-muted-foreground"}),W&&m1.jsx(zX,{open:G})]}),W&&m1.jsx(BX,{open:G,children:m1.jsxs("div",{className:"mt-1 mb-1 flex flex-col gap-1.5",children:[z,(F||K)&&m1.jsx(il,{call:J,output:F,isError:K})]})})]})})}function ZG0({isFirst:$,isLast:Z,text:J,inProgress:H=!1,durationMs:Q}){let[B,X]=J_.useState(!1);if(!J){let U=Q===void 0?"Thought":`Thought for ${s$(Q)}`;return m1.jsx(WH,{isFirst:$,isLast:Z,loading:H,children:m1.jsx("div",{className:B0(OW,"min-w-0 flex-1 cursor-default"),children:m1.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:H?"Thinking":U})})})}let z=H?"Thinking":"Thought",G=H||B;return m1.jsx(WH,{isFirst:$,isLast:Z,loading:H,children:m1.jsxs("div",{className:"min-w-0 flex-1",children:[m1.jsxs("button",{type:"button","aria-expanded":G,onClick:()=>X((U)=>!U),className:B0(OW,"cursor-pointer"),children:[m1.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:z}),m1.jsx(zX,{open:G})]}),m1.jsx(BX,{open:G,children:m1.jsx("div",{className:"mt-1 mb-1 pr-2 text-xs leading-relaxed whitespace-pre-wrap text-muted-foreground",children:m1.jsx(Zd,{content:J})})})]})})}function JG0({call:$,cwd:Z,isFirst:J,isLast:H}){if($.caller==="subagent")return m1.jsx(bl,{call:$,cwd:Z,isFirst:J,isLast:H,renderNestedParts:(X,z)=>m1.jsx(RW,{parts:X,cwd:z})});if($.name==="Skill"&&$.skill){let X=$.state==="success";return m1.jsx(Z_,{isFirst:J,isLast:H,call:$,marker:X?m1.jsx(Ql,{icon:rl,size:16,stroke:1.75}):void 0,name:"Loading skill",brief:$.skill.skillName})}let Q=pP($)??cP($)??dP($);if(Q){let X=lP(Q.server,Q.tool);return m1.jsx(Z_,{isFirst:J,isLast:H,call:$,marker:m1.jsx(Bl,{src:PW(Q.server)}),name:_W(Q.server),brief:Q.rest?`${X} ${Q.rest}`:X})}let B=$.state==="error"?null:ed($,Z);return m1.jsx(Z_,{isFirst:J,isLast:H,call:$,leading:m1.jsx(HG0,{call:$}),name:El($),brief:Sl($,Z),preview:B?m1.jsx($l,{relPath:B}):void 0})}function HG0({call:$}){if($.caller!=="mcp"&&$.caller!=="server-tool")return null;let Z=$.caller==="mcp"?`mcp${$.mcpServer?`:${$.mcpServer.slice(0,8)}`:""}`:"server";return m1.jsx("span",{className:"shrink-0 rounded border border-border px-1 text-[9px] text-muted-foreground uppercase",children:Z})}var h1=P(c(),1);function nl($){if($.type==="reasoning")return!0;if($.type==="tool-call")return!0;return!1}function QG0($){let Z=[];for(let J of $)if(nl(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 IW({parts:$,cwd:Z,processing:J=!1}){let H=QG0($);return h1.jsx("div",{className:"flex flex-col",children:H.map((Q,B)=>{let X=B===0?"":"mt-3",z=B===H.length-1;return h1.jsx("div",{className:X,children:Q.kind==="run"?h1.jsx(RW,{parts:Q.parts,cwd:Z,processing:J&&z}):h1.jsx(UG0,{part:Q.part})},B)})})}function BG0($){return $.some((Z)=>Z.type!=="text"||Z.text.trim().length>0)}function XG0($){let Z=-1;for(let H=$.length-1;H>=0;H--)if(nl($[H])){Z=H;break}if(Z<0)return null;let J=$.slice(Z+1);if(!BG0(J))return null;return{work:$.slice(0,Z+1),response:J}}function zG0({parts:$,cwd:Z,durationMs:J,defaultOpen:H}){let Q=J===void 0?"Worked":`Worked for ${s$(J)}`;return h1.jsxs(QY,{defaultOpen:H,className:"group/collapsible",children:[h1.jsxs(BY,{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:[h1.jsx("span",{children:Q}),h1.jsx(R$,{size:16,stroke:1.5,className:"shrink-0 transition-transform group-data-open/collapsible:rotate-90"})]}),h1.jsx(XY,{className:"overflow-hidden pt-2",children:h1.jsx(IW,{parts:$,cwd:Z})})]})}function GG0({parts:$,cwd:Z,processing:J=!1,durationMs:H}){let Q=J?null:XG0($);return h1.jsx("div",{className:"w-full min-w-0",children:J?h1.jsx(IW,{parts:$,cwd:Z,processing:!0}):Q?h1.jsxs("div",{className:"flex flex-col gap-3",children:[h1.jsx(zG0,{parts:Q.work,cwd:Z,durationMs:H}),h1.jsx(IW,{parts:Q.response,cwd:Z})]}):h1.jsx(IW,{parts:$,cwd:Z})})}var sl=ol.memo(function({turn:Z,processing:J=!1}){let H=i1().cwd;if(Z.role==="user"&&Z.origin.kind==="user-input"){let Q=Z.parts.filter((z)=>z.type==="file-attachment"),B=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&&Q.length===0&&B.length===0)return null;return h1.jsxs("div",{className:"flex w-full min-w-0 flex-col items-end gap-1.5 pl-8",children:[B.map((z,G)=>h1.jsx(wB,{label:z.label},`text-attachment:${G}`)),Q.map((z,G)=>h1.jsx(tl,{mediaType:z.mediaType,previewUrl:z.previewUrl,label:z.label},G)),X&&h1.jsx("p",{className:B0("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 h1.jsx(GG0,{parts:Z.parts,cwd:H,processing:J,durationMs:Z.meta?.durationMs})});function UG0({part:$}){switch($.type){case"text-attachment":return h1.jsx(wB,{label:$.label});case"text":return h1.jsx($d,{content:$.text});case"tool-call":return h1.jsx(RW,{parts:[$],cwd:null});case"file-attachment":return h1.jsx(tl,{mediaType:$.mediaType,previewUrl:$.previewUrl,label:$.label});case"source-url":return h1.jsx(al,{url:$.url,title:$.title});case"source-document":return h1.jsx(al,{url:"#",title:$.title});case"data":return h1.jsx(KG0,{name:$.name,data:$.data});case"reasoning":return null}}function tl({mediaType:$,previewUrl:Z,label:J}){if($.startsWith("image/")&&Z)return h1.jsx("img",{src:Z,alt:J??"attachment",className:"max-h-64 max-w-full rounded-lg border border-border object-contain"});return h1.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:[h1.jsx(WJ,{size:16,stroke:1.75}),h1.jsx("span",{className:"truncate",children:J??$})]})}function al({url:$,title:Z}){return h1.jsx("a",{href:$,target:"_blank",rel:"noreferrer",className:"text-xs underline",children:Z??$})}function KG0({name:$,data:Z}){return h1.jsxs("details",{children:[h1.jsxs("summary",{className:"cursor-pointer list-none text-xs text-muted-foreground marker:hidden [&::-webkit-details-marker]:hidden",children:["data:",$]}),h1.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 _5=P(c(),1),YG0=[],FG0=[];function kW({agent:$,active:Z=!0,focusRequest:J=0,docked:H=!1,chatLoaded:Q,hasWorkspaceApplets:B,view:X,previewTurn:z,sessionId:G,processing:U,composerBanner:K,agentAvailability:Y,annotation:F,send:W,stop:q,onNavigateFromWelcome:N,onClose:V,builderDraft:A}){let D=e1(),L=l4.useRef(null),j=l4.useRef(null),M=A?.sessionId??G??null,_=A?null:G??null,E=A?YG0:X.turns,C=w5((d)=>d.hasSentMessageFromMoi),R=w5((d)=>(d.workspaceIdsPendingAnalysis??[]).includes(D)),T=g2((d)=>(d.attachments[a8(D,M)]??[]).some((o)=>o.kind!=="text"&&o.status==="uploading")),I=!CB(!0,T,Y),y=A?null:z,S=A?FG0:X.notices,O=l4.useMemo(()=>th(E),[E]),b=l4.useMemo(()=>sh(O,y),[O,y]),k=l4.useMemo(()=>$v(b,S),[b,S]),h=b.length>0?b[b.length-1].id:null,v=A?!1:U,f=!!A||Q&&k.length===0&&!v,w=Q&&!f,i=jf({isViewBuilderDraft:!!A,hasSentMessageFromMoi:C,isWorkspacePendingAnalysis:R}),{atBottom:r,scrollToBottom:x,scrollToTop:l}=oh(j,M);l4.useLayoutEffect(()=>{if(f&&i!=="empty")l()},[f,i,l]),l4.useEffect(()=>{if(Z)NL(L.current)},[Z,J]);let s=l4.useCallback(async(d,o)=>{if(A)await A.onSubmit(d);else W(d,o);x()},[A,W,x]),p=l4.useCallback((d)=>{if(I)return;s(d.prompt,{directives:d.context})},[s,I]);return _5.jsxs("div",{className:"flex min-h-0 flex-1 flex-col pt-2 pb-3",children:[_5.jsxs("header",{className:"mx-auto flex w-full max-w-[calc(var(--chat-max-container)+40px)] min-w-0 items-center justify-between pr-2 pb-2 pl-2",children:[_5.jsx("div",{className:"min-w-0 flex-1",children:_5.jsx(Ef,{isViewBuilder:!!A})}),V&&H&&_5.jsxs(Q5,{children:[_5.jsx(B5,{render:_5.jsx(j0,{variant:"ghost",size:"icon-sm",onClick:V,"aria-label":"Undock agent",children:_5.jsx(el,{className:"size-5! text-muted-foreground",stroke:1.5})})}),_5.jsx(X5,{children:"Undock agent"})]}),!A&&V&&!H&&_5.jsx(j0,{variant:"ghost",size:"icon-sm",onClick:V,"aria-label":"Close chat",children:_5.jsx(o5,{stroke:2})})]}),_5.jsxs("div",{className:"relative flex min-h-0 flex-1 flex-col",children:[_5.jsx("div",{ref:j,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:_5.jsxs("div",{className:"mx-auto flex w-full max-w-(--chat-max-container) flex-1 flex-col gap-6",children:[f&&_5.jsx(Of,{agent:$,kind:i,hasWorkspaceApplets:B,disabled:I,onSelectPrompt:p,onNavigate:N}),w&&k.map((d)=>d.kind==="notice"?_5.jsx(WG0,{notice:d.notice},`notice:${d.notice.id}`):_5.jsx(sl,{turn:d.turn,processing:v&&d.turn.id===h},d.turn.id)),w&&_5.jsx("div",{className:"mt-auto -ml-3 pt-2",children:_5.jsx(l9,{preset:$,color:"primary",animated:v,expression:v?"thinking":void 0})})]})}),w&&!r&&E.length>0&&_5.jsx(j0,{type:"button",variant:"outline",size:"icon",onClick:()=>x("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:_5.jsx(ZJ,{stroke:1.5})})]}),_5.jsx("div",{className:"mx-auto flex w-full max-w-[calc(var(--chat-max-container)+24px)] flex-col px-3",children:_5.jsxs("div",{className:B0("@container flex w-full flex-col transition-[padding]",K&&"gap-2 rounded-t-lg rounded-b-2xl p-2",K?.tone==="default"&&"bg-accent",K?.tone==="error"&&"bg-destructive/10"),children:[K?.content,_5.jsx(Lf,{composerRef:L,onSend:s,onStop:q,processing:v,sessionId:M,modelSessionId:_,availability:Y,annotation:A?void 0:F,onRemoveDrawing:A?.onRemoveDrawing??F?.onRemove,allowFiles:!A,placeholder:A?"Drop in the details":void 0,draft:A?{id:A.builderId,initialValue:A.initialValue,onChange:A.onChange}:void 0})]})})]})}function WG0({notice:$}){let Z=AL($);if(!Z)return null;return _5.jsx("div",{className:"flex justify-center",children:_5.jsx("span",{className:"max-w-full truncate text-xs text-muted-foreground",children:Z})})}var x3=P(c(),1);function $i({agent:$,loading:Z,open:J,onOpenChange:H,onOpenChangeComplete:Q,children:B}){let X=()=>H(!1);return x3.jsxs(q6,{open:J,onOpenChange:(G,U)=>{if(!G&&(U.reason==="outside-press"||U.reason==="focus-out")){U.cancel();return}H(G)},onOpenChangeComplete:Q,children:[x3.jsx(N6,{render:x3.jsx("div",{className:"fixed right-3 bottom-3",children:x3.jsx(z5.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:x3.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:x3.jsx(l9,{preset:$,color:"primary",animated:Z,size:Z?80:64,expression:Z?"thinking":void 0,className:B0("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")})})})})}),x3.jsx(A6,{side:"top",sideOffset:({anchor:G})=>-G.height,align:"end",className:"flex h-[calc(100vh-2rem)] w-[min(440px,calc(100vw-1rem))] flex-col gap-0 rounded-3xl p-0 sm:h-[calc(100vh-8rem)] sm:w-[min(440px,calc(100vw-2rem))] sm:p-1",keepMounted:!0,children:B(X)})]})}var h3=P(c(),1);function bW({actions:$,className:Z,title:J,children:H,onClose:Q,ref:B}){return h3.jsxs(z5.div,{ref:B,className:B0("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:[h3.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-4",children:[h3.jsx("p",{className:"text-sm font-medium",children:J}),h3.jsxs("div",{className:"flex items-center gap-2",children:[$,h3.jsx(j0,{type:"button",variant:"ghost",size:"icon-sm",onClick:Q,"aria-label":"Close panel",children:h3.jsx(o5,{stroke:1.75})})]})]}),H&&h3.jsx("div",{className:"flex-1 pb-(--page-pad)",children:H})]})}var F5=P(c(),1),qG0=Object.entries(m6),NG0=Object.entries(bK),AG0=Object.entries(nQ),VG0=Object.entries(sQ),DG0="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 yW({children:$,className:Z,gridClassName:J,label:H}){return F5.jsxs("div",{className:B0("flex flex-col gap-2",Z),children:[F5.jsx("p",{className:"text-xs font-medium",children:H}),F5.jsx("div",{role:"group","aria-label":H,className:B0("grid grid-cols-4 gap-2 @4xl/workspace:grid-cols-2",J),children:$})]})}function xW({active:$,children:Z,className:J,onSelect:H,style:Q}){return F5.jsxs("button",{type:"button","aria-pressed":$,onClick:H,className:B0(DG0,"flex items-center gap-2 p-3",J,!$&&"cursor-pointer pr-9 opacity-70 hover:opacity-100"),style:Q,children:[F5.jsx("div",{className:"flex flex-1 flex-col justify-center",children:Z}),$&&F5.jsx(xK,{size:20,stroke:1.5,"aria-hidden":"true"})]})}function Zi({onClose:$,ref:Z}){UY();let{layout:J,setLayout:H}=i1(),Q=$9(J.theme);function B(X){H({theme:{...Q,...X}})}return F5.jsx(bW,{ref:Z,title:"Theme",onClose:$,className:"@4xl/workspace:max-w-5xl",children:F5.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:[F5.jsx(yW,{label:"Font",className:"@4xl/workspace:col-span-2 @4xl/workspace:col-start-1",children:qG0.map(([X,z])=>F5.jsx(xW,{active:X===Q.font,onSelect:()=>B({font:X}),style:{fontFamily:z.sans},children:F5.jsx("span",{className:"text-sm font-medium",children:z.label})},X))}),F5.jsx(yW,{label:"Colors",className:"@4xl/workspace:col-span-2 @4xl/workspace:col-start-4",children:NG0.map(([X,z])=>F5.jsx(xW,{active:X===Q.color,className:z.primary&&"bg-background text-foreground",onSelect:()=>B({color:X}),style:J9({...Q,color:X}),children:F5.jsxs("div",{className:"flex gap-2",children:[F5.jsx("span",{className:B0("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"}),F5.jsx("span",{className:"text-sm font-medium",children:z.label})]})},X))}),F5.jsx(yW,{label:"Radius",className:"@4xl/workspace:col-start-7",gridClassName:"@4xl/workspace:grid-cols-1",children:AG0.map(([X,z])=>F5.jsx(xW,{active:X===Q.radius,onSelect:()=>B({radius:X}),style:J9({...Q,radius:X}),children:F5.jsxs("div",{className:"flex items-center gap-2",children:[F5.jsx("span",{className:"size-5 shrink-0 rounded-sm bg-card texture-checker-2.5 shadow-xs","aria-hidden":"true"}),F5.jsx("span",{className:"text-sm font-medium",children:z.label})]})},X))}),F5.jsx(yW,{label:"Agent",className:"@4xl/workspace:col-start-9",gridClassName:"@4xl/workspace:grid-cols-1",children:VG0.map(([X,z])=>F5.jsx(xW,{active:X===Q.agent,onSelect:()=>B({agent:X}),children:F5.jsxs("div",{className:"flex items-center gap-2",children:[F5.jsx("span",{className:"flex size-5 shrink-0 items-center justify-center",children:F5.jsx(l9,{preset:X,color:"primary",size:28})}),F5.jsx("span",{className:"text-sm font-medium",children:z.label})]})},X))})]})})}var uq=P(m(),1);var Qi=P(m(),1);function Ji($){return J5({queryKey:S0.appletThumbnails($),queryFn:async()=>(await q1(`/api/workspaces/${$}/applet-thumbnails`)).thumbnails,...p4})}function Hi($){let Z=U1();return H5({mutationFn:(J)=>P4(`/api/workspaces/${$}/applet-thumbnails`,g5("PUT",J),"Failed to save applet thumbnails"),onSuccess:()=>{Z.invalidateQueries({queryKey:S0.appletThumbnails($)}),Z.invalidateQueries({queryKey:S0.preview($)})}})}var LG0=1000,MG0=3,PG0=10800000,_G0=1000,jG0="1000px-3x-webp-q80-v1",OG0=5000,TG0=1000,CG0=1e4,wG0=100,EG0=5000;function SG0($){return Math.min(MG0,LG0/Math.max($.offsetWidth,$.offsetHeight))}function RG0($){return`${jG0}:${$??""}`}function IG0($,Z,J=Date.now()){if(!$||$.revision!==Z)return!0;let H=Date.parse($.capturedAt);return!Number.isFinite(H)||J-H>=PG0}function kG0($,Z){return $!==void 0&&$.revision===Z&&$.captureMs!==void 0&&$.captureMs>=_G0}var bG0=($)=>new Promise((Z)=>{setTimeout(()=>Z(null),$)});function yG0($,Z=wG0){let J=$.getBoundingClientRect(),H=J.top-Z,Q=J.bottom+Z,B=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<Q&&U.right>B&&U.left<X}}function xG0($,Z,J=EG0){let H=J,Q=(B)=>{for(let X of B.children){if(!Z(X))continue;if(--H<0)return!0;if(Q(X))return!0}return!1};return Q($)}async function hG0($,Z){let{createContext:J,destroyContext:H,domToDataUrl:Q}=await import("/chunk-efdyz6xp.js"),B=yG0($);if(xG0($,B))return null;let X=async()=>{let z=await J($,{scale:SG0($),type:"image/webp",quality:0.8,backgroundColor:"#ffffff",timeout:TG0,filter:B,...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 Q(z)}finally{H(z)}};return Promise.race([X(),bG0(CG0)])}async function vG0($,Z,J,H,Q=hG0,B=Date.now()){let X=[];for(let z of J){if(H())return null;let G=RG0(z.revision),U=Z.find((W)=>W.kind===$&&W.id===z.id);if(!IG0(U,G,B)){X.push({id:z.id,revision:G});continue}if(kG0(U,G)){X.push({id:z.id,revision:G});continue}if(!z.element){X.push({id:z.id,revision:G,image:null});continue}let K=performance.now(),Y=await Q(z.element,$==="widget").catch(()=>null),F=Math.round(performance.now()-K);if(H())return null;X.push({id:z.id,revision:G,image:Y,captureMs:F})}return X}function hW({kind:$,enabled:Z,targets:J}){let H=e1(),Q=Ji(H).data,B=Hi(H),X=K5(J),z=K5(Q??[]),G=K5(B.mutate),U=J.map((Y)=>`${Y.id}@${Y.revision??""}`).join(`
66
- `),K=Q!==void 0;Qi.useEffect(()=>{if(!Z||!K||U==="")return;let Y=!1,F=0,W,q=()=>{F+=1;let N=F;if(W!==void 0)clearTimeout(W);if(document.visibilityState!=="visible")return;W=setTimeout(async()=>{W=void 0;let V=await vG0($,z.current,X.current.map((A)=>({...A,element:document.querySelector(`[data-applet-thumbnail="${CSS.escape(i6($==="view"?"views":"widgets",A.id))}"]`)})),()=>Y||F!==N||document.visibilityState!=="visible");if(!V||Y||document.visibilityState!=="visible")return;G.current({kind:$,thumbnails:V})},OG0)};return document.addEventListener("visibilitychange",q),q(),()=>{if(Y=!0,W!==void 0)clearTimeout(W);document.removeEventListener("visibilitychange",q)}},[Z,$,K,z,G,U,X])}var yi=P(m(),1);var Bi=P(c(),1);function vW({className:$,...Z}){return Bi.jsx("div",{"data-slot":"skeleton",className:a0("animate-pulse rounded-lg bg-accent",$),...Z})}var I2=P(c(),1);function gG0($){if($==="needs-auth")return"Needs auth";return $[0].toUpperCase()+$.slice(1)}function fG0({name:$,status:Z}){let J=PW($),H="size-full rounded-lg ring-2 ring-background";return I2.jsxs("span",{className:"relative size-10 shrink-0",children:[J?I2.jsx("img",{src:J,alt:"",className:"size-full rounded-lg ring-2 ring-background"}):I2.jsx("span",{className:"flex size-full items-center justify-center rounded-lg bg-muted text-muted-foreground ring-2 ring-background",children:I2.jsx(jW,{className:"size-5"})}),Z!=="connected"&&I2.jsx(Xi,{"aria-hidden":"true",size:16,stroke:1.75,className:"absolute -top-1 -right-1 rounded-full bg-card text-amber-400"})]})}function zi($){return[...$].sort((Z,J)=>Number(J.status==="connected")-Number(Z.status==="connected"))}function Gi({icon:$,children:Z}){return I2.jsxs("div",{className:"flex items-center gap-3 text-card-foreground",children:[$,I2.jsx("div",{className:"flex min-w-0 flex-1 flex-col justify-center gap-0.5",children:Z})]})}function Ui({server:$}){return I2.jsxs(Gi,{icon:I2.jsx(fG0,{name:$.name,status:$.status}),children:[I2.jsx("div",{className:"truncate text-sm font-medium text-foreground",children:_W($.name)}),I2.jsx("span",{className:"text-sm text-muted-foreground",children:gG0($.status)})]})}function Ki(){return I2.jsxs(Gi,{icon:I2.jsx(vW,{className:"size-10 shrink-0 rounded-lg"}),children:[I2.jsx(vW,{className:"h-4 w-36 max-w-full"}),I2.jsx(vW,{className:"h-4 w-20"})]})}function H_({children:$}){return I2.jsx("div",{className:"grid grid-cols-1 gap-6 sm:grid-cols-2",children:$})}function Yi($,Z){return J5({queryKey:S0.mcp($),queryFn:()=>q1(`/api/workspaces/${$}/mcp`),enabled:Z,staleTime:1/0,gcTime:1/0,refetchOnMount:!1,refetchOnWindowFocus:!1})}var i4=P(c(),1);function DH({title:$,description:Z,children:J}){return i4.jsxs("div",{className:"flex flex-col gap-6",children:[i4.jsxs("header",{className:"flex flex-col gap-0.5",children:[i4.jsx("h2",{className:"text-lg font-medium",children:$}),Z&&i4.jsx("p",{className:"text-sm text-muted-foreground",children:Z})]}),J]})}function LH({label:$,children:Z}){return i4.jsxs("section",{className:"flex flex-col gap-2",children:[$&&i4.jsx("p",{className:"px-0.5 text-xs font-medium text-muted-foreground",children:$}),i4.jsx("div",{className:"flex flex-col divide-y divide-dashed divide-border overflow-hidden rounded-xl border",children:Z})]})}function YX({title:$,description:Z,control:J}){return i4.jsxs("div",{className:"flex items-center gap-3 px-3.5 py-3",children:[i4.jsxs("div",{className:"flex min-w-0 flex-col",children:[i4.jsx("span",{className:"text-sm font-medium",children:$}),Z&&i4.jsx("span",{className:"text-xs text-muted-foreground",children:Z})]}),J&&i4.jsx("div",{className:"ml-auto flex shrink-0 items-center pl-3",children:J})]})}var K4=P(c(),1),mG0=Array.from({length:4},($,Z)=>Z);function uG0({connectors:$}){if($.isPending)return K4.jsx("div",{role:"status","aria-label":"Loading connectors",children:K4.jsx(H_,{children:mG0.map((Z)=>K4.jsx(Ki,{},Z))})});if($.isError)return K4.jsxs(Fi,{children:[K4.jsx("p",{className:"text-sm text-muted-foreground",children:"Could not load connectors."}),K4.jsx(j0,{variant:"outline",size:"sm",onClick:()=>$.refetch(),children:"Retry"})]});if($.data.length===0)return K4.jsxs(Fi,{children:[K4.jsx(gW,{size:24,stroke:1.5,className:"text-muted-foreground"}),K4.jsx("p",{className:"text-sm text-foreground",children:"No connectors configured."})]});return K4.jsx(H_,{children:zi($.data).map((Z)=>K4.jsx(Ui,{server:Z},Z.name))})}function Fi({children:$}){return K4.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 Wi(){let{workspaceId:$}=i1(),Z=Yi($,!0);return K4.jsx(DH,{title:"Connectors",description:"Connectors available to the agent in this workspace.",children:K4.jsx(uG0,{connectors:Z})})}var z_=P(m(),1);var WX={};C5(WX,{Thumb:()=>Mi,Root:()=>Di});var e$=P(m(),1);var fW=P(m(),1),Q_=fW.createContext(void 0);function qi(){let $=fW.useContext(Q_);if($===void 0)throw Error(y0(63));return $}var Ni="data-checked",Ai="data-unchecked";var mW={...C2,checked($){if($)return{[Ni]:""};return{[Ai]:""}}};var Vi=P(m(),1);function uW($,Z,J,H=!0,Q){let[B,X]=Vi.useState(),z=t0(Q?`${Q}-label`:void 0),G=$??Z??B;return J0(()=>{let U=$||Z||!H?void 0:cG0(J.current,z);if(B!==U)X(U)}),G}function cG0($,Z){let J=dG0($);if(!J)return;if(!J.id&&Z)J.id=Z;return J.id||void 0}function dG0($){if(!$)return;let Z=$.parentElement;if(Z&&Z.tagName==="LABEL")return Z;let J=$.id;if(J){let Q=$.nextElementSibling;if(Q&&Q.htmlFor===J)return Q}let H=$.labels;return H&&H[0]}var FX=P(c(),1),Di=e$.forwardRef(function(Z,J){let{checked:H,className:Q,defaultChecked:B,"aria-labelledby":X,form:z,id:G,inputRef:U,name:K,nativeButton:Y=!1,onCheckedChange:F,readOnly:W=!1,required:q=!1,disabled:N=!1,render:V,uncheckedValue:A,value:D,style:L,...j}=Z,{clearErrors:M}=Z4(),{state:_,setTouched:E,setDirty:C,validityData:R,setFilled:T,setFocused:I,validationMode:y,disabled:S,name:O,validation:b}=l5(),{labelId:k}=i5(),h=S||N,v=O??K,f=e$.useRef(null),w=x2(f,U,b.inputRef),i=e$.useRef(null),r=t0(),x=E6({id:G}),l=Y?void 0:x,[s,p]=J4({controlled:H,default:Boolean(B),name:"Switch",state:"checked"});w6(i,r,s,void 0,!h,K),J0(()=>{T(s)},[s,T]),h9(s,()=>{M(v),C(s!==R.initialValue),b.change(s)});let{getButtonProps:d,buttonRef:o}=T5({disabled:h,native:Y}),Z0=uW(X,k,f,!Y,l),H0={id:Y?x:r,role:"switch","aria-checked":s,"aria-readonly":W||void 0,"aria-required":q||void 0,"aria-labelledby":Z0,onFocus(){if(!h)I(!0)},onBlur(){let V0=f.current;if(!V0||h)return;if(E(!0),I(!1),y==="onBlur")b.commit(V0.checked)},onClick(V0){if(W||h)return;V0.preventDefault();let N0=f.current;if(!N0)return;gJ(N0,V0)}},G0={...b.getValidationProps(h),checked:s,disabled:h,form:z,id:l,name:v,required:q,style:v?Cz:m8,tabIndex:-1,type:"checkbox","aria-hidden":!0,ref:w,onChange(V0){if(V0.nativeEvent.defaultPrevented)return;if(W){V0.preventDefault();return}let N0=V0.currentTarget.checked,F0=R0(K0.none,V0.nativeEvent);if(F?.(N0,F0),F0.isCanceled)return;p(N0)},onClick(V0){V0.stopPropagation()},onFocus(){i.current?.focus()},...D!==void 0?{value:D}:L1},X0=e$.useMemo(()=>({..._,checked:s,disabled:h,readOnly:W,required:q}),[_,s,h,W,q]),Y0=z0("span",Z,{state:X0,ref:[J,i,o],props:[H0,j,d,(V0)=>b.getValidationProps(h,V0)],stateAttributesMapping:mW});return FX.jsxs(Q_.Provider,{value:X0,children:[Y0,!s&&v&&A!==void 0&&FX.jsx("input",{type:"hidden",form:z,name:v,value:A,disabled:h}),FX.jsx("input",{...G0,suppressHydrationWarning:!0})]})});var Li=P(m(),1);var Mi=Li.forwardRef(function(Z,J){let{render:H,className:Q,style:B,...X}=Z,z=qi();return z0("span",Z,{state:z,ref:J,stateAttributesMapping:mW,props:X})});var B_=P(c(),1);function Pi({className:$,...Z}){return B_.jsx(WX.Root,{"data-slot":"switch",className:a0('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:B_.jsx(WX.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 X_=["app-settings"];function _i(){let $=U1();return W2((Z)=>{if(Z.type==="settings:updated")$.setQueryData(X_,Z.settings)}),J5({queryKey:X_,queryFn:()=>q1("/api/settings"),staleTime:30000})}function ji(){let $=U1();return H5({mutationFn:(Z)=>q1("/api/settings",g5("PATCH",Z),"Failed to save settings"),onSuccess:(Z)=>{$.setQueryData(X_,Z)}})}function Oi($){return J5({queryKey:S0.env($),queryFn:()=>q1(`/api/workspaces/${$}/env`),...p4})}function Ti($){let Z=U1();return H5({mutationFn:(J)=>q1(`/api/workspaces/${$}/env`,g5("PUT",J)),onSuccess:(J)=>{Z.setQueryData(S0.env($),J)}})}function Ci($){let Z=U1();return H5({mutationFn:(J)=>P4(`/api/workspaces/${$}/config`,g5("PUT",{name:J}),"Failed to save name"),onSuccess:()=>{Z.invalidateQueries({queryKey:S0.layout($)}),Z.invalidateQueries({queryKey:S0.all})}})}function wi($){let Z=U1();return H5({scope:{id:`workspace-icon:${$}`},mutationFn:async(J)=>{if(J.kind==="set"){await P4(`/api/workspaces/${$}/config`,g5("PUT",{icon:J.icon}),"Failed to save icon");return}if(J.kind==="reset"){await P4(`/api/workspaces/${$}/icon`,{method:"DELETE"},"Failed to reset icon");return}await q1(`/api/workspaces/${$}/icon`,{method:"PUT",headers:{"Content-Type":J.file.type||"application/octet-stream"},body:J.file})},onMutate:(J)=>{if(J.kind!=="set")return;let H={icon:J.icon};Z.setQueryData(S0.layout($),(Q)=>Q?{...Q,...H}:Q),Z.setQueryData(S0.all,(Q)=>Q?.map((B)=>B.id===$?{...B,...H}:B))},onError:(J,H)=>{if(H.kind!=="set")return;Z.invalidateQueries({queryKey:S0.layout($)}),Z.invalidateQueries({queryKey:S0.all,exact:!0})},onSuccess:()=>{Z.invalidateQueries({queryKey:S0.layout($)}),Z.invalidateQueries({queryKey:S0.all})}})}function Ei($){let Z=U1();return W2((J)=>{if(J.type==="env:updated"&&J.workspaceId===$)Z.invalidateQueries({queryKey:S0.env($)})}),{env:Oi($),update:Ti($)}}var p5=P(c(),1),lG0={dotenv:".env",custom:"secret",both:"override"},iG0=/^[A-Za-z_][A-Za-z0-9_]*$/;function Si(){let{workspaceId:$}=i1(),{env:Z,update:J}=Ei($),[H,Q]=z_.useState(""),[B,X]=z_.useState(""),z=iG0.test(H),G=z&&B.length>0&&!J.isPending,U=()=>{if(!G)return;J.mutate({set:{[H]:B}},{onSuccess:()=>{Q(""),X("")}})},K=Z.data?.vars??[],Y=Z.data?.files.reduce((W,q)=>W+q.count,0)??0,F=Z.data?.files.length??0;return p5.jsxs(DH,{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:[p5.jsxs(LH,{label:"Variables",children:[Z.isLoading?p5.jsx("div",{className:"flex items-center justify-center px-3.5 py-6 text-muted-foreground",children:p5.jsx(b5,{className:"size-4 animate-spin",stroke:1.75})}):K.length===0?p5.jsx("p",{className:"px-3.5 py-4 text-sm text-muted-foreground",children:"No variables yet."}):K.map((W)=>{let q=W.source!=="dotenv";return p5.jsxs("div",{className:"flex items-center gap-3 px-3.5 py-2.5",children:[p5.jsx("code",{className:"min-w-0 flex-1 truncate font-mono text-xs text-foreground",children:W.key}),p5.jsx("span",{className:"text-xs tracking-widest text-muted-foreground/60 select-none",children:"••••••"}),p5.jsx("span",{className:B0("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:lG0[W.source]}),!q&&p5.jsx("span",{className:"text-right text-[11px] text-muted-foreground/60",children:"from file"}),p5.jsx(j0,{type:"button",variant:"ghost",size:"icon-sm",onClick:()=>J.mutate({remove:[W.key]}),disabled:!q,"aria-label":`Delete ${W.key}`,className:"disabled:invisible",children:p5.jsx(pW,{stroke:1.75})})]},W.key)}),p5.jsxs("div",{className:"flex items-center gap-2 px-3.5 py-2.5",children:[p5.jsx(N$,{value:H,onChange:(W)=>Q(W.target.value),placeholder:"NEW_KEY","aria-invalid":H.length>0&&!z,className:"h-7 w-40 font-mono text-xs"}),p5.jsx(N$,{value:B,onChange:(W)=>X(W.target.value),onKeyDown:(W)=>{if(W.key==="Enter")U()},type:"password",placeholder:"value",className:"h-7 flex-1 text-xs"}),p5.jsxs(j0,{variant:"outline",size:"sm",onClick:U,disabled:!G,children:[J.isPending?p5.jsx(b5,{stroke:1.75,className:"animate-spin"}):p5.jsx(f2,{stroke:1.75}),"Add"]})]})]}),p5.jsx(LH,{label:"From .env files",children:p5.jsx(YX,{title:"Inherit .env files",description:F>0?`Discovered ${Y} ${Y===1?"key":"keys"} across ${F} ${F===1?"file":"files"} in this space.`:"No .env files found in this space.",control:p5.jsx(Pi,{checked:Z.data?.inheritDotenv??!0,disabled:Z.isLoading,onCheckedChange:(W)=>J.mutate({inheritDotenv:W})})})})]})}var B9={};C5(B9,{createHandle:()=>ki,Viewport:()=>wU,Trigger:()=>Ii,Title:()=>EU,Root:()=>Ri,Portal:()=>OU,Popup:()=>jU,Handle:()=>cW,Description:()=>LU,Close:()=>DU,Backdrop:()=>VU});function Ri($){return CU("alert-dialog",$)}var Ii=SU;class cW extends XJ{}function ki(){return new cW}var Y4=P(c(),1);function dW({...$}){return Y4.jsx(B9.Root,{"data-slot":"alert-dialog",...$})}function lW({...$}){return Y4.jsx(B9.Trigger,{"data-slot":"alert-dialog-trigger",...$})}function rG0({...$}){return Y4.jsx(_8,{portal:B9.Portal,"data-slot":"alert-dialog-portal",...$})}function aG0({className:$,...Z}){return Y4.jsx(B9.Backdrop,{"data-slot":"alert-dialog-overlay",className:a0("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 iW({className:$,size:Z="default",...J}){return Y4.jsxs(rG0,{children:[Y4.jsx(aG0,{}),Y4.jsx(B9.Popup,{"data-slot":"alert-dialog-content","data-size":Z,className:a0("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 rW({className:$,...Z}){return Y4.jsx("div",{"data-slot":"alert-dialog-header",className:a0("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 aW({className:$,...Z}){return Y4.jsx("div",{"data-slot":"alert-dialog-footer",className:a0("-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 oW({className:$,...Z}){return Y4.jsx(B9.Title,{"data-slot":"alert-dialog-title",className:a0('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 nW({className:$,...Z}){return Y4.jsx(B9.Description,{"data-slot":"alert-dialog-description",className:a0("text-sm text-balance text-muted-foreground md:text-pretty *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",$),...Z})}function sW({className:$,...Z}){return Y4.jsx(j0,{"data-slot":"alert-dialog-action",className:a0($),...Z})}function tW({className:$,variant:Z="outline",size:J="default",...H}){return Y4.jsx(B9.Close,{"data-slot":"alert-dialog-cancel",className:a0($),render:Y4.jsx(j0,{variant:Z,size:J}),...H})}var Y2=P(c(),1);function bi(){let{cloudDemo:$}=O8(),{name:Z,cwd:J,workspaceId:H}=i1(),[,Q]=W8(),B=CR(),X=Z??J??"this space",z=()=>{B.mutate(H,{onSuccess:()=>Q("/")})};return Y2.jsxs(DH,{title:"General",description:"Basic details for this space.",children:[Y2.jsx(LH,{children:Y2.jsx(YX,{title:"Path",control:Y2.jsx(N$,{value:J??"","aria-label":"Workspace path",title:J??void 0,className:"w-56",readOnly:!0})})}),!$&&Y2.jsx(LH,{label:"Danger zone",children:Y2.jsx(YX,{title:"Remove space",description:"Remove this space from moi. Its folder and sessions stay on disk.",control:Y2.jsxs(dW,{children:[Y2.jsx(lW,{render:Y2.jsx(j0,{type:"button",variant:"destructive",size:"sm"}),disabled:B.isPending,children:"Remove"}),Y2.jsxs(iW,{children:[Y2.jsxs(rW,{children:[Y2.jsxs(oW,{children:["Remove “",X,"” from your workspaces?"]}),Y2.jsx(nW,{children:"This only removes it from your list. The folder and its sessions stay on disk. You can add it back any time."})]}),B.isError&&Y2.jsx("p",{className:"text-xs text-destructive",children:B.error.message}),Y2.jsxs(aW,{children:[Y2.jsx(tW,{disabled:B.isPending,children:"Cancel"}),Y2.jsxs(sW,{type:"button",variant:"destructive",onClick:z,disabled:B.isPending,children:[B.isPending&&Y2.jsx(b5,{"data-icon":"inline-start",stroke:1.75,className:"animate-spin"}),"Remove"]})]})]})]})})})]})}var r4=P(c(),1),oG0=[{id:"general",label:"General",icon:S6},{id:"connectors",label:"Connectors",icon:gW},{id:"environment",label:"Environment",icon:oU}];function eW({children:$}){let[Z,J]=yi.useState("general");return r4.jsxs(O6,{children:[$,r4.jsxs(zJ,{className:"flex h-[min(680px,90vh)] w-[880px] gap-0 overflow-hidden p-0 sm:max-w-[94vw]",children:[r4.jsx(T6,{className:"sr-only",children:"Space settings"}),r4.jsxs("nav",{className:"flex w-48 shrink-0 flex-col gap-0.5 border-r bg-muted p-3",children:[r4.jsx("p",{className:"px-2.5 pt-4 pb-2 text-xs text-muted-foreground",children:"Settings"}),oG0.map((H)=>r4.jsxs(j0,{type:"button",variant:Z===H.id?"secondary":"ghost",size:"sm",onClick:()=>J(H.id),className:"justify-start",children:[r4.jsx(H.icon,{stroke:1.75}),H.label]},H.id))]}),r4.jsx("div",{className:"relative scrollbar-thin min-w-0 flex-1 overflow-y-auto",children:r4.jsxs("div",{className:"px-8 py-7",children:[Z==="general"&&r4.jsx(bi,{}),Z==="connectors"&&r4.jsx(Wi,{}),Z==="environment"&&r4.jsx(Si,{})]})})]})]})}var ci=P(m(),1);var xi=P(m(),1);var hi=P(c(),1);function $q({className:$,onBlur:Z,onFocus:J,onKeyDown:H,onValueChange:Q,onValueCommit:B,selectOnFocus:X,...z}){let G=xi.useRef(null);function U(F){let W=G.current!==null;if(G.current=null,Z?.(F),!F.defaultPrevented&&W)B?.(F.currentTarget.value)}function K(F){if(G.current=F.currentTarget.value,X){let W=F.currentTarget;W.select(),requestAnimationFrame(()=>{W.scrollLeft=0})}J?.(F)}function Y(F){if(H?.(F),F.defaultPrevented)return;if(F.key==="Enter")F.preventDefault(),F.currentTarget.blur();else if(F.key==="Escape"){F.preventDefault();let W=G.current??F.currentTarget.value;G.current=null,F.currentTarget.value=W,Q?.(W),F.currentTarget.blur()}}return hi.jsx(hQ,{"data-slot":"inline-input",className:B0("-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:(F)=>Q?.(F.target.value),onFocus:K,onKeyDown:Y,...z})}function Zq($){return J5({queryKey:S0.views($),queryFn:async()=>{return(await q1(`/api/workspaces/${$}/views`)).views},...p4})}function vi($){return H5({mutationFn:({viewId:Z,title:J})=>q1(`/api/workspaces/${$}/views/${encodeURIComponent(Z)}`,g5("PATCH",{title:J}),"Failed to rename view")})}function gi($){return H5({mutationFn:(Z)=>P4(`/api/workspaces/${$}/views/${encodeURIComponent(Z)}`,{method:"DELETE"},"Failed to delete view")})}function Jq($,Z){let J=$??[];if(J.findIndex((Q)=>Q.id===Z.id)===-1)return[...J,Z];return J.map((Q)=>Q.id===Z.id&&Q.updatedAt<=Z.updatedAt?Z:Q)}function Hq($){let Z=U1();return W2((J)=>{if(J.type==="view-builder:updated"&&J.workspaceId===$)Z.setQueryData(S0.viewBuilders($),(H)=>Jq(H,J.builder));else if(J.type==="view-builder:deleted"&&J.workspaceId===$)Z.setQueryData(S0.viewBuilders($),(H)=>(H??[]).filter((Q)=>Q.id!==J.builderId))}),J5({queryKey:S0.viewBuilders($),queryFn:async()=>{return(await q1(`/api/workspaces/${$}/view-builders`)).builders},...p4})}function fi($){let Z=U1();return H5({mutationFn:()=>q1(`/api/workspaces/${$}/view-builders`,g5("POST"),"Failed to create view builder"),onSuccess:(J)=>{Z.setQueryData(S0.viewBuilders($),(H)=>Jq(H,J))}})}function mi($){let Z=U1();return H5({mutationFn:({builderId:J,requirements:H})=>q1(`/api/workspaces/${$}/view-builders/${J}`,g5("PATCH",{input:{requirements:H}}),"Failed to save view requirements"),onSuccess:(J)=>{Z.setQueryData(S0.viewBuilders($),(H)=>Jq(H,J))}})}function ui($){let Z=U1();return H5({mutationFn:({builderId:J,requirements:H,...Q})=>q1(`/api/workspaces/${$}/view-builders/${J}/submit`,g5("POST",{input:{requirements:H},availableIcons:vQ,...Q}),"Failed to start view builder"),onSuccess:(J)=>{Z.setQueryData(S0.viewBuilders($),(H)=>Jq(H,J))}})}function pi($){let Z=U1();return H5({mutationFn:(J)=>P4(`/api/workspaces/${$}/view-builders/${J}`,{method:"DELETE"},"Failed to discard view builder"),onSuccess:(J,H)=>{Z.setQueryData(S0.viewBuilders($),(Q)=>(Q??[]).filter((B)=>B.id!==H))}})}function qX($){return $.config.title||$.id}function NX($,Z){let J=Z.find((H)=>H.viewId===$.id);return V$($.config.icon)??V$(J?.icon)??rJ}var C1=P(c(),1);function nG0({outlined:$,onClick:Z}){return C1.jsxs("button",{type:"button","aria-label":"Create new view",onClick:Z,className:B0("group flex w-20 shrink-0 cursor-pointer flex-col items-center gap-2 text-sm",$?"text-foreground":"text-muted-foreground"),children:[C1.jsx("div",{className:B0("size-16 rounded-2xl squircle",$&&"shadow-xs transition-shadow duration-300 ease-out group-hover:shadow-2xl"),children:C1.jsx("div",{className:B0("flex size-full items-center justify-center rounded-2xl squircle",$?"bg-background text-foreground":"bg-accent"),children:C1.jsx(f2,{size:32,stroke:1.25})})}),C1.jsx("span",{className:"line-clamp-2 w-full text-xs leading-snug font-medium text-ellipsis",children:"New view"})]})}function sG0({view:$,Icon:Z,onOpen:J}){let{workspaceId:H}=i1(),Q=vi(H),B=gi(H),X=qX($),[z,G]=ci.useState(!1);function U(){G(!0)}function K(Y){let F=Y.trim();if(!F||F===X)return;Q.mutate({viewId:$.id,title:F},{onError:(W)=>{A5.add({title:"Couldn’t rename view",description:W.message,type:"error"})}})}return C1.jsxs("div",{className:"group/item relative w-20 shrink-0",children:[C1.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:[C1.jsx("div",{className:"size-16 rounded-2xl transition-shadow duration-300 ease-out squircle group-hover:shadow-xl group-hover/item:shadow-xl",children:C1.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:C1.jsx(Z,{size:32,stroke:1.25})})}),C1.jsx("span",{className:"line-clamp-2 w-full text-xs leading-snug font-medium text-ellipsis",children:z?"":X})]}),z&&C1.jsx($q,{autoFocus:!0,selectOnFocus:!0,"aria-label":`Rename ${X}`,defaultValue:X,onBlur:()=>G(!1),onValueCommit:K,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"}),C1.jsxs(dW,{children:[C1.jsxs(o9,{children:[C1.jsx(n9,{render:C1.jsx(j0,{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:C1.jsx(aU,{stroke:1.75})})}),C1.jsxs(s9,{align:"end",className:"min-w-32",children:[C1.jsxs(H9,{onClick:U,disabled:Q.isPending,children:[C1.jsx(OF,{stroke:1.75}),"Rename"]}),C1.jsxs(H9,{nativeButton:!0,render:C1.jsx(lW,{}),disabled:B.isPending,onClick:()=>B.reset(),className:"w-full",children:[C1.jsx(pW,{stroke:1.75}),"Delete"]})]})]}),C1.jsxs(iW,{children:[C1.jsxs(rW,{children:[C1.jsxs(oW,{children:["Delete “",X,"”?"]}),C1.jsx(nW,{children:"This deletes the view and its source code. Related data and shared files stay in the workspace."})]}),B.isError&&C1.jsx("p",{className:"text-xs text-destructive",children:B.error.message}),C1.jsxs(aW,{children:[C1.jsx(tW,{disabled:B.isPending,children:"Cancel"}),C1.jsxs(sW,{type:"button",variant:"destructive",disabled:B.isPending,onClick:()=>B.mutate($.id),children:[B.isPending&&C1.jsx(b5,{"data-icon":"inline-start",stroke:1.75,className:"animate-spin"}),"Delete view"]})]})]})]})]})}function di({views:$,builders:Z,onOpenView:J,onCreateView:H,showOnboarding:Q}){let B=$.length===0;return C1.jsxs("div",{className:"relative no-scrollbar flex size-full items-center overflow-hidden bg-muted",children:[B&&C1.jsx("div",{className:"pointer-events-none absolute inset-0 texture-checker [mask-image:linear-gradient(to_right,transparent_40%,black_80%)]","aria-hidden":!0}),C1.jsx("h2",{className:"relative pr-6 pl-12 text-2xl font-semibold text-foreground",children:"Views"}),C1.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((X)=>C1.jsx(sG0,{view:X,Icon:NX(X,Z),onOpen:()=>J(X.id)},X.id)),C1.jsx(nG0,{outlined:B,onClick:H})]}),B&&Q&&C1.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 ii=P(c(),1),tG0={[UL.id]:($)=>ii.jsx(di,{views:$.views,builders:$.builders,onOpenView:$.onOpenView,onCreateView:$.onCreateView,showOnboarding:$.showOnboarding})};function li($,Z){if(!r9($))return;return tG0[$](Z)}function ri($,Z,J,H){let Q=$.reduce((B,X)=>Math.max(B,X.y+X.h),0);for(let B=0;B<=Q+J;B++)for(let X=0;X<=H-Z;X++)if(!$.some((G)=>!(X+Z<=G.x||G.x+G.w<=X||B+J<=G.y||G.y+G.h<=B)))return{x:X,y:B};return{x:0,y:Q}}function AX($,Z=[],J=4){let H=[];for(let Q of $){let{x:B,y:X}=Q.x!==void 0&&Q.y!==void 0?{x:Q.x,y:Q.y}:ri([...Z,...H],Q.w,Q.h,J);H.push({i:Q.id,x:B,y:X,w:Q.w,h:Q.h})}return H}function Qq($,Z,J){return ri($,Z,J,4)}function ai($,Z){let J=new Map(Z.map((H)=>[H.id,H]));return $.map((H)=>{let Q=J.get(H.i);return Q?{...H,x:Q.x,y:Q.y}:H})}var G_=P(m(),1),Bq=new Map;function eG0($){let Z=window.__moiAppletCss?.get($)??"",J=Bq.get($);if(!J){let B=document.createElement("style");B.dataset.appletStyle=$,document.head.appendChild(B),J={el:B,refs:0},Bq.set($,J)}if(J.el.textContent!==Z)J.el.textContent=Z;J.refs++;let H=J,Q=!1;return()=>{if(Q)return;if(Q=!0,H.refs--,H.refs<=0)H.el.remove(),Bq.delete($)}}function $U0($){let Z=Bq.get($);if(!Z||Z.el===document.head.lastElementChild)return;document.head.appendChild(Z.el)}function Xq($,Z,J=!1){G_.useInsertionEffect(()=>eG0($),[$,Z]),G_.useInsertionEffect(()=>{if(J)$U0($)},[$,J,Z])}var U_=P(c(),1);function oi({segment:$,name:Z,version:J,children:H}){let Q=e1(),B=i6($,Z);return Xq(LY($,Q,Z),J),U_.jsx("div",{"data-applet":B,className:"size-full",children:U_.jsx(DQ,{appletId:B,children:H})})}var ni=P(m(),1);var MH=P(c(),1);class VX extends ni.Component{state={error:null};static getDerivedStateFromError($){return{error:$}}componentDidCatch($,Z){console.error(`[widget:${this.props.name}]`,$,Z.componentStack),Z8(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 MH.jsxs("div",{className:"flex h-full w-full flex-col items-start justify-start gap-1.5 p-4 text-xs",children:[MH.jsxs("div",{className:"flex items-center gap-1.5 font-semibold text-destructive",children:[MH.jsx(qG,{size:16,stroke:1.75}),"Widget crashed"]}),MH.jsx("div",{className:"font-mono break-words text-muted-foreground",children:this.state.error.message})]});return this.props.children}}var W7=P(c(),1);function si({name:$}){let Z=e1(),J=Nh($);return W7.jsxs(j4,{mode:"wait",initial:!1,children:[J.status==="ready"&&W7.jsx(z5.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:W7.jsx(VX,{name:$,kind:"widget",workspaceId:Z,resetKey:J.version,children:W7.jsx(oi,{segment:"widgets",name:$,version:J.version,children:W7.jsx(J.Component,{})})})},J.version),J.status==="error"&&W7.jsx(z5.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 ei=P(m(),1);var q7=P(c(),1);function zq({customizing:$,hidden:Z,widgetId:J,onRemove:H,children:Q}){let B=Rh(),X=!J||!r9(J);return q7.jsxs(z5.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:[q7.jsx("div",{"data-widget-chrome":!0,"data-vivid":X?!0:void 0,style:X?J9(B,"widget"):void 0,className:B0("absolute inset-0 overflow-hidden rounded-2xl text-foreground squircle",$&&"pointer-events-none"),children:Q}),$&&H&&q7.jsx("div",{className:"absolute -top-2 -right-2 opacity-0 transition-opacity group-hover/widget:opacity-100",children:q7.jsx(j0,{size:"icon-sm",variant:"outline",className:"rounded-full","aria-label":Z?"Restore widget":"Hide widget",onPointerDown:(z)=>z.stopPropagation(),onClick:H,children:Z?q7.jsx(f2,{stroke:1.75}):q7.jsx(ti,{stroke:1.75})})})]})}var v3=P(c(),1),ZU0={0:"col-start-1",1:"col-start-2",2:"col-start-3",3:"col-start-4"},JU0={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"},HU0={1:"col-span-1",2:"col-span-2",3:"col-span-3",4:"col-span-4"},QU0={1:"row-span-1",2:"row-span-2",3:"row-span-3",4:"row-span-4"};function $r({items:$,renderItem:Z,onCreateWidget:J,onClose:H,onRestore:Q,ref:B}){let X=ei.useMemo(()=>AX($),[$]);return v3.jsx(bW,{ref:B,title:"Widgets",actions:v3.jsxs(j0,{type:"button",variant:"secondary",size:"sm",onClick:J,children:[v3.jsx(f2,{"data-icon":"inline-start",stroke:1.75}),"New widget"]}),onClose:H,className:"max-h-[60vh]",children:X.length>0&&v3.jsx("div",{className:"grid auto-rows-[160px] grid-cols-4 gap-2",children:v3.jsx(j4,{children:X.map((z)=>v3.jsx(z5.div,{layoutId:z.i,className:B0(ZU0[z.x],JU0[z.y],HU0[z.w],QU0[z.h]),transition:{type:"spring",duration:0.35,bounce:0},children:v3.jsx(zq,{customizing:!0,widgetId:z.i,onRemove:()=>Q(z.i),hidden:!0,children:Z(z.i)})},z.i))})})})}var jq=P(m(),1);var E4=P(m(),1);var Z1=P(m(),1),PH=P(m(),1),z8=P(m(),1),_r=P(c(),1),Uq=P(m(),1),Kq=P(m(),1),v1=P(c(),1),BU0=Object.defineProperty,XU0=($,Z)=>{for(var J in Z)BU0($,J,{get:Z[J],enumerable:!0})},g3={};XU0(g3,{ActiveEmoji:()=>gr,Empty:()=>vr,List:()=>yr,Loading:()=>hr,Root:()=>wr,Search:()=>Er,SkinTone:()=>fr,SkinToneSelector:()=>xr,Viewport:()=>Sr});var Ar="'Apple Color Emoji', 'Noto Color Emoji', 'Twemoji Mozilla', 'Android Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', EmojiSymbols, sans-serif",F_=["none","light","medium-light","medium","medium-dark","dark"];function K_($){return $.charAt(0).toUpperCase()+$.slice(1)}var X9=2,F4=null;function Zr($){try{F4??=document.createElement("canvas").getContext("2d",{willReadFrequently:!0})}catch{}if(!F4||(queueMicrotask(()=>{F4&&(F4=null)}),F4.canvas.width=X9,F4.canvas.height=X9,F4.font=`2px ${Ar}`,F4.textBaseline="middle",F4.measureText($).width>=X9*2))return!1;F4.fillStyle="#00f",F4.fillText($,0,0);let Z=F4.getImageData(0,0,X9,X9).data;F4.clearRect(0,0,X9,X9),F4.fillStyle="#f00",F4.fillText($,0,0);let J=F4.getImageData(0,0,X9,X9).data;for(let H=0;H<X9*X9*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 Jr($,Z,J){try{let H=$.getItem(Z);if(!H)throw Error(`No value found for "${Z}".`);let Q=JSON.parse(H);return J(Q)}catch{return null}}function Vr($,Z,J){$.setItem(Z,JSON.stringify(J))}function Hr($){return(Z)=>Z===void 0?void 0:$(Z)}function Qr($){return(Z)=>Z===null?null:$(Z)}function p2($){if(typeof $!="string")throw Error();return $}function Gq($){if(typeof $!="number")throw Error();return $}function Dr($){if(typeof $!="boolean")throw Error();return $}function N7($){return(Z)=>{if(typeof Z!="object"||Z===null)throw Error();let J={};for(let H in $){let Q=Z[H];Q===void 0&&$[H](void 0),J[H]=$[H](Q)}return J}}function Y_($){return(Z)=>{if(!Array.isArray(Z))throw Error();return Z.length>0&&$(Z[0]),Z}}var Lr=($,Z)=>`${$}/${Z}/data.json`,Mr=($,Z)=>`${$}/${Z}/messages.json`,zU0=["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"],Br="en",Pr=($)=>`frimousse/data/${$}`,Xr="frimousse/metadata";async function zr($,Z){try{return(await fetch($,{method:"HEAD",signal:Z})).headers.get("etag")}catch{return null}}async function GU0($,Z,J){let[{emojis:H,emojisEtag:Q},{messages:B,messagesEtag:X}]=await Promise.all([fetch(Lr($,Z),{signal:J}).then(async(z)=>({emojis:await z.json(),emojisEtag:z.headers.get("etag")})),fetch(Mr($,Z),{signal:J}).then(async(z)=>({messages:await z.json(),messagesEtag:z.headers.get("etag")}))]);return{emojis:H,messages:B,emojisEtag:Q,messagesEtag:X}}async function UU0($,Z,J){let[H,Q]=await Promise.all([zr(Lr($,Z),J),zr(Mr($,Z),J)]);return{emojisEtag:H,messagesEtag:Q}}function KU0($){return $.skins?$.skins.filter((Z)=>typeof Z.tone=="number").reduce((Z,J)=>{let H=F_[J.tone];return Z[H]=J.emoji,Z},{}):void 0}async function Gr($,Z,J){let{emojis:H,emojisEtag:Q,messages:B,messagesEtag:X}=await GU0($,Z,J),z=B.subgroups.find((q)=>q.key==="country-flag"||q.key==="subdivision-flag"),G=B.groups.filter((q)=>q.key!=="component"),U=H.filter((q)=>("group"in q)),K=G.map((q)=>({index:q.order,label:K_(q.message)})),Y=B.skinTones.reduce((q,N)=>(q[N.key]=K_(N.message),q),{}),F=U.map((q)=>({emoji:q.emoji,category:q.group,version:q.version,label:K_(q.label),tags:q.tags??[],countryFlag:z&&q.subgroup===z.order||void 0,skins:KU0(q)})),W={locale:Z,emojis:F,categories:K,skinTones:Y};return Vr(localStorage,Pr(Z),{data:W,metadata:{emojisEtag:Q,messagesEtag:X}}),W}function YU0($,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),Q=H[0]??0,B=Zr("\uD83C\uDDEA\uD83C\uDDFA");if(typeof Z=="number")return{emojiVersion:Z,countryFlags:B};for(let X of H){let z=J.get(X);if(Zr(z))return{emojiVersion:X,countryFlags:B}}return{emojiVersion:Q,countryFlags:B}}var FU0=N7({emojiVersion:Gq,countryFlags:Dr}),WU0=N7({data:N7({locale:p2,emojis:Y_(N7({emoji:p2,category:Gq,label:p2,version:Gq,tags:Y_(p2),countryFlag:Hr(Dr),skins:Hr(N7({light:p2,"medium-light":p2,medium:p2,"medium-dark":p2,dark:p2}))})),categories:Y_(N7({index:Gq,label:p2})),skinTones:N7({light:p2,"medium-light":p2,medium:p2,"medium-dark":p2,dark:p2})}),metadata:N7({emojisEtag:Qr(p2),messagesEtag:Qr(p2)})});async function qU0({locale:$,emojiVersion:Z,emojibaseUrl:J,signal:H}){let Q=typeof J=="string"?J:`https://cdn.jsdelivr.net/npm/emojibase-data@${typeof Z=="number"?Math.floor(Z):"latest"}`,B=Jr(sessionStorage,Xr,FU0),X=Jr(localStorage,Pr($),WU0),z;if(!X)z=await Gr(Q,$,H);else if(B)z=X.data;else try{let{emojisEtag:U,messagesEtag:K}=await UU0(Q,$,H);z=!U||!K||U!==X.metadata.emojisEtag||K!==X.metadata.messagesEtag?await Gr(Q,$,H):X.data}catch{z=X.data}B??=YU0(z.emojis,Z),Vr(sessionStorage,Xr,B);let G=z.emojis.filter((U)=>{let K=U.version<=B.emojiVersion;return U.countryFlag?K&&B.countryFlags:K});return{locale:$,emojis:G,categories:z.categories,skinTones:z.skinTones}}function Ur($){return zU0.includes($)?$:(console.warn(`Locale "${$}" is not supported, using "${Br}" instead.`),Br)}function Kr($){return F_.includes($)?$:(console.warn(`Skin tone "${$}" is not valid, using "none" instead.`),"none")}function NU0($,Z){let J=[];if(Z<=0)return J;for(let H=0,Q=$.length;H<Q;H+=Z)J.push($.slice(H,H+Z));return J}function AU0($,Z){if(!Z)return $;let J=Z.toLowerCase().trim(),H=new WeakMap;return $.filter((Q)=>{let B=0;Q.label.toLowerCase().includes(J)&&(B+=10);for(let X of Q.tags)X.toLowerCase().includes(J)&&(B+=1);return B>0?(H.set(Q,B),!0):!1}).sort((Q,B)=>(H.get(B)??0)-(H.get(Q)??0))}function VU0($,Z,J,H){let Q=AU0($.emojis,H),B=[],X=[],z=[],G={},U=0,K=0;for(let Y of Q)G[Y.category]||(G[Y.category]=[]),G[Y.category].push({emoji:J&&J!=="none"&&Y.skins?Y.skins[J]:Y.emoji,label:Y.label});for(let Y of $.categories){let F=G[Y.index];if(!F||F.length===0)continue;let W=NU0(Array.from(F),Z).map((q)=>({categoryIndex:U,emojis:q}));B.push(...W),X.push({label:Y.label,rowsCount:W.length,startRowIndex:K}),z.push(K),U++,K+=W.length}return{count:Q.length,categories:X,categoriesStartRowIndices:z,rows:B,skinTones:$.skinTones}}function DU0($){let Z={},J=null,H=null,Q=new Set,B=()=>{if(J){Z=J,J=null;for(let U of Q)U(Z)}H=null},X=()=>J??Z,z=(U)=>{J??=Z,Object.assign(J,typeof U=="function"?U(X()):U),H||(H=requestAnimationFrame(B))},G=(U)=>(Q.add(U),()=>Q.delete(U));return Z=$(z,X),{get:X,set:z,subscribe:G}}function LU0($){let[Z]=z8.useState($);return Z}function MU0($){let Z=z8.createContext(null);return{useStore:()=>{let J=z8.useContext(Z);if(!J)throw Error($);return J},Provider:({store:J,children:H})=>_r.jsx(Z.Provider,{value:J,children:H})}}function X8($,Z,J=Object.is){let[H,Q]=z8.useState(()=>Z($.get()));return z8.useEffect(()=>$.subscribe(()=>{let B=Z($.get());Q((X)=>J(X,B)?X:B)}),[$,Z,J]),z8.useDebugValue(H),H}function Q3($,Z,J){let H=z8.useCallback((Q)=>Q[Z],[Z]);return X8($,H,J)}var Yr=2;function PU0($,Z,J,H,Q){let B=0;return DU0((X,z)=>({locale:Z,columns:J,sticky:H,skinTone:Q,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(),K=G?.data??U.data,Y=G?.categoryHeaderHeight??U.categoryHeaderHeight,F=G?.rowHeight??U.rowHeight,W=G?.viewportHeight??U.viewportHeight;if(!K||K.rows.length===0||!Y||!F||!W)return X({...G,viewportStartCategoryIndex:0,viewportStartRowIndex:0,viewportEndRowIndex:0});let q=0,N=0;for(let C of K.categories)if(N++*Y+C.startRowIndex*F<B)q+=Y;else break;let V=K.categories.length*Y+K.rows.length*F,A=Math.floor(Yr*F/2),D=Math.ceil(Yr*F/2),L=Math.min(B-q-A,V-W),j=L+W+D,M=Math.max(0,Math.floor(L/F)),_=Math.min(K.rows.length-1,Math.ceil(j/F)),E=K.rows[M]?.categoryIndex;return X(E===void 0&&G?G:{...G,viewportStartCategoryIndex:E,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,K)=>{if(X({interaction:G,activeColumnIndex:U,activeRowIndex:K}),G!=="keyboard")return;let{listRef:Y,viewportRef:F,sticky:W,rowHeight:q,viewportHeight:N,categoryHeaderHeight:V}=z(),A=Y?.current,D=F?.current;if(!A||!D||!q||!V||!N)return;let L=K;L===0&&D.scrollTo({top:0,behavior:"instant"});let j=A.querySelector(`[aria-rowindex="${L}"]`);if(!(j instanceof HTMLElement))return;let M=j.offsetTop,_=getComputedStyle(j),E=Number.parseFloat(_.scrollMarginTop),C=Number.parseFloat(_.scrollMarginBottom),R=B+E;W&&M<B+N/2&&(R+=V);let T=R+N-C;(M<R||M+q>T)&&D.scrollTo({top:Math.max(M<R+V?M-Math.max(W?V:0,E):M-N+q+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)=>{B=G,z().updateViewportState()}}))}var{useStore:a4,Provider:_U0}=MU0("EmojiPicker.Root is missing.");function jU0($){return $.search}function W_($){return $.interaction==="none"?void 0:$.data?.rows[$.activeRowIndex]?.emojis[$.activeColumnIndex]}function OU0($){return $.data===void 0||typeof $.data?.count=="number"&&$.data.count===0}function TU0($){return $.data===null||$.viewportHeight===null||$.rowHeight===null||$.categoryHeaderHeight===null}function jr($){return $.data?.rows.length}function CU0($){return $.data?.categories.length}function wU0($){return $.data?.categoriesStartRowIndices}function EU0($){return $.data?.skinTones}function Or($,Z){return $?.emoji===Z?.emoji}function SU0($,Z){return $?.categoryIndex!==Z?.categoryIndex||$?.emojis.length!==Z?.emojis.length?!1:!!$?.emojis.every((J,H)=>Or(J,Z?.emojis[H]))}var DX="‍",Fr=/\p{Emoji_Modifier_Base}/u,RU0=/\uFE0F$/,IU0=/\u{1F3FB}|\u{1F3FC}|\u{1F3FD}|\u{1F3FE}|\u{1F3FF}/gu,kU0={light:"\uD83C\uDFFB","medium-light":"\uD83C\uDFFC",medium:"\uD83C\uDFFD","medium-dark":"\uD83C\uDFFE",dark:"\uD83C\uDFFF"};function bU0($,Z){if(!$.split(DX).some((H)=>Fr.test(H)))return $;let J=$.split(DX).map((H)=>H.replace(IU0,"")).join(DX);return Z==="none"?J:J.split(DX).map((H,Q,B)=>{let X=B.length>1;return!Fr.test(H)||X&&H==="\uD83E\uDD1D"?H:H.replace(RU0,"")+kU0[Z]}).join(DX)}function yU0($){return F_.map((Z)=>({skinTone:Z,emoji:bU0($,Z)}))}function Tr(){let $=a4(),Z=X8($,W_,Or);return PH.useDeferredValue(Z)}function Cr($="✋"){let Z=a4(),J=Q3(Z,"skinTone"),H=PH.useMemo(()=>yU0($),[$]),Q=PH.useCallback((B)=>{Z.set({skinTone:B})},[]);return[J,Q,H]}function q_($,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((Q)=>(Q in Z)&&$[Q]===Z[Q])}function xU0(...$){}function hU0($,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 z9=typeof window<"u"?Uq.useLayoutEffect:Uq.useEffect;function vU0($){let Z=Kq.useRef($);return z9(()=>{Z.current=$}),Kq.useCallback((...J)=>Z.current(...J),[])}function gU0({emojiVersion:$,emojibaseUrl:Z}){let[J,H]=Z1.useState(void 0),Q=a4(),B=Q3(Q,"locale"),X=Q3(Q,"columns"),z=Q3(Q,"skinTone"),G=Q3(Q,"search");return Z1.useEffect(()=>{let U=new AbortController,K=U.signal;return qU0({locale:B,emojiVersion:$,emojibaseUrl:Z,signal:K}).then((Y)=>{H(Y)}).catch((Y)=>{K.aborted||console.error(Y)}),()=>{U.abort()}},[$,Z,B]),Z1.useEffect(()=>{if(J)return hU0(()=>{Q.get().onDataChange(VU0(J,X,z,G))},{timeout:100})},[J,X,z,G]),null}var wr=Z1.forwardRef(({locale:$="en",columns:Z=9,skinTone:J="none",onEmojiSelect:H=xU0,emojiVersion:Q,emojibaseUrl:B,onFocusCapture:X,onBlurCapture:z,children:G,style:U,sticky:K=!0,...Y},F)=>{let W=vU0(H),q=LU0(()=>PU0(W,Ur($),Z,K,Kr(J))),[N,V]=Z1.useState(!1),A=Z1.useRef(null),D=Z1.useCallback((M)=>{M&&(A.current=M,q.set({rootRef:A}))},[]);z9(()=>{q.set({locale:Ur($)})},[$]),z9(()=>{q.set({columns:Z})},[Z]),z9(()=>{q.set({sticky:K})},[K]),z9(()=>{q.set({skinTone:Kr(J)})},[J]);let L=Z1.useCallback((M)=>{X?.(M);let{searchRef:_,viewportRef:E}=q.get(),C=M.target===_?.current||M.target.hasAttribute("frimousse-search"),R=M.target===E?.current||M.target.hasAttribute("frimousse-viewport");M.isDefaultPrevented()||(V(C||R),M.isDefaultPrevented()||(V(C||R),R?q.get().onActiveEmojiChange("keyboard",0,0):C&&q.get().search===""&&q.set({interaction:"none"})))},[X]),j=Z1.useCallback((M)=>{z?.(M),!M.isDefaultPrevented()&&!M.currentTarget.contains(M.relatedTarget)&&V(!1)},[z]);return z9(()=>{N||q.get().onActiveEmojiReset()},[N]),Z1.useImperativeHandle(F,()=>A.current),Z1.useEffect(()=>{if(!N)return;function M(_){if(_.defaultPrevented||!_.key.startsWith("Arrow")&&_.key!=="Enter")return;let{data:E,onEmojiSelect:C,onActiveEmojiChange:R,interaction:T,activeColumnIndex:I,activeRowIndex:y}=q.get();if(_.key==="Enter"){let S=W_(q.get());S&&(_.preventDefault(),C(S))}if(_.key.startsWith("Arrow")){let S=I,O=y;if(_.preventDefault(),T!=="none"){if(E?.rows&&E.rows.length>0)switch(_.key){case"ArrowLeft":{if(S===0){let b=O-1,k=E.rows[b];k&&(O=b,S=k.emojis.length-1)}else S-=1;break}case"ArrowRight":{if(S===E.rows[O].emojis.length-1){let b=O+1;E.rows[b]&&(O=b,S=0)}else S+=1;break}case"ArrowUp":{let b=E.rows[O-1];b&&(O-=1,b.emojis[S]||(S=b.emojis.length-1));break}case"ArrowDown":{let b=E.rows[O+1];b&&(O+=1,b.emojis[S]||(S=b.emojis.length-1));break}}R("keyboard",S,O)}else R("keyboard",0,0)}}return document.addEventListener("keydown",M),()=>{document.removeEventListener("keydown",M)}},[N]),z9(()=>{let M=null,_=null,E=null,C=null,R=q.subscribe((O)=>{A.current&&(M!==O.viewportWidth&&(M=O.viewportWidth,A.current.style.setProperty("--frimousse-viewport-width",`${O.viewportWidth}px`)),_!==O.viewportHeight&&(_=O.viewportHeight,A.current.style.setProperty("--frimousse-viewport-height",`${O.viewportHeight}px`)),E!==O.rowHeight&&(E=O.rowHeight,A.current.style.setProperty("--frimousse-row-height",`${O.rowHeight}px`)),C!==O.categoryHeaderHeight&&(C=O.categoryHeaderHeight,A.current.style.setProperty("--frimousse-category-header-height",`${O.categoryHeaderHeight}px`)))}),{viewportWidth:T,viewportHeight:I,rowHeight:y,categoryHeaderHeight:S}=q.get();return T&&A.current.style.setProperty("--frimousse-viewport-width",`${T}px`),I&&A.current.style.setProperty("--frimousse-viewport-height",`${I}px`),y&&A.current.style.setProperty("--frimousse-row-height",`${y}px`),S&&A.current.style.setProperty("--frimousse-category-header-height",`${S}px`),R},[]),v1.jsx("div",{"data-focused":N?"":void 0,"frimousse-root":"",onBlurCapture:j,onFocusCapture:L,...Y,ref:D,style:{"--frimousse-emoji-font":Ar,...U},children:v1.jsxs(_U0,{store:q,children:[v1.jsx(gU0,{emojiVersion:Q,emojibaseUrl:B}),G]})})}),Er=Z1.forwardRef(({value:$,defaultValue:Z,onChange:J,...H},Q)=>{let B=a4(),X=Z1.useRef(null),z=Z1.useCallback((Y)=>{Y&&(X.current=Y,B.set({searchRef:X}))},[]),G=typeof $=="string",U=Z1.useRef(G);Z1.useEffect(()=>{U.current=G},[G]),z9(()=>{B.set({search:typeof $=="string"?$:typeof Z=="string"?Z:""})},[]),z9(()=>{typeof $=="string"&&B.get().onSearchChange($)},[$]);let K=Z1.useCallback((Y)=>{J?.(Y),Y.isDefaultPrevented()||B.get().onSearchChange(Y.target.value)},[J]);return Z1.useImperativeHandle(Q,()=>X.current),v1.jsx("input",{autoCapitalize:"off",autoComplete:"off",autoCorrect:"off",enterKeyHint:"done","frimousse-search":"",placeholder:"Search…",spellCheck:!1,type:"search",...H,defaultValue:Z,onChange:K,ref:z,value:$})}),fU0=Z1.memo(()=>{let $=Tr();return $?v1.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}),Sr=Z1.forwardRef(({children:$,onScroll:Z,onKeyDown:J,style:H,...Q},B)=>{let X=a4(),z=Z1.useRef(null),G=Z1.useCallback((F)=>{F&&(z.current=F,X.set({viewportRef:z}))},[]),U=X8(X,jr),K=X8(X,CU0),Y=Z1.useCallback((F)=>{Z?.(F),X.get().onViewportScroll(F.currentTarget.scrollTop)},[Z]);return z9(()=>{if(!z.current)return;let F=new ResizeObserver(([W])=>{let q=W?.borderBoxSize[0]?.inlineSize??0,N=W?.borderBoxSize[0]?.blockSize??0,{onViewportSizeChange:V,viewportHeight:A,viewportWidth:D}=X.get();(A!==N||D!==q)&&V(q,N)});return F.observe(z.current),X.get().onViewportSizeChange(z.current.offsetWidth,z.current.clientHeight),()=>{F.disconnect()}},[]),Z1.useImperativeHandle(B,()=>z.current),v1.jsxs("div",{"frimousse-viewport":"",...Q,onScroll:Y,ref:G,style:{position:"relative",boxSizing:"border-box",contain:"layout paint",containIntrinsicSize:typeof U=="number"&&typeof K=="number"?`var(--frimousse-viewport-width, auto) calc(${U} * var(--frimousse-row-height) + ${K} * var(--frimousse-category-header-height))`:void 0,overflowY:"auto",overscrollBehavior:"contain",scrollbarGutter:"stable",willChange:"scroll-position",...H},children:[v1.jsx(fU0,{}),$]})});function Rr($,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 Ir($,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 kr($,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 br($,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 Wr($,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 qr($,Z,J){return{"aria-colcount":$,"aria-rowcount":Z,"frimousse-list":"",style:{"--frimousse-list-columns":$,...J},role:"grid"}}function mU0($){$.preventDefault()}var uU0=Z1.memo(({Emoji:$,emoji:Z,columnIndex:J,rowIndex:H})=>{let Q=a4(),B=X8(Q,(U)=>W_(U)?.emoji===Z.emoji),X=Z1.useCallback(()=>{Q.get().onEmojiSelect(Z)},[Z]),z=Z1.useCallback(()=>{Q.get().onActiveEmojiChange("pointer",J,H)},[J,H]),G=Z1.useCallback(()=>{Q.get().onActiveEmojiReset()},[]);return v1.jsx($,{...Rr(Z,J,B),onClick:X,onPointerDown:mU0,onPointerEnter:z,onPointerLeave:G})}),pU0=Z1.memo(({Row:$,Emoji:Z,rowIndex:J})=>{let H=a4(),Q=X8(H,(B)=>B.data?.rows[J],SU0);return Q?v1.jsx($,{...Ir(J),children:Q.emojis.map((B,X)=>v1.jsx(uU0,{Emoji:Z,columnIndex:X,emoji:B,rowIndex:J},B.label))}):null}),cU0=Z1.memo(({CategoryHeader:$,categoryIndex:Z})=>{let J=a4(),H=X8(J,(B)=>B.data?.categories[Z],q_),Q=Q3(J,"sticky");return H?v1.jsx("div",{...kr(Z,H),children:v1.jsx($,{...br({label:H.label},!1,Q)})}):null}),Nr=Z1.memo(({CategoryHeader:$,Row:Z,Emoji:J})=>{let H=Z1.useRef(null),Q=a4(),B=Q3(Q,"columns"),X=Z1.useMemo(()=>Array(B).fill({emoji:"\uD83D\uDE42",label:""}),[B]),z=Z1.useMemo(()=>({label:"Category"}),[]),G=Z1.useRef(null),U=Z1.useRef(null);return z9(()=>{let K=H.current?.parentElement?.parentElement;if(!K||!G.current||!U.current)return;let Y=new ResizeObserver((q)=>{for(let N of q){let V=N.contentRect.height,{onRowHeightChange:A,onCategoryHeaderHeightChange:D,rowHeight:L,categoryHeaderHeight:j}=Q.get();N.target===G.current&&L!==V&&A(V),N.target===U.current&&j!==V&&D(V)}});Y.observe(K),Y.observe(G.current),Y.observe(U.current);let{onRowHeightChange:F,onCategoryHeaderHeightChange:W}=Q.get();return F(G.current.clientHeight),W(U.current.clientHeight),()=>{Y.disconnect()}},[]),v1.jsxs("div",{"aria-hidden":!0,ref:H,style:{height:0,visibility:"hidden"},children:[v1.jsx("div",{"frimousse-row-sizer":"",ref:G,children:v1.jsx(Z,{...Ir(-1,!0),children:X.map((K,Y)=>v1.jsx(J,{...Rr(K,Y,!1)},Y))})}),v1.jsx("div",{...kr(-1),children:v1.jsx("div",{"frimousse-category-header-sizer":"",ref:U,children:v1.jsx($,{...br(z,!0)})})})]})});function dU0({category:$,...Z}){return v1.jsx("div",{...Z,children:$.label})}function lU0({emoji:$,...Z}){return v1.jsx("button",{type:"button",...Z,children:$.emoji})}function iU0({...$}){return v1.jsx("div",{...$})}var yr=Z1.forwardRef(({style:$,components:Z,...J},H)=>{let Q=a4(),B=Z1.useRef(null),X=Z1.useCallback((A)=>{A&&(B.current=A,Q.set({listRef:B}))},[]),z=Z?.CategoryHeader??dU0,G=Z?.Emoji??lU0,U=Z?.Row??iU0,K=Q3(Q,"columns"),Y=Q3(Q,"viewportStartRowIndex"),F=Q3(Q,"viewportEndRowIndex"),W=X8(Q,jr),q=X8(Q,wU0,q_),N=Z1.useMemo(()=>q?.filter((A)=>A<Y).length??0,[q,Y]),V=q?.length??0;return Z1.useImperativeHandle(H,()=>B.current),!W||!q||V===0?v1.jsx("div",{...qr(K,0,$),...J,children:v1.jsx("div",{...Wr(0,0,0,0),children:v1.jsx(Nr,{CategoryHeader:z,Emoji:G,Row:U})})}):v1.jsx("div",{...qr(K,W,$),...J,ref:X,children:v1.jsxs("div",{...Wr(W,V,Y,N),children:[v1.jsx(Nr,{CategoryHeader:z,Emoji:G,Row:U}),Array.from({length:F-Y+1},(A,D)=>{let L=Y+D,j=q.indexOf(L);return v1.jsxs(Z1.Fragment,{children:[j>=0&&v1.jsx("div",{style:{height:"var(--frimousse-category-header-height)"}}),v1.jsx(pU0,{Emoji:G,Row:U,rowIndex:L})]},L)}),Array.from({length:V},(A,D)=>v1.jsx(cU0,{CategoryHeader:z,categoryIndex:D},D))]})})}),xr=Z1.forwardRef(({emoji:$,onClick:Z,"aria-label":J="Change skin tone",...H},Q)=>{let B=a4(),X=X8(B,EU0,q_),[z,G,U]=Cr($),K=Z1.useMemo(()=>Math.max(0,U.findIndex((V)=>V.skinTone===z)),[z,U]),Y=U[K],F=U[(K+1)%U.length].skinTone,W=z==="none"?void 0:X?.[z],q=F==="none"?void 0:X?.[F],N=Z1.useCallback((V)=>{Z?.(V),V.isDefaultPrevented()||G(F)},[Z,G,F]);return v1.jsx("button",{type:"button",...H,"aria-label":J+(q?` (${q})`:""),"aria-live":"polite","aria-valuetext":W,"frimousse-skin-tone-selector":"",onClick:N,ref:Q,children:Y.emoji})});function hr({children:$,...Z}){let J=a4();return X8(J,TU0)?v1.jsx("span",{"frimousse-loading":"",...Z,children:$}):null}function rU0({children:$}){let Z=a4(),J=X8(Z,jU0);return $({search:J})}function vr({children:$,...Z}){let J=a4();return X8(J,OU0)?v1.jsx("span",{"frimousse-empty":"",...Z,children:typeof $=="function"?v1.jsx(rU0,{children:$}):$}):null}function gr({children:$}){let Z=Tr();return $({emoji:Z})}function fr({children:$,emoji:Z}){let[J,H,Q]=Cr(Z);return $({skinTone:J,setSkinTone:H,skinToneVariations:Q})}wr.displayName="EmojiPicker.Root";Er.displayName="EmojiPicker.Search";Sr.displayName="EmojiPicker.Viewport";yr.displayName="EmojiPicker.List";hr.displayName="EmojiPicker.Loading";vr.displayName="EmojiPicker.Empty";xr.displayName="EmojiPicker.SkinToneSelector";gr.displayName="EmojiPicker.ActiveEmoji";fr.displayName="EmojiPicker.SkinTone";var MX={};C5(MX,{Root:()=>lr,Indicator:()=>ir});var G9=P(m(),1);function mr($){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 ur="data-checked",pr="data-unchecked";function Yq($){return{checked(Z){if($.indeterminate)return{};if(Z)return{[ur]:""};return{[pr]:""}},...C2}}var Fq=P(m(),1),oU0=Fq.createContext(void 0);function cr(){return Fq.useContext(oU0)}var Wq=P(m(),1),N_=Wq.createContext(void 0);function dr(){let $=Wq.useContext(N_);if($===void 0)throw Error(y0(14));return $}var LX=P(c(),1),nU0="data-parent",lr=G9.forwardRef(function(Z,J){let{checked:H,className:Q,defaultChecked:B=!1,"aria-labelledby":X,disabled:z=!1,form:G,id:U,indeterminate:K=!1,inputRef:Y,name:F,onCheckedChange:W,parent:q=!1,readOnly:N=!1,render:V,required:A=!1,uncheckedValue:D,value:L,nativeButton:j=!1,style:M,..._}=Z,{clearErrors:E}=Z4(),{disabled:C,name:R,setDirty:T,setFilled:I,setFocused:y,setTouched:S,state:O,validationMode:b,validityData:k,validation:h}=l5(),v=UJ(),{labelId:f,registerControlId:w,getDescriptionProps:i}=i5(),r=cr(),x=r?.allValues===void 0?void 0:r.parent,l=x!==void 0,s=C||v.disabled||r?.disabled||z,p=R??F,d=L??p,o=t0(),Z0=r?.registerControlId!==w,H0=E6({id:U||void 0,enabled:Z0}),G0=j?H0:o,X0={};if(l){if(q)X0=x.getParentProps();else if(d!==void 0)X0=x.getChildProps(d)}let{checked:Y0=H,indeterminate:V0=K,onCheckedChange:N0,...F0}=X0,n=r?.value,a=G9.useRef(null),{getButtonProps:e,buttonRef:$0}=T5({disabled:s,native:j}),Q0=r?.validation??h,[_0,M0]=J4({controlled:d!==void 0&&n!==void 0&&!q?n.includes(d):Y0,default:B,name:"Checkbox",state:"checked"}),A0=l?Boolean(Y0):_0,L0=l?V0||K:K;w6(a,o,_0,void 0,!r&&!s,F);let g=x?.registerChildId,u=G9.useRef(null),t=Q0.registerInput,W0=r?d:void 0,I0=G9.useCallback((v0)=>t(v0,{controlRef:a,value:W0}),[t,W0]),c0=x2(Y,u,q?void 0:I0),f0=uW(X,f,u,!j,H0);J0(()=>{if(u.current)u.current.indeterminate=L0;if(!r)I(_0)},[_0,L0,r,I]),h9(_0,()=>{if(r)return;E(p),T(_0!==k.initialValue),Q0.change(_0)});let T0=X2({checked:_0,disabled:s,form:G,name:q?void 0:p,id:j?void 0:H0,required:A,ref:c0,style:p?Cz:m8,tabIndex:-1,type:"checkbox","aria-hidden":!0,onChange(v0){if(v0.nativeEvent.defaultPrevented)return;if(N){v0.preventDefault();return}let E1=v0.currentTarget.checked,B1=R0(K0.none,v0.nativeEvent);if(W?.(E1,B1),B1.isCanceled)return;if(N0?.(E1,B1),B1.isCanceled)return;if(M0(E1),d!==void 0&&r!==void 0&&!q&&!l){let s1=E1?[...r.value,d]:r.value.filter((C0)=>C0!==d);r.setValue(s1,B1)}},onClick(v0){v0.stopPropagation()},onFocus(){a.current?.focus()}},L!==void 0?{value:(r?_0&&L:L)||""}:L1,i,(v0)=>Q0.getValidationProps(s,v0));G9.useEffect(()=>{if(!x||d===void 0)return;let v0=x.disabledStatesRef.current;return v0.set(d,s),()=>{v0.delete(d)}},[x,s,d]);let x0=G9.useMemo(()=>({...O,checked:A0,disabled:s,readOnly:N,required:A,indeterminate:L0}),[O,A0,s,N,A,L0]),J1=Yq(x0),W1=z0("span",Z,{state:x0,ref:[$0,a,J],props:[{id:G0,role:"checkbox","aria-checked":L0?"mixed":A0,"aria-readonly":N||void 0,"aria-required":A||void 0,"aria-labelledby":f0,[nU0]:q?"":void 0,onFocus(){if(!s)y(!0)},onBlur(){let v0=u.current;if(!v0)return;if(S(!0),y(!1),b==="onBlur")Q0.commit(r?n:v0.checked)},onKeyDown(v0){if(v0.key!=="Enter")return;if(v0.preventBaseUIHandler(),v0.defaultPrevented)return;let E1=u.current?.form??null,B1=v0.currentTarget,s1=v0.nativeEvent,C0=v0.preventDefault,p0=s1.preventDefault,i0=!1;v0.preventDefault=()=>{i0=!0,C0.call(v0)},s1.preventDefault=()=>{i0=!0,p0.call(s1)},p0.call(s1),R1(B1).queueMicrotask(()=>{if(v0.preventDefault=C0,s1.preventDefault=p0,!i0)mr(E1)?.click()})},onClick(v0){if(N||s)return;v0.preventDefault();let E1=u.current;if(!E1)return;gJ(E1,v0)}},_,F0,e,i,(v0)=>Q0.getValidationProps(s,v0)],stateAttributesMapping:J1}),d0=W1.props.id;return J0(()=>{if(!g||q||d===void 0||d0===void 0)return;return g(d,d0)},[g,q,d,d0]),LX.jsxs(N_.Provider,{value:x0,children:[W1,!_0&&!r&&p&&!q&&D!==void 0&&LX.jsx("input",{type:"hidden",form:G,name:p,value:D,disabled:s}),LX.jsx("input",{...T0,suppressHydrationWarning:!0})]})});var qq=P(m(),1);var ir=qq.forwardRef(function(Z,J){let{render:H,className:Q,style:B,keepMounted:X=!1,...z}=Z,G=dr(),U=G.checked||G.indeterminate,{mounted:K,transitionStatus:Y,setMounted:F}=j2(U),W=qq.useRef(null),q={...G,transitionStatus:Y};W5({batch:!0,enabled:!U,open:U,ref:W,onComplete(){if(!U)F(!1)}});let V={...Yq(G),...Q2},A=X||K,D=z0("span",Z,{ref:[J,W],state:q,stateAttributesMapping:V,props:z});if(!A)return null;return D});var Nq=P(c(),1);function rr({className:$,...Z}){return Nq.jsx(MX.Root,{"data-slot":"checkbox",className:a0('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:Nq.jsx(MX.Indicator,{"data-slot":"checkbox-indicator",className:"grid place-content-center text-current transition-none [&>svg]:size-3.5",children:Nq.jsx(j8,{stroke:2})})})}var ZZ={};C5(ZZ,{Tab:()=>sr,Root:()=>nr,Panel:()=>Ka,List:()=>Na,Indicator:()=>Ga});var H2=P(m(),1);var Aq=P(m(),1),A_=Aq.createContext(void 0);function A7(){let $=Aq.useContext(A_);if($===void 0)throw Error(y0(64));return $}var ar="data-activation-direction";var B3={tabActivationDirection:($)=>({[ar]:$})};var V_=P(c(),1),nr=H2.forwardRef(function(Z,J){let{className:H,defaultValue:Q=0,onValueChange:B,orientation:X="horizontal",render:z,value:G,style:U,...K}=Z,Y=Z.defaultValue!==void 0,F=H2.useRef([]),[W,q]=H2.useState(()=>new Map),[N,V]=J4({controlled:G,default:Q,name:"Tabs",state:"value"}),A=G!==void 0,[D,L]=H2.useState(()=>new Map),j=H2.useRef(void 0),M=H2.useCallback((o)=>D_(D,o),[D]),[_,E]=H2.useState(()=>({previousValue:N,tabActivationDirection:"none"})),{previousValue:C,tabActivationDirection:R}=_,T=R,I=!1;if(C!==N)T=or(C,N,X,D),I=C!=null&&N!=null&&M(N)==null;let y=I?C:N,S=C!==y||R!==T;J0(()=>{if(!S)return;E({previousValue:y,tabActivationDirection:T})},[y,S,T]);let O=U0((o,Z0)=>{let H0=or(N,o,X,D);if(Z0.activationDirection=H0,B?.(o,Z0),Z0.isCanceled)return;V(o)}),b=U0((o,Z0)=>{B?.(o,R0(Z0,void 0,void 0,{activationDirection:"none"}))}),k=U0((o,Z0)=>{return q((H0)=>{let G0=new Map(H0);return G0.set(o,Z0),G0}),()=>{q((H0)=>{if(H0.get(o)!==Z0)return H0;let G0=new Map(H0);return G0.delete(o),G0})}}),h=H2.useCallback((o)=>{return W.get(o)},[W]),v=H2.useCallback((o)=>{for(let Z0 of D.values())if(o===Z0.value)return Z0.id;return},[D]),f=H2.useMemo(()=>({getTabElementBySelectedValue:M,getTabIdByPanelValue:v,getTabPanelIdByValue:h,onValueChange:O,orientation:X,registerMountedTabPanel:k,setTabMap:L,tabActivationDirection:T,value:N}),[M,v,h,O,X,k,L,T,N]),w=H2.useMemo(()=>{for(let o of D.values())if(o.value===N)return o;return},[D,N]),i=H2.useMemo(()=>{for(let o of D.values())if(!o.disabled)return o.value;return},[D]),r=H2.useRef(!Y),x=H2.useRef(Q),l=H2.useRef(Y),s=H2.useRef(!1);J0(()=>{if(A)return;function o(X0,Y0){V(X0),E({previousValue:X0,tabActivationDirection:"none"}),b(X0,Y0),r.current=!1}if(D.size===0){if(s.current&&N!==null&&!j.current?.isConnected)o(null,K0.missing);return}s.current=!0,j.current=D.keys().next().value;let Z0=w?.disabled,H0=w==null&&N!==null;if(!Z0&&N===x.current)l.current=!1;if(l.current&&Z0&&N===x.current)return;let G0=r.current;if(Z0||H0){let X0=i??null;if(N===X0){r.current=!1;return}let Y0=K0.missing;if(G0)Y0=K0.initial;else if(Z0)Y0=K0.disabled;o(X0,Y0);return}if(G0&&w!=null)b(N,K0.initial),r.current=!1},[i,A,b,w,V,D,N]);let d=z0("div",Z,{state:{orientation:X,tabActivationDirection:T},ref:J,props:K,stateAttributesMapping:B3});return V_.jsx(A_.Provider,{value:f,children:V_.jsx(e6,{elementsRef:F,children:d})})});function D_($,Z){for(let[J,H]of $.entries())if(Z===H.value)return J;return null}function or($,Z,J,H){if($==null||Z==null)return"none";let[Q,B,X]=J==="horizontal"?["left","left","right"]:["top","up","down"],z=D_(H,$),G=D_(H,Z);if(z==null||G==null){if(z!==G&&(typeof $==="number"||typeof $==="string")&&typeof $===typeof Z)return Z>$?X:B;return"none"}let U=z.getBoundingClientRect()[Q],K=G.getBoundingClientRect()[Q];if(K<U)return B;if(K>U)return X;return"none"}var f3=P(m(),1);var PX="data-composite-item-active";var Vq=P(m(),1),L_=Vq.createContext(void 0);function Dq(){let $=Vq.useContext(L_);if($===void 0)throw Error(y0(65));return $}var sr=f3.forwardRef(function(Z,J){let{className:H,disabled:Q=!1,render:B,value:X,id:z,nativeButton:G=!0,style:U,...K}=Z,{value:Y,getTabPanelIdByValue:F,onValueChange:W,orientation:q,tabActivationDirection:N}=A7(),{activateOnFocus:V,registerTabResizeObserverElement:A,tabsListElement:D}=Dq(),{highlightedIndex:L,onHighlightedIndexChange:j}=uJ(),M=t0(z),_=f3.useMemo(()=>({disabled:Q,id:M,value:X}),[Q,M,X]),{compositeProps:E,compositeRef:C,index:R}=BF({metadata:_}),T=X===Y,I=f3.useRef(!1),y=f3.useRef(null),S=U0((s)=>{y.current?.(),y.current=s?A(s):null});J0(()=>{if(I.current){I.current=!1;return}if(!(T&&R>-1&&L!==R))return;let s=D;if(s!=null){let p=p1(m0(s));if(p&&k0(s,p))return}if(!Q)j(R)},[T,R,L,j,Q,D]);let{getButtonProps:O,buttonRef:b}=T5({disabled:Q,native:G,focusableWhenDisabled:!0}),k=F(X),h=f3.useRef(!1),v=f3.useRef(!1);function f(s){W(X,R0(K0.none,s.nativeEvent,void 0,{activationDirection:"none"}))}function w(s){if(T||Q)return;f(s)}function i(s){if(T||Q)return;if(V&&(!h.current||v.current))f(s)}function r(s){if(T||Q)return;h.current=!0,v.current=s.button===0;let p=m0(s.currentTarget);function d(){h.current=!1,v.current=!1,p.removeEventListener("pointerup",d),p.removeEventListener("pointercancel",d)}p.addEventListener("pointerup",d),p.addEventListener("pointercancel",d)}return z0("button",Z,{state:{disabled:Q,active:T,orientation:q,tabActivationDirection:N},ref:[J,b,C,S],props:[E,{role:"tab","aria-controls":k,"aria-selected":T,id:M,onClick:w,onFocus:i,onPointerDown:r,[PX]:T?"":void 0,onKeyDownCapture(){I.current=!0}},K,O],stateAttributesMapping:B3})});var _H=P(m(),1);var tr="--active-tab-left",er="--active-tab-right",$a="--active-tab-top",Za="--active-tab-bottom",Ja="--active-tab-width",Ha="--active-tab-height";var Lq=P(c(),1),Qa,eU0={...B3,activeTabPosition:()=>null,activeTabSize:()=>null},Ba=2,Ga=_H.forwardRef(function(Z,J){let{className:H,render:Q,renderBeforeHydration:B=!1,style:X,...z}=Z,{getTabElementBySelectedValue:G,orientation:U,tabActivationDirection:K,value:Y}=A7(),{tabsListElement:F,registerIndicatorUpdateListener:W}=Dq(),q=bO();_H.useEffect(()=>{return W(q)},[W,q]);let N=0,V=0,A=0,D=0,L=0,j=0,M=!1;if(Y!=null&&F!=null){let y=G(Y);if(y!=null){M=!0;let{width:S,height:O}=bZ(y),{width:b,height:k}=bZ(F),h=y.getBoundingClientRect(),v=F.getBoundingClientRect(),f=b>0?v.width/b:1,w=k>0?v.height/k:1,i=$K0(y,F);N=i.left,A=i.top;let r=(h.left-v.left)/f+F.scrollLeft-F.clientLeft,x=(h.top-v.top)/w+F.scrollTop-F.clientTop,l=ZK0(y);if(Math.abs(r-l.x-N)<=Ba&&Math.abs(x-l.y-A)<=Ba)N=r,A=x;L=S,j=O,V=F.scrollWidth-N-L,D=F.scrollHeight-A-j}}let _=M?{left:N,right:V,top:A,bottom:D}:null,E=M?{width:L,height:j}:null,C=M?{[tr]:`${N}px`,[er]:`${V}px`,[$a]:`${A}px`,[Za]:`${D}px`,[Ja]:`${L}px`,[Ha]:`${j}px`}:void 0,R=M&&L>0&&j>0,I=z0("span",Z,{state:{orientation:U,activeTabPosition:_,activeTabSize:E,tabActivationDirection:K},ref:J,props:[{role:"presentation",style:C,hidden:!R},z,{suppressHydrationWarning:!0}],stateAttributesMapping:eU0});if(Y==null)return null;return Lq.jsxs(_H.Fragment,{children:[I,B&&(Qa||(Qa=Lq.jsx(DF,{script:AF})))]})});function $K0($,Z){let J=Xa($),H=Xa(Z),Q=J.left-H.left-Z.clientLeft,B=J.top-H.top-Z.clientTop,X=M8($);while(P1(X)&&X!==Z&&!L8(X))Q-=X.scrollLeft,B-=X.scrollTop,X=M8(X);return{left:Q,top:B}}function Xa($){let Z=0,J=0,H=$;while(H!=null){Z+=H.offsetLeft,J+=H.offsetTop;let Q=H.offsetParent;if(Q!=null)Z+=Q.clientLeft,J+=Q.clientTop;H=Q}return{left:Z,top:J}}function ZK0($){let Z=R1($).getComputedStyle($),{x:J,y:H}=Iz($,Z),Q=J,B=H,{translate:X}=Z;if(X&&X!=="none"){let z=X.split(" ");Q+=za(z[0],$.offsetWidth),B+=za(z[1],$.offsetHeight)}return{x:Q,y:B}}function za($,Z){if(!$)return 0;let J=parseFloat($);if(!Number.isFinite(J))return 0;return $.endsWith("%")?J/100*Z:J}var Mq=P(m(),1);var Ua="data-index";var Qj1=n4.startingStyle,Bj1=n4.endingStyle;var HK0={...B3,...Q2},Ka=Mq.forwardRef(function(Z,J){let{className:H,value:Q,render:B,keepMounted:X=!1,style:z,...G}=Z,{value:U,getTabIdByPanelValue:K,orientation:Y,tabActivationDirection:F,registerMountedTabPanel:W}=A7(),q=t0(),{ref:N,index:V}=X4(),A=Q===U,{mounted:D,transitionStatus:L,setMounted:j}=j2(A),M=!D,_=K(Q),E={hidden:M,orientation:Y,tabActivationDirection:F,transitionStatus:L},C=Mq.useRef(null),R=z0("div",Z,{state:E,ref:[J,N,C],props:[{"aria-labelledby":_,hidden:M,id:q,role:"tabpanel",tabIndex:A?0:-1,inert:D8(!A),[Ua]:V},G],stateAttributesMapping:HK0});if(W5({open:A,ref:C,onComplete(){if(!A)j(!1)}}),J0(()=>{if(q==null||M&&!X)return;return W(Q,q)},[M,X,Q,q,W]),!(X||D))return null;return R});var U9=P(m(),1);var Wa=P(m(),1);var $Z=P(m(),1);function Ya($){let{loopFocus:Z=!0,orientation:J="both",grid:H,onLoop:Q,direction:B,highlightedIndex:X,onHighlightedIndexChange:z,rootRef:G,enableHomeAndEndKeys:U=!1,stopEventPropagation:K,disabledIndices:Y,modifierKeys:F=r2}=$,[W,q]=$Z.useState(0),N=H!=null,V=$Z.useRef(null),A=x2(V,G),D=$Z.useRef([]),L=$Z.useRef(!1),j=$Z.useRef(null),M=X??W,_=U0((I,y=!1)=>{if(j.current=D.current[I]??null,(z??q)(I),y){let S=D.current[I];UV(V.current,S,B,J)}}),E=U0((I)=>{if(I.size===0)return;if(L.current){let b=D.current,k=b.indexOf(j.current);if(k===-1){let h=b[M];if(!h||W3(b,M,Y))_(QK0(b,Y));else j.current=h}else if(k!==M)_(k);return}L.current=!0;let y=Array.from(I.keys()),S=y.find((b)=>b?.hasAttribute(PX))??null,O=S?I.get(S)?.index??-1:-1;if(O!==-1)_(O);else if(W3(y,M,Y)){let b=A8(y,{disabledIndices:Y});if(!$6(y,b))_(b)}UV(V.current,S,B,J)});J0(()=>{if(Y==null||X!=null||!L.current)return;let I=D.current;if(W3(I,M,Y)){let y=A8(I,{disabledIndices:Y});if(!$6(I,y))_(y)}},[Y,X,M,D,_]);let C=U0((I,y,S)=>{if(!Q)return S;return Q(I,y,S,D)}),R=U0((I)=>{let y=I.key===iZ||I.key===rZ;if(!n8.has(I.key)||!U&&y)return;if(BK0(I,F))return;if(!V.current)return;let O=B==="rtl",b=O?dZ:lZ,k=O?lZ:dZ,h=J==="vertical"?cZ:b,v=J==="vertical"?pZ:k,f=M1(I.nativeEvent);if(f!=null&&GV(f)&&!gg(f)){let{selectionStart:s,selectionEnd:p,value:d}=f;if(s==null||I.shiftKey||s!==p)return;if(I.key!==v&&s<d.length)return;if(I.key!==h&&s>0)return}let w=M,i=p7(D,Y),r=MZ(D,Y);if(H!=null)w=H({disabledIndices:Y,elementsRef:D,event:I,highlightedIndex:M,loopFocus:Z,maxIndex:r,minIndex:i,onLoop:C,orientation:J,rtl:O});let x=J!=="vertical"&&I.key===b||J!=="horizontal"&&I.key===cZ,l=J!=="vertical"&&I.key===k||J!=="horizontal"&&I.key===pZ;if(U){if(I.key===iZ)w=i;else if(I.key===rZ)w=r}if(w===M&&(x||l))if(Z&&w===r&&x){if(w=i,Q)w=Q(I,M,w,D)}else if(Z&&w===i&&l){if(w=r,Q)w=Q(I,M,w,D)}else w=A8(D.current,{startingIndex:w,decrement:l,disabledIndices:Y});if(w!==M&&!$6(D.current,w)){if(K)I.stopPropagation();if(N||y||x||l)I.preventDefault();_(w,!0),queueMicrotask(()=>{D.current[w]?.focus()})}});return{props:{ref:A,onFocus(I){let y=V.current,S=M1(I.nativeEvent);if(!y||S==null||!GV(S))return;S.setSelectionRange(0,S.value.length)},onKeyDown:R},highlightedIndex:M,onHighlightedIndexChange:_,elementsRef:D,onMapChange:E,relayKeyboardEvent:R}}function QK0($,Z){let J=-1;for(let H=0;H<$.length;H+=1){let Q=$[H];if(!Q||W3($,H,Z))continue;if(Q.hasAttribute(PX))return H;if(J===-1)J=H}return Math.max(J,0)}function BK0($,Z){for(let J of eE){if(Z.includes(J))continue;if($.getModifierState(J))return!0}return!1}var M_=P(c(),1);function qa($){let{render:Z,className:J,style:H,refs:Q=r2,props:B=r2,state:X=L1,stateAttributesMapping:z,highlightedIndex:G,onHighlightedIndexChange:U,orientation:K,grid:Y,loopFocus:F,onLoop:W,enableHomeAndEndKeys:q,onMapChange:N,stopEventPropagation:V=!0,rootRef:A,disabledIndices:D,modifierKeys:L,highlightItemOnHover:j=!1,tag:M="div",..._}=$,E=g4(),{props:C,highlightedIndex:R,onHighlightedIndexChange:T,elementsRef:I,onMapChange:y,relayKeyboardEvent:S}=Ya({grid:Y,loopFocus:F,onLoop:W,orientation:K,highlightedIndex:G,onHighlightedIndexChange:U,rootRef:A,stopEventPropagation:V,enableHomeAndEndKeys:q,direction:E,disabledIndices:D,modifierKeys:L}),O=z0(M,$,{state:X,ref:Q,props:[C,...B,_],stateAttributesMapping:z}),b=Wa.useMemo(()=>({highlightedIndex:R,onHighlightedIndexChange:T,highlightItemOnHover:j,relayKeyboardEvent:S}),[R,T,j,S]);return M_.jsx(Fa.Provider,{value:b,children:M_.jsx(e6,{elementsRef:I,onMapChange:(k)=>{N?.(k),y(k)},children:O})})}var P_=P(c(),1),Na=U9.forwardRef(function(Z,J){let{activateOnFocus:H=!1,className:Q,loopFocus:B=!0,render:X,style:z,...G}=Z,{orientation:U,setTabMap:K,tabActivationDirection:Y}=A7(),[F,W]=U9.useState(0),[q,N]=U9.useState(null),V=U9.useRef(new Set),A=U9.useRef(new Set),D=U9.useRef(null);J0(()=>{if(typeof ResizeObserver>"u")return;let C=new ResizeObserver(()=>{V.current.forEach((R)=>{R()})});if(D.current=C,q)C.observe(q);return A.current.forEach((R)=>{C.observe(R)}),()=>{C.disconnect(),D.current=null}},[q]);let L=U0((C)=>{return V.current.add(C),()=>{V.current.delete(C)}}),j=U0((C)=>{return A.current.add(C),D.current?.observe(C),()=>{A.current.delete(C),D.current?.unobserve(C)}}),M={orientation:U,tabActivationDirection:Y},_={"aria-orientation":U==="vertical"?"vertical":void 0,role:"tablist"},E=U9.useMemo(()=>({activateOnFocus:H,registerIndicatorUpdateListener:L,registerTabResizeObserverElement:j,tabsListElement:q}),[H,L,j,q]);return P_.jsx(L_.Provider,{value:E,children:P_.jsx(qa,{render:X,className:Q,style:z,state:M,refs:[J,N],props:[_,G],stateAttributesMapping:B3,highlightedIndex:F,enableHomeAndEndKeys:!0,loopFocus:B,orientation:U,onHighlightedIndexChange:W,onMapChange:K,disabledIndices:r2})})});var _X=P(c(),1);function Aa({className:$,orientation:Z="horizontal",...J}){return _X.jsx(ZZ.Root,{"data-slot":"tabs","data-orientation":Z,orientation:Z,className:a0("group/tabs flex gap-2 data-horizontal:flex-col",$),...J})}var XK0=JJ("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 Va({className:$,variant:Z="default",...J}){return _X.jsx(ZZ.List,{"data-slot":"tabs-list","data-variant":Z,className:a0(XK0({variant:Z}),$),...J})}function Pq({className:$,...Z}){return _X.jsx(ZZ.Tab,{"data-slot":"tabs-trigger",className:a0("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 _q({className:$,...Z}){return _X.jsx(ZZ.Panel,{"data-slot":"tabs-content",className:a0("flex-1 text-sm outline-none",$),...Z})}var Da=["\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","☕"],__="font-[Apple_Color_Emoji,Segoe_UI_Emoji,Noto_Color_Emoji,sans-serif]";var A1=P(c(),1),zK0=32,La=4,GK0=12,Ta="flex pt-4 pb-2 items-center bg-background px-3 text-xs font-medium text-muted-foreground",Ca=E4.createContext(null);function Ma($,Z){if(Z)return{...$,background:"theme"};if($.type==="emoji")return{type:"emoji",value:$.value};return{type:"glyph",value:$.value}}function UK0({category:$,className:Z,...J}){return A1.jsx("div",{...J,className:B0(Ta,Z),children:$.label})}function Pa({className:$,...Z}){return A1.jsx("div",{className:B0("flex flex-wrap content-start gap-1",$),...Z})}function j_({className:$,selected:Z=!1,...J}){return A1.jsx(j0,{type:"button",variant:"ghost",size:"icon","aria-pressed":Z,className:B0("shrink-0 data-active:bg-accent",Z&&"bg-accent",$),...J})}function KK0({children:$,className:Z,...J}){return A1.jsx("div",{...J,className:B0("flex h-8 gap-1 px-1.5",Z),children:$})}function YK0({emoji:$,...Z}){let J=E4.useContext(Ca);return A1.jsx(j_,{selected:J===$.emoji,className:__,...Z,children:A1.jsx("span",{className:"text-xl leading-none",children:$.emoji})})}function wa(){let{layout:$,workspaceId:Z}=i1(),{icon:J}=$,H=wi(Z),[Q,B]=E4.useState(J?.type??"glyph"),[X,z]=E4.useState(!J||J.type!=="upload"&&J.background==="theme"),G=J?.type==="upload"?void 0:J,[U,K]=E4.useState(""),[Y,F]=E4.useState(13),[W,q]=E4.useState(null),[N,V]=E4.useState(!1),A=E4.useRef(null),D=(M)=>{let _=Ma(M,X);H.mutate({kind:"set",icon:_})},L=(M)=>{H.mutate({kind:"upload",file:M})},j=(M)=>{if(z(M),G){let _=Ma(G,M);H.mutate({kind:"set",icon:_})}};return E4.useEffect(()=>{if(!W)return;let M=(E)=>{let C=Math.max(1,Math.floor((E-GK0+La)/(zK0+La)));F((R)=>R===C?R:C)};M(W.clientWidth);let _=new ResizeObserver(([E])=>{M(E?.contentRect.width??W.clientWidth)});return _.observe(W),()=>_.disconnect()},[W]),A1.jsxs(Aa,{value:Q,onValueChange:(M)=>B(M),className:"min-w-0 gap-4",children:[A1.jsxs("div",{className:"flex items-center justify-between gap-4",children:[A1.jsxs(Va,{"aria-label":"Icon source",children:[A1.jsx(Pq,{value:"glyph",children:"Icon"}),A1.jsx(Pq,{value:"emoji",children:"Emoji"}),A1.jsx(Pq,{value:"upload",children:"Upload"})]}),J&&A1.jsxs(j0,{type:"button",variant:"ghost",onClick:()=>{z(!0),H.mutate({kind:"reset"})},className:"text-muted-foreground",children:[A1.jsx(_a,{"data-icon":"inline-start",stroke:1.5}),"Reset"]})]}),A1.jsx(_q,{value:"emoji",className:"flex-none",children:A1.jsx(Ca,{value:G?.type==="emoji"?G.value:null,children:A1.jsxs(g3.Root,{onEmojiSelect:(M)=>D({type:"emoji",value:M.emoji}),emojibaseUrl:"/vendor/emojibase",columns:Y,className:"isolate flex h-72 flex-col overflow-hidden rounded-xl border border-border bg-background",children:[A1.jsxs("div",{className:"flex items-center gap-1.5 p-1.5 pb-0",children:[A1.jsx(g3.Search,{placeholder:"Search emoji",onChange:(M)=>K(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"}),A1.jsx(g3.SkinToneSelector,{className:"size-8 shrink-0 rounded-lg text-lg hover:bg-accent"})]}),A1.jsxs(g3.Viewport,{ref:q,className:"relative scrollbar-thin flex-1 overflow-y-auto outline-none",children:[A1.jsxs(g3.Loading,{className:"absolute inset-0 flex items-center justify-center gap-2 text-xs text-muted-foreground",children:[A1.jsx(b5,{size:16,stroke:1.75,className:"animate-spin"}),"Loading emoji…"]}),U.trim()===""&&A1.jsxs("div",{className:"border-b border-dashed border-border",children:[A1.jsx("p",{className:B0("sticky top-0",Ta),children:"Favorites"}),A1.jsx(Pa,{className:"px-1.5 pb-1.5",children:Da.map((M)=>A1.jsx(j_,{onClick:()=>D({type:"emoji",value:M}),selected:G?.type==="emoji"&&G.value===M,className:__,children:A1.jsx("span",{className:"text-xl leading-none",children:M})},M))})]}),A1.jsxs(g3.Empty,{className:"absolute inset-0 flex flex-col items-center justify-center gap-1 text-xs text-muted-foreground",children:[A1.jsx(ja,{size:20,stroke:1.5}),"No emoji found"]}),A1.jsx(g3.List,{className:"select-none",components:{CategoryHeader:UK0,Row:KK0,Emoji:YK0}})]})]})})}),A1.jsx(_q,{value:"glyph",className:"scrollbar-thin h-72 overflow-y-auto rounded-xl border border-border bg-background p-1.5",children:A1.jsx(Pa,{children:bk.map(({id:M,Icon:_})=>A1.jsx(j_,{"aria-label":M,onClick:()=>D({type:"glyph",value:M}),selected:G?.type==="glyph"&&G.value===M,className:"text-muted-foreground aria-pressed:text-accent-foreground",children:A1.jsx(_,{stroke:1.75})},M))})}),A1.jsx(_q,{value:"upload",className:"flex-none",children:A1.jsxs("button",{type:"button",onClick:()=>A.current?.click(),onDragOver:(M)=>{M.preventDefault(),V(!0)},onDragLeave:()=>V(!1),onDrop:(M)=>{M.preventDefault(),V(!1);let _=M.dataTransfer.files?.[0];if(_)L(_)},className:B0("flex h-72 w-full flex-col items-center justify-center gap-2 rounded-xl border border-dashed transition-colors",N?"border-primary bg-primary/5 text-primary":"border-border text-muted-foreground hover:border-muted-foreground/30 hover:text-foreground"),children:[A1.jsx(Oa,{size:24,stroke:1.5}),A1.jsx("span",{className:"text-xs font-medium",children:"Click or drop an image"}),A1.jsx("span",{className:"text-[11px] text-muted-foreground/70",children:"PNG, JPG, GIF, or WebP"})]})}),Q!=="upload"&&A1.jsxs("label",{htmlFor:"workspace-icon-theme-background",className:"flex w-fit cursor-pointer items-center gap-2 text-sm font-medium",children:[A1.jsx(rr,{id:"workspace-icon-theme-background",checked:X,onCheckedChange:j}),"Use theme background"]}),H.error&&A1.jsx("p",{className:"text-xs text-destructive","aria-live":"polite",children:H.error.message}),A1.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 X3=P(c(),1);function Ea(){let{layout:$,name:Z,provider:J,workspaceId:H}=i1(),Q=Z??"Workspace",B=Ci(H),[X,z]=jq.useState(Q);jq.useEffect(()=>z(Q),[Q]);function G(U){let K=U.trim();if(z(K),K!==Q)B.mutate(K===""?null:K)}return X3.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-4",children:[X3.jsxs(q6,{children:[X3.jsx(N6,{render:X3.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:X3.jsx(u6,{icon:$.icon,workspaceType:J,workspaceTheme:$.theme,className:"size-full rounded-lg"})})}),X3.jsx(A6,{align:"start",sideOffset:8,className:"w-[min(32rem,calc(100vw-2rem))] gap-4 rounded-2xl p-6",children:X3.jsx(wa,{})})]}),X3.jsx($q,{"aria-label":"Workspace name",value:X,onValueChange:z,onValueCommit:G,className:"min-w-0 truncate text-3xl font-semibold md:text-3xl"})]})}var hX=P(m(),1);function D7($){let{margin:Z,containerPadding:J,containerWidth:H,cols:Q}=$;return(H-Z[0]*(Q-1)-J[0]*2)/Q}function K9($,Z,J){if(!Number.isFinite($))return $;return Math.round(Z*$+Math.max(0,$-1)*J)}function OX($,Z,J,H,Q,B,X){let{margin:z,containerPadding:G,rowHeight:U}=$,K=D7($),Y,F,W,q;if(X)Y=Math.round(X.width),F=Math.round(X.height);else Y=K9(H,K,z[0]),F=K9(Q,U,z[1]);if(B)W=Math.round(B.top),q=Math.round(B.left);else if(X)W=Math.round(X.top),q=Math.round(X.left);else W=Math.round((U+z[1])*J+G[1]),q=Math.round((K+z[0])*Z+G[0]);if(!B&&!X){if(Number.isFinite(H)){let V=Math.round((K+z[0])*(Z+H)+G[0])-q-Y;if(V!==z[0])Y+=V-z[0]}if(Number.isFinite(Q)){let V=Math.round((U+z[1])*(J+Q)+G[1])-W-F;if(V!==z[1])F+=V-z[1]}}return{top:W,left:q,width:Y,height:F}}function Ra($,Z,J,H,Q){let{margin:B,containerPadding:X,cols:z,rowHeight:G,maxRows:U}=$,K=D7($),Y=Math.round((J-X[0])/(K+B[0])),F=Math.round((Z-X[1])/(G+B[1]));return Y=jX(Y,0,z-H),F=jX(F,0,U-Q),{x:Y,y:F}}function TX($,Z,J){let{margin:H,containerPadding:Q,rowHeight:B}=$,X=D7($),z=Math.round((J-Q[0])/(X+H[0])),G=Math.round((Z-Q[1])/(B+H[1]));return{x:z,y:G}}function Ia($,Z,J){let{margin:H,rowHeight:Q}=$,B=D7($),X=Math.max(1,Math.round((Z+H[0])/(B+H[0]))),z=Math.max(1,Math.round((J+H[1])/(Q+H[1])));return{w:X,h:z}}function jX($,Z,J){return Math.max(Math.min($,J),Z)}function Tq($,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 L7($,Z){for(let J=0;J<$.length;J++){let H=$[J];if(H!==void 0&&Tq(H,Z))return H}return}function O_($,Z){return $.filter((J)=>Tq(J,Z))}function FK0($,Z){if(Z==="horizontal")return T_($);if(Z==="vertical")return Oq($);if(Z==="wrap")return Oq($);return[...$]}function Oq($){return[...$].sort((Z,J)=>{if(Z.y!==J.y)return Z.y-J.y;return Z.x-J.x})}function T_($){return[...$].sort((Z,J)=>{if(Z.x!==J.x)return Z.x-J.x;return Z.y-J.y})}function CX($){let Z=0;for(let J=0;J<$.length;J++){let H=$[J];if(H!==void 0){let Q=H.y+H.h;if(Q>Z)Z=Q}}return Z}function M7($,Z){for(let J=0;J<$.length;J++){let H=$[J];if(H!==void 0&&H.i===Z)return H}return}function wX($){return $.filter((Z)=>Z.static===!0)}function m3($){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 jH($){let Z=Array($.length);for(let J=0;J<$.length;J++){let H=$[J];if(H!==void 0)Z[J]=m3(H)}return Z}function WK0($,Z){let J=Array($.length);for(let H=0;H<$.length;H++){let Q=$[H];if(Q!==void 0)if(Z.i===Q.i)J[H]=Z;else J[H]=Q}return J}function ka($,Z,J){let H=M7($,Z);if(!H)return[[...$],null];return H=J(m3(H)),[WK0($,H),H]}function C_($,Z){let J=wX($);for(let H=0;H<$.length;H++){let Q=$[H];if(Q===void 0)continue;if(Q.x+Q.w>Z.cols)Q.x=Z.cols-Q.w;if(Q.x<0)Q.x=0,Q.w=Z.cols;if(!Q.static)J.push(Q);else while(L7(J,Q))Q.y++}return $}function V7($,Z,J,H,Q,B,X,z,G){if(Z.static&&Z.isDraggable!==!0)return[...$];if(Z.y===H&&Z.x===J)return[...$];let{x:U,y:K}=Z;if(typeof J==="number")Z.x=J;if(typeof H==="number")Z.y=H;Z.moved=!0;let Y=FK0($,X);if(X==="vertical"&&typeof H==="number"?K>=H:X==="horizontal"&&typeof J==="number"?U>=J:!1)Y=Y.reverse();let W=O_(Y,Z),q=W.length>0;if(q&&G)return jH($);if(q&&B)return Z.x=U,Z.y=K,Z.moved=!1,$;let N=[...$];for(let V=0;V<W.length;V++){let A=W[V];if(A===void 0)continue;if(A.moved)continue;if(A.static)N=Sa(N,A,Z,Q,X);else N=Sa(N,Z,A,Q,X)}return N}function Sa($,Z,J,H,Q,B){let X=Q==="horizontal",z=Q==="vertical",G=Z.static;if(H){H=!1;let Y={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"},F=L7($,Y),W=F!==void 0&&F.y+F.h>Z.y,q=F!==void 0&&Z.x+Z.w>F.x;if(!F)return V7($,J,X?Y.x:void 0,z?Y.y:void 0,H,G,Q);if(W&&z)return V7($,J,void 0,J.y+1,H,G,Q);if(W&&Q===null)return Z.y=J.y,J.y=J.y+J.h,[...$];if(q&&X)return V7($,Z,J.x,void 0,H,G,Q)}let U=X?J.x+1:void 0,K=z?J.y+1:void 0;if(U===void 0&&K===void 0)return[...$];return V7($,J,U,K,H,G,Q)}function OH($,Z,J){return Math.max(Z,Math.min(J,$))}var qK0={name:"gridBounds",constrainPosition($,Z,J,{cols:H,maxRows:Q}){return{x:OH(Z,0,Math.max(0,H-$.w)),y:OH(J,0,Math.max(0,Q-$.h))}},constrainSize($,Z,J,H,{cols:Q,maxRows:B}){let X=H==="w"||H==="nw"||H==="sw"?$.x+$.w:Q-$.x,z=H==="n"||H==="nw"||H==="ne"?$.y+$.h:B-$.y;return{w:OH(Z,1,Math.max(1,X)),h:OH(J,1,Math.max(1,z))}}},NK0={name:"minMaxSize",constrainSize($,Z,J){return{w:OH(Z,$.minW??1,$.maxW??1/0),h:OH(J,$.minH??1,$.maxH??1/0)}}};var w_=[qK0,NK0];function EX($,Z,J,H,Q){let B={x:J,y:H};for(let X of $)if(X.constrainPosition)B=X.constrainPosition(Z,B.x,B.y,Q);if(Z.constraints){for(let X of Z.constraints)if(X.constrainPosition)B=X.constrainPosition(Z,B.x,B.y,Q)}return B}function ba($,Z,J,H,Q,B){let X={w:J,h:H};for(let z of $)if(z.constrainSize)X=z.constrainSize(Z,X.w,X.h,Q,B);if(Z.constraints){for(let z of Z.constraints)if(z.constrainSize)X=z.constrainSize(Z,X.w,X.h,Q,B)}return X}function wq({top:$,left:Z,width:J,height:H}){let Q=`translate(${Z}px,${$}px)`;return{transform:Q,WebkitTransform:Q,MozTransform:Q,msTransform:Q,OTransform:Q,width:`${J}px`,height:`${H}px`,position:"absolute"}}function E_({top:$,left:Z,width:J,height:H}){return{top:`${$}px`,left:`${Z}px`,width:`${J}px`,height:`${H}px`,position:"absolute"}}function S_($){return $*100+"%"}function AK0($,Z,J,H){return $+J>H?Z:J}function ya($,Z,J){return $<0?Z:J}function VK0($){return Math.max(0,$)}function Cq($){return Math.max(0,$)}var R_=($,Z,J)=>{let{left:H,height:Q,width:B}=Z,X=$.top-(Q-$.height);return{left:H,width:B,height:ya(X,$.height,Q),top:Cq(X)}},I_=($,Z,J)=>{let{top:H,left:Q,height:B,width:X}=Z;return{top:H,height:B,width:AK0($.left,$.width,X,J),left:VK0(Q)}},k_=($,Z,J)=>{let{top:H,height:Q,width:B}=Z,X=$.left+$.width-B;if(X<0)return{height:Q,width:$.left+$.width,top:Cq(H),left:0};return{height:Q,width:B,top:Cq(H),left:X}},b_=($,Z,J)=>{let{top:H,left:Q,height:B,width:X}=Z;return{width:X,left:Q,height:ya(H,$.height,B),top:Cq(H)}},DK0=($,Z,J)=>R_($,I_($,Z,J)),LK0=($,Z,J)=>R_($,k_($,Z)),MK0=($,Z,J)=>b_($,I_($,Z,J)),PK0=($,Z,J)=>b_($,k_($,Z)),_K0={n:R_,ne:DK0,e:I_,se:MK0,s:b_,sw:PK0,w:k_,nw:LK0};function xa($,Z,J,H){let Q=_K0[$];if(!Q)return J;return Q(Z,{...Z,...J},H)}var jK0={type:"transform",scale:1,calcStyle($){return wq($)}};var ha=jK0,va={cols:12,rowHeight:150,margin:[10,10],containerPadding:null,maxRows:1/0},ga={enabled:!0,bounded:!1,threshold:3},fa={enabled:!0,handles:["se"]},ma={enabled:!1,defaultItem:{w:1,h:1}};function y_($,Z,J,H,Q){let B=H==="x"?"w":"h";Z[H]+=1;let X=$.findIndex((G)=>G.i===Z.i),z=Q??wX($).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(Tq(Z,U))y_($,U,J+Z[B],H,z)}Z[H]=J}function OK0($,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&&!L7($,Z))Z.y--;let Q;while((Q=L7($,Z))!==void 0)y_(J,Z,Q.y+Q.h,"y");return Z.y=Math.max(Z.y,0),Z}function TK0($,Z,J,H){Z.x=Math.max(Z.x,0),Z.y=Math.max(Z.y,0);while(Z.x>0&&!L7($,Z))Z.x--;let Q;while((Q=L7($,Z))!==void 0)if(y_(H,Z,Q.x+Q.w,"x"),Z.x+Z.w>J){Z.x=J-Z.w,Z.y++;while(Z.x>0&&!L7($,Z))Z.x--}return Z.x=Math.max(Z.x,0),Z}var SX={type:"vertical",allowOverlap:!1,compact($,Z){let J=wX($),H=CX(J),Q=Oq($),B=Array($.length);for(let X=0;X<Q.length;X++){let z=Q[X];if(z===void 0)continue;let G=m3(z);if(!G.static)G=OK0(J,G,Q,H),H=Math.max(H,G.y+G.h),J.push(G);let U=$.indexOf(z);B[U]=G,G.moved=!1}return B}},x_={type:"horizontal",allowOverlap:!1,compact($,Z){let J=wX($),H=T_($),Q=Array($.length);for(let B=0;B<H.length;B++){let X=H[B];if(X===void 0)continue;let z=m3(X);if(!z.static)z=TK0(J,z,Z,H),J.push(z);let G=$.indexOf(X);Q[G]=z,z.moved=!1}return Q}},h_={type:null,allowOverlap:!1,compact($,Z){return jH($)}},CK0={...SX,allowOverlap:!0,compact($,Z){return jH($)}},wK0={...x_,allowOverlap:!0,compact($,Z){return jH($)}},EK0={...h_,allowOverlap:!0};function v_($,Z=!1,J=!1){let H;if(Z)if($==="vertical")H=CK0;else if($==="horizontal")H=wK0;else H=EK0;else if($==="vertical")H=SX;else if($==="horizontal")H=x_;else H=h_;if(J)return{...H,preventCollision:J};return H}var Y9=P(m(),1);function SK0($){let Z=typeof globalThis.getComputedStyle==="function"?globalThis.getComputedStyle($):null;if(!Z)return $.clientWidth;let J=(Q)=>{let B=Number.parseFloat(Q);return Number.isFinite(B)?B: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 g_($={}){let{measureBeforeMount:Z=!1,initialWidth:J=1280}=$,[H,Q]=Y9.useState(J),[B,X]=Y9.useState(!Z),z=Y9.useRef(null),G=Y9.useRef(null),U=Y9.useCallback(()=>{let K=z.current;if(K){let Y=Math.round(SK0(K));if(Q((F)=>F===Y?F:Y),!B)X(!0)}},[B]);return Y9.useEffect(()=>{let K=z.current;if(!K)return;if(U(),typeof ResizeObserver<"u"){let Y=null;return G.current=new ResizeObserver((F)=>{let W=F[0];if(W){let q=Math.round(W.contentRect.width);if(Y!==null)cancelAnimationFrame(Y);Y=requestAnimationFrame(()=>{Q((N)=>N===q?N:q),Y=null})}}),G.current.observe(K),()=>{if(Y!==null)cancelAnimationFrame(Y);if(G.current)G.current.disconnect(),G.current=null}}return()=>{if(G.current)G.current.disconnect(),G.current=null}},[U]),{width:H,mounted:B,containerRef:z,measureWidth:U}}var g0=P(m(),1),go=P(hq(),1),fo=P(xo(),1);var p3=P(c(),1),JZ=P(pa(),1);function Qj($){let{children:Z,cols:J,containerWidth:H,margin:Q,containerPadding:B,rowHeight:X,maxRows:z,isDraggable:G,isResizable:U,isBounded:K,static:Y,useCSSTransforms:F=!0,usePercentages:W=!1,transformScale:q=1,positionStrategy:N,dragThreshold:V=0,droppingPosition:A,className:D="",style:L,handle:j="",cancel:M="",x:_,y:E,w:C,h:R,minW:T=1,maxW:I=1/0,minH:y=1,maxH:S=1/0,i:O,resizeHandles:b,resizeHandle:k,constraints:h=w_,layoutItem:v,layout:f=[],onDragStart:w,onDrag:i,onDragStop:r,onResizeStart:x,onResize:l,onResizeStop:s}=$,[p,d]=g0.useState(!1),[o,Z0]=g0.useState(!1),H0=g0.useRef(null),G0=g0.useRef({left:0,top:0}),X0=g0.useRef({top:0,left:0,width:0,height:0}),Y0=g0.useRef(void 0),V0=g0.useRef(f);V0.current=f;let N0=g0.useRef(null),F0=g0.useRef(null),n=g0.useRef(!1),a=g0.useRef({x:0,y:0}),e=g0.useRef(!1),$0=g0.useMemo(()=>({cols:J,containerPadding:B,containerWidth:H,margin:Q,maxRows:z,rowHeight:X}),[J,B,H,Q,z,X]),Q0=g0.useMemo(()=>({cols:J,maxRows:z,containerWidth:H,containerHeight:0,rowHeight:X,margin:Q,layout:[]}),[J,z,H,X,Q]),_0=g0.useCallback(()=>({...Q0,layout:V0.current}),[Q0]),M0=g0.useMemo(()=>v??{i:O,x:_,y:E,w:C,h:R,minW:T,maxW:I,minH:y,maxH:S},[v,O,_,E,C,R,T,I,y,S]),A0=g0.useCallback((C0)=>{if(N?.calcStyle)return N.calcStyle(C0);if(F)return wq(C0);let p0=E_(C0);if(W)return{...p0,left:S_(C0.left/H),width:S_(C0.width/H)};return p0},[N,F,W,H]),L0=g0.useCallback((C0,{node:p0})=>{if(!w)return;let{offsetParent:i0}=p0;if(!i0)return;let o0=i0.getBoundingClientRect(),V1=p0.getBoundingClientRect(),D1=V1.left/q,u1=o0.left/q,q0=V1.top/q,P0=o0.top/q,l0;if(N?.calcDragPosition){let r0=C0;l0=N.calcDragPosition(r0.clientX,r0.clientY,r0.clientX-V1.left,r0.clientY-V1.top)}else l0={left:D1-u1+i0.scrollLeft,top:q0-P0+i0.scrollTop};if(G0.current=l0,V>0){let r0=C0;a.current={x:r0.clientX,y:r0.clientY},n.current=!0,e.current=!1,d(!0);return}d(!0);let z1=TX($0,l0.top,l0.left),{x:O1,y:b0}=EX(h,M0,z1.x,z1.y,_0());w(O,O1,b0,{e:C0,node:p0,newPosition:l0})},[w,q,$0,N,V,h,M0,_0,O]),g=g0.useCallback((C0,{node:p0,deltaX:i0,deltaY:o0})=>{if(!i||!p)return;let V1=C0;if(n.current&&!e.current){let O1=V1.clientX-a.current.x,b0=V1.clientY-a.current.y;if(Math.hypot(O1,b0)<V)return;if(e.current=!0,n.current=!1,w){let h0=TX($0,G0.current.top,G0.current.left),{x:G1,y:S1}=EX(h,M0,h0.x,h0.y,_0());w(O,G1,S1,{e:C0,node:p0,newPosition:G0.current})}}let D1=G0.current.top+o0,u1=G0.current.left+i0;if(K){let{offsetParent:O1}=p0;if(O1){let b0=O1.clientHeight-K9(R,X,Q[1]);D1=jX(D1,0,b0);let r0=D7($0),h0=H-K9(C,r0,Q[0]);u1=jX(u1,0,h0)}}let q0={top:D1,left:u1};G0.current=q0;let P0=TX($0,D1,u1),{x:l0,y:z1}=EX(h,M0,P0.x,P0.y,_0());i(O,l0,z1,{e:C0,node:p0,newPosition:q0})},[i,w,p,V,K,R,X,Q,$0,H,C,O,h,M0,_0]),u=g0.useCallback((C0,{node:p0})=>{if(!r||!p)return;let i0=n.current;if(n.current=!1,e.current=!1,a.current={x:0,y:0},i0){d(!1),G0.current={left:0,top:0};return}let{left:o0,top:V1}=G0.current,D1={top:V1,left:o0};d(!1),G0.current={left:0,top:0};let u1=TX($0,V1,o0),{x:q0,y:P0}=EX(h,M0,u1.x,u1.y,_0());r(O,q0,P0,{e:C0,node:p0,newPosition:D1})},[r,p,$0,h,M0,_0,O]);N0.current=L0,F0.current=g;let t=g0.useCallback((C0,{node:p0,size:i0,handle:o0},V1,D1)=>{let u1=D1==="onResizeStart"?x:D1==="onResize"?l:s;if(!u1)return;let q0;if(p0)q0=xa(o0,V1,i0,H);else q0={...i0,top:V1.top,left:V1.left};X0.current=q0;let P0=Ia($0,q0.width,q0.height),{w:l0,h:z1}=ba(h,M0,P0.w,P0.h,o0,_0());u1(O,l0,z1,{e:C0.nativeEvent??C0,node:p0,size:q0,handle:o0})},[x,l,s,H,$0,O,h,M0,_0]),W0=g0.useCallback((C0,p0)=>{Z0(!0);let i0=OX($0,_,E,C,R),o0={...p0,handle:p0.handle};t(C0,o0,i0,"onResizeStart")},[t,$0,_,E,C,R]),I0=g0.useCallback((C0,p0)=>{let i0=OX($0,_,E,C,R),o0={...p0,handle:p0.handle};t(C0,o0,i0,"onResize")},[t,$0,_,E,C,R]),c0=g0.useCallback((C0,p0)=>{Z0(!1),X0.current={top:0,left:0,width:0,height:0};let i0=OX($0,_,E,C,R),o0={...p0,handle:p0.handle};t(C0,o0,i0,"onResizeStop")},[t,$0,_,E,C,R]);g0.useEffect(()=>{if(!A)return;let C0=H0.current;if(!C0)return;let p0=Y0.current||{left:0,top:0},i0=p&&(A.left!==p0.left||A.top!==p0.top);if(!p){let o0={node:C0,deltaX:A.left,deltaY:A.top,lastX:0,lastY:0,x:A.left,y:A.top};N0.current?.(A.e,o0)}else if(i0){let o0=A.left-G0.current.left,V1=A.top-G0.current.top,D1={node:C0,deltaX:o0,deltaY:V1,lastX:G0.current.left,lastY:G0.current.top,x:A.left,y:A.top};F0.current?.(A.e,D1)}Y0.current=A},[A,p,O]);let f0=OX($0,_,E,C,R,p?G0.current:null,o?X0.current:null),T0=g0.default.Children.only(Z),x0=D7($0),J1=[K9(T,x0,Q[0]),K9(y,X,Q[1])],W1=[K9(I,x0,Q[0]),K9(S,X,Q[1])],d0=T0.props,v0=d0.className,E1=d0.style,B1=g0.default.cloneElement(T0,{ref:H0,className:Bj("react-grid-item",v0,D,{static:Y,resizing:o,"react-draggable":G,"react-draggable-dragging":p,dropping:Boolean(A),cssTransforms:F}),style:{...L,...E1,...A0(f0)}}),s1=k;return B1=p3.jsx(fo.Resizable,{draggableOpts:{disabled:!U},className:U?void 0:"react-resizable-hide",width:f0.width,height:f0.height,minConstraints:J1,maxConstraints:W1,onResizeStart:W0,onResize:I0,onResizeStop:c0,transformScale:q,resizeHandles:b,handle:s1,children:B1}),B1=p3.jsx(go.DraggableCore,{disabled:!G,onStart:L0,onDrag:g,onStop:u,handle:j,cancel:".react-resizable-handle"+(M?","+M:""),scale:q,nodeRef:H0,children:B1}),B1}var u3=()=>{},ho="react-grid-layout",mo=!1;try{mo=/firefox/i.test(navigator.userAgent)}catch{}function mF0($,Z){let J=g0.default.Children.toArray($),H=g0.default.Children.toArray(Z);if(J.length!==H.length)return!1;for(let Q=0;Q<J.length;Q++){let B=J[Q],X=H[Q];if(B?.key!==X?.key)return!1}return!0}function vo($,Z,J,H){let Q=[],B=new Set;g0.default.Children.forEach(Z,(z)=>{if(!g0.default.isValidElement(z)||z.key===null)return;let G=String(z.key);B.add(G);let U=$.find((K)=>K.i===G);if(U)Q.push(m3(U));else{let Y=z.props["data-grid"];if(Y)Q.push({i:G,x:Y.x??0,y:Y.y??0,w:Y.w??1,h:Y.h??1,minW:Y.minW,maxW:Y.maxW,minH:Y.minH,maxH:Y.maxH,static:Y.static,isDraggable:Y.isDraggable,isResizable:Y.isResizable,resizeHandles:Y.resizeHandles,isBounded:Y.isBounded});else Q.push({i:G,x:0,y:CX(Q),w:1,h:1})}});let X=C_(Q,{cols:J});return H.compact(X,J)}function xX($){let{children:Z,width:J,gridConfig:H,dragConfig:Q,resizeConfig:B,dropConfig:X,positionStrategy:z=ha,compactor:G,constraints:U=w_,layout:K=[],droppingItem:Y,autoSize:F=!0,className:W="",style:q={},innerRef:N,onLayoutChange:V=u3,onDragStart:A=u3,onDrag:D=u3,onDragStop:L=u3,onResizeStart:j=u3,onResize:M=u3,onResizeStop:_=u3,onDrop:E=u3,onDropDragOver:C=u3}=$,R=g0.useMemo(()=>({...va,...H}),[H]),T=g0.useMemo(()=>({...ga,...Q}),[Q]),I=g0.useMemo(()=>({...fa,...B}),[B]),y=g0.useMemo(()=>({...ma,...X}),[X]),{cols:S,rowHeight:O,maxRows:b,margin:k,containerPadding:h}=R,{enabled:v,bounded:f,handle:w,cancel:i,threshold:r}=T,{enabled:x,handles:l,handleComponent:s}=I,{enabled:p,defaultItem:d,onDragOver:o}=y,Z0=G??v_("vertical"),H0=Z0.type,G0=Z0.allowOverlap,X0=Z0.preventCollision??!1,Y0=g0.useMemo(()=>Y??{i:"__dropping-elem__",...d},[Y,d]),V0=z.type==="transform",N0=z.scale,F0=h??k,[n,a]=g0.useState(!1),[e,$0]=g0.useState(()=>vo(K,Z,S,Z0)),[Q0,_0]=g0.useState(null),[M0,A0]=g0.useState(!1),[L0,g]=g0.useState(null),[u,t]=g0.useState(),W0=g0.useRef(null),I0=g0.useRef(null),c0=g0.useRef(null),f0=g0.useRef(0),T0=g0.useRef(e),x0=g0.useRef(K),J1=g0.useRef(Z),W1=g0.useRef(H0),d0=g0.useRef(e);d0.current=e,g0.useEffect(()=>{if(a(!0),!JZ.deepEqual(e,K))V(e)},[]),g0.useEffect(()=>{if(Q0)return;if(L0)return;let b0=!JZ.deepEqual(K,x0.current),r0=!mF0(Z,J1.current),h0=H0!==W1.current;if(b0||r0||h0){let S1=vo(b0?K:e,Z,S,Z0);if(!JZ.deepEqual(S1,e))$0(S1)}x0.current=K,J1.current=Z,W1.current=H0},[K,Z,S,H0,Z0,Q0,L0,e]),g0.useEffect(()=>{if(!Q0&&!JZ.deepEqual(e,T0.current)){T0.current=e;let b0=e.filter((r0)=>r0.i!==Y0.i);V(b0)}},[e,Q0,V,Y0.i]);let v0=g0.useMemo(()=>{if(!F)return;let b0=CX(e),r0=F0[1];return b0*O+(b0-1)*k[1]+r0*2+"px"},[F,e,O,k,F0]),E1=g0.useCallback((b0,r0,h0,G1)=>{let S1=d0.current,k1=M7(S1,b0);if(!k1)return;let h5={w:k1.w,h:k1.h,x:k1.x,y:k1.y,i:b0};W0.current=m3(k1),c0.current=S1,_0(h5),A(S1,k1,k1,null,G1.e,G1.node)},[A]),B1=g0.useCallback((b0,r0,h0,G1)=>{let S1=d0.current,k1=W0.current,h5=M7(S1,b0);if(!h5)return;let L2={w:h5.w,h:h5.h,x:h5.x,y:h5.y,i:b0},v5=V7(S1,h5,r0,h0,!0,X0,H0,S,G0);D(v5,k1,h5,L2,G1.e,G1.node),$0(Z0.compact(v5,S)),_0(L2)},[X0,H0,S,G0,Z0,D]),s1=g0.useCallback((b0,r0,h0,G1)=>{if(!Q0)return;let S1=d0.current,k1=W0.current,h5=M7(S1,b0);if(!h5)return;let L2=V7(S1,h5,r0,h0,!0,X0,H0,S,G0),v5=Z0.compact(L2,S);L(v5,k1,h5,null,G1.e,G1.node);let l2=c0.current;if(W0.current=null,c0.current=null,_0(null),$0(v5),l2&&!JZ.deepEqual(l2,v5))V(v5)},[Q0,X0,H0,S,G0,Z0,L,V]),C0=g0.useCallback((b0,r0,h0,G1)=>{let S1=d0.current,k1=M7(S1,b0);if(!k1)return;I0.current=m3(k1),c0.current=S1,A0(!0),j(S1,k1,k1,null,G1.e,G1.node)},[j]),p0=g0.useCallback((b0,r0,h0,G1)=>{let S1=d0.current,k1=I0.current,{handle:h5}=G1,L2=!1,v5,l2,[cX,K3]=ka(S1,b0,(m5)=>{if(v5=m5.x,l2=m5.y,["sw","w","nw","n","ne"].includes(h5)){if(["sw","nw","w"].includes(h5))v5=m5.x+(m5.w-r0),r0=m5.x!==v5&&v5<0?m5.w:r0,v5=v5<0?0:v5;if(["ne","n","nw"].includes(h5))l2=m5.y+(m5.h-h0),h0=m5.y!==l2&&l2<0?m5.h:h0,l2=l2<0?0:l2;L2=!0}if(X0&&!G0){if(O_(S1,{...m5,w:r0,h:h0,x:v5??m5.x,y:l2??m5.y}).filter((lX)=>lX.i!==m5.i).length>0)l2=m5.y,h0=m5.h,v5=m5.x,r0=m5.w,L2=!1}return m5.w=r0,m5.h=h0,m5});if(!K3)return;let hH=cX;if(L2&&v5!==void 0&&l2!==void 0)hH=V7(cX,K3,v5,l2,!0,X0,H0,S,G0);let dX={w:K3.w,h:K3.h,x:K3.x,y:K3.y,i:b0,static:!0};M(hH,k1,K3,dX,G1.e,G1.node),$0(Z0.compact(hH,S)),_0(dX)},[X0,H0,S,G0,Z0,M]),i0=g0.useCallback((b0,r0,h0,G1)=>{let S1=d0.current,k1=I0.current,h5=M7(S1,b0),L2=Z0.compact(S1,S);_(L2,k1,h5??null,null,G1.e,G1.node);let v5=c0.current;if(I0.current=null,c0.current=null,_0(null),A0(!1),$0(L2),v5&&!JZ.deepEqual(v5,L2))V(L2)},[S,Z0,_,V]),o0=g0.useCallback(()=>{let b0=d0.current;if(!b0.some((G1)=>G1.i===Y0.i)){g(null),_0(null),t(void 0);return}let h0=Z0.compact(b0.filter((G1)=>G1.i!==Y0.i),S);$0(h0),g(null),_0(null),t(void 0)},[Y0.i,S,Z0]),V1=g0.useCallback((b0)=>{if(b0.preventDefault(),b0.stopPropagation(),mo&&!b0.nativeEvent.target?.classList.contains(ho))return!1;let r0=o?o(b0.nativeEvent):C(b0);if(r0===!1){if(L0)o0();return!1}let{dragOffsetX:h0=0,dragOffsetY:G1=0,...S1}=r0??{},k1={...Y0,...S1},h5=b0.currentTarget.getBoundingClientRect(),L2={cols:S,margin:k,maxRows:b,rowHeight:O,containerWidth:J,containerPadding:F0},v5=D7(L2),l2=K9(k1.w,v5,k[0]),cX=K9(k1.h,O,k[1]),K3=l2/2,hH=cX/2,dX=b0.clientX-h5.left+h0-K3,m5=b0.clientY-h5.top+G1-hH,JN=Math.max(0,dX),lX=Math.max(0,m5),iX={left:JN/N0,top:lX/N0,e:b0.nativeEvent};if(!L0){let HN=Ra(L2,lX,JN,k1.w,k1.h);g(p3.jsx("div",{},k1.i)),t(iX);let ys=d0.current.filter((xs)=>xs.i!==k1.i);$0([...ys,{...k1,x:HN.x,y:HN.y,static:!1,isDraggable:!0}])}else if(u){if(u.left!==iX.left||u.top!==iX.top)t(iX)}},[L0,u,Y0,o,C,o0,N0,S,k,b,O,J,F0]),D1=g0.useCallback((b0)=>{if(b0.preventDefault(),b0.stopPropagation(),f0.current--,f0.current<0)f0.current=0;if(f0.current===0)o0()},[o0]),u1=g0.useCallback((b0)=>{b0.preventDefault(),b0.stopPropagation(),f0.current++},[]),q0=g0.useCallback((b0)=>{b0.preventDefault(),b0.stopPropagation();let r0=d0.current,h0=r0.find((G1)=>G1.i===Y0.i);f0.current=0,o0(),E(r0,h0,b0.nativeEvent)},[Y0.i,o0,E]),P0=g0.useCallback((b0,r0)=>{if(!b0||!b0.key)return null;let h0=M7(e,String(b0.key));if(!h0)return null;let G1=typeof h0.isDraggable==="boolean"?h0.isDraggable:!h0.static&&v,S1=typeof h0.isResizable==="boolean"?h0.isResizable:!h0.static&&x,k1=h0.resizeHandles||[...l],h5=G1&&f&&h0.isBounded!==!1,L2=s;return p3.jsx(Qj,{containerWidth:J,cols:S,margin:k,containerPadding:F0,maxRows:b,rowHeight:O,cancel:i,handle:w,onDragStart:E1,onDrag:B1,onDragStop:s1,onResizeStart:C0,onResize:p0,onResizeStop:i0,isDraggable:G1,isResizable:S1,isBounded:h5,useCSSTransforms:V0&&n,usePercentages:!n,transformScale:N0,positionStrategy:z,dragThreshold:r,w:h0.w,h:h0.h,x:h0.x,y:h0.y,i:h0.i,minH:h0.minH,minW:h0.minW,maxH:h0.maxH,maxW:h0.maxW,static:h0.static,droppingPosition:r0?u:void 0,resizeHandles:k1,resizeHandle:L2,constraints:U,layoutItem:h0,layout:e,children:b0},h0.i)},[e,J,S,k,F0,b,O,i,w,E1,B1,s1,C0,p0,i0,v,x,f,V0,n,N0,z,r,u,l,s,U]),l0=()=>{if(!Q0)return null;return p3.jsx(Qj,{w:Q0.w,h:Q0.h,x:Q0.x,y:Q0.y,i:Q0.i,className:`react-grid-placeholder ${M0?"placeholder-resizing":""}`,containerWidth:J,cols:S,margin:k,containerPadding:F0,maxRows:b,rowHeight:O,isDraggable:!1,isResizable:!1,isBounded:!1,useCSSTransforms:V0,transformScale:N0,constraints:U,layout:e,children:p3.jsx("div",{})})},z1=Bj(ho,W),O1={height:v0,...q};return p3.jsxs("div",{ref:N,className:z1,style:O1,onDrop:p?q0:void 0,onDragLeave:p?D1:void 0,onDragEnter:p?u1:void 0,onDragOver:p?V1:void 0,children:[g0.default.Children.map(Z,(b0)=>{if(!g0.default.isValidElement(b0))return null;return P0(b0)}),p&&L0&&P0(L0,!0),l0()]})}var K8=P(c(),1),Xj="moi:empty-state",uo={type:"spring",duration:0.35,bounce:0};function pF0({items:$,customizing:Z,emptyState:J,renderItem:H,onMove:Q,onRemove:B}){let[X,z]=hX.useState(()=>AX($)),[G,U]=hX.useState($),{width:K,containerRef:Y,mounted:F}=g_({measureBeforeMount:!0});if(G!==$)U($),z((N)=>{let V=new Map(N.map((L)=>[L.i,L])),A=$.filter((L)=>V.has(L.id)).map((L)=>({...V.get(L.id),w:L.w,h:L.h})),D=new Set(A.map((L)=>L.i));return[...A,...AX($.filter((L)=>!D.has(L.id)),A)]});let W=J?[...X,{i:Xj,x:0,y:X.reduce((N,V)=>Math.max(N,V.y+V.h),0),w:4,h:2,static:!0}]:X,q=hX.useCallback((N)=>{let V=N.filter((A)=>A.i!==Xj);z(V),Q?.(V.map((A)=>({id:A.i,x:A.x,y:A.y})))},[Q]);return K8.jsx("div",{ref:Y,className:"w-full",children:F&&K8.jsxs(xX,{width:K,layout:W,gridConfig:{cols:4,rowHeight:160,margin:[8,8],containerPadding:[0,0]},dragConfig:{enabled:!!Z},resizeConfig:{enabled:!1},compactor:SX,onLayoutChange:q,children:[X.map((N)=>K8.jsx("div",{children:K8.jsx(z5.div,{layoutId:N.i,"data-applet-thumbnail":i6("widgets",N.i),className:"size-full",transition:uo,children:K8.jsx(zq,{customizing:Z,widgetId:N.i,onRemove:B?()=>B(N.i):void 0,children:H(N.i)})})},N.i)),J&&K8.jsx("div",{children:K8.jsx(z5.div,{layout:!0,className:"size-full",transition:uo,children:J})},Xj)]})})}function po({items:$,customizing:Z,header:J,emptyState:H,bottomInset:Q=0,renderItem:B,onMove:X,onRemove:z}){return K8.jsxs("div",{className:"size-full overflow-y-auto p-4",children:[K8.jsx("div",{className:"mx-auto h-32 w-full max-w-(--column-w)",children:J}),K8.jsx(z5.div,{className:"mx-auto flex min-h-0 w-full max-w-(--column-w) flex-col gap-2",animate:{marginBottom:Q},transition:{type:"spring",duration:0.3,bounce:0},children:($.length>0||H)&&K8.jsx(pF0,{items:$,customizing:Z,emptyState:H,renderItem:B,onMove:X,onRemove:z})})]})}var c1=P(c(),1);function cF0({onCreateWidget:$,showOnboarding:Z}){return c1.jsxs("div",{className:"relative grid size-full grid-cols-4 grid-rows-2 gap-2 overflow-hidden",children:[c1.jsx("div",{className:"col-span-2 overflow-hidden rounded-2xl bg-muted texture-checker squircle",children:c1.jsx("div",{className:"flex size-full items-start justify-start bg-radial-[at_top_left] from-muted from-40% to-transparent p-12",children:c1.jsx("h2",{className:"text-2xl font-semibold text-foreground",children:"Widgets"})})}),c1.jsx("div",{className:"col-span-2 overflow-hidden rounded-2xl bg-muted texture-checker squircle"}),c1.jsx("div",{className:"col-span-2 overflow-hidden rounded-2xl bg-muted texture-checker squircle"}),c1.jsx("div",{className:"col-span-2 overflow-hidden rounded-2xl bg-muted texture-checker squircle",children:Z&&c1.jsx("div",{className:"flex size-full items-end justify-end",children:c1.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"})})}),c1.jsxs(j0,{type:"button",variant:"outline",className:B0("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:[c1.jsx(f2,{"data-icon":"inline-start",stroke:1}),"New widget"]})]})}function zj({Icon:$,label:Z,active:J,className:H,...Q}){return c1.jsx(j0,{type:"button",variant:J?"default":"secondary",className:B0("relative h-16 w-24 rounded-lg px-4 py-0 text-xs [&_svg]:size-5",H),"aria-pressed":J,...Q,children:c1.jsx(j4,{mode:"popLayout",initial:!1,children:c1.jsxs(z5.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?c1.jsx(j8,{stroke:1.5}):c1.jsx($,{stroke:1.5}),c1.jsx("span",{children:J?"Done":Z})]},J?"done":"action")})})}function dF0({customizing:$,theming:Z,onCustomizingChange:J,onThemingChange:H}){return c1.jsxs("div",{className:"flex size-full items-center gap-4",children:[c1.jsx(Ea,{}),c1.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[c1.jsx(zj,{Icon:co,label:"Customize",active:$,onClick:()=>J(!$)}),c1.jsx(zj,{Icon:mq,label:"Theme",active:Z,onClick:()=>H(!Z)}),c1.jsx(eW,{children:c1.jsx(w3,{render:c1.jsx(zj,{Icon:S6,label:"Settings"})})})]})]})}function lF0(){let[$,Z]=uq.useState(0);return[uq.useCallback((H)=>{if(!H)return;let Q=new ResizeObserver(([B])=>{let X=B.borderBoxSize?.[0];Z(X?X.blockSize:B.contentRect.height)});return Q.observe(H),()=>Q.disconnect()},[]),$]}function lo({onCreateWidget:$,onCreateView:Z,onOpenView:J,customizing:H,theming:Q,onThemingChange:B,onCustomizingChange:X,widgets:z,views:G,builders:U}){let{layout:K,setLayout:Y}=i1(),F=w5((T)=>T.hasSentMessageFromMoi),W=new Map(z.map((T)=>[T.id,T])),q=new Set(K.widgetGrid.map((T)=>T.i)),N=K.widgetGrid.filter((T)=>W.has(T.i)).map((T)=>{let I=W.get(T.i);return{id:T.i,w:I.config.colSpan,h:I.config.rowSpan,x:T.x,y:T.y}}),V=z.filter((T)=>!q.has(T.id)).map((T)=>({id:T.id,w:T.config.colSpan,h:T.config.rowSpan})),A=!H&&N.every((T)=>r9(T.id)),D=!F&&z.every((T)=>r9(T.id)),[L,j]=lF0(),M=H;hW({kind:"widget",enabled:!H,targets:N.filter((T)=>!r9(T.id)).map((T)=>({id:T.id,revision:W.get(T.id)?.revision}))});function _(T){let I=li(T,{views:G,builders:U,onOpenView:J,onCreateView:Z,showOnboarding:D});if(I)return I;return c1.jsx(si,{name:T})}function E(T){Y({widgetGrid:K.widgetGrid.filter((I)=>I.i!==T)})}function C(T){let I=W.get(T);if(!I)return;let y=K.widgetGrid.map((O)=>{let b=W.get(O.i);return{...O,w:b?.config.colSpan??1,h:b?.config.rowSpan??1}}),S=Qq(y,I.config.colSpan,I.config.rowSpan);Y({widgetGrid:[...K.widgetGrid,{i:T,x:S.x,y:S.y}]})}function R(T){Y({widgetGrid:ai(K.widgetGrid,T)})}return c1.jsx("div",{className:"relative min-h-0 flex-1 bg-background",children:c1.jsxs(UU,{children:[c1.jsx(po,{items:N,customizing:H,header:c1.jsx(dF0,{customizing:H,theming:Q,onCustomizingChange:X,onThemingChange:B}),emptyState:A?c1.jsx(cF0,{onCreateWidget:$,showOnboarding:D}):void 0,bottomInset:M?j:0,renderItem:_,onMove:R,onRemove:E}),c1.jsx(j4,{children:H&&c1.jsx($r,{ref:L,items:V,renderItem:_,onCreateWidget:$,onClose:()=>X(!1),onRestore:C})})]})})}var ro=P(c(),1);function io({children:$}){return ro.jsx("header",{className:B0("@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 ao=!0;var iF0=64;function oo($,Z=[]){let J=HL($),H=J.attachments.map(QL);return(Jh(J.text).trim()||(H.length?H:Z).filter(Boolean).join(", ")).replace(/\s+/gu," ").trim().slice(0,iF0).trimEnd()}function pq($,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:Q,text:B}=$;return{attachment:{type:"text",source:H,label:Q,text:B},part:Zh({type:"text",source:H,label:Q,text:B})}}function no($){return{attachments:$.map((Z)=>Z.attachment),parts:$.map((Z)=>Z.part)}}async function so($,Z){let J=qY(Z);if(J)throw Error(J);return no(await Promise.all(Z.map(async(H)=>{if(H.type==="text")return pq(H);let Q=await OB($,H.file??H.path);return pq(Q,`/api/workspaces/${$}/uploads/${Q.id}`,{source:H.source})})))}function cq($){return no($.flatMap((Z)=>{if(Z.kind==="text")return[pq(Z)];if(!Z.upload)return[];return[pq({...Z.upload,filename:Z.label,mediaType:Z.mediaType},Z.previewUrl,{source:Z.source,purpose:Z.kind==="drawing"?Z.purpose:void 0})]}))}function dq($){return!$?.applet&&!$?.preparedAttachments}function lq($,Z,J){if(!dq(J))return[];return(b1.getState().attachments[a8($,Z)]??[]).filter((Q)=>Q.kind==="text"||Q.status==="ready"&&Q.upload)}function iq({queryClient:$,workspaceId:Z,sessionId:J,parts:H}){let Q=`optimistic:${crypto.randomUUID()}`;return $.setQueryData(S0.events(Z,J),(B)=>SG(B??qQ(),{kind:"turn",turn:{id:Q,role:"user",origin:{kind:"user-input"},parts:H,timestamp:new Date().toISOString()}})),b1.getState().setActivity(Z,J,"running"),b1.getState().setError(Z,J,null),Q}function rq({queryClient:$,workspaceId:Z,sessionId:J,text:H,filenames:Q=[]}){let B=oo(H,Q);if(!B)return;$.setQueryData(S0.sessions(Z),(X)=>[{sessionId:J,summary:B,lastModified:Date.now()},...(X??[]).filter((z)=>z.sessionId!==J)])}function aq($,Z,J,H){let Q=$?.models,B=!Z||!Q||Q.some((Y)=>Y.value===Z)?Z:void 0,X=$?.provider==="codex"?xY($.models,Z):Q?.find((Y)=>Y.value===(B??"default")),z=$?.provider==="codex"&&X?X.resolvedModel??X.value:B,G=J&&(!X||(X.supportedEffortLevels??[]).includes(J))?J:void 0,U=H===void 0||!X||X.supportsFastMode?H:!1,K=ao&&$?.supportsStreaming?!0:void 0;return{model:z,effort:G,...U!==void 0?{fastMode:U}:{},stream:K}}var eo=P(m(),1);function to($){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 rF0($,Z,J,H="shared"){let Q=new Set,B=!1,X=()=>Z.getQueryData(K$($,H))?.sessionId??null;async function z(G){if(B)return;let U=(D)=>{A5.add({title:"Couldn’t send message",description:D,type:"error"}),Z8($,{source:"runtime",message:`sendChatMessage() from ${G.source}: ${D}`})},K=to(J().agentAvailability);if(K){U(K);return}let Y=X(),F=!0,W,q=()=>{if(F=!1,V(),Q.delete(N),W)A5.close(W)},N=()=>{if(!F)return;q(),A5.add({title:"Message canceled",description:"The active chat changed before attachments were ready",type:"info"})},V=Z.getQueryCache().subscribe(()=>{if(X()!==Y)N()});if(Q.add(N),J().sessionId!==Y){N();return}J().revealChat();let A;try{if(G.attachments.some((j)=>j.type==="file"))W=A5.add({title:"Preparing attachments…",type:"loading",timeout:0});if(A=await so($,G.attachments),!F)return;let D=J(),L=to(D.agentAvailability);if(L)throw Error(L);if(D.sessionId!==Y){N();return}}catch(D){if(F)q(),U(D instanceof Error?D.message:"Couldn’t prepare the attachments");return}q();try{J().send(G.message,{applet:{source:G.source},preparedAttachments:A})}catch(D){U(D instanceof Error?D.message:"Something went wrong while sending this message")}}return{handle:z,dispose(){B=!0;for(let G of Q)G()}}}function $n($){let Z=e1(),J=U1(),H=M4(),Q=K5($);eo.useLayoutEffect(()=>{let B=rF0(Z,J,()=>Q.current,H?"browser-tab":"shared"),X=AY(Z).on("sendChatMessage",(z)=>{B.handle(z)});return()=>{X(),B.dispose()}},[Z,J,Q,H])}function Zn($,Z){let J=e1();VY(J,"addChatAttachment",(H)=>{ph({workspaceId:J,sessionId:$},H),Z()})}var c3=P(m(),1);var Hn=P(m(),1);var Jn=new Map;function aF0($){let Z=Jn.get($)??[];return Jn.delete($),Z}function oF0($,Z=[]){return[...aF0($),...Z]}function nF0($,Z){if(!$.startsWith("views/"))return;return Object.keys(Z).length>0?Z:void 0}function sF0($,Z,J){if($.startsWith("views/"))return Z?.find((H)=>H.id===$.slice(6))?.config.title||void 0;if($.startsWith("view-builders/"))return J?.find((H)=>H.id===$.slice(14))?.title||void 0;return}function Qn({activeTab:$,appletParams:Z}){let J=e1(),H=Zq(J).data,Q=Hq(J).data;return Hn.useCallback((B={})=>{let X=oF0(J,B.directives??[]),z=nF0($,Z);return{activeTab:$,tabTitle:sF0($,H,Q),...z?{tabParams:z}:{},...B.applet?{applet:B.applet}:{},...X.length>0?{directives:X}:{}}},[J,$,Z,H,Q])}function tF0($){return $.filter((Z)=>Z.text.length>0).map((Z)=>Z.kind==="reasoning"?{type:"reasoning",text:Z.text}:{type:"text",text:Z.text})}function Bn($){let Z=tF0($?.blocks??[]);if(Z.length===0)return null;return{id:"live-preview",role:"assistant",origin:{kind:"user-input"},parts:Z}}var eF0=qQ();function Xn($){let Z=e1(),J=U1(),{layout:H}=i1(),[Q,B]=j6(),X=M4(),z=i9(Z).data,G=bY(Z).data,U=Boolean(Q)&&G!==void 0&&!G.some((T)=>T.sessionId===Q),K=U?null:Q??null;c3.useEffect(()=>{if(U)B(null)},[B,U]);let Y=Qn($),F=g2((T)=>K?T.activity[`${Z}:${K}`]??"idle":"idle"),W=hZ(F),q=g2((T)=>K?T.errors[`${Z}:${K}`]??null:null),N=xv(Z,K),{refetch:V}=N,A=c3.useCallback(()=>void V(),[V]),D=N.data??eF0,L=G!==void 0&&(K===null||N.data!==void 0),j=g2((T)=>WE(T.previews,Z,K).root),M=c3.useMemo(()=>Bn(j),[j]),_=yY(Z,K).data,E=c3.useCallback((T,I)=>{let y=T.trim(),S=lq(Z,K,I);if(!y&&S.length===0&&!I?.preparedAttachments?.attachments.length)return;let O=I?.preparedAttachments??cq(S),b=qY(O.attachments);if(b){A5.add({title:"Couldn’t send message",description:b,type:"error"});return}let k=K,h=!1;if(!k){if(k=crypto.randomUUID(),h=!0,!dq(I))b1.getState().renameSession(Z,K,k);B(k),rq({queryClient:J,workspaceId:Z,sessionId:k,text:y,filenames:S.map((o)=>o.label)})}let v=[...O.parts];if(y)v.push({type:"text",text:y});let f=iq({queryClient:J,workspaceId:Z,sessionId:k,parts:v}),w=_?.model??H.selectedModel,i=_?.effort??H.selectedEffort,r=_?.fastMode??H.selectedFastMode,{model:x,effort:l,fastMode:s,stream:p}=aq(z,w,i,r),{attachments:d}=O;if(FU({type:"chat",workspaceId:Z,content:y,sessionId:k,isNew:h,selectedSessionScope:X?"browser-tab":"shared",optimisticId:f,model:x,effort:l,fastMode:s,stream:p,context:Y(I),...d.length>0?{attachments:d}:{}}),w5.getState().markMessageSentFromMoi(Z),h)J.invalidateQueries({queryKey:S0.preview(Z)});if(dq(I))b1.getState().clearAttachments(Z,K)},[K,Z,J,H.selectedModel,H.selectedEffort,H.selectedFastMode,Y,_?.model,_?.effort,_?.fastMode,B,X,z]),C=c3.useCallback(()=>{if(!K)return;b1.getState().setError(Z,K,null)},[K,Z]),R=c3.useCallback(()=>{if(!W||!K)return;FU({type:"stop",workspaceId:Z,sessionId:K})},[W,K,Z]);return{view:D,chatLoaded:L,previewTurn:M,sessionId:K,processing:W,error:q,loadError:N.error?.message??null,retryLoad:A,send:E,stop:R,selectSession:B,dismissError:C}}var Gn=P(m(),1);var c2=P(m(),1);function zn({active:$,builderId:Z,sessionId:J,source:H,workspaceId:Q,onEditingStart:B,onContinueInChat:X}){let z=c2.useRef(`sketch:${Z}`),G=c2.useRef(0),U=c2.useRef(null),K=c2.useRef(null),Y=c2.useRef(!0),[F,W]=c2.useState(!1),q=K5(B),N=K5(X),V=c2.useCallback((C)=>{if(!Y.current)return;if(!C){G.current+=1,U.current=null,K.current=null,b1.getState().removeAttachment(Q,z.current);return}TB({workspaceId:Q,sessionId:J,localId:z.current,purpose:"sketch",source:H,blob:C})},[J,H,Q]),A=c2.useCallback((C)=>{if(!C)return K.current??Promise.resolve();if(C===U.current){if(b1.getState().attachments[a8(Q,J)]?.some((y)=>y.localId===z.current&&y.kind!=="text"&&(y.status==="ready"||y.status==="uploading")))return K.current??Promise.resolve()}U.current=C;let R=++G.current,T=wY({workspaceId:Q,sessionId:J,localId:z.current,purpose:"sketch",source:H,blob:C,isCurrent:()=>G.current===R});return K.current=T,T},[J,H,Q]),D=TY({mode:"sketch",onChange:V,onEditingStart:()=>q.current()}),{controls:L}=D,j=c2.useCallback(async()=>{await A(await L.flush())},[L,A]),M=c2.useCallback(async()=>{await A(await L.deactivate())},[L,A]),_=c2.useCallback(async()=>{if(F)return;W(!0);try{await M(),N.current()}finally{W(!1)}},[F,M,N]),E=c2.useCallback(async()=>{Y.current=!1,G.current+=1,U.current=null,K.current=null,b1.getState().removeAttachment(Q,z.current);try{await L.cancel()}finally{Y.current=!0}},[L,Q]);return c2.useEffect(()=>{if(!$&&L.active)M()},[$,L.active,M]),{...D,continuing:F,continueInChat:_,prepareForSend:j,resetDocument:E}}var S5=P(c(),1);function Un({ref:$,active:Z,builder:J,chatDocked:H,workspaceId:Q,onEditingStart:B,onContinueInChat:X,onOpenChat:z,onDiscard:G}){let U=zn({active:Z&&J.status==="draft",builderId:J.id,sessionId:J.sessionId,source:H$(J.id),workspaceId:Q,onEditingStart:B,onContinueInChat:X});switch(Gn.useImperativeHandle($,()=>({prepareSketchForSend:U.prepareForSend,resetSketch:U.resetDocument}),[U.prepareForSend,U.resetDocument]),J.status){case"ready":return null;case"draft":case"waiting":case"building":return S5.jsx($W0,{active:Z,chatDocked:H,error:J.error,sketch:U,status:J.status,onDiscard:G,onOpenChat:z})}}function $W0({active:$,chatDocked:Z,error:J,sketch:H,status:Q,onDiscard:B,onOpenChat:X}){let z=Q==="draft";return S5.jsxs("div",{className:B0("relative min-h-0 flex-1 overflow-hidden bg-background",$?"flex":"hidden"),children:[z&&S5.jsx(ZW0,{chatDocked:Z,sketch:H}),S5.jsx("div",{inert:z?void 0:!0,className:B0("absolute inset-0",Q==="building"&&"pointer-events-none opacity-50",Q==="waiting"&&"invisible"),children:S5.jsx(jY,{...H.layerProps,children:z&&S5.jsx(CY,{controls:H.controls,title:"Sketch the view",busy:H.continuing,onComplete:()=>void H.continueInChat()})})}),S5.jsx("div",{"aria-hidden":!0,className:B0("pointer-events-none absolute inset-0 transition-shadow duration-500 ease-in-out",Q==="building"&&"animate-glow texture-inset-shadow-50% motion-reduce:animate-none")}),Q==="building"&&S5.jsx(HW0,{controls:H.controls}),Q==="waiting"&&S5.jsx(JW0,{error:J,onDiscard:B,onOpenChat:X})]})}function ZW0({chatDocked:$,sketch:Z}){let{controls:J,targetRef:H}=Z,{hasStrokes:Q}=jB(J);return S5.jsx("div",{ref:H,className:"absolute inset-0 flex items-center justify-center texture-checker-20",children:!J.active&&!Q&&S5.jsxs("div",{className:B0("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:[S5.jsx(vJ,{size:56,stroke:0.5}),S5.jsx("span",{className:"max-w-32",children:"Sketch how the view should look"})]})})}function JW0({error:$,onDiscard:Z,onOpenChat:J}){return S5.jsx(Kn,{children:S5.jsxs("div",{className:"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:[S5.jsxs("div",{className:"flex flex-col gap-1",children:[S5.jsx("h1",{className:"font-medium",children:"The view needs your attention"}),S5.jsx("p",{className:"text-sm text-muted-foreground",children:$??"Open the chat to answer or ask the agent to continue"})]}),S5.jsxs("div",{className:"flex gap-2",children:[S5.jsx(j0,{onClick:J,children:"Open chat"}),S5.jsx(j0,{variant:"secondary",onClick:Z,children:"Discard view"})]})]})})}function HW0({controls:$}){let{hasStrokes:Z}=jB($);return S5.jsx(Kn,{children:!Z&&S5.jsx(J8,{className:"size-6 text-muted-foreground"})})}function Kn({children:$,className:Z}){return S5.jsx("div",{className:B0("relative flex min-h-0 flex-1 items-center justify-center texture-checker-20",Z),children:$})}var o4=P(m(),1);function Yn($,{activeId:Z,available:J,now:H}){let Q=[];if(Z!==null&&J.has(Z))Q.push({id:Z,releasedAt:null});for(let B of $){if(B.id===Z||!J.has(B.id))continue;let X=B.releasedAt??H;if(H-X>=60000)continue;if(Q.length>=4)break;Q.push({id:B.id,releasedAt:X})}return Q}function Fn($,Z){let J=null;for(let{releasedAt:H}of $){if(H===null)continue;let Q=H+60000;if(J===null||Q<J)J=Q}return J===null?null:Math.max(0,J-Z)}function Wn($,Z){return $.length===Z.length&&$.every((J,H)=>{let Q=Z[H];return J.id===Q.id&&J.releasedAt===Q.releasedAt})}var D2=P(c(),1),Nn=o4.memo(function({views:Z,activeViewId:J,params:H}){let Q=QW0(J,Z),B=new Set(Q.map((X)=>X.id));return D2.jsx("div",{className:B0("relative min-h-0 flex-1 overflow-hidden",!J&&"hidden"),children:Z.filter((X)=>B.has(X.id)).map((X)=>D2.jsx(BW0,{view:X,active:X.id===J,params:H},X.id))})});function QW0($,Z){let[J,H]=o4.useState([]),Q=K5(Z),B=Z.map((z)=>z.id).join(`
68
- `),X=o4.useCallback(()=>{H((z)=>{let G=Yn(z,{activeId:$,available:new Set(Q.current.map((U)=>U.id)),now:Date.now()});return Wn(z,G)?z:G})},[$,Q]);return o4.useEffect(()=>{X()},[B,X]),o4.useEffect(()=>{let z=Fn(J,Date.now());if(z===null)return;let G=setTimeout(X,z);return()=>clearTimeout(G)},[X,J]),J}function BW0({view:$,active:Z,params:J}){let H=e1(),Q=Ah($.id),{current:B,outgoing:X}=zW0(Q,Z),[z,G]=o4.useState(J);if(Z&&z!==J)G(J);Xq(LY("views",H,$.id),B?.version??Q.version,Z);let U=Q.status==="error";return hW({kind:"view",enabled:Z&&Boolean(B)&&!U,targets:[{id:$.id,revision:$.revision}]}),D2.jsxs(D2.Fragment,{children:[Z&&U&&D2.jsx("p",{className:"absolute inset-0 p-4 text-xs text-destructive",children:Q.error}),Z&&!U&&!B&&D2.jsx(GW0,{}),B&&!U&&D2.jsxs(o4.Activity,{mode:Z?"visible":"hidden",children:[X&&D2.jsx(qn,{view:$,build:X,params:z},X.version),D2.jsx(qn,{view:$,build:B,params:z,entering:X!==null,current:!0},B.version)]})]})}function qn({view:$,build:Z,params:J,entering:H,current:Q=!1}){let B=e1(),X=i6("views",$.id);return D2.jsx("div",{"data-applet-thumbnail":Q?X:void 0,"data-applet":X,className:B0("absolute inset-0 isolate",H&&"animate-in duration-200 ease-out blur-in-4 fade-in"),children:D2.jsx("div",{className:"size-full overflow-auto",children:D2.jsx(VX,{name:$.id,kind:"view",workspaceId:B,resetKey:Z.version,children:D2.jsx(DQ,{appletId:X,active:Q,children:D2.jsx(Z.Component,{params:J})})})})})}var XW0=200;function zW0($,Z){let[J,H]=o4.useState({current:null,outgoing:null});if($.status==="ready"&&J.current?.version!==$.version){let Q={Component:$.Component,version:$.version};H((B)=>({current:Q,outgoing:Z?B.current:null}))}return o4.useEffect(()=>{if(!J.outgoing)return;let Q=setTimeout(()=>H((B)=>({...B,outgoing:null})),XW0);return()=>clearTimeout(Q)},[J.outgoing]),J}function GW0(){return D2.jsx("div",{className:"absolute inset-0 flex animate-in items-center justify-center delay-150 duration-200 fill-mode-both fade-in",children:D2.jsx(J8,{className:"text-muted-foreground"})})}function An(){let $=U1(),{workspaceId:Z,layout:J}=i1(),[,H]=j6(),Q=M4(),B=i9(Z).data,X=fi(Z),z=mi(Z),G=ui(Z),U=pi(Z);return{create:()=>X.mutateAsync(),save:(q,N)=>z.mutateAsync({builderId:q,requirements:N}),submit:async(q,N)=>{let V=N.trim(),A=lq(Z,q.sessionId);if(!V&&A.length===0)return;rq({queryClient:$,workspaceId:Z,sessionId:q.sessionId,text:V,filenames:A.map((R)=>R.label)});let D=cq(A),L=[...D.parts];if(V)L.push({type:"text",text:V});let j=iq({queryClient:$,workspaceId:Z,sessionId:q.sessionId,parts:L});H(q.sessionId);let{model:M,effort:_,fastMode:E,stream:C}=aq(B,J.selectedModel,J.selectedEffort,J.selectedFastMode);try{await G.mutateAsync({builderId:q.id,requirements:V,optimisticId:j,selectedSessionScope:Q?"browser-tab":"shared",...A.length>0?{attachments:D.attachments}:{},model:M,effort:_,fastMode:E,stream:C}),b1.getState().clearAttachments(Z,q.sessionId)}catch(R){throw b1.getState().setActivity(Z,q.sessionId,"idle"),b1.getState().setError(Z,q.sessionId,R instanceof Error?R.message:"Could not start view builder"),R}},discard:(q)=>U.mutateAsync(q)}}var j7=P(m(),1);function Vn({builders:$,onSave:Z}){let J=j7.useRef(new Map),H=K5($),Q=K5(Z),B=j7.useCallback((z)=>{let G=J.current.get(z);if(G)clearTimeout(G);J.current.delete(z),w5.getState().setViewBuilderDraft(z,null)},[]),X=j7.useCallback((z,G)=>{w5.getState().setViewBuilderDraft(z,G);let U=J.current.get(z);if(U)clearTimeout(U);J.current.set(z,setTimeout(()=>{J.current.delete(z);let K=H.current.find((Y)=>Y.id===z);if(!K||K.status!=="draft")return;Q.current(z,G).catch(()=>{A5.add({title:"Couldn’t save view description",type:"error"})})},500))},[H,Q]);return j7.useEffect(()=>{for(let z of $)if(z.status!=="draft")B(z.id)},[$,B]),j7.useEffect(()=>()=>{for(let z of J.current.values())clearTimeout(z)},[]),{change:X,clear:B}}var SH=P(m(),1);function Gj($){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 Dn(){let $=SH.useRef(null),[Z,J]=SH.useState(null);return SH.useLayoutEffect(()=>{let H=$.current;if(!H)return;let Q=(X)=>{let z=Gj("--column-w"),G=Gj("--chat-min"),U=Gj("--chat-max"),K={fits:X-G>=z,workspaceMinWidth:z,chatMinWidth:G,chatMaxWidth:U};J((Y)=>Y?.fits===K.fits&&Y.workspaceMinWidth===K.workspaceMinWidth&&Y.chatMinWidth===K.chatMinWidth&&Y.chatMaxWidth===K.chatMaxWidth?Y:K)};Q(H.getBoundingClientRect().width);let B=()=>Q(H.getBoundingClientRect().width);return window.addEventListener("resize",B),()=>window.removeEventListener("resize",B)},[]),{ref:$,fits:Z?.fits??!1,constraints:Z?{workspaceMinWidth:Z.workspaceMinWidth,chatMinWidth:Z.chatMinWidth,chatMaxWidth:Z.chatMaxWidth}:null}}function Ln($,Z){if(Z)return{status:"disconnected"};return $??{status:"checking"}}var Mn=P(c(),1);function Uj({agentUnavailable:$,chatError:Z,skillUpdate:J}){return $??Z??J}function O7({className:$,...Z}){return Mn.jsx("div",{...Z,className:B0("w-full p-2 text-sm @xl:p-1 @xl:pl-3",$)})}var HZ=P(c(),1);function Kj({error:$,onDismiss:Z,onRetry:J}){return HZ.jsxs(O7,{role:"alert",className:"flex items-center gap-2 text-destructive",children:[HZ.jsx("span",{className:"flex-1 wrap-break-word",children:$}),J&&HZ.jsx(j0,{type:"button",variant:"ghost",size:"sm",onClick:J,children:"Retry"}),Z&&HZ.jsx(j0,{type:"button",variant:"ghost",size:"icon-sm",onClick:Z,className:"text-destructive hover:text-destructive","aria-label":"Dismiss error",children:HZ.jsx(o5,{stroke:1.75})})]})}var Yj=P(m(),1);var I4=P(c(),1);function Tn({availability:$,login:Z,onStartLogin:J}){switch($.status){case"login-required":return I4.jsx(UW0,{login:Z,onStartLogin:J});case"disconnected":return I4.jsx(Pn,{icon:On,children:"Reconnecting to moi…"});case"unavailable":return I4.jsx(Pn,{icon:_n,children:$.reason})}}function UW0({login:$,onStartLogin:Z}){let[J,H]=Yj.useState(!1),[Q,B]=Yj.useState(null),X=$?.state==="failed"?$.reason:null,z=Q??X,G=async()=>{let U=window.open("about:blank","moi-agent-login");if(U)U.opener=null;H(!0),B(null);try{let K=await Z();if(K.url){if(!U)throw Error("Allow pop-ups, then try again");U.location.href=K.url}else U?.close()}catch(K){U?.close(),B(K instanceof Error?K.message:"Could not start sign-in")}finally{H(!1)}};return I4.jsxs(O7,{role:"alert",className:"flex items-center gap-2",children:[I4.jsx(jn,{size:20,stroke:1.5}),I4.jsxs("div",{className:"min-w-0 flex-1 space-y-1",children:[I4.jsx("div",{className:"wrap-break-word",children:"Log in to your agent to send messages"}),z&&I4.jsx("div",{className:"wrap-break-word text-destructive",children:z})]}),I4.jsxs(j0,{type:"button",size:"sm",onClick:()=>void G(),disabled:J,children:[J&&I4.jsx(b5,{stroke:1.75,className:"animate-spin"}),"Log in"]})]})}function Pn({icon:$,children:Z}){return I4.jsxs(O7,{role:"alert",className:"flex items-center gap-2",children:[I4.jsx($,{size:20,stroke:1.5}),I4.jsx("div",{className:"min-w-0 flex-1 wrap-break-word",children:Z})]})}var d2=P(c(),1);function wn({error:$,pendingAction:Z,onUpdate:J,onDismiss:H}){if(!$&&Z==="auto")return d2.jsxs(O7,{role:"status",className:"flex items-center gap-1.5 text-muted-foreground",children:[d2.jsx(b5,{size:20,stroke:1.5,className:"shrink-0 animate-spin"}),d2.jsx("span",{className:"wrap-break-word",children:"Updating moi skills…"})]});let Q=Z!==null;return d2.jsxs(O7,{role:$?"alert":"status",className:B0("grid grid-cols-[minmax(0,1fr)_auto] gap-x-2 gap-y-2","@xl:flex @xl:items-center",$&&"text-destructive"),children:[d2.jsxs("div",{className:"flex min-w-0 items-start gap-1.5 @xl:order-1 @xl:flex-1 @xl:items-center",children:[d2.jsx(Cn,{size:20,stroke:1.5,className:"shrink-0"}),$?d2.jsx("span",{className:"wrap-break-word",children:`Update failed: ${$}`}):d2.jsx("span",{className:"wrap-break-word",children:"This workspace is using old moi skills"})]}),d2.jsx(j0,{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:d2.jsx(o5,{stroke:1.75})}),d2.jsxs("div",{className:"col-span-2 flex flex-wrap gap-1.5 @xl:contents",children:[d2.jsxs(j0,{type:"button",variant:"default",size:"sm",onClick:()=>J("auto"),disabled:Q,className:"@xl:order-2",children:[Z==="auto"&&d2.jsx(b5,{stroke:1.75,className:"animate-spin"}),Z==="auto"?"Updating…":"Auto-update"]}),d2.jsxs(j0,{type:"button",variant:"secondary",size:"sm",onClick:()=>J("once"),disabled:Q,className:"@xl:order-3",children:[Z==="once"&&d2.jsx(b5,{stroke:1.75,className:"animate-spin"}),Z==="once"?"Updating…":"Update once"]})]})]})}var T7=P(m(),1);function Fj($){return{workspaceId:$,phase:"idle",pendingAction:null,error:null}}function KW0($){return $.phase==="active"||$.phase==="idle"&&$.updateAvailable&&!$.autoUpdateEnabled}function YW0($){return $.updateAvailable&&$.autoUpdateEnabled&&!$.updatePending&&$.phase==="idle"}function En($){let Z=_h($),{isPending:J,mutate:H,reset:Q}=jh($),B=_i(),{mutate:X}=ji(),z=B.data!==void 0,G=B.data?.autoUpdateSkills??!1,U=T7.useCallback(()=>X({autoUpdateSkills:!0}),[X]),[K,Y]=T7.useState(()=>Fj($)),F=K.workspaceId===$?K:Fj($);T7.useEffect(()=>{Y(Fj($)),Q()},[$,Q]);let W=T7.useCallback((V)=>{if(J)return;if(V==="auto")U();Y({workspaceId:$,phase:"active",pendingAction:V,error:null}),H(void 0,{onSuccess:()=>{Y((A)=>A.workspaceId===$?{...A,phase:"dismissed",pendingAction:null,error:null}:A)},onError:(A)=>{Y((D)=>D.workspaceId===$&&D.phase!=="dismissed"?{...D,phase:"active",pendingAction:null,error:A.message}:D)}})},[U,J,H,$]),q=Z.data?.updateAvailable??!1;return T7.useEffect(()=>{if(z&&YW0({updateAvailable:q,autoUpdateEnabled:G,updatePending:J,phase:F.phase}))W("auto")},[G,F.phase,W,z,q,J]),{bannerProps:z&&KW0({updateAvailable:q,autoUpdateEnabled:G,phase:F.phase})?{error:F.error,pendingAction:F.pendingAction,onUpdate:W,onDismiss:()=>{Y((V)=>V.workspaceId===$?{...V,phase:"dismissed",pendingAction:null,error:null}:V)}}:null}}var vX=P(c(),1);function Sn($,{chatError:Z,onDismissChatError:J,chatLoadError:H,onRetryChatLoad:Q}){let{data:B,error:X}=i9($),z=B?.availability,{bannerProps:G}=En($),U=Ln(z,Boolean(X)),K=U.status==="checking"||U.status==="available"?void 0:U,Y=K?{tone:"default",content:vX.jsx(Tn,{availability:K,login:B?.login,onStartLogin:()=>Ph($)})}:void 0,F;if(H)F={tone:"error",content:vX.jsx(Kj,{error:H,onRetry:Q})};else if(Z)F={tone:"error",content:vX.jsx(Kj,{error:Z,onDismiss:J})};let W=G?{tone:"default",content:vX.jsx(wn,{...G})}:void 0,q=Uj({agentUnavailable:Y,chatError:F,skillUpdate:W}),N=Uj({agentUnavailable:Y,skillUpdate:W});return{agentAvailability:U,composerBanner:q,builderComposerBanner:N}}var FW0=PY();function gX($){return _Y($)}function C7($,Z,J){if($==="agent"||$==="overview"||$==="scratchpad")return!0;let H=Q$($);if(H)return J.some((B)=>B.id===H);let Q=AQ($);return Q?Z.some((B)=>B.id===Q):!1}function fX($,Z,J){let H=$.open.filter((Q)=>C7(Q,Z,J));return H.length>0?H:FW0.open}function Rn($,Z,J,H,Q){if($!==null&&!(Q&&$==="agent"))return $;let B=fX(Z,J,H),X=Q?B.filter((z)=>z!=="agent"):B;return X.includes(Z.active)?Z.active:X[0]??"overview"}var Y8=P(m(),1);var oq=P(m(),1);var In=($)=>`moi:collab:${$}:tabs`;function WW0($,Z){try{let J=sessionStorage.getItem(In($));return J?_Y(JSON.parse(J)):Z}catch{return Z}}function qW0($,Z){try{sessionStorage.setItem(In($),JSON.stringify(Z))}catch{}}function kn($,Z,J){let[H,Q]=oq.useState(()=>Z?WW0($,J):J),B=oq.useCallback((X)=>{Q(X),qW0($,X)},[$]);return[Z?H:J,B]}var bn=new Map;function xn({views:$,builders:Z,split:J}){let{layout:H,setLayout:Q,workspaceId:B}=i1(),X=M4(),[,z]=W8(),G=i2(),{base:U}=G,K=b7(G).slice(o8(B,U).length+1),Y=VQ(Bz(G)),F=Y8.useMemo(()=>VE(Y),[Y]),[W,q]=kn(B,X,gX(H.tabs)),N=gX(W),V=K5(N),A=Y8.useMemo(()=>{let S=bn.get(B);if(!S)bn.set(B,S=new Map);return S},[B]),D=_3(K),L=D?null:RG(K),j=Rn(D??L,N,$,Z,J),M=Boolean(K)&&!L&&(!D||!C7(D,$,Z)),_=D===j&&!M,E=Y8.useCallback((S)=>{if(V.current=S,X)q(S);else Q({tabs:S})},[Q,V,X,q]),C=Y8.useCallback((S,O={})=>{let b=window.location.pathname+VQ(window.location.search),k=`${U}${S}`;if(b!==k||window.location.hash)z(S,O)},[U,z]),R=Y8.useCallback((S,O={})=>{C(A.get(S)??gZ(B,{tab:S,search:""}),O)},[C,A,B]),T=Y8.useCallback((S)=>{let O=B$(S,{apiBase:`/api/workspaces/${encodeURIComponent(B)}`,workspacePath:o8(B)});if(S.startsWith("moi:/files/")||!S.startsWith("moi:")){window.location.assign(O);return}let b=rA(S);if(!C7(b.tab,$,Z))throw Error("This destination is unavailable in this workspace");C(O)},[Z,C,$,B]),I=Y8.useCallback((S)=>{let O=S instanceof Error?S.message:"Navigation failed";A5.add({type:"error",title:"Could not navigate",description:O}),Z8(B,{source:"runtime",message:O})},[B]);VY(B,"navigate",(S)=>{try{T(S)}catch(O){I(O)}}),yn(B,T),Y8.useEffect(()=>{if(M)return;if(L)C(gZ(B,{tab:L,search:Y}),{replace:!0});else if(!K||D==="agent"&&J)R(j,{replace:!0})},[j,C,L,R,K,D,Y,J,M,B]),Y8.useEffect(()=>{if(!_)return;A.set(j,gZ(B,{tab:j,search:Y}));let S=V.current,O=S.open.includes(j)?S.open:[...S.open,j];if(O!==S.open||S.active!==j)E({open:O,active:j})},[j,_,A,Y,E,V,B]);let y=Y8.useCallback((S)=>{if(S.defaultPrevented||S.button!==0||S.metaKey||S.ctrlKey||S.altKey||S.shiftKey)return;let O=S.target instanceof Element?S.target.closest("a[href]"):null;if(!(O instanceof HTMLAnchorElement)||O.hasAttribute("download")||O.target&&O.target!=="_self")return;let b=new URL(O.href),k=o8(B,U)+"/";if(b.origin!==window.location.origin||!b.pathname.startsWith(k))return;if(b.hash)return;let h=_3(b.pathname.slice(k.length));if(!h)return;S.preventDefault();try{if(!C7(h,$,Z))throw Error("This destination is unavailable in this workspace");C(gZ(B,{tab:h,search:VQ(b.search)}))}catch(v){I(v)}},[U,Z,C,I,$,B]);return{tabsState:N,activeTab:j,appletParams:F,navigateToTab:R,setTabs:E,isUnavailable:M,onNavigationClick:y}}var x5=P(c(),1),NW0=JJ([A$({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 AW0({items:$}){return x5.jsxs(o9,{children:[x5.jsx(n9,{render:x5.jsx(j0,{type:"button",variant:"ghost",size:"icon-sm",className:"text-muted-foreground","aria-label":"Create tab",children:x5.jsx(f2,{stroke:1.75})})}),x5.jsx(s9,{align:"start",className:"min-w-48",children:x5.jsx(J7,{children:$.map((Z)=>x5.jsxs(H9,{onClick:Z.onClick,className:"font-medium",children:[x5.jsx(Z.Icon,{stroke:2}),Z.label]},Z.key))})})]})}function hn($){let{tab:Z,active:J}=$,H=$.preview===!0;return x5.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:NW0({active:J,dragging:$.preview?!1:$.state.isDragging,preview:H}),...$.preview?{}:$.state.dragHandleProps,children:[x5.jsxs("div",{className:B0("flex items-center gap-1 overflow-hidden select-none",Z.closable&&"group-hover/tab:mr-3"),children:[Z.loading?x5.jsx(J8,{"data-icon":"inline-start",className:"shrink-0"}):x5.jsx(Z.Icon,{"data-icon":"inline-start",stroke:2,className:"size-4 shrink-0"}),x5.jsx("span",{className:B0("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&&x5.jsx("div",{"aria-label":`Close ${Z.label}`,tabIndex:H?-1:void 0,className:B0("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:(Q)=>{Q.stopPropagation(),$.onClose(Z.key)},children:x5.jsx(o5,{stroke:1.75,className:"size-4 shrink-0"})})]})}function vn({tabs:$,active:Z,createItems:J,onSelect:H,onClose:Q,onReorder:B}){return x5.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-1",children:[x5.jsx("div",{className:"no-scrollbar min-w-0 scroll-fade-x overflow-x-auto overflow-y-hidden [--scroll-fade-reveal:16px]",children:x5.jsx(aK,{items:$,getId:(X)=>X.key,isItemDragDisabled:(X)=>X.reorderable===!1,className:"flex w-max items-center gap-1",onReorder:(X)=>B(X),renderPlaceholder:()=>x5.jsx("div",{className:"pointer-events-none absolute inset-0 rounded-md bg-muted"}),renderOverlay:(X)=>x5.jsx(hn,{tab:X,active:Z===X.key,preview:!0}),renderItem:(X,z)=>x5.jsx(hn,{tab:X,active:Z===X.key,state:z,onSelect:H,onClose:Q})})}),x5.jsx("div",{className:"shrink-0",children:x5.jsx(AW0,{items:J})})]})}var R7=P(m(),1);var yH=P(c(),1),I1=P(m(),1);function VW0($,Z){let J=getComputedStyle($),H=parseFloat(J.fontSize);return Z*H}function DW0($,Z){let J=getComputedStyle($.ownerDocument.documentElement),H=parseFloat(J.fontSize);return Z*H}function LW0($){return $/100*window.innerHeight}function MW0($){return $/100*window.innerWidth}function PW0($){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 mX({groupSize:$,panelElement:Z,styleProp:J}){let H,[Q,B]=PW0(J);switch(B){case"%":{H=Q/100*$;break}case"px":{H=Q;break}case"rem":{H=DW0(Z,Q);break}case"em":{H=VW0(Z,Q);break}case"vh":{H=LW0(Q);break}case"vw":{H=MW0(Q);break}}return H}function k4($){return parseFloat($.toFixed(3))}function xH({group:$}){let{orientation:Z,panels:J}=$;return J.reduce((H,Q)=>(H+=Z==="horizontal"?Q.element.offsetWidth:Q.element.offsetHeight,H),0)}function qj($){let{panels:Z}=$,J=xH({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:Q,panelConstraints:B}=H,X=0;if(B.collapsedSize!==void 0){let K=mX({groupSize:J,panelElement:Q,styleProp:B.collapsedSize});X=k4(K/J*100)}let z;if(B.defaultSize!==void 0){let K=mX({groupSize:J,panelElement:Q,styleProp:B.defaultSize});z=k4(K/J*100)}let G=0;if(B.minSize!==void 0){let K=mX({groupSize:J,panelElement:Q,styleProp:B.minSize});G=k4(K/J*100)}let U=100;if(B.maxSize!==void 0){let K=mX({groupSize:J,panelElement:Q,styleProp:B.maxSize});U=k4(K/J*100)}return{groupResizeBehavior:B.groupResizeBehavior,collapsedSize:X,collapsible:B.collapsible===!0,defaultSize:z,disabled:B.disabled,minSize:G,maxSize:U,panelId:H.id}})}function j5($,Z="Assertion error"){if(!$)throw Error(Z)}function Nj($,Z){return Array.from(Z).sort($==="horizontal"?_W0:jW0)}function _W0($,Z){let J=$.element.offsetLeft-Z.element.offsetLeft;return J!==0?J:$.element.offsetWidth-Z.element.offsetWidth}function jW0($,Z){let J=$.element.offsetTop-Z.element.offsetTop;return J!==0?J:$.element.offsetHeight-Z.element.offsetHeight}function Js($){return $!==null&&typeof $=="object"&&"nodeType"in $&&$.nodeType===Node.ELEMENT_NODE}function Hs($,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 OW0({orientation:$,rects:Z,targetRect:J}){let H={x:J.x+J.width/2,y:J.y+J.height/2},Q,B=Number.MAX_VALUE;for(let X of Z){let{x:z,y:G}=Hs(H,X),U=$==="horizontal"?z:G;U<B&&(B=U,Q=X)}return j5(Q,"No rect found"),Q}var nq;function TW0(){return nq===void 0&&(typeof matchMedia=="function"?nq=!!matchMedia("(pointer:coarse)").matches:nq=!1),nq}function Qs($){let{element:Z,orientation:J,panels:H,separators:Q}=$,B=Nj(J,Array.from(Z.children).filter(Js).map((q)=>({element:q}))).map(({element:q})=>q),X=[],z=!1,G=!1,U=-1,K=-1,Y=0,F,W=[];{let q=-1;for(let N of B)N.hasAttribute("data-panel")&&(q++,N.hasAttribute("data-disabled")||(Y++,U===-1&&(U=q),K=q))}if(Y>1){let q=-1;for(let N of B)if(N.hasAttribute("data-panel")){q++;let V=H.find((A)=>A.element===N);if(V){if(F){let A=F.element.getBoundingClientRect(),D=N.getBoundingClientRect(),L;if(G){let j=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(D.left,D.top,0,D.height):new DOMRect(D.left,D.top,D.width,0);switch(W.length){case 0:{L=[j,M];break}case 1:{let _=W[0],E=OW0({orientation:J,rects:[A,D],targetRect:_.element.getBoundingClientRect()});L=[_,E===A?M:j];break}default:{L=W;break}}}else W.length?L=W:L=[J==="horizontal"?new DOMRect(A.right,D.top,D.left-A.right,D.height):new DOMRect(D.left,A.bottom,D.width,D.top-A.bottom)];for(let j of L){let M="width"in j?j:j.element.getBoundingClientRect(),_=TW0()?$.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 E=q<=U||q>K;!z&&!E&&X.push({group:$,groupSize:xH({group:$}),panels:[F,V],separator:"width"in j?void 0:j,rect:M}),z=!1}}G=!1,F=V,W=[]}}else if(N.hasAttribute("data-separator")){N.ariaDisabled!==null&&(z=!0);let V=Q.find((A)=>A.element===N);V?W.push(V):(F=void 0,W=[])}else G=!0}return X}class Aj{#$={};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,Q=null,B=Array.from(J);for(let X=0;X<B.length;X++){let z=B[X];try{z.call(null,Z)}catch(G){Q===null&&(H=!0,Q=G)}}if(H)throw Q}}removeAllListeners(){this.#$={}}removeListener($,Z){let J=this.#$[$];if(J!==void 0){let H=J.indexOf(Z);H>=0&&J.splice(H,1)}}}var kH={cursorFlags:0,state:"inactive"},Vj=new Aj;function BZ(){return kH}function CW0($){return Vj.addListener("change",$)}function wW0($){let Z=kH,J={...kH};J.cursorFlags=$,kH=J,Vj.emit("change",{prev:Z,next:J})}function bH($){let Z=kH;kH=$,Vj.emit("change",{prev:Z,next:$})}var EW0=($)=>$,Wj=()=>{},Bs=1,Xs=2,zs=4,Gs=8,gn=3,fn=12,sq;function mn(){return sq===void 0&&(sq=!1,typeof window<"u"&&(window.navigator.userAgent.includes("Chrome")||window.navigator.userAgent.includes("Firefox"))&&(sq=!0)),sq}function SW0({cursorFlags:$,groups:Z,state:J}){let H=0,Q=0;switch(J){case"active":case"hover":Z.forEach((B)=>{if(!B.mutableState.disableCursor)switch(B.orientation){case"horizontal":{H++;break}case"vertical":{Q++;break}}})}if(!(H===0&&Q===0)){switch(J){case"active":{if($&&mn()){let B=($&Bs)!==0,X=($&Xs)!==0,z=($&zs)!==0,G=($&Gs)!==0;if(B)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 mn()?H>0&&Q>0?"move":H>0?"ew-resize":"ns-resize":H>0&&Q>0?"grab":H>0?"col-resize":"row-resize"}}var un=new WeakMap;function Dj($){if(!$.defaultView||!$.adoptedStyleSheets)return;let{prevStyle:Z,styleSheet:J}=un.get($)??{};J===void 0&&(J=new $.defaultView.CSSStyleSheet,$.adoptedStyleSheets&&(Object.isExtensible($.adoptedStyleSheets)?$.adoptedStyleSheets.push(J):$.adoptedStyleSheets=[...$.adoptedStyleSheets,J]));let H=BZ();switch(H.state){case"active":case"hover":{let Q=SW0({cursorFlags:H.cursorFlags,groups:H.hitRegions.map((X)=>X.group),state:H.state}),B=`*, *:hover {cursor: ${Q} !important; }`;if(Z===B)return;Z=B,Q?J.cssRules.length===0?J.insertRule(B):J.replaceSync(B):J.cssRules.length===1&&J.deleteRule(0);break}case"inactive":{Z=void 0,J.cssRules.length===1&&J.deleteRule(0);break}}un.set($,{prevStyle:Z,styleSheet:J})}var G3=new Map,Us=new Aj;function RW0($){G3=new Map(G3),G3.delete($)}function pn($,Z){for(let[J]of G3)if(J.id===$)return J}function w7($,Z){for(let[J,H]of G3)if(J.id===$)return H;if(Z)throw Error(`Could not find data for Group with id ${$}`)}function E7(){return G3}function Lj($,Z){return Us.addListener("groupChange",(J)=>{J.group.id===$&&Z(J)})}function d3($,Z,J){let H=G3.get($);G3=new Map(G3),G3.set($,Z),Us.emit("groupChange",{group:$,isUserInteraction:J?.isUserInteraction===!0,prev:H,next:Z})}function Ks($){let Z=BZ(),J=E7(),H=!1;switch(Z.state){case"active":bH({cursorFlags:0,state:"inactive"}),Z.hitRegions.length>0&&(Dj($),H=!0,Z.hitRegions.forEach((Q)=>{if(!J.has(Q.group))return;let B=w7(Q.group.id,!0);d3(Q.group,B,{isUserInteraction:!0})}))}return H}function cn($){$.defaultPrevented||Ks($.currentTarget)}function IW0($,Z,J){let H,Q={x:1/0,y:1/0};for(let B of Z){let X=Hs(J,B.rect);switch($){case"horizontal":{X.x<=Q.x&&(H=B,Q=X);break}case"vertical":{X.y<=Q.y&&(H=B,Q=X);break}}}return H?{distance:Q,hitRegion:H}:void 0}function kW0($){return $!==null&&typeof $=="object"&&"nodeType"in $&&$.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function bW0($,Z){if($===Z)throw Error("Cannot compare node with itself");let J={a:rn($),b:rn(Z)},H;for(;J.a.at(-1)===J.b.at(-1);)H=J.a.pop(),J.b.pop();j5(H,"Stacking order can only be calculated for elements with a common ancestor");let Q={a:ln(dn(J.a)),b:ln(dn(J.b))};if(Q.a===Q.b){let B=H.childNodes,X={a:J.a.at(-1),b:J.b.at(-1)},z=B.length;for(;z--;){let G=B[z];if(G===X.a)return 1;if(G===X.b)return-1}}return Math.sign(Q.a-Q.b)}var yW0=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function xW0($){let Z=getComputedStyle(Ys($)??$).display;return Z==="flex"||Z==="inline-flex"}function hW0($){let Z=getComputedStyle($);return!!(Z.position==="fixed"||Z.zIndex!=="auto"&&(Z.position!=="static"||xW0($))||+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"||yW0.test(Z.willChange)||Z.webkitOverflowScrolling==="touch")}function dn($){let Z=$.length;for(;Z--;){let J=$[Z];if(j5(J,"Missing node"),hW0(J))return J}return null}function ln($){return $&&Number(getComputedStyle($).zIndex)||0}function rn($){let Z=[];for(;$;)Z.push($),$=Ys($);return Z}function Ys($){let{parentNode:Z}=$;return kW0(Z)?Z.host:Z}function vW0($,Z){return $.x<Z.x+Z.width&&$.x+$.width>Z.x&&$.y<Z.y+Z.height&&$.y+$.height>Z.y}function gW0({groupElement:$,hitRegion:Z,pointerEventTarget:J}){if(!Js(J)||J.contains($)||$.contains(J))return!0;if(bW0(J,$)>0){let H=J;for(;H;){if(H.contains($))return!0;if(vW0(H.getBoundingClientRect(),Z))return!1;H=H.parentElement}}return!0}function Mj($,Z){let J=[];return Z.forEach((H,Q)=>{if(Q.disabled)return;let B=Qs(Q),X=IW0(Q.orientation,B,{x:$.clientX,y:$.clientY});X&&X.distance.x<=0&&X.distance.y<=0&&gW0({groupElement:Q.element,hitRegion:X.hitRegion.rect,pointerEventTarget:$.target})&&J.push(X.hitRegion)}),J}function fW0($,Z){if($.length!==Z.length)return!1;for(let J=0;J<$.length;J++)if($[J]!=Z[J])return!1;return!0}function q4($,Z,J=0){return Math.abs(k4($)-k4(Z))<=J}function z3($,Z){return q4($,Z)?0:$>Z?1:-1}function IH({overrideDisabledPanels:$,panelConstraints:Z,prevSize:J,size:H}){let{collapsedSize:Q=0,collapsible:B,disabled:X,maxSize:z=100,minSize:G=0}=Z;if(X&&!$)return J;if(z3(H,G)<0)if(B){let U=(Q+G)/2;z3(H,U)<0?H=Q:H=G}else H=G;return H=Math.min(z,H),H=k4(H),H}function pX({delta:$,initialLayout:Z,panelConstraints:J,pivotIndices:H,prevLayout:Q,trigger:B}){if(q4($,0))return Z;let X=B==="imperative-api",z=Object.values(Z),G=Object.values(Q),U=[...z],[K,Y]=H;j5(K!=null,"Invalid first pivot index"),j5(Y!=null,"Invalid second pivot index");let F=0;switch(B){case"keyboard":{{let N=$<0?Y:K,V=J[N];j5(V,`Panel constraints not found for index ${N}`);let{collapsedSize:A=0,collapsible:D,minSize:L=0}=V;if(D){let j=z[N];if(j5(j!=null,`Previous layout not found for panel index ${N}`),q4(j,A)){let M=L-j;z3(M,Math.abs($))>0&&($=$<0?0-M:M)}}}{let N=$<0?K:Y,V=J[N];j5(V,`No panel constraints found for index ${N}`);let{collapsedSize:A=0,collapsible:D,minSize:L=0}=V;if(D){let j=z[N];if(j5(j!=null,`Previous layout not found for panel index ${N}`),q4(j,L)){let M=j-A;z3(M,Math.abs($))>0&&($=$<0?0-M:M)}}}break}default:{let N=$<0?Y:K,V=J[N];j5(V,`Panel constraints not found for index ${N}`);let A=z[N],{collapsible:D,collapsedSize:L,minSize:j}=V;if(D&&z3(A,j)<0)if($>0){let M=j-L,_=M/2,E=A+$;z3(E,j)<0&&($=z3($,_)<=0?0:M)}else{let M=j-L,_=100-M/2,E=A-$;z3(E,j)<0&&($=z3(100+$,_)>0?0:-M)}break}}{let N=$<0?1:-1,V=$<0?Y:K,A=0;for(;;){let L=z[V];j5(L!=null,`Previous layout not found for panel index ${V}`);let j=IH({overrideDisabledPanels:X,panelConstraints:J[V],prevSize:L,size:100})-L;if(A+=j,V+=N,V<0||V>=J.length)break}let D=Math.min(Math.abs($),Math.abs(A));$=$<0?0-D:D}{let N=$<0?K:Y;for(;N>=0&&N<J.length;){let V=Math.abs($)-Math.abs(F),A=z[N];j5(A!=null,`Previous layout not found for panel index ${N}`);let D=A-V,L=IH({overrideDisabledPanels:X,panelConstraints:J[N],prevSize:A,size:D});if(!q4(A,L)&&(F+=A-L,U[N]=L,F.toFixed(3).localeCompare(Math.abs($).toFixed(3),void 0,{numeric:!0})>=0))break;$<0?N--:N++}}if(fW0(G,U))return Q;{let N=$<0?Y:K,V=z[N];j5(V!=null,`Previous layout not found for panel index ${N}`);let A=V+F,D=IH({overrideDisabledPanels:X,panelConstraints:J[N],prevSize:V,size:A});if(U[N]=D,!q4(D,A)){let L=A-D,j=$<0?Y:K;for(;j>=0&&j<J.length;){let M=U[j];j5(M!=null,`Previous layout not found for panel index ${j}`);let _=M+L,E=IH({overrideDisabledPanels:X,panelConstraints:J[j],prevSize:M,size:_});if(q4(M,E)||(L-=E-M,U[j]=E),q4(L,0))break;$>0?j--:j++}}}let W=Object.values(U).reduce((N,V)=>V+N,0);if(!q4(W,100,0.1))return Q;let q=Object.keys(Q);return U.reduce((N,V,A)=>(N[q[A]]=V,N),{})}function XZ($,Z){if(Object.keys($).length!==Object.keys(Z).length)return!1;for(let J in $)if(Z[J]===void 0||z3($[J],Z[J])!==0)return!1;return!0}function zZ({layout:$,panelConstraints:Z}){let J=Object.values($),H=[...J],Q=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(!q4(Q,100)&&H.length>0)for(let z=0;z<Z.length;z++){let G=H[z];j5(G!=null,`No layout data found for index ${z}`);let U=100/Q*G;H[z]=U}let B=0;for(let z=0;z<Z.length;z++){let G=J[z];j5(G!=null,`No layout data found for index ${z}`);let U=H[z];j5(U!=null,`No layout data found for index ${z}`);let K=IH({overrideDisabledPanels:!0,panelConstraints:Z[z],prevSize:G,size:U});U!=K&&(B+=U-K,H[z]=K)}if(!q4(B,0))for(let z=0;z<Z.length;z++){let G=H[z];j5(G!=null,`No layout data found for index ${z}`);let U=G+B,K=IH({overrideDisabledPanels:!0,panelConstraints:Z[z],prevSize:G,size:U});if(G!==K&&(B-=K-G,H[z]=K,q4(B,0)))break}let X=Object.keys($);return H.reduce((z,G,U)=>(z[X[U]]=G,z),{})}function Fs({groupId:$,panelId:Z}){let J=()=>{let G=E7();for(let[U,{defaultLayoutDeferred:K,derivedPanelConstraints:Y,layout:F,groupSize:W,separatorToPanels:q}]of G)if(U.id===$)return{defaultLayoutDeferred:K,derivedPanelConstraints:Y,group:U,groupSize:W,layout:F,separatorToPanels:q};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}`)},Q=()=>{let G=J().group.panels.find((U)=>U.id===Z);if(G!==void 0)return G;throw Error(`Layout not found for Panel ${Z}`)},B=()=>{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:K,derivedPanelConstraints:Y})=>{let F=B(),W=U.findIndex((V)=>V.id===Z),q=W===0,N=W===U.length-1;if(N&&G<F&&(q||U.slice(0,W).every((V,A)=>{let D=Y[A];return D?.collapsible&&q4(D.collapsedSize,K[D.panelId])}))){let V=U.slice(0,W).reduce((A,D)=>A+K[D.id],0);return{...K,[Z]:k4(100-V)}}return pX({delta:N?F-G:G-F,initialLayout:K,panelConstraints:Y,pivotIndices:N?[W-1,W]:[W,W+1],prevLayout:K,trigger:"imperative-api"})},z=(G)=>{let U=B();if(G===U)return;let{defaultLayoutDeferred:K,derivedPanelConstraints:Y,group:F,groupSize:W,layout:q,separatorToPanels:N}=J(),V=X({nextSize:G,panels:F.panels,prevLayout:q,derivedPanelConstraints:Y}),A=zZ({layout:V,panelConstraints:Y});XZ(q,A)||d3(F,{defaultLayoutDeferred:K,derivedPanelConstraints:Y,groupSize:W,layout:A,separatorToPanels:N})};return{collapse:()=>{let{collapsible:G,collapsedSize:U}=H(),{mutableValues:K}=Q(),Y=B();G&&Y!==U&&(K.expandToSize=Y,z(U))},expand:()=>{let{collapsible:G,collapsedSize:U,minSize:K}=H(),{mutableValues:Y}=Q(),F=B();if(G&&F===U){let W=Y.expandToSize??K;W===0&&(W=1),z(W)}},getSize:()=>{let{group:G}=J(),U=B(),{element:K}=Q(),Y=G.orientation==="horizontal"?K.offsetWidth:K.offsetHeight;return{asPercentage:U,inPixels:Y}},isCollapsed:()=>{let{collapsible:G,collapsedSize:U}=H(),K=B();return G&&q4(U,K)},resize:(G)=>{let{group:U}=J(),{element:K}=Q(),Y=xH({group:U}),F=mX({groupSize:Y,panelElement:K,styleProp:G}),W=k4(F/Y*100);z(W)}}}function an($){if($.defaultPrevented)return;let Z=E7();Mj($,Z).forEach((J)=>{if(J.separator&&!J.separator.disableDoubleClick){let H=J.panels.find((Q)=>Q.panelConstraints.defaultSize!==void 0);if(H){let Q=H.panelConstraints.defaultSize,B=Fs({groupId:J.group.id,panelId:H.id});B&&Q!==void 0&&(B.resize(Q),$.preventDefault())}}})}function tq($){let Z=E7();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 Ws({groupId:$}){let Z=()=>{let J=E7();for(let[H,Q]of J)if(H.id===$)return{group:H,...Q};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:Q,group:B,groupSize:X,layout:z,separatorToPanels:G}=Z(),U=zZ({layout:J,panelConstraints:Q});return H?z:(XZ(z,U)||d3(B,{defaultLayoutDeferred:H,derivedPanelConstraints:Q,groupSize:X,layout:U,separatorToPanels:G}),U)}}}function QZ($,Z){let J=tq($),H=w7(J.id,!0),Q=J.separators.find((K)=>K.element===$);j5(Q,"Matching separator not found");let B=H.separatorToPanels.get(Q);j5(B,"Matching panels not found");let X=B.map((K)=>J.panels.indexOf(K)),z=Ws({groupId:J.id}).getLayout(),G=pX({delta:Z,initialLayout:z,panelConstraints:H.derivedPanelConstraints,pivotIndices:X,prevLayout:z,trigger:"keyboard"}),U=zZ({layout:G,panelConstraints:H.derivedPanelConstraints});XZ(z,U)||d3(J,{defaultLayoutDeferred:H.defaultLayoutDeferred,derivedPanelConstraints:H.derivedPanelConstraints,groupSize:H.groupSize,layout:U,separatorToPanels:H.separatorToPanels},{isUserInteraction:!0})}function on($){if($.defaultPrevented)return;let Z=$.currentTarget,J=tq(Z);if(!J.disabled)switch($.key){case"ArrowDown":{$.preventDefault(),J.orientation==="vertical"&&QZ(Z,5);break}case"ArrowLeft":{$.preventDefault(),J.orientation==="horizontal"&&QZ(Z,-5);break}case"ArrowRight":{$.preventDefault(),J.orientation==="horizontal"&&QZ(Z,5);break}case"ArrowUp":{$.preventDefault(),J.orientation==="vertical"&&QZ(Z,-5);break}case"End":{$.preventDefault(),QZ(Z,100);break}case"Enter":{$.preventDefault();let H=tq(Z),Q=w7(H.id,!0),{derivedPanelConstraints:B,layout:X,separatorToPanels:z}=Q,G=H.separators.find((F)=>F.element===Z);j5(G,"Matching separator not found");let U=z.get(G);j5(U,"Matching panels not found");let K=U[0],Y=B.find((F)=>F.panelId===K.id);if(j5(Y,"Panel metadata not found"),Y.collapsible){let F=X[K.id],W=Y.collapsedSize===F?H.mutableState.expandedPanelSizes[K.id]??Y.minSize:Y.collapsedSize;QZ(Z,W-F)}break}case"F6":{$.preventDefault();let H=tq(Z).separators.map((X)=>X.element),Q=Array.from(H).findIndex((X)=>X===$.currentTarget);j5(Q!==null,"Index not found");let B=$.shiftKey?Q>0?Q-1:H.length-1:Q+1<H.length?Q+1:0;H[B].focus({preventScroll:!0});break}case"Home":{$.preventDefault(),QZ(Z,-100);break}}}function nn($){if($.defaultPrevented)return;if($.pointerType==="mouse"&&$.button>0)return;let Z=E7(),J=Mj($,Z),H=new Map,Q=!1;J.forEach((B)=>{B.separator&&(Q||(Q=!0,B.separator.element.focus({focusVisible:!1,preventScroll:!0})));let X=Z.get(B.group);X&&H.set(B.group,X.layout)}),bH({cursorFlags:0,hitRegions:J,initialLayoutMap:H,pointerDownAtPoint:{x:$.clientX,y:$.clientY},state:"active"}),J.length&&$.preventDefault()}function qs({document:$,event:Z,hitRegions:J,initialLayoutMap:H,mountedGroups:Q,pointerDownAtPoint:B,prevCursorFlags:X}){let z=0;J.forEach((U)=>{let{group:K,groupSize:Y}=U,{orientation:F,panels:W}=K,{disableCursor:q}=K.mutableState,N=0;B?F==="horizontal"?N=(Z.clientX-B.x)/Y*100:N=(Z.clientY-B.y)/Y*100:F==="horizontal"?N=Z.clientX<0?-100:100:N=Z.clientY<0?-100:100;let V=H.get(K),A=Q.get(K);if(!V||!A)return;let{defaultLayoutDeferred:D,derivedPanelConstraints:L,groupSize:j,layout:M,separatorToPanels:_}=A;if(L&&M&&_){let E=pX({delta:N,initialLayout:V,panelConstraints:L,pivotIndices:U.panels.map((C)=>W.indexOf(C)),prevLayout:M,trigger:"mouse-or-touch"});if(XZ(E,M)){if(N!==0&&!q)switch(F){case"horizontal":{z|=N<0?Bs:Xs;break}case"vertical":{z|=N<0?zs:Gs;break}}}else d3(U.group,{defaultLayoutDeferred:D,derivedPanelConstraints:L,groupSize:j,layout:E,separatorToPanels:_})}});let G=0;Z.movementX===0?G|=X&gn:G|=z&gn,Z.movementY===0?G|=X&fn:G|=z&fn,wW0(G),Dj($)}function sn($){let Z=E7(),J=BZ();switch(J.state){case"active":qs({document:$.currentTarget,event:$,hitRegions:J.hitRegions,initialLayoutMap:J.initialLayoutMap,mountedGroups:Z,prevCursorFlags:J.cursorFlags})}}function tn($){if($.defaultPrevented)return;let Z=BZ(),J=E7();switch(Z.state){case"active":{if($.buttons===0){bH({cursorFlags:0,state:"inactive"}),Z.hitRegions.forEach((H)=>{if(!J.has(H.group))return;let Q=w7(H.group.id,!0);d3(H.group,Q,{isUserInteraction:!0})});return}for(let H of Z.hitRegions)if(H.separator){let{element:Q}=H.separator;Q.isConnected&&!Q.hasPointerCapture?.($.pointerId)&&Q.setPointerCapture?.($.pointerId)}qs({document:$.currentTarget,event:$,hitRegions:Z.hitRegions,initialLayoutMap:Z.initialLayoutMap,mountedGroups:J,pointerDownAtPoint:Z.pointerDownAtPoint,prevCursorFlags:Z.cursorFlags});break}default:{let H=Mj($,J);H.length===0?Z.state!=="inactive"&&bH({cursorFlags:0,state:"inactive"}):bH({cursorFlags:0,hitRegions:H,state:"hover"}),Dj($.currentTarget);break}}}function en($){if($.relatedTarget instanceof HTMLIFrameElement)switch(BZ().state){case"hover":bH({cursorFlags:0,state:"inactive"})}}function $s($){if($.defaultPrevented)return;if($.pointerType==="mouse"&&$.button>0)return;Ks($.currentTarget)&&$.preventDefault()}function Zs($){let Z=0,J=0,H={};for(let B of $)if(B.defaultSize!==void 0){Z++;let X=k4(B.defaultSize);J+=X,H[B.panelId]=X}else H[B.panelId]=void 0;let Q=$.length-Z;if(Q!==0){let B=k4((100-J)/Q);for(let X of $)X.defaultSize===void 0&&(H[X.panelId]=B)}return H}function mW0($,Z,J){if(!J[0])return;let H=$.panels.find((G)=>G.element===Z);if(!H||!H.onResize)return;let Q=xH({group:$}),B=$.orientation==="horizontal"?H.element.offsetWidth:H.element.offsetHeight,X=H.mutableValues.prevSize,z={asPercentage:k4(B/Q*100),inPixels:B};H.mutableValues.prevSize=z,H.onResize(z,H.id,X)}function uW0($,Z){if(Object.keys($).length!==Object.keys(Z).length)return!1;for(let J in $)if($[J]!==Z[J])return!1;return!0}function pW0($,Z){return $.length!==Z.length?!1:$.every((J,H)=>uW0(J,Z[H]))}function cW0({group:$,nextGroupSize:Z,prevGroupSize:J,prevLayout:H}){if(J<=0||Z<=0||J===Z)return H;let Q=0,B=0,X=!1,z=new Map,G=[];for(let Y of $.panels){let F=H[Y.id]??0;switch(Y.panelConstraints.groupResizeBehavior){case"preserve-pixel-size":{X=!0;let W=F/100*J,q=k4(W/Z*100);z.set(Y.id,q),Q+=q;break}case"preserve-relative-size":default:{G.push(Y.id),B+=F;break}}}if(!X||G.length===0)return H;let U=100-Q,K={...H};if(z.forEach((Y,F)=>{K[F]=Y}),B>0)for(let Y of G){let F=H[Y]??0;K[Y]=k4(F/B*U)}else{let Y=k4(U/G.length);for(let F of G)K[F]=Y}return K}function dW0($,Z){let J=$.map((Q)=>Q.id),H=Object.keys(Z);if(J.length!==H.length)return!1;for(let Q of J)if(!H.includes(Q))return!1;return!0}var RH=new Map;function lW0($){let Z=!0;j5($.element.ownerDocument.defaultView,"Cannot register an unmounted Group");let J=$.element.ownerDocument.defaultView.ResizeObserver,H=new Set,Q=new Set,B=new J((q)=>{for(let N of q){let{borderBoxSize:V,target:A}=N;if(A===$.element){if(Z){let D=xH({group:$});if(D===0)return;let L=w7($.id);if(!L)return;let j=qj($),M=L.defaultLayoutDeferred?Zs(j):L.layout,_=cW0({group:$,nextGroupSize:D,prevGroupSize:L.groupSize,prevLayout:M}),E=zZ({layout:_,panelConstraints:j});if(!L.defaultLayoutDeferred&&XZ(L.layout,E)&&pW0(L.derivedPanelConstraints,j)&&L.groupSize===D)continue;d3($,{defaultLayoutDeferred:!1,derivedPanelConstraints:j,groupSize:D,layout:E,separatorToPanels:L.separatorToPanels})}}else mW0($,A,V)}});B.observe($.element),$.panels.forEach((q)=>{j5(!H.has(q.id),`Panel ids must be unique; id "${q.id}" was used more than once`),H.add(q.id),q.onResize&&B.observe(q.element)});let X=xH({group:$}),z=qj($),G=$.panels.map(({id:q})=>q).join(","),U=$.mutableState.defaultLayout;U&&(dW0($.panels,U)||(U=void 0));let K=$.mutableState.layouts[G]??U??Zs(z),Y=zZ({layout:K,panelConstraints:z}),F=$.element.ownerDocument;RH.set(F,(RH.get(F)??0)+1);let W=new Map;return Qs($).forEach((q)=>{q.separator&&W.set(q.separator,q.panels)}),d3($,{defaultLayoutDeferred:X===0,derivedPanelConstraints:z,groupSize:X,layout:Y,separatorToPanels:W}),$.separators.forEach((q)=>{j5(!Q.has(q.id),`Separator ids must be unique; id "${q.id}" was used more than once`),Q.add(q.id),q.element.addEventListener("keydown",on)}),RH.get(F)===1&&(F.addEventListener("contextmenu",cn,!0),F.addEventListener("dblclick",an,!0),F.addEventListener("pointerdown",nn,!0),F.addEventListener("pointerleave",sn),F.addEventListener("pointermove",tn),F.addEventListener("pointerout",en),F.addEventListener("pointerup",$s,!0)),function(){Z=!1,RH.set(F,Math.max(0,(RH.get(F)??0)-1)),RW0($),$.separators.forEach((q)=>{q.element.removeEventListener("keydown",on)}),RH.get(F)||(F.removeEventListener("contextmenu",cn,!0),F.removeEventListener("dblclick",an,!0),F.removeEventListener("pointerdown",nn,!0),F.removeEventListener("pointerleave",sn),F.removeEventListener("pointermove",tn),F.removeEventListener("pointerout",en),F.removeEventListener("pointerup",$s,!0)),B.disconnect()}}function iW0(){let[$,Z]=I1.useState({}),J=I1.useCallback(()=>Z({}),[]);return[$,J]}function Pj($){let Z=I1.useId();return`${$??Z}`}var GZ=typeof window<"u"?I1.useLayoutEffect:I1.useEffect;function uX($){let Z=I1.useRef($);return GZ(()=>{Z.current=$},[$]),I1.useCallback((...J)=>Z.current?.(...J),[Z])}function _j(...$){return uX((Z)=>{$.forEach((J)=>{if(J)switch(typeof J){case"function":{J(Z);break}case"object":{J.current=Z;break}}})})}function jj($){let Z=I1.useRef({...$});return GZ(()=>{for(let J in $)Z.current[J]=$[J]},[$]),Z.current}var Ns=I1.createContext(null);function rW0($,Z){let J=I1.useRef({getLayout:()=>({}),setLayout:EW0});I1.useImperativeHandle(Z,()=>J.current,[]),GZ(()=>{Object.assign(J.current,Ws({groupId:$}))})}function Oj({children:$,className:Z,defaultLayout:J,disableCursor:H,disabled:Q,elementRef:B,groupRef:X,id:z,onLayoutChange:G,onLayoutChanged:U,orientation:K="horizontal",resizeTargetMinimumSize:Y={coarse:20,fine:10},style:F,...W}){let q=I1.useRef({onLayoutChange:{},onLayoutChanged:{}}),N=uX((I)=>{XZ(q.current.onLayoutChange,I)||(q.current.onLayoutChange=I,G?.(I))}),V=uX((I,y)=>{XZ(q.current.onLayoutChanged,I)||(q.current.onLayoutChanged=I,U?.(I,{isUserInteraction:y}))}),A=Pj(z),D=I1.useRef(null),[L,j]=iW0(),M=I1.useRef({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:Y,separators:[]}),_=_j(D,B);rW0(A,X);let E=uX((I,y)=>{let S=BZ(),O=pn(I),b=w7(I);if(b){let k=!1;switch(S.state){case"active":{k=S.hitRegions.some((h)=>h.group===O);break}}return{flexGrow:b.layout[y]??1,pointerEvents:k?"none":void 0}}if(J?.[y])return{flexGrow:J?.[y]}}),C=jj({defaultLayout:J,disableCursor:H}),R=I1.useMemo(()=>({get disableCursor(){return!!C.disableCursor},getPanelStyles:E,id:A,orientation:K,registerPanel:(I)=>{let y=M.current;return y.panels=Nj(K,[...y.panels,I]),j(),()=>{y.panels=y.panels.filter((S)=>S!==I),j()}},registerSeparator:(I)=>{let y=M.current;return y.separators=Nj(K,[...y.separators,I]),j(),()=>{y.separators=y.separators.filter((S)=>S!==I),j()}},updatePanelProps:(I,{disabled:y})=>{let S=M.current.panels.find((k)=>k.id===I);S&&(S.panelConstraints.disabled=y);let O=pn(A),b=w7(A);O&&b&&d3(O,{...b,derivedPanelConstraints:qj(O)})},updateSeparatorProps:(I,{disabled:y,disableDoubleClick:S})=>{let O=M.current.separators.find((b)=>b.id===I);O&&(O.disabled=y,O.disableDoubleClick=S)}}),[E,A,j,K,C]),T=I1.useRef(null);return GZ(()=>{let I=D.current;if(I===null)return;let y=M.current,S;if(C.defaultLayout!==void 0&&Object.keys(C.defaultLayout).length===y.panels.length){S={};for(let w of y.panels){let i=C.defaultLayout[w.id];i!==void 0&&(S[w.id]=i)}}let O={disabled:!!Q,element:I,id:A,mutableState:{defaultLayout:S,disableCursor:!!C.disableCursor,expandedPanelSizes:M.current.lastExpandedPanelSizes,layouts:M.current.layouts},orientation:K,panels:y.panels,resizeTargetMinimumSize:y.resizeTargetMinimumSize,separators:y.separators};T.current=O;let b=lW0(O),{defaultLayoutDeferred:k,derivedPanelConstraints:h,layout:v}=w7(O.id,!0);!k&&h.length>0&&(N(v),V(v,!1));let f=Lj(A,(w)=>{let{defaultLayoutDeferred:i,derivedPanelConstraints:r,layout:x}=w.next;if(i||r.length===0)return;let l=O.panels.map(({id:p})=>p).join(",");O.mutableState.layouts[l]=x,r.forEach((p)=>{if(p.collapsible){let{layout:d}=w.prev??{};if(d){let o=q4(p.collapsedSize,x[p.panelId]),Z0=q4(p.collapsedSize,d[p.panelId]);o&&!Z0&&(O.mutableState.expandedPanelSizes[p.panelId]=d[p.panelId])}}});let s=BZ().state!=="active";N(x),s&&V(x,w.isUserInteraction)});return()=>{T.current=null,b(),f()}},[Q,A,V,N,K,L,C]),I1.useEffect(()=>{let I=T.current;I&&(I.mutableState.defaultLayout=J,I.mutableState.disableCursor=!!H)}),yH.jsx(Ns.Provider,{value:R,children:yH.jsx("div",{...W,className:Z,"data-group":!0,"data-testid":A,id:A,ref:_,style:{height:"100%",width:"100%",overflow:"hidden",...F,display:"flex",flexDirection:K==="horizontal"?"row":"column",flexWrap:"nowrap",touchAction:K==="horizontal"?"pan-y":"pan-x"},children:$})})}Oj.displayName="Group";function Tj(){let $=I1.useContext(Ns);return j5($,"Group Context not found; did you render a Panel or Separator outside of a Group?"),$}function aW0($,Z){let{id:J}=Tj(),H=I1.useRef({collapse:Wj,expand:Wj,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:Wj});I1.useImperativeHandle(Z,()=>H.current,[]),GZ(()=>{Object.assign(H.current,Fs({groupId:J,panelId:$}))})}function Cj({children:$,className:Z,collapsedSize:J="0%",collapsible:H=!1,defaultSize:Q,disabled:B,elementRef:X,groupResizeBehavior:z="preserve-relative-size",id:G,maxSize:U="100%",minSize:K="0%",onResize:Y,panelRef:F,style:W,...q}){let N=!!G,V=Pj(G),A=jj({disabled:B}),D=I1.useRef(null),L=_j(D,X),{getPanelStyles:j,id:M,orientation:_,registerPanel:E,updatePanelProps:C}=Tj(),R=Y!==null,T=uX((O,b,k)=>{Y?.(O,G,k)});GZ(()=>{let O=D.current;if(O!==null){let b={element:O,id:V,idIsStable:N,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:R?T:void 0,panelConstraints:{groupResizeBehavior:z,collapsedSize:J,collapsible:H,defaultSize:Q,disabled:A.disabled,maxSize:U,minSize:K}};return E(b)}},[z,J,H,Q,R,V,N,U,K,T,E,A]),I1.useEffect(()=>{C(V,{disabled:B})},[B,V,C]),aW0(V,F);let I=()=>{let O=j(M,V);if(O)return JSON.stringify(O)},y=I1.useSyncExternalStore((O)=>Lj(M,O),I,I),S;return y?S=JSON.parse(y):Q!==void 0?S={flexGrow:void 0,flexShrink:void 0,flexBasis:Q}:S={flexGrow:1},yH.jsx("div",{...q,"data-disabled":B||void 0,"data-panel":!0,"data-testid":V,id:V,ref:L,style:{...oW0,display:"flex",flexBasis:0,flexShrink:1,overflow:"visible",...S},children:yH.jsx("div",{className:Z,style:{maxHeight:"100%",maxWidth:"100%",flexGrow:1,overflow:"auto",...W,touchAction:_==="horizontal"?"pan-y":"pan-x"},children:$})})}Cj.displayName="Panel";var oW0={minHeight:0,maxHeight:"100%",height:"auto",minWidth:0,maxWidth:"100%",width:"auto",border:"none",borderWidth:0,padding:0,margin:0};function nW0({layout:$,panelConstraints:Z,panelId:J,panelIndex:H}){let Q,B,X=$[J],z=Z.find((G)=>G.panelId===J);if(z){let G=z.maxSize,U=z.collapsible?z.collapsedSize:z.minSize,K=[H,H+1];B=zZ({layout:pX({delta:U-X,initialLayout:$,panelConstraints:Z,pivotIndices:K,prevLayout:$}),panelConstraints:Z})[J],Q=zZ({layout:pX({delta:G-X,initialLayout:$,panelConstraints:Z,pivotIndices:K,prevLayout:$}),panelConstraints:Z})[J]}return{valueControls:J,valueMax:Q,valueMin:B,valueNow:X}}function wj({children:$,className:Z,disabled:J,disableDoubleClick:H,elementRef:Q,id:B,style:X,...z}){let G=Pj(B),U=jj({disabled:J,disableDoubleClick:H}),[K,Y]=I1.useState({}),[F,W]=I1.useState("inactive"),[q,N]=I1.useState(!1),V=I1.useRef(null),A=_j(V,Q),{disableCursor:D,id:L,orientation:j,registerSeparator:M,updateSeparatorProps:_}=Tj(),E=j==="horizontal"?"vertical":"horizontal";GZ(()=>{let T=V.current;if(T!==null){let I={disabled:U.disabled,disableDoubleClick:U.disableDoubleClick,element:T,id:G},y=M(I),S=CW0((b)=>{W(b.next.state!=="inactive"&&b.next.hitRegions.some((k)=>k.separator===I)?b.next.state:"inactive")}),O=Lj(L,(b)=>{let{derivedPanelConstraints:k,layout:h,separatorToPanels:v}=b.next,f=v.get(I);if(f){let w=f[0],i=k.findIndex((r)=>r.panelId===w.id);Y(nW0({layout:h,panelConstraints:k,panelId:w.id,panelIndex:i}))}});return()=>{S(),O(),y()}}},[L,G,M,U]),I1.useEffect(()=>{_(G,{disabled:J,disableDoubleClick:H})},[J,H,G,_]);let C;J&&!D&&(C="not-allowed");let R;if(J)R="disabled";else switch(F){case"active":{R="active";break}default:q?R="focus":R=F}return yH.jsx("div",{...z,"aria-controls":K.valueControls,"aria-disabled":J||void 0,"aria-orientation":E,"aria-valuemax":K.valueMax,"aria-valuemin":K.valueMin,"aria-valuenow":K.valueNow,children:$,className:Z,"data-separator":R,"data-testid":G,id:G,onBlur:()=>N(!1),onFocus:()=>N(!0),ref:A,role:"separator",style:{flexBasis:"auto",cursor:C,...X,flexGrow:0,flexShrink:0,touchAction:"none"},tabIndex:J?void 0:0})}wj.displayName="Separator";var eq=P(c(),1);function As({className:$,...Z}){return eq.jsx(Oj,{"data-slot":"resizable-panel-group",className:a0("flex h-full w-full aria-[orientation=vertical]:flex-col",$),...Z})}function Ej({...$}){return eq.jsx(Cj,{"data-slot":"resizable-panel",...$})}function Vs({showDivider:$=!0,className:Z,...J}){return eq.jsx(wj,{"data-slot":"resizable-handle",className:a0("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 S7=P(c(),1);function Ds({workspace:$,chat:Z,open:J,workspaceMinWidth:H,chatMinWidth:Q,chatMaxWidth:B,chatWidth:X,onCollapse:z,onChatWidthChange:G}){let U=R7.useRef(null),K=R7.useRef(null),[Y,F]=R7.useState(!1),W=Math.min(Math.max(X,Q),B),[q]=R7.useState(()=>J?W:0);return R7.useLayoutEffect(()=>{let N=U.current;if(!N)return;if(J)N.resize(W);else N.collapse()},[W,J]),S7.jsxs(As,{orientation:"horizontal",className:B0("overflow-visible!",Y&&"[&>#chat]:transition-[flex-grow] [&>#chat]:duration-200 [&>#chat]:ease-in-out motion-reduce:[&>#chat]:transition-none!",Y&&"has-[[data-separator=active]]:[&>#chat]:transition-none!"),onLayoutChanged:(N,V)=>{if(!Y&&K.current===null)K.current=requestAnimationFrame(()=>{F(!0)});if(V.isUserInteraction)requestAnimationFrame(()=>{let A=U.current;if(!A)return;let D=A.getSize();if(D.inPixels>0)G(Math.round(D.inPixels))})},children:[S7.jsx(Ej,{id:"workspace",className:"overflow-visible!",minSize:H,children:S7.jsx("div",{"data-slot":"workspace-split-workspace",className:"flex h-full min-h-0 min-w-0 flex-col",children:$})}),S7.jsx(Vs,{"aria-label":"Resize chat",showDivider:!1,hidden:!J,disabled:!J}),S7.jsx(Ej,{id:"chat","aria-hidden":!J,inert:!J,collapsible:!0,collapsedSize:0,defaultSize:q,minSize:Q,maxSize:B,groupResizeBehavior:"preserve-pixel-size",panelRef:U,onResize:(N,V,A)=>{if(J&&N.inPixels===0&&A&&A.inPixels>0)z()},className:B0("overflow-hidden!",Y&&"transition-opacity duration-200 ease-in-out motion-reduce:transition-none",J?"opacity-100":"opacity-0"),children:S7.jsx("div",{"data-slot":"workspace-split-chat",className:"flex h-full min-h-0 min-w-(--chat-min) flex-col",children:Z})})]})}var UZ=P(c(),1);function Ls({onOpenOverview:$}){return UZ.jsxs("div",{className:"flex flex-1 flex-col items-center justify-center gap-4 p-6 text-center",children:[UZ.jsxs("div",{className:"flex flex-col items-center justify-center gap-2",children:[UZ.jsx(PF,{size:56,stroke:0.5,"aria-hidden":!0}),UZ.jsx("p",{className:"text-sm",children:"There's no such page in this workspace"})]}),UZ.jsx(j0,{variant:"secondary",onClick:$,children:"Back to overview"})]})}var j1=P(c(),1),tW0=F2.lazy(()=>import("/chunk-3a48fyf7.js").then(($)=>({default:$.Scratchpad}))),js=($)=>V$($.icon)??rJ;function Ms($,Z,J,H,Q,B){if($==="agent")return{key:$,Icon:yB,label:"Agent",closable:H,loading:Q};if($==="overview")return{key:$,Icon:_F,label:"Overview",closable:!1,reorderable:!1};if($==="scratchpad")return{key:$,Icon:xB,label:"Scratchpad",closable:H};let X=Q$($),z=X?J.find((K)=>K.id===X):null;if(z)return{key:$,Icon:js(z),label:z.title||z.viewId||"New view",closable:H,loading:B(z.sessionId)};let G=AQ($),U=G?Z.find((K)=>K.id===G):null;return U?{key:$,Icon:NX(U,J),label:qX(U),closable:H}:null}function eW0($,Z,J){let H=new Set(Z),Q=0;return $.map((B)=>H.has(B)?J[Q++]:B)}function $q0({onOpenTheme:$}){let{layout:Z,name:J,provider:H}=i1(),[Q,B]=F2.useState(!1);return j1.jsx(eW,{children:j1.jsxs(o9,{children:[j1.jsxs(n9,{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:()=>B(!0),onPointerLeave:()=>B(!1),children:[j1.jsx(u6,{icon:Q?{...Z.icon,type:"glyph",value:"dots"}:Z.icon,workspaceType:H,workspaceTheme:Z.theme,className:"size-5 rounded-sm"}),J&&j1.jsx("span",{className:"truncate text-sm font-medium text-foreground",children:J})]}),j1.jsx(s9,{align:"start",sideOffset:6,className:"w-36",children:j1.jsxs(J7,{children:[j1.jsxs(H9,{onClick:$,children:[j1.jsx(mq,{stroke:1.75}),"Theme"]}),j1.jsxs(H9,{nativeButton:!0,render:j1.jsx(w3,{}),className:"w-full",children:[j1.jsx(S6,{stroke:1.75}),"Settings"]})]})})]})})}function Os({widgets:$,views:Z,builders:J}){let{layout:H,setLayout:Q,workspaceId:B}=i1(),X=$9(H.theme),z=An(),{ref:G,fits:U,constraints:K}=Dn(),[Y,F]=F2.useState("idle"),[W,q]=F2.useState(!1),[N,V]=F2.useState(0),A=F2.useRef(new Map),D=w5((q0)=>q0.dockedChatWidth),L=w5((q0)=>q0.setDockedChatWidth),j=g2((q0)=>q0.activity),M=EG(j,B),_=Vn({builders:J,onSave:(q0,P0)=>z.save(q0,P0)});mx(H.theme);let E=fX(gX(H.tabs),Z,J).some((q0)=>q0!=="agent"),C=$.some((q0)=>!r9(q0.id)),R=C||Z.length>0,I=H.layoutMode==="split"&&E&&U?"split":"fullscreen",y=I==="split",{tabsState:S,activeTab:O,appletParams:b,navigateToTab:k,setTabs:h,isUnavailable:v,onNavigationClick:f}=xn({views:Z,builders:J,split:y}),{view:w,chatLoaded:i,previewTurn:r,sessionId:x,processing:l,error:s,loadError:p,retryLoad:d,send:o,stop:Z0,selectSession:H0,dismissError:G0}=Xn({activeTab:O,appletParams:b}),{composerBanner:X0,builderComposerBanner:Y0,agentAvailability:V0}=Sn(B,{chatError:s,onDismissChatError:G0,chatLoadError:p,onRetryChatLoad:d}),N0=fX(S,Z,J),F0=N0.filter((q0)=>q0!=="agent"),n=new Set(S.open),a=(q0)=>{Q({layoutMode:q0})},e=y?F0:N0,$0=N0.length>1,Q0=e.map((q0)=>Ms(q0,Z,J,$0||Q$(q0)!==null,M,(P0)=>WQ(j,B,P0))).filter((q0)=>Boolean(q0)),_0=AQ(O),M0=_0?Z.find((q0)=>q0.id===_0):void 0,A0=Q$(O),L0=A0?J.find((q0)=>q0.id===A0):void 0,g=L0?.status==="draft"&&!WQ(j,B,L0.sessionId)?L0:void 0,u=g?.id,t=Y==="idle"&&(O==="overview"&&C||M0!==void 0),{controls:W0,docked:I0,layerProps:c0,popup:f0,targetRef:T0}=ch({workspaceId:B,sessionId:x,activeTab:O,mode:I,available:t,closePopup:()=>q(!1),openPopup:()=>q(!0)});F2.useEffect(()=>{if(S.open.filter((l0)=>C7(l0,Z,J)).length===S.open.length)return;let P0=fX(S,Z,J);h({open:P0,active:P0.includes(S.active)?S.active:P0[0]})},[J,h,S,Z]),F2.useEffect(()=>{let q0=new Map;for(let h0 of J){if(h0.status!=="ready"||!h0.viewId)continue;if(!Z.some((G1)=>G1.id===h0.viewId))continue;q0.set(H$(h0.id),vZ(h0.viewId))}if(q0.size===0)return;let P0=q0.get(O);if(P0)k(P0,{replace:!0});let l0=new Set(q0.values()),z1=new Map([...q0].map(([h0,G1])=>[G1,h0])),O1=[],b0=!1;for(let h0 of S.open){let G1=z1.get(h0);if(l0.has(h0)&&G1&&S.open.includes(G1)){b0=!0;continue}let S1=q0.get(h0),k1=S1??h0;if(S1)b0=!0;if(!O1.includes(k1))O1.push(k1)}if(!b0)return;let r0=q0.get(S.active)??S.active;h({open:O1.length>0?O1:["overview"],active:r0})},[O,J,k,h,S,Z]),F2.useEffect(()=>{if(I!=="fullscreen"||O==="agent")q(!1)},[O,I]),F2.useEffect(()=>{if(!u)return;if(I==="fullscreen")q(!0);V((q0)=>q0+1)},[u,I]);let x0=(q0)=>{if(k(q0),q0==="agent")q(!1),V((P0)=>P0+1)},J1=()=>{z.create().then((q0)=>x0(H$(q0.id)))},W1=(q0)=>{if(q0==="views"){let P0=Z[0];if(P0)x0(vZ(P0.id));else J1()}else x0(q0);q(!1)};W2((q0)=>{if(q0.type==="view:deleted"&&q0.workspaceId===B&&O===vZ(q0.name))x0("overview")});let d0=(q0)=>{if(q0==="overview")return;let P0=Q$(q0),l0=P0?J.find((h0)=>h0.id===P0):void 0;if(!$0&&!l0||!n.has(q0))return;let z1=S.open.filter((h0)=>h0!==q0);if(z1.length===0)z1=["overview"];let O1=e.indexOf(q0),b0=e[O1+1]??e[O1-1]??z1.find((h0)=>C7(h0,Z,J))??"overview",r0=S.active===q0||!z1.includes(S.active)?b0:S.active;if(h({open:z1,active:r0}),O===q0)k(b0);if(l0?.status==="draft")A.current.get(l0.id)?.resetSketch(),_.clear(l0.id),z.discard(l0.id)},v0=(q0)=>{let P0=H$(q0.id);if(n.has(P0)){let l0=S.open.filter((z1)=>z1!==P0);if(l0.length===0)l0=["overview"];if(h({open:l0,active:S.active===P0?l0[0]:S.active}),O===P0)k(l0[0])}A.current.get(q0.id)?.resetSketch(),_.clear(q0.id),z.discard(q0.id)},E1=(q0)=>{let P0=eW0(S.open,e,q0);if(P0===S.open)return;h({open:P0,active:S.active})},B1=(q0)=>{if(q0!==void 0)w5.getState().setComposerDraft(B,q0);if(I==="fullscreen"&&O!=="agent"){if(q(!0),W)V((P0)=>P0+1);return}V((P0)=>P0+1)};$n({sessionId:x,send:o,revealChat:B1,agentAvailability:V0}),Zn(x,B1);let s1=[...!y&&!n.has("agent")?[{key:"agent",Icon:yB,label:"Agent",onClick:()=>x0("agent")}]:[],...!n.has("scratchpad")?[{key:"scratchpad",Icon:xB,label:"Scratchpad",onClick:()=>x0("scratchpad")}]:[],...Z.map((q0)=>({view:q0,tab:vZ(q0.id)})).filter(({tab:q0})=>!n.has(q0)).map(({view:q0,tab:P0})=>({key:P0,Icon:NX(q0,J),label:qX(q0),onClick:()=>x0(P0)})),...J.filter((q0)=>q0.status!=="ready").map((q0)=>({builder:q0,tab:H$(q0.id)})).filter(({tab:q0})=>!n.has(q0)).map(({builder:q0,tab:P0})=>({key:P0,Icon:js(q0),label:q0.title||q0.viewId||"New view",onClick:()=>x0(P0)})),{key:"create-view",Icon:Ps,label:"New view",onClick:J1}],C0=F2.useCallback((q0)=>{if(g)_.change(g.id,q0)},[g,_]),p0=F2.useCallback(()=>{if(g)A.current.get(g.id)?.resetSketch()},[g]),i0=F2.useCallback(async(q0)=>{if(!g)return;await A.current.get(g.id)?.prepareSketchForSend(),await z.submit(g,q0),_.clear(g.id)},[g,z,_]),o0=g?{sessionId:g.sessionId,builderId:g.id,initialValue:g.input.requirements,onChange:C0,onRemoveDrawing:p0,onSubmit:i0}:void 0,V1=j1.jsx(kW,{agent:X.agent,active:I==="split",focusRequest:N,chatLoaded:i,hasWorkspaceApplets:R,view:w,previewTurn:r,sessionId:x,processing:l,composerBanner:g?Y0:X0,agentAvailability:V0,send:o,stop:Z0,onNavigateFromWelcome:W1,onClose:()=>a("fullscreen"),annotation:I0,builderDraft:o0,docked:!0}),D1=j1.jsx(kW,{agent:X.agent,active:I==="fullscreen"&&O==="agent",focusRequest:N,chatLoaded:i,hasWorkspaceApplets:R,view:w,previewTurn:r,sessionId:x,processing:l,composerBanner:X0,agentAvailability:V0,send:o,stop:Z0,onNavigateFromWelcome:W1}),u1=j1.jsxs("div",{className:B0("@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",I==="split"&&"rounded-xl"),children:[j1.jsxs("div",{className:"relative flex min-h-0 flex-1",children:[j1.jsxs("div",{ref:T0,inert:W0.active||void 0,"aria-hidden":W0.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:[v?j1.jsx(Ls,{onOpenOverview:()=>x0("overview")}):O==="agent"?D1:O==="overview"?j1.jsx(lo,{customizing:Y==="customizing",theming:Y==="theming",onThemingChange:(q0)=>F(q0?"theming":"idle"),onCustomizingChange:(q0)=>F(q0?"customizing":"idle"),widgets:$,views:Z,builders:J,onOpenView:(q0)=>x0(vZ(q0)),onCreateView:J1,onCreateWidget:()=>{H0(null),B1("Create widget")}}):O==="scratchpad"?j1.jsx(F2.Suspense,{fallback:null,children:j1.jsx(tW0,{})}):null,J.filter((q0)=>q0.status!=="ready").map((q0)=>j1.jsx(Un,{ref:(P0)=>{if(P0)A.current.set(q0.id,P0);else A.current.delete(q0.id)},active:!v&&L0?.id===q0.id,builder:q0,chatDocked:I==="split",workspaceId:B,onEditingStart:()=>{if(I==="fullscreen")q(!1)},onContinueInChat:B1,onOpenChat:()=>{H0(q0.sessionId),B1()},onDiscard:()=>v0(q0)},q0.id)),j1.jsx(Nn,{views:Z,activeViewId:v?null:M0?.id??null,params:b})]}),j1.jsx(jY,{...c0,children:j1.jsx(CY,{controls:W0,title:"Draw annotation",busy:W0.finishing,onComplete:()=>void W0.finish()})})]}),j1.jsx(j4,{children:Y==="theming"&&j1.jsx(Zi,{onClose:()=>F("idle")})}),j1.jsxs(io,{children:[j1.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-4",children:[j1.jsx($q0,{onOpenTheme:()=>F("theming")}),j1.jsx(vn,{tabs:Q0,active:O,createItems:s1,onSelect:x0,onClose:d0,onReorder:E1})]}),j1.jsx(LV,{workspaceId:B,describeTab:(q0)=>Ms(q0,Z,J,!1,!1,()=>!1),onOpenTab:x0}),E&&U&&I==="fullscreen"&&j1.jsxs(Q5,{children:[j1.jsx(B5,{render:j1.jsx(j0,{variant:"ghost",size:"icon-sm",onClick:()=>a("split"),"aria-label":"Dock agent",className:"text-muted-foreground",children:j1.jsx(_s,{stroke:1.75})})}),j1.jsx(X5,{children:"Dock agent"})]})]})]});return j1.jsxs("div",{onClick:f,className:"relative flex h-full min-h-0 flex-col font-sans text-foreground",children:[j1.jsx("div",{ref:G,className:"flex min-h-0 flex-1",children:E&&U&&K?j1.jsx(Ds,{...K,workspace:u1,chat:V1,open:I==="split",chatWidth:D,onCollapse:()=>a("fullscreen"),onChatWidthChange:L}):u1}),I==="fullscreen"&&O!=="agent"&&E&&j1.jsx($i,{agent:X.agent,loading:M,open:W,onOpenChange:q,onOpenChangeComplete:(q0)=>{if(q0)V((P0)=>P0+1)},children:(q0)=>j1.jsx(kW,{agent:X.agent,active:W,focusRequest:N,chatLoaded:i,hasWorkspaceApplets:R,view:w,previewTurn:r,sessionId:x,processing:l,composerBanner:g?Y0:X0,agentAvailability:V0,send:o,stop:Z0,onNavigateFromWelcome:W1,onClose:q0,annotation:f0,builderDraft:o0})})]})}var Cs=P(m(),1);var $N=P(m(),1);function Zq0($){return new Map($.map((Z)=>[Z.id,{w:Z.config.colSpan,h:Z.config.rowSpan}]))}function Jq0($,Z,J){let H=new Set($.map((K)=>K.i)),Q=Z.filter((K)=>{let Y=J.get(K.id);if(!Y)return!H.has(K.id);if(!H.has(K.id))return!1;return Y.w!==K.config.colSpan||Y.h!==K.config.rowSpan});if(Q.length===0)return null;let B=new Set(Q.map((K)=>K.id)),X=new Map(Z.map((K)=>[K.id,K.config])),z=$.filter((K)=>!B.has(K.i)&&X.has(K.i)).map((K)=>{let Y=X.get(K.i);return{...K,w:Y.colSpan,h:Y.rowSpan}}),G=z.map(({i:K,x:Y,y:F})=>({i:K,x:Y,y:F})),U=[...z];for(let K of Q){let Y=Qq(U,K.config.colSpan,K.config.rowSpan);G.push({i:K.id,...Y}),U.push({i:K.id,...Y,w:K.config.colSpan,h:K.config.rowSpan})}return G}function Ts($,Z,J,H){let Q=$N.useRef(null);$N.useEffect(()=>{if(!Z)return;let B=Zq0(Z);if(Q.current?.workspaceId!==$){Q.current={workspaceId:$,sizes:B};return}let X=Jq0(J.widgetGrid,Z,Q.current.sizes);if(Q.current={workspaceId:$,sizes:B},X)H({widgetGrid:X})},[$,Z,J.widgetGrid,H])}function ws($){let{layout:Z,setLayout:J}=i1(),H=J5({queryKey:S0.widgets($),queryFn:async()=>{return(await q1(`/api/workspaces/${$}/widgets`)).widgets},...p4}),Q=Cs.useMemo(()=>Th(H.data??[]),[H.data]);return Ts($,H.data?Q:void 0,Z,J),{...H,data:Q}}var l3=P(c(),1);function Ss({id:$}){let{experimental:Z}=O8();return l3.jsx(Es,{id:$,children:l3.jsx(Ih,{id:$,children:l3.jsx(sA,{workspaceId:$,enabled:Z.collab,children:l3.jsx(Hq0,{id:$})})})})}function Hq0({id:$}){let Z=M4(),J=U1(),[H]=j6(),{isLoading:Q}=i1(),B=ws($),X=Zq($),z=Hq($);Vh(),W2((U)=>{if(U.type==="theme:updated"||U.type==="workspace:updated")J.invalidateQueries({queryKey:S0.layout($)});else if(U.type==="widget-layout:updated"||U.type==="widget:updated")J.invalidateQueries({queryKey:S0.widgets($)});else if(U.type==="view-layout:updated"||U.type==="view:updated")J.invalidateQueries({queryKey:S0.views($)})});let G=Q||H===void 0||B.isLoading||X.isLoading||z.isLoading;return l3.jsx(oK,{children:G?l3.jsx("div",{className:"flex h-full items-center justify-center",children:l3.jsx(tx,{sprite:"moi",effect:"chaos"})}):l3.jsx(Os,{widgets:B.data,views:X.data??[],builders:z.data??[]},Z?"browser-tab":"shared")})}var U3=P(c(),1),Rs=null;function Qq0(){if(!Rs)return U3.jsx(wO,{to:"/"});return U3.jsx(ZN.Suspense,{fallback:null,children:U3.jsx(Rs,{})})}function Is(){let[,$]=W8();return ZN.useEffect(()=>{return EV((Z)=>$(`/workspace/${Z}`)),()=>EV(null)},[$]),U3.jsxs(CO,{children:[U3.jsx(Xz,{path:"/",component:ix}),U3.jsx(Xz,{path:"/dev/*?",component:Qq0}),U3.jsx(Xz,{path:"/workspace/:id/*?",children:(Z)=>U3.jsx(Ss,{id:Z.id},Z.id)})]})}var I7=P(c(),1),bs=new NN;AR(bs);GE();function QR1($){function Z(){return I7.jsx(BN,{client:bs,children:I7.jsxs(TG,{children:[I7.jsx(_N,{children:I7.jsx(Is,{})}),I7.jsx(Tw,{})]})})}ks.createRoot($).render(I7.jsx(Z,{}))}export{QR1 as mount};