moi-computer 0.9.0 → 0.9.1-next.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.
Files changed (87) hide show
  1. package/client/assets/hermes.png +0 -0
  2. package/client/components/shared/IconGhost.tsx +15 -18
  3. package/client/components/ui/button.tsx +2 -2
  4. package/client/components/ui/hover-card.tsx +1 -1
  5. package/client/components/ui/popover.tsx +3 -1
  6. package/client/features/chat/ChatEmptyState.tsx +25 -7
  7. package/client/features/chat/ChatPanel.tsx +70 -28
  8. package/client/features/chat/ChatPopup.tsx +3 -2
  9. package/client/features/chat/ChatPromptBubbles.tsx +1 -1
  10. package/client/features/chat/MarkdownContent.tsx +1 -1
  11. package/client/features/chat/attachment-staging.ts +153 -0
  12. package/client/features/chat/chat-send.ts +55 -0
  13. package/client/features/chat/chat-store.ts +32 -8
  14. package/client/features/chat/composer/ChatComposer.tsx +190 -77
  15. package/client/features/chat/{ModelPicker.tsx → composer/ModelPicker.tsx} +29 -25
  16. package/client/features/chat/composer/banners/ComposerBanner.tsx +1 -1
  17. package/client/features/chat/composer/banners/WorkspaceAgentAvailabilityBanner.tsx +4 -13
  18. package/client/features/chat/{model-order.ts → composer/model-order.ts} +16 -0
  19. package/client/features/chat/composer/useWorkspaceComposerState.tsx +9 -4
  20. package/client/features/chat/tool-group/format/claude.ts +48 -0
  21. package/client/features/chat/tool-group/format/codex.ts +126 -0
  22. package/client/features/chat/tool-group/format/hermes.ts +68 -0
  23. package/client/features/chat/tool-group/format/index.ts +34 -0
  24. package/client/features/chat/tool-group/format/mcp.ts +64 -0
  25. package/client/features/chat/tool-group/format/openclaw.ts +116 -0
  26. package/client/features/chat/tool-group/format/shared.ts +49 -0
  27. package/client/features/chat/useChat.ts +5 -10
  28. package/client/features/drawings/DrawingLayer.tsx +49 -0
  29. package/client/features/drawings/DrawingToolbar.tsx +95 -0
  30. package/client/features/drawings/annotation-availability.ts +10 -0
  31. package/client/features/drawings/capture-element.ts +45 -0
  32. package/client/features/drawings/useChatAnnotation.ts +222 -0
  33. package/client/features/drawings/useDrawingLayer.ts +758 -0
  34. package/client/features/drawings/useViewBuilderSketch.ts +151 -0
  35. package/client/features/home/workspace-presentation.tsx +6 -2
  36. package/client/features/home/workspace-setup/WorkspaceAgentStep.tsx +12 -6
  37. package/client/features/scratchpad/ScratchpadControls.tsx +19 -5
  38. package/client/features/views/ViewBuilder.tsx +224 -0
  39. package/client/features/views/api.ts +1 -0
  40. package/client/features/views/useViewBuilderActions.ts +24 -3
  41. package/client/features/views/useViewBuilderDrafts.ts +66 -0
  42. package/client/features/widgets/Widgets.tsx +23 -39
  43. package/client/features/workspace/CustomizePanel.tsx +1 -1
  44. package/client/features/workspace/WorkspaceScreen.tsx +157 -57
  45. package/client/features/workspace/WorkspaceTabs.tsx +3 -3
  46. package/client/features/workspace/useFitsSplitLayout.ts +14 -8
  47. package/client/index.css +8 -0
  48. package/client/store/ui.ts +19 -0
  49. package/client/theme.css +33 -8
  50. package/dist/chunk-3becmq75.js +81 -0
  51. package/dist/{chunk-kkj86722.js → chunk-6w6j9g4b.js} +78 -78
  52. package/dist/{chunk-xeyxk7ep.js → chunk-8ew39cvq.js} +4 -4
  53. package/dist/chunk-c8gtrjwp.js +1 -0
  54. package/dist/{chunk-2vaafjp4.js → chunk-pp62fnxh.js} +1 -1
  55. package/dist/{chunk-35fq49qa.js → chunk-sxc24vfp.js} +1 -1
  56. package/dist/{chunk-3b3rkjet.js → chunk-v964b5g7.js} +1 -1
  57. package/dist/chunk-zx33ts9d.css +1 -0
  58. package/dist/hermes-pznd63x9.png +0 -0
  59. package/dist/index.html +1 -1
  60. package/lib/format.ts +1 -1
  61. package/lib/themes.ts +8 -8
  62. package/lib/types.ts +8 -1
  63. package/lib/workspace-types.ts +2 -1
  64. package/package.json +2 -1
  65. package/server/api.ts +21 -2
  66. package/server/cli.ts +188 -3
  67. package/server/harness/README.md +64 -17
  68. package/server/harness/acp/adapter.ts +220 -0
  69. package/server/harness/acp/archived.ts +88 -0
  70. package/server/harness/acp/client.ts +328 -0
  71. package/server/harness/acp/discovery.ts +130 -0
  72. package/server/harness/acp/run-durations.ts +68 -0
  73. package/server/harness/acp/session.ts +788 -0
  74. package/server/harness/acp/wire.ts +132 -0
  75. package/server/harness/executable.ts +15 -1
  76. package/server/harness/hermes/NOTES.md +815 -0
  77. package/server/harness/hermes/discovery.ts +155 -0
  78. package/server/harness/hermes/index.ts +155 -0
  79. package/server/harness/hermes/models.ts +79 -0
  80. package/server/harness/registry.ts +3 -1
  81. package/server/view-builders.ts +4 -2
  82. package/server/workspace-import.ts +30 -1
  83. package/client/features/chat/tool-group/format.ts +0 -384
  84. package/client/features/views/ViewBuilderTab.tsx +0 -152
  85. package/dist/chunk-gt7n06ef.js +0 -1
  86. package/dist/chunk-ty1sqbmn.js +0 -80
  87. package/dist/chunk-yz6wd5vc.css +0 -1
@@ -0,0 +1,81 @@
1
+ import{$ as _q,$a as a$,A as iB,Aa as bp,Ab as Km,Ac as UO,B as QD,Ba as Qf,Bb as kf,Bc as J1,C as XD,Ca as Xf,Cb as If,Cc as up,D as O3,Da as zf,Db as Rf,Dc as Z8,E as UJ,Ea as Gf,Eb as yf,Ec as DO,F as zD,Fa as Hf,Fb as HK,Fc as OO,G as Pq,Ga as T$,Gc as o8,H as GD,Ha as Yf,Hb as bf,Hc as vg,I as HD,Ia as UK,Ib as BK,Ic as p5,J as O4,Ja as d3,Jb as xf,Jc as lT,K as Y4,Ka as Kh,Kb as fx,L as wE,La as OD,Lb as aV,M as fY,Ma as Ym,Mb as mx,N as UD,Na as Kf,Nb as vW,O as v7,Oa as Wf,Ob as hf,P as NE,Pa as Bf,Pb as K4,Q as a2,Qa as $h,R as u_,Ra as qf,Rb as gf,S as W0,Sa as Uf,Sb as vf,T as j_,Ta as Ff,Tb as EQ,U as xY,Ua as Nf,Ub as EX,V as f1,Va as Vf,Vb as ff,W as iz,Wa as lS,Wb as mf,X as n_,Xa as WT,Xb as IQ,Y as Lq,Yb as Ow,Z as Mq,Za as Lf,Zb as pf,_ as Aq,_a as vS,_b as uf,aa as Dq,ab as Mf,ac as cf,b as v,ba as Oq,bb as Af,c as d,cb as dm,cc as df,d as G4,da as dL,db as _f,dc as fS,e as bZ0,ea as s,eb as WK,ec as lf,f as T5,fa as tm,fb as Df,fc as rf,g as C0,ga as oJ,gb as Of,gc as af,h as Qz,ha as k0,hc as Kv,i as U0,ia as Jh,ib as Pf,ic as nf,j as q0,ja as sv,jb as wf,k as f5,ka as DD,kc as mS,l as DQ,la as sz,lb as jf,lc as Wm,m as E5,ma as tv,mb as PD,mc as of,n as vz,na as dS,nb as dW,o as C8,oa as tT,ob as kQ,oc as sf,p as p_,pa as eT,pb as xp,pc as tf,q as _5,qb as Tf,qc as m1,r as L1,ra as QC,rb as hp,rc as ug,s as dA,sa as Hm,sc as RS,t as NG,ta as SQ,tb as T1,tc as yG,u as r_,ua as ev,ub as wD,uc as xS,v as f7,va as $f,vb as um,vc as VO,w as g7,wa as CQ,wb as Cf,wc as zO,x as mz,xa as Zf,xb as Ef,xc as GO,y as YJ,ya as Jf,yb as Sf,yc as _O,z as Rq,za as KK,zb as Lh}from"/chunk-8ew39cvq.js";import{Kc as P,Lc as z1,Mc as _4,Nc as WF}from"/chunk-sxc24vfp.js";var aX=z1((Mu)=>{var z2=P(v());function Ku($,Z){return $===Z&&($!==0||1/$===1/Z)||$!==$&&Z!==Z}var Wu=typeof Object.is==="function"?Object.is:Ku,Bu=z2.useState,qu=z2.useEffect,Uu=z2.useLayoutEffect,Fu=z2.useDebugValue;function Nu($,Z){var J=Z(),Q=Bu({inst:{value:J,getSnapshot:Z}}),X=Q[0].inst,z=Q[1];return Uu(function(){X.value=J,X.getSnapshot=Z,CB(X)&&z({inst:X})},[$,J,Z]),qu(function(){return CB(X)&&z({inst:X}),$(function(){CB(X)&&z({inst:X})})},[$]),Fu(J),J}function CB($){var Z=$.getSnapshot;$=$.value;try{var J=Z();return!Wu($,J)}catch(Q){return!0}}function Vu($,Z){return Z()}var Lu=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?Vu:Nu;Mu.useSyncExternalStore=z2.useSyncExternalStore!==void 0?z2.useSyncExternalStore:Lu});var Gk=z1((Oi0,zk)=>{var Zk=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,Vt=/\n/g,Lt=/^\s*/,Mt=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,At=/^:\s*/,_t=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,Dt=/^[;\s]*/,Ot=/^\s+|\s+$/g,Pt=`
2
+ `,Jk="/",Qk="*",e3="",wt="comment",jt="declaration";function Tt($,Z){if(typeof $!=="string")throw TypeError("First argument must be a string");if(!$)return[];Z=Z||{};var J=1,Q=1;function X(F){var N=F.match(Vt);if(N)J+=N.length;var L=F.lastIndexOf(Pt);Q=~L?F.length-L:Q+F.length}function z(){var F={line:J,column:Q};return function(N){return N.position=new G(F),K(),N}}function G(F){this.start=F,this.end={line:J,column:Q},this.source=Z.source}G.prototype.content=$;function H(F){var N=Error(Z.source+":"+J+":"+Q+": "+F);if(N.reason=F,N.filename=Z.source,N.line=J,N.column=Q,N.source=$,Z.silent);else throw N}function Y(F){var N=F.exec($);if(!N)return;var L=N[0];return X(L),$=$.slice(L.length),N}function K(){Y(Lt)}function W(F){var N;F=F||[];while(N=B())if(N!==!1)F.push(N);return F}function B(){var F=z();if(Jk!=$.charAt(0)||Qk!=$.charAt(1))return;var N=2;while(e3!=$.charAt(N)&&(Qk!=$.charAt(N)||Jk!=$.charAt(N+1)))++N;if(N+=2,e3===$.charAt(N-1))return H("End of comment missing");var L=$.slice(2,N-2);return Q+=2,X(L),$=$.slice(N),Q+=2,F({type:wt,comment:L})}function q(){var F=z(),N=Y(Mt);if(!N)return;if(B(),!Y(At))return H("property missing ':'");var L=Y(_t),V=F({type:jt,property:Xk(N[0].replace(Zk,e3)),value:L?Xk(L[0].replace(Zk,e3)):e3});return Y(Dt),V}function U(){var F=[];W(F);var N;while(N=q())if(N!==!1)F.push(N),W(F);return F}return K(),U()}function Xk($){return $?$.replace(Ot,e3):e3}zk.exports=Tt});var Hk=z1((xQ)=>{var Ct=xQ&&xQ.__importDefault||function($){return $&&$.__esModule?$:{default:$}};Object.defineProperty(xQ,"__esModule",{value:!0});xQ.default=St;var Et=Ct(Gk());function St($,Z){let J=null;if(!$||typeof $!=="string")return J;let Q=(0,Et.default)($),X=typeof Z==="function";return Q.forEach((z)=>{if(z.type!=="declaration")return;let{property:G,value:H}=z;if(X)Z(G,H,z);else if(H)J=J||{},J[G]=H}),J}});var Bk=z1((Kk)=>{Object.defineProperty(Kk,"__esModule",{value:!0});Kk.camelCase=void 0;var kt=/^--[a-zA-Z0-9_-]+$/,It=/-([a-z])/g,Rt=/^[^-]+$/,yt=/^-(webkit|moz|ms|o|khtml)-/,bt=/^-(ms)-/,xt=function($){return!$||Rt.test($)||kt.test($)},ht=function($,Z){return Z.toUpperCase()},Yk=function($,Z){return"".concat(Z,"-")},gt=function($,Z){if(Z===void 0)Z={};if(xt($))return $;if($=$.toLowerCase(),Z.reactCompat)$=$.replace(bt,Yk);else $=$.replace(yt,Yk);return $.replace(It,ht)};Kk.camelCase=gt});var Uk=z1((QN,qk)=>{var vt=QN&&QN.__importDefault||function($){return $&&$.__esModule?$:{default:$}},ft=vt(Hk()),mt=Bk();function JN($,Z){var J={};if(!$||typeof $!=="string")return J;return(0,ft.default)($,function(Q,X){if(Q&&X)J[(0,mt.camelCase)(Q,Z)]=X}),J}JN.default=JN;qk.exports=JN});var bI=z1((Ut0,yI)=>{var dK=Object.prototype.hasOwnProperty,RI=Object.prototype.toString,TI=Object.defineProperty,CI=Object.getOwnPropertyDescriptor,EI=function(Z){if(typeof Array.isArray==="function")return Array.isArray(Z);return RI.call(Z)==="[object Array]"},SI=function(Z){if(!Z||RI.call(Z)!=="[object Object]")return!1;var J=dK.call(Z,"constructor"),Q=Z.constructor&&Z.constructor.prototype&&dK.call(Z.constructor.prototype,"isPrototypeOf");if(Z.constructor&&!J&&!Q)return!1;var X;for(X in Z);return typeof X>"u"||dK.call(Z,X)},kI=function(Z,J){if(TI&&J.name==="__proto__")TI(Z,J.name,{enumerable:!0,configurable:!0,value:J.newValue,writable:!0});else Z[J.name]=J.newValue},II=function(Z,J){if(J==="__proto__"){if(!dK.call(Z,J))return;else if(CI)return CI(Z,J).value}return Z[J]};yI.exports=function $(){var Z,J,Q,X,z,G,H=arguments[0],Y=1,K=arguments.length,W=!1;if(typeof H==="boolean")W=H,H=arguments[1]||{},Y=2;if(H==null||typeof H!=="object"&&typeof H!=="function")H={};for(;Y<K;++Y)if(Z=arguments[Y],Z!=null){for(J in Z)if(Q=II(H,J),X=II(Z,J),H!==X){if(W&&X&&(SI(X)||(z=EI(X)))){if(z)z=!1,G=Q&&EI(Q)?Q:[];else G=Q&&SI(Q)?Q:{};kI(H,{name:J,newValue:$(W,G,X)})}else if(typeof X<"u")kI(H,{name:J,newValue:X})}}return H}});var Ty=z1((b05,jy)=>{function Wy($){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],Q=typeof J;if((Q==="object"||Q==="function")&&!Object.isFrozen(J))Wy(J)}),$}class aN{constructor($){if($.data===void 0)$.data={};this.data=$.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function By($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;")}function g6($,...Z){let J=Object.create(null);for(let Q in $)J[Q]=$[Q];return Z.forEach(function(Q){for(let X in Q)J[X]=Q[X]}),J}var B10="</span>",Xy=($)=>{return!!$.scope},q10=($,{prefix:Z})=>{if($.startsWith("language:"))return $.replace("language:","language-");if($.includes(".")){let J=$.split(".");return[`${Z}${J.shift()}`,...J.map((Q,X)=>`${Q}${"_".repeat(X+1)}`)].join(" ")}return`${Z}${$}`};class qy{constructor($,Z){this.buffer="",this.classPrefix=Z.classPrefix,$.walk(this)}addText($){this.buffer+=By($)}openNode($){if(!Xy($))return;let Z=q10($.scope,{prefix:this.classPrefix});this.span(Z)}closeNode($){if(!Xy($))return;this.buffer+=B10}value(){return this.buffer}span($){this.buffer+=`<span class="${$}">`}}var zy=($={})=>{let Z={children:[]};return Object.assign(Z,$),Z};class nN{constructor(){this.rootNode=zy(),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=zy({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)=>{nN._collapse(Z)})}}class Uy extends nN{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 qy(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function tQ($){if(!$)return null;if(typeof $==="string")return $;return $.source}function Fy($){return K7("(?=",$,")")}function U10($){return K7("(?:",$,")*")}function F10($){return K7("(?:",$,")?")}function K7(...$){return $.map((J)=>tQ(J)).join("")}function N10($){let Z=$[$.length-1];if(typeof Z==="object"&&Z.constructor===Object)return $.splice($.length-1,1),Z;else return{}}function oN(...$){return"("+(N10($).capture?"":"?:")+$.map((Q)=>tQ(Q)).join("|")+")"}function Ny($){return new RegExp($.toString()+"|").exec("").length-1}function V10($,Z){let J=$&&$.exec(Z);return J&&J.index===0}var L10=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function sN($,{joinWith:Z}){let J=0;return $.map((Q)=>{J+=1;let X=J,z=tQ(Q),G="";while(z.length>0){let H=L10.exec(z);if(!H){G+=z;break}if(G+=z.substring(0,H.index),z=z.substring(H.index+H[0].length),H[0][0]==="\\"&&H[1])G+="\\"+String(Number(H[1])+X);else if(G+=H[0],H[0]==="(")J++}return G}).map((Q)=>`(${Q})`).join(Z)}var M10=/\b\B/,Vy="[a-zA-Z]\\w*",tN="[a-zA-Z_]\\w*",Ly="\\b\\d+(\\.\\d+)?",My="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",Ay="\\b(0b[01]+)",A10="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",_10=($={})=>{let Z=/^#![ ]*\//;if($.binary)$.begin=K7(Z,/.*\b/,$.binary,/\b.*/);return g6({scope:"meta",begin:Z,end:/$/,relevance:0,"on:begin":(J,Q)=>{if(J.index!==0)Q.ignoreMatch()}},$)},eQ={begin:"\\\\[\\s\\S]",relevance:0},D10={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[eQ]},O10={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[eQ]},P10={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/},QW=function($,Z,J={}){let Q=g6({scope:"comment",begin:$,end:Z,contains:[]},J);Q.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 X=oN("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 Q.contains.push({begin:K7(/[ ]+/,"(",X,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),Q},w10=QW("//","$"),j10=QW("/\\*","\\*/"),T10=QW("#","$"),C10={scope:"number",begin:Ly,relevance:0},E10={scope:"number",begin:My,relevance:0},S10={scope:"number",begin:Ay,relevance:0},k10={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[eQ,{begin:/\[/,end:/\]/,relevance:0,contains:[eQ]}]},I10={scope:"title",begin:Vy,relevance:0},R10={scope:"title",begin:tN,relevance:0},y10={begin:"\\.\\s*"+tN,relevance:0},b10=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()}})},ZW=Object.freeze({__proto__:null,APOS_STRING_MODE:D10,BACKSLASH_ESCAPE:eQ,BINARY_NUMBER_MODE:S10,BINARY_NUMBER_RE:Ay,COMMENT:QW,C_BLOCK_COMMENT_MODE:j10,C_LINE_COMMENT_MODE:w10,C_NUMBER_MODE:E10,C_NUMBER_RE:My,END_SAME_AS_BEGIN:b10,HASH_COMMENT_MODE:T10,IDENT_RE:Vy,MATCH_NOTHING_RE:M10,METHOD_GUARD:y10,NUMBER_MODE:C10,NUMBER_RE:Ly,PHRASAL_WORDS_MODE:P10,QUOTE_STRING_MODE:O10,REGEXP_MODE:k10,RE_STARTERS_RE:A10,SHEBANG:_10,TITLE_MODE:I10,UNDERSCORE_IDENT_RE:tN,UNDERSCORE_TITLE_MODE:R10});function x10($,Z){if($.input[$.index-1]===".")Z.ignoreMatch()}function h10($,Z){if($.className!==void 0)$.scope=$.className,delete $.className}function g10($,Z){if(!Z)return;if(!$.beginKeywords)return;if($.begin="\\b("+$.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",$.__beforeBegin=x10,$.keywords=$.keywords||$.beginKeywords,delete $.beginKeywords,$.relevance===void 0)$.relevance=0}function v10($,Z){if(!Array.isArray($.illegal))return;$.illegal=oN(...$.illegal)}function f10($,Z){if(!$.match)return;if($.begin||$.end)throw Error("begin & end are not supported with match");$.begin=$.match,delete $.match}function m10($,Z){if($.relevance===void 0)$.relevance=1}var p10=($,Z)=>{if(!$.beforeMatch)return;if($.starts)throw Error("beforeMatch cannot be used with starts");let J=Object.assign({},$);Object.keys($).forEach((Q)=>{delete $[Q]}),$.keywords=J.keywords,$.begin=K7(J.beforeMatch,Fy(J.begin)),$.starts={relevance:0,contains:[Object.assign(J,{endsParent:!0})]},$.relevance=0,delete J.beforeMatch},u10=["of","and","for","in","not","or","if","then","parent","list","value"],c10="keyword";function _y($,Z,J=c10){let Q=Object.create(null);if(typeof $==="string")X(J,$.split(" "));else if(Array.isArray($))X(J,$);else Object.keys($).forEach(function(z){Object.assign(Q,_y($[z],Z,z))});return Q;function X(z,G){if(Z)G=G.map((H)=>H.toLowerCase());G.forEach(function(H){let Y=H.split("|");Q[Y[0]]=[z,d10(Y[0],Y[1])]})}}function d10($,Z){if(Z)return Number(Z);return l10($)?0:1}function l10($){return u10.includes($.toLowerCase())}var Gy={},Y7=($)=>{console.error($)},Hy=($,...Z)=>{console.log(`WARN: ${$}`,...Z)},HZ=($,Z)=>{if(Gy[`${$}/${Z}`])return;console.log(`Deprecated as of ${$}. ${Z}`),Gy[`${$}/${Z}`]=!0},JW=Error();function Dy($,Z,{key:J}){let Q=0,X=$[J],z={},G={};for(let H=1;H<=Z.length;H++)G[H+Q]=X[H],z[H+Q]=!0,Q+=Ny(Z[H-1]);$[J]=G,$[J]._emit=z,$[J]._multi=!0}function i10($){if(!Array.isArray($.begin))return;if($.skip||$.excludeBegin||$.returnBegin)throw Y7("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),JW;if(typeof $.beginScope!=="object"||$.beginScope===null)throw Y7("beginScope must be object"),JW;Dy($,$.begin,{key:"beginScope"}),$.begin=sN($.begin,{joinWith:""})}function r10($){if(!Array.isArray($.end))return;if($.skip||$.excludeEnd||$.returnEnd)throw Y7("skip, excludeEnd, returnEnd not compatible with endScope: {}"),JW;if(typeof $.endScope!=="object"||$.endScope===null)throw Y7("endScope must be object"),JW;Dy($,$.end,{key:"endScope"}),$.end=sN($.end,{joinWith:""})}function a10($){if($.scope&&typeof $.scope==="object"&&$.scope!==null)$.beginScope=$.scope,delete $.scope}function n10($){if(a10($),typeof $.beginScope==="string")$.beginScope={_wrap:$.beginScope};if(typeof $.endScope==="string")$.endScope={_wrap:$.endScope};i10($),r10($)}function o10($){function Z(G,H){return new RegExp(tQ(G),"m"+($.case_insensitive?"i":"")+($.unicodeRegex?"u":"")+(H?"g":""))}class J{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(G,H){H.position=this.position++,this.matchIndexes[this.matchAt]=H,this.regexes.push([H,G]),this.matchAt+=Ny(G)+1}compile(){if(this.regexes.length===0)this.exec=()=>null;let G=this.regexes.map((H)=>H[1]);this.matcherRe=Z(sN(G,{joinWith:"|"}),!0),this.lastIndex=0}exec(G){this.matcherRe.lastIndex=this.lastIndex;let H=this.matcherRe.exec(G);if(!H)return null;let Y=H.findIndex((W,B)=>B>0&&W!==void 0),K=this.matchIndexes[Y];return H.splice(0,Y),Object.assign(H,K)}}class Q{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(G){if(this.multiRegexes[G])return this.multiRegexes[G];let H=new J;return this.rules.slice(G).forEach(([Y,K])=>H.addRule(Y,K)),H.compile(),this.multiRegexes[G]=H,H}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(G,H){if(this.rules.push([G,H]),H.type==="begin")this.count++}exec(G){let H=this.getMatcher(this.regexIndex);H.lastIndex=this.lastIndex;let Y=H.exec(G);if(this.resumingScanAtSamePosition())if(Y&&Y.index===this.lastIndex);else{let K=this.getMatcher(0);K.lastIndex=this.lastIndex+1,Y=K.exec(G)}if(Y){if(this.regexIndex+=Y.position+1,this.regexIndex===this.count)this.considerAll()}return Y}}function X(G){let H=new Q;if(G.contains.forEach((Y)=>H.addRule(Y.begin,{rule:Y,type:"begin"})),G.terminatorEnd)H.addRule(G.terminatorEnd,{type:"end"});if(G.illegal)H.addRule(G.illegal,{type:"illegal"});return H}function z(G,H){let Y=G;if(G.isCompiled)return Y;[h10,f10,n10,p10].forEach((W)=>W(G,H)),$.compilerExtensions.forEach((W)=>W(G,H)),G.__beforeBegin=null,[g10,v10,m10].forEach((W)=>W(G,H)),G.isCompiled=!0;let K=null;if(typeof G.keywords==="object"&&G.keywords.$pattern)G.keywords=Object.assign({},G.keywords),K=G.keywords.$pattern,delete G.keywords.$pattern;if(K=K||/\w+/,G.keywords)G.keywords=_y(G.keywords,$.case_insensitive);if(Y.keywordPatternRe=Z(K,!0),H){if(!G.begin)G.begin=/\B|\b/;if(Y.beginRe=Z(Y.begin),!G.end&&!G.endsWithParent)G.end=/\B|\b/;if(G.end)Y.endRe=Z(Y.end);if(Y.terminatorEnd=tQ(Y.end)||"",G.endsWithParent&&H.terminatorEnd)Y.terminatorEnd+=(G.end?"|":"")+H.terminatorEnd}if(G.illegal)Y.illegalRe=Z(G.illegal);if(!G.contains)G.contains=[];if(G.contains=[].concat(...G.contains.map(function(W){return s10(W==="self"?G:W)})),G.contains.forEach(function(W){z(W,Y)}),G.starts)z(G.starts,H);return Y.matcher=X(Y),Y}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=g6($.classNameAliases||{}),z($)}function Oy($){if(!$)return!1;return $.endsWithParent||Oy($.starts)}function s10($){if($.variants&&!$.cachedVariants)$.cachedVariants=$.variants.map(function(Z){return g6($,{variants:null},Z)});if($.cachedVariants)return $.cachedVariants;if(Oy($))return g6($,{starts:$.starts?g6($.starts):null});if(Object.isFrozen($))return g6($);return $}var t10="11.11.1";class Py extends Error{constructor($,Z){super($);this.name="HTMLInjectionError",this.html=Z}}var rN=By,Yy=g6,Ky=Symbol("nomatch"),e10=7,wy=function($){let Z=Object.create(null),J=Object.create(null),Q=[],X=!0,z="Could not find the language '{}', did you forget to load/include a language module?",G={disableAutodetect:!0,name:"Plain text",contains:[]},H={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:Uy};function Y(R){return H.noHighlightRe.test(R)}function K(R){let b=R.className+" ";b+=R.parentNode?R.parentNode.className:"";let g=H.languageDetectRe.exec(b);if(g){let u=I(g[1]);if(!u)Hy(z.replace("{}",g[1])),Hy("Falling back to no-highlight mode for this block.",R);return u?g[1]:"no-highlight"}return b.split(/\s+/).find((u)=>Y(u)||I(u))}function W(R,b,g){let u="",j="";if(typeof b==="object")u=R,g=b.ignoreIllegals,j=b.language;else HZ("10.7.0","highlight(lang, code, ...args) has been deprecated."),HZ("10.7.0",`Please use highlight(code, options) instead.
3
+ https://github.com/highlightjs/highlight.js/issues/2277`),j=R,u=b;if(g===void 0)g=!0;let t={code:u,language:j};w("before:highlight",t);let Q0=t.result?t.result:B(t.language,t.code,g);return Q0.code=t.code,w("after:highlight",Q0),Q0}function B(R,b,g,u){let j=Object.create(null);function t(p,r){return p.keywords[r]}function Q0(){if(!c.keywords){a.addText(o);return}let p=0;c.keywordPatternRe.lastIndex=0;let r=c.keywordPatternRe.exec(o),z0="";while(r){z0+=o.substring(p,r.index);let L0=J0.case_insensitive?r[0].toLowerCase():r[0],P0=t(c,L0);if(P0){let[g0,e0]=P0;if(a.addText(z0),z0="",j[L0]=(j[L0]||0)+1,j[L0]<=e10)N0+=e0;if(g0.startsWith("_"))z0+=r[0];else{let U5=J0.classNameAliases[g0]||g0;M0(r[0],U5)}}else z0+=r[0];p=c.keywordPatternRe.lastIndex,r=c.keywordPatternRe.exec(o)}z0+=o.substring(p),a.addText(z0)}function x(){if(o==="")return;let p=null;if(typeof c.subLanguage==="string"){if(!Z[c.subLanguage]){a.addText(o);return}p=B(c.subLanguage,o,!0,f[c.subLanguage]),f[c.subLanguage]=p._top}else p=U(o,c.subLanguage.length?c.subLanguage:null);if(c.relevance>0)N0+=p.relevance;a.__addSublanguage(p._emitter,p.language)}function e(){if(c.subLanguage!=null)x();else Q0();o=""}function M0(p,r){if(p==="")return;a.startScope(r),a.addText(p),a.endScope()}function l(p,r){let z0=1,L0=r.length-1;while(z0<=L0){if(!p._emit[z0]){z0++;continue}let P0=J0.classNameAliases[p[z0]]||p[z0],g0=r[z0];if(P0)M0(g0,P0);else o=g0,Q0(),o="";z0++}}function H0(p,r){if(p.scope&&typeof p.scope==="string")a.openNode(J0.classNameAliases[p.scope]||p.scope);if(p.beginScope){if(p.beginScope._wrap)M0(o,J0.classNameAliases[p.beginScope._wrap]||p.beginScope._wrap),o="";else if(p.beginScope._multi)l(p.beginScope,r),o=""}return c=Object.create(p,{parent:{value:c}}),c}function B0(p,r,z0){let L0=V10(p.endRe,z0);if(L0){if(p["on:end"]){let P0=new aN(p);if(p["on:end"](r,P0),P0.isMatchIgnored)L0=!1}if(L0){while(p.endsParent&&p.parent)p=p.parent;return p}}if(p.endsWithParent)return B0(p.parent,r,z0)}function X0(p){if(c.matcher.regexIndex===0)return o+=p[0],1;else return u0=!0,0}function Y0(p){let r=p[0],z0=p.rule,L0=new aN(z0),P0=[z0.__beforeBegin,z0["on:begin"]];for(let g0 of P0){if(!g0)continue;if(g0(p,L0),L0.isMatchIgnored)return X0(r)}if(z0.skip)o+=r;else{if(z0.excludeBegin)o+=r;if(e(),!z0.returnBegin&&!z0.excludeBegin)o=r}return H0(z0,p),z0.returnBegin?0:r.length}function V0(p){let r=p[0],z0=b.substring(p.index),L0=B0(c,p,z0);if(!L0)return Ky;let P0=c;if(c.endScope&&c.endScope._wrap)e(),M0(r,c.endScope._wrap);else if(c.endScope&&c.endScope._multi)e(),l(c.endScope,p);else if(P0.skip)o+=r;else{if(!(P0.returnEnd||P0.excludeEnd))o+=r;if(e(),P0.excludeEnd)o=r}do{if(c.scope)a.closeNode();if(!c.skip&&!c.subLanguage)N0+=c.relevance;c=c.parent}while(c!==L0.parent);if(L0.starts)H0(L0.starts,p);return P0.returnEnd?0:r.length}function i(){let p=[];for(let r=c;r!==J0;r=r.parent)if(r.scope)p.unshift(r.scope);p.forEach((r)=>a.openNode(r))}let $0={};function Z0(p,r){let z0=r&&r[0];if(o+=p,z0==null)return e(),0;if($0.type==="begin"&&r.type==="end"&&$0.index===r.index&&z0===""){if(o+=b.slice(r.index,r.index+1),!X){let L0=Error(`0 width match regex (${R})`);throw L0.languageName=R,L0.badRule=$0.rule,L0}return 1}if($0=r,r.type==="begin")return Y0(r);else if(r.type==="illegal"&&!g){let L0=Error('Illegal lexeme "'+z0+'" for mode "'+(c.scope||"<unnamed>")+'"');throw L0.mode=c,L0}else if(r.type==="end"){let L0=V0(r);if(L0!==Ky)return L0}if(r.type==="illegal"&&z0==="")return o+=`
4
+ `,1;if(h0>1e5&&h0>r.index*3)throw Error("potential infinite loop, way more iterations than matches");return o+=z0,z0.length}let J0=I(R);if(!J0)throw Y7(z.replace("{}",R)),Error('Unknown language: "'+R+'"');let n=o10(J0),m="",c=u||n,f={},a=new H.__emitter(H);i();let o="",N0=0,j0=0,h0=0,u0=!1;try{if(!J0.__emitTokens){c.matcher.considerAll();for(;;){if(h0++,u0)u0=!1;else c.matcher.considerAll();c.matcher.lastIndex=j0;let p=c.matcher.exec(b);if(!p)break;let r=b.substring(j0,p.index),z0=Z0(r,p);j0=p.index+z0}Z0(b.substring(j0))}else J0.__emitTokens(b,a);return a.finalize(),m=a.toHTML(),{language:R,value:m,relevance:N0,illegal:!1,_emitter:a,_top:c}}catch(p){if(p.message&&p.message.includes("Illegal"))return{language:R,value:rN(b),illegal:!0,relevance:0,_illegalBy:{message:p.message,index:j0,context:b.slice(j0-100,j0+100),mode:p.mode,resultSoFar:m},_emitter:a};else if(X)return{language:R,value:rN(b),illegal:!1,relevance:0,errorRaised:p,_emitter:a,_top:c};else throw p}}function q(R){let b={value:rN(R),illegal:!1,relevance:0,_top:G,_emitter:new H.__emitter(H)};return b._emitter.addText(R),b}function U(R,b){b=b||H.languages||Object.keys(Z);let g=q(R),u=b.filter(I).filter(C).map((e)=>B(e,R,!1));u.unshift(g);let j=u.sort((e,M0)=>{if(e.relevance!==M0.relevance)return M0.relevance-e.relevance;if(e.language&&M0.language){if(I(e.language).supersetOf===M0.language)return 1;else if(I(M0.language).supersetOf===e.language)return-1}return 0}),[t,Q0]=j,x=t;return x.secondBest=Q0,x}function F(R,b,g){let u=b&&J[b]||g;R.classList.add("hljs"),R.classList.add(`language-${u}`)}function N(R){let b=null,g=K(R);if(Y(g))return;if(w("before:highlightElement",{el:R,language:g}),R.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",R);return}if(R.children.length>0){if(!H.ignoreUnescapedHTML)console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(R);if(H.throwUnescapedHTML)throw new Py("One of your code blocks includes unescaped HTML.",R.innerHTML)}b=R;let u=b.textContent,j=g?W(u,{language:g,ignoreIllegals:!0}):U(u);if(R.innerHTML=j.value,R.dataset.highlighted="yes",F(R,g,j.language),R.result={language:j.language,re:j.relevance,relevance:j.relevance},j.secondBest)R.secondBest={language:j.secondBest.language,relevance:j.secondBest.relevance};w("after:highlightElement",{el:R,result:j,text:u})}function L(R){H=Yy(H,R)}let V=()=>{O(),HZ("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function M(){O(),HZ("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let _=!1;function O(){function R(){O()}if(document.readyState==="loading"){if(!_)window.addEventListener("DOMContentLoaded",R,!1);_=!0;return}document.querySelectorAll(H.cssSelector).forEach(N)}function D(R,b){let g=null;try{g=b($)}catch(u){if(Y7("Language definition for '{}' could not be registered.".replace("{}",R)),!X)throw u;else Y7(u);g=G}if(!g.name)g.name=R;if(Z[R]=g,g.rawDefinition=b.bind(null,$),g.aliases)y(g.aliases,{languageName:R})}function A(R){delete Z[R];for(let b of Object.keys(J))if(J[b]===R)delete J[b]}function E(){return Object.keys(Z)}function I(R){return R=(R||"").toLowerCase(),Z[R]||Z[J[R]]}function y(R,{languageName:b}){if(typeof R==="string")R=[R];R.forEach((g)=>{J[g.toLowerCase()]=b})}function C(R){let b=I(R);return b&&!b.disableAutodetect}function h(R){if(R["before:highlightBlock"]&&!R["before:highlightElement"])R["before:highlightElement"]=(b)=>{R["before:highlightBlock"](Object.assign({block:b.el},b))};if(R["after:highlightBlock"]&&!R["after:highlightElement"])R["after:highlightElement"]=(b)=>{R["after:highlightBlock"](Object.assign({block:b.el},b))}}function k(R){h(R),Q.push(R)}function S(R){let b=Q.indexOf(R);if(b!==-1)Q.splice(b,1)}function w(R,b){let g=R;Q.forEach(function(u){if(u[g])u[g](b)})}function T(R){return HZ("10.7.0","highlightBlock will be removed entirely in v12.0"),HZ("10.7.0","Please use highlightElement now."),N(R)}Object.assign($,{highlight:W,highlightAuto:U,highlightAll:O,highlightElement:N,highlightBlock:T,configure:L,initHighlighting:V,initHighlightingOnLoad:M,registerLanguage:D,unregisterLanguage:A,listLanguages:E,getLanguage:I,registerAliases:y,autoDetection:C,inherit:Yy,addPlugin:k,removePlugin:S}),$.debugMode=function(){X=!1},$.safeMode=function(){X=!0},$.versionString=t10,$.regex={concat:K7,lookahead:Fy,either:oN,optional:F10,anyNumberOfTimes:U10};for(let R in ZW)if(typeof ZW[R]==="object")Wy(ZW[R]);return Object.assign($,ZW),$},YZ=wy({});YZ.newInstance=()=>wy({});jy.exports=YZ;YZ.HighlightJS=YZ;YZ.default=YZ});var yh=z1((TW,Rh)=>{(function($,Z){typeof TW==="object"&&typeof Rh<"u"?Z(TW):typeof define==="function"&&define.amd?define(["exports"],Z):($=typeof globalThis<"u"?globalThis:$||self,Z($["fast-equals"]={}))})(TW,function($){function Z(l){return function(B0,X0,Y0,V0,i,$0,Z0){return l(B0,X0,Z0)}}function J(l){return function(B0,X0,Y0,V0){if(!B0||!X0||typeof B0!=="object"||typeof X0!=="object")return l(B0,X0,Y0,V0);var i=V0.get(B0),$0=V0.get(X0);if(i&&$0)return i===X0&&$0===B0;V0.set(B0,X0),V0.set(X0,B0);var Z0=l(B0,X0,Y0,V0);return V0.delete(B0),V0.delete(X0),Z0}}function Q(l,H0){var B0={};for(var X0 in l)B0[X0]=l[X0];for(var X0 in H0)B0[X0]=H0[X0];return B0}function X(l){return l.constructor===Object||l.constructor==null}function z(l){return typeof l.then==="function"}function G(l,H0){return l===H0||l!==l&&H0!==H0}var H="[object Arguments]",Y="[object Boolean]",K="[object Date]",W="[object RegExp]",B="[object Map]",q="[object Number]",U="[object Object]",F="[object Set]",N="[object String]",L=Object.prototype.toString;function V(l){var{areArraysEqual:H0,areDatesEqual:B0,areMapsEqual:X0,areObjectsEqual:Y0,areRegExpsEqual:V0,areSetsEqual:i,createIsNestedEqual:$0}=l,Z0=$0(J0);function J0(n,m,c){if(n===m)return!0;if(!n||!m||typeof n!=="object"||typeof m!=="object")return n!==n&&m!==m;if(X(n)&&X(m))return Y0(n,m,Z0,c);var f=Array.isArray(n),a=Array.isArray(m);if(f||a)return f===a&&H0(n,m,Z0,c);var o=L.call(n);if(o!==L.call(m))return!1;if(o===K)return B0(n,m,Z0,c);if(o===W)return V0(n,m,Z0,c);if(o===B)return X0(n,m,Z0,c);if(o===F)return i(n,m,Z0,c);if(o===U||o===H)return z(n)||z(m)?!1:Y0(n,m,Z0,c);if(o===Y||o===q||o===N)return G(n.valueOf(),m.valueOf());return!1}return J0}function M(l,H0,B0,X0){var Y0=l.length;if(H0.length!==Y0)return!1;while(Y0-- >0)if(!B0(l[Y0],H0[Y0],Y0,Y0,l,H0,X0))return!1;return!0}var _=J(M);function O(l,H0){return G(l.valueOf(),H0.valueOf())}function D(l,H0,B0,X0){var Y0=l.size===H0.size;if(!Y0)return!1;if(!l.size)return!0;var V0={},i=0;return l.forEach(function($0,Z0){if(!Y0)return;var J0=!1,n=0;H0.forEach(function(m,c){if(!J0&&!V0[n]&&(J0=B0(Z0,c,i,n,l,H0,X0)&&B0($0,m,Z0,c,l,H0,X0)))V0[n]=!0;n++}),i++,Y0=J0}),Y0}var A=J(D),E="_owner",I=Object.prototype.hasOwnProperty;function y(l,H0,B0,X0){var Y0=Object.keys(l),V0=Y0.length;if(Object.keys(H0).length!==V0)return!1;var i;while(V0-- >0){if(i=Y0[V0],i===E){var $0=!!l.$$typeof,Z0=!!H0.$$typeof;if(($0||Z0)&&$0!==Z0)return!1}if(!I.call(H0,i)||!B0(l[i],H0[i],i,i,l,H0,X0))return!1}return!0}var C=J(y);function h(l,H0){return l.source===H0.source&&l.flags===H0.flags}function k(l,H0,B0,X0){var Y0=l.size===H0.size;if(!Y0)return!1;if(!l.size)return!0;var V0={};return l.forEach(function(i,$0){if(!Y0)return;var Z0=!1,J0=0;H0.forEach(function(n,m){if(!Z0&&!V0[J0]&&(Z0=B0(i,n,$0,m,l,H0,X0)))V0[J0]=!0;J0++}),Y0=Z0}),Y0}var S=J(k),w=Object.freeze({areArraysEqual:M,areDatesEqual:O,areMapsEqual:D,areObjectsEqual:y,areRegExpsEqual:h,areSetsEqual:k,createIsNestedEqual:Z}),T=Object.freeze({areArraysEqual:_,areDatesEqual:O,areMapsEqual:A,areObjectsEqual:C,areRegExpsEqual:h,areSetsEqual:S,createIsNestedEqual:Z}),R=V(w);function b(l,H0){return R(l,H0,void 0)}var g=V(Q(w,{createIsNestedEqual:function(){return G}}));function u(l,H0){return g(l,H0,void 0)}var j=V(T);function t(l,H0){return j(l,H0,new WeakMap)}var Q0=V(Q(T,{createIsNestedEqual:function(){return G}}));function x(l,H0){return Q0(l,H0,new WeakMap)}function e(l){return V(Q(w,l(w)))}function M0(l){var H0=V(Q(T,l(T)));return function(B0,X0,Y0){if(Y0===void 0)Y0=new WeakMap;return H0(B0,X0,Y0)}}$.circularDeepEqual=t,$.circularShallowEqual=x,$.createCustomCircularEqual=M0,$.createCustomEqual=e,$.deepEqual=b,$.sameValueZeroEqual=G,$.shallowEqual=u,Object.defineProperty($,"__esModule",{value:!0})})});var xh=z1((K75,bh)=>{var o90="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";bh.exports=o90});var fh=z1((W75,vh)=>{var s90=xh();function hh(){}function gh(){}gh.resetWarningCache=hh;vh.exports=function(){function $(Q,X,z,G,H,Y){if(Y===s90)return;var K=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 K.name="Invariant Violation",K}$.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:gh,resetWarningCache:hh};return J.PropTypes=J,J}});var LX=z1((B75,mh)=>{mh.exports=fh()();var t90,e90});var ch=z1((q75,wL)=>{function uh($){var Z,J,Q="";if(typeof $=="string"||typeof $=="number")Q+=$;else if(typeof $=="object")if(Array.isArray($)){var X=$.length;for(Z=0;Z<X;Z++)$[Z]&&(J=uh($[Z]))&&(Q&&(Q+=" "),Q+=J)}else for(J in $)$[J]&&(Q&&(Q+=" "),Q+=J);return Q}function ph(){for(var $,Z,J=0,Q="",X=arguments.length;J<X;J++)($=arguments[J])&&(Z=uh($))&&(Q&&(Q+=" "),Q+=Z);return Q}wL.exports=ph,wL.exports.clsx=ph});var MX=z1((dh)=>{Object.defineProperty(dh,"__esModule",{value:!0});dh.dontSetMe=X60;dh.findInArray=$60;dh.int=Q60;dh.isFunction=Z60;dh.isNum=J60;function $60($,Z){for(let J=0,Q=$.length;J<Q;J++)if(Z.apply(Z,[$[J],J,$]))return $[J]}function Z60($){return typeof $==="function"||Object.prototype.toString.call($)==="[object Function]"}function J60($){return typeof $==="number"&&!isNaN($)}function Q60($){return parseInt($,10)}function X60($,Z,J){if($[Z])return Error(`Invalid prop ${Z} passed to ${J} - do not set this, set it on the child.`)}});var nh=z1((rh)=>{Object.defineProperty(rh,"__esModule",{value:!0});rh.browserPrefixToKey=ih;rh.browserPrefixToStyle=W60;rh.default=void 0;rh.getPrefix=lh;var jL=["Moz","Webkit","O","ms"];function lh(){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<jL.length;J++)if(ih($,jL[J])in Z)return jL[J];return""}function ih($,Z){return Z?`${Z}${B60($)}`:$}function W60($,Z){return Z?`-${Z.toLowerCase()}-${$}`:$}function B60($){let Z="",J=!0;for(let Q=0;Q<$.length;Q++)if(J)Z+=$[Q].toUpperCase(),J=!1;else if($[Q]==="-")J=!0;else Z+=$[Q];return Z}var F75=rh.default=lh()});var EW=z1((Jg)=>{Object.defineProperty(Jg,"__esModule",{value:!0});Jg.addClassName=$g;Jg.addEvent=V60;Jg.addUserSelectStyles=C60;Jg.createCSSTransform=P60;Jg.createSVGTransform=w60;Jg.getTouch=j60;Jg.getTouchIdentifier=T60;Jg.getTranslation=TL;Jg.innerHeight=_60;Jg.innerWidth=D60;Jg.matchesSelector=eh;Jg.matchesSelectorAndParentsTo=N60;Jg.offsetXYFromParent=O60;Jg.outerHeight=M60;Jg.outerWidth=A60;Jg.removeClassName=Zg;Jg.removeEvent=L60;Jg.scheduleRemoveUserSelectStyles=E60;var R4=MX(),oh=th(nh());function th($,Z){if(typeof WeakMap=="function")var J=new WeakMap,Q=new WeakMap;return(th=function(X,z){if(!z&&X&&X.__esModule)return X;var G,H,Y={__proto__:null,default:X};if(X===null||typeof X!="object"&&typeof X!="function")return Y;if(G=z?Q:J){if(G.has(X))return G.get(X);G.set(X,Y)}for(let K in X)K!=="default"&&{}.hasOwnProperty.call(X,K)&&((H=(G=Object.defineProperty)&&Object.getOwnPropertyDescriptor(X,K))&&(H.get||H.set)?G(Y,K,H):Y[K]=X[K]);return Y})($,Z)}var CW="";function eh($,Z){if(!CW)CW=(0,R4.findInArray)(["matches","webkitMatchesSelector","mozMatchesSelector","msMatchesSelector","oMatchesSelector"],function(J){return(0,R4.isFunction)($[J])});if(!(0,R4.isFunction)($[CW]))return!1;return $[CW](Z)}function N60($,Z,J){let Q=$;do{if(eh(Q,Z))return!0;if(Q===J)return!1;Q=Q.parentNode}while(Q);return!1}function V60($,Z,J,Q){if(!$)return;let X={capture:!0,...Q};if($.addEventListener)$.addEventListener(Z,J,X);else if($.attachEvent)$.attachEvent("on"+Z,J);else $["on"+Z]=J}function L60($,Z,J,Q){if(!$)return;let X={capture:!0,...Q};if($.removeEventListener)$.removeEventListener(Z,J,X);else if($.detachEvent)$.detachEvent("on"+Z,J);else $["on"+Z]=null}function M60($){let Z=$.clientHeight,J=$.ownerDocument.defaultView.getComputedStyle($);return Z+=(0,R4.int)(J.borderTopWidth),Z+=(0,R4.int)(J.borderBottomWidth),Z}function A60($){let Z=$.clientWidth,J=$.ownerDocument.defaultView.getComputedStyle($);return Z+=(0,R4.int)(J.borderLeftWidth),Z+=(0,R4.int)(J.borderRightWidth),Z}function _60($){let Z=$.clientHeight,J=$.ownerDocument.defaultView.getComputedStyle($);return Z-=(0,R4.int)(J.paddingTop),Z-=(0,R4.int)(J.paddingBottom),Z}function D60($){let Z=$.clientWidth,J=$.ownerDocument.defaultView.getComputedStyle($);return Z-=(0,R4.int)(J.paddingLeft),Z-=(0,R4.int)(J.paddingRight),Z}function O60($,Z,J){let X=Z===Z.ownerDocument.body?{left:0,top:0}:Z.getBoundingClientRect(),z=($.clientX+Z.scrollLeft-X.left)/J,G=($.clientY+Z.scrollTop-X.top)/J;return{x:z,y:G}}function P60($,Z){let J=TL($,Z,"px");return{[(0,oh.browserPrefixToKey)("transform",oh.default)]:J}}function w60($,Z){return TL($,Z,"")}function TL($,Z,J){let{x:Q,y:X}=$,z=`translate(${Q}${J},${X}${J})`;if(Z){let G=`${typeof Z.x==="string"?Z.x:Z.x+J}`,H=`${typeof Z.y==="string"?Z.y:Z.y+J}`;z=`translate(${G}, ${H})`+z}return z}function j60($,Z){return $.targetTouches&&(0,R4.findInArray)($.targetTouches,(J)=>Z===J.identifier)||$.changedTouches&&(0,R4.findInArray)($.changedTouches,(J)=>Z===J.identifier)}function T60($){if($.targetTouches&&$.targetTouches[0])return $.targetTouches[0].identifier;if($.changedTouches&&$.changedTouches[0])return $.changedTouches[0].identifier}function C60($){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;}
5
+ `,Z.innerHTML+=`.react-draggable-transparent-selection *::selection {all: inherit;}
6
+ `,$.getElementsByTagName("head")[0].appendChild(Z);if($.body)$g($.body,"react-draggable-transparent-selection")}function E60($){if(window.requestAnimationFrame)window.requestAnimationFrame(()=>{sh($)});else sh($)}function sh($){if(!$)return;try{if($.body)Zg($.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 $g($,Z){if($.classList)$.classList.add(Z);else if(!$.className.match(new RegExp(`(?:^|\\s)${Z}(?!\\S)`)))$.className+=` ${Z}`}function Zg($,Z){if($.classList)$.classList.remove(Z);else $.className=$.className.replace(new RegExp(`(?:^|\\s)${Z}(?!\\S)`,"g"),"")}});var EL=z1((Qg)=>{Object.defineProperty(Qg,"__esModule",{value:!0});Qg.canDragX=n60;Qg.canDragY=o60;Qg.createCoreData=t60;Qg.createDraggableData=e60;Qg.getBoundPosition=r60;Qg.getControlPosition=s60;Qg.snapToGrid=a60;var y4=MX(),PZ=EW();function r60($,Z,J){if(!$.props.bounds)return[Z,J];let{bounds:Q}=$.props;Q=typeof Q==="string"?Q:$30(Q);let X=CL($);if(typeof Q==="string"){let{ownerDocument:z}=X,G=z.defaultView,H;if(Q==="parent")H=X.parentNode;else H=X.getRootNode().querySelector(Q);if(!(H instanceof G.HTMLElement))throw Error('Bounds selector "'+Q+'" could not find an element.');let Y=H,K=G.getComputedStyle(X),W=G.getComputedStyle(Y);Q={left:-X.offsetLeft+(0,y4.int)(W.paddingLeft)+(0,y4.int)(K.marginLeft),top:-X.offsetTop+(0,y4.int)(W.paddingTop)+(0,y4.int)(K.marginTop),right:(0,PZ.innerWidth)(Y)-(0,PZ.outerWidth)(X)-X.offsetLeft+(0,y4.int)(W.paddingRight)-(0,y4.int)(K.marginRight),bottom:(0,PZ.innerHeight)(Y)-(0,PZ.outerHeight)(X)-X.offsetTop+(0,y4.int)(W.paddingBottom)-(0,y4.int)(K.marginBottom)}}if((0,y4.isNum)(Q.right))Z=Math.min(Z,Q.right);if((0,y4.isNum)(Q.bottom))J=Math.min(J,Q.bottom);if((0,y4.isNum)(Q.left))Z=Math.max(Z,Q.left);if((0,y4.isNum)(Q.top))J=Math.max(J,Q.top);return[Z,J]}function a60($,Z,J){let Q=Math.round(Z/$[0])*$[0],X=Math.round(J/$[1])*$[1];return[Q,X]}function n60($){return $.props.axis==="both"||$.props.axis==="x"}function o60($){return $.props.axis==="both"||$.props.axis==="y"}function s60($,Z,J){let Q=typeof Z==="number"?(0,PZ.getTouch)($,Z):null;if(typeof Z==="number"&&!Q)return null;let X=CL(J),z=J.props.offsetParent||X.offsetParent||X.ownerDocument.body;return(0,PZ.offsetXYFromParent)(Q||$,z,J.props.scale)}function t60($,Z,J){let Q=!(0,y4.isNum)($.lastX),X=CL($);if(Q)return{node:X,deltaX:0,deltaY:0,lastX:Z,lastY:J,x:Z,y:J};else return{node:X,deltaX:Z-$.lastX,deltaY:J-$.lastY,lastX:$.lastX,lastY:$.lastY,x:Z,y:J}}function e60($,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 $30($){return{left:$.left,top:$.top,right:$.right,bottom:$.bottom}}function CL($){let Z=$.findDOMNode();if(!Z)throw Error("<DraggableCore>: Unmounted during event!");return Z}});var SL=z1((Xg)=>{Object.defineProperty(Xg,"__esModule",{value:!0});Xg.default=Y30;function Y30(){}});var Yg=z1((Gg)=>{var U30=P(v()),F30=P(G4());Object.defineProperty(Gg,"__esModule",{value:!0});Gg.default=void 0;var kL=zg(U30),Z4=RL(LX()),W30=RL(F30),m8=EW(),r6=EL(),IL=MX(),AX=RL(SL());function RL($){return $&&$.__esModule?$:{default:$}}function zg($,Z){if(typeof WeakMap=="function")var J=new WeakMap,Q=new WeakMap;return(zg=function(X,z){if(!z&&X&&X.__esModule)return X;var G,H,Y={__proto__:null,default:X};if(X===null||typeof X!="object"&&typeof X!="function")return Y;if(G=z?Q:J){if(G.has(X))return G.get(X);G.set(X,Y)}for(let K in X)K!=="default"&&{}.hasOwnProperty.call(X,K)&&((H=(G=Object.defineProperty)&&Object.getOwnPropertyDescriptor(X,K))&&(H.get||H.set)?G(Y,K,H):Y[K]=X[K]);return Y})($,Z)}function J4($,Z,J){return(Z=B30(Z))in $?Object.defineProperty($,Z,{value:J,enumerable:!0,configurable:!0,writable:!0}):$[Z]=J,$}function B30($){var Z=q30($,"string");return typeof Z=="symbol"?Z:Z+""}function q30($,Z){if(typeof $!="object"||!$)return $;var J=$[Symbol.toPrimitive];if(J!==void 0){var Q=J.call($,Z||"default");if(typeof Q!="object")return Q;throw TypeError("@@toPrimitive must return a primitive value.")}return(Z==="string"?String:Number)($)}var j2={touch:{start:"touchstart",move:"touchmove",stop:"touchend"},mouse:{start:"mousedown",move:"mousemove",stop:"mouseup"}},a6=j2.mouse;class _X extends kL.Component{constructor(){super(...arguments);J4(this,"dragging",!1),J4(this,"lastX",NaN),J4(this,"lastY",NaN),J4(this,"touchIdentifier",null),J4(this,"mounted",!1),J4(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,m8.matchesSelectorAndParentsTo)($.target,this.props.handle,Z)||this.props.cancel&&(0,m8.matchesSelectorAndParentsTo)($.target,this.props.cancel,Z))return;if($.type==="touchstart"&&!this.props.allowMobileScroll)$.preventDefault();let Q=(0,m8.getTouchIdentifier)($);this.touchIdentifier=Q;let X=(0,r6.getControlPosition)($,Q,this);if(X==null)return;let{x:z,y:G}=X,H=(0,r6.createCoreData)(this,z,G);if((0,AX.default)("DraggableCore: handleDragStart: %j",H),(0,AX.default)("calling",this.props.onStart),this.props.onStart($,H)===!1||this.mounted===!1)return;if(this.props.enableUserSelectHack)(0,m8.addUserSelectStyles)(J);this.dragging=!0,this.lastX=z,this.lastY=G,(0,m8.addEvent)(J,a6.move,this.handleDrag),(0,m8.addEvent)(J,a6.stop,this.handleDragStop)}),J4(this,"handleDrag",($)=>{let Z=(0,r6.getControlPosition)($,this.touchIdentifier,this);if(Z==null)return;let{x:J,y:Q}=Z;if(Array.isArray(this.props.grid)){let G=J-this.lastX,H=Q-this.lastY;if([G,H]=(0,r6.snapToGrid)(this.props.grid,G,H),!G&&!H)return;J=this.lastX+G,Q=this.lastY+H}let X=(0,r6.createCoreData)(this,J,Q);if((0,AX.default)("DraggableCore: handleDrag: %j",X),this.props.onDrag($,X)===!1||this.mounted===!1){try{this.handleDragStop(new MouseEvent("mouseup"))}catch(G){let H=document.createEvent("MouseEvents");H.initMouseEvent("mouseup",!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),this.handleDragStop(H)}return}this.lastX=J,this.lastY=Q}),J4(this,"handleDragStop",($)=>{if(!this.dragging)return;let Z=(0,r6.getControlPosition)($,this.touchIdentifier,this);if(Z==null)return;let{x:J,y:Q}=Z;if(Array.isArray(this.props.grid)){let H=J-this.lastX||0,Y=Q-this.lastY||0;[H,Y]=(0,r6.snapToGrid)(this.props.grid,H,Y),J=this.lastX+H,Q=this.lastY+Y}let X=(0,r6.createCoreData)(this,J,Q);if(this.props.onStop($,X)===!1||this.mounted===!1)return!1;let G=this.findDOMNode();if(G){if(this.props.enableUserSelectHack)(0,m8.scheduleRemoveUserSelectStyles)(G.ownerDocument)}if((0,AX.default)("DraggableCore: handleDragStop: %j",X),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,G)(0,AX.default)("DraggableCore: Removing handlers"),(0,m8.removeEvent)(G.ownerDocument,a6.move,this.handleDrag),(0,m8.removeEvent)(G.ownerDocument,a6.stop,this.handleDragStop)}),J4(this,"onMouseDown",($)=>{return a6=j2.mouse,this.handleDragStart($)}),J4(this,"onMouseUp",($)=>{return a6=j2.mouse,this.handleDragStop($)}),J4(this,"onTouchStart",($)=>{return a6=j2.touch,this.handleDragStart($)}),J4(this,"onTouchEnd",($)=>{return a6=j2.touch,this.handleDragStop($)})}componentDidMount(){this.mounted=!0;let $=this.findDOMNode();if($)(0,m8.addEvent)($,j2.touch.start,this.onTouchStart,{passive:!1})}componentWillUnmount(){this.mounted=!1;let $=this.findDOMNode();if($){let{ownerDocument:Z}=$;if((0,m8.removeEvent)(Z,j2.mouse.move,this.handleDrag),(0,m8.removeEvent)(Z,j2.touch.move,this.handleDrag),(0,m8.removeEvent)(Z,j2.mouse.stop,this.handleDragStop),(0,m8.removeEvent)(Z,j2.touch.stop,this.handleDragStop),(0,m8.removeEvent)($,j2.touch.start,this.onTouchStart,{passive:!1}),this.props.enableUserSelectHack)(0,m8.scheduleRemoveUserSelectStyles)(Z)}}findDOMNode(){return this.props?.nodeRef?this.props?.nodeRef?.current:W30.default.findDOMNode(this)}render(){return kL.cloneElement(kL.Children.only(this.props.children),{onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}}Gg.default=_X;J4(_X,"displayName","DraggableCore");J4(_X,"propTypes",{allowAnyClick:Z4.default.bool,allowMobileScroll:Z4.default.bool,children:Z4.default.node.isRequired,disabled:Z4.default.bool,enableUserSelectHack:Z4.default.bool,offsetParent:function($,Z){if($[Z]&&$[Z].nodeType!==1)throw Error("Draggable's offsetParent must be a DOM Node.")},grid:Z4.default.arrayOf(Z4.default.number),handle:Z4.default.string,cancel:Z4.default.string,nodeRef:Z4.default.object,onStart:Z4.default.func,onDrag:Z4.default.func,onStop:Z4.default.func,onMouseDown:Z4.default.func,scale:Z4.default.number,className:IL.dontSetMe,style:IL.dontSetMe,transform:IL.dontSetMe});J4(_X,"defaultProps",{allowAnyClick:!1,allowMobileScroll:!1,disabled:!1,enableUserSelectHack:!0,onStart:function(){},onDrag:function(){},onStop:function(){},onMouseDown:function(){},scale:1})});var qg=z1((xL)=>{var A30=P(v()),_30=P(G4());Object.defineProperty(xL,"__esModule",{value:!0});Object.defineProperty(xL,"DraggableCore",{enumerable:!0,get:function(){return IW.default}});xL.default=void 0;var SW=Wg(A30),W1=RW(LX()),N30=RW(_30),V30=ch(),Kg=EW(),wZ=EL(),yL=MX(),IW=RW(Yg()),kW=RW(SL());function RW($){return $&&$.__esModule?$:{default:$}}function Wg($,Z){if(typeof WeakMap=="function")var J=new WeakMap,Q=new WeakMap;return(Wg=function(X,z){if(!z&&X&&X.__esModule)return X;var G,H,Y={__proto__:null,default:X};if(X===null||typeof X!="object"&&typeof X!="function")return Y;if(G=z?Q:J){if(G.has(X))return G.get(X);G.set(X,Y)}for(let K in X)K!=="default"&&{}.hasOwnProperty.call(X,K)&&((H=(G=Object.defineProperty)&&Object.getOwnPropertyDescriptor(X,K))&&(H.get||H.set)?G(Y,K,H):Y[K]=X[K]);return Y})($,Z)}function bL(){return bL=Object.assign?Object.assign.bind():function($){for(var Z=1;Z<arguments.length;Z++){var J=arguments[Z];for(var Q in J)({}).hasOwnProperty.call(J,Q)&&($[Q]=J[Q])}return $},bL.apply(null,arguments)}function jZ($,Z,J){return(Z=L30(Z))in $?Object.defineProperty($,Z,{value:J,enumerable:!0,configurable:!0,writable:!0}):$[Z]=J,$}function L30($){var Z=M30($,"string");return typeof Z=="symbol"?Z:Z+""}function M30($,Z){if(typeof $!="object"||!$)return $;var J=$[Symbol.toPrimitive];if(J!==void 0){var Q=J.call($,Z||"default");if(typeof Q!="object")return Q;throw TypeError("@@toPrimitive must return a primitive value.")}return(Z==="string"?String:Number)($)}class DX extends SW.Component{static getDerivedStateFromProps($,Z){let{position:J}=$,{prevPropsPosition:Q}=Z;if(J&&(!Q||J.x!==Q.x||J.y!==Q.y))return(0,kW.default)("Draggable: getDerivedStateFromProps %j",{position:J,prevPropsPosition:Q}),{x:J.x,y:J.y,prevPropsPosition:{...J}};return null}constructor($){super($);if(jZ(this,"onDragStart",(Z,J)=>{if((0,kW.default)("Draggable: onDragStart: %j",J),this.props.onStart(Z,(0,wZ.createDraggableData)(this,J))===!1)return!1;this.setState({dragging:!0,dragged:!0})}),jZ(this,"onDrag",(Z,J)=>{if(!this.state.dragging)return!1;(0,kW.default)("Draggable: onDrag: %j",J);let Q=(0,wZ.createDraggableData)(this,J),X={x:Q.x,y:Q.y,slackX:0,slackY:0};if(this.props.bounds){let{x:G,y:H}=X;X.x+=this.state.slackX,X.y+=this.state.slackY;let[Y,K]=(0,wZ.getBoundPosition)(this,X.x,X.y);X.x=Y,X.y=K,X.slackX=this.state.slackX+(G-X.x),X.slackY=this.state.slackY+(H-X.y),Q.x=X.x,Q.y=X.y,Q.deltaX=X.x-this.state.x,Q.deltaY=X.y-this.state.y}if(this.props.onDrag(Z,Q)===!1)return!1;this.setState(X)}),jZ(this,"onDragStop",(Z,J)=>{if(!this.state.dragging)return!1;if(this.props.onStop(Z,(0,wZ.createDraggableData)(this,J))===!1)return!1;(0,kW.default)("Draggable: onDragStop: %j",J);let X={dragging:!1,slackX:0,slackY:0};if(Boolean(this.props.position)){let{x:G,y:H}=this.props.position;X.x=G,X.y=H}this.setState(X)}),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??N30.default.findDOMNode(this)}render(){let{axis:$,bounds:Z,children:J,defaultPosition:Q,defaultClassName:X,defaultClassNameDragging:z,defaultClassNameDragged:G,position:H,positionOffset:Y,scale:K,...W}=this.props,B={},q=null,F=!Boolean(H)||this.state.dragging,N=H||Q,L={x:(0,wZ.canDragX)(this)&&F?this.state.x:N.x,y:(0,wZ.canDragY)(this)&&F?this.state.y:N.y};if(this.state.isElementSVG)q=(0,Kg.createSVGTransform)(L,Y);else B=(0,Kg.createCSSTransform)(L,Y);let V=(0,V30.clsx)(J.props.className||"",X,{[z]:this.state.dragging,[G]:this.state.dragged});return SW.createElement(IW.default,bL({},W,{onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop}),SW.cloneElement(SW.Children.only(J),{className:V,style:{...J.props.style,...B},transform:q}))}}xL.default=DX;jZ(DX,"displayName","Draggable");jZ(DX,"propTypes",{...IW.default.propTypes,axis:W1.default.oneOf(["both","x","y","none"]),bounds:W1.default.oneOfType([W1.default.shape({left:W1.default.number,right:W1.default.number,top:W1.default.number,bottom:W1.default.number}),W1.default.string,W1.default.oneOf([!1])]),defaultClassName:W1.default.string,defaultClassNameDragging:W1.default.string,defaultClassNameDragged:W1.default.string,defaultPosition:W1.default.shape({x:W1.default.number,y:W1.default.number}),positionOffset:W1.default.shape({x:W1.default.oneOfType([W1.default.number,W1.default.string]),y:W1.default.oneOfType([W1.default.number,W1.default.string])}),position:W1.default.shape({x:W1.default.number,y:W1.default.number}),className:yL.dontSetMe,style:yL.dontSetMe,transform:yL.dontSetMe});jZ(DX,"defaultProps",{...IW.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 bW=z1((D75,yW)=>{var{default:Ug,DraggableCore:D30}=qg();yW.exports=Ug;yW.exports.default=Ug;yW.exports.DraggableCore=D30});var Vg=z1((E30)=>{var I30=P(v());E30.__esModule=!0;E30.cloneElement=C30;var O30=P30(I30);function P30($){return $&&$.__esModule?$:{default:$}}function Fg($,Z){var J=Object.keys($);if(Object.getOwnPropertySymbols){var Q=Object.getOwnPropertySymbols($);Z&&(Q=Q.filter(function(X){return Object.getOwnPropertyDescriptor($,X).enumerable})),J.push.apply(J,Q)}return J}function Ng($){for(var Z=1;Z<arguments.length;Z++){var J=arguments[Z]!=null?arguments[Z]:{};Z%2?Fg(Object(J),!0).forEach(function(Q){w30($,Q,J[Q])}):Object.getOwnPropertyDescriptors?Object.defineProperties($,Object.getOwnPropertyDescriptors(J)):Fg(Object(J)).forEach(function(Q){Object.defineProperty($,Q,Object.getOwnPropertyDescriptor(J,Q))})}return $}function w30($,Z,J){return(Z=j30(Z))in $?Object.defineProperty($,Z,{value:J,enumerable:!0,configurable:!0,writable:!0}):$[Z]=J,$}function j30($){var Z=T30($,"string");return typeof Z=="symbol"?Z:Z+""}function T30($,Z){if(typeof $!="object"||!$)return $;var J=$[Symbol.toPrimitive];if(J!==void 0){var Q=J.call($,Z||"default");if(typeof Q!="object")return Q;throw TypeError("@@toPrimitive must return a primitive value.")}return(Z==="string"?String:Number)($)}function C30($,Z){if(Z.style&&$.props.style)Z.style=Ng(Ng({},$.props.style),Z.style);if(Z.className&&$.props.className)Z.className=`${$.props.className} ${Z.className}`;return O30.default.cloneElement($,Z)}});var hL=z1((y30)=>{y30.__esModule=!0;y30.resizableProps=void 0;var B5=R30(LX()),P75=bW();function R30($){return $&&$.__esModule?$:{default:$}}var w75=y30.resizableProps={axis:B5.default.oneOf(["both","x","y","none"]),className:B5.default.string,children:B5.default.element.isRequired,draggableOpts:B5.default.shape({allowAnyClick:B5.default.bool,cancel:B5.default.string,children:B5.default.node,disabled:B5.default.bool,enableUserSelectHack:B5.default.bool,offsetParent:typeof Element<"u"?B5.default.instanceOf(Element):B5.default.any,grid:B5.default.arrayOf(B5.default.number),handle:B5.default.string,nodeRef:B5.default.object,onStart:B5.default.func,onDrag:B5.default.func,onStop:B5.default.func,onMouseDown:B5.default.func,scale:B5.default.number}),height:function(){for(var $=arguments.length,Z=Array($),J=0;J<$;J++)Z[J]=arguments[J];let[Q]=Z;if(Q.axis==="both"||Q.axis==="y")return B5.default.number.isRequired(...Z);return B5.default.number(...Z)},handle:B5.default.oneOfType([B5.default.node,B5.default.func]),handleSize:B5.default.arrayOf(B5.default.number),lockAspectRatio:B5.default.bool,maxConstraints:B5.default.arrayOf(B5.default.number),minConstraints:B5.default.arrayOf(B5.default.number),onResizeStop:B5.default.func,onResizeStart:B5.default.func,onResize:B5.default.func,resizeHandles:B5.default.arrayOf(B5.default.oneOf(["s","w","e","n","sw","nw","se","ne"])),transformScale:B5.default.number,width:function(){for(var $=arguments.length,Z=Array($),J=0;J<$;J++)Z[J]=arguments[J];let[Q]=Z;if(Q.axis==="both"||Q.axis==="x")return B5.default.number.isRequired(...Z);return B5.default.number(...Z)}}});var fL=z1((d30)=>{var i30=P(v());d30.__esModule=!0;d30.default=void 0;var TZ=Ag(i30),x30=bW(),h30=Vg(),g30=hL(),v30=["children","className","draggableOpts","width","height","handle","handleSize","lockAspectRatio","axis","minConstraints","maxConstraints","onResize","onResizeStop","onResizeStart","resizeHandles","transformScale"];function Ag($,Z){if(typeof WeakMap=="function")var J=new WeakMap,Q=new WeakMap;return(Ag=function(X,z){if(!z&&X&&X.__esModule)return X;var G,H,Y={__proto__:null,default:X};if(X===null||typeof X!="object"&&typeof X!="function")return Y;if(G=z?Q:J){if(G.has(X))return G.get(X);G.set(X,Y)}for(let K in X)K!=="default"&&{}.hasOwnProperty.call(X,K)&&((H=(G=Object.defineProperty)&&Object.getOwnPropertyDescriptor(X,K))&&(H.get||H.set)?G(Y,K,H):Y[K]=X[K]);return Y})($,Z)}function vL(){return vL=Object.assign?Object.assign.bind():function($){for(var Z=1;Z<arguments.length;Z++){var J=arguments[Z];for(var Q in J)({}).hasOwnProperty.call(J,Q)&&($[Q]=J[Q])}return $},vL.apply(null,arguments)}function f30($,Z){if($==null)return{};var J,Q,X=m30($,Z);if(Object.getOwnPropertySymbols){var z=Object.getOwnPropertySymbols($);for(Q=0;Q<z.length;Q++)J=z[Q],Z.indexOf(J)===-1&&{}.propertyIsEnumerable.call($,J)&&(X[J]=$[J])}return X}function m30($,Z){if($==null)return{};var J={};for(var Q in $)if({}.hasOwnProperty.call($,Q)){if(Z.indexOf(Q)!==-1)continue;J[Q]=$[Q]}return J}function Mg($,Z){var J=Object.keys($);if(Object.getOwnPropertySymbols){var Q=Object.getOwnPropertySymbols($);Z&&(Q=Q.filter(function(X){return Object.getOwnPropertyDescriptor($,X).enumerable})),J.push.apply(J,Q)}return J}function gL($){for(var Z=1;Z<arguments.length;Z++){var J=arguments[Z]!=null?arguments[Z]:{};Z%2?Mg(Object(J),!0).forEach(function(Q){p30($,Q,J[Q])}):Object.getOwnPropertyDescriptors?Object.defineProperties($,Object.getOwnPropertyDescriptors(J)):Mg(Object(J)).forEach(function(Q){Object.defineProperty($,Q,Object.getOwnPropertyDescriptor(J,Q))})}return $}function p30($,Z,J){return(Z=u30(Z))in $?Object.defineProperty($,Z,{value:J,enumerable:!0,configurable:!0,writable:!0}):$[Z]=J,$}function u30($){var Z=c30($,"string");return typeof Z=="symbol"?Z:Z+""}function c30($,Z){if(typeof $!="object"||!$)return $;var J=$[Symbol.toPrimitive];if(J!==void 0){var Q=J.call($,Z||"default");if(typeof Q!="object")return Q;throw TypeError("@@toPrimitive must return a primitive value.")}return(Z==="string"?String:Number)($)}class xW extends TZ.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{minConstraints:J,maxConstraints:Q,lockAspectRatio:X}=this.props;if(!J&&!Q&&!X)return[$,Z];if(X){let K=this.props.width/this.props.height,W=$-this.props.width,B=Z-this.props.height;if(Math.abs(W)>Math.abs(B*K))Z=$/K;else $=Z*K}let[z,G]=[$,Z],[H,Y]=this.slack||[0,0];if($+=H,Z+=Y,J)$=Math.max(J[0],$),Z=Math.max(J[1],Z);if(Q)$=Math.min(Q[0],$),Z=Math.min(Q[1],Z);return this.slack=[H+(z-$),Y+(G-Z)],[$,Z]}resizeHandler($,Z){return(J,Q)=>{let{node:X,deltaX:z,deltaY:G}=Q;if($==="onResizeStart")this.resetData();let H=(this.props.axis==="both"||this.props.axis==="x")&&Z!=="n"&&Z!=="s",Y=(this.props.axis==="both"||this.props.axis==="y")&&Z!=="e"&&Z!=="w";if(!H&&!Y)return;let K=Z[0],W=Z[Z.length-1],B=X.getBoundingClientRect();if(this.lastHandleRect!=null){if(W==="w"){let V=B.left-this.lastHandleRect.left;z+=V}if(K==="n"){let V=B.top-this.lastHandleRect.top;G+=V}}if(this.lastHandleRect=B,W==="w")z=-z;if(K==="n")G=-G;let q=this.props.width+(H?z/this.props.transformScale:0),U=this.props.height+(Y?G/this.props.transformScale:0);if([q,U]=this.runConstraints(q,U),$==="onResizeStop"&&this.lastSize)({width:q,height:U}=this.lastSize);let F=q!==this.props.width||U!==this.props.height;if($!=="onResizeStop")this.lastSize={width:q,height:U};let N=typeof this.props[$]==="function"?this.props[$]:null;if(N&&!($==="onResize"&&!F))J.persist?.(),N(J,{node:X,size:{width:q,height:U},handle:Z});if($==="onResizeStop")this.resetData()}}renderResizeHandle($,Z){let{handle:J}=this.props;if(!J)return TZ.createElement("span",{className:`react-resizable-handle react-resizable-handle-${$}`,ref:Z});if(typeof J==="function")return J($,Z);let Q=typeof J.type==="string",X=gL({ref:Z},Q?{}:{handleAxis:$});return TZ.cloneElement(J,X)}render(){let $=this.props,{children:Z,className:J,draggableOpts:Q,width:X,height:z,handle:G,handleSize:H,lockAspectRatio:Y,axis:K,minConstraints:W,maxConstraints:B,onResize:q,onResizeStop:U,onResizeStart:F,resizeHandles:N,transformScale:L}=$,V=f30($,v30);return(0,h30.cloneElement)(Z,gL(gL({},V),{},{className:`${J?`${J} `:""}react-resizable`,children:[...TZ.Children.toArray(Z.props.children),...N.map((M)=>{let _=this.handleRefs[M]??(this.handleRefs[M]=TZ.createRef());return TZ.createElement(x30.DraggableCore,vL({},Q,{nodeRef:_,key:`resizableHandle-${M}`,onStop:this.resizeHandler("onResizeStop",M),onStart:this.resizeHandler("onResizeStart",M),onDrag:this.resizeHandler("onResize",M)}),this.renderResizeHandle(M,_))})]}))}}d30.default=xW;xW.propTypes=g30.resizableProps;xW.defaultProps={axis:"both",handleSize:[20,20],lockAspectRatio:!1,minConstraints:[20,20],maxConstraints:[1/0,1/0],resizeHandles:["se"],transformScale:1}});var jg=z1((J70)=>{var X70=P(v());J70.__esModule=!0;J70.default=void 0;var mL=Pg(X70),r30=Og(LX()),a30=Og(fL()),n30=hL(),o30=["handle","handleSize","onResize","onResizeStart","onResizeStop","draggableOpts","minConstraints","maxConstraints","lockAspectRatio","axis","width","height","resizeHandles","style","transformScale"];function Og($){return $&&$.__esModule?$:{default:$}}function Pg($,Z){if(typeof WeakMap=="function")var J=new WeakMap,Q=new WeakMap;return(Pg=function(X,z){if(!z&&X&&X.__esModule)return X;var G,H,Y={__proto__:null,default:X};if(X===null||typeof X!="object"&&typeof X!="function")return Y;if(G=z?Q:J){if(G.has(X))return G.get(X);G.set(X,Y)}for(let K in X)K!=="default"&&{}.hasOwnProperty.call(X,K)&&((H=(G=Object.defineProperty)&&Object.getOwnPropertyDescriptor(X,K))&&(H.get||H.set)?G(Y,K,H):Y[K]=X[K]);return Y})($,Z)}function pL(){return pL=Object.assign?Object.assign.bind():function($){for(var Z=1;Z<arguments.length;Z++){var J=arguments[Z];for(var Q in J)({}).hasOwnProperty.call(J,Q)&&($[Q]=J[Q])}return $},pL.apply(null,arguments)}function Dg($,Z){var J=Object.keys($);if(Object.getOwnPropertySymbols){var Q=Object.getOwnPropertySymbols($);Z&&(Q=Q.filter(function(X){return Object.getOwnPropertyDescriptor($,X).enumerable})),J.push.apply(J,Q)}return J}function hW($){for(var Z=1;Z<arguments.length;Z++){var J=arguments[Z]!=null?arguments[Z]:{};Z%2?Dg(Object(J),!0).forEach(function(Q){s30($,Q,J[Q])}):Object.getOwnPropertyDescriptors?Object.defineProperties($,Object.getOwnPropertyDescriptors(J)):Dg(Object(J)).forEach(function(Q){Object.defineProperty($,Q,Object.getOwnPropertyDescriptor(J,Q))})}return $}function s30($,Z,J){return(Z=t30(Z))in $?Object.defineProperty($,Z,{value:J,enumerable:!0,configurable:!0,writable:!0}):$[Z]=J,$}function t30($){var Z=e30($,"string");return typeof Z=="symbol"?Z:Z+""}function e30($,Z){if(typeof $!="object"||!$)return $;var J=$[Symbol.toPrimitive];if(J!==void 0){var Q=J.call($,Z||"default");if(typeof Q!="object")return Q;throw TypeError("@@toPrimitive must return a primitive value.")}return(Z==="string"?String:Number)($)}function $70($,Z){if($==null)return{};var J,Q,X=Z70($,Z);if(Object.getOwnPropertySymbols){var z=Object.getOwnPropertySymbols($);for(Q=0;Q<z.length;Q++)J=z[Q],Z.indexOf(J)===-1&&{}.propertyIsEnumerable.call($,J)&&(X[J]=$[J])}return X}function Z70($,Z){if($==null)return{};var J={};for(var Q in $)if({}.hasOwnProperty.call($,Q)){if(Z.indexOf(Q)!==-1)continue;J[Q]=$[Q]}return J}class uL extends mL.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{size:J}=Z;if(this.props.onResize)$.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,{handle:Z,handleSize:J,onResize:Q,onResizeStart:X,onResizeStop:z,draggableOpts:G,minConstraints:H,maxConstraints:Y,lockAspectRatio:K,axis:W,width:B,height:q,resizeHandles:U,style:F,transformScale:N}=$,L=$70($,o30);return mL.createElement(a30.default,{axis:W,draggableOpts:G,handle:Z,handleSize:J,height:this.state.height,lockAspectRatio:K,maxConstraints:Y,minConstraints:H,onResizeStart:X,onResize:this.onResize,onResizeStop:z,resizeHandles:U,transformScale:N,width:this.state.width},mL.createElement("div",pL({},L,{style:hW(hW({},F),{},{width:this.state.width+"px",height:this.state.height+"px"})})))}}J70.default=uL;uL.propTypes=hW(hW({},n30.resizableProps),{},{children:r30.default.element})});var Tg=z1((E75,gW)=>{gW.exports=function(){throw Error("Don't instantiate Resizable directly! Use require('react-resizable').Resizable")};gW.exports.Resizable=fL().default;gW.exports.ResizableBox=jg().default});var h4=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 op=class extends h4{#$;#Z;#J;constructor(){super();this.#J=($)=>{if(typeof window<"u"&&window.addEventListener){let Z=()=>$();return window.addEventListener("visibilitychange",Z,!1),()=>{window.removeEventListener("visibilitychange",Z)}}return}}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"}},w7=new op;var sp={setTimeout:($,Z)=>setTimeout($,Z),clearTimeout:($)=>clearTimeout($),setInterval:($,Z)=>setInterval($,Z),clearInterval:($)=>clearInterval($)},tp=class{#$=sp;#Z=!1;setTimeoutProvider($){this.#$=$}setTimeout($,Z){return this.#$.setTimeout($,Z)}clearTimeout($){this.#$.clearTimeout($)}setInterval($,Z){return this.#$.setInterval($,Z)}clearInterval($){this.#$.clearInterval($)}},S2=new tp;function CM($){setTimeout($,0)}var UB=typeof window>"u"||"Deno"in globalThis;function k1(){}function kM($,Z){return typeof $==="function"?$(Z):$}function uZ($){return typeof $==="number"&&$>=0&&$!==1/0}function fX($,Z){return Math.max($+(Z||0)-Date.now(),0)}function X2($,Z){return typeof $==="function"?$(Z):$}function d8($,Z){return typeof $==="function"?$(Z):$}function mX($,Z){let{type:J="all",exact:Q,fetchStatus:X,predicate:z,queryKey:G,stale:H}=$;if(G){if(Q){if(Z.queryHash!==cZ(G,Z.options))return!1}else if(!J3(Z.queryKey,G))return!1}if(J!=="all"){let Y=Z.isActive();if(J==="active"&&!Y)return!1;if(J==="inactive"&&Y)return!1}if(typeof H==="boolean"&&Z.isStale()!==H)return!1;if(X&&X!==Z.state.fetchStatus)return!1;if(z&&!z(Z))return!1;return!0}function pX($,Z){let{exact:J,status:Q,predicate:X,mutationKey:z}=$;if(z){if(!Z.options.mutationKey)return!1;if(J){if(k2(Z.options.mutationKey)!==k2(z))return!1}else if(!J3(Z.options.mutationKey,z))return!1}if(Q&&Z.state.status!==Q)return!1;if(X&&!X(Z))return!1;return!0}function cZ($,Z){return(Z?.queryKeyHashFn||k2)($)}function k2($){return JSON.stringify($,(Z,J)=>qB(J)?Object.keys(J).sort().reduce((Q,X)=>{return Q[X]=J[X],Q},{}):J)}function J3($,Z){if($===Z)return!0;if(typeof $!==typeof Z)return!1;if($&&Z&&typeof $==="object"&&typeof Z==="object")return Object.keys(Z).every((J)=>J3($[J],Z[J]));return!1}var ep=Object.prototype.hasOwnProperty;function dZ($,Z,J=0){if($===Z)return $;if(J>500)return Z;let Q=EM($)&&EM(Z);if(!Q&&!(qB($)&&qB(Z)))return Z;let z=(Q?$:Object.keys($)).length,G=Q?Z:Object.keys(Z),H=G.length,Y=Q?Array(H):{},K=0;for(let W=0;W<H;W++){let B=Q?W:G[W],q=$[B],U=Z[B];if(q===U){if(Y[B]=q,Q?W<z:ep.call($,B))K++;continue}if(q===null||U===null||typeof q!=="object"||typeof U!=="object"){Y[B]=U;continue}let F=dZ(q,U,J+1);if(Y[B]=F,F===q)K++}return z===H&&K===z?$:Y}function j7($,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 EM($){return Array.isArray($)&&$.length===Object.keys($).length}function qB($){if(!SM($))return!1;let Z=$.constructor;if(Z===void 0)return!0;let J=Z.prototype;if(!SM(J))return!1;if(!J.hasOwnProperty("isPrototypeOf"))return!1;if(Object.getPrototypeOf($)!==Object.prototype)return!1;return!0}function SM($){return Object.prototype.toString.call($)==="[object Object]"}function IM($){return new Promise((Z)=>{S2.setTimeout(Z,$)})}function lZ($,Z,J){if(typeof J.structuralSharing==="function")return J.structuralSharing($,Z);else if(J.structuralSharing!==!1)return dZ($,Z);return Z}function RM($,Z,J=0){let Q=[...$,Z];return J&&Q.length>J?Q.slice(1):Q}function yM($,Z,J=0){let Q=[Z,...$];return J&&Q.length>J?Q.slice(0,-1):Q}var T7=Symbol();function uX($,Z){if(!$.queryFn&&Z?.initialPromise)return()=>Z.initialPromise;if(!$.queryFn||$.queryFn===T7)return()=>Promise.reject(Error(`Missing queryFn: '${$.queryHash}'`));return $.queryFn}function C7($,Z){if(typeof $==="function")return $(...Z);return!!$}function bM($,Z,J){let Q=!1,X;return Object.defineProperty($,"signal",{enumerable:!0,get:()=>{if(X??=Z(),Q)return X;if(Q=!0,X.aborted)J();else X.addEventListener("abort",J,{once:!0});return X}}),$}var I2=(()=>{let $=()=>UB;return{isServer(){return $()},setIsServer(Z){$=Z}}})();function iZ(){let $,Z,J=new Promise((X,z)=>{$=X,Z=z});J.status="pending",J.catch(()=>{});function Q(X){Object.assign(J,X),delete J.resolve,delete J.reject}return J.resolve=(X)=>{Q({status:"fulfilled",value:X}),$(X)},J.reject=(X)=>{Q({status:"rejected",reason:X}),Z(X)},J}var xM=CM;function $u(){let $=[],Z=0,J=(H)=>{H()},Q=(H)=>{H()},X=xM,z=(H)=>{if(Z)$.push(H);else X(()=>{J(H)})},G=()=>{let H=$;if($=[],H.length)X(()=>{Q(()=>{H.forEach((Y)=>{J(Y)})})})};return{batch:(H)=>{let Y;Z++;try{Y=H()}finally{if(Z--,!Z)G()}return Y},batchCalls:(H)=>{return(...Y)=>{z(()=>{H(...Y)})}},schedule:z,setNotifyFunction:(H)=>{J=H},setBatchNotifyFunction:(H)=>{Q=H},setScheduler:(H)=>{X=H}}}var g5=$u();var Zu=class extends h4{#$=!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)}}return}}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((J)=>{J($)})}isOnline(){return this.#$}},E7=new Zu;function Ju($){return Math.min(1000*2**$,30000)}function FB($){return($??"online")==="online"?E7.isOnline():!0}var cX=class extends Error{constructor($){super("CancelledError");this.revert=$?.revert,this.silent=$?.silent}};function dX($){let Z=!1,J=0,Q,X=iZ(),z=()=>X.status!=="pending",G=(N)=>{if(!z()){let L=new cX(N);q(L),$.onCancel?.(L)}},H=()=>{Z=!0},Y=()=>{Z=!1},K=()=>w7.isFocused()&&($.networkMode==="always"||E7.isOnline())&&$.canRun(),W=()=>FB($.networkMode)&&$.canRun(),B=(N)=>{if(!z())Q?.(),X.resolve(N)},q=(N)=>{if(!z())Q?.(),X.reject(N)},U=()=>{return new Promise((N)=>{Q=(L)=>{if(z()||K())N(L)},$.onPause?.()}).then(()=>{if(Q=void 0,!z())$.onContinue?.()})},F=()=>{if(z())return;let N,L=J===0?$.initialPromise:void 0;try{N=L??$.fn()}catch(V){N=Promise.reject(V)}Promise.resolve(N).then(B).catch((V)=>{if(z())return;let M=$.retry??(I2.isServer()?0:3),_=$.retryDelay??Ju,O=typeof _==="function"?_(J,V):_,D=M===!0||typeof M==="number"&&J<M||typeof M==="function"&&M(J,V);if(Z||!D){q(V);return}J++,$.onFail?.(J,V),IM(O).then(()=>{return K()?void 0:U()}).then(()=>{if(Z)q(V);else F()})})};return{promise:X,status:()=>X.status,cancel:G,continue:()=>{return Q?.(),X},cancelRetry:H,continueRetry:Y,canStart:W,start:()=>{if(W())F();else U().then(F);return X}}}var lX=class{#$;destroy(){this.clearGcTimeout()}scheduleGc(){if(this.clearGcTimeout(),uZ(this.gcTime))this.#$=S2.setTimeout(()=>{this.optionalRemove()},this.gcTime)}updateGcTime($){this.gcTime=Math.max(this.gcTime||0,$??(I2.isServer()?1/0:300000))}clearGcTimeout(){if(this.#$!==void 0)S2.clearTimeout(this.#$),this.#$=void 0}};var vM=class extends lX{#$;#Z;#J;#X;#Q;#z;#G;constructor($){super();this.#G=!1,this.#z=$.defaultOptions,this.setOptions($.options),this.observers=[],this.#X=$.client,this.#J=this.#X.getQueryCache(),this.queryKey=$.queryKey,this.queryHash=$.queryHash,this.#$=gM(this.options),this.state=$.state??this.#$,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#Q?.promise}setOptions($){if(this.options={...this.#z,...$},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let Z=gM(this.options);if(Z.data!==void 0)this.setState(hM(Z.data,Z.dataUpdatedAt)),this.#$=Z}}optionalRemove(){if(!this.observers.length&&this.state.fetchStatus==="idle")this.#J.remove(this)}setData($,Z){let J=lZ(this.state.data,$,this.options);return this.#Y({data:J,type:"success",dataUpdatedAt:Z?.updatedAt,manual:Z?.manual}),J}setState($,Z){this.#Y({type:"setState",state:$,setStateOptions:Z})}cancel($){let Z=this.#Q?.promise;return this.#Q?.cancel($),Z?Z.then(k1).catch(k1):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#$}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(($)=>d8($.options.enabled,this)!==!1)}isDisabled(){if(this.getObserversCount()>0)return!this.isActive();return this.options.queryFn===T7||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){if(this.getObserversCount()>0)return this.observers.some(($)=>X2($.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!fX(this.state.dataUpdatedAt,$)}onFocus(){this.observers.find((Z)=>Z.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#Q?.continue()}onOnline(){this.observers.find((Z)=>Z.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#Q?.continue()}addObserver($){if(!this.observers.includes($))this.observers.push($),this.clearGcTimeout(),this.#J.notify({type:"observerAdded",query:this,observer:$})}removeObserver($){if(this.observers.includes($)){if(this.observers=this.observers.filter((Z)=>Z!==$),!this.observers.length){if(this.#Q)if(this.#G||this.#H())this.#Q.cancel({revert:!0});else this.#Q.cancelRetry();this.scheduleGc()}this.#J.notify({type:"observerRemoved",query:this,observer:$})}}getObserversCount(){return this.observers.length}#H(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"}invalidate(){if(!this.state.isInvalidated)this.#Y({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 H=this.observers.find((Y)=>Y.options.queryFn);if(H)this.setOptions(H.options)}let J=new AbortController,Q=(H)=>{Object.defineProperty(H,"signal",{enumerable:!0,get:()=>{return this.#G=!0,J.signal}})},X=()=>{let H=uX(this.options,Z),K=(()=>{let W={client:this.#X,queryKey:this.queryKey,meta:this.meta};return Q(W),W})();if(this.#G=!1,this.options.persister)return this.options.persister(H,K,this);return H(K)},G=(()=>{let H={fetchOptions:Z,options:this.options,queryKey:this.queryKey,client:this.#X,state:this.state,fetchFn:X};return Q(H),H})();if(this.options.behavior?.onFetch(G,this),this.#Z=this.state,this.state.fetchStatus==="idle"||this.state.fetchMeta!==G.fetchOptions?.meta)this.#Y({type:"fetch",meta:G.fetchOptions?.meta});this.#Q=dX({initialPromise:Z?.initialPromise,fn:G.fetchFn,onCancel:(H)=>{if(H instanceof cX&&H.revert)this.setState({...this.#Z,fetchStatus:"idle"});J.abort()},onFail:(H,Y)=>{this.#Y({type:"failed",failureCount:H,error:Y})},onPause:()=>{this.#Y({type:"pause"})},onContinue:()=>{this.#Y({type:"continue"})},retry:G.options.retry,retryDelay:G.options.retryDelay,networkMode:G.options.networkMode,canRun:()=>!0});try{let H=await this.#Q.start();if(H===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(H),this.#J.config.onSuccess?.(H,this),this.#J.config.onSettled?.(H,this.state.error,this),H}catch(H){if(H instanceof cX){if(H.silent)return this.#Q.promise;else if(H.revert){if(this.state.data===void 0)throw H;return this.state.data}}throw this.#Y({type:"error",error:H}),this.#J.config.onError?.(H,this),this.#J.config.onSettled?.(this.state.data,H,this),H}finally{this.scheduleGc()}}#Y($){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,...NB(J.data,this.options),fetchMeta:$.meta??null};case"success":let Q={...J,...hM($.data,$.dataUpdatedAt),dataUpdateCount:J.dataUpdateCount+1,...!$.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#Z=$.manual?Q:void 0,Q;case"error":let X=$.error;return{...J,error:X,errorUpdateCount:J.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:J.fetchFailureCount+1,fetchFailureReason:X,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...J,isInvalidated:!0};case"setState":return{...J,...$.state}}};this.state=Z(this.state),g5.batch(()=>{this.observers.forEach((J)=>{J.onQueryUpdate()}),this.#J.notify({query:this,type:"updated",action:$})})}};function NB($,Z){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:FB(Z.networkMode)?"fetching":"paused",...$===void 0&&{error:null,status:"pending"}}}function hM($,Z){return{data:$,dataUpdatedAt:Z??Date.now(),error:null,isInvalidated:!1,status:"success"}}function gM($){let Z=typeof $.initialData==="function"?$.initialData():$.initialData,J=Z!==void 0,Q=J?typeof $.initialDataUpdatedAt==="function"?$.initialDataUpdatedAt():$.initialDataUpdatedAt:0;return{data:Z,dataUpdateCount:0,dataUpdatedAt:J?Q??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:J?"success":"pending",fetchStatus:"idle"}}var LB=class extends h4{constructor($,Z){super();this.options=Z,this.#$=$,this.#H=null,this.#G=iZ(),this.bindMethods(),this.setOptions(Z)}#$;#Z=void 0;#J=void 0;#X=void 0;#Q;#z;#G;#H;#Y;#U;#F;#W;#B;#K;#N=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){if(this.listeners.size===1){if(this.#Z.addObserver(this),fM(this.#Z,this.options))this.#q();else this.updateResult();this.#A()}}onUnsubscribe(){if(!this.hasListeners())this.destroy()}shouldFetchOnReconnect(){return VB(this.#Z,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return VB(this.#Z,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#_(),this.#D(),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 d8(this.options.enabled,this.#Z)!=="boolean")throw Error("Expected enabled to be a boolean or a callback that returns a boolean");if(this.#O(),this.#Z.setOptions(this.options),Z._defaulted&&!j7(this.options,Z))this.#$.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#Z,observer:this});let Q=this.hasListeners();if(Q&&mM(this.#Z,J,this.options,Z))this.#q();if(this.updateResult(),Q&&(this.#Z!==J||d8(this.options.enabled,this.#Z)!==d8(Z.enabled,this.#Z)||X2(this.options.staleTime,this.#Z)!==X2(Z.staleTime,this.#Z)))this.#V();let X=this.#L();if(Q&&(this.#Z!==J||d8(this.options.enabled,this.#Z)!==d8(Z.enabled,this.#Z)||X!==this.#K))this.#M(X)}getOptimisticResult($){let Z=this.#$.getQueryCache().build(this.#$,$),J=this.createResult(Z,$);if(Xu(this,J))this.#X=J,this.#z=this.options,this.#Q=this.#Z.state;return J}getCurrentResult(){return this.#X}trackResult($,Z){return new Proxy($,{get:(J,Q)=>{if(this.trackProp(Q),Z?.(Q),Q==="promise"){if(this.trackProp("data"),!this.options.experimental_prefetchInRender&&this.#G.status==="pending")this.#G.reject(Error("experimental_prefetchInRender feature flag is not enabled"))}return Reflect.get(J,Q)}})}trackProp($){this.#N.add($)}getCurrentQuery(){return this.#Z}refetch({...$}={}){return this.fetch({...$})}fetchOptimistic($){let Z=this.#$.defaultQueryOptions($),J=this.#$.getQueryCache().build(this.#$,Z);return J.fetch().then(()=>this.createResult(J,Z))}fetch($){return this.#q({...$,cancelRefetch:$.cancelRefetch??!0}).then(()=>{return this.updateResult(),this.#X})}#q($){this.#O();let Z=this.#Z.fetch(this.options,$);if(!$?.throwOnError)Z=Z.catch(k1);return Z}#V(){this.#_();let $=X2(this.options.staleTime,this.#Z);if(I2.isServer()||this.#X.isStale||!uZ($))return;let J=fX(this.#X.dataUpdatedAt,$)+1;this.#W=S2.setTimeout(()=>{if(!this.#X.isStale)this.updateResult()},J)}#L(){return(typeof this.options.refetchInterval==="function"?this.options.refetchInterval(this.#Z):this.options.refetchInterval)??!1}#M($){if(this.#D(),this.#K=$,I2.isServer()||d8(this.options.enabled,this.#Z)===!1||!uZ(this.#K)||this.#K===0)return;this.#B=S2.setInterval(()=>{if(this.options.refetchIntervalInBackground||w7.isFocused())this.#q()},this.#K)}#A(){this.#V(),this.#M(this.#L())}#_(){if(this.#W!==void 0)S2.clearTimeout(this.#W),this.#W=void 0}#D(){if(this.#B!==void 0)S2.clearInterval(this.#B),this.#B=void 0}createResult($,Z){let J=this.#Z,Q=this.options,X=this.#X,z=this.#Q,G=this.#z,Y=$!==J?$.state:this.#J,{state:K}=$,W={...K},B=!1,q;if(Z._optimisticResults){let I=this.hasListeners(),y=!I&&fM($,Z),C=I&&mM($,J,Z,Q);if(y||C)W={...W,...NB(K.data,$.options)};if(Z._optimisticResults==="isRestoring")W.fetchStatus="idle"}let{error:U,errorUpdatedAt:F,status:N}=W;q=W.data;let L=!1;if(Z.placeholderData!==void 0&&q===void 0&&N==="pending"){let I;if(X?.isPlaceholderData&&Z.placeholderData===G?.placeholderData)I=X.data,L=!0;else I=typeof Z.placeholderData==="function"?Z.placeholderData(this.#F?.state.data,this.#F):Z.placeholderData;if(I!==void 0)N="success",q=lZ(X?.data,I,Z),B=!0}if(Z.select&&q!==void 0&&!L)if(X&&q===z?.data&&Z.select===this.#Y)q=this.#U;else try{this.#Y=Z.select,q=Z.select(q),q=lZ(X?.data,q,Z),this.#U=q,this.#H=null}catch(I){this.#H=I}if(this.#H)U=this.#H,q=this.#U,F=Date.now(),N="error";let V=W.fetchStatus==="fetching",M=N==="pending",_=N==="error",O=M&&V,D=q!==void 0,E={status:N,fetchStatus:W.fetchStatus,isPending:M,isSuccess:N==="success",isError:_,isInitialLoading:O,isLoading:O,data:q,dataUpdatedAt:W.dataUpdatedAt,error:U,errorUpdatedAt:F,failureCount:W.fetchFailureCount,failureReason:W.fetchFailureReason,errorUpdateCount:W.errorUpdateCount,isFetched:$.isFetched(),isFetchedAfterMount:W.dataUpdateCount>Y.dataUpdateCount||W.errorUpdateCount>Y.errorUpdateCount,isFetching:V,isRefetching:V&&!M,isLoadingError:_&&!D,isPaused:W.fetchStatus==="paused",isPlaceholderData:B,isRefetchError:_&&D,isStale:MB($,Z),refetch:this.refetch,promise:this.#G,isEnabled:d8(Z.enabled,$)!==!1};if(this.options.experimental_prefetchInRender){let I=E.data!==void 0,y=E.status==="error"&&!I,C=(S)=>{if(y)S.reject(E.error);else if(I)S.resolve(E.data)},h=()=>{let S=this.#G=E.promise=iZ();C(S)},k=this.#G;switch(k.status){case"pending":if($.queryHash===J.queryHash)C(k);break;case"fulfilled":if(y||E.data!==k.value)h();break;case"rejected":if(!y||E.error!==k.reason)h();break}}return E}updateResult(){let $=this.#X,Z=this.createResult(this.#Z,this.options);if(this.#Q=this.#Z.state,this.#z=this.options,this.#Q.data!==void 0)this.#F=this.#Z;if(j7(Z,$))return;this.#X=Z;let J=()=>{if(!$)return!0;let{notifyOnChangeProps:Q}=this.options,X=typeof Q==="function"?Q():Q;if(X==="all"||!X&&!this.#N.size)return!0;let z=new Set(X??this.#N);if(this.options.throwOnError)z.add("error");return Object.keys(this.#X).some((G)=>{let H=G;return this.#X[H]!==$[H]&&z.has(H)})};this.#P({listeners:J()})}#O(){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.#A()}#P($){g5.batch(()=>{if($.listeners)this.listeners.forEach((Z)=>{Z(this.#X)});this.#$.getQueryCache().notify({query:this.#Z,type:"observerResultsUpdated"})})}};function Qu($,Z){return d8(Z.enabled,$)!==!1&&$.state.data===void 0&&!($.state.status==="error"&&d8(Z.retryOnMount,$)===!1)}function fM($,Z){return Qu($,Z)||$.state.data!==void 0&&VB($,Z,Z.refetchOnMount)}function VB($,Z,J){if(d8(Z.enabled,$)!==!1&&X2(Z.staleTime,$)!=="static"){let Q=typeof J==="function"?J($):J;return Q==="always"||Q!==!1&&MB($,Z)}return!1}function mM($,Z,J,Q){return($!==Z||d8(Q.enabled,$)===!1)&&(!J.suspense||$.state.status!=="error")&&MB($,J)}function MB($,Z){return d8(Z.enabled,$)!==!1&&$.isStaleByTime(X2(Z.staleTime,$))}function Xu($,Z){if(!j7($.getCurrentResult(),Z))return!0;return!1}function AB($){return{onFetch:(Z,J)=>{let Q=Z.options,X=Z.fetchOptions?.meta?.fetchMore?.direction,z=Z.state.data?.pages||[],G=Z.state.data?.pageParams||[],H={pages:[],pageParams:[]},Y=0,K=async()=>{let W=!1,B=(F)=>{bM(F,()=>Z.signal,()=>W=!0)},q=uX(Z.options,Z.fetchOptions),U=async(F,N,L)=>{if(W)return Promise.reject();if(N==null&&F.pages.length)return Promise.resolve(F);let M=(()=>{let A={client:Z.client,queryKey:Z.queryKey,pageParam:N,direction:L?"backward":"forward",meta:Z.options.meta};return B(A),A})(),_=await q(M),{maxPages:O}=Z.options,D=L?yM:RM;return{pages:D(F.pages,_,O),pageParams:D(F.pageParams,N,O)}};if(X&&z.length){let F=X==="backward",N=F?zu:pM,L={pages:z,pageParams:G},V=N(Q,L);H=await U(L,V,F)}else{let F=$??z.length;do{let N=Y===0?G[0]??Q.initialPageParam:pM(Q,H);if(Y>0&&N==null)break;H=await U(H,N),Y++}while(Y<F)}return H};if(Z.options.persister)Z.fetchFn=()=>{return Z.options.persister?.(K,{client:Z.client,queryKey:Z.queryKey,meta:Z.options.meta,signal:Z.signal},J)};else Z.fetchFn=K}}}function pM($,{pages:Z,pageParams:J}){let Q=Z.length-1;return Z.length>0?$.getNextPageParam(Z[Q],Z,J[Q],J):void 0}function zu($,{pages:Z,pageParams:J}){return Z.length>0?$.getPreviousPageParam?.(Z[0],Z,J[0],J):void 0}var uM=class extends lX{#$;#Z;#J;#X;constructor($){super();this.#$=$.client,this.mutationId=$.mutationId,this.#J=$.mutationCache,this.#Z=[],this.state=$.state||_B(),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.#X?.continue()??this.execute(this.state.variables)}async execute($){let Z=()=>{this.#Q({type:"continue"})},J={client:this.#$,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#X=dX({fn:()=>{if(!this.options.mutationFn)return Promise.reject(Error("No mutationFn found"));return this.options.mutationFn($,J)},onFail:(z,G)=>{this.#Q({type:"failed",failureCount:z,error:G})},onPause:()=>{this.#Q({type:"pause"})},onContinue:Z,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#J.canRun(this)});let Q=this.state.status==="pending",X=!this.#X.canStart();try{if(Q)Z();else{if(this.#Q({type:"pending",variables:$,isPaused:X}),this.#J.config.onMutate)await this.#J.config.onMutate($,this,J);let G=await this.options.onMutate?.($,J);if(G!==this.state.context)this.#Q({type:"pending",context:G,variables:$,isPaused:X})}let z=await this.#X.start();return await this.#J.config.onSuccess?.(z,$,this.state.context,this,J),await this.options.onSuccess?.(z,$,this.state.context,J),await this.#J.config.onSettled?.(z,null,this.state.variables,this.state.context,this,J),await this.options.onSettled?.(z,null,$,this.state.context,J),this.#Q({type:"success",data:z}),z}catch(z){try{await this.#J.config.onError?.(z,$,this.state.context,this,J)}catch(G){Promise.reject(G)}try{await this.options.onError?.(z,$,this.state.context,J)}catch(G){Promise.reject(G)}try{await this.#J.config.onSettled?.(void 0,z,this.state.variables,this.state.context,this,J)}catch(G){Promise.reject(G)}try{await this.options.onSettled?.(void 0,z,$,this.state.context,J)}catch(G){Promise.reject(G)}throw this.#Q({type:"error",error:z}),z}finally{this.#J.runNext(this)}}#Q($){let Z=(J)=>{switch($.type){case"failed":return{...J,failureCount:$.failureCount,failureReason:$.error};case"pause":return{...J,isPaused:!0};case"continue":return{...J,isPaused:!1};case"pending":return{...J,context:$.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:$.isPaused,status:"pending",variables:$.variables,submittedAt:Date.now()};case"success":return{...J,data:$.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...J,data:void 0,error:$.error,failureCount:J.failureCount+1,failureReason:$.error,isPaused:!1,status:"error"}}};this.state=Z(this.state),g5.batch(()=>{this.#Z.forEach((J)=>{J.onMutationUpdate($)}),this.#J.notify({mutation:this,type:"updated",action:$})})}};function _B(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var cM=class extends h4{constructor($={}){super();this.config=$,this.#$=new Set,this.#Z=new Map,this.#J=0}#$;#Z;#J;build($,Z,J){let Q=new uM({client:$,mutationCache:this,mutationId:++this.#J,options:$.defaultMutationOptions(Z),state:J});return this.add(Q),Q}add($){this.#$.add($);let Z=iX($);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=iX($);if(typeof Z==="string"){let J=this.#Z.get(Z);if(J){if(J.length>1){let Q=J.indexOf($);if(Q!==-1)J.splice(Q,1)}else if(J[0]===$)this.#Z.delete(Z)}}}this.notify({type:"removed",mutation:$})}canRun($){let Z=iX($);if(typeof Z==="string"){let Q=this.#Z.get(Z)?.find((X)=>X.state.status==="pending");return!Q||Q===$}else return!0}runNext($){let Z=iX($);if(typeof Z==="string")return this.#Z.get(Z)?.find((Q)=>Q!==$&&Q.state.isPaused)?.continue()??Promise.resolve();else return Promise.resolve()}clear(){g5.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)=>pX(Z,J))}findAll($={}){return this.getAll().filter((Z)=>pX($,Z))}notify($){g5.batch(()=>{this.listeners.forEach((Z)=>{Z($)})})}resumePausedMutations(){let $=this.getAll().filter((Z)=>Z.state.isPaused);return g5.batch(()=>Promise.all($.map((Z)=>Z.continue().catch(k1))))}};function iX($){return $.options.scope?.id}var DB=class extends h4{#$;#Z=void 0;#J;#X;constructor($,Z){super();this.#$=$,this.setOptions(Z),this.bindMethods(),this.#Q()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions($){let Z=this.options;if(this.options=this.#$.defaultMutationOptions($),!j7(this.options,Z))this.#$.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#J,observer:this});if(Z?.mutationKey&&this.options.mutationKey&&k2(Z.mutationKey)!==k2(this.options.mutationKey))this.reset();else if(this.#J?.state.status==="pending")this.#J.setOptions(this.options)}onUnsubscribe(){if(!this.hasListeners())this.#J?.removeObserver(this)}onMutationUpdate($){this.#Q(),this.#z($)}getCurrentResult(){return this.#Z}reset(){this.#J?.removeObserver(this),this.#J=void 0,this.#Q(),this.#z()}mutate($,Z){return this.#X=Z,this.#J?.removeObserver(this),this.#J=this.#$.getMutationCache().build(this.#$,this.options),this.#J.addObserver(this),this.#J.execute($)}#Q(){let $=this.#J?.state??_B();this.#Z={...$,isPending:$.status==="pending",isSuccess:$.status==="success",isError:$.status==="error",isIdle:$.status==="idle",mutate:this.mutate,reset:this.reset}}#z($){g5.batch(()=>{if(this.#X&&this.hasListeners()){let Z=this.#Z.variables,J=this.#Z.context,Q={client:this.#$,meta:this.options.meta,mutationKey:this.options.mutationKey};if($?.type==="success"){try{this.#X.onSuccess?.($.data,Z,J,Q)}catch(X){Promise.reject(X)}try{this.#X.onSettled?.($.data,null,Z,J,Q)}catch(X){Promise.reject(X)}}else if($?.type==="error"){try{this.#X.onError?.($.error,Z,J,Q)}catch(X){Promise.reject(X)}try{this.#X.onSettled?.(void 0,$.error,Z,J,Q)}catch(X){Promise.reject(X)}}}this.listeners.forEach((Z)=>{Z(this.#Z)})})}};var dM=class extends h4{constructor($={}){super();this.config=$,this.#$=new Map}#$;build($,Z,J){let Q=Z.queryKey,X=Z.queryHash??cZ(Q,Z),z=this.get(X);if(!z)z=new vM({client:$,queryKey:Q,queryHash:X,options:$.defaultQueryOptions(Z),state:J,defaultOptions:$.getQueryDefaults(Q)}),this.add(z);return z}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(){g5.batch(()=>{this.getAll().forEach(($)=>{this.remove($)})})}get($){return this.#$.get($)}getAll(){return[...this.#$.values()]}find($){let Z={exact:!0,...$};return this.getAll().find((J)=>mX(Z,J))}findAll($={}){let Z=this.getAll();return Object.keys($).length>0?Z.filter((J)=>mX($,J)):Z}notify($){g5.batch(()=>{this.listeners.forEach((Z)=>{Z($)})})}onFocus(){g5.batch(()=>{this.getAll().forEach(($)=>{$.onFocus()})})}onOnline(){g5.batch(()=>{this.getAll().forEach(($)=>{$.onOnline()})})}};var OB=class{#$;#Z;#J;#X;#Q;#z;#G;#H;constructor($={}){this.#$=$.queryCache||new dM,this.#Z=$.mutationCache||new cM,this.#J=$.defaultOptions||{},this.#X=new Map,this.#Q=new Map,this.#z=0}mount(){if(this.#z++,this.#z!==1)return;this.#G=w7.subscribe(async($)=>{if($)await this.resumePausedMutations(),this.#$.onFocus()}),this.#H=E7.subscribe(async($)=>{if($)await this.resumePausedMutations(),this.#$.onOnline()})}unmount(){if(this.#z--,this.#z!==0)return;this.#G?.(),this.#G=void 0,this.#H?.(),this.#H=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),Q=J.state.data;if(Q===void 0)return this.fetchQuery($);if($.revalidateIfStale&&J.isStaleByTime(X2(Z.staleTime,J)))this.prefetchQuery(Z);return Promise.resolve(Q)}getQueriesData($){return this.#$.findAll($).map(({queryKey:Z,state:J})=>{let Q=J.data;return[Z,Q]})}setQueryData($,Z,J){let Q=this.defaultQueryOptions({queryKey:$}),z=this.#$.get(Q.queryHash)?.state.data,G=kM(Z,z);if(G===void 0)return;return this.#$.build(this,Q).setData(G,{...J,manual:!0})}setQueriesData($,Z,J){return g5.batch(()=>this.#$.findAll($).map(({queryKey:Q})=>[Q,this.setQueryData(Q,Z,J)]))}getQueryState($){let Z=this.defaultQueryOptions({queryKey:$});return this.#$.get(Z.queryHash)?.state}removeQueries($){let Z=this.#$;g5.batch(()=>{Z.findAll($).forEach((J)=>{Z.remove(J)})})}resetQueries($,Z){let J=this.#$;return g5.batch(()=>{return J.findAll($).forEach((Q)=>{Q.reset()}),this.refetchQueries({type:"active",...$},Z)})}cancelQueries($,Z={}){let J={revert:!0,...Z},Q=g5.batch(()=>this.#$.findAll($).map((X)=>X.cancel(J)));return Promise.all(Q).then(k1).catch(k1)}invalidateQueries($,Z={}){return g5.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},Q=g5.batch(()=>this.#$.findAll($).filter((X)=>!X.isDisabled()&&!X.isStatic()).map((X)=>{let z=X.fetch(void 0,J);if(!J.throwOnError)z=z.catch(k1);return X.state.fetchStatus==="paused"?Promise.resolve():z}));return Promise.all(Q).then(k1)}fetchQuery($){let Z=this.defaultQueryOptions($);if(Z.retry===void 0)Z.retry=!1;let J=this.#$.build(this,Z);return J.isStaleByTime(X2(Z.staleTime,J))?J.fetch(Z):Promise.resolve(J.state.data)}prefetchQuery($){return this.fetchQuery($).then(k1).catch(k1)}fetchInfiniteQuery($){return $.behavior=AB($.pages),this.fetchQuery($)}prefetchInfiniteQuery($){return this.fetchInfiniteQuery($).then(k1).catch(k1)}ensureInfiniteQueryData($){return $.behavior=AB($.pages),this.ensureQueryData($)}resumePausedMutations(){if(E7.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.#X.set(k2($),{queryKey:$,defaultOptions:Z})}getQueryDefaults($){let Z=[...this.#X.values()],J={};return Z.forEach((Q)=>{if(J3($,Q.queryKey))Object.assign(J,Q.defaultOptions)}),J}setMutationDefaults($,Z){this.#Q.set(k2($),{mutationKey:$,defaultOptions:Z})}getMutationDefaults($){let Z=[...this.#Q.values()],J={};return Z.forEach((Q)=>{if(J3($,Q.mutationKey))Object.assign(J,Q.defaultOptions)}),J}defaultQueryOptions($){if($._defaulted)return $;let Z={...this.#J.queries,...this.getQueryDefaults($.queryKey),...$,_defaulted:!0};if(!Z.queryHash)Z.queryHash=cZ(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===T7)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 c9=P(v(),1);var S7=P(v(),1),lM=P(d(),1),PB=S7.createContext(void 0),o0=($)=>{let Z=S7.useContext(PB);if($)return $;if(!Z)throw Error("No QueryClient set, use QueryClientProvider to set one");return Z},wB=({client:$,children:Z})=>{return S7.useEffect(()=>{return $.mount(),()=>{$.unmount()}},[$]),lM.jsx(PB.Provider,{value:$,children:Z})};var rZ=P(v(),1),Gu=P(d(),1);function Hu(){let $=!1;return{clearReset:()=>{$=!1},reset:()=>{$=!0},isReset:()=>{return $}}}var Yu=rZ.createContext(Hu()),iM=()=>rZ.useContext(Yu);var rM=P(v(),1);var aM=($,Z,J)=>{let Q=J?.state.error&&typeof $.throwOnError==="function"?C7($.throwOnError,[J.state.error,J]):$.throwOnError;if($.suspense||$.experimental_prefetchInRender||Q){if(!Z.isReset())$.retryOnMount=!1}},nM=($)=>{rM.useEffect(()=>{$.clearReset()},[$])},oM=({result:$,errorResetBoundary:Z,throwOnError:J,query:Q,suspense:X})=>{return $.isError&&!Z.isReset()&&!$.isFetching&&Q&&(X&&$.data===void 0||C7(J,[$.error,Q]))};var rX=P(v(),1),sM=rX.createContext(!1),tM=()=>rX.useContext(sM),AQ0=sM.Provider;var eM=($)=>{if($.suspense){let J=(X)=>X==="static"?X:Math.max(X??1000,1000),Q=$.staleTime;if($.staleTime=typeof Q==="function"?(...X)=>J(Q(...X)):J(Q),typeof $.gcTime==="number")$.gcTime=Math.max($.gcTime,1000)}},$A=($,Z)=>$.isLoading&&$.isFetching&&!Z,ZA=($,Z)=>$?.suspense&&Z.isPending,jB=($,Z,J)=>Z.fetchOptimistic($).catch(()=>{J.clearReset()});function JA($,Z,J){let Q=tM(),X=iM(),z=o0(J),G=z.defaultQueryOptions($);z.getDefaultOptions().queries?._experimental_beforeQuery?.(G);let H=z.getQueryCache().get(G.queryHash);G._optimisticResults=Q?"isRestoring":"optimistic",eM(G),aM(G,X,H),nM(X);let Y=!z.getQueryCache().get(G.queryHash),[K]=c9.useState(()=>new Z(z,G)),W=K.getOptimisticResult(G),B=!Q&&$.subscribed!==!1;if(c9.useSyncExternalStore(c9.useCallback((q)=>{let U=B?K.subscribe(g5.batchCalls(q)):k1;return K.updateResult(),U},[K,B]),()=>K.getCurrentResult(),()=>K.getCurrentResult()),c9.useEffect(()=>{K.setOptions(G)},[G,K]),ZA(G,W))throw jB(G,K,X);if(oM({result:W,errorResetBoundary:X,throwOnError:G.throwOnError,query:H,suspense:G.suspense}))throw W.error;if(z.getDefaultOptions().queries?._experimental_afterQuery?.(G,W),G.experimental_prefetchInRender&&!I2.isServer()&&$A(W,Q))(Y?jB(G,K,X):H?.promise)?.catch(k1).finally(()=>{K.updateResult()});return!G.notifyOnChangeProps?K.trackResult(W):W}function X1($,Z){return JA($,LB,Z)}var D9=P(v(),1);function TB($,Z){let J=o0(Z);return XA({filters:{...$,status:"pending"}},J).length}function QA($,Z){return $.findAll(Z.filters).map((J)=>Z.select?Z.select(J):J.state)}function XA($={},Z){let J=o0(Z).getMutationCache(),Q=D9.useRef($),X=D9.useRef(null);if(X.current===null)X.current=QA(J,$);return D9.useEffect(()=>{Q.current=$}),D9.useSyncExternalStore(D9.useCallback((z)=>J.subscribe(()=>{let G=dZ(X.current,QA(J,Q.current));if(X.current!==G)X.current=G,g5.schedule(z)}),[J]),()=>X.current,()=>X.current)}var O9=P(v(),1);function t5($,Z){let J=o0(Z),[Q]=O9.useState(()=>new DB(J,$));O9.useEffect(()=>{Q.setOptions($)},[Q,$]);let X=O9.useSyncExternalStore(O9.useCallback((G)=>Q.subscribe(g5.batchCalls(G)),[Q]),()=>Q.getCurrentResult(),()=>Q.getCurrentResult()),z=O9.useCallback((G,H)=>{Q.mutate(G,H).catch(k1)},[Q]);if(X.error&&C7(Q.options.throwOnError,[X.error]))throw X.error;return{...X,mutate:z,mutateAsync:X.mutate}}var ip=P(bZ0(),1);function zA($,Z){if($ instanceof RegExp)return{keys:!1,pattern:$};var J,Q,X,z,G=[],H="",Y=$.split("/");Y[0]||Y.shift();while(X=Y.shift())if(J=X[0],J==="*")G.push(J),H+=X[1]==="?"?"(?:/(.*))?":"/(.*)";else if(J===":"){if(Q=X.indexOf("?",1),z=X.indexOf(".",1),G.push(X.substring(1,~Q?Q:~z?z:X.length)),H+=!!~Q&&!~z?"(?:/([^/]+?))?":"/([^/]+?)",~z)H+=(~Q?"?":"")+"\\"+X.substring(z)}else H+="/"+X;return{keys:G,pattern:new RegExp("^"+H+(Z?"(?=$|/)":"/?$"),"i")}}var Q3=P(v(),1),O5=P(v(),1);var nX=P(aX(),1);var _u=Q3.useInsertionEffect,Du=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",EB=Du?Q3.useLayoutEffect:Q3.useEffect,Ou=_u||EB,oX=($)=>{let Z=Q3.useRef([$,(...J)=>Z[0](...J)]).current;return Ou(()=>{Z[0]=$}),Z[1]};var Pu="popstate",SB="pushState",kB="replaceState",wu="hashchange",GA=[Pu,SB,kB,wu],ju=($)=>{for(let Z of GA)addEventListener(Z,$);return()=>{for(let Z of GA)removeEventListener(Z,$)}},IB=($,Z)=>nX.useSyncExternalStore(ju,$,Z),HA=()=>location.search,WA=({ssrSearch:$}={})=>IB(HA,$!=null?()=>$:HA),YA=()=>location.pathname,Tu=({ssrPath:$}={})=>IB(YA,$!=null?()=>$:YA),Cu=()=>history.state,BA=()=>IB(Cu,()=>null),Eu=($,{replace:Z=!1,state:J=null}={})=>history[Z?kB:SB](J,"",$),qA=($={})=>[Tu($),Eu],KA=Symbol.for("wouter_v3");if(typeof history<"u"&&typeof window[KA]>"u"){for(let $ of[SB,kB]){let Z=history[$];history[$]=function(){let J=Z.apply(this,arguments),Q=new Event($);return Q.arguments=arguments,dispatchEvent(Q),J}}Object.defineProperty(window,KA,{value:!0})}var Su=($,Z)=>!Z.toLowerCase().indexOf($.toLowerCase())?Z.slice($.length)||"/":"~"+Z,FA=($="")=>$==="/"?"":$,NA=($,Z)=>$[0]==="~"?$.slice(1):FA(Z)+$,VA=($="",Z)=>Su(UA(FA($)),UA(Z));var UA=($)=>{try{return decodeURI($)}catch(Z){return $}};var MA={hook:qA,searchHook:WA,parser:zA,base:"",ssrPath:void 0,ssrSearch:void 0,ssrContext:void 0,hrefs:($)=>$,aroundNav:($,Z,J)=>$(Z,J)},AA=O5.createContext(MA),k7=()=>O5.useContext(AA),_A={},DA=O5.createContext(_A),RB=()=>O5.useContext(DA),aZ=($)=>{let[Z,J]=$.hook($);return[VA($.base,Z),oX((Q,X)=>$.aroundNav(J,NA(Q,$.base),X))]},g4=()=>aZ(k7());var OA=($,Z,J,Q)=>{let{pattern:X,keys:z}=Z instanceof RegExp?{keys:!1,pattern:Z}:$(Z||"*",Q),G=X.exec(J)||[],[H,...Y]=G;return H!==void 0?[!0,(()=>{let K=z!==!1?Object.fromEntries(z.map((B,q)=>[B,Y[q]])):G.groups,W={...Y};return K&&Object.assign(W,K),W})(),...Q?[H]:[]]:[!1,null]};var yB=({children:$,...Z})=>{let J=k7(),Q=Z.hook?MA:J,X=Q,[z,G=Z.ssrSearch??""]=Z.ssrPath?.split("?")??[];if(z)Z.ssrSearch=G,Z.ssrPath=z;Z.hrefs=Z.hrefs??Z.hook?.hrefs,Z.searchHook=Z.searchHook??Z.hook?.searchHook;let H=O5.useRef({}),Y=H.current,K=Y;for(let W in Q){let B=W==="base"?Q[W]+(Z[W]??""):Z[W]??Q[W];if(Y===K&&B!==K[W])H.current=K={...K};if(K[W]=B,B!==Q[W]||B!==X[W])X=K}return O5.createElement(AA.Provider,{value:X,children:$})},LA=({children:$,component:Z},J)=>{if(Z)return O5.createElement(Z,{params:J});return typeof $==="function"?$(J):$},ku=($)=>{let Z=O5.useRef(_A),J=Z.current;return Z.current=Object.keys($).length!==Object.keys(J).length||Object.entries($).some(([Q,X])=>X!==J[Q])?$:J};var sX=({path:$,nest:Z,match:J,...Q})=>{let X=k7(),[z]=aZ(X),[G,H,Y]=J??OA(X.parser,$,z,Z),K=ku({...RB(),...H});if(!G)return null;let W=Y?O5.createElement(yB,{base:Y},LA(Q,K)):LA(Q,K);return O5.createElement(DA.Provider,{value:K,children:W})},nZ=O5.forwardRef(($,Z)=>{let J=k7(),[Q,X]=aZ(J),{to:z="",href:G=z,onClick:H,asChild:Y,children:K,className:W,replace:B,state:q,transition:U,...F}=$,N=oX((V)=>{if(V.ctrlKey||V.metaKey||V.altKey||V.shiftKey||V.button!==0)return;if(H?.(V),!V.defaultPrevented)V.preventDefault(),X(G,$)}),L=J.hrefs(G[0]==="~"?G.slice(1):J.base+G,J);return Y&&O5.isValidElement(K)?O5.cloneElement(K,{onClick:N,href:L}):O5.createElement("a",{...F,onClick:N,href:L,className:W?.call?W(Q===G):W,children:K,ref:Z})}),PA=($)=>Array.isArray($)?$.flatMap((Z)=>PA(Z&&Z.type===O5.Fragment?Z.props.children:Z)):[$],wA=({children:$,location:Z})=>{let J=k7(),[Q]=aZ(J);for(let X of PA($)){let z=0;if(O5.isValidElement(X)&&(z=OA(J.parser,X.props.path,Z||Q,X.props.nest))[0])return O5.cloneElement(X,{match:z})}return null},jA=($)=>{let{to:Z,href:J=Z}=$,Q=k7(),[,X]=aZ(Q),z=oX(()=>X(Z||J,$)),{ssrContext:G}=Q;if(EB(()=>{z()},[]),G)G.redirectTo=Z;return null};var I8={};_4(I8,{useToastManager:()=>AD,createToastManager:()=>_D,Viewport:()=>N_,Title:()=>S_,Root:()=>D_,Provider:()=>W_,Positioner:()=>VD,Portal:()=>JD,Description:()=>C_,Content:()=>O_,Close:()=>k_,Arrow:()=>MD,Action:()=>R_});var Y_=P(v(),1);var TA=P(v(),1),Iu=[];function T8($){TA.useEffect($,Iu)}var tX=P(v(),1),oZ=tX.createContext(void 0);function d9(){let $=tX.useContext(oZ);if(!$)throw Error(C0(73));return $}var $z=Symbol("NOT_FOUND");function Ru($,Z=`expected a function, instead received ${typeof $}`){if(typeof $!=="function")throw TypeError(Z)}function yu($,Z=`expected an object, instead received ${typeof $}`){if(typeof $!=="object")throw TypeError(Z)}function bu($,Z="expected all items to be functions, instead received the following types: "){if(!$.every((J)=>typeof J==="function")){let J=$.map((Q)=>typeof Q==="function"?`function ${Q.name||"unnamed"}()`:typeof Q).join(", ");throw TypeError(`${Z}[${J}]`)}}var CA=($)=>{return Array.isArray($)?$:[$]};function xu($){let Z=Array.isArray($[0])?$[0]:$;return bu(Z,"createSelector expects all input-selectors to be functions, but received the following types: "),Z}function hu($,Z){let J=[],{length:Q}=$;for(let X=0;X<Q;X++)J.push($[X].apply(null,Z));return J}var EA=0,gu=null,kA=class{revision=EA;_value;_lastValue;_isEqual=bB;constructor($,Z=bB){this._value=this._lastValue=$,this._isEqual=Z}get value(){return gu?.add(this),this._value}set value($){if(this.value===$)return;this._value=$,this.revision=++EA}};function bB($,Z){return $===Z}function xB($){if(!($ instanceof kA))console.warn("Not a valid cell! ",$);return $.value}function vu($,Z=bB){return new kA($,Z)}var fu=($,Z)=>!1;function Zz(){return vu(null,fu)}var IA=($)=>{let Z=$.collectionTag;if(Z===null)Z=$.collectionTag=Zz();xB(Z)};var vX0=Symbol(),RA=0,mu=Object.getPrototypeOf({}),pu=class{constructor($){this.value=$,this.value=$,this.tag.value=$}proxy=new Proxy(this,sZ);tag=Zz();tags={};children={};collectionTag=null;id=RA++},sZ={get($,Z){function J(){let{value:X}=$,z=Reflect.get(X,Z);if(typeof Z==="symbol")return z;if(Z in mu)return z;if(typeof z==="object"&&z!==null){let G=$.children[Z];if(G===void 0)G=$.children[Z]=du(z);if(G.tag)xB(G.tag);return G.proxy}else{let G=$.tags[Z];if(G===void 0)G=$.tags[Z]=Zz(),G.value=z;return xB(G),z}}return J()},ownKeys($){return IA($),Reflect.ownKeys($.value)},getOwnPropertyDescriptor($,Z){return Reflect.getOwnPropertyDescriptor($.value,Z)},has($,Z){return Reflect.has($.value,Z)}},uu=class{constructor($){this.value=$,this.value=$,this.tag.value=$}proxy=new Proxy([this],cu);tag=Zz();tags={};children={};collectionTag=null;id=RA++},cu={get([$],Z){if(Z==="length")IA($);return sZ.get($,Z)},ownKeys([$]){return sZ.ownKeys($)},getOwnPropertyDescriptor([$],Z){return sZ.getOwnPropertyDescriptor($,Z)},has([$],Z){return sZ.has($,Z)}};function du($){if(Array.isArray($))return new uu($);return new pu($)}function lu($){let Z;return{get(J){if(Z&&$(Z.key,J))return Z.value;return $z},put(J,Q){Z={key:J,value:Q}},getEntries(){return Z?[Z]:[]},clear(){Z=void 0}}}function iu($,Z){let J=[];function Q(H){let Y=J.findIndex((K)=>Z(H,K.key));if(Y>-1){let K=J[Y];if(Y>0)J.splice(Y,1),J.unshift(K);return K.value}return $z}function X(H,Y){if(Q(H)===$z){if(J.unshift({key:H,value:Y}),J.length>$)J.pop()}}function z(){return J}function G(){J=[]}return{get:Q,put:X,getEntries:z,clear:G}}var ru=($,Z)=>$===Z;function au($){return function(J,Q){if(J===null||Q===null||J.length!==Q.length)return!1;let{length:X}=J;for(let z=0;z<X;z++)if(!$(J[z],Q[z]))return!1;return!0}}function yA($,Z){let J=typeof Z==="object"?Z:{equalityCheck:Z},{equalityCheck:Q=ru,maxSize:X=1,resultEqualityCheck:z}=J,G=au(Q),H=0,Y=X<=1?lu(G):iu(X,G);function K(){let W=Y.get(arguments);if(W===$z){if(W=$.apply(null,arguments),H++,z){let q=Y.getEntries().find((U)=>z(U.value,W));if(q)W=q.value,H!==0&&H--}Y.put(arguments,W)}return W}return K.clearCache=()=>{Y.clear(),K.resetResultsCount()},K.resultsCount=()=>H,K.resetResultsCount=()=>{H=0},K}var nu=class{constructor($){this.value=$}deref(){return this.value}},ou=typeof WeakRef<"u"?WeakRef:nu,su=0,SA=1;function eX(){return{s:su,v:void 0,o:null,p:null}}function bA($,Z={}){let J=eX(),{resultEqualityCheck:Q}=Z,X,z=0;function G(){let H=J,{length:Y}=arguments;for(let B=0,q=Y;B<q;B++){let U=arguments[B];if(typeof U==="function"||typeof U==="object"&&U!==null){let F=H.o;if(F===null)H.o=F=new WeakMap;let N=F.get(U);if(N===void 0)H=eX(),F.set(U,H);else H=N}else{let F=H.p;if(F===null)H.p=F=new Map;let N=F.get(U);if(N===void 0)H=eX(),F.set(U,H);else H=N}}let K=H,W;if(H.s===SA)W=H.v;else if(W=$.apply(null,arguments),z++,Q){let B=X?.deref?.()??X;if(B!=null&&Q(B,W))W=B,z!==0&&z--;X=typeof W==="object"&&W!==null||typeof W==="function"?new ou(W):W}return K.s=SA,K.v=W,W}return G.clearCache=()=>{J=eX(),G.resetResultsCount()},G.resultsCount=()=>z,G.resetResultsCount=()=>{z=0},G}function hB($,...Z){let J=typeof $==="function"?{memoize:$,memoizeOptions:Z}:$,Q=(...X)=>{let z=0,G=0,H,Y={},K=X.pop();if(typeof K==="object")Y=K,K=X.pop();Ru(K,`createSelector expects an output function after the inputs, but received: [${typeof K}]`);let W={...J,...Y},{memoize:B,memoizeOptions:q=[],argsMemoize:U=bA,argsMemoizeOptions:F=[],devModeChecks:N={}}=W,L=CA(q),V=CA(F),M=xu(X),_=B(function(){return z++,K.apply(null,arguments)},...L),O=!0,D=U(function(){G++;let E=hu(M,arguments);return H=_.apply(null,E),H},...V);return Object.assign(D,{resultFunc:K,memoizedResultFunc:_,dependencies:M,dependencyRecomputations:()=>G,resetDependencyRecomputations:()=>{G=0},lastResult:()=>H,recomputations:()=>z,resetRecomputations:()=>{z=0},memoize:B,argsMemoize:U})};return Object.assign(Q,{withTypes:()=>Q}),Q}var tu=hB(bA),eu=Object.assign(($,Z=tu)=>{yu($,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof $}`);let J=Object.keys($),Q=J.map((z)=>$[z]);return Z(Q,(...z)=>{return z.reduce((G,H,Y)=>{return G[J[Y]]=H,G},{})})},{withTypes:()=>eu});var $c=hB({memoize:yA,memoizeOptions:{maxSize:1,equalityCheck:Object.is}}),E0=($,Z,J,Q,X,z,...G)=>{if(G.length>0)throw Error(C0(1));let H;if($&&Z&&J&&Q&&X&&z)H=(Y,K,W,B)=>{let q=$(Y,K,W,B),U=Z(Y,K,W,B),F=J(Y,K,W,B),N=Q(Y,K,W,B),L=X(Y,K,W,B);return z(q,U,F,N,L,K,W,B)};else if($&&Z&&J&&Q&&X)H=(Y,K,W,B)=>{let q=$(Y,K,W,B),U=Z(Y,K,W,B),F=J(Y,K,W,B),N=Q(Y,K,W,B);return X(q,U,F,N,K,W,B)};else if($&&Z&&J&&Q)H=(Y,K,W,B)=>{let q=$(Y,K,W,B),U=Z(Y,K,W,B),F=J(Y,K,W,B);return Q(q,U,F,K,W,B)};else if($&&Z&&J)H=(Y,K,W,B)=>{let q=$(Y,K,W,B),U=Z(Y,K,W,B);return J(q,U,K,W,B)};else if($&&Z)H=(Y,K,W,B)=>{let q=$(Y,K,W,B);return Z(q,K,W,B)};else if($)H=$;else throw Error("Missing arguments");return H},xA=(...$)=>{let Z=new WeakMap,J=1,Q=$[$.length-1],X=$.length-1||1,z=Q.length-X;if(z>3)throw Error(C0(2));return(H,Y,K,W)=>{let B=H.__cacheKey__;if(!B)B={id:J},H.__cacheKey__=B,J+=1;let q=Z.get(B);if(!q){let U=$,F=[void 0,void 0,void 0];switch(z){case 0:break;case 1:{U=[...$.slice(0,-1),()=>F[0],Q];break}case 2:{U=[...$.slice(0,-1),()=>F[0],()=>F[1],Q];break}case 3:{U=[...$.slice(0,-1),()=>F[0],()=>F[1],()=>F[2],Q];break}default:throw Error(C0(2))}q=$c(...U),q.selectorArgs=F,Z.set(B,q)}switch(q.selectorArgs[0]=Y,q.selectorArgs[1]=K,q.selectorArgs[2]=W,z){case 0:return q(H);case 1:return q(H,Y);case 2:return q(H,Y,K);case 3:return q(H,Y,K,W);default:throw Error("unreachable")}}};var fA=P(v(),1),mB=P(aX(),1);var l9=P(v(),1),Zc=aX();function Jc($,Z){return $===Z&&($!==0||1/$===1/Z)||$!==$&&Z!==Z}var Qc=typeof Object.is==="function"?Object.is:Jc,Xc=Zc.useSyncExternalStore,zc=l9.useRef,Gc=l9.useEffect,Hc=l9.useMemo,Yc=l9.useDebugValue;var gB=function($,Z,J,Q,X){var z=zc(null);if(z.current===null){var G={hasValue:!1,value:null};z.current=G}else G=z.current;z=Hc(function(){function Y(U){if(!K){if(K=!0,W=U,U=Q(U),X!==void 0&&G.hasValue){var F=G.value;if(X(F,U))return B=F}return B=U}if(F=B,Qc(W,U))return F;var N=Q(U);if(X!==void 0&&X(F,N))return W=U,F;return W=U,B=N}var K=!1,W,B,q=J===void 0?null:J;return[function(){return Y(Z())},q===null?void 0:function(){return Y(q())}]},[Z,J,Q,X]);var H=Xc($,z[0],z[1]);return Gc(function(){G.hasValue=!0,G.value=H},[H]),Yc(H),H};var hA=P(v(),1);var vB=[],fB=void 0;function gA(){return fB}function vA($){vB.push($)}function tZ($){let Z=(J,Q)=>{let X=T5(Kc).current,z;try{fB=X;for(let G of vB)G.before(X);z=$(J,Q);for(let G of vB)G.after(X);X.didInitialize=!0}finally{fB=void 0}return z};return Z.displayName=$.displayName||$.name,Z}function Jz($){return hA.forwardRef(tZ($))}function Kc(){return{didInitialize:!1}}var Wc=Qz(19),Bc=Wc?Uc:Fc;function Xz($,Z,J,Q,X){return Bc($,Z,J,Q,X)}function qc($,Z,J,Q,X){let z=fA.useCallback(()=>Z($.getSnapshot(),J,Q,X),[$,Z,J,Q,X]);return mB.useSyncExternalStore($.subscribe,z,z)}vA({before($){if($.syncIndex=0,!$.didInitialize)$.syncTick=1,$.syncHooks=[],$.didChangeStore=!0,$.getSnapshot=()=>{let Z=!1;for(let J=0;J<$.syncHooks.length;J+=1){let Q=$.syncHooks[J],X=Q.selector(Q.store.state,Q.a1,Q.a2,Q.a3);if(Q.didChange||!Object.is(Q.value,X))Z=!0,Q.value=X,Q.didChange=!1}if(Z)$.syncTick+=1;return $.syncTick}},after($){if($.syncHooks.length>0){if($.didChangeStore)$.didChangeStore=!1,$.subscribe=(Z)=>{let J=new Set;for(let X of $.syncHooks)J.add(X.store);let Q=[];for(let X of J)Q.push(X.subscribe(Z));return()=>{for(let X of Q)X()}};mB.useSyncExternalStore($.subscribe,$.getSnapshot,$.getSnapshot)}}});function Uc($,Z,J,Q,X){let z=gA();if(!z)return qc($,Z,J,Q,X);let G=z.syncIndex;z.syncIndex+=1;let H;if(!z.didInitialize)H={store:$,selector:Z,a1:J,a2:Q,a3:X,value:Z($.getSnapshot(),J,Q,X),didChange:!1},z.syncHooks.push(H);else if(H=z.syncHooks[G],H.store!==$||H.selector!==Z||!Object.is(H.a1,J)||!Object.is(H.a2,Q)||!Object.is(H.a3,X)){if(H.store!==$)z.didChangeStore=!0;H.store=$,H.selector=Z,H.a1=J,H.a2=Q,H.a3=X,H.didChange=!0}return H.value}function Fc($,Z,J,Q,X){return gB($.subscribe,$.getSnapshot,$.getSnapshot,(z)=>Z(z,J,Q,X))}class pB{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,Q){return Xz(this,$,Z,J,Q)}}var X3=P(v(),1);class l8 extends pB{constructor($,Z={},J){super($);this.context=Z,this.selectors=J}useSyncedValue($,Z){X3.useDebugValue($),q0(()=>{if(this.state[$]!==Z)this.set($,Z)},[$,Z])}useSyncedValueWithCleanup($,Z){let J=this;q0(()=>{if(J.state[$]!==Z)J.set($,Z);return()=>{J.set($,void 0)}},[J,$,Z])}useSyncedValues($){let Z=this,J=Object.values($);q0(()=>{Z.update($)},[Z,...J])}useControlledProp($,Z){X3.useDebugValue($);let J=Z!==void 0;q0(()=>{if(J&&!Object.is(this.state[$],Z))super.setState({...this.state,[$]:Z})},[$,Z,J])}select($,Z,J,Q){let X=this.selectors[$];return X(this.state,Z,J,Q)}useState($,Z,J,Q){return X3.useDebugValue($),Xz(this,this.selectors[$],Z,J,Q)}useContextCallback($,Z){X3.useDebugValue($);let J=U0(Z??f5);this.context[$]=J}useStateSetter($){let Z=X3.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 Q=J(this.state);return Z(Q,Q,this),this.subscribe((X)=>{let z=J(X);if(!Object.is(Q,z)){let G=Q;Q=z,Z(z,G,this)}})}}var zz=null,Wz0=globalThis.requestAnimationFrame;class mA{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 Q=0;Q<Z.length;Q+=1)Z[Q]?.($)};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;this.callbacks[Z]=null,this.callbacksCount-=1}}var Gz=new mA;class G1{static create(){return new G1}static request($){return Gz.request($)}static cancel($){return Gz.cancel($)}currentId=zz;request($){this.cancel(),this.currentId=Gz.request(()=>{this.currentId=zz,$()})}cancel=()=>{if(this.currentId!==zz)Gz.cancel(this.currentId),this.currentId=zz};disposeEffect=()=>{return this.cancel}}function z4(){let $=T5(G1.create).current;return T8($.disposeEffect),$}var eZ=0;class l1{static create(){return new l1}currentId=eZ;start($,Z){this.clear(),this.currentId=setTimeout(()=>{this.currentId=eZ,Z()},$)}isStarted(){return this.currentId!==eZ}clear=()=>{if(this.currentId!==eZ)clearTimeout(this.currentId),this.currentId=eZ};disposeEffect=()=>{return this.clear}}function V1(){let $=T5(l1.create).current;return T8($.disposeEffect),$}var pA=0;function Hz($){return pA+=1,`${$}-${Math.random().toString(36).slice(2,6)}-${pA}`}function p0($){return $?.ownerDocument||document}function Yz($,Z){if(typeof $==="string")return{description:$};if(typeof $==="function"){let J=$(Z);return typeof J==="string"?{description:J}:J}return $}var i9=typeof navigator<"u",uB=Nc(),uA=Lc(),Kz=Vc(),Wz=typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter:none"),Bz=uB.platform==="MacIntel"&&uB.maxTouchPoints>1?!0:/iP(hone|ad|od)|iOS/.test(uB.platform),Az0=i9&&/firefox/i.test(Kz),qz=i9&&/apple/i.test(navigator.vendor),_z0=i9&&/Edg/i.test(Kz),Uz=i9&&/android/i.test(uA)||/android/i.test(Kz),cA=i9&&uA.toLowerCase().startsWith("mac")&&!navigator.maxTouchPoints,Fz=Kz.includes("jsdom/");function Nc(){if(!i9)return{platform:"",maxTouchPoints:-1};let $=navigator.userAgentData;if($?.platform)return{platform:$.platform,maxTouchPoints:navigator.maxTouchPoints};return{platform:navigator.platform??"",maxTouchPoints:navigator.maxTouchPoints??-1}}function Vc(){if(!i9)return"";let $=navigator.userAgentData;if($&&Array.isArray($.brands))return $.brands.map(({brand:Z,version:J})=>`${Z}/${J}`).join(" ");return navigator.userAgent}function Lc(){if(!i9)return"";let $=navigator.userAgentData;if($?.platform)return $.platform;return navigator.platform??""}var $J="data-base-ui-focusable",cB="active",dB="selected",I7="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])",R2="ArrowLeft",y2="ArrowRight",ZJ="ArrowUp",z3="ArrowDown";function r5($){let Z=$.activeElement;while(Z?.shadowRoot?.activeElement!=null)Z=Z.shadowRoot.activeElement;return Z}function m0($,Z){if(!$||!Z)return!1;let J=Z.getRootNode?.();if($.contains(Z))return!0;if(J&&dA(J)){let Q=Z;while(Q){if($===Q)return!0;Q=Q.parentNode||Q.host}}return!1}function G3($,Z){if(!_5($))return!1;let J=$;if(Z.hasElement(J))return!J.hasAttribute("data-trigger-disabled");for(let[,Q]of Z.entries())if(m0(Q,J))return!Q.hasAttribute("data-trigger-disabled");return!1}function R5($){if("composedPath"in $)return $.composedPath()[0];return $.target}function v4($,Z){if(Z==null)return!1;if("composedPath"in $)return $.composedPath().includes(Z);let J=$;return J.target!=null&&Z.contains(J.target)}function lA($){return $.matches("html,body")}function H3($){return L1($)&&$.matches(I7)}function JJ($){if(!$)return!1;return $.getAttribute("role")==="combobox"&&H3($)}function r9($){if(!$||Fz)return!0;try{return $.matches(":focus-visible")}catch(Z){return!0}}function Y3($){if(!$)return null;return $.hasAttribute($J)?$:$.querySelector(`[${$J}]`)||$}function b2($,Z,J=!0){return $.filter((X)=>X.parentId===Z&&(!J||X.context?.open)).flatMap((X)=>[X,...b2($,X.id,J)])}function lB($,Z){let J=[],Q=$.find((X)=>X.id===Z)?.parentId;while(Q){let X=$.find((z)=>z.id===Q);if(Q=X?.parentId,X)J=J.concat(X)}return J}function i1($){$.preventDefault(),$.stopPropagation()}function iA($){return"nativeEvent"in $}function Nz($){if($.pointerType===""&&$.isTrusted)return!0;if(Uz&&$.pointerType)return $.type==="click"&&$.buttons===1;return $.detail===0&&!$.pointerType}function Vz($){if(Fz)return!1;return!Uz&&$.width===0&&$.height===0||Uz&&$.width===1&&$.height===1&&$.pressure===0&&$.detail===0&&$.pointerType==="mouse"||$.width<1&&$.height<1&&$.pressure===0&&$.detail===0&&$.pointerType==="touch"}function f4($,Z){let J=["mouse","pen"];if(!Z)J.push("",void 0);return J.includes($)}function Lz($){let Z=$.type;return Z==="click"||Z==="mousedown"||Z==="keydown"||Z==="keyup"}function Mz($,Z,J){return Math.floor($/Z)!==J}function R7($,Z){return Z<0||Z>=$.current.length}function Az($,Z){return A8($,{disabledIndices:Z})}function rB($,Z){return A8($,{decrement:!0,startingIndex:$.current.length,disabledIndices:Z})}function A8($,{startingIndex:Z=-1,decrement:J=!1,disabledIndices:Q,amount:X=1}={}){let z=Z;do z+=J?-X:X;while(z>=0&&z<=$.current.length-1&&y7($,z,Q));return z}function rA($,{event:Z,orientation:J,loopFocus:Q,rtl:X,cols:z,disabledIndices:G,minIndex:H,maxIndex:Y,prevIndex:K,stopEvent:W=!1}){let B=K,q=[],U={},F=!1;{let V=null,M=-1;$.current.forEach((_,O)=>{if(_==null)return;let D=_.closest('[role="row"]');if(D)F=!0;if(D!==V||M===-1)V=D,M+=1,q[M]=[];q[M].push(O),U[O]=M})}let N=F&&q.length>0&&q.some((V)=>V.length!==z);function L(V){if(!N||K===-1)return;let M=U[K];if(M==null)return;let _=q[M].indexOf(K),O=V==="up"?M-1:M+1;if(Q){if(O<0)O=q.length-1;else if(O>=q.length)O=0}let D=new Set;while(O>=0&&O<q.length&&!D.has(O)){D.add(O);let A=q[O];if(A.length===0){O=V==="up"?O-1:O+1;continue}let E=Math.min(_,A.length-1);for(let I=E;I>=0;I-=1){let y=A[I];if(!y7($,y,G))return y}if(O=V==="up"?O-1:O+1,Q){if(O<0)O=q.length-1;else if(O>=q.length)O=0}}return}if(Z.key===ZJ){let V=L("up");if(V!==void 0){if(W)i1(Z);B=V}else{if(W)i1(Z);if(K===-1)B=Y;else if(B=A8($,{startingIndex:B,amount:z,decrement:!0,disabledIndices:G}),Q&&(K-z<H||B<0)){let M=K%z,_=Y%z,O=Y-(_-M);if(_===M)B=Y;else B=_>M?O:O-z}if(R7($,B))B=K}}if(Z.key===z3){let V=L("down");if(V!==void 0){if(W)i1(Z);B=V}else{if(W)i1(Z);if(K===-1)B=H;else if(B=A8($,{startingIndex:K,amount:z,disabledIndices:G}),Q&&K+z>Y)B=A8($,{startingIndex:K%z-z,amount:z,disabledIndices:G});if(R7($,B))B=K}}if(J==="both"){let V=iB(K/z);if(Z.key===(X?R2:y2)){if(W)i1(Z);if(K%z!==z-1){if(B=A8($,{startingIndex:K,disabledIndices:G}),Q&&Mz(B,z,V))B=A8($,{startingIndex:K-K%z-1,disabledIndices:G})}else if(Q)B=A8($,{startingIndex:K-K%z-1,disabledIndices:G});if(Mz(B,z,V))B=K}if(Z.key===(X?y2:R2)){if(W)i1(Z);if(K%z!==0){if(B=A8($,{startingIndex:K,decrement:!0,disabledIndices:G}),Q&&Mz(B,z,V))B=A8($,{startingIndex:K+(z-K%z),decrement:!0,disabledIndices:G})}else if(Q)B=A8($,{startingIndex:K+(z-K%z),decrement:!0,disabledIndices:G});if(Mz(B,z,V))B=K}let M=iB(Y/z)===V;if(R7($,B))if(Q&&M)B=Z.key===(X?y2:R2)?Y:A8($,{startingIndex:K-K%z-1,disabledIndices:G});else B=K}return B}function aA($,Z,J){let Q=[],X=0;return $.forEach(({width:z,height:G},H)=>{if(z>Z);let Y=!1;if(J)X=0;while(!Y){let K=[];for(let W=0;W<z;W+=1)for(let B=0;B<G;B+=1)K.push(X+W+B*Z);if(X%Z+z<=Z&&K.every((W)=>Q[W]==null))K.forEach((W)=>{Q[W]=H}),Y=!0;else X+=1}}),[...Q]}function nA($,Z,J,Q,X){if($===-1)return-1;let z=J.indexOf($),G=Z[$];switch(X){case"tl":return z;case"tr":if(!G)return z;return z+G.width-1;case"bl":if(!G)return z;return z+(G.height-1)*Q;case"br":return J.lastIndexOf($);default:return-1}}function oA($,Z){return Z.flatMap((J,Q)=>$.includes(J)?[Q]:[])}function y7($,Z,J){if(typeof J==="function")return J(Z);if(J)return J.includes(Z);let Q=$.current[Z];if(!Q)return!1;return Q.hasAttribute("disabled")||Q.getAttribute("aria-disabled")==="true"}/*!
7
+ * tabbable 6.4.0
8
+ * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
9
+ */var Mc=["input:not([inert]):not([inert] *)","select:not([inert]):not([inert] *)","textarea:not([inert]):not([inert] *)","a[href]:not([inert]):not([inert] *)","button:not([inert]):not([inert] *)","[tabindex]:not(slot):not([inert]):not([inert] *)","audio[controls]:not([inert]):not([inert] *)","video[controls]:not([inert]):not([inert] *)",'[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)',"details>summary:first-of-type:not([inert]):not([inert] *)","details:not([inert]):not([inert] *)"],_z=Mc.join(","),tA=typeof Element>"u",b7=tA?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Dz=!tA&&Element.prototype.getRootNode?function($){var Z;return $===null||$===void 0?void 0:(Z=$.getRootNode)===null||Z===void 0?void 0:Z.call($)}:function($){return $===null||$===void 0?void 0:$.ownerDocument},Oz=function(Z,J){var Q;if(J===void 0)J=!0;var X=Z===null||Z===void 0?void 0:(Q=Z.getAttribute)===null||Q===void 0?void 0:Q.call(Z,"inert"),z=X===""||X==="true",G=z||J&&Z&&(typeof Z.closest==="function"?Z.closest("[inert]"):Oz(Z.parentNode));return G},Ac=function(Z){var J,Q=Z===null||Z===void 0?void 0:(J=Z.getAttribute)===null||J===void 0?void 0:J.call(Z,"contenteditable");return Q===""||Q==="true"},eA=function(Z,J,Q){if(Oz(Z))return[];var X=Array.prototype.slice.apply(Z.querySelectorAll(_z));if(J&&b7.call(Z,_z))X.unshift(Z);return X=X.filter(Q),X},Pz=function(Z,J,Q){var X=[],z=Array.from(Z);while(z.length){var G=z.shift();if(Oz(G,!1))continue;if(G.tagName==="SLOT"){var H=G.assignedElements(),Y=H.length?H:G.children,K=Pz(Y,!0,Q);if(Q.flatten)X.push.apply(X,K);else X.push({scopeParent:G,candidates:K})}else{var W=b7.call(G,_z);if(W&&Q.filter(G)&&(J||!Z.includes(G)))X.push(G);var B=G.shadowRoot||typeof Q.getShadowRoot==="function"&&Q.getShadowRoot(G),q=!Oz(B,!1)&&(!Q.shadowRootFilter||Q.shadowRootFilter(G));if(B&&q){var U=Pz(B===!0?G.children:B.children,!0,Q);if(Q.flatten)X.push.apply(X,U);else X.push({scopeParent:G,candidates:U})}else z.unshift.apply(z,G.children)}}return X},$_=function(Z){return!isNaN(parseInt(Z.getAttribute("tabindex"),10))},Z_=function(Z){if(!Z)throw Error("No node provided");if(Z.tabIndex<0){if((/^(AUDIO|VIDEO|DETAILS)$/.test(Z.tagName)||Ac(Z))&&!$_(Z))return 0}return Z.tabIndex},_c=function(Z,J){var Q=Z_(Z);if(Q<0&&J&&!$_(Z))return 0;return Q},Dc=function(Z,J){return Z.tabIndex===J.tabIndex?Z.documentOrder-J.documentOrder:Z.tabIndex-J.tabIndex},J_=function(Z){return Z.tagName==="INPUT"},Oc=function(Z){return J_(Z)&&Z.type==="hidden"},Pc=function(Z){var J=Z.tagName==="DETAILS"&&Array.prototype.slice.apply(Z.children).some(function(Q){return Q.tagName==="SUMMARY"});return J},wc=function(Z,J){for(var Q=0;Q<Z.length;Q++)if(Z[Q].checked&&Z[Q].form===J)return Z[Q]},jc=function(Z){if(!Z.name)return!0;var J=Z.form||Dz(Z),Q=function(H){return J.querySelectorAll('input[type="radio"][name="'+H+'"]')},X;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape==="function")X=Q(window.CSS.escape(Z.name));else try{X=Q(Z.name)}catch(G){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",G.message),!1}var z=wc(X,Z.form);return!z||z===Z},Tc=function(Z){return J_(Z)&&Z.type==="radio"},Cc=function(Z){return Tc(Z)&&!jc(Z)},Ec=function(Z){var J,Q=Z&&Dz(Z),X=(J=Q)===null||J===void 0?void 0:J.host,z=!1;if(Q&&Q!==Z){var G,H,Y;z=!!((G=X)!==null&&G!==void 0&&(H=G.ownerDocument)!==null&&H!==void 0&&H.contains(X)||Z!==null&&Z!==void 0&&(Y=Z.ownerDocument)!==null&&Y!==void 0&&Y.contains(Z));while(!z&&X){var K,W,B;Q=Dz(X),X=(K=Q)===null||K===void 0?void 0:K.host,z=!!((W=X)!==null&&W!==void 0&&(B=W.ownerDocument)!==null&&B!==void 0&&B.contains(X))}}return z},sA=function(Z){var J=Z.getBoundingClientRect(),Q=J.width,X=J.height;return Q===0&&X===0},Sc=function(Z,J){var{displayCheck:Q,getShadowRoot:X}=J;if(Q==="full-native"){if("checkVisibility"in Z){var z=Z.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});return!z}}if(getComputedStyle(Z).visibility==="hidden")return!0;var G=b7.call(Z,"details>summary:first-of-type"),H=G?Z.parentElement:Z;if(b7.call(H,"details:not([open]) *"))return!0;if(!Q||Q==="full"||Q==="full-native"||Q==="legacy-full"){if(typeof X==="function"){var Y=Z;while(Z){var K=Z.parentElement,W=Dz(Z);if(K&&!K.shadowRoot&&X(K)===!0)return sA(Z);else if(Z.assignedSlot)Z=Z.assignedSlot;else if(!K&&W!==Z.ownerDocument)Z=W.host;else Z=K}Z=Y}if(Ec(Z))return!Z.getClientRects().length;if(Q!=="legacy-full")return!0}else if(Q==="non-zero-area")return sA(Z);return!1},kc=function(Z){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(Z.tagName)){var J=Z.parentElement;while(J){if(J.tagName==="FIELDSET"&&J.disabled){for(var Q=0;Q<J.children.length;Q++){var X=J.children.item(Q);if(X.tagName==="LEGEND")return b7.call(J,"fieldset[disabled] *")?!0:!X.contains(Z)}return!0}J=J.parentElement}}return!1},aB=function(Z,J){if(J.disabled||Oc(J)||Sc(J,Z)||Pc(J)||kc(J))return!1;return!0},nB=function(Z,J){if(Cc(J)||Z_(J)<0||!aB(Z,J))return!1;return!0},Ic=function(Z){var J=parseInt(Z.getAttribute("tabindex"),10);if(isNaN(J)||J>=0)return!0;return!1},Q_=function(Z){var J=[],Q=[];return Z.forEach(function(X,z){var G=!!X.scopeParent,H=G?X.scopeParent:X,Y=_c(H,G),K=G?Q_(X.candidates):H;if(Y===0)G?J.push.apply(J,K):J.push(H);else Q.push({documentOrder:z,tabIndex:Y,item:X,isScope:G,content:K})}),Q.sort(Dc).reduce(function(X,z){return z.isScope?X.push.apply(X,z.content):X.push(z.content),X},[]).concat(J)},K3=function(Z,J){J=J||{};var Q;if(J.getShadowRoot)Q=Pz([Z],J.includeContainer,{filter:nB.bind(null,J),flatten:!1,getShadowRoot:J.getShadowRoot,shadowRootFilter:Ic});else Q=eA(Z,J.includeContainer,nB.bind(null,J));return Q_(Q)},X_=function(Z,J){J=J||{};var Q;if(J.getShadowRoot)Q=Pz([Z],J.includeContainer,{filter:aB.bind(null,J),flatten:!0,getShadowRoot:J.getShadowRoot});else Q=eA(Z,J.includeContainer,aB.bind(null,J));return Q},oB=function(Z,J){if(J=J||{},!Z)throw Error("No node provided");if(b7.call(Z,_z)===!1)return!1;return nB(J,Z)};var W3=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver==="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function z_($,Z){let J=K3($,W3()),Q=J.length;if(Q===0)return;let X=r5(p0($)),z=J.indexOf(X),G=z===-1?Z===1?0:Q-1:z+Z;return J[G]}function a9($){return z_(p0($).body,1)||$}function wz($){return z_(p0($).body,-1)||$}function G_($,Z){if(!$)return null;let J=K3(p0($).body,W3()),Q=J.length;if(Q===0)return null;let X=J.indexOf($);if(X===-1)return null;let z=(X+Z+Q)%Q;return J[z]}function jz($){return G_($,1)}function Tz($){return G_($,-1)}function G2($,Z){let J=Z||$.currentTarget,Q=$.relatedTarget;return!Q||!m0(J,Q)}function H_($){K3($,W3()).forEach((J)=>{J.dataset.tabindex=J.getAttribute("tabindex")||"",J.setAttribute("tabindex","-1")})}function sB($){$.querySelectorAll("[data-tabindex]").forEach((J)=>{let Q=J.dataset.tabindex;if(delete J.dataset.tabindex,Q)J.setAttribute("tabindex",Q);else J.removeAttribute("tabindex")})}var Cz=xA(($)=>$.toasts,($)=>{let Z=new Map,J=0,Q=0;return $.forEach((X,z)=>{let G=X.transitionStatus==="ending";if(Z.set(X.id,{value:X,domIndex:z,visibleIndex:G?-1:J,offsetY:Q}),Q+=X.height||0,!G)J+=1}),Z}),P9={toasts:E0(($)=>$.toasts),isEmpty:E0(($)=>$.toasts.length===0),toast:E0(Cz,($,Z)=>$.get(Z)?.value),toastIndex:E0(Cz,($,Z)=>$.get(Z)?.domIndex??-1),toastOffsetY:E0(Cz,($,Z)=>$.get(Z)?.offsetY??0),toastVisibleIndex:E0(Cz,($,Z)=>$.get(Z)?.visibleIndex??-1),hovering:E0(($)=>$.hovering),focused:E0(($)=>$.focused),expanded:E0(($)=>$.hovering||$.focused),expandedOrOutOfFocus:E0(($)=>$.hovering||$.focused||!$.isWindowFocused),prevFocusElement:E0(($)=>$.prevFocusElement)};class tB extends l8{timers=new Map;areTimersPaused=!1;constructor($){super($,{},P9)}setFocused($){this.set("focused",$)}setHovering($){this.set("hovering",$)}setIsWindowFocused($){this.set("isWindowFocused",$)}setPrevFocusElement($){this.set("prevFocusElement",$)}setViewport=($)=>{this.set("viewport",$)};disposeEffect=()=>{return()=>{this.timers.forEach(($)=>{$.timeout?.clear()}),this.timers.clear()}};removeToast($){let Z=P9.toastIndex(this.state,$);if(Z===-1)return;this.state.toasts[Z]?.onRemove?.();let Q=[...this.state.toasts];Q.splice(Z,1),this.setToasts(Q)}addToast=($)=>{let{toasts:Z,timeout:J,limit:Q}=this.state,X=$.id||Hz("toast"),z={...$,id:X,transitionStatus:"starting"},G=[z,...Z],H=G.filter((K)=>K.transitionStatus!=="ending");if(H.length>Q){let K=H.length-Q,W=H.slice(-K),B=new Set(W.map((q)=>q.id));this.setToasts(G.map((q)=>{let U=B.has(q.id);if(q.limited!==U)return{...q,limited:U};return q}))}else this.setToasts(G.map((K)=>K.limited?{...K,limited:!1}:K));let Y=z.timeout??J;if(z.type!=="loading"&&Y>0)this.scheduleTimer(X,Y,()=>this.closeToast(X));if(P9.expandedOrOutOfFocus(this.state))this.pauseTimers();return X};updateToast=($,Z)=>{this.updateToastInternal($,Z)};updateToastInternal=($,Z)=>{let{timeout:J,toasts:Q}=this.state,X=P9.toast(this.state,$)??null;if(!X)return;if(X.transitionStatus==="ending")return;let z={...X,...Z};this.setToasts(Q.map((U)=>U.id===$?{...U,...Z}:U));let G=z.timeout??J,H=X?.timeout??J,Y=Object.hasOwn(Z,"timeout"),K=z.transitionStatus!=="ending"&&z.type!=="loading"&&G>0,W=this.timers.has($),B=H!==G,q=X?.type==="loading";if(!K&&W){this.timers.get($)?.timeout?.clear(),this.timers.delete($);return}if(K&&(!W||B||Y||q)){let U=this.timers.get($);if(U)U.timeout?.clear(),this.timers.delete($);if(this.scheduleTimer($,G,()=>this.closeToast($)),P9.expandedOrOutOfFocus(this.state))this.pauseTimers()}};closeToast=($)=>{P9.toast(this.state,$)?.onClose?.();let{limit:J,toasts:Q}=this.state,X=0,z=Q.map((H)=>{if(H.id===$)return{...H,transitionStatus:"ending",height:0};if(H.transitionStatus==="ending")return H;let Y=X>=J;return X+=1,H.limited!==Y?{...H,limited:Y}:H}),G=this.timers.get($);if(G&&G.timeout)G.timeout.clear(),this.timers.delete($);this.handleFocusManagement($),this.setToasts(z)};promiseToast=($,Z)=>{let J=Yz(Z.loading),Q=this.addToast({...J,type:"loading"}),X=$.then((z)=>{let G=Yz(Z.success,z);return this.updateToast(Q,{...G,type:"success",timeout:G.timeout}),z}).catch((z)=>{let G=Yz(Z.error,z);return this.updateToast(Q,{...G,type:"error",timeout:G.timeout}),Promise.reject(z)});if({}.hasOwnProperty.call(Z,"setPromise"))Z.setPromise(X);return X};pauseTimers(){if(this.areTimersPaused)return;this.areTimersPaused=!0,this.timers.forEach(($)=>{if($.timeout){$.timeout.clear();let Z=Date.now()-$.start,J=$.delay-Z;$.remaining=J>0?J:0}})}resumeTimers(){if(!this.areTimersPaused)return;this.areTimersPaused=!1,this.timers.forEach(($,Z)=>{$.remaining=$.remaining>0?$.remaining:$.delay,$.timeout??=l1.create(),$.timeout.start($.remaining,()=>{this.timers.delete(Z),$.callback()}),$.start=Date.now()})}restoreFocusToPrevElement(){this.state.prevFocusElement?.focus({preventScroll:!0})}handleDocumentPointerDown=($)=>{if($.pointerType!=="touch")return;let Z=R5($);if(m0(this.state.viewport,Z))return;this.resumeTimers(),this.update({hovering:!1,focused:!1})};scheduleTimer($,Z,J){let Q=Date.now(),X=!P9.expandedOrOutOfFocus(this.state),z=X?l1.create():void 0;z?.start(Z,()=>{this.timers.delete($),J()}),this.timers.set($,{timeout:z,start:X?Q:0,delay:Z,remaining:Z,callback:J})}setToasts($){let Z={toasts:$};if($.length===0)Z.hovering=!1,Z.focused=!1;this.update(Z)}handleFocusManagement($){let Z=r5(p0(this.state.viewport));if(!this.state.viewport||!m0(this.state.viewport,Z)||!r9(Z))return;let J=P9.toasts(this.state),Q=P9.toastIndex(this.state,$),X=null,z=Q+1;while(z<J.length){if(J[z].transitionStatus!=="ending"){X=J[z];break}z+=1}if(!X){z=Q-1;while(z>=0){if(J[z].transitionStatus!=="ending"){X=J[z];break}z-=1}}if(X)X.ref?.current?.focus();else this.restoreFocusToPrevElement()}}var K_=P(d(),1),W_=function(Z){let{children:J,timeout:Q=5000,limit:X=3,toastManager:z}=Z,G=T5(()=>new tB({timeout:Q,limit:X,viewport:null,toasts:[],hovering:!1,focused:!1,isWindowFocused:!0,prevFocusElement:null})).current;return T8(G.disposeEffect),Y_.useEffect(function(){if(!z)return;return z[" subscribe"](({action:K,options:W})=>{let B=W.id;if(K==="promise"&&W.promise)G.promiseToast(W.promise,W);else if(K==="update"&&B)G.updateToast(B,W);else if(K==="close"&&B)G.closeToast(B);else G.addToast(W)})},[G,Q,z]),G.useSyncedValues({timeout:Q,limit:X}),K_.jsx(oZ.Provider,{value:G,children:J})};var S8=P(v(),1);var B_={clipPath:"inset(50%)",overflow:"hidden",whiteSpace:"nowrap",border:0,padding:0,width:1,height:1,margin:-1},H2={...B_,position:"fixed",top:0,left:0},q_={...B_,position:"absolute"};var Ez=P(v(),1);var U_=P(d(),1),E8=Ez.forwardRef(function(Z,J){let[Q,X]=Ez.useState();return q0(()=>{if(qz)X("button")},[]),U_.jsx("span",{...Z,ref:J,style:H2,"aria-hidden":Q?void 0:!0,...{tabIndex:0,role:Q},"data-base-ui-focus-guard":""})});var F_=function($){return $.frontmostHeight="--toast-frontmost-height",$}({});var Y2=P(d(),1),N_=S8.forwardRef(function(Z,J){let{render:Q,className:X,children:z,...G}=Z,H=d9(),Y=V1(),K=S8.useRef(!1),W=S8.useRef(!1),B=H.useState("isEmpty"),q=H.useState("toasts"),U=H.useState("focused"),F=H.useState("expanded"),N=H.useState("prevFocusElement"),L=q[0]?.height??0,V=S8.useMemo(()=>q.some((k)=>k.transitionStatus==="ending"),[q]);S8.useEffect(()=>{let k=H.state.viewport;if(!k)return;function S(T){if(B)return;if(T.key==="F6"&&T.target!==k)T.preventDefault(),H.setPrevFocusElement(r5(p0(k))),k?.focus({preventScroll:!0}),H.pauseTimers(),H.setFocused(!0)}let w=C8(k);return w.addEventListener("keydown",S),()=>{w.removeEventListener("keydown",S)}},[H,B]),S8.useEffect(()=>{let k=H.state.viewport;if(!k||B)return;let S=C8(k);function w(R){if(R.target!==S)return;H.setIsWindowFocused(!1),H.pauseTimers()}function T(R){if(R.relatedTarget||R.target===S)return;let b=R5(R),g=r5(p0(k));if(!m0(k,b)||!r9(g))H.resumeTimers();Y.start(0,()=>H.setIsWindowFocused(!0))}return S.addEventListener("blur",w,!0),S.addEventListener("focus",T,!0),()=>{S.removeEventListener("blur",w,!0),S.removeEventListener("focus",T,!0)}},[H,Y,B]),S8.useEffect(()=>{let k=H.state.viewport;if(!k||B)return;let S=p0(k);return S.addEventListener("pointerdown",H.handleDocumentPointerDown,!0),()=>{S.removeEventListener("pointerdown",H.handleDocumentPointerDown,!0)}},[B,H]);function M(k){let S=H.state.viewport;if(!S)return;if(K.current=!0,k.relatedTarget===S)q[0]?.ref?.current?.focus();else H.restoreFocusToPrevElement()}function _(k){if(k.key==="Tab"&&k.shiftKey&&k.target===H.state.viewport)k.preventDefault(),H.restoreFocusToPrevElement(),H.resumeTimers()}S8.useEffect(()=>{if(!H.state.isWindowFocused||V||!W.current)return;H.resumeTimers(),H.setHovering(!1),W.current=!1},[V,H]);function O(){H.pauseTimers(),H.setHovering(!0),W.current=!1}function D(){if(V)W.current=!0;else H.resumeTimers(),H.setHovering(!1)}function A(){if(K.current){K.current=!1;return}if(U)return;if(r9(p0(H.state.viewport).activeElement))H.setFocused(!0),H.pauseTimers()}function E(k){if(!U||m0(H.state.viewport,k.relatedTarget))return;H.setFocused(!1),H.resumeTimers()}let I={tabIndex:-1,role:"region","aria-live":"polite","aria-atomic":!1,"aria-relevant":"additions text","aria-label":"Notifications",onMouseEnter:O,onMouseMove:O,onMouseLeave:D,onFocus:A,onBlur:E,onKeyDown:_,onClick:A},y={expanded:F},C=W0("div",Z,{ref:[J,H.setViewport],state:y,props:[I,{style:{[F_.frontmostHeight]:L?`${L}px`:void 0}},G,{children:Y2.jsxs(S8.Fragment,{children:[!B&&N&&Y2.jsx(E8,{onFocus:M}),z,!B&&N&&Y2.jsx(E8,{onFocus:M})]})}]}),h=S8.useMemo(()=>q.filter((k)=>k.priority==="high"),[q]);return Y2.jsxs(S8.Fragment,{children:[!B&&N&&Y2.jsx(E8,{onFocus:M}),C,!U&&h.length>0&&Y2.jsx("div",{style:H2,children:h.map((k)=>Y2.jsxs("div",{role:"alert","aria-atomic":!0,children:[Y2.jsx("div",{children:k.title}),Y2.jsx("div",{children:k.description})]},k.id))})]})});var H1=P(v(),1),A_=P(G4(),1);function x2($){if(Qz(19))return $;return $?"true":void 0}var Sz=P(v(),1),eB=Sz.createContext(void 0);function h2(){let $=Sz.useContext(eB);if(!$)throw Error(C0(66));return $}var g2=function($){return $.startingStyle="data-starting-style",$.endingStyle="data-ending-style",$}({}),Rc={[g2.startingStyle]:""},yc={[g2.endingStyle]:""},m5={transitionStatus($){if($==="starting")return Rc;if($==="ending")return yc;return null}};var L_=P(v(),1);var V_=P(G4(),1);function K2($){if($==null)return $;return"current"in $?$.current:$}function v2($,Z=!1,J=!0){let Q=z4();return U0((X,z=null)=>{Q.cancel();function G(){V_.flushSync(X)}let H=K2($);if(H==null)return;let Y=H;if(typeof Y.getAnimations!=="function"||globalThis.BASE_UI_ANIMATIONS_DISABLED)X();else{let K=function(){let B=g2.startingStyle;if(!Y.hasAttribute(B)){Q.request(W);return}let q=new MutationObserver(()=>{if(!Y.hasAttribute(B))q.disconnect(),W()});q.observe(Y,{attributes:!0,attributeFilter:[B]}),z?.addEventListener("abort",()=>q.disconnect(),{once:!0})},W=function(){Promise.all(Y.getAnimations().map((B)=>B.finished)).then(()=>{if(z?.aborted)return;G()}).catch(()=>{let B=Y.getAnimations();if(J){if(z?.aborted)return;G()}else if(B.length>0&&B.some((q)=>q.pending||q.playState!=="finished"))W()})};if(Z){K();return}Q.request(W)}})}function I1($){let{enabled:Z=!0,open:J,ref:Q,onComplete:X}=$,z=U0(X),G=v2(Q,J,!1);L_.useEffect(()=>{if(!Z)return;let H=new AbortController;return G(z,H.signal),()=>{H.abort()}},[Z,J,z,G])}var f2=function($){return $.index="--toast-index",$.offsetY="--toast-offset-y",$.height="--toast-height",$.swipeMovementX="--toast-swipe-movement-x",$.swipeMovementY="--toast-swipe-movement-y",$}({});var __=P(d(),1),bc={...m5,swipeDirection($){return $?{"data-swipe-direction":$}:null}},QJ=40,xc=10,n9=0.5,hc=1;function M_($,Z,J){switch($){case"up":return-J;case"down":return J;case"left":return-Z;case"right":return Z;default:return 0}}function gc($){let J=window.getComputedStyle($).transform,Q=0,X=0,z=1;if(J&&J!=="none"){let G=J.match(/matrix(?:3d)?\(([^)]+)\)/);if(G){let H=G[1].split(", ").map(parseFloat);if(H.length===6)Q=H[4],X=H[5],z=Math.sqrt(H[0]*H[0]+H[1]*H[1]);else if(H.length===16)Q=H[12],X=H[13],z=H[0]}}return{x:Q,y:X,scale:z}}var D_=H1.forwardRef(function(Z,J){let{toast:Q,render:X,className:z,swipeDirection:G=["down","right"],...H}=Z,Y=Q.positionerProps?.anchor!==void 0,K=[];if(!Y)K=Array.isArray(G)?G:[G];let W=K.length>0,B=d9(),[q,U]=H1.useState(void 0),[F,N]=H1.useState(!1),[L,V]=H1.useState(!1),[M,_]=H1.useState(!1),[O,D]=H1.useState({x:0,y:0}),[A,E]=H1.useState({x:0,y:0,scale:1}),[I,y]=H1.useState(),[C,h]=H1.useState(),[k,S]=H1.useState(null),w=H1.useRef(null),T=H1.useRef({x:0,y:0}),R=H1.useRef({x:0,y:0,scale:1}),b=H1.useRef(void 0),g=H1.useRef(0),u=H1.useRef(!1),j=H1.useRef({x:0,y:0}),t=H1.useRef(!1),Q0=B.useState("toastIndex",Q.id),x=B.useState("toastVisibleIndex",Q.id),e=B.useState("toastOffsetY",Q.id),M0=B.useState("focused"),l=B.useState("expanded");I1({open:Q.transitionStatus!=="ending",ref:w,onComplete(){if(Q.transitionStatus==="ending")B.removeToast(Q.id)}});let H0=U0((f=!1)=>{let a=w.current;if(!a)return;let o=a.style.height;a.style.height="auto";let N0=a.offsetHeight;a.style.height=o;function j0(){B.updateToastInternal(Q.id,{ref:w,height:N0,...Q.transitionStatus==="starting"?{transitionStatus:void 0}:{}})}if(f)A_.flushSync(j0);else j0()});q0(H0,[H0]);function B0(f,a){let o=f,N0=a;if(!K.includes("left")&&!K.includes("right"))o=f>0?f**n9:-(Math.abs(f)**n9);else{if(!K.includes("right")&&f>0)o=f**n9;if(!K.includes("left")&&f<0)o=-(Math.abs(f)**n9)}if(!K.includes("up")&&!K.includes("down"))N0=a>0?a**n9:-(Math.abs(a)**n9);else{if(!K.includes("down")&&a>0)N0=a**n9;if(!K.includes("up")&&a<0)N0=-(Math.abs(a)**n9)}return{x:o,y:N0}}function X0(f){if(f.button!==0)return;if(f.pointerType==="touch")B.pauseTimers();let a=R5(f.nativeEvent);if(a?a.closest('button,a,input,textarea,[role="button"],[data-swipe-ignore]'):!1)return;if(u.current=!1,b.current=void 0,g.current=0,T.current={x:f.clientX,y:f.clientY},j.current=T.current,w.current){let N0=gc(w.current);R.current=N0,E(N0),D({x:N0.x,y:N0.y})}B.setHovering(!0),N(!0),V(!1),S(null),t.current=!0,w.current?.setPointerCapture(f.pointerId)}function Y0(f){if(!F)return;if(f.preventDefault(),t.current)T.current={x:f.clientX,y:f.clientY},t.current=!1;let{clientY:a,clientX:o,movementX:N0,movementY:j0}=f;if(j0<0&&a>j.current.y||j0>0&&a<j.current.y)j.current={x:j.current.x,y:a};if(N0<0&&o>j.current.x||N0>0&&o<j.current.x)j.current={x:o,y:j.current.y};let h0=o-T.current.x,u0=a-T.current.y,p=a-j.current.y,r=o-j.current.x;if(!L){if(Math.sqrt(h0*h0+u0*u0)>=hc){if(V(!0),k===null){let U5=K.includes("left")||K.includes("right"),d0=K.includes("up")||K.includes("down");if(U5&&d0){let R0=Math.abs(h0),G0=Math.abs(u0);S(R0>G0?"horizontal":"vertical")}}}}let z0;if(!b.current){if(k==="vertical"){if(u0>0)z0="down";else if(u0<0)z0="up"}else if(k==="horizontal"){if(h0>0)z0="right";else if(h0<0)z0="left"}else if(Math.abs(h0)>=Math.abs(u0))z0=h0>0?"right":"left";else z0=u0>0?"down":"up";if(z0&&K.includes(z0))b.current=z0,g.current=M_(z0,h0,u0),U(z0)}else{let e0=b.current,U5=M_(e0,r,p);if(U5>QJ)u.current=!1,U(e0);else if(!(K.includes("left")&&K.includes("right"))&&!(K.includes("up")&&K.includes("down"))&&g.current-U5>=xc)u.current=!0}let L0=B0(h0,u0),P0=R.current.x,g0=R.current.y;if(k==="horizontal"){if(K.includes("left")||K.includes("right"))P0+=L0.x}else if(k==="vertical"){if(K.includes("up")||K.includes("down"))g0+=L0.y}else{if(K.includes("left")||K.includes("right"))P0+=L0.x;if(K.includes("up")||K.includes("down"))g0+=L0.y}D({x:P0,y:g0})}function V0(f){if(!F)return;if(N(!1),V(!1),S(null),w.current?.releasePointerCapture(f.pointerId),u.current){D({x:A.x,y:A.y}),U(void 0);return}let a=!1,o=O.x-A.x,N0=O.y-A.y,j0;for(let h0 of K){switch(h0){case"right":if(o>QJ)a=!0,j0="right";break;case"left":if(o<-QJ)a=!0,j0="left";break;case"down":if(N0>QJ)a=!0,j0="down";break;case"up":if(N0<-QJ)a=!0,j0="up";break;default:break}if(a)break}if(a)U(j0),_(!0),B.closeToast(Q.id);else D({x:A.x,y:A.y}),U(void 0)}function i(f){if(f.key==="Escape"){if(!w.current||!m0(w.current,r5(p0(w.current))))return;B.closeToast(Q.id)}}H1.useEffect(()=>{if(!W)return;let f=w.current;if(!f)return;function a(o){if(m0(f,o.target))o.preventDefault()}return f.addEventListener("touchmove",a,{passive:!1}),()=>{f.removeEventListener("touchmove",a)}},[W]);function $0(){if(!F&&O.x===A.x&&O.y===A.y&&!M)return{[f2.swipeMovementX]:"0px",[f2.swipeMovementY]:"0px"};let f=O.x-A.x,a=O.y-A.y;return{transition:F?"none":void 0,transform:F?`translateX(${O.x}px) translateY(${O.y}px) scale(${A.scale})`:void 0,[f2.swipeMovementX]:`${f}px`,[f2.swipeMovementY]:`${a}px`}}let Z0=Q.priority==="high",J0={role:Z0?"alertdialog":"dialog",tabIndex:0,"aria-modal":!1,"aria-labelledby":I,"aria-describedby":C,"aria-hidden":Z0&&!M0?!0:void 0,onPointerDown:W?X0:void 0,onPointerMove:W?Y0:void 0,onPointerUp:W?V0:void 0,onKeyDown:i,inert:x2(Q.limited),style:{...$0(),[f2.index]:Q.transitionStatus==="ending"?Q0:x,[f2.offsetY]:`${e}px`,[f2.height]:Q.height?`${Q.height}px`:void 0}},n=H1.useMemo(()=>({rootRef:w,toast:Q,titleId:I,setTitleId:y,descriptionId:C,setDescriptionId:h,swiping:F,swipeDirection:q,recalculateHeight:H0,index:Q0,visibleIndex:x,expanded:l}),[Q,I,C,F,q,H0,Q0,x,l]),m={transitionStatus:Q.transitionStatus,expanded:l,limited:Q.limited||!1,type:Q.type,swiping:n.swiping,swipeDirection:n.swipeDirection},c=W0("div",Z,{ref:[J,n.rootRef],state:m,stateAttributesMapping:bc,props:[J0,H]});return __.jsx(eB.Provider,{value:n,children:c})});var kz=P(v(),1);var O_=kz.forwardRef(function(Z,J){let{render:Q,className:X,...z}=Z,{visibleIndex:G,expanded:H,recalculateHeight:Y}=h2(),K=kz.useRef(null);q0(()=>{let U=K.current;if(!U)return;if(Y(),typeof ResizeObserver!=="function"||typeof MutationObserver!=="function")return;let F=new ResizeObserver(()=>Y(!0)),N=new MutationObserver(()=>Y(!0));return F.observe(U),N.observe(U,{childList:!0,subtree:!0,characterData:!0}),()=>{F.disconnect(),N.disconnect()}},[Y]);let W=G>0;return W0("div",Z,{ref:[J,K],state:{expanded:H,behind:W},props:z})});var T_=P(v(),1);var Iz=P(v(),1);var P_=0;function vc($,Z="mui"){let[J,Q]=Iz.useState($),X=$||J;return Iz.useEffect(()=>{if(J==null)P_+=1,Q(`${Z}-${P_}`)},[J,Z]),X}var w_=j_.useId;function Y8($,Z){if(w_!==void 0){let J=w_();return $??(Z?`${Z}-${J}`:J)}return vc($,Z)}var C_=T_.forwardRef(function(Z,J){let{render:Q,className:X,id:z,children:G,...H}=Z,{toast:Y,setDescriptionId:K}=h2(),W=G??Y.description,B=Boolean(W),q=Y8(z);q0(()=>{if(!B)return;return K(q),()=>{K(void 0)}},[B,q,K]);let U={type:Y.type},F=W0("p",Z,{ref:J,state:U,props:{...H,id:q,children:W}});if(!B)return null;return F});var E_=P(v(),1);var S_=E_.forwardRef(function(Z,J){let{render:Q,className:X,id:z,children:G,...H}=Z,{toast:Y,setTitleId:K}=h2(),W=G??Y.title,B=Boolean(W),q=Y8(z);q0(()=>{if(!B)return;return K(q),()=>{K(void 0)}},[B,q,K]);let U={type:Y.type},F=W0("h2",Z,{ref:J,state:U,props:{...H,id:q,children:W}});if(!B)return null;return F});var Rz=P(v(),1);var k_=Rz.forwardRef(function(Z,J){let{render:Q,className:X,disabled:z,nativeButton:G=!0,...H}=Z,Y=d9(),{toast:K}=h2(),W=Y.useState("expanded"),[B,q]=Rz.useState(!1),{getButtonProps:U,buttonRef:F}=f1({disabled:z,native:G}),N={type:K.type};return W0("button",Z,{ref:[J,F],state:N,props:[{"aria-hidden":!W&&!B,onClick(){Y.closeToast(K.id)},onFocus(){q(!0)},onBlur(){q(!1)}},H,U]})});var I_=P(v(),1);var R_=I_.forwardRef(function(Z,J){let{render:Q,className:X,disabled:z,nativeButton:G=!0,...H}=Z,{toast:Y}=h2(),K=Y.actionProps?.children??H.children,W=Boolean(K),{getButtonProps:B,buttonRef:q}=f1({disabled:z,native:G}),U={type:Y.type},F=W0("button",Z,{ref:[J,q],state:U,props:[H,Y.actionProps,B,{children:K}]});if(!W)return null;return F});var rz=P(v(),1),$D=P(G4(),1);var H4=P(v(),1);var xz=P(v(),1);function w1($){let Z=T5(fc,$).current;return Z.next=$,q0(Z.effect),Z}function fc($){let Z={current:$,next:$,effect:()=>{Z.current=Z.next}};return Z}var o9=P(v(),1);function yz(){let $=new Map;return{emit(Z,J){$.get(Z)?.forEach((Q)=>Q(J))},on(Z,J){if(!$.has(Z))$.set(Z,new Set);$.get(Z).add(J)},off(Z,J){$.get(Z)?.delete(J)}}}class B3{nodesRef={current:[]};events=yz();addNode($){this.nodesRef.current.push($)}removeNode($){let Z=this.nodesRef.current.findIndex((J)=>J===$);if(Z!==-1)this.nodesRef.current.splice(Z,1)}}var $q=P(d(),1),y_=o9.createContext(null),b_=o9.createContext(null),s1=()=>o9.useContext(y_)?.id||null,k8=($)=>{let Z=o9.useContext(b_);return $??Z};function q3($){let Z=Y8(),J=k8($),Q=s1();return q0(()=>{if(!Z)return;let X={id:Z,parentId:Q};return J?.addNode(X),()=>{J?.removeNode(X)}},[J,Z,Q]),Z}function XJ($){let{children:Z,id:J}=$,Q=s1();return $q.jsx(y_.Provider,{value:o9.useMemo(()=>({id:J,parentId:Q}),[J,Q]),children:Z})}function zJ($){let{children:Z,externalTree:J}=$,Q=T5(()=>J??new B3).current;return $q.jsx(b_.Provider,{value:Q,children:Z})}var K0={};_4(K0,{windowResize:()=>Md,wheel:()=>Bd,triggerPress:()=>pc,triggerHover:()=>uc,triggerFocus:()=>cc,trackPress:()=>oc,swipe:()=>Ld,siblingOpen:()=>Fd,scrub:()=>qd,pointer:()=>Kd,outsidePress:()=>dc,none:()=>mc,listNavigation:()=>Hd,linkPress:()=>rc,keyboard:()=>Yd,itemPress:()=>lc,inputPress:()=>Qd,inputPaste:()=>Jd,inputClear:()=>$d,inputChange:()=>ec,inputBlur:()=>Zd,incrementPress:()=>sc,imperativeAction:()=>Vd,focusOut:()=>Xd,escapeKey:()=>zd,drag:()=>Wd,disabled:()=>Nd,decrementPress:()=>tc,closeWatcher:()=>Gd,closePress:()=>ic,clearPress:()=>ac,chipRemovePress:()=>nc,cancelOpen:()=>Ud});var mc="none",pc="trigger-press",uc="trigger-hover",cc="trigger-focus",dc="outside-press",lc="item-press",ic="close-press",rc="link-press",ac="clear-press",nc="chip-remove-press",oc="track-press",sc="increment-press",tc="decrement-press",ec="input-change",$d="input-clear",Zd="input-blur",Jd="input-paste",Qd="input-press",Xd="focus-out",zd="escape-key",Gd="close-watcher",Hd="list-navigation",Yd="keyboard",Kd="pointer",Wd="drag",Bd="wheel",qd="scrub",Ud="cancel-open",Fd="sibling-open",Nd="disabled",Vd="imperative-action",Ld="swipe",Md="window-resize";function D0($,Z,J,Q){let X=!1,z=!1,G=Q??E5;return{reason:$,event:Z??new Event("base-ui"),cancel(){X=!0},allowPropagation(){z=!0},get isCanceled(){return X},get isPropagationAllowed(){return z},trigger:J,...G}}function bz($,Z,J){let Q=J??E5;return{reason:$,event:Z??new Event("base-ui"),...Q}}function D4($){return`data-base-ui-${$}`}var RH0=D4("safe-polygon"),yH0=`button,[role="button"],select,[tabindex]:not([tabindex="-1"]),${I7}`;function x7($,Z,J){if(J&&!f4(J))return 0;if(typeof $==="number")return $;if(typeof $==="function"){let Q=$();if(typeof Q==="number")return Q;return Q?.[Z]}return $?.[Z]}var x_=P(d(),1),h_=H4.createContext({hasProvider:!1,timeoutMs:0,delayRef:{current:0},initialDelayRef:{current:0},timeout:new l1,currentIdRef:{current:null},currentContextRef:{current:null}});function Zq($){let{children:Z,delay:J,timeoutMs:Q=0}=$,X=H4.useRef(J),z=H4.useRef(J),G=H4.useRef(null),H=H4.useRef(null),Y=V1();return x_.jsx(h_.Provider,{value:H4.useMemo(()=>({hasProvider:!0,delayRef:X,initialDelayRef:z,currentIdRef:G,timeoutMs:Q,currentContextRef:H,timeout:Y}),[Q,Y]),children:Z})}function Jq($,Z={open:!1}){let J="rootStore"in $?$.rootStore:$,Q=J.useState("floatingId"),{open:X}=Z,z=H4.useContext(h_),{currentIdRef:G,delayRef:H,timeoutMs:Y,initialDelayRef:K,currentContextRef:W,hasProvider:B,timeout:q}=z,[U,F]=H4.useState(!1);return q0(()=>{function N(){F(!1),W.current?.setIsInstantPhase(!1),G.current=null,W.current=null,H.current=K.current}if(!G.current)return;if(!X&&G.current===Q){if(F(!1),Y){let L=Q;return q.start(Y,()=>{if(J.select("open")||G.current&&G.current!==L)return;N()}),()=>{q.clear()}}N()}return},[X,Q,G,H,Y,K,W,q,J]),q0(()=>{if(!X)return;let N=W.current,L=G.current;if(q.clear(),W.current={onOpenChange:J.setOpen,setIsInstantPhase:F},G.current=Q,H.current={open:0,close:x7(K.current,"close")},L!==null&&L!==Q)F(!0),N?.setIsInstantPhase(!0),N?.onOpenChange(!1,D0(K0.none));else F(!1),N?.setIsInstantPhase(!1)},[X,Q,J,G,H,Y,K,W,q]),q0(()=>{return()=>{W.current=null}},[W]),H4.useMemo(()=>({hasProvider:B,delayRef:H,isInstantPhase:U}),[B,H,U])}var t1=P(v(),1);var g_=0;function U3($,Z={}){let{preventScroll:J=!1,cancelPrevious:Q=!0,sync:X=!1}=Z;if(Q)cancelAnimationFrame(g_);let z=()=>$?.focus({preventScroll:J});if(X)z();else g_=requestAnimationFrame(z)}var h7={inert:new WeakMap,"aria-hidden":new WeakMap,none:new WeakMap};function v_($){if($==="inert")return h7.inert;if($==="aria-hidden")return h7["aria-hidden"];return h7.none}var hz=new WeakSet,gz={},Qq=0;var f_=($)=>$&&($.host||f_($.parentNode)),Ad=($,Z)=>Z.map((J)=>{if($.contains(J))return J;let Q=f_(J);if($.contains(Q))return Q;return null}).filter((J)=>J!=null);function _d($,Z,J,Q){let z=Q?"inert":J?"aria-hidden":null,G=Ad(Z,$),H=new Set,Y=new Set(G),K=[];if(!gz["data-base-ui-inert"])gz["data-base-ui-inert"]=new WeakMap;let W=gz["data-base-ui-inert"];G.forEach(B),q(Z),H.clear();function B(U){if(!U||H.has(U))return;if(H.add(U),U.parentNode)B(U.parentNode)}function q(U){if(!U||Y.has(U))return;[].forEach.call(U.children,(F)=>{if(vz(F)==="script")return;if(H.has(F))q(F);else{let N=z?F.getAttribute(z):null,L=N!==null&&N!=="false",V=v_(z),M=(V.get(F)||0)+1,_=(W.get(F)||0)+1;if(V.set(F,M),W.set(F,_),K.push(F),M===1&&L)hz.add(F);if(_===1)F.setAttribute("data-base-ui-inert","");if(!L&&z)F.setAttribute(z,z==="inert"?"":"true")}})}return Qq+=1,()=>{if(K.forEach((U)=>{let F=v_(z),L=(F.get(U)||0)-1,V=(W.get(U)||0)-1;if(F.set(U,L),W.set(U,V),!L){if(!hz.has(U)&&z)U.removeAttribute(z);hz.delete(U)}if(!V)U.removeAttribute("data-base-ui-inert")}),Qq-=1,!Qq)h7.inert=new WeakMap,h7["aria-hidden"]=new WeakMap,h7.none=new WeakMap,hz=new WeakSet,gz={}}}function m_($,Z=!1,J=!1){let Q=p0($[0]).body;return _d($.concat(Array.from(Q.querySelectorAll("[aria-live]"))),Q,Z,J)}var j1=P(v(),1),Xq=P(G4(),1);var F3=P(d(),1),c_=j1.createContext(null),zq=()=>j1.useContext(c_),Dd=D4("portal");function fz($={}){let{ref:Z,container:J,componentProps:Q=E5,elementProps:X}=$,z=Y8(),H=zq()?.portalNode,[Y,K]=j1.useState(null),[W,B]=j1.useState(null),q=U0((L)=>{if(L!==null)B(L)}),U=j1.useRef(null);q0(()=>{if(J===null){if(U.current)U.current=null,B(null),K(null);return}if(z==null)return;let L=(J&&(p_(J)?J:J.current))??H??document.body;if(L==null){if(U.current)U.current=null,B(null),K(null);return}if(U.current!==L)U.current=L,B(null),K(L)},[J,H,z]);let F=W0("div",Q,{ref:[Z,q],props:[{id:z,[Dd]:""},X]});return{portalNode:W,portalSubtree:Y&&F?Xq.createPortal(F,Y):null}}var N3=j1.forwardRef(function(Z,J){let{children:Q,container:X,className:z,render:G,renderGuards:H,...Y}=Z,{portalNode:K,portalSubtree:W}=fz({container:X,ref:J,componentProps:Z,elementProps:Y}),B=j1.useRef(null),q=j1.useRef(null),U=j1.useRef(null),F=j1.useRef(null),[N,L]=j1.useState(null),V=N?.modal,M=N?.open,_=typeof H==="boolean"?H:!!N&&!N.modal&&N.open&&!!K;j1.useEffect(()=>{if(!K||V)return;function D(A){if(K&&A.relatedTarget&&G2(A))(A.type==="focusin"?sB:H_)(K)}return K.addEventListener("focusin",D,!0),K.addEventListener("focusout",D,!0),()=>{K.removeEventListener("focusin",D,!0),K.removeEventListener("focusout",D,!0)}},[K,V]),j1.useEffect(()=>{if(!K||M)return;sB(K)},[M,K]);let O=j1.useMemo(()=>({beforeOutsideRef:B,afterOutsideRef:q,beforeInsideRef:U,afterInsideRef:F,portalNode:K,setFocusManagerState:L}),[K]);return F3.jsxs(j1.Fragment,{children:[W,F3.jsxs(c_.Provider,{value:O,children:[_&&K&&F3.jsx(E8,{"data-type":"outside",ref:B,onFocus:(D)=>{if(G2(D,K))U.current?.focus();else{let A=N?N.domReference:null;wz(A)?.focus()}}}),_&&K&&F3.jsx("span",{"aria-owns":K.id,style:u_}),K&&Xq.createPortal(Q,K),_&&K&&F3.jsx(E8,{"data-type":"outside",ref:q,onFocus:(D)=>{if(G2(D,K))F.current?.focus();else{let A=N?N.domReference:null;if(a9(A)?.focus(),N?.closeOnFocusOut)N?.onOpenChange(!1,D0(K0.focusOut,D.nativeEvent))}}})]})]})});var GJ=P(d(),1);function Od($,Z){let J=C8($.target);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 d_=20,s9=[];function Hq(){s9=s9.filter(($)=>{return $.deref()?.isConnected})}function Pd($){if(Hq(),$&&vz($)!=="body"){if(s9.push(new WeakRef($)),s9.length>d_)s9=s9.slice(-d_)}}function Gq(){return Hq(),s9[s9.length-1]?.deref()}function wd($){if(!$)return null;let Z=W3();if(oB($,Z))return $;return K3($,Z)[0]||$}function jd($){if(!$||!$.isConnected)return!1;if(typeof $.checkVisibility==="function")return $.checkVisibility();return g7($).display!=="none"}function l_($,Z){if(!Z.current.includes("floating")&&!$.getAttribute("role")?.includes("dialog"))return;let J=W3(),X=X_($,J).filter((G)=>{let H=G.getAttribute("data-tabindex")||"";return oB(G,J)||G.hasAttribute("data-tabindex")&&!H.startsWith("-")}),z=$.getAttribute("tabindex");if(Z.current.includes("floating")||X.length===0){if(z!=="0")$.setAttribute("tabindex","0")}else if(z!=="-1"||$.hasAttribute("data-tabindex")&&$.getAttribute("data-tabindex")!=="-1")$.setAttribute("tabindex","-1"),$.setAttribute("data-tabindex","-1")}function V3($){let{context:Z,children:J,disabled:Q=!1,initialFocus:X=!0,returnFocus:z=!0,restoreFocus:G=!1,modal:H=!0,closeOnFocusOut:Y=!0,openInteractionType:K="",nextFocusableElement:W,previousFocusableElement:B,beforeContentFocusGuardRef:q,externalTree:U}=$,F="rootStore"in Z?Z.rootStore:Z,N=F.useState("open"),L=F.useState("domReferenceElement"),V=F.useState("floatingElement"),{events:M,dataRef:_}=F.context,O=U0(()=>_.current.floatingContext?.nodeId),D=X===!1,A=JJ(L)&&D,E=t1.useRef(["content"]),I=w1(X),y=w1(z),C=w1(K),h=k8(U),k=zq(),S=t1.useRef(null),w=t1.useRef(null),T=t1.useRef(!1),R=t1.useRef(!1),b=t1.useRef(!1),g=t1.useRef(-1),u=t1.useRef(""),j=t1.useRef(""),t=t1.useRef(null),Q0=t1.useRef(null),x=O4(t,q,k?.beforeInsideRef),e=O4(Q0,k?.afterInsideRef),M0=V1(),l=V1(),H0=z4(),B0=k!=null,X0=Y3(V),Y0=U0(($0=X0)=>{return $0?K3($0,W3()):[]}),V0=U0(($0)=>{let Z0=Y0($0);return E.current.map(()=>Z0).filter(Boolean).flat()});t1.useEffect(()=>{if(Q||!H)return;function $0(J0){if(J0.key==="Tab"){if(m0(X0,r5(p0(X0)))&&Y0().length===0&&!A)i1(J0)}}let Z0=p0(X0);return Z0.addEventListener("keydown",$0),()=>{Z0.removeEventListener("keydown",$0)}},[Q,L,X0,H,E,A,Y0,V0]),t1.useEffect(()=>{if(Q||!N)return;let $0=p0(X0);function Z0(){b.current=!1}function J0(m){let c=R5(m),f=m0(V,c)||m0(L,c)||m0(k?.portalNode,c);if(b.current=!f,j.current=m.pointerType||"keyboard",c?.closest(`[${v7}]`))R.current=!0}function n(){j.current="keyboard"}return $0.addEventListener("pointerdown",J0,!0),$0.addEventListener("pointerup",Z0,!0),$0.addEventListener("pointercancel",Z0,!0),$0.addEventListener("keydown",n,!0),()=>{$0.removeEventListener("pointerdown",J0,!0),$0.removeEventListener("pointerup",Z0,!0),$0.removeEventListener("pointercancel",Z0,!0),$0.removeEventListener("keydown",n,!0)}},[Q,V,L,X0,N,k]),t1.useEffect(()=>{if(Q||!Y)return;let $0=p0(X0);function Z0(){R.current=!0,l.start(0,()=>{R.current=!1})}function J0(a){let o=R5(a),j0=Y0().indexOf(o);if(j0!==-1)g.current=j0}function n(a){let{relatedTarget:o,currentTarget:N0}=a,j0=R5(a);queueMicrotask(()=>{let h0=O(),u0=F.context.triggerElements,p=o?.hasAttribute(D4("focus-guard"))&&[t.current,Q0.current,k?.beforeInsideRef.current,k?.afterInsideRef.current,k?.beforeOutsideRef.current,k?.afterOutsideRef.current,K2(B),K2(W)].includes(o),r=!(m0(L,o)||m0(V,o)||m0(o,V)||m0(k?.portalNode,o)||o!=null&&u0.hasElement(o)||u0.hasMatchingElement((z0)=>m0(z0,o))||p||h&&(b2(h.nodesRef.current,h0).find((z0)=>m0(z0.context?.elements.floating,o)||m0(z0.context?.elements.domReference,o))||lB(h.nodesRef.current,h0).find((z0)=>[z0.context?.elements.floating,Y3(z0.context?.elements.floating)].includes(o)||z0.context?.elements.domReference===o)));if(N0===L&&X0)l_(X0,E);if(G&&N0!==L&&!jd(j0)&&r5($0)===$0.body){if(L1(X0)){if(X0.focus(),G==="popup"){H0.request(()=>{X0.focus()});return}}let z0=g.current,L0=Y0(),P0=L0[z0]||L0[L0.length-1]||X0;if(L1(P0))P0.focus()}if(_.current.insideReactTree){_.current.insideReactTree=!1;return}if((A?!0:!H)&&o&&r&&!R.current&&(A||o!==Gq()))T.current=!0,F.setOpen(!1,D0(K0.focusOut,a))})}function m(){if(b.current)return;_.current.insideReactTree=!0,M0.start(0,()=>{_.current.insideReactTree=!1})}let c=L1(L)?L:null,f=[];if(!V&&!c)return;if(c)c.addEventListener("focusout",n),c.addEventListener("pointerdown",Z0),f.push(()=>{c.removeEventListener("focusout",n),c.removeEventListener("pointerdown",Z0)});if(V){if(V.addEventListener("focusin",J0),V.addEventListener("focusout",n),k)V.addEventListener("focusout",m,!0),f.push(()=>{V.removeEventListener("focusout",m,!0)});f.push(()=>{V.removeEventListener("focusin",J0),V.removeEventListener("focusout",n)})}return()=>{f.forEach((a)=>{a()})}},[Q,L,V,X0,H,h,k,F,Y,G,Y0,A,O,E,_,M0,l,H0,W,B]),t1.useEffect(()=>{if(Q||!V||!N)return;let $0=Array.from(k?.portalNode?.querySelectorAll(`[${D4("portal")}]`)||[]),J0=(h?lB(h.nodesRef.current,O()):[]).find((m)=>JJ(m.context?.elements.domReference||null))?.context?.elements.domReference,n=[V,J0,...$0,S.current,w.current,t.current,Q0.current,k?.beforeOutsideRef.current,k?.afterOutsideRef.current,K2(B),K2(W),A?L:null].filter((m)=>m!=null);return m_(n,H||A)},[N,Q,L,V,H,E,k,A,h,O,W,B]),q0(()=>{if(!N||Q||!L1(X0))return;let $0=p0(X0),Z0=r5($0);queueMicrotask(()=>{let J0=V0(X0),n=I.current,m=typeof n==="function"?n(C.current||""):n;if(m===void 0||m===!1)return;let c;if(m===!0||m===null)c=J0[0]||X0;else c=K2(m);if(c=c||J0[0]||X0,m0(X0,Z0))return;U3(c,{preventScroll:c===X0})})},[Q,N,X0,D,V0,I,C]),q0(()=>{if(Q||!X0)return;let $0=p0(X0),Z0=r5($0);Pd(Z0);function J0(c){if(!c.open)u.current=Od(c.nativeEvent,j.current);if(c.reason===K0.triggerHover&&c.nativeEvent.type==="mouseleave")T.current=!0;if(c.reason!==K0.outsidePress)return;if(c.nested)T.current=!1;else if(Nz(c.nativeEvent)||Vz(c.nativeEvent))T.current=!1;else{let f=!1;if(document.createElement("div").focus({get preventScroll(){return f=!0,!1}}),f)T.current=!1;else T.current=!0}}M.on("openchange",J0);let n=$0.createElement("span");if(n.setAttribute("tabindex","-1"),n.setAttribute("aria-hidden","true"),Object.assign(n.style,H2),B0&&L)L.insertAdjacentElement("afterend",n);function m(){let c=y.current,f=typeof c==="function"?c(u.current):c;if(f===void 0||f===!1)return null;if(f===null)f=!0;if(typeof f==="boolean"){let o=L||Gq();return o&&o.isConnected?o:n}let a=L||Gq()||n;return K2(f)||a}return()=>{M.off("openchange",J0);let c=r5($0),f=m0(V,c)||h&&b2(h.nodesRef.current,O(),!1).some((o)=>m0(o.context?.elements.floating,c)),a=m();queueMicrotask(()=>{let o=wd(a),N0=typeof y.current!=="boolean";if(y.current&&!T.current&&L1(o)&&(!N0&&o!==c&&c!==$0.body?f:!0))o.focus({preventScroll:!0});n.remove(),T.current=!1})}},[Q,V,X0,y,_,M,h,B0,L,O]),q0(()=>{if(!Wz||N||!V)return;let $0=r5(p0(V));if(!L1($0)||!H3($0))return;if(m0(V,$0))$0.blur()},[N,V]),q0(()=>{if(Q||!k)return;return k.setFocusManagerState({modal:H,closeOnFocusOut:Y,open:N,onOpenChange:F.setOpen,domReference:L}),()=>{k.setFocusManagerState(null)}},[Q,k,H,N,F,Y,L]),q0(()=>{if(Q||!X0)return;return l_(X0,E),()=>{queueMicrotask(Hq)}},[Q,X0,E]);let i=!Q&&(H?!A:!0)&&(B0||H);return GJ.jsxs(t1.Fragment,{children:[i&&GJ.jsx(E8,{"data-type":"inside",ref:x,onFocus:($0)=>{if(H){let Z0=V0();U3(Z0[Z0.length-1])}else if(k?.portalNode)if(T.current=!1,G2($0,k.portalNode))a9(L)?.focus();else K2(B??k.beforeOutsideRef)?.focus()}}),J,i&&GJ.jsx(E8,{"data-type":"inside",ref:e,onFocus:($0)=>{if(H)U3(V0()[0]);else if(k?.portalNode){if(Y)T.current=!0;if(G2($0,k.portalNode))wz(L)?.focus();else K2(W??k.afterOutsideRef)?.focus()}}})]})}var HJ=P(v(),1);function w9($,Z={}){let J="rootStore"in $?$.rootStore:$,Q=J.context.dataRef,{enabled:X=!0,event:z="click",toggle:G=!0,ignoreMouse:H=!1,stickIfOpen:Y=!0,touchOpenDelay:K=0,reason:W=K0.triggerPress}=Z,B=HJ.useRef(void 0),q=z4(),U=V1(),F=HJ.useMemo(()=>({onPointerDown(N){B.current=N.pointerType},onMouseDown(N){let L=B.current,V=N.nativeEvent,M=J.select("open");if(N.button!==0||z==="click"||f4(L,!0)&&H)return;let _=Q.current.openEvent,O=_?.type,D=J.select("domReferenceElement")!==N.currentTarget,A=M&&D||!(M&&G&&(_&&Y?O==="click"||O==="mousedown":!0));if(H3(V.target)){let I=D0(W,V,V.target);if(A&&L==="touch"&&K>0)U.start(K,()=>{J.setOpen(!0,I)});else J.setOpen(A,I);return}let E=N.currentTarget;q.request(()=>{let I=D0(W,V,E);if(A&&L==="touch"&&K>0)U.start(K,()=>{J.setOpen(!0,I)});else J.setOpen(A,I)})},onClick(N){if(z==="mousedown-only")return;let L=B.current;if(z==="mousedown"&&L){B.current=void 0;return}if(f4(L,!0)&&H)return;let V=J.select("open"),M=Q.current.openEvent,_=J.select("domReferenceElement")!==N.currentTarget,O=V&&_||!(V&&G&&(M&&Y?Lz(M):!0)),D=D0(W,N.nativeEvent,N.currentTarget);if(O&&L==="touch"&&K>0)U.start(K,()=>{J.setOpen(!0,D)});else J.setOpen(O,D)},onKeyDown(){B.current=void 0}}),[Q,z,H,J,Y,G,q,U,K,W]);return HJ.useMemo(()=>X?{reference:F}:E5,[X,F])}var i8=P(v(),1);function Td($,Z){let J=null,Q=null,X=!1;return{contextElement:$||void 0,getBoundingClientRect(){let z=$?.getBoundingClientRect()||{width:0,height:0,x:0,y:0},G=Z.axis==="x"||Z.axis==="both",H=Z.axis==="y"||Z.axis==="both",Y=["mouseenter","mousemove"].includes(Z.dataRef.current.openEvent?.type||"")&&Z.pointerType!=="touch",K=z.width,W=z.height,B=z.x,q=z.y;if(J==null&&Z.x&&G)J=z.x-Z.x;if(Q==null&&Z.y&&H)Q=z.y-Z.y;if(B-=J||0,q-=Q||0,K=0,W=0,!X||Y)K=Z.axis==="y"?z.width:0,W=Z.axis==="x"?z.height:0,B=G&&Z.x!=null?Z.x:B,q=H&&Z.y!=null?Z.y:q;else if(X&&!Y)W=Z.axis==="x"?z.height:W,K=Z.axis==="y"?z.width:K;return X=!0,{width:K,height:W,x:B,y:q,top:q,right:B+K,bottom:q+W,left:B}}}}function i_($){return $!=null&&$.clientX!=null}function Yq($,Z={}){let J="rootStore"in $?$.rootStore:$,Q=J.useState("open"),X=J.useState("floatingElement"),z=J.useState("domReferenceElement"),G=J.context.dataRef,{enabled:H=!0,axis:Y="both"}=Z,K=i8.useRef(!1),W=i8.useRef(null),[B,q]=i8.useState(),[U,F]=i8.useState([]),N=U0((O,D,A)=>{if(K.current)return;if(G.current.openEvent&&!i_(G.current.openEvent))return;J.set("positionReference",Td(A??z,{x:O,y:D,axis:Y,dataRef:G,pointerType:B}))}),L=U0((O)=>{if(!Q)N(O.clientX,O.clientY,O.currentTarget);else if(!W.current)F([])}),V=f4(B)?X:Q,M=i8.useCallback(()=>{if(!V||!H)return;let O=C8(X);function D(A){let E=R5(A);if(!m0(X,E))N(A.clientX,A.clientY);else O.removeEventListener("mousemove",D),W.current=null}if(!G.current.openEvent||i_(G.current.openEvent)){O.addEventListener("mousemove",D);let A=()=>{O.removeEventListener("mousemove",D),W.current=null};return W.current=A,A}J.set("positionReference",z);return},[V,H,X,G,z,J,N]);i8.useEffect(()=>{return M()},[M,U]),i8.useEffect(()=>{if(H&&!X)K.current=!1},[H,X]),i8.useEffect(()=>{if(!H&&Q)K.current=!0},[H,Q]);let _=i8.useMemo(()=>{function O(D){q(D.pointerType)}return{onPointerDown:O,onPointerEnter:O,onMouseMove:L,onMouseEnter:L}},[L]);return i8.useMemo(()=>H?{reference:_,trigger:_}:{},[H,_])}var m4=P(v(),1);var Cd={intentional:"onClick",sloppy:"onPointerDown"};function Ed($){return{escapeKey:typeof $==="boolean"?$:$?.escapeKey??!1,outsidePress:typeof $==="boolean"?$:$?.outsidePress??!0}}function W2($,Z={}){let J="rootStore"in $?$.rootStore:$,Q=J.useState("open"),X=J.useState("floatingElement"),z=J.useState("referenceElement"),G=J.useState("domReferenceElement"),{onOpenChange:H,dataRef:Y}=J.context,{enabled:K=!0,escapeKey:W=!0,outsidePress:B=!0,outsidePressEvent:q="sloppy",referencePress:U=!1,referencePressEvent:F="sloppy",ancestorScroll:N=!1,bubbles:L,externalTree:V}=Z,M=k8(V),_=U0(typeof B==="function"?B:()=>!1),O=typeof B==="function"?_:B,D=m4.useRef(!1),{escapeKey:A,outsidePress:E}=Ed(L),I=m4.useRef(null),y=V1(),C=V1(),h=U0(()=>{C.clear(),Y.current.insideReactTree=!1}),k=m4.useRef(!1),S=m4.useRef(""),w=U0((i)=>{S.current=i.pointerType}),T=U0(()=>{let i=S.current,$0=i==="pen"||!i?"mouse":i,Z0=typeof q==="function"?q():q;if(typeof Z0==="string")return Z0;return Z0[$0]}),R=U0((i)=>{if(!Q||!K||!W||i.key!=="Escape")return;if(k.current)return;let $0=Y.current.floatingContext?.nodeId,Z0=M?b2(M.nodesRef.current,$0):[];if(!A){if(Z0.length>0){let m=!0;if(Z0.forEach((c)=>{if(c.context?.open&&!c.context.dataRef.current.__escapeKeyBubbles)m=!1}),!m)return}}let J0=iA(i)?i.nativeEvent:i,n=D0(K0.escapeKey,J0);if(J.setOpen(!1,n),!A&&!n.isPropagationAllowed)i.stopPropagation()}),b=U0((i)=>{let $0=T();return $0==="intentional"&&i.type!=="click"||$0==="sloppy"&&i.type==="click"}),g=U0(()=>{Y.current.insideReactTree=!0,C.start(0,h)}),u=U0((i,$0=!1)=>{if(b(i)){h();return}if(Y.current.insideReactTree){h();return}if(T()==="intentional"&&$0)return;if(typeof O==="function"&&!O(i))return;let Z0=R5(i),J0=`[${D4("inert")}]`,n=p0(J.select("floatingElement")).querySelectorAll(J0),m=J.context.triggerElements;if(Z0&&(m.hasElement(Z0)||m.hasMatchingElement((N0)=>m0(N0,Z0))))return;let c=_5(Z0)?Z0:null;while(c&&!f7(c)){let N0=mz(c);if(f7(N0)||!_5(N0))break;c=N0}if(n.length&&_5(Z0)&&!lA(Z0)&&!m0(Z0,J.select("floatingElement"))&&Array.from(n).every((N0)=>!m0(c,N0)))return;if(L1(Z0)&&!("touches"in i)){let N0=f7(Z0),j0=g7(Z0),h0=/auto|scroll/,u0=N0||h0.test(j0.overflowX),p=N0||h0.test(j0.overflowY),r=u0&&Z0.clientWidth>0&&Z0.scrollWidth>Z0.clientWidth,z0=p&&Z0.clientHeight>0&&Z0.scrollHeight>Z0.clientHeight,L0=j0.direction==="rtl",P0=z0&&(L0?i.offsetX<=Z0.offsetWidth-Z0.clientWidth:i.offsetX>Z0.clientWidth),g0=r&&i.offsetY>Z0.clientHeight;if(P0||g0)return}let f=Y.current.floatingContext?.nodeId,a=M&&b2(M.nodesRef.current,f).some((N0)=>v4(i,N0.context?.elements.floating));if(v4(i,J.select("floatingElement"))||v4(i,J.select("domReferenceElement"))||a)return;let o=M?b2(M.nodesRef.current,f):[];if(o.length>0){let N0=!0;if(o.forEach((j0)=>{if(j0.context?.open&&!j0.context.dataRef.current.__outsidePressBubbles)N0=!1}),!N0)return}J.setOpen(!1,D0(K0.outsidePress,i)),h()}),j=U0((i)=>{if(T()!=="sloppy"||i.pointerType==="touch"||!J.select("open")||!K||v4(i,J.select("floatingElement"))||v4(i,J.select("domReferenceElement")))return;u(i)}),t=U0((i)=>{if(T()!=="sloppy"||!J.select("open")||!K||v4(i,J.select("floatingElement"))||v4(i,J.select("domReferenceElement")))return;let $0=i.touches[0];if($0)I.current={startTime:Date.now(),startX:$0.clientX,startY:$0.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},y.start(1000,()=>{if(I.current)I.current.dismissOnTouchEnd=!1,I.current.dismissOnMouseDown=!1})}),Q0=U0((i)=>{let $0=R5(i);function Z0(){t(i),$0?.removeEventListener(i.type,Z0)}$0?.addEventListener(i.type,Z0)}),x=U0((i)=>{let $0=D.current;if(D.current=!1,y.clear(),i.type==="mousedown"&&I.current&&!I.current.dismissOnMouseDown)return;let Z0=R5(i);function J0(){if(i.type==="pointerdown")j(i);else u(i,$0);Z0?.removeEventListener(i.type,J0)}Z0?.addEventListener(i.type,J0)}),e=U0((i)=>{if(T()!=="sloppy"||!I.current||v4(i,J.select("floatingElement"))||v4(i,J.select("domReferenceElement")))return;let $0=i.touches[0];if(!$0)return;let Z0=Math.abs($0.clientX-I.current.startX),J0=Math.abs($0.clientY-I.current.startY),n=Math.sqrt(Z0*Z0+J0*J0);if(n>5)I.current.dismissOnTouchEnd=!0;if(n>10)u(i),y.clear(),I.current=null}),M0=U0((i)=>{let $0=R5(i);function Z0(){e(i),$0?.removeEventListener(i.type,Z0)}$0?.addEventListener(i.type,Z0)}),l=U0((i)=>{if(T()!=="sloppy"||!I.current||v4(i,J.select("floatingElement"))||v4(i,J.select("domReferenceElement")))return;if(I.current.dismissOnTouchEnd)u(i);y.clear(),I.current=null}),H0=U0((i)=>{let $0=R5(i);function Z0(){l(i),$0?.removeEventListener(i.type,Z0)}$0?.addEventListener(i.type,Z0)});m4.useEffect(()=>{if(!Q||!K)return;Y.current.__escapeKeyBubbles=A,Y.current.__outsidePressBubbles=E;let i=new l1;function $0(c){J.setOpen(!1,D0(K0.none,c))}function Z0(){i.clear(),k.current=!0}function J0(){i.start(r_()?5:0,()=>{k.current=!1})}let n=p0(X);if(n.addEventListener("pointerdown",w,!0),W)n.addEventListener("keydown",R),n.addEventListener("compositionstart",Z0),n.addEventListener("compositionend",J0);if(O)n.addEventListener("click",x,!0),n.addEventListener("pointerdown",x,!0),n.addEventListener("touchstart",Q0,!0),n.addEventListener("touchmove",M0,!0),n.addEventListener("touchend",H0,!0),n.addEventListener("mousedown",x,!0);let m=[];if(N){if(_5(G))m=YJ(G);if(_5(X))m=m.concat(YJ(X));if(!_5(z)&&z&&z.contextElement)m=m.concat(YJ(z.contextElement))}return m=m.filter((c)=>c!==n.defaultView?.visualViewport),m.forEach((c)=>{c.addEventListener("scroll",$0,{passive:!0})}),()=>{if(n.removeEventListener("pointerdown",w,!0),W)n.removeEventListener("keydown",R),n.removeEventListener("compositionstart",Z0),n.removeEventListener("compositionend",J0);if(O)n.removeEventListener("click",x,!0),n.removeEventListener("pointerdown",x,!0),n.removeEventListener("touchstart",Q0,!0),n.removeEventListener("touchmove",M0,!0),n.removeEventListener("touchend",H0,!0),n.removeEventListener("mousedown",x,!0);m.forEach((c)=>{c.removeEventListener("scroll",$0)}),i.clear(),D.current=!1}},[Y,X,z,G,W,O,Q,H,N,K,A,E,R,u,x,j,Q0,M0,H0,w,J]),m4.useEffect(h,[O,h]);let B0=m4.useMemo(()=>({onKeyDown:R,...U&&{[Cd[F]]:(i)=>{J.setOpen(!1,D0(K0.triggerPress,i.nativeEvent))},...F!=="intentional"&&{onClick(i){J.setOpen(!1,D0(K0.triggerPress,i.nativeEvent))}}}}),[R,J,U,F]),X0=U0((i)=>{let $0=R5(i.nativeEvent);if(!m0(J.select("floatingElement"),$0)||i.button!==0)return;D.current=!0}),Y0=U0((i)=>{if(!Q||!K||i.button!==0)return;D.current=!0}),V0=m4.useMemo(()=>({onKeyDown:R,onPointerDown:X0,onMouseDown:X0,onMouseUp:X0,onClickCapture:g,onMouseDownCapture(i){g(),Y0(i)},onPointerDownCapture(i){g(),Y0(i)},onMouseUpCapture:g,onTouchEndCapture:g,onTouchMoveCapture:g}),[R,X0,g,Y0]);return m4.useMemo(()=>K?{reference:B0,floating:V0,trigger:B0}:{},[K,B0,V0])}var a8=P(v(),1);var Sd={open:E0(($)=>$.open),domReferenceElement:E0(($)=>$.domReferenceElement),referenceElement:E0(($)=>$.positionReference??$.referenceElement),floatingElement:E0(($)=>$.floatingElement),floatingId:E0(($)=>$.floatingId)};class L3 extends l8{constructor($){let{nested:Z,noEmit:J,onOpenChange:Q,triggerElements:X,...z}=$;super({...z,positionReference:z.referenceElement,domReferenceElement:z.referenceElement},{onOpenChange:Q,dataRef:{current:{}},events:yz(),nested:Z,noEmit:J,triggerElements:X},Sd)}setOpen=($,Z)=>{if(!$||!this.state.open||Lz(Z.event))this.context.dataRef.current.openEvent=$?Z.event:void 0;if(!this.context.noEmit){let J={open:$,reason:Z.reason,nativeEvent:Z.event,nested:this.context.nested,triggerElement:Z.trigger};this.context.events.emit("openchange",J)}this.context.onOpenChange?.($,Z)}}var WJ=P(v(),1);var KJ=P(v(),1);function p4($,Z=!1,J=!1){let[Q,X]=KJ.useState($&&Z?"idle":void 0),[z,G]=KJ.useState($);if($&&!z)G(!0),X("starting");if(!$&&z&&Q!=="ending"&&!J)X("ending");if(!$&&!z&&Q==="ending")X(void 0);return q0(()=>{if(!$&&z&&Q!=="ending"&&J){let H=G1.request(()=>{X("ending")});return()=>{G1.cancel(H)}}return},[$,z,Q,J]),q0(()=>{if(!$||Z)return;let H=G1.request(()=>{X(void 0)});return()=>{G1.cancel(H)}},[Z,$]),q0(()=>{if(!$||!Z)return;if($&&z&&Q!=="idle")X("starting");let H=G1.request(()=>{X("idle")});return()=>{G1.cancel(H)}},[Z,$,z,X,Q]),KJ.useMemo(()=>({mounted:z,setMounted:G,transitionStatus:Q}),[z,Q])}function Kq($,Z){let J=WJ.useRef(null),Q=WJ.useRef(null);return WJ.useCallback((X)=>{if($===void 0)return;if(J.current!==null){let z=J.current,G=Q.current,H=Z.context.triggerElements.getById(z);if(G&&H===G)Z.context.triggerElements.delete(z);J.current=null,Q.current=null}if(X!==null)J.current=$,Q.current=X,Z.context.triggerElements.add($,X)},[Z,$])}function m2($,Z,J,Q){let X=J.useState("isMountedByTrigger",$),z=Kq($,J),G=U0((H)=>{if(z(H),!H||!J.select("open"))return;let Y=J.select("activeTriggerId");if(Y===$){J.update({activeTriggerElement:H,...Q});return}if(Y==null)J.update({activeTriggerId:$,activeTriggerElement:H,...Q})});return q0(()=>{if(X)J.update({activeTriggerElement:Z.current,...Q})},[X,J,Z,...Object.values(Q)]),{registerTrigger:G,isMountedByThisTrigger:X}}function p2($){let Z=$.useState("open");q0(()=>{if(Z&&!$.select("activeTriggerId")&&$.context.triggerElements.size===1){let J=$.context.triggerElements.entries().next();if(!J.done){let[Q,X]=J.value;$.update({activeTriggerId:Q,activeTriggerElement:X})}}},[Z,$])}function u2($,Z,J){let{mounted:Q,setMounted:X,transitionStatus:z}=p4($);Z.useSyncedValues({mounted:Q,transitionStatus:z});let G=U0(()=>{X(!1),Z.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1}),J?.(),Z.context.onOpenChangeComplete?.(!1)}),H=Z.useState("preventUnmountingOnClose");return I1({enabled:!H,open:$,ref:Z.context.popupRef,onComplete(){if(!$)G()}}),{forceUnmount:G,transitionStatus:z}}class r8{constructor(){this.elementsSet=new Set,this.idMap=new Map}add($,Z){let J=this.idMap.get($);if(J===Z)return;if(J!==void 0)this.elementsSet.delete(J);this.elementsSet.add(Z),this.idMap.set($,Z)}delete($){let Z=this.idMap.get($);if(Z)this.elementsSet.delete(Z),this.idMap.delete($)}hasElement($){return this.elementsSet.has($)}hasMatchingElement($){for(let Z of this.elementsSet)if($(Z))return!0;return!1}getById($){return this.idMap.get($)}entries(){return this.idMap.entries()}elements(){return this.elementsSet.values()}get size(){return this.idMap.size}}function a_(){return new L3({open:!1,floatingElement:null,referenceElement:null,triggerElements:new r8,floatingId:"",nested:!1,noEmit:!1,onOpenChange:void 0})}function c2(){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:"idle",floatingRootContext:a_(),preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:E5,inactiveTriggerProps:E5,popupProps:E5}}var pz=E0(($)=>$.triggerIdProp??$.activeTriggerId),d2={open:E0(($)=>$.openProp??$.open),mounted:E0(($)=>$.mounted),transitionStatus:E0(($)=>$.transitionStatus),floatingRootContext:E0(($)=>$.floatingRootContext),preventUnmountingOnClose:E0(($)=>$.preventUnmountingOnClose),payload:E0(($)=>$.payload),activeTriggerId:pz,activeTriggerElement:E0(($)=>$.mounted?$.activeTriggerElement:null),isTriggerActive:E0(($,Z)=>Z!==void 0&&pz($)===Z),isOpenedByTrigger:E0(($,Z)=>Z!==void 0&&pz($)===Z&&$.open),isMountedByTrigger:E0(($,Z)=>Z!==void 0&&pz($)===Z&&$.mounted),triggerProps:E0(($,Z)=>Z?$.activeTriggerProps:$.inactiveTriggerProps),popupProps:E0(($)=>$.popupProps),popupElement:E0(($)=>$.popupElement),positionerElement:E0(($)=>$.positionerElement)};function BJ($){let{open:Z=!1,onOpenChange:J,elements:Q={}}=$,X=Y8(),z=s1()!=null,G=T5(()=>new L3({open:Z,onOpenChange:J,referenceElement:Q.reference??null,floatingElement:Q.floating??null,triggerElements:new r8,floatingId:X,nested:z,noEmit:!1})).current;return q0(()=>{let H={open:Z,floatingId:X};if(Q.reference!==void 0)H.referenceElement=Q.reference,H.domReferenceElement=_5(Q.reference)?Q.reference:null;if(Q.floating!==void 0)H.floatingElement=Q.floating;G.update(H)},[Z,X,Q.reference,Q.floating,G]),G.context.onOpenChange=J,G.context.nested=z,G.context.noEmit=!1,G}function Wq($={}){let{nodeId:Z,externalTree:J}=$,Q=BJ($),X=$.rootContext||Q,z={reference:X.useState("referenceElement"),floating:X.useState("floatingElement"),domReference:X.useState("domReferenceElement")},[G,H]=a8.useState(null),Y=a8.useRef(null),K=k8(J);q0(()=>{if(z.domReference)Y.current=z.domReference},[z.domReference]);let W=n_({...$,elements:{...z,...G&&{reference:G}}}),B=a8.useCallback((E)=>{let I=_5(E)?{getBoundingClientRect:()=>E.getBoundingClientRect(),getClientRects:()=>E.getClientRects(),contextElement:E}:E;H(I),W.refs.setReference(I)},[W.refs]),[q,U]=a8.useState(null),[F,N]=a8.useState(null);X.useSyncedValue("referenceElement",q),X.useSyncedValue("domReferenceElement",_5(q)?q:null),X.useSyncedValue("floatingElement",F);let L=a8.useCallback((E)=>{if(_5(E)||E===null)Y.current=E,U(E);if(_5(W.refs.reference.current)||W.refs.reference.current===null||E!==null&&!_5(E))W.refs.setReference(E)},[W.refs,U]),V=a8.useCallback((E)=>{N(E),W.refs.setFloating(E)},[W.refs]),M=a8.useMemo(()=>({...W.refs,setReference:L,setFloating:V,setPositionReference:B,domReference:Y}),[W.refs,L,V,B]),_=a8.useMemo(()=>({...W.elements,domReference:z.domReference}),[W.elements,z.domReference]),O=X.useState("open"),D=X.useState("floatingId"),A=a8.useMemo(()=>({...W,dataRef:X.context.dataRef,open:O,onOpenChange:X.setOpen,events:X.context.events,floatingId:D,refs:M,elements:_,nodeId:Z,rootStore:X}),[W,M,_,Z,X,O,D]);return q0(()=>{X.context.dataRef.current.floatingContext=A;let E=K?.nodesRef.current.find((I)=>I.id===Z);if(E)E.context=A}),a8.useMemo(()=>({...W,context:A,refs:M,elements:_,rootStore:X}),[W,M,_,A,X])}function B2($){let{popupStore:Z,noEmit:J=!1,treatPopupAsFloatingElement:Q=!1,onOpenChange:X}=$,z=Y8(),G=s1()!=null,H=Z.useState("open"),Y=Z.useState("activeTriggerElement"),K=Z.useState(Q?"popupElement":"positionerElement"),W=Z.context.triggerElements,B=T5(()=>new L3({open:H,referenceElement:Y,floatingElement:K,triggerElements:W,onOpenChange:X,floatingId:z,nested:G,noEmit:J})).current;return q0(()=>{let q={open:H,floatingId:z,referenceElement:Y,floatingElement:K};if(_5(Y))q.domReferenceElement=Y;if(B.state.positionReference===B.state.referenceElement)q.positionReference=Y;B.update(q)},[H,z,Y,K,B]),B.context.onOpenChange=X,B.context.nested=G,B.context.noEmit=J,B}var l2=P(v(),1);var Bq=cA&&qz;function M3($,Z={}){let J="rootStore"in $?$.rootStore:$,{events:Q,dataRef:X}=J.context,{enabled:z=!0,delay:G}=Z,H=l2.useRef(!1),Y=l2.useRef(null),K=V1(),W=l2.useRef(!0);l2.useEffect(()=>{let q=J.select("domReferenceElement");if(!z)return;let U=C8(q);function F(){let V=J.select("domReferenceElement");if(!J.select("open")&&L1(V)&&V===r5(p0(V)))H.current=!0}function N(){W.current=!0}function L(){W.current=!1}if(U.addEventListener("blur",F),Bq)U.addEventListener("keydown",N,!0),U.addEventListener("pointerdown",L,!0);return()=>{if(U.removeEventListener("blur",F),Bq)U.removeEventListener("keydown",N,!0),U.removeEventListener("pointerdown",L,!0)}},[J,z]),l2.useEffect(()=>{if(!z)return;function q(U){if(U.reason===K0.triggerPress||U.reason===K0.escapeKey){let F=J.select("domReferenceElement");if(_5(F))Y.current=F,H.current=!0}}return Q.on("openchange",q),()=>{Q.off("openchange",q)}},[Q,z,J]);let B=l2.useMemo(()=>({onMouseLeave(){H.current=!1,Y.current=null},onFocus(q){let U=q.currentTarget;if(H.current){if(Y.current===U)return;H.current=!1,Y.current=null}let F=R5(q.nativeEvent);if(_5(F)){if(Bq&&!q.relatedTarget){if(!W.current&&!H3(F))return}else if(!r9(F))return}let N=G3(q.relatedTarget,J.context.triggerElements),{nativeEvent:L,currentTarget:V}=q,M=typeof G==="function"?G():G;if(J.select("open")&&N||M===0||M===void 0){J.setOpen(!0,D0(K0.triggerFocus,L,V));return}K.start(M,()=>{if(H.current)return;J.setOpen(!0,D0(K0.triggerFocus,L,V))})},onBlur(q){H.current=!1,Y.current=null;let{relatedTarget:U,nativeEvent:F}=q,N=_5(U)&&U.hasAttribute(D4("focus-guard"))&&U.getAttribute("data-type")==="outside";K.start(0,()=>{let L=J.select("domReferenceElement"),V=r5(L?L.ownerDocument:document);if(!U&&V===L)return;if(m0(X.current.floatingContext?.refs.floating.current,V)||m0(L,V)||N)return;if(G3(U??V,J.context.triggerElements))return;J.setOpen(!1,D0(K0.triggerFocus,F))})}}),[X,J,K,G]);return l2.useMemo(()=>z?{reference:B,trigger:B}:{},[z,B])}var m7=P(v(),1);var qJ=D4("safe-polygon"),kd=`button,a,[role="button"],select,[tabindex]:not([tabindex="-1"]),${I7}`;function o_($){return $?Boolean($.closest(kd)):!1}class qq{constructor(){this.pointerType=void 0,this.interactedInside=!1,this.handler=void 0,this.blockMouseMove=!0,this.performedPointerEventsMutation=!1,this.unbindMouseMove=()=>{},this.restTimeoutPending=!1,this.openChangeTimeout=new l1,this.restTimeout=new l1,this.handleCloseOptions=void 0}static create(){return new qq}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>{return this.dispose}}function uz($){let Z=T5(qq.create).current,J=$.context.dataRef.current;if(!J.hoverInteractionState)J.hoverInteractionState=Z;return T8(J.hoverInteractionState.disposeEffect),J.hoverInteractionState}var Id=new Set(["click","mousedown"]);function j9($,Z={}){let J="rootStore"in $?$.rootStore:$,Q=J.useState("open"),X=J.useState("floatingElement"),z=J.useState("domReferenceElement"),{dataRef:G}=J.context,{enabled:H=!0,closeDelay:Y=0}=Z,K=uz(J),W=k8(),B=s1(),q=U0(()=>{if(K.interactedInside)return!0;return G.current.openEvent?Id.has(G.current.openEvent.type):!1}),U=U0(()=>{let _=G.current.openEvent?.type;return _?.includes("mouse")&&_!=="mousedown"}),F=U0((_)=>{return G3(_,J.context.triggerElements)}),N=m7.useCallback((_,O=!0)=>{let D=Rd(Y,K.pointerType);if(D&&!K.handler)K.openChangeTimeout.start(D,()=>J.setOpen(!1,D0(K0.triggerHover,_)));else if(O)K.openChangeTimeout.clear(),J.setOpen(!1,D0(K0.triggerHover,_))},[Y,J,K]),L=U0(()=>{K.unbindMouseMove(),K.handler=void 0}),V=U0(()=>{if(K.performedPointerEventsMutation){let _=p0(X).body;_.style.pointerEvents="",_.removeAttribute(qJ),K.performedPointerEventsMutation=!1}}),M=U0((_)=>{let O=R5(_);if(!o_(O)){K.interactedInside=!1;return}K.interactedInside=!0});q0(()=>{if(!Q)K.pointerType=void 0,K.restTimeoutPending=!1,K.interactedInside=!1,L(),V()},[Q,K,L,V]),m7.useEffect(()=>{return()=>{L()}},[L]),m7.useEffect(()=>{return V},[V]),q0(()=>{if(!H)return;if(Q&&K.handleCloseOptions?.blockPointerEvents&&U()&&_5(z)&&X){K.performedPointerEventsMutation=!0;let _=p0(X).body;_.setAttribute(qJ,"");let O=z,D=X,A=W?.nodesRef.current.find((E)=>E.id===B)?.context?.elements.floating;if(A)A.style.pointerEvents="";return _.style.pointerEvents="none",O.style.pointerEvents="auto",D.style.pointerEvents="auto",()=>{_.style.pointerEvents="",O.style.pointerEvents="",D.style.pointerEvents=""}}return},[H,Q,z,X,K,U,W,B]),m7.useEffect(()=>{if(!H)return;function _(E){if(q()||!G.current.floatingContext||!J.select("open"))return;if(F(E.relatedTarget))return;if(V(),L(),!q())N(E)}function O(E){K.openChangeTimeout.clear(),V(),K.handler?.(E),L()}function D(E){if(!q())N(E,!1)}let A=X;if(A)A.addEventListener("mouseleave",_),A.addEventListener("mouseenter",O),A.addEventListener("mouseleave",D),A.addEventListener("pointerdown",M,!0);return()=>{if(A)A.removeEventListener("mouseleave",_),A.removeEventListener("mouseenter",O),A.removeEventListener("mouseleave",D),A.removeEventListener("pointerdown",M,!0)}},[H,X,J,G,q,F,N,V,L,M,K])}function Rd($,Z){if(Z&&!f4(Z))return 0;if(typeof $==="function")return $();return $}var A3=P(v(),1),s_=P(G4(),1);function Uq($){if(typeof $==="function")return $();return $}var yd={current:null};function q2($,Z={}){let J="rootStore"in $?$.rootStore:$,{dataRef:Q,events:X}=J.context,{enabled:z=!0,delay:G=0,handleClose:H=null,mouseOnly:Y=!1,restMs:K=0,move:W=!0,triggerElementRef:B=yd,externalTree:q,isActiveTrigger:U=!0}=Z,F=k8(q),N=uz(J),L=w1(H),V=w1(G),M=w1(K),_=w1(z);if(U)N.handleCloseOptions=L.current?.__options;let O=U0(()=>{if(N.interactedInside)return!0;return Q.current.openEvent?["click","mousedown"].includes(Q.current.openEvent.type):!1}),D=U0((C)=>{return G3(C,J.context.triggerElements)}),A=A3.useCallback((C,h=!0)=>{let k=x7(V.current,"close",N.pointerType);if(k&&!N.handler)N.openChangeTimeout.start(k,()=>J.setOpen(!1,D0(K0.triggerHover,C)));else if(h)N.openChangeTimeout.clear(),J.setOpen(!1,D0(K0.triggerHover,C))},[V,J,N]),E=U0(()=>{N.unbindMouseMove(),N.handler=void 0}),I=U0(()=>{if(N.performedPointerEventsMutation){let C=p0(J.select("domReferenceElement")).body;C.style.pointerEvents="",C.removeAttribute(qJ),N.performedPointerEventsMutation=!1}});A3.useEffect(()=>{if(!z)return;function C(h){if(!h.open)N.openChangeTimeout.clear(),N.restTimeout.clear(),N.blockMouseMove=!0,N.restTimeoutPending=!1}return X.on("openchange",C),()=>{X.off("openchange",C)}},[z,X,N]);let y=U0((C)=>{if(O())return;if(!Q.current.floatingContext)return;if(D(C.relatedTarget))return;let h=B.current;L.current?.({...Q.current.floatingContext,tree:F,x:C.clientX,y:C.clientY,onClose(){if(I(),E(),!O()&&h===J.select("domReferenceElement"))A(C)}})(C)});return A3.useEffect(()=>{if(!z)return;let C=B.current??(U?J.select("domReferenceElement"):null);if(!_5(C))return;function h(w){if(N.openChangeTimeout.clear(),N.blockMouseMove=!1,Y&&!f4(N.pointerType))return;if(Uq(M.current)>0&&!x7(V.current,"open"))return;let T=x7(V.current,"open",N.pointerType),R=J.select("domReferenceElement"),b=J.context.triggerElements,g=(b.hasElement(w.target)||b.hasMatchingElement((Q0)=>m0(Q0,w.target)))&&(!R||!m0(R,w.target)),u=w.currentTarget??null,j=J.select("open"),t=!j||g;if(g&&j)J.setOpen(!0,D0(K0.triggerHover,w,u));else if(T)N.openChangeTimeout.start(T,()=>{if(t)J.setOpen(!0,D0(K0.triggerHover,w,u))});else if(t)J.setOpen(!0,D0(K0.triggerHover,w,u))}function k(w){if(O()){I();return}N.unbindMouseMove();let T=J.select("domReferenceElement"),R=p0(T);if(N.restTimeout.clear(),N.restTimeoutPending=!1,D(w.relatedTarget))return;if(L.current&&Q.current.floatingContext){if(!J.select("open"))N.openChangeTimeout.clear();let g=B.current;N.handler=L.current({...Q.current.floatingContext,tree:F,x:w.clientX,y:w.clientY,onClose(){if(I(),E(),_.current&&!O()&&g===J.select("domReferenceElement"))A(w,!0)}});let u=N.handler;u(w),R.addEventListener("mousemove",u),N.unbindMouseMove=()=>{R.removeEventListener("mousemove",u)};return}if(N.pointerType==="touch"?!m0(J.select("floatingElement"),w.relatedTarget):!0)A(w)}function S(w){y(w)}if(J.select("open"))C.addEventListener("mouseleave",S);if(W)C.addEventListener("mousemove",h,{once:!0});return C.addEventListener("mouseenter",h),C.addEventListener("mouseleave",k),()=>{if(C.removeEventListener("mouseleave",S),W)C.removeEventListener("mousemove",h);C.removeEventListener("mouseenter",h),C.removeEventListener("mouseleave",k)}},[E,I,Q,V,A,J,z,L,y,N,U,O,D,Y,W,M,B,F,_]),A3.useMemo(()=>{if(!z)return;function C(h){N.pointerType=h.pointerType}return{onPointerDown:C,onPointerEnter:C,onMouseMove(h){let{nativeEvent:k}=h,S=h.currentTarget,w=J.select("domReferenceElement"),T=J.context.triggerElements,R=J.select("open"),b=(T.hasElement(h.target)||T.hasMatchingElement((u)=>m0(u,h.target)))&&(!w||!m0(w,h.target));if(Y&&!f4(N.pointerType))return;if(R&&!b||Uq(M.current)===0)return;if(!b&&N.restTimeoutPending&&h.movementX**2+h.movementY**2<2)return;N.restTimeout.clear();function g(){if(N.restTimeoutPending=!1,O())return;let u=J.select("open");if(!N.blockMouseMove&&(!u||b))J.setOpen(!0,D0(K0.triggerHover,k,S))}if(N.pointerType==="touch")s_.flushSync(()=>{g()});else if(b&&R)g();else N.restTimeoutPending=!0,N.restTimeout.start(Uq(M.current),g)}}},[z,N,O,Y,J,M])}var _3=P(v(),1);function e1($=[]){let Z=$.map((K)=>K?.reference),J=$.map((K)=>K?.floating),Q=$.map((K)=>K?.item),X=$.map((K)=>K?.trigger),z=_3.useCallback((K)=>cz(K,$,"reference"),Z),G=_3.useCallback((K)=>cz(K,$,"floating"),J),H=_3.useCallback((K)=>cz(K,$,"item"),Q),Y=_3.useCallback((K)=>cz(K,$,"trigger"),X);return _3.useMemo(()=>({getReferenceProps:z,getFloatingProps:G,getItemProps:H,getTriggerProps:Y}),[z,G,H,Y])}function cz($,Z,J){let Q=new Map,X=J==="item",z={};if(J==="floating")z.tabIndex=-1,z[$J]="";for(let G in $){if(X&&$){if(G===cB||G===dB)continue}z[G]=$[G]}for(let G=0;G<Z.length;G+=1){let H,Y=Z[G]?.[J];if(typeof Y==="function")H=$?Y($):null;else H=Y;if(!H)continue;t_(z,H,X,Q)}return t_(z,$,X,Q),z}function t_($,Z,J,Q){for(let X in Z){let z=Z[X];if(J&&(X===cB||X===dB))continue;if(!X.startsWith("on"))$[X]=z;else{if(!Q.has(X))Q.set(X,[]);if(typeof z==="function")Q.get(X)?.push(z),$[X]=(...G)=>{return Q.get(X)?.map((H)=>H(...G)).find((H)=>H!==void 0)}}}}var $8=P(v(),1);var bd="Escape";function lz($,Z,J){switch($){case"vertical":return Z;case"horizontal":return J;default:return Z||J}}function dz($,Z){return lz(Z,$===ZJ||$===z3,$===R2||$===y2)}function Fq($,Z,J){return lz(Z,$===z3,J?$===R2:$===y2)||$==="Enter"||$===" "||$===""}function xd($,Z,J){return lz(Z,J?$===R2:$===y2,$===z3)}function hd($,Z,J,Q){let X=J?$===y2:$===R2,z=$===ZJ;if(Z==="both"||Z==="horizontal"&&Q&&Q>1)return $===bd;return lz(Z,X,z)}function Nq($,Z){let J="rootStore"in $?$.rootStore:$,Q=J.useState("open"),X=J.useState("floatingElement"),z=J.useState("domReferenceElement"),G=J.context.dataRef,{listRef:H,activeIndex:Y,onNavigate:K=()=>{},enabled:W=!0,selectedIndex:B=null,allowEscape:q=!1,loopFocus:U=!1,nested:F=!1,rtl:N=!1,virtual:L=!1,focusItemOnOpen:V="auto",focusItemOnHover:M=!0,openOnArrowKeyDown:_=!0,disabledIndices:O=void 0,orientation:D="vertical",parentOrientation:A,cols:E=1,id:I,resetOnPointerLeave:y=!0,externalTree:C}=Z,h=Y3(X),k=w1(h),S=s1(),w=k8(C);q0(()=>{G.current.orientation=D},[G,D]);let T=JJ(z),R=$8.useRef(V),b=$8.useRef(B??-1),g=$8.useRef(null),u=$8.useRef(!0),j=U0((f)=>{K(b.current===-1?null:b.current,f)}),t=$8.useRef(j),Q0=$8.useRef(!!X),x=$8.useRef(Q),e=$8.useRef(!1),M0=$8.useRef(!1),l=w1(O),H0=w1(Q),B0=w1(B),X0=w1(y),Y0=U0(()=>{function f(j0){if(L)w?.events.emit("virtualfocus",j0);else U3(j0,{sync:e.current,preventScroll:!0})}let a=H.current[b.current],o=M0.current;if(a)f(a);(e.current?(j0)=>j0():requestAnimationFrame)(()=>{let j0=H.current[b.current]||a;if(!j0)return;if(!a)f(j0);if(i&&(o||!u.current))j0.scrollIntoView?.({block:"nearest",inline:"nearest"})})});q0(()=>{if(!W)return;if(Q&&X){if(b.current=B??-1,R.current&&B!=null)M0.current=!0,j()}else if(Q0.current)b.current=-1,t.current()},[W,Q,X,B,j]),q0(()=>{if(!W)return;if(!Q){e.current=!1;return}if(!X)return;if(Y==null){if(e.current=!1,B0.current!=null)return;if(Q0.current)b.current=-1,Y0();if((!x.current||!Q0.current)&&R.current&&(g.current!=null||R.current===!0&&g.current==null)){let f=0,a=()=>{if(H.current[0]==null){if(f<2)(f?requestAnimationFrame:queueMicrotask)(a);f+=1}else b.current=g.current==null||Fq(g.current,D,N)||F?Az(H):rB(H),g.current=null,j()};a()}}else if(!R7(H,Y))b.current=Y,Y0(),M0.current=!1},[W,Q,X,Y,B0,F,H,D,N,j,Y0,l]),q0(()=>{if(!W||X||!w||L||!Q0.current)return;let f=w.nodesRef.current,a=f.find((j0)=>j0.id===S)?.context?.elements.floating,o=r5(p0(X)),N0=f.some((j0)=>j0.context&&m0(j0.context.elements.floating,o));if(a&&!N0&&u.current)a.focus({preventScroll:!0})},[W,X,w,S,L]),q0(()=>{t.current=j,x.current=Q,Q0.current=!!X}),q0(()=>{if(!Q)g.current=null,R.current=V},[Q,V]);let V0=Y!=null,i=$8.useMemo(()=>{function f(o){if(!H0.current)return;let N0=H.current.indexOf(o.currentTarget);if(N0!==-1&&b.current!==N0)b.current=N0,j(o)}return{onFocus(o){e.current=!0,f(o)},onClick:({currentTarget:o})=>o.focus({preventScroll:!0}),onMouseMove(o){if(e.current=!0,M0.current=!1,M)f(o)},onPointerLeave(o){if(!H0.current||!u.current||o.pointerType==="touch")return;e.current=!0;let N0=o.relatedTarget;if(!M||H.current.includes(N0))return;if(!X0.current)return;if(U3(null,{sync:!0}),b.current=-1,j(o),!L)k.current?.focus({preventScroll:!0})}}},[H0,k,M,H,j,X0,L]),$0=$8.useCallback(()=>{return A??w?.nodesRef.current.find((f)=>f.id===S)?.context?.dataRef?.current.orientation},[S,w,A]),Z0=U0((f)=>{if(u.current=!1,e.current=!0,f.which===229)return;if(!H0.current&&f.currentTarget===k.current)return;if(F&&hd(f.key,D,N,E)){if(!dz(f.key,$0()))i1(f);if(J.setOpen(!1,D0(K0.listNavigation,f.nativeEvent)),L1(z))if(L)w?.events.emit("virtualfocus",z);else z.focus();return}let a=b.current,o=Az(H,O),N0=rB(H,O);if(!T){if(f.key==="Home")i1(f),b.current=o,j(f);if(f.key==="End")i1(f),b.current=N0,j(f)}if(E>1){let j0=Array.from({length:H.current.length},()=>({width:1,height:1})),h0=aA(j0,E,!1),u0=h0.findIndex((z0)=>z0!=null&&!y7(H,z0,O)),p=h0.reduce((z0,L0,P0)=>L0!=null&&!y7(H,L0,O)?P0:z0,-1),r=h0[rA({current:h0.map((z0)=>z0!=null?H.current[z0]:null)},{event:f,orientation:D,loopFocus:U,rtl:N,cols:E,disabledIndices:oA([...(typeof O!=="function"?O:null)||H.current.map((z0,L0)=>y7(H,L0,O)?L0:void 0),void 0],h0),minIndex:u0,maxIndex:p,prevIndex:nA(b.current>N0?o:b.current,j0,h0,E,f.key===z3?"bl":f.key===(N?R2:y2)?"tr":"tl"),stopEvent:!0})];if(r!=null)b.current=r,j(f);if(D==="both")return}if(dz(f.key,D)){if(i1(f),Q&&!L&&r5(f.currentTarget.ownerDocument)===f.currentTarget){b.current=Fq(f.key,D,N)?o:N0,j(f);return}if(Fq(f.key,D,N))if(U)if(a>=N0)if(q&&a!==H.current.length)b.current=-1;else e.current=!1,b.current=o;else b.current=A8(H,{startingIndex:a,disabledIndices:O});else b.current=Math.min(N0,A8(H,{startingIndex:a,disabledIndices:O}));else if(U)if(a<=o)if(q&&a!==-1)b.current=H.current.length;else e.current=!1,b.current=N0;else b.current=A8(H,{startingIndex:a,decrement:!0,disabledIndices:O});else b.current=Math.max(o,A8(H,{startingIndex:a,decrement:!0,disabledIndices:O}));if(R7(H,b.current))b.current=-1;j(f)}}),J0=$8.useMemo(()=>{return L&&Q&&V0&&{"aria-activedescendant":`${I}-${Y}`}},[L,Q,V0,I,Y]),n=$8.useMemo(()=>{return{"aria-orientation":D==="both"?void 0:D,...!T?J0:{},onKeyDown(f){if(f.key==="Tab"&&f.shiftKey&&Q&&!L){let a=R5(f.nativeEvent);if(a&&!m0(k.current,a))return;if(i1(f),J.setOpen(!1,D0(K0.focusOut,f.nativeEvent)),L1(z))z.focus();return}Z0(f)},onPointerMove(){u.current=!0}}},[J0,Z0,k,D,T,J,Q,L,z]),m=$8.useMemo(()=>{function f(o){if(V==="auto"&&Nz(o.nativeEvent))R.current=!L}function a(o){if(R.current=V,V==="auto"&&Vz(o.nativeEvent))R.current=!0}return{onKeyDown(o){let N0=J.select("open");u.current=!1;let j0=o.key.startsWith("Arrow"),h0=xd(o.key,$0(),N),u0=dz(o.key,D),p=(F?h0:u0)||o.key==="Enter"||o.key.trim()==="";if(L&&N0)return Z0(o);if(!N0&&!_&&j0)return;if(p){let r=dz(o.key,$0());g.current=F&&r?null:o.key}if(F){if(h0)if(i1(o),N0)b.current=Az(H,l.current),j(o);else J.setOpen(!0,D0(K0.listNavigation,o.nativeEvent,o.currentTarget));return}if(u0){if(B0.current!=null)b.current=B0.current;if(i1(o),!N0&&_)J.setOpen(!0,D0(K0.listNavigation,o.nativeEvent,o.currentTarget));else Z0(o);if(N0)j(o)}return},onFocus(o){if(J.select("open")&&!L)b.current=-1,j(o)},onPointerDown:a,onPointerEnter:a,onMouseDown:f,onClick:f}},[Z0,l,V,H,F,j,J,_,D,$0,N,B0,L]),c=$8.useMemo(()=>{return{...J0,...m}},[J0,m]);return $8.useMemo(()=>W?{reference:c,floating:n,item:i,trigger:m}:{},[W,c,n,m,i])}var t9=P(v(),1);var gd=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function D3($,Z={}){let J="rootStore"in $?$.rootStore:$,Q=J.useState("open"),X=J.useState("floatingId"),z=J.useState("domReferenceElement"),G=J.useState("floatingElement"),{role:H="dialog"}=Z,Y=Y8(),K=z?.id||Y,W=t9.useMemo(()=>Y3(G)?.id||X,[G,X]),B=gd.get(H)??H,U=s1()!=null,F=t9.useMemo(()=>{if(B==="tooltip"||H==="label")return E5;return{"aria-haspopup":B==="alertdialog"?"dialog":B,"aria-expanded":"false",...B==="listbox"&&{role:"combobox"},...B==="menu"&&U&&{role:"menuitem"},...H==="select"&&{"aria-autocomplete":"none"},...H==="combobox"&&{"aria-autocomplete":"list"}}},[B,U,H]),N=t9.useMemo(()=>{if(B==="tooltip"||H==="label")return{[`aria-${H==="label"?"labelledby":"describedby"}`]:Q?W:void 0};return{...F,"aria-expanded":Q?"true":"false","aria-controls":Q?W:void 0,...B==="menu"&&{id:K}}},[B,W,Q,K,H,F]),L=t9.useMemo(()=>{let M={id:W,...B&&{role:B}};if(B==="tooltip"||H==="label")return M;return{...M,...B==="menu"&&{"aria-labelledby":K}}},[B,W,K,H]),V=t9.useCallback(({active:M,selected:_})=>{let O={role:"option",...M&&{id:`${W}-fui-option`}};switch(H){case"select":case"combobox":return{...O,"aria-selected":_};default:}return{}},[W,H]);return t9.useMemo(()=>({reference:N,floating:L,item:V,trigger:F}),[N,L,F,V])}var e9=P(v(),1);function Vq($,Z){let J="rootStore"in $?$.rootStore:$,Q=J.context.dataRef,X=J.useState("open"),{listRef:z,activeIndex:G,onMatch:H,onTypingChange:Y,enabled:K=!0,resetMs:W=750,selectedIndex:B=null}=Z,q=V1(),U=e9.useRef(""),F=e9.useRef(B??G??-1),N=e9.useRef(null);q0(()=>{if(!X&&B!==null)return;if(q.clear(),N.current=null,U.current!=="")U.current=""},[X,B,q]),q0(()=>{if(X&&U.current==="")F.current=B??G??-1},[X,B,G]);let L=U0((D)=>{if(D){if(!Q.current.typing)Q.current.typing=D,Y?.(D)}else if(Q.current.typing)Q.current.typing=D,Y?.(D)}),V=U0((D)=>{function A(k,S,w){let T=S.find((R)=>R?.toLocaleLowerCase().indexOf(w.toLocaleLowerCase())===0);return T?k.indexOf(T):-1}let E=z.current;if(U.current.length>0&&U.current[0]!==" "){if(A(E,E,U.current)===-1)L(!1);else if(D.key===" ")i1(D)}if(E==null||D.key.length!==1||D.ctrlKey||D.metaKey||D.altKey)return;if(X&&D.key!==" ")i1(D),L(!0);let I=U.current==="";if(I)F.current=B??G??-1;if(E.every((k)=>k?k[0]?.toLocaleLowerCase()!==k[1]?.toLocaleLowerCase():!0)&&U.current===D.key)U.current="",F.current=N.current;U.current+=D.key,q.start(W,()=>{U.current="",F.current=N.current,L(!1)});let C=I?B??G??-1:F.current,h=A(E,[...E.slice((C||0)+1),...E.slice(0,(C||0)+1)],U.current);if(h!==-1)H?.(h),N.current=h;else if(D.key!==" ")U.current="",L(!1)}),M=U0((D)=>{let A=D.relatedTarget,E=J.select("domReferenceElement"),I=J.select("floatingElement"),y=m0(E,A),C=m0(I,A);if(y||C)return;q.clear(),U.current="",F.current=N.current,L(!1)}),_=e9.useMemo(()=>({onKeyDown:V,onBlur:M}),[V,M]),O=e9.useMemo(()=>{return{onKeyDown:V,onKeyUp(D){if(D.key===" ")L(!1)},onBlur:M}},[V,M,L]);return e9.useMemo(()=>K?{reference:_,floating:O}:{},[K,_,O])}function e_($,Z){let[J,Q]=$,X=!1,z=Z.length;for(let G=0,H=z-1;G<z;H=G++){let[Y,K]=Z[G]||[0,0],[W,B]=Z[H]||[0,0];if(K>=Q!==B>=Q&&J<=(W-Y)*(Q-K)/(B-K)+Y)X=!X}return X}function vd($,Z){return $[0]>=Z.x&&$[0]<=Z.x+Z.width&&$[1]>=Z.y&&$[1]<=Z.y+Z.height}function U2($={}){let{buffer:Z=0.5,blockPointerEvents:J=!1,requireIntent:Q=!0}=$,X=new l1,z=!1,G=null,H=null,Y=typeof performance<"u"?performance.now():0;function K(B,q){let U=performance.now(),F=U-Y;if(G===null||H===null||F===0)return G=B,H=q,Y=U,null;let N=B-G,L=q-H,M=Math.sqrt(N*N+L*L)/F;return G=B,H=q,Y=U,M}let W=({x:B,y:q,placement:U,elements:F,onClose:N,nodeId:L,tree:V})=>{return function(_){function O(){X.clear(),N()}if(X.clear(),!F.domReference||!F.floating||U==null||B==null||q==null)return;let{clientX:D,clientY:A}=_,E=[D,A],I=R5(_),y=_.type==="mouseleave",C=m0(F.floating,I),h=m0(F.domReference,I),k=F.domReference.getBoundingClientRect(),S=F.floating.getBoundingClientRect(),w=U.split("-")[0],T=B>S.right-S.width/2,R=q>S.bottom-S.height/2,b=vd(E,k),g=S.width>k.width,u=S.height>k.height,j=(g?k:S).left,t=(g?k:S).right,Q0=(u?k:S).top,x=(u?k:S).bottom;if(C){if(z=!0,!y)return}if(h)z=!1;if(h&&!y){z=!0;return}if(y&&_5(_.relatedTarget)&&m0(F.floating,_.relatedTarget))return;if(V&&b2(V.nodesRef.current,L).some(({context:l})=>l?.open))return;if(w==="top"&&q>=k.bottom-1||w==="bottom"&&q<=k.top+1||w==="left"&&B>=k.right-1||w==="right"&&B<=k.left+1)return O();let e=[];switch(w){case"top":e=[[j,k.top+1],[j,S.bottom-1],[t,S.bottom-1],[t,k.top+1]];break;case"bottom":e=[[j,S.top+1],[j,k.bottom-1],[t,k.bottom-1],[t,S.top+1]];break;case"left":e=[[S.right-1,x],[S.right-1,Q0],[k.left+1,Q0],[k.left+1,x]];break;case"right":e=[[k.right-1,x],[k.right-1,Q0],[S.left+1,Q0],[S.left+1,x]];break;default:}function M0([l,H0]){switch(w){case"top":{let B0=[g?l+Z/2:T?l+Z*4:l-Z*4,H0+Z+1],X0=[g?l-Z/2:T?l+Z*4:l-Z*4,H0+Z+1],Y0=[[S.left,T?S.bottom-Z:g?S.bottom-Z:S.top],[S.right,T?g?S.bottom-Z:S.top:S.bottom-Z]];return[B0,X0,...Y0]}case"bottom":{let B0=[g?l+Z/2:T?l+Z*4:l-Z*4,H0-Z],X0=[g?l-Z/2:T?l+Z*4:l-Z*4,H0-Z],Y0=[[S.left,T?S.top+Z:g?S.top+Z:S.bottom],[S.right,T?g?S.top+Z:S.bottom:S.top+Z]];return[B0,X0,...Y0]}case"left":{let B0=[l+Z+1,u?H0+Z/2:R?H0+Z*4:H0-Z*4],X0=[l+Z+1,u?H0-Z/2:R?H0+Z*4:H0-Z*4];return[...[[R?S.right-Z:u?S.right-Z:S.left,S.top],[R?u?S.right-Z:S.left:S.right-Z,S.bottom]],B0,X0]}case"right":{let B0=[l-Z,u?H0+Z/2:R?H0+Z*4:H0-Z*4],X0=[l-Z,u?H0-Z/2:R?H0+Z*4:H0-Z*4],Y0=[[R?S.left+Z:u?S.left+Z:S.right,S.top],[R?u?S.left+Z:S.right:S.left+Z,S.bottom]];return[B0,X0,...Y0]}default:return[]}}if(e_([D,A],e))return;if(z&&!b)return O();if(!y&&Q){let l=K(_.clientX,_.clientY),H0=0.1;if(l!==null&&l<0.1)return O()}if(!e_([D,A],M0([B,q])))O();else if(!z&&Q)X.start(40,O);return}};return W.__options={blockPointerEvents:J},W}var ZD=P(d(),1),p7=rz.forwardRef(function(Z,J){let{children:Q,container:X,className:z,render:G,...H}=Z,{portalNode:Y,portalSubtree:K}=fz({container:X,ref:J,componentProps:Z,elementProps:H});if(!K&&!Y)return null;return ZD.jsxs(rz.Fragment,{children:[K,Y&&$D.createPortal(Q,Y)]})});var JD=p7;var $6=P(v(),1);var P4=P(v(),1);var az=P(v(),1),fd=az.createContext(void 0);function u4(){return az.useContext(fd)?.direction??"ltr"}var md=($)=>({name:"arrow",options:$,async fn(Z){let{x:J,y:Q,placement:X,rects:z,platform:G,elements:H,middlewareData:Y}=Z,{element:K,padding:W=0,offsetParent:B="real"}=XD($,Z)||{};if(K==null)return{};let q=HD(W),U={x:J,y:Q},F=GD(X),N=zD(F),L=await G.getDimensions(K),V=F==="y",M=V?"top":"left",_=V?"bottom":"right",O=V?"clientHeight":"clientWidth",D=z.reference[N]+z.reference[F]-U[F]-z.floating[N],A=U[F]-z.reference[F],E=B==="real"?await G.getOffsetParent?.(K):H.floating,I=H.floating[O]||z.floating[N];if(!I||!await G.isElement?.(E))I=H.floating[O]||z.floating[N];let y=D/2-A/2,C=I/2-L[N]/2-1,h=Math.min(q[M],C),k=Math.min(q[_],C),S=h,w=I-L[N]-k,T=I/2-L[N]/2+y,R=QD(S,T,w),b=!Y.arrow&&UJ(X)!=null&&T!==R&&z.reference[N]/2-(T<S?h:k)-L[N]/2<0,g=b?T<S?T-S:T-w:0;return{[F]:U[F]+g,data:{[F]:R,centerOffset:T-R-g,...b&&{alignmentOffset:g}},reset:b}}}),YD=($,Z)=>({...md($),options:[$,Z]});var KD={name:"hide",async fn($){let{width:Z,height:J,x:Q,y:X}=$.rects.reference,z=Z===0&&J===0&&Q===0&&X===0;return{data:{referenceHidden:(await Oq().fn($)).data?.referenceHidden||z}}}};var FJ={sideX:"left",sideY:"top"},u7={name:"adaptiveOrigin",async fn($){let{x:Z,y:J,rects:{floating:Q},elements:{floating:X},platform:z,strategy:G,placement:H}=$,Y=C8(X),K=Y.getComputedStyle(X);if(!(K.transitionDuration!=="0s"&&K.transitionDuration!==""))return{x:Z,y:J,data:FJ};let B=await z.getOffsetParent?.(X),q={width:0,height:0};if(G==="fixed"&&Y?.visualViewport)q={width:Y.visualViewport.width,height:Y.visualViewport.height};else if(B===Y){let M=p0(X);q={width:M.documentElement.clientWidth,height:M.documentElement.clientHeight}}else if(await z.isElement?.(B))q=await z.getDimensions(B);let U=O3(H),F=Z,N=J;if(U==="left")F=q.width-(Z+Q.width);if(U==="top")N=q.height-(J+Q.height);let L=U==="left"?"right":FJ.sideX,V=U==="top"?"bottom":FJ.sideY;return{x:F,y:N,data:{sideX:L,sideY:V}}}};function qD($,Z,J){let Q=$==="inline-start"||$==="inline-end";return{top:"top",right:Q?J?"inline-start":"inline-end":"right",bottom:"bottom",left:Q?J?"inline-end":"inline-start":"left"}[Z]}function WD($,Z,J){let{rects:Q,placement:X}=$;return{side:qD(Z,O3(X),J),align:UJ(X)||"center",anchor:{width:Q.reference.width,height:Q.reference.height},positioner:{width:Q.floating.width,height:Q.floating.height}}}function i2($){let{anchor:Z,positionMethod:J="absolute",side:Q="bottom",sideOffset:X=0,align:z="center",alignOffset:G=0,collisionBoundary:H,collisionPadding:Y=5,sticky:K=!1,arrowPadding:W=5,disableAnchorTracking:B=!1,keepMounted:q=!1,floatingRootContext:U,mounted:F,collisionAvoidance:N,shiftCrossAxis:L=!1,nodeId:V,adaptiveOrigin:M,lazyFlip:_=!1,externalTree:O}=$,[D,A]=P4.useState(null);if(!F&&D!==null)A(null);let E=N.side||"flip",I=N.align||"flip",y=N.fallbackAxisSide||"end",C=typeof Z==="function"?Z:void 0,h=U0(C),k=C?h:Z,S=w1(Z),T=u4()==="rtl",R=D||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":T?"left":"right","inline-start":T?"right":"left"}[Q],b=z==="center"?R:`${R}-${z}`,g=Y,u=1,j=Q==="bottom"?u:0,t=Q==="top"?u:0,Q0=Q==="right"?u:0,x=Q==="left"?u:0;if(typeof g==="number")g={top:g+j,right:g+x,bottom:g+t,left:g+Q0};else if(g)g={top:(g.top||0)+j,right:(g.right||0)+x,bottom:(g.bottom||0)+t,left:(g.left||0)+Q0};let e={boundary:H==="clipping-ancestors"?"clippingAncestors":H,padding:g},M0=P4.useRef(null),l=w1(X),H0=w1(G),Y0=[Lq((A0)=>{let v0=WD(A0,Q,T),D5=typeof l.current==="function"?l.current(v0):l.current,K5=typeof H0.current==="function"?H0.current(v0):H0.current;return{mainAxis:D5,crossAxis:K5,alignmentAxis:K5}},[typeof X!=="function"?X:0,typeof G!=="function"?G:0,T,Q])],V0=I==="none"&&E!=="shift",i=!V0&&(K||L||E==="shift"),$0=E==="none"?null:_q({...e,padding:{top:g.top+u,right:g.right+u,bottom:g.bottom+u,left:g.left+u},mainAxis:!L&&E==="flip",crossAxis:I==="flip"?"alignment":!1,fallbackAxisSideDirection:y}),Z0=V0?null:Mq((A0)=>{let v0=p0(A0.elements.floating).documentElement;return{...e,rootBoundary:L?{x:0,y:0,width:v0.clientWidth,height:v0.clientHeight}:void 0,mainAxis:I!=="none",crossAxis:i,limiter:K||L?void 0:Aq((D5)=>{if(!M0.current)return{};let{width:K5,height:d5}=M0.current.getBoundingClientRect(),I0=Pq(O3(D5.placement)),T0=I0==="y"?K5:d5,f0=I0==="y"?g.left+g.right:g.top+g.bottom;return{offset:T0/2+f0/2}})}},[e,K,L,g,I]);if(E==="shift"||I==="shift"||z==="center")Y0.push(Z0,$0);else Y0.push($0,Z0);Y0.push(Dq({...e,apply({elements:{floating:A0},rects:{reference:v0},availableWidth:D5,availableHeight:K5}){let d5=A0.style;d5.setProperty("--available-width",`${D5}px`),d5.setProperty("--available-height",`${K5}px`),d5.setProperty("--anchor-width",`${v0.width}px`),d5.setProperty("--anchor-height",`${v0.height}px`)}}),YD(()=>({element:M0.current||document.createElement("div"),padding:W,offsetParent:"floating"}),[W]),{name:"transformOrigin",fn(A0){let{elements:v0,middlewareData:D5,placement:K5,rects:d5,y:I0}=A0,T0=O3(K5),f0=Pq(T0),$5=M0.current,H5=D5.arrow?.x||0,S5=D5.arrow?.y||0,l5=$5?.clientWidth||0,i5=$5?.clientHeight||0,F5=H5+l5/2,U1=S5+i5/2,v1=Math.abs(D5.shift?.y||0),d1=d5.reference.height/2,x0=typeof X==="function"?X(WD(A0,Q,T)):X,J5=v1>x0,c0={top:`${F5}px calc(100% + ${x0}px)`,bottom:`${F5}px ${-x0}px`,left:`calc(100% + ${x0}px) ${U1}px`,right:`${-x0}px ${U1}px`}[T0],W5=`${F5}px ${d5.reference.y+d1-I0}px`;return v0.floating.style.setProperty("--transform-origin",i&&f0==="y"&&J5?W5:c0),{}}},KD,M),q0(()=>{if(!F&&U)U.update({referenceElement:null,floatingElement:null,domReferenceElement:null})},[F,U]);let J0=P4.useMemo(()=>({elementResize:!B&&typeof ResizeObserver<"u",layoutShift:!B&&typeof IntersectionObserver<"u"}),[B]),{refs:n,elements:m,x:c,y:f,middlewareData:a,update:o,placement:N0,context:j0,isPositioned:h0,floatingStyles:u0}=Wq({rootContext:U,placement:b,middleware:Y0,strategy:J,whileElementsMounted:q?void 0:(...A0)=>iz(...A0,J0),nodeId:V,externalTree:O}),{sideX:p,sideY:r}=a.adaptiveOrigin||FJ,z0=h0?J:"fixed",L0=P4.useMemo(()=>{let A0=M?{position:z0,[p]:c,[r]:f}:{position:z0,...u0};if(!h0)A0.opacity=0;return A0},[M,z0,p,c,r,f,u0,h0]),P0=P4.useRef(null);q0(()=>{if(!F)return;let A0=S.current,v0=typeof A0==="function"?A0():A0,K5=(BD(v0)?v0.current:v0)||null||null;if(K5!==P0.current)n.setPositionReference(K5),P0.current=K5},[F,n,k,S]),P4.useEffect(()=>{if(!F)return;let A0=S.current;if(typeof A0==="function")return;if(BD(A0)&&A0.current!==P0.current)n.setPositionReference(A0.current),P0.current=A0.current},[F,n,k,S]),P4.useEffect(()=>{if(q&&F&&m.domReference&&m.floating)return iz(m.domReference,m.floating,o,J0);return},[q,F,m,o,J0]);let g0=O3(N0),e0=qD(Q,g0,T),U5=UJ(N0)||"center",d0=Boolean(a.hide?.referenceHidden);q0(()=>{if(_&&F&&h0)A(g0)},[_,F,h0,g0]);let R0=P4.useMemo(()=>({position:"absolute",top:a.arrow?.y,left:a.arrow?.x}),[a.arrow]),G0=a.arrow?.centerOffset!==0;return P4.useMemo(()=>({positionerStyles:L0,arrowStyles:R0,arrowRef:M0,arrowUncentered:G0,side:e0,align:U5,physicalSide:g0,anchorHidden:d0,refs:n,context:j0,isPositioned:h0,update:o}),[L0,R0,M0,G0,e0,U5,g0,d0,n,j0,h0,o])}function BD($){return $!=null&&"current"in $}var w4=function($){return $.open="data-open",$.closed="data-closed",$[$.startingStyle=g2.startingStyle]="startingStyle",$[$.endingStyle=g2.endingStyle]="endingStyle",$.anchorHidden="data-anchor-hidden",$.side="data-side",$.align="data-align",$}({}),NJ=function($){return $.popupOpen="data-popup-open",$.pressed="data-pressed",$}({}),pd={[NJ.popupOpen]:""},ud={[NJ.popupOpen]:"",[NJ.pressed]:""},cd={[w4.open]:""},dd={[w4.closed]:""},ld={[w4.anchorHidden]:""},r2={open($){if($)return pd;return null}},VJ={open($){if($)return ud;return null}},N5={open($){if($)return cd;return dd},anchorHidden($){if($)return ld;return null}};function K8($){return $==="starting"?UD:E5}var nz=P(v(),1),wq=nz.createContext(void 0);function FD(){let $=nz.useContext(wq);if($===void 0)throw Error(C0(84));return $}var ND=P(d(),1),VD=$6.forwardRef(function(Z,J){let{toast:Q,...X}=Z,z=d9(),G=Q.positionerProps??E5,{render:H,className:Y,anchor:K=G.anchor,positionMethod:W=G.positionMethod??"absolute",side:B=G.side??"top",align:q=G.align??"center",sideOffset:U=G.sideOffset??0,alignOffset:F=G.alignOffset??0,collisionBoundary:N=G.collisionBoundary??"clipping-ancestors",collisionPadding:L=G.collisionPadding??5,arrowPadding:V=G.arrowPadding??5,sticky:M=G.sticky??!1,disableAnchorTracking:_=G.disableAnchorTracking??!1,collisionAvoidance:O=G.collisionAvoidance??a2,...D}=X,[A,E]=$6.useState(null),I=z.useState("toastIndex",Q.id),y=z.useState("toastVisibleIndex",Q.id),C=_5(K)?K:null,h=BJ({open:!0,onOpenChange:f5,elements:{floating:A,reference:C}}),k=i2({anchor:C,positionMethod:W,floatingRootContext:h,mounted:!0,side:B,sideOffset:U,align:q,alignOffset:F,collisionBoundary:N,collisionPadding:L,sticky:M,arrowPadding:V,disableAnchorTracking:_,keepMounted:!0,collisionAvoidance:O}),S=$6.useMemo(()=>{let b={};return{role:"presentation",style:{...k.positionerStyles,...b,[f2.index]:Q.transitionStatus==="ending"?I:y}}},[k.positionerStyles,Q.transitionStatus,I,y]),w=$6.useMemo(()=>({side:k.side,align:k.align,anchorHidden:k.anchorHidden}),[k.side,k.align,k.anchorHidden]),T=$6.useMemo(()=>({...w,arrowRef:k.arrowRef,arrowStyles:k.arrowStyles,arrowUncentered:k.arrowUncentered}),[w,k.arrowRef,k.arrowStyles,k.arrowUncentered]),R=W0("div",Z,{state:w,props:[S,K8(Q.transitionStatus),D],ref:[J,E],stateAttributesMapping:N5});return ND.jsx(wq.Provider,{value:T,children:R})});var LD=P(v(),1);var MD=LD.forwardRef(function(Z,J){let{className:Q,render:X,...z}=Z,{arrowRef:G,side:H,align:Y,arrowUncentered:K,arrowStyles:W}=FD();return W0("div",Z,{state:{side:H,align:Y,uncentered:K},ref:[J,G],props:[{style:W,"aria-hidden":!0},z]})});var oz=P(v(),1);function AD(){let $=oz.useContext(oZ);if(!$)throw Error(C0(73));let Z=$.useState("toasts");return oz.useMemo(()=>({toasts:Z,add:$.addToast,close:$.closeToast,update:$.updateToast,promise:$.promiseToast}),[Z,$])}function _D(){let $=new Set;function Z(J){$.forEach((Q)=>Q(J))}return{" subscribe":function(Q){return $.add(Q),()=>{$.delete(Q)}},add(J){let Q=J.id||Hz("toast"),X={...J,id:Q,transitionStatus:"starting"};return Z({action:"add",options:X}),Q},close(J){Z({action:"close",options:{id:J}})},update(J,Q){Z({action:"update",options:{...Q,id:J}})},promise(J,Q){let X=J;return Z({action:"promise",options:{...Q,promise:J,setPromise(z){X=z}}}),X}}}var y5=P(d(),1),c4=I8.createToastManager();function id({...$}){return y5.jsx(I8.Provider,{...$})}function rd({...$}){return y5.jsx(I8.Portal,{"data-slot":"toast-portal",...$})}function ad({className:$,...Z}){return y5.jsx(I8.Viewport,{"data-slot":"toast-viewport",className:s("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 nd({className:$,...Z}){return y5.jsx(I8.Root,{"data-slot":"toast",className:s("group/toast pointer-events-auto absolute right-0 bottom-0 z-[calc(1000-var(--toast-index))] w-full origin-bottom rounded-2xl border 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 od({className:$,...Z}){return y5.jsx(I8.Content,{"data-slot":"toast-content",className:s("flex h-full 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 sd({className:$,...Z}){return y5.jsx(I8.Title,{"data-slot":"toast-title",className:s("text-sm font-medium",$),...Z})}function td({className:$,...Z}){return y5.jsx(I8.Description,{"data-slot":"toast-description",className:s("text-sm text-muted-foreground",$),...Z})}function ed({className:$,render:Z=y5.jsx(k0,{variant:"outline",size:"sm"}),...J}){return y5.jsx(I8.Action,{"data-slot":"toast-action",render:Z,className:s("shrink-0",$),...J})}function $l({className:$,children:Z,render:J=y5.jsx(k0,{variant:"ghost",size:"icon-sm"}),...Q}){return y5.jsx(I8.Close,{"data-slot":"toast-close","aria-label":"Close toast",render:J,className:s("relative shrink-0 text-muted-foreground after:absolute after:-inset-2 after:content-[''] hover:text-foreground",$),...Q,children:Z??y5.jsx(m1,{"aria-hidden":"true",stroke:1.75})})}function Zl({type:$}){let Z=null;if($==="success")Z=y5.jsx(OD,{"aria-hidden":"true",stroke:1.75});if($==="info")Z=y5.jsx(PD,{"aria-hidden":"true",stroke:1.75});if($==="warning")Z=y5.jsx(sz,{"aria-hidden":"true",stroke:1.75});if($==="error")Z=y5.jsx(DD,{className:"text-destructive","aria-hidden":"true",stroke:1.75});if($==="loading")Z=y5.jsx(wD,{className:"animate-spin","aria-hidden":"true",stroke:1.75});if(!Z)return null;return y5.jsx("span",{"data-slot":"toast-icon",className:"shrink-0 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4",children:Z})}function Jl(){let{toasts:$}=I8.useToastManager();return $.map((Z)=>y5.jsx(nd,{toast:Z,children:y5.jsxs(od,{children:[y5.jsx(Zl,{type:Z.type}),y5.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[y5.jsx(sd,{}),y5.jsx(td,{})]}),y5.jsx(ed,{}),y5.jsx($l,{})]})},Z.id))}function jD({children:$,toastManager:Z=c4,...J}){return y5.jsxs(id,{toastManager:Z,...J,children:[$,y5.jsx(rd,{children:y5.jsx(ad,{children:y5.jsx(Jl,{})})})]})}var gq0=I8.createToastManager,vq0=I8.useToastManager;var T9={};_4(T9,{createHandle:()=>$O,Viewport:()=>eD,Trigger:()=>xD,Root:()=>kD,Provider:()=>lD,Positioner:()=>mD,Portal:()=>vD,Popup:()=>uD,Handle:()=>XG,Arrow:()=>dD});var o2=P(v(),1);var TD=P(v(),1);function n2($){let Z=TD.useRef(!0);if(Z.current)Z.current=!1,$()}var tz=P(v(),1),jq=tz.createContext(void 0);function d4($){let Z=tz.useContext(jq);if(Z===void 0&&!$)throw Error(C0(72));return Z}var CD=P(v(),1),ED=P(G4(),1);var Ql={...d2,disabled:E0(($)=>$.disabled),instantType:E0(($)=>$.instantType),isInstantPhase:E0(($)=>$.isInstantPhase),trackCursorAxis:E0(($)=>$.trackCursorAxis),disableHoverablePopup:E0(($)=>$.disableHoverablePopup),lastOpenChangeReason:E0(($)=>$.openChangeReason),closeDelay:E0(($)=>$.closeDelay),hasViewport:E0(($)=>$.hasViewport)};class c7 extends l8{constructor($){super({...Xl(),...$},{popupRef:CD.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:new r8},Ql)}setOpen=($,Z)=>{let J=Z.reason,Q=J===K0.triggerHover,X=$&&J===K0.triggerFocus,z=!$&&(J===K0.triggerPress||J===K0.escapeKey);if(Z.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},this.context.onOpenChange?.($,Z),Z.isCanceled)return;let G=()=>{let H={open:$,openChangeReason:J};if(X)H.instantType="focus";else if(z)H.instantType="dismiss";else if(J===K0.triggerHover)H.instantType=void 0;let Y=Z.trigger?.id??null;if(Y||$)H.activeTriggerId=Y,H.activeTriggerElement=Z.trigger??null;this.update(H)};if(Q)ED.flushSync(G);else G()};static useStore($,Z){let J=T5(()=>{return new c7(Z)}).current,Q=$??J,X=B2({popupStore:Q,onOpenChange:Q.setOpen});return Q.state.floatingRootContext=X,Q}}function Xl(){return{...c2(),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:"none",disableHoverablePopup:!1,openChangeReason:null,closeDelay:0,hasViewport:!1}}var SD=P(d(),1),kD=tZ(function(Z){let{disabled:J=!1,defaultOpen:Q=!1,open:X,disableHoverablePopup:z=!1,trackCursorAxis:G="none",actionsRef:H,onOpenChange:Y,onOpenChangeComplete:K,handle:W,triggerId:B,defaultTriggerId:q=null,children:U}=Z,F=c7.useStore(W?.store,{open:Q,openProp:X,activeTriggerId:q,triggerIdProp:B});n2(()=>{if(X===void 0&&F.state.open===!1&&Q===!0)F.update({open:!0,activeTriggerId:q})}),F.useControlledProp("openProp",X),F.useControlledProp("triggerIdProp",B),F.useContextCallback("onOpenChange",Y),F.useContextCallback("onOpenChangeComplete",K);let N=F.useState("open"),L=!J&&N,V=F.useState("activeTriggerId"),M=F.useState("payload");F.useSyncedValues({trackCursorAxis:G,disableHoverablePopup:z}),q0(()=>{if(N&&J)F.setOpen(!1,D0(K0.disabled))},[N,J,F]),F.useSyncedValue("disabled",J),p2(F);let{forceUnmount:_,transitionStatus:O}=u2(L,F),D=F.useState("isInstantPhase"),A=F.useState("instantType"),E=F.useState("lastOpenChangeReason"),I=o2.useRef(null);q0(()=>{if(O==="ending"&&E===K0.none||O!=="ending"&&D){if(A!=="delay")I.current=A;F.set("instantType","delay")}else if(I.current!==null)F.set("instantType",I.current),I.current=null},[O,D,E,A,F]),q0(()=>{if(L){if(V==null)F.set("payload",void 0)}},[F,V,L]);let y=o2.useCallback(()=>{F.setOpen(!1,zl(F,K0.imperativeAction))},[F]);o2.useImperativeHandle(H,()=>({unmount:_,close:y}),[_,y]);let C=F.useState("floatingRootContext"),h=W2(C,{enabled:!J,referencePress:!0}),k=Yq(C,{enabled:!J&&G!=="none",axis:G==="none"?void 0:G}),{getReferenceProps:S,getFloatingProps:w,getTriggerProps:T}=e1([h,k]),R=o2.useMemo(()=>S(),[S]),b=o2.useMemo(()=>T(),[T]),g=o2.useMemo(()=>w(),[w]);return F.useSyncedValues({activeTriggerProps:R,inactiveTriggerProps:b,popupProps:g}),SD.jsx(jq.Provider,{value:F,children:typeof U==="function"?U({payload:M}):U})});function zl($,Z){let J=D0(Z);return J.preventUnmountOnClose=()=>{$.set("preventUnmountingOnClose",!0)},J}var bD=P(v(),1);function s0($){return Y8($,"base-ui")}var ez=P(v(),1),Tq=ez.createContext(void 0);function ID(){return ez.useContext(Tq)}var RD=function($){return $[$.popupOpen=NJ.popupOpen]="popupOpen",$.triggerDisabled="data-trigger-disabled",$}({});var yD=600;var xD=Jz(function(Z,J){let{className:Q,render:X,handle:z,payload:G,disabled:H,delay:Y,closeDelay:K,id:W,...B}=Z,q=d4(!0),U=z?.store??q;if(!U)throw Error(C0(82));let F=s0(W),N=U.useState("isTriggerActive",F),L=U.useState("isOpenedByTrigger",F),V=U.useState("floatingRootContext"),M=bD.useRef(null),_=Y??yD,O=K??0,{registerTrigger:D,isMountedByThisTrigger:A}=m2(F,M,U,{payload:G,closeDelay:O}),E=ID(),{delayRef:I,isInstantPhase:y,hasProvider:C}=Jq(V,{open:L});U.useSyncedValue("isInstantPhase",y);let h=U.useState("disabled"),k=H??h,S=U.useState("trackCursorAxis"),w=U.useState("disableHoverablePopup"),T=q2(V,{enabled:!k,mouseOnly:!0,move:!1,handleClose:!w&&S!=="both"?U2():null,restMs(){let j=E?.delay,t=typeof I.current==="object"?I.current.open:void 0,Q0=_;if(C)if(t!==0)Q0=Y??j??_;else Q0=0;return Q0},delay(){let j=typeof I.current==="object"?I.current.close:void 0,t=O;if(K==null&&C)t=j;return{close:t}},triggerElementRef:M,isActiveTrigger:N}),R=M3(V,{enabled:!k}).reference,b={open:L},g=U.useState("triggerProps",A);return W0("button",Z,{state:b,ref:[J,D,M],props:[T,R,g,{id:F,[RD.triggerDisabled]:k?"":void 0},B],stateAttributesMapping:r2})});var gD=P(v(),1);var $G=P(v(),1),Cq=$G.createContext(void 0);function hD(){let $=$G.useContext(Cq);if($===void 0)throw Error(C0(70));return $}var Eq=P(d(),1),vD=gD.forwardRef(function(Z,J){let{keepMounted:Q=!1,...X}=Z;if(!(d4().useState("mounted")||Q))return null;return Eq.jsx(Cq.Provider,{value:Q,children:Eq.jsx(p7,{ref:J,...X})})});var l7=P(v(),1);var ZG=P(v(),1),Sq=ZG.createContext(void 0);function d7(){let $=ZG.useContext(Sq);if($===void 0)throw Error(C0(71));return $}var fD=P(d(),1),mD=l7.forwardRef(function(Z,J){let{render:Q,className:X,anchor:z,positionMethod:G="absolute",side:H="top",align:Y="center",sideOffset:K=0,alignOffset:W=0,collisionBoundary:B="clipping-ancestors",collisionPadding:q=5,arrowPadding:U=5,sticky:F=!1,disableAnchorTracking:N=!1,collisionAvoidance:L=a2,...V}=Z,M=d4(),_=hD(),O=M.useState("open"),D=M.useState("mounted"),A=M.useState("trackCursorAxis"),E=M.useState("disableHoverablePopup"),I=M.useState("floatingRootContext"),y=M.useState("instantType"),C=M.useState("transitionStatus"),h=M.useState("hasViewport"),k=i2({anchor:z,positionMethod:G,floatingRootContext:I,mounted:D,side:H,sideOffset:K,align:Y,alignOffset:W,collisionBoundary:B,collisionPadding:q,sticky:F,arrowPadding:U,disableAnchorTracking:N,keepMounted:_,collisionAvoidance:L,adaptiveOrigin:h?u7:void 0}),S=l7.useMemo(()=>{let b={};if(!O||A==="both"||E)b.pointerEvents="none";return{role:"presentation",hidden:!D,style:{...k.positionerStyles,...b}}},[O,A,E,D,k.positionerStyles]),w=l7.useMemo(()=>({open:O,side:k.side,align:k.align,anchorHidden:k.anchorHidden,instant:A!=="none"?"tracking-cursor":y}),[O,k.side,k.align,k.anchorHidden,A,y]),T=l7.useMemo(()=>({...w,arrowRef:k.arrowRef,arrowStyles:k.arrowStyles,arrowUncentered:k.arrowUncentered}),[w,k.arrowRef,k.arrowStyles,k.arrowUncentered]),R=W0("div",Z,{state:w,props:[S,K8(C),V],ref:[J,M.useStateSetter("positionerElement")],stateAttributesMapping:N5});return fD.jsx(Sq.Provider,{value:T,children:R})});var pD=P(v(),1);var Gl={...N5,...m5},uD=pD.forwardRef(function(Z,J){let{className:Q,render:X,...z}=Z,G=d4(),{side:H,align:Y}=d7(),K=G.useState("open"),W=G.useState("instantType"),B=G.useState("transitionStatus"),q=G.useState("popupProps"),U=G.useState("floatingRootContext");I1({open:K,ref:G.context.popupRef,onComplete(){if(K)G.context.onOpenChangeComplete?.(!0)}});let F=G.useState("disabled"),N=G.useState("closeDelay");return j9(U,{enabled:!F,closeDelay:N}),W0("div",Z,{state:{open:K,side:H,align:Y,instant:W,transitionStatus:B},ref:[J,G.context.popupRef,G.useStateSetter("popupElement")],props:[q,K8(B),z],stateAttributesMapping:Gl})});var cD=P(v(),1);var dD=cD.forwardRef(function(Z,J){let{className:Q,render:X,...z}=Z,H=d4().useState("instantType"),{open:Y,arrowRef:K,side:W,align:B,arrowUncentered:q,arrowStyles:U}=d7();return W0("div",Z,{state:{open:Y,side:W,align:B,uncentered:q,instant:H},ref:[J,K],props:[{style:U,"aria-hidden":!0},z],stateAttributesMapping:N5})});var kq=P(v(),1);var Iq=P(d(),1),lD=function(Z){let{delay:J,closeDelay:Q,timeout:X=400}=Z,z=kq.useMemo(()=>({delay:J,closeDelay:Q}),[J,Q]),G=kq.useMemo(()=>({open:J,close:Q}),[J,Q]);return Iq.jsx(Tq.Provider,{value:z,children:Iq.jsx(Zq,{delay:G,timeoutMs:X,children:Z.children})})};var tD=P(v(),1);var iD=function($){return $.popupWidth="--popup-width",$.popupHeight="--popup-height",$}({});var R8=P(v(),1);var rD=P(v(),1);function aD($){let[Z,J]=rD.useState({current:$,previous:null});if($!==Z.current)J({current:$,previous:Z.current});return Z.previous}var P3=P(v(),1);function yq($){let Z=g7($),J=parseFloat(Z.width)||0,Q=parseFloat(Z.height)||0,X=L1($),z=X?$.offsetWidth:J,G=X?$.offsetHeight:Q;if(Rq(J)!==z||Rq(Q)!==G)J=z,Q=G;return{width:J,height:Q}}var Hl=typeof ResizeObserver<"u",Yl=()=>!0;function oD($){let{popupElement:Z,positionerElement:J,content:Q,mounted:X,enabled:z=Yl,onMeasureLayout:G,onMeasureLayoutComplete:H,side:Y,direction:K}=$,W=v2(Z,!0,!1),B=z4(),q=P3.useRef(null),U=P3.useRef(null),F=P3.useRef(!0),N=P3.useRef(f5),L=U0(G),V=U0(H),M=P3.useMemo(()=>{let _=Y==="top",O=Y==="left";if(K==="rtl")_=_||Y==="inline-end",O=O||Y==="inline-end";else _=_||Y==="inline-start",O=O||Y==="inline-start";return _?{position:"absolute",[Y==="top"?"bottom":"top"]:"0",[O?"right":"left"]:"0"}:E5},[Y,K]);q0(()=>{if(!X||!z()||!Hl){N.current=f5,F.current=!0,q.current=null,U.current=null;return}if(!Z||!J)return;N.current=nD(Z,M);let _=new ResizeObserver((S)=>{let w=S[0];if(w)U.current={width:Math.ceil(w.borderBoxSize[0].inlineSize),height:Math.ceil(w.borderBoxSize[0].blockSize)}});_.observe(Z),JG(Z,"auto");let O=QG(Z,"position","static"),D=QG(Z,"transform","none"),A=QG(Z,"scale","1"),E=nD(J,{"--available-width":"max-content","--available-height":"max-content"});function I(){O(),D(),E()}function y(){I(),A()}if(L?.(),F.current||q.current===null){LJ(J,"max-content");let S=yq(Z);return q.current=S,LJ(J,S),y(),V?.(null,S),F.current=!1,()=>{_.disconnect(),N.current(),N.current=f5}}JG(Z,"auto"),LJ(J,"max-content");let C=q.current??U.current,h=yq(Z);if(q.current=h,!C)return LJ(J,h),y(),V?.(null,h),()=>{_.disconnect(),B.cancel(),N.current(),N.current=f5};JG(Z,C),y(),V?.(C,h),LJ(J,h);let k=new AbortController;return B.request(()=>{JG(Z,h),W(()=>{Z.style.setProperty("--popup-width","auto"),Z.style.setProperty("--popup-height","auto")},k.signal)}),()=>{_.disconnect(),k.abort(),B.cancel(),N.current(),N.current=f5}},[Q,Z,J,W,B,z,X,L,V,M])}function QG($,Z,J){let Q=$.style.getPropertyValue(Z);return $.style.setProperty(Z,J),()=>{$.style.setProperty(Z,Q)}}function nD($,Z){let J=[];for(let[Q,X]of Object.entries(Z))J.push(QG($,Q,X));return J.length?()=>{J.forEach((Q)=>Q())}:f5}function JG($,Z){let J=Z==="auto"?"auto":`${Z.width}px`,Q=Z==="auto"?"auto":`${Z.height}px`;$.style.setProperty("--popup-width",J),$.style.setProperty("--popup-height",Q)}function LJ($,Z){let J=Z==="max-content"?"max-content":`${Z.width}px`,Q=Z==="max-content"?"max-content":`${Z.height}px`;$.style.setProperty("--positioner-width",J),$.style.setProperty("--positioner-height",Q)}var i7=P(d(),1);function r7($){let{store:Z,side:J,cssVars:Q,children:X}=$,z=u4(),G=Z.useState("activeTriggerElement"),H=Z.useState("activeTriggerId"),Y=Z.useState("open"),K=Z.useState("payload"),W=Z.useState("mounted"),B=Z.useState("popupElement"),q=Z.useState("positionerElement"),U=aD(Y?G:null),F=Bl(H,K),N=R8.useRef(null),[L,V]=R8.useState(null),[M,_]=R8.useState(null),O=R8.useRef(null),D=R8.useRef(null),A=v2(O,!0,!1),E=z4(),[I,y]=R8.useState(null),[C,h]=R8.useState(!1);q0(()=>{return Z.set("hasViewport",!0),()=>{Z.set("hasViewport",!1)}},[Z]);let k=U0(()=>{O.current?.style.setProperty("animation","none"),O.current?.style.setProperty("transition","none"),D.current?.style.setProperty("display","none")}),S=U0((g)=>{if(O.current?.style.removeProperty("animation"),O.current?.style.removeProperty("transition"),D.current?.style.removeProperty("display"),g)y(g)}),w=R8.useRef(null);q0(()=>{if(G&&U&&G!==U&&w.current!==G&&N.current){V(N.current),h(!0);let g=Wl(U,G);_(g),E.request(()=>{E.request(()=>{h(!1),A(()=>{V(null),y(null),N.current=null})})}),w.current=G}},[G,U,L,A,E]),q0(()=>{let g=O.current;if(!g)return;let u=document.createElement("div");for(let j of Array.from(g.childNodes))u.appendChild(j.cloneNode(!0));N.current=u});let T=L!=null,R;if(!T)R=i7.jsx("div",{"data-current":!0,ref:O,children:X},F);else R=i7.jsxs(R8.Fragment,{children:[i7.jsx("div",{"data-previous":!0,inert:x2(!0),ref:D,style:{[Q.popupWidth]:`${I?.width}px`,[Q.popupHeight]:`${I?.height}px`,position:"absolute"},"data-ending-style":C?void 0:""},"previous"),i7.jsx("div",{"data-current":!0,ref:O,"data-starting-style":C?"":void 0,children:X},F)]});q0(()=>{let g=D.current;if(!g||!L)return;g.replaceChildren(...Array.from(L.childNodes))},[L]),oD({popupElement:B,positionerElement:q,mounted:W,content:K,onMeasureLayout:k,onMeasureLayoutComplete:S,side:J,direction:z});let b={activationDirection:Kl(M),transitioning:T};return{children:R,state:b}}function Kl($){if(!$)return;return`${sD($.horizontal,5,"right","left")} ${sD($.vertical,5,"down","up")}`}function sD($,Z,J,Q){if($>Z)return J;if($<-Z)return Q;return""}function Wl($,Z){let J=$.getBoundingClientRect(),Q=Z.getBoundingClientRect(),X={x:J.left+J.width/2,y:J.top+J.height/2},z={x:Q.left+Q.width/2,y:Q.top+Q.height/2};return{horizontal:z.x-X.x,vertical:z.y-X.y}}function Bl($,Z){let[J,Q]=R8.useState(0),X=R8.useRef($),z=R8.useRef(Z),G=R8.useRef(!1);return q0(()=>{let H=X.current,Y=z.current,K=$!==H,W=Z!==Y;if(K)Q((B)=>B+1),G.current=!W;else if(G.current&&W)Q((B)=>B+1),G.current=!1;X.current=$,z.current=Z},[$,Z]),`${$??"current"}-${J}`}var ql={activationDirection:($)=>$?{"data-activation-direction":$}:null},eD=tD.forwardRef(function(Z,J){let{render:Q,className:X,children:z,...G}=Z,H=d4(),Y=d7(),K=H.useState("instantType"),{children:W,state:B}=r7({store:H,side:Y.side,cssVars:iD,children:z}),q={activationDirection:B.activationDirection,transitioning:B.transitioning,instant:K};return W0("div",Z,{state:q,ref:J,props:[G,{children:W}],stateAttributesMapping:ql})});class XG{constructor(){this.store=new c7}open($){let Z=$?this.store.context.triggerElements.getById($):void 0;if($&&!Z)throw Error(C0(81,$));this.store.setOpen(!0,D0(K0.imperativeAction,void 0,Z))}close(){this.store.setOpen(!1,D0(K0.imperativeAction,void 0,void 0))}get isOpen(){return this.store.state.open}}function $O(){return new XG}var w3=P(d(),1);function ZO({delay:$=100,...Z}){return w3.jsx(T9.Provider,{"data-slot":"tooltip-provider",delay:$,...Z})}function M1({...$}){return w3.jsx(T9.Root,{"data-slot":"tooltip",...$})}function A1({...$}){return w3.jsx(T9.Trigger,{"data-slot":"tooltip-trigger",...$})}function _1({className:$,side:Z="top",sideOffset:J=6,align:Q="center",alignOffset:X=0,children:z,...G}){return w3.jsx(T9.Portal,{children:w3.jsx(T9.Positioner,{align:Q,alignOffset:X,side:Z,sideOffset:J,className:"isolate z-50",children:w3.jsx(T9.Popup,{"data-slot":"tooltip-content",className:s("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",$),...G,children:z})})})}function zG({cooldownMs:$,windowMs:Z,maxPerWindow:J,maxKeys:Q=256,now:X=Date.now}){let z=new Map,G=0,H=0;return{admit(Y){let K=X(),W=z.get(Y);if(W!==void 0&&K-W<$)return"cooldown";if(K-G>=Z)G=K,H=0;if(H>=J)return"window";if(H++,z.set(Y,K),z.size>Q)for(let B of[...z.keys()].slice(0,Math.ceil(Q/2)))z.delete(B);return"ok"}}}var Ul=zG({cooldownMs:5000,windowMs:60000,maxPerWindow:30});function F2($,Z){let J=[$,Z.source,Z.kind,Z.name,Z.message].join("\x00");if(Ul.admit(J)!=="ok")return;fetch(`/api/workspaces/${$}/applet-log`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({events:[Z]})}).catch(()=>{})}var Fl=/\/api\/workspaces\/([^/\s)]+)\/(widgets|views)\/([^/\s)]+)\//;function JO($){if(!$)return null;let Z=Fl.exec($);if(!Z)return null;return{workspaceId:Z[1],kind:Z[2]==="widgets"?"widget":"view",name:Z[3]}}var QO=!1;function XO(){if(QO)return;QO=!0;let $=(Z,J,Q)=>{let X=J instanceof Error?J:null,z=X?.stack??"",G=Z??JO(z);if(!G)return;F2(G.workspaceId,{source:"window",kind:G.kind,name:G.name,message:X?.message||Q||String(J),...z?{stack:z}:{}})};window.addEventListener("error",(Z)=>$(JO(Z.filename),Z.error,Z.message)),window.addEventListener("unhandledrejection",(Z)=>$(null,Z.reason))}function Z6($,Z){return`${$}:${Z}`}function MJ($){return $==="running"}function AJ($,Z,J){return MJ($[Z6(Z,J)])}function HO($,Z){let J=`${Z}:`;return Object.entries($).some(([Q,X])=>Q.startsWith(J)&&MJ(X))}function YO($,Z,J){if(!J)return!1;let Q=`${Z}:`,X=Z6(Z,J);return Object.entries($).some(([z,G])=>z.startsWith(Q)&&z!==X&&MJ(G))}function n8($,Z){return Z6($,Z??"new")}var P5=zO()(($)=>({activity:{},errors:{},previews:{},attachments:{},setActivity:(Z,J,Q)=>$((X)=>({activity:{...X.activity,[Z6(Z,J)]:Q}})),reconcileActivity:(Z)=>$(()=>({activity:Object.fromEntries(Z.map((J)=>[Z6(J.workspaceId,J.sessionId),J.activity]))})),setError:(Z,J,Q)=>$((X)=>({errors:{...X.errors,[Z6(Z,J)]:Q}})),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]:Q,...X}=J.previews;return{previews:X}}),clearPreviewsForSession:(Z,J)=>$((Q)=>{let X={},z=!1;for(let[G,H]of Object.entries(Q.previews))if(H.workspaceId===Z&&H.sessionId===J)z=!0;else X[G]=H;return z?{previews:X}:Q}),clearAllPreviews:()=>$((Z)=>Object.keys(Z.previews).length?{previews:{}}:Z),sweepPreviews:(Z,J)=>$((Q)=>{let X={},z=!1;for(let[G,H]of Object.entries(Q.previews))if(J-H.updatedAt>Z)z=!0;else X[G]=H;return z?{previews:X}:Q}),addAttachments:(Z,J,Q)=>$((X)=>{let z=n8(Z,J);return{attachments:{...X.attachments,[z]:[...X.attachments[z]??[],...Q]}}}),updateAttachment:(Z,J,Q,X)=>$((z)=>{let G=n8(Z,J),H=z.attachments[G];if(!H)return{};let Y=H.find((K)=>K.localId===Q);if(Y?.previewUrl&&"previewUrl"in X&&X.previewUrl!==Y.previewUrl)URL.revokeObjectURL(Y.previewUrl);return{attachments:{...z.attachments,[G]:H.map((K)=>K.localId===Q?{...K,...X}:K)}}}),removeAttachment:(Z,J,Q)=>$((X)=>{let z=n8(Z,J),G=X.attachments[z];if(!G)return{};let H=G.find((Y)=>Y.localId===Q);if(H?.previewUrl)URL.revokeObjectURL(H.previewUrl);return{attachments:{...X.attachments,[z]:G.filter((Y)=>Y.localId!==Q)}}}),clearAttachments:(Z,J)=>$((Q)=>{let X=n8(Z,J);for(let G of Q.attachments[X]??[])if(G.previewUrl)URL.revokeObjectURL(G.previewUrl);let z={...Q.attachments};return delete z[X],{attachments:z}}),renameSession:(Z,J,Q)=>$((X)=>{let z=Z6(Z,J),G=Z6(Z,Q),H={...X.activity},Y={...X.errors};if(z in H)H[G]=H[z],delete H[z];if(z in Y)Y[G]=Y[z],delete Y[z];let K=X.previews,W=!1;for(let[B,q]of Object.entries(X.previews))if(q.workspaceId===Z&&q.sessionId===J){if(!W)K={...X.previews},W=!0;K[B]={...q,sessionId:Q}}return{activity:H,errors:Y,previews:K}})}));function KO($,Z,J){if(!J)return{root:null,byParent:{}};let Q=null,X={};for(let z of Object.values($)){if(z.workspaceId!==Z||z.sessionId!==J)continue;if(z.parentToolUseId===null){if(!Q||z.updatedAt>Q.updatedAt)Q=z}else{let G=X[z.parentToolUseId];if(!G||z.updatedAt>G.updatedAt)X[z.parentToolUseId]=z}}return{root:Q,byParent:X}}function j4($){return GO(P5,$)}var S0={all:["workspaces"],discover:["workspaces","discover"],setupInfo:["workspaces","setup-info"],preview:($)=>["workspaces","preview",$],layout:($)=>["workspaces","layout",$],widgets:($)=>["workspaces","widgets",$],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",$]};var _J=P(v(),1);var j3={all:["app-ui"],selectedSession:($)=>["app-ui","selected-session",$]};async function WO($,Z){let J=await $.text();return Error(J||Z)}async function C5($,Z,J="Request failed"){let Q=await fetch($,Z);if(!Q.ok)throw await WO(Q,J);return Q.json()}async function T4($,Z,J="Request failed"){let Q=await fetch($,Z);if(!Q.ok)throw await WO(Q,J)}function r1($,Z){return{method:$,headers:{"Content-Type":"application/json"},body:Z===void 0?void 0:JSON.stringify(Z)}}function Nl($){return[...j3.selectedSession($),"save"]}function Vl($,Z,J){let Q=j3.selectedSession(Z),X=$.getQueryData(Q),z=X?.sessionId??null;if(X&&z===J)return null;return $.setQueryData(Q,{sessionId:J}),{sessionId:J,previousSessionId:z}}function Ll($,Z,J,Q){let X=j3.selectedSession(Z),z=$.getQueryData(X);if(J.sessionId!==Q.sessionId&&z?.sessionId!==J.sessionId)return"conflict";if(z?.sessionId!==Q.sessionId&&z?.sessionId!==Q.previousSessionId)return"ignored";return $.setQueryData(X,J),"applied"}function Ml($,Z,J,Q){if(Q)return;$.setQueryData(j3.selectedSession(Z),{sessionId:J})}function BO($,Z,J,Q){$.setQueryData(j3.selectedSession(Z),(X)=>X?.sessionId===J?{sessionId:Q}:X)}function a7(){let $=J1(),Z=o0(),J=_J.useMemo(()=>j3.selectedSession($),[$]),Q=_J.useMemo(()=>Nl($),[$]),X=TB({mutationKey:Q,exact:!0}),z=X1({queryKey:J,queryFn:()=>C5(`/api/workspaces/${$}/selected-session`),staleTime:1/0,gcTime:0,refetchOnMount:!1,refetchOnWindowFocus:!1}),{mutate:G}=t5({mutationKey:Q,scope:{id:`selected-session:${$}`},mutationFn:(K)=>C5(`/api/workspaces/${$}/selected-session`,r1("PUT",K),"Couldn’t save selected chat"),onSuccess:(K,W)=>{if(Ll(Z,$,K,W)!=="conflict")return;c4.add({title:"Couldn’t save selected chat",type:"error"}),Z.invalidateQueries({queryKey:J})},onError:(K,W)=>{if(Z.getQueryData(J)?.sessionId!==W.sessionId)return;c4.add({title:"Couldn’t save selected chat",type:"error"}),Z.invalidateQueries({queryKey:J})}}),H=_J.useCallback((K)=>{let W=Vl(Z,$,K);if(W)G(W)},[Z,G,$]);return Z8((K)=>{if(K.type!=="selected-session:updated"||K.workspaceId!==$)return;Ml(Z,$,K.sessionId,X>0)}),[z.isLoading?void 0:z.data?.sessionId??null,H]}function DJ(){return{turns:[],notices:[]}}function OJ($,Z){switch(Z.kind){case"snapshot":return{...$,snapshot:Z.snapshot};case"turn":{let J=$.turns.findIndex((X)=>X.id===Z.turn.id);if(J>=0)return{...$,turns:$.turns.map((X,z)=>z===J?Z.turn:X)};if(Z.turn.seq===void 0)return{...$,turns:[...$.turns,Z.turn]};let Q=$.turns.findIndex((X)=>X.seq!==void 0&&X.seq>Z.turn.seq);if(Q<0)return{...$,turns:[...$.turns,Z.turn]};return{...$,turns:[...$.turns.slice(0,Q),Z.turn,...$.turns.slice(Q)]}}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 qO($){return $.reduce(OJ,DJ())}function FO($,Z){let{queryClient:J,sendMessage:Q,onWorkspaceSwitch:X}=Z,z=P5.getState();if($.type==="status_snapshot"){z.reconcileActivity($.sessions??[]);return}if($.type==="status"){let{workspaceId:K,sessionId:W,activity:B}=$;if(z.setActivity(K,W,B),B!=="running")z.clearPreviewsForSession(K,W);return}if($.type==="preview"){let K=$,W=S0.events(K.workspaceId,K.sessionId);if(J?.getQueryData(W)===void 0)return;z.setPreview({workspaceId:K.workspaceId,sessionId:K.sessionId,messageId:K.messageId,parentToolUseId:K.parentToolUseId,blocks:K.blocks});return}if($.type==="session_renamed"){let{workspaceId:K,from:W,to:B}=$,q=S0.sessions(K),F=J?.getQueryData(q)?.find((V)=>V.sessionId===W||V.sessionId===B);if(F)J?.cancelQueries({queryKey:q});if(z.renameSession(K,W,B),J)BO(J,K,W,B);if(F)J?.setQueryData(q,(V)=>[{...F,sessionId:B},...(V??[]).filter((M)=>M.sessionId!==W&&M.sessionId!==B)]);let N=J?.getQueryData(S0.events(K,W));if(N!==void 0)J?.setQueryData(S0.events(K,B),N),J?.removeQueries({queryKey:S0.events(K,W)});let L=J?.getQueryData(S0.sessionConfig(K,W));if(L!==void 0)J?.setQueryData(S0.sessionConfig(K,B),L),J?.removeQueries({queryKey:S0.sessionConfig(K,W)});if(!F)J?.invalidateQueries({queryKey:q});J?.invalidateQueries({queryKey:S0.preview(K)});return}if($.type==="sessions_changed"){let K=$.workspaceId,W=S0.sessions(K);J?.invalidateQueries({queryKey:W}),J?.invalidateQueries({queryKey:S0.preview(K)});return}if($.type==="workspace:switch"){X?.($.workspaceId);return}if($.type==="scratchpad:op"){let K=UO($.workspaceId);if(!K)return;let W=$.opId;K($.op).then((B)=>Q({type:"scratchpad:op-result",opId:W,result:B}),(B)=>Q({type:"scratchpad:op-result",opId:W,error:B instanceof Error?B.message:String(B)}));return}let{workspaceId:G,sessionId:H}=$;if(!G||!H)return;let Y=$.kind;if(Y==="snapshot"||Y==="turn"||Y==="notice"||Y==="result"){if(Al(J,G,H,$),Y==="turn"){let K=$.turn?.meta?.apiMessageId;if(K)z.clearPreview(K)}if(Y==="result")z.clearPreviewsForSession(G,H)}if(Y==="error"&&typeof $.content==="string")z.setError(G,H,$.content),z.setActivity(G,H,"idle"),z.clearPreviewsForSession(G,H);if(Y==="stopped")z.setActivity(G,H,"idle"),z.clearPreviewsForSession(G,H)}function Al($,Z,J,Q){let X=S0.events(Z,J),z=$?.getQueryData(X);if(z===void 0)return;$?.setQueryData(X,OJ(z,Q))}var xq=null,n7=null,GG=0,HG=null,bq=[],LO=null,NO=null,_l=15000;function MO($){if(xq=$,!NO)NO=setInterval(()=>P5.getState().sweepPreviews(_l,Date.now()),5000);if(n7)return;AO()}function AO(){let $=++GG;if(HG)clearTimeout(HG),HG=null;let Z=new WebSocket(VO("/ws"));n7=Z,Z.onopen=()=>{if(GG!==$){Z.close();return}for(let J of bq)Z.send(JSON.stringify(J));bq.length=0,xq?.invalidateQueries({queryKey:["workspaces","events"]}),P5.getState().clearAllPreviews()},Z.onmessage=(J)=>{if(GG!==$)return;let Q;try{Q=JSON.parse(J.data)}catch{return}Dl(Q)},Z.onclose=()=>{if(GG!==$)return;n7=null,HG=setTimeout(AO,1000)},Z.onerror=()=>Z.close()}function Dl($){FO($,{queryClient:xq,sendMessage:YG,onWorkspaceSwitch:LO})}function YG($){if(n7&&n7.readyState===WebSocket.OPEN)n7.send(JSON.stringify($));else bq.push($)}function hq($){LO=$}var KB=P(v(),1);var Ol=($)=>_O()(OO((Z)=>({discoveredWorkspacesOpen:!0,hasSentMessageFromMoi:!1,workspaceIdsPendingAnalysis:[],composerDrafts:{},viewBuilderDrafts:{},dockedChatWidth:360,setDiscoveredWorkspacesOpen:(J)=>Z({discoveredWorkspacesOpen:J}),markWorkspacePendingAnalysis:(J)=>Z((Q)=>{let X=Q.workspaceIdsPendingAnalysis??[];return{workspaceIdsPendingAnalysis:X.includes(J)?X:[...X,J]}}),markMessageSentFromMoi:(J)=>Z((Q)=>({hasSentMessageFromMoi:!0,workspaceIdsPendingAnalysis:(Q.workspaceIdsPendingAnalysis??[]).filter((X)=>X!==J)})),setComposerDraft:(J,Q)=>Z((X)=>{let z={...X.composerDrafts??{}};if(Q)z[J]=Q;else delete z[J];return{composerDrafts:z}}),setViewBuilderDraft:(J,Q)=>Z((X)=>{let z=X.viewBuilderDrafts??{};if(Q===null){if(!(J in z))return X;let G={...z};return delete G[J],{viewBuilderDrafts:G}}if(z[J]===Q)return X;return{viewBuilderDrafts:{...z,[J]:Q}}}),setDockedChatWidth:(J)=>Z({dockedChatWidth:J})}),$?{name:"moi:ui",storage:DO(()=>$)}:{name:"moi:ui"})),D1=Ol();function PO($,Z){let J=$??[],Q=J.findIndex((X)=>X.id===Z.id||X.path===Z.path);if(Q===-1)return[Z,...J];return J.map((X,z)=>z===Q?{...X,...Z}:X)}function KG(){return X1({queryKey:S0.all,queryFn:()=>C5("/api/workspaces"),staleTime:1/0,refetchOnMount:"always"})}function WG($){return X1({queryKey:S0.preview($),queryFn:()=>C5(`/api/workspaces/${$}/preview`),staleTime:60000})}function wO(){return X1({queryKey:S0.discover,queryFn:()=>C5("/api/workspaces/discover")})}function jO(){let $=o0();return t5({mutationFn:(Z)=>C5("/api/workspaces",r1("POST",Z),"Failed to add workspace"),onSuccess:(Z,J)=>{D1.getState().markWorkspacePendingAnalysis(Z.id),$.setQueryData(S0.all,(Q)=>PO(Q,Z)),$.setQueryData(S0.discover,(Q)=>(Q??[]).filter((X)=>X.path!==J.path))}})}function BG(){return X1({queryKey:S0.setupInfo,queryFn:()=>C5("/api/workspaces/create"),staleTime:30000,refetchOnMount:"always"})}function TO(){let $=o0();return t5({mutationFn:(Z)=>C5("/api/workspaces/create",r1("POST",Z),"Failed to create workspace"),onSuccess:(Z)=>{$.setQueryData(S0.all,(J)=>PO(J,Z))}})}function CO(){let $=o0();return t5({mutationFn:(Z)=>C5("/api/workspaces/order",r1("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 Q=new Map(J.map((z)=>[z.id,z])),X=Z.map((z)=>Q.get(z)).filter((z)=>Boolean(z));if(X.length===J.length)$.setQueryData(S0.all,X)}return{previous:J}},onError:(Z,J,Q)=>{if(Q?.previous)$.setQueryData(S0.all,Q.previous);$.invalidateQueries({queryKey:S0.all,exact:!0})},onSuccess:(Z)=>{$.setQueryData(S0.all,Z)}})}function EO(){let $=o0();return t5({mutationFn:(Z)=>T4(`/api/workspaces/${Z}`,{method:"DELETE"},"Failed to remove workspace"),onSuccess:(Z,J)=>{$.setQueryData(S0.all,(Q)=>(Q??[]).filter((X)=>X.id!==J)),$.invalidateQueries({queryKey:S0.discover})}})}var xJ=P(v(),1);var N2={};_4(N2,{createHandle:()=>XP,Viewport:()=>$P,Trigger:()=>QP,Title:()=>JP,Root:()=>tO,Portal:()=>cO,Popup:()=>fO,Handle:()=>MG,Description:()=>bO,Close:()=>RO,Backdrop:()=>kO});var SO=P(v(),1);var qG=P(v(),1),gq=qG.createContext(void 0);function W8($){let Z=qG.useContext(gq);if($===!1&&Z===void 0)throw Error(C0(27));return Z}var Pl={...N5,...m5},kO=SO.forwardRef(function(Z,J){let{render:Q,className:X,forceRender:z=!1,...G}=Z,{store:H}=W8(),Y=H.useState("open"),K=H.useState("nested"),W=H.useState("mounted"),B=H.useState("transitionStatus");return W0("div",Z,{state:{open:Y,transitionStatus:B},ref:[H.context.backdropRef,J],stateAttributesMapping:Pl,props:[{role:"presentation",hidden:!W,style:{userSelect:"none",WebkitUserSelect:"none"}},G],enabled:z||!K})});var IO=P(v(),1);var RO=IO.forwardRef(function(Z,J){let{render:Q,className:X,disabled:z=!1,nativeButton:G=!0,...H}=Z,{store:Y}=W8(),K=Y.useState("open");function W(F){if(K)Y.setOpen(!1,D0(K0.closePress,F.nativeEvent))}let{getButtonProps:B,buttonRef:q}=f1({disabled:z,native:G});return W0("button",Z,{state:{disabled:z},ref:[J,q],props:[{onClick:W},H,B]})});var yO=P(v(),1);var bO=yO.forwardRef(function(Z,J){let{render:Q,className:X,id:z,...G}=Z,{store:H}=W8(),Y=s0(z);return H.useSyncedValueWithCleanup("descriptionElementId",Y),W0("p",Z,{ref:J,props:[{id:Y},G]})});var gO=P(v(),1);var xO=function($){return $.nestedDialogs="--nested-dialogs",$}({});var hO=function($){return $[$.open=w4.open]="open",$[$.closed=w4.closed]="closed",$[$.startingStyle=w4.startingStyle]="startingStyle",$[$.endingStyle=w4.endingStyle]="endingStyle",$.nested="data-nested",$.nestedDialogOpen="data-nested-dialog-open",$}({});var UG=P(v(),1),vq=UG.createContext(void 0);function FG(){let $=UG.useContext(vq);if($===void 0)throw Error(C0(26));return $}var PJ="ArrowUp",wJ="ArrowDown",jJ="ArrowLeft",TJ="ArrowRight",CJ="Home",EJ="End",wl=new Set([jJ,TJ]);var jl=new Set([PJ,wJ]);var Tl=new Set([...wl,...jl]),GV0=new Set([...Tl,CJ,EJ]),J6=new Set([PJ,wJ,jJ,TJ,CJ,EJ]);var vO=P(d(),1),Cl={...N5,...m5,nestedDialogOpen($){return $?{[hO.nestedDialogOpen]:""}:null}},fO=gO.forwardRef(function(Z,J){let{className:Q,finalFocus:X,initialFocus:z,render:G,...H}=Z,{store:Y}=W8(),K=Y.useState("descriptionElementId"),W=Y.useState("disablePointerDismissal"),B=Y.useState("floatingRootContext"),q=Y.useState("popupProps"),U=Y.useState("modal"),F=Y.useState("mounted"),N=Y.useState("nested"),L=Y.useState("nestedOpenDialogCount"),V=Y.useState("open"),M=Y.useState("openMethod"),_=Y.useState("titleElementId"),O=Y.useState("transitionStatus"),D=Y.useState("role");FG(),I1({open:V,ref:Y.context.popupRef,onComplete(){if(V)Y.context.onOpenChangeComplete?.(!0)}});function A(h){if(h==="touch")return Y.context.popupRef.current;return!0}let E=z===void 0?A:z,I=L>0,C=W0("div",Z,{state:{open:V,nested:N,transitionStatus:O,nestedDialogOpen:I},props:[q,{"aria-labelledby":_??void 0,"aria-describedby":K??void 0,role:D,tabIndex:-1,hidden:!F,onKeyDown(h){if(J6.has(h.key))h.stopPropagation()},style:{[xO.nestedDialogs]:L}},H],ref:[J,Y.context.popupRef,Y.useStateSetter("popupElement")],stateAttributesMapping:Cl});return vO.jsx(V3,{context:B,openInteractionType:M,disabled:!F,closeOnFocusOut:!W,initialFocus:E,returnFocus:X,modal:U!==!1,restoreFocus:"popup",children:C})});var uO=P(v(),1);var mO=P(v(),1),pO=P(d(),1),o7=mO.forwardRef(function(Z,J){let{cutout:Q,...X}=Z,z;if(Q){let G=Q?.getBoundingClientRect();z=`polygon(
10
+ 0% 0%,
11
+ 100% 0%,
12
+ 100% 100%,
13
+ 0% 100%,
14
+ 0% 0%,
15
+ ${G.left}px ${G.top}px,
16
+ ${G.left}px ${G.bottom}px,
17
+ ${G.right}px ${G.bottom}px,
18
+ ${G.right}px ${G.top}px,
19
+ ${G.left}px ${G.top}px
20
+ )`}return pO.jsx("div",{ref:J,role:"presentation","data-base-ui-inert":"",...X,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:z}})});var SJ=P(d(),1),cO=uO.forwardRef(function(Z,J){let{keepMounted:Q=!1,...X}=Z,{store:z}=W8(),G=z.useState("mounted"),H=z.useState("modal"),Y=z.useState("open");if(!(G||Q))return null;return SJ.jsx(vq.Provider,{value:Q,children:SJ.jsxs(N3,{ref:J,...X,children:[G&&H===!0&&SJ.jsx(o7,{ref:z.context.internalBackdropRef,inert:x2(!Y)}),Z.children]})})});var oO=P(v(),1);var l4=P(v(),1);var dO={},lO={},iO="";function El($){if(typeof document>"u")return!1;let Z=p0($);return C8(Z).innerWidth-Z.documentElement.clientWidth>0}function Sl($){if(!(typeof CSS<"u"&&CSS.supports&&CSS.supports("scrollbar-gutter","stable"))||typeof document>"u")return!1;let J=p0($),Q=J.documentElement,X=J.body,z=NG(Q)?Q:X,G=z.style.overflowY,H=Q.style.scrollbarGutter;Q.style.scrollbarGutter="stable",z.style.overflowY="scroll";let Y=z.offsetWidth;z.style.overflowY="hidden";let K=z.offsetWidth;return z.style.overflowY=G,Q.style.scrollbarGutter=H,Y===K}function kl($){let Z=p0($),J=Z.documentElement,Q=Z.body,X=NG(J)?J:Q,z={overflowY:X.style.overflowY,overflowX:X.style.overflowX};return Object.assign(X.style,{overflowY:"hidden",overflowX:"hidden"}),()=>{Object.assign(X.style,z)}}function Il($){let Z=p0($),J=Z.documentElement,Q=Z.body,X=C8(J),z=0,G=0,H=!1,Y=G1.create();if(Wz&&(X.visualViewport?.scale??1)!==1)return()=>{};function K(){let q=X.getComputedStyle(J),U=X.getComputedStyle(Q),L=(q.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";z=J.scrollTop,G=J.scrollLeft,dO={scrollbarGutter:J.style.scrollbarGutter,overflowY:J.style.overflowY,overflowX:J.style.overflowX},iO=J.style.scrollBehavior,lO={position:Q.style.position,height:Q.style.height,width:Q.style.width,boxSizing:Q.style.boxSizing,overflowY:Q.style.overflowY,overflowX:Q.style.overflowX,scrollBehavior:Q.style.scrollBehavior};let V=J.scrollHeight>J.clientHeight,M=J.scrollWidth>J.clientWidth,_=q.overflowY==="scroll"||U.overflowY==="scroll",O=q.overflowX==="scroll"||U.overflowX==="scroll",D=Math.max(0,X.innerWidth-Q.clientWidth),A=Math.max(0,X.innerHeight-Q.clientHeight),E=parseFloat(U.marginTop)+parseFloat(U.marginBottom),I=parseFloat(U.marginLeft)+parseFloat(U.marginRight),y=NG(J)?J:Q;if(H=Sl($),H){J.style.scrollbarGutter=L,y.style.overflowY="hidden",y.style.overflowX="hidden";return}if(Object.assign(J.style,{scrollbarGutter:L,overflowY:"hidden",overflowX:"hidden"}),V||_)J.style.overflowY="scroll";if(M||O)J.style.overflowX="scroll";Object.assign(Q.style,{position:"relative",height:E||A?`calc(100dvh - ${E+A}px)`:"100dvh",width:I||D?`calc(100vw - ${I+D}px)`:"100vw",boxSizing:"border-box",overflow:"hidden",scrollBehavior:"unset"}),Q.scrollTop=z,Q.scrollLeft=G,J.setAttribute("data-base-ui-scroll-locked",""),J.style.scrollBehavior="unset"}function W(){if(Object.assign(J.style,dO),Object.assign(Q.style,lO),!H)J.scrollTop=z,J.scrollLeft=G,J.removeAttribute("data-base-ui-scroll-locked"),J.style.scrollBehavior=iO}function B(){W(),Y.request(K)}return K(),X.addEventListener("resize",B),()=>{if(Y.cancel(),W(),typeof X.removeEventListener==="function")X.removeEventListener("resize",B)}}class rO{lockCount=0;restore=null;timeoutLock=l1.create();timeoutUnlock=l1.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 J=p0($).documentElement,Q=C8(J).getComputedStyle(J).overflowY;if(Q==="hidden"||Q==="clip"){this.restore=f5;return}let X=Bz||!El($);this.restore=X?kl($):Il($)}}var Rl=new rO;function s7($=!0,Z=null){q0(()=>{if(!$)return;return Rl.acquire(Z)},[$,Z])}var t7=P(v(),1);var kJ=P(v(),1);function aO($){let Z=kJ.useRef(""),J=kJ.useCallback((X)=>{if(X.defaultPrevented)return;Z.current=X.pointerType,$(X,X.pointerType)},[$]);return{onClick:kJ.useCallback((X)=>{if(X.detail===0){$(X,"keyboard");return}if("pointerType"in X)$(X,X.pointerType);else $(X,Z.current);Z.current=""},[$]),onPointerDown:J}}function e7($){let[Z,J]=t7.useState(null),Q=U0((H,Y)=>{if(!$)J(Y||(Bz?"touch":""))}),X=t7.useCallback(()=>{J(null)},[]),{onClick:z,onPointerDown:G}=aO(Q);return t7.useMemo(()=>({openMethod:Z,reset:X,triggerProps:{onClick:z,onPointerDown:G}}),[Z,X,z,G])}function nO($){let{store:Z,parentContext:J,actionsRef:Q}=$,X=Z.useState("open"),z=Z.useState("disablePointerDismissal"),G=Z.useState("modal"),H=Z.useState("popupElement"),{openMethod:Y,triggerProps:K,reset:W}=e7(X);p2(Z);let{forceUnmount:B}=u2(X,Z,()=>{W()}),q=U0((C)=>{let h=D0(C);return h.preventUnmountOnClose=()=>{Z.set("preventUnmountingOnClose",!0)},h}),U=l4.useCallback(()=>{Z.setOpen(!1,q(K0.imperativeAction))},[Z,q]);l4.useImperativeHandle(Q,()=>({unmount:B,close:U}),[B,U]);let F=B2({popupStore:Z,onOpenChange:Z.setOpen,treatPopupAsFloatingElement:!0,noEmit:!0}),[N,L]=l4.useState(0),V=N===0,M=D3(F),_=W2(F,{outsidePressEvent(){if(Z.context.internalBackdropRef.current||Z.context.backdropRef.current)return"intentional";return{mouse:G==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}},outsidePress(C){if(!Z.context.outsidePressEnabledRef.current)return!1;if("button"in C&&C.button!==0)return!1;if("touches"in C&&C.touches.length!==1)return!1;let h=R5(C);if(V&&!z){let k=h;if(G)return Z.context.internalBackdropRef.current||Z.context.backdropRef.current?Z.context.internalBackdropRef.current===k||Z.context.backdropRef.current===k||m0(k,H)&&!k?.hasAttribute("data-base-ui-portal"):!0;return!0}return!1},escapeKey:V});s7(X&&G===!0,H);let{getReferenceProps:O,getFloatingProps:D,getTriggerProps:A}=e1([M,_]);Z.useContextCallback("onNestedDialogOpen",(C)=>{L(C+1)}),Z.useContextCallback("onNestedDialogClose",()=>{L(0)}),l4.useEffect(()=>{if(J?.onNestedDialogOpen&&X)J.onNestedDialogOpen(N);if(J?.onNestedDialogClose&&!X)J.onNestedDialogClose();return()=>{if(J?.onNestedDialogClose&&X)J.onNestedDialogClose()}},[X,J,N]);let E=l4.useMemo(()=>O(K),[O,K]),I=l4.useMemo(()=>A(K),[A,K]),y=l4.useMemo(()=>D(),[D]);Z.useSyncedValues({openMethod:Y,activeTriggerProps:E,inactiveTriggerProps:I,popupProps:y,floatingRootContext:F,nestedOpenDialogCount:N})}var VG=P(v(),1);var yl={...d2,modal:E0(($)=>$.modal),nested:E0(($)=>$.nested),nestedOpenDialogCount:E0(($)=>$.nestedOpenDialogCount),disablePointerDismissal:E0(($)=>$.disablePointerDismissal),openMethod:E0(($)=>$.openMethod),descriptionElementId:E0(($)=>$.descriptionElementId),titleElementId:E0(($)=>$.titleElementId),viewportElement:E0(($)=>$.viewportElement),role:E0(($)=>$.role)};class IJ extends l8{constructor($){super(bl($),{popupRef:VG.createRef(),backdropRef:VG.createRef(),internalBackdropRef:VG.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:new r8,onOpenChange:void 0,onOpenChangeComplete:void 0},yl)}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;let J={open:$,nativeEvent:Z.event,reason:Z.reason,nested:this.state.nested};this.state.floatingRootContext.context.events?.emit("openchange",J);let Q={open:$},X=Z.trigger?.id??null;if(X||$)Q.activeTriggerId=X,Q.activeTriggerElement=Z.trigger??null;this.update(Q)}}function bl($={}){return{...c2(),modal:!0,disablePointerDismissal:!1,popupElement:null,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,role:"dialog",...$}}var sO=P(d(),1);function tO($){let{children:Z,open:J,defaultOpen:Q=!1,onOpenChange:X,onOpenChangeComplete:z,disablePointerDismissal:G=!1,modal:H=!0,actionsRef:Y,handle:K,triggerId:W,defaultTriggerId:B=null}=$,q=W8(!0),U=Boolean(q),F=T5(()=>{return K?.store??new IJ({open:Q,openProp:J,activeTriggerId:B,triggerIdProp:W,modal:H,disablePointerDismissal:G,nested:U})}).current;n2(()=>{if(J===void 0&&F.state.open===!1&&Q===!0)F.update({open:!0,activeTriggerId:B})}),F.useControlledProp("openProp",J),F.useControlledProp("triggerIdProp",W),F.useSyncedValues({disablePointerDismissal:G,nested:U,modal:H}),F.useContextCallback("onOpenChange",X),F.useContextCallback("onOpenChangeComplete",z);let N=F.useState("payload");nO({store:F,actionsRef:Y,parentContext:q?.store.context,onOpenChange:X,triggerIdProp:W});let L=oO.useMemo(()=>({store:F}),[F]);return sO.jsx(gq.Provider,{value:L,children:typeof Z==="function"?Z({payload:N}):Z})}var eO=P(v(),1);var fq=function($){return $[$.open=w4.open]="open",$[$.closed=w4.closed]="closed",$[$.startingStyle=w4.startingStyle]="startingStyle",$[$.endingStyle=w4.endingStyle]="endingStyle",$.nested="data-nested",$.nestedDialogOpen="data-nested-dialog-open",$}({});var xl={...N5,...m5,nested($){return $?{[fq.nested]:""}:null},nestedDialogOpen($){return $?{[fq.nestedDialogOpen]:""}:null}},$P=eO.forwardRef(function(Z,J){let{className:Q,render:X,children:z,...G}=Z,H=FG(),{store:Y}=W8(),K=Y.useState("open"),W=Y.useState("nested"),B=Y.useState("transitionStatus"),q=Y.useState("nestedOpenDialogCount"),U=Y.useState("mounted"),F=q>0;return W0("div",Z,{enabled:H||U,state:{open:K,nested:W,transitionStatus:B,nestedDialogOpen:F},ref:[J,Y.useStateSetter("viewportElement")],stateAttributesMapping:xl,props:[{role:"presentation",hidden:!U,style:{pointerEvents:!K?"none":void 0},children:z},G]})});var ZP=P(v(),1);var JP=ZP.forwardRef(function(Z,J){let{render:Q,className:X,id:z,...G}=Z,{store:H}=W8(),Y=s0(z);return H.useSyncedValueWithCleanup("titleElementId",Y),W0("h2",Z,{ref:J,props:[{id:Y},G]})});var LG=P(v(),1);var QP=LG.forwardRef(function(Z,J){let{render:Q,className:X,disabled:z=!1,nativeButton:G=!0,id:H,payload:Y,handle:K,...W}=Z,B=W8(!0),q=K?.store??B?.store;if(!q)throw Error(C0(79));let U=s0(H),F=q.useState("floatingRootContext"),N=q.useState("isOpenedByTrigger",U),L=LG.useRef(null),{registerTrigger:V,isMountedByThisTrigger:M}=m2(U,L,q,{payload:Y}),{getButtonProps:_,buttonRef:O}=f1({disabled:z,native:G}),D=w9(F,{enabled:F!=null}),A=e1([D]),E={disabled:z,open:N},I=q.useState("triggerProps",M);return W0("button",Z,{state:E,ref:[O,J,V,L],props:[A.getReferenceProps(),I,{[v7]:"",id:U},W,_],stateAttributesMapping:r2})});class MG{constructor($){this.store=$??new IJ}open($){let Z=$?this.store.context.triggerElements.getById($):void 0;this.store.setOpen(!0,D0(K0.imperativeAction,void 0,Z))}openWithPayload($){this.store.set("payload",$),this.store.setOpen(!0,D0(K0.imperativeAction,void 0,void 0))}close(){this.store.setOpen(!1,D0(K0.imperativeAction,void 0,void 0))}get isOpen(){return this.store.state.open}}function XP(){return new MG}var s2=P(d(),1);function $$({...$}){return s2.jsx(N2.Root,{"data-slot":"dialog",...$})}function zP({...$}){return s2.jsx(N2.Trigger,{"data-slot":"dialog-trigger",...$})}function AG({...$}){return s2.jsx(N2.Close,{"data-slot":"dialog-close",...$})}function _G({className:$,children:Z,...J}){return s2.jsxs(N2.Portal,{children:[s2.jsx(N2.Backdrop,{"data-slot":"dialog-backdrop",className:"fixed inset-0 z-50 bg-foreground/40 duration-150 data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0"}),s2.jsx(N2.Popup,{"data-slot":"dialog-content",className:s("fixed top-1/2 left-1/2 z-50 origin-center -translate-x-1/2 -translate-y-1/2 overflow-hidden rounded-xl bg-card text-card-foreground shadow-xl outline-hidden duration-150 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,children:Z})]})}function Z$({className:$,...Z}){return s2.jsx(N2.Title,{"data-slot":"dialog-title",className:s("text-lg font-semibold",$),...Z})}function DG({className:$,...Z}){return s2.jsx(N2.Description,{"data-slot":"dialog-description",className:s("text-sm text-muted-foreground",$),...Z})}var DP=P(v(),1);var RG={};_4(RG,{Validity:()=>LP,Root:()=>KP,Label:()=>WP,Item:()=>_P,Error:()=>BP,Description:()=>UP,Control:()=>NP});var q8=P(v(),1);var OG=P(v(),1);var mq=function($){return $.disabled="data-disabled",$.valid="data-valid",$.invalid="data-invalid",$.touched="data-touched",$.dirty="data-dirty",$.filled="data-filled",$.focused="data-focused",$}({});var T3={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},y8={valid($){if($===null)return null;if($)return{[mq.valid]:""};return{[mq.invalid]:""}}};var pq=OG.createContext({invalid:void 0,name:void 0,validityData:{state:T3,errors:[],error:"",value:"",initialValue:null},setValidityData:f5,disabled:void 0,touched:!1,setTouched:f5,dirty:!1,setDirty:f5,filled:!1,setFilled:f5,focused:!1,setFocused:f5,validate:()=>null,validationMode:"onSubmit",validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:{disabled:!1,valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},markedDirtyRef:{current:!1},validation:{getValidationProps:($=E5)=>$,getInputValidationProps:($=E5)=>$,inputRef:{current:null},commit:async()=>{}}});function R1($=!0){let Z=OG.useContext(pq);if(Z.setValidityData===f5&&!$)throw Error(C0(28));return Z}var PG=P(v(),1),hl=PG.createContext({legendId:void 0,setLegendId:()=>{},disabled:void 0});function GP($=!1){let Z=PG.useContext(hl);if(!Z&&!$)throw Error(C0(86));return Z}var wG=P(v(),1);var gl=wG.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:f5,validationMode:"onSubmit",submitAttemptedRef:{current:!1}});function i4(){return wG.useContext(gl)}var Q6=P(v(),1);var jG=P(v(),1);var uq=jG.createContext({controlId:void 0,registerControlId:f5,labelId:void 0,setLabelId:f5,messageIds:[],setMessageIds:f5,getDescriptionProps:($)=>$});function B8(){return jG.useContext(uq)}var HP=P(d(),1),TG=function(Z){let J=s0(),[Q,X]=Q6.useState(Z.initialControlId===void 0?J:Z.initialControlId),[z,G]=Q6.useState(void 0),[H,Y]=Q6.useState([]),K=T5(()=>new Map),{messageIds:W}=B8(),B=U0((F,N)=>{let L=K.current;if(N===void 0){L.delete(F);return}L.set(F,N),X((V)=>{if(L.size===0)return;let M;for(let _ of L.values()){if(V!==void 0&&_===V)return V;if(M===void 0)M=_}return M})}),q=Q6.useCallback((F)=>{return Y4({"aria-describedby":W.concat(H).join(" ")||void 0},F)},[W,H]),U=Q6.useMemo(()=>({controlId:Q,registerControlId:B,labelId:z,setLabelId:G,messageIds:H,setMessageIds:Y,getDescriptionProps:q}),[Q,B,z,G,H,Y,q]);return HP.jsx(uq.Provider,{value:U,children:Z.children})};var E3=P(v(),1);function C3($,Z){return{...$,state:{...$.state,valid:!Z&&$.state.valid}}}var CG=Object.keys(T3);function vl($){if(!$||$.valid||!$.valueMissing)return!1;let Z=!1;for(let J of CG){if(J==="valid")continue;if(J==="valueMissing")Z=$[J];if($[J])Z=!1}return Z}function YP($){let{formRef:Z,clearErrors:J}=i4(),{setValidityData:Q,validate:X,validityData:z,validationDebounceTime:G,invalid:H,markedDirtyRef:Y,state:K,name:W,shouldValidateOnChange:B}=$,{controlId:q,getDescriptionProps:U}=B8(),F=V1(),N=E3.useRef(null),L=U0(async(_,O=!1)=>{let D=N.current;if(!D)return;if(O){if(K.valid!==!1)return;let S=D.validity;if(!S.valueMissing){let T={value:_,state:{...T3,valid:!0},error:"",errors:[],initialValue:z.initialValue};if(D.setCustomValidity(""),q){let R=Z.current.fields.get(q);if(R)Z.current.fields.set(q,{...R,...C3(T,!1)})}Q(T);return}let w=CG.reduce((T,R)=>{return T[R]=S[R],T},{});if(!w.valid&&!vl(w))return}function A(S){let w=CG.reduce((R,b)=>{return R[b]=S.validity[b],R},{}),T=!1;for(let R of CG){if(R==="valid")continue;if(R==="valueMissing"&&w[R])T=!0;else if(w[R])return w}if(T&&!Y.current)w.valid=!0,w.valueMissing=!1;return w}F.clear();let E=null,I=[],y=A(D),C,h=B();if(D.validationMessage&&!h)C=D.validationMessage,I=[D.validationMessage];else{let S=Array.from(Z.current.fields.values()).reduce((T,R)=>{if(R.name)T[R.name]=R.getValue();return T},{}),w=X(_,S);if(typeof w==="object"&&w!==null&&"then"in w)E=await w;else E=w;if(E!==null){if(y.valid=!1,y.customError=!0,Array.isArray(E))I=E,D.setCustomValidity(E.join(`
21
+ `));else if(E)I=[E],D.setCustomValidity(E)}else if(h){if(D.setCustomValidity(""),y.customError=!1,D.validationMessage)C=D.validationMessage,I=[D.validationMessage];else if(D.validity.valid&&!y.valid)y.valid=!0}}let k={value:_,state:y,error:C??(Array.isArray(E)?E[0]:E??""),errors:I,initialValue:z.initialValue};if(q){let S=Z.current.fields.get(q);if(S)Z.current.fields.set(q,{...S,...C3(k,H)})}Q(k)}),V=E3.useCallback((_={})=>Y4(U,K.valid===!1?{"aria-invalid":!0}:E5,_),[U,K.valid]),M=E3.useCallback((_={})=>Y4({onChange(O){if(O.nativeEvent.defaultPrevented)return;if(J(W),!B()){L(O.currentTarget.value,!0);return}if(H)return;let D=O.currentTarget;if(D.value===""){L(D.value);return}if(F.clear(),G)F.start(G,()=>{L(D.value)});else L(D.value)}},V(_)),[V,J,W,F,L,H,G,B]);return E3.useMemo(()=>({getValidationProps:V,getInputValidationProps:M,inputRef:N,commit:L}),[V,M,L])}var EG=P(d(),1),fl=q8.forwardRef(function(Z,J){let{errors:Q,validationMode:X,submitAttemptedRef:z}=i4(),{render:G,className:H,validate:Y,validationDebounceTime:K=0,validationMode:W=X,name:B,disabled:q=!1,invalid:U,dirty:F,touched:N,actionsRef:L,...V}=Z,{disabled:M}=GP(),_=U0(Y||(()=>null)),O=M||q,[D,A]=q8.useState(!1),[E,I]=q8.useState(!1),[y,C]=q8.useState(!1),[h,k]=q8.useState(!1),S=F??E,w=N??D,T=q8.useRef(!1),R=U0((B0)=>{if(F!==void 0)return;if(B0)T.current=!0;I(B0)}),b=U0((B0)=>{if(N!==void 0)return;A(B0)}),g=U0(()=>W==="onChange"||W==="onSubmit"&&z.current),u=Boolean(U||B&&{}.hasOwnProperty.call(Q,B)&&Q[B]!==void 0),[j,t]=q8.useState({state:T3,error:"",errors:[],value:null,initialValue:null}),Q0=!u&&j.state.valid,x=q8.useMemo(()=>({disabled:O,touched:w,dirty:S,valid:Q0,filled:y,focused:h}),[O,w,S,Q0,y,h]),e=YP({setValidityData:t,validate:_,validityData:j,validationDebounceTime:K,invalid:u,markedDirtyRef:T,state:x,name:B,shouldValidateOnChange:g}),M0=q8.useCallback(()=>{T.current=!0,e.commit(j.value)},[e,j]);q8.useImperativeHandle(L,()=>({validate:M0}),[M0]);let l=q8.useMemo(()=>({invalid:u,name:B,validityData:j,setValidityData:t,disabled:O,touched:w,setTouched:b,dirty:S,setDirty:R,filled:y,setFilled:C,focused:h,setFocused:k,validate:_,validationMode:W,validationDebounceTime:K,shouldValidateOnChange:g,state:x,markedDirtyRef:T,validation:e}),[u,B,j,O,w,b,S,R,y,C,h,k,_,W,K,g,x,e]),H0=W0("div",Z,{ref:J,state:x,props:V,stateAttributesMapping:y8});return EG.jsx(pq.Provider,{value:l,children:H0})}),KP=q8.forwardRef(function(Z,J){return EG.jsx(TG,{children:EG.jsx(fl,{...Z,ref:J})})});var RJ=P(v(),1);var WP=RJ.forwardRef(function(Z,J){let{render:Q,className:X,id:z,nativeLabel:G=!0,...H}=Z,Y=R1(!1),{controlId:K,setLabelId:W,labelId:B}=B8(),q=s0(z),U=RJ.useRef(null),F=U0((L)=>{if(R5(L.nativeEvent)?.closest("button,input,select,textarea"))return;if(!L.defaultPrevented&&L.detail>1)L.preventDefault();if(G||!K)return;let M=p0(L.currentTarget).getElementById(K);if(L1(M))M.focus({focusVisible:!0})});return q0(()=>{if(q)W(q);return()=>{W(void 0)}},[q,W]),W0("label",Z,{ref:[J,U],state:Y.state,props:[{id:B},G?{htmlFor:K??void 0,onMouseDown:F}:{onClick:F,onPointerDown(L){L.preventDefault()}},H],stateAttributesMapping:y8})});var S3=P(v(),1);var cq=P(d(),1),ml={...y8,...m5},BP=S3.forwardRef(function(Z,J){let{render:Q,id:X,className:z,match:G,...H}=Z,Y=s0(X),{validityData:K,state:W,name:B}=R1(!1),{setMessageIds:q}=B8(),{errors:U}=i4(),F=B?U[B]:null,N=!1;if(F||G===!0)N=!0;else if(G)N=Boolean(K.state[G]);else N=K.state.valid===!1;let{mounted:L,transitionStatus:V,setMounted:M}=p4(N);q0(()=>{if(!N||!Y)return;return q((k)=>k.concat(Y)),()=>{q((k)=>k.filter((S)=>S!==Y))}},[N,Y,q]);let _=S3.useRef(null),[O,D]=S3.useState(null),[A,E]=S3.useState(null),I=F||(K.errors.length>1?cq.jsx("ul",{children:K.errors.map((k)=>cq.jsx("li",{children:k},k))}):K.error),y=K.error;if(F!=null)y=Array.isArray(F)?JSON.stringify(F):F;else if(K.errors.length>1)y=JSON.stringify(K.errors);if(N&&y!==A)E(y),D(I);I1({open:N,ref:_,onComplete(){if(!N)M(!1)}});let C={...W,transitionStatus:V},h=W0("div",Z,{ref:[J,_],state:C,props:[{id:Y,children:N?I:O},H],stateAttributesMapping:ml,enabled:L});if(!L)return null;return h});var qP=P(v(),1);var UP=qP.forwardRef(function(Z,J){let{render:Q,id:X,className:z,...G}=Z,H=s0(X),Y=R1(!1),{setMessageIds:K}=B8();return q0(()=>{if(!H)return;return K((B)=>B.concat(H)),()=>{K((B)=>B.filter((q)=>q!==H))}},[H,K]),W0("p",Z,{ref:J,state:Y.state,props:[{id:H},G],stateAttributesMapping:y8})});var SG=P(v(),1);var k3=P(v(),1);function r4({controlled:$,default:Z,name:J,state:Q="value"}){let{current:X}=k3.useRef($!==void 0),[z,G]=k3.useState(Z),H=X?$:z,Y=k3.useCallback((K)=>{if(!X)G(K)},[]);return[H,Y]}var yJ=P(v(),1);function J$($={}){let{id:Z,implicit:J=!1,controlRef:Q}=$,{controlId:X,registerControlId:z}=B8(),G=s0(Z),H=J?X:void 0,Y=T5(()=>Symbol("labelable-control")),K=yJ.useRef(!1),W=yJ.useRef(Z!=null),B=U0(()=>{if(!K.current||z===f5)return;K.current=!1,z(Y.current,void 0)});return q0(()=>{if(z===f5)return;let q;if(J){let U=Q?.current;if(_5(U)&&U.closest("label")!=null)q=Z??null;else q=H??G}else if(Z!=null)W.current=!0,q=Z;else if(W.current)q=G;else{B();return}if(q===void 0){B();return}K.current=!0,z(Y.current,q);return},[Z,Q,H,z,J,G,Y,B]),yJ.useEffect(()=>{return B},[B]),X??G}var FP=P(G4(),1);function Q$($){let{enabled:Z=!0,value:J,id:Q,name:X,controlRef:z,commit:G}=$,{formRef:H}=i4(),{invalid:Y,markedDirtyRef:K,validityData:W,setValidityData:B}=R1(),q=U0($.getValue);q0(()=>{if(!Z)return;let U=J;if(U===void 0)U=q();if(W.initialValue===null&&U!==null)B((F)=>({...F,initialValue:U}))},[Z,B,J,W.initialValue,q]),q0(()=>{if(!Z||!Q)return;H.current.fields.set(Q,{getValue:q,name:X,controlRef:z,validityData:C3(W,Y),validate(U=!0){let F=J;if(F===void 0)F=q();if(K.current=!0,!U)G(F);else FP.flushSync(()=>G(F))}})},[G,z,Z,H,q,Q,Y,K,X,W,J]),q0(()=>{let U=H.current.fields;return()=>{if(Q)U.delete(Q)}},[H,Q])}var NP=SG.forwardRef(function(Z,J){let{render:Q,className:X,id:z,name:G,value:H,disabled:Y=!1,onValueChange:K,defaultValue:W,autoFocus:B=!1,...q}=Z,{state:U,name:F,disabled:N,setTouched:L,setDirty:V,validityData:M,setFocused:_,setFilled:O,validationMode:D,validation:A}=R1(),E=N||Y,I=F??G,y={...U,disabled:E},{labelId:C}=B8(),h=J$({id:z});q0(()=>{let b=H!=null;if(A.inputRef.current?.value||b&&H!=="")O(!0);else if(b&&H==="")O(!1)},[A.inputRef,O,H]);let k=SG.useRef(null);q0(()=>{if(B&&k.current===r5(p0(k.current)))_(!0)},[B,_]);let[S]=r4({controlled:H,default:W,name:"FieldControl",state:"value"}),w=H!==void 0,T=w?S:void 0;return Q$({id:h,name:I,commit:A.commit,value:T,getValue:()=>A.inputRef.current?.value,controlRef:A.inputRef}),W0("input",Z,{ref:[J,k],state:y,props:[{id:h,disabled:E,name:I,ref:A.inputRef,"aria-labelledby":C,autoFocus:B,...w?{value:T}:{defaultValue:W},onChange(b){let g=b.currentTarget.value;K?.(g,D0(K0.none,b.nativeEvent)),V(g!==M.initialValue),O(g!=="")},onFocus(){_(!0)},onBlur(b){if(L(!0),_(!1),D==="onBlur")A.commit(b.currentTarget.value)},onKeyDown(b){if(b.currentTarget.tagName==="INPUT"&&b.key==="Enter")L(!0),A.commit(b.currentTarget.value)}},A.getInputValidationProps(),q],stateAttributesMapping:y8})});var bJ=P(v(),1);var VP=P(d(),1),LP=function(Z){let{children:J}=Z,{validityData:Q,invalid:X}=R1(!1),z=bJ.useMemo(()=>C3(Q,X),[Q,X]),G=z.state.valid===!1,{transitionStatus:H}=p4(G),Y=bJ.useMemo(()=>{return{...z,validity:z.state,transitionStatus:H}},[z,H]);return VP.jsx(bJ.Fragment,{children:J(Y)})};var IG=P(v(),1);var dq=P(v(),1),MP=dq.createContext({disabled:!1});var kG=P(v(),1),pl=kG.createContext(void 0);function AP($=!0){let Z=kG.useContext(pl);if(Z===void 0&&!$)throw Error(C0(3));return Z}var lq=P(d(),1),_P=IG.forwardRef(function(Z,J){let{render:Q,className:X,disabled:z=!1,...G}=Z,{state:H,disabled:Y}=R1(!1),K=Y||z,W=AP(),B=W?.parent.id,U=W?.allValues!==void 0?B:void 0,F=IG.useMemo(()=>({disabled:K}),[K]),N=W0("div",Z,{ref:J,state:H,props:G,stateAttributesMapping:y8});return lq.jsx(TG,{initialControlId:U,children:lq.jsx(MP.Provider,{value:F,children:N})})});var OP=P(d(),1),iq=DP.forwardRef(function(Z,J){return OP.jsx(RG.Control,{ref:J,...Z})});var PP=P(d(),1);function X6({className:$,type:Z,...J}){return PP.jsx(iq,{type:Z,"data-slot":"input",className:s("h-8 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-sm 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 wP($){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 X$=["claude-code","codex","openclaw","hermes"];var kP=P(v(),1);var jP="/claude-z2xnay0d.svg";var TP="/hermes-pznd63x9.png";var CP="/openai-ep9ht2pq.svg";var EP="/openclaw-a2pyfhpn.svg";var rq=P(d(),1),V2={"claude-code":jP,openclaw:EP,codex:CP,hermes:TP},aq={"claude-code":"Claude Code",openclaw:"OpenClaw",codex:"Codex",hermes:"Hermes"};function SP({types:$}){let Z=$.map((J)=>aq[J]).join(", ");return rq.jsx("span",{role:"img","aria-label":Z,className:"inline-flex shrink-0 items-center -space-x-0.5",children:$.map((J)=>rq.jsx("img",{src:V2[J],alt:"",className:"size-4 shrink-0 rounded-full bg-muted ring-2 ring-muted"},J))})}function I3($){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 Y1=P(d(),1),il="Choose which agent moi will use to build your workspace",rl={openclaw:`Initialize OpenClaw in the folder
22
+ manually, then import it to moi`,hermes:`Create a Hermes profile with
23
+ hermes profile create, then import it`},al={"claude-code":"Anthropic",codex:"OpenAI",openclaw:"Open-source",hermes:"Nous Research"};function nl({availability:$,detectedTypes:Z=[]}){return X$.map((J)=>{let Q=$?.[J],X=Q?.available===!1?Q.reason:void 0,z=!Z.includes(J)?rl[J]:void 0,G=X??z;return{type:J,description:al[J],disabled:Boolean(G),...G?{disabledReason:G}:{}}})}function ol($,Z){let J=$.find((Q)=>Q.type===Z);if(J&&!J.disabled)return J.type;return $.find((Q)=>!Q.disabled)?.type}function bG({title:$,selectedType:Z,detectedTypes:J,availability:Q,isPending:X,errorMessage:z,secondaryAction:G,primaryLabel:H,pendingLabel:Y,onTypeChange:K,onSubmit:W}){let B=D1((L)=>L.hasSentMessageFromMoi),q=nl({availability:Q,detectedTypes:J}),U=ol(q,Z),F=U!==Z,N=U==="claude-code"?"Tip: you can use your existing Claude subscription in moi":U==="codex"?"Tip: you can use your existing ChatGPT subscription in moi":void 0;return kP.useEffect(()=>{if(U&&F)K(U)},[K,U,F]),Y1.jsxs("div",{className:"flex flex-col gap-5",children:[Y1.jsxs("div",{className:"flex flex-col gap-0.5 pr-8",children:[Y1.jsx(Z$,{children:$}),Y1.jsx(DG,{children:il})]}),Y1.jsxs("div",{className:"flex flex-col gap-4",children:[Y1.jsx(sl,{options:q,selectedType:F?void 0:Z,onTypeChange:K}),!B&&N&&Y1.jsx("p",{className:"text-sm text-muted-foreground",children:N})]}),z&&Y1.jsx("p",{role:"alert",className:"text-xs text-destructive",children:z}),Y1.jsxs("div",{className:"flex items-center justify-end gap-2",children:[G,Y1.jsx(k0,{onClick:W,disabled:X||F,children:X&&Y?Y:H})]})]})}function sl({options:$,selectedType:Z,onTypeChange:J}){return Y1.jsx("div",{role:"group","aria-label":"Agent",className:s("grid gap-2",$.length>2?"grid-cols-3":"grid-cols-2"),children:$.map((Q)=>Y1.jsx(tl,{option:Q,selected:Z===Q.type,onSelect:J},Q.type))})}function tl({option:$,selected:Z,onSelect:J}){let Q=Boolean($.disabledReason),X=Y1.jsxs("button",{type:"button",disabled:$.disabled&&!Q,"aria-disabled":$.disabled||void 0,"aria-pressed":Z,onClick:(z)=>{if($.disabled){z.preventDefault();return}J($.type)},className:s("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:[Y1.jsxs("span",{className:"relative inline-flex",children:[Y1.jsx(el,{type:$.type}),Z&&Y1.jsx(yG,{size:16,stroke:1.75,"aria-hidden":"true",className:"absolute -top-1.5 -right-1.5"})]}),Y1.jsxs("span",{className:"flex min-w-0 flex-col gap-0.5",children:[Y1.jsx("span",{className:"text-sm font-medium text-foreground",children:aq[$.type]}),Y1.jsx("span",{className:"text-xs leading-4 text-muted-foreground",children:$.description})]})]});if(!Q)return X;return Y1.jsxs(M1,{children:[Y1.jsx(A1,{render:X}),Y1.jsx(_1,{className:"max-w-64 text-center whitespace-pre-line",children:$.disabledReason})]})}function el({type:$}){return Y1.jsx("img",{src:V2[$],alt:"",className:"size-8 shrink-0"})}var z$=P(d(),1);function xG({children:$,closeDisabled:Z=!1}){return z$.jsxs(_G,{className:"w-[calc(100%-2rem)] max-w-md p-6",children:[z$.jsx(AG,{render:z$.jsx(k0,{variant:"ghost",size:"icon-sm","aria-label":"Close",className:"absolute top-4 right-4",disabled:Z,children:z$.jsx(m1,{stroke:1.75})})}),$]})}var K1=P(d(),1),IP=X$[0];function hJ({trigger:$}){let[,Z]=g4(),J=BG(),Q=TO(),[X,z]=xJ.useState(!1),[G,H]=xJ.useState("agent"),[Y,K]=xJ.useState(IP),[W,B]=xJ.useState(""),q=W.trim(),U=q?wP(q):null,F=Q.isPending;function N(_){z(!1),Z(`/workspace/${_}`)}function L(){H("agent"),K(IP),B(""),Q.reset()}function V(){Q.reset(),H("name")}function M(){if(!q||U||F)return;Q.reset(),Q.mutate({name:q,type:Y},{onSuccess:(_)=>N(_.id)})}return K1.jsxs($$,{open:X,onOpenChange:z,onOpenChangeComplete:(_)=>{if(!_)L()},children:[K1.jsx(zP,{render:$}),K1.jsx(xG,{children:G==="agent"?K1.jsx(bG,{title:"Create new workspace",selectedType:Y,availability:J.data?.availability,isPending:!1,secondaryAction:K1.jsx(Zi,{}),primaryLabel:"Next",onTypeChange:K,onSubmit:V}):K1.jsx($i,{name:W,validationError:U,requestError:Q.error?.message,isPending:F,onNameChange:B,onSubmit:M})})]})}function $i({name:$,validationError:Z,requestError:J,isPending:Q,onNameChange:X,onSubmit:z}){function G(H){H.preventDefault(),z()}return K1.jsxs("form",{className:"flex flex-col gap-5",onSubmit:G,children:[K1.jsxs("div",{className:"flex flex-col gap-0.5 pr-8",children:[K1.jsx(Z$,{children:"Create new workspace"}),K1.jsx(DG,{children:"Give it a short and recognizable name"})]}),K1.jsxs("div",{className:"flex flex-col gap-2",children:[K1.jsx("label",{htmlFor:"workspace-name",className:"sr-only",children:"Workspace name"}),K1.jsx(X6,{id:"workspace-name",value:$,onChange:(H)=>X(H.target.value),placeholder:"my-workspace",autoFocus:!0,"aria-invalid":Boolean(Z),"aria-describedby":Z?"workspace-name-error":void 0,autoComplete:"off",spellCheck:!1}),Z&&K1.jsx("p",{id:"workspace-name-error",role:"alert",className:"text-xs text-destructive",children:Z})]}),J&&K1.jsx("p",{role:"alert",className:"text-xs text-destructive",children:J}),K1.jsx("div",{className:"flex items-center justify-end gap-2",children:K1.jsx(k0,{type:"submit",disabled:!$.trim()||Boolean(Z)||Q,children:Q?"Creating…":"Create workspace"})})]})}function Zi(){return K1.jsxs(M1,{children:[K1.jsx(A1,{render:K1.jsx(k0,{variant:"secondary","aria-disabled":!0,onClick:(Z)=>Z.preventDefault(),className:"cursor-not-allowed opacity-50",children:"Use existing folder"})}),K1.jsx(_1,{className:"max-w-64",children:K1.jsxs("span",{className:"text-center",children:["Not supported yet — run"," ",K1.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 G6=P(v(),1);var F0=P(v(),1),h3=P(G4(),1);var a1=P(v(),1);var gJ=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function R3($){let Z=Object.prototype.toString.call($);return Z==="[object Window]"||Z==="[object global]"}function hG($){return"nodeType"in $}function b8($){var Z,J;if(!$)return window;if(R3($))return $;if(!hG($))return window;return(Z=(J=$.ownerDocument)==null?void 0:J.defaultView)!=null?Z:window}function gG($){let{Document:Z}=b8($);return $ instanceof Z}function H$($){if(R3($))return!1;return $ instanceof b8($).HTMLElement}function oq($){return $ instanceof b8($).SVGElement}function y3($){if(!$)return document;if(R3($))return $.document;if(!hG($))return document;if(gG($))return $;if(H$($)||oq($))return $.ownerDocument;return document}var t2=gJ?a1.useLayoutEffect:a1.useEffect;function vJ($){let Z=a1.useRef($);return t2(()=>{Z.current=$}),a1.useCallback(function(){for(var J=arguments.length,Q=Array(J),X=0;X<J;X++)Q[X]=arguments[X];return Z.current==null?void 0:Z.current(...Q)},[])}function yP(){let $=a1.useRef(null),Z=a1.useCallback((Q,X)=>{$.current=setInterval(Q,X)},[]),J=a1.useCallback(()=>{if($.current!==null)clearInterval($.current),$.current=null},[]);return[Z,J]}function Y$($,Z){if(Z===void 0)Z=[$];let J=a1.useRef($);return t2(()=>{if(J.current!==$)J.current=$},Z),J}function K$($,Z){let J=a1.useRef();return a1.useMemo(()=>{let Q=$(J.current);return J.current=Q,Q},[...Z])}function fJ($){let Z=vJ($),J=a1.useRef(null),Q=a1.useCallback((X)=>{if(X!==J.current)Z==null||Z(X,J.current);J.current=X},[]);return[J,Q]}function mJ($){let Z=a1.useRef();return a1.useEffect(()=>{Z.current=$},[$]),Z.current}var nq={};function pJ($,Z){return a1.useMemo(()=>{if(Z)return Z;let J=nq[$]==null?0:nq[$]+1;return nq[$]=J,$+"-"+J},[$,Z])}function bP($){return function(Z){for(var J=arguments.length,Q=Array(J>1?J-1:0),X=1;X<J;X++)Q[X-1]=arguments[X];return Q.reduce((z,G)=>{let H=Object.entries(G);for(let[Y,K]of H){let W=z[Y];if(W!=null)z[Y]=W+$*K}return z},{...Z})}}var b3=bP(1),uJ=bP(-1);function Ji($){return"clientX"in $&&"clientY"in $}function vG($){if(!$)return!1;let{KeyboardEvent:Z}=b8($.target);return Z&&$ instanceof Z}function Qi($){if(!$)return!1;let{TouchEvent:Z}=b8($.target);return Z&&$ instanceof Z}function cJ($){if(Qi($)){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(Ji($))return{x:$.clientX,y:$.clientY};return null}var G$=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[G$.Translate.toString($),G$.Scale.toString($)].join(" ")}},Transition:{toString($){let{property:Z,duration:J,easing:Q}=$;return Z+" "+J+"ms "+Q}}}),RP="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function xP($){if($.matches(RP))return $;return $.querySelector(RP)}var x3=P(v(),1),Xi={display:"none"};function hP($){let{id:Z,value:J}=$;return x3.default.createElement("div",{id:Z,style:Xi},J)}function gP($){let{id:Z,announcement:J,ariaLiveType:Q="assertive"}=$,X={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 x3.default.createElement("div",{id:Z,style:X,role:"status","aria-live":Q,"aria-atomic":!0},J)}function vP(){let[$,Z]=x3.useState("");return{announce:x3.useCallback((Q)=>{if(Q!=null)Z(Q)},[]),announcement:$}}var sP=F0.createContext(null);function zi($){let Z=F0.useContext(sP);F0.useEffect(()=>{if(!Z)throw Error("useDndMonitor must be used within a children of <DndContext>");return Z($)},[$,Z])}function Gi(){let[$]=F0.useState(()=>new Set),Z=F0.useCallback((Q)=>{return $.add(Q),()=>$.delete(Q)},[$]);return[F0.useCallback((Q)=>{let{type:X,event:z}=Q;$.forEach((G)=>{var H;return(H=G[X])==null?void 0:H.call(G,z)})},[$]),Z]}var Hi={draggable:`
24
+ To pick up a draggable item, press the space bar.
25
+ While dragging, use the arrow keys to move the item.
26
+ Press space again to drop the item in its new position, or press escape to cancel.
27
+ `},Yi={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 Ki($){let{announcements:Z=Yi,container:J,hiddenTextDescribedById:Q,screenReaderInstructions:X=Hi}=$,{announce:z,announcement:G}=vP(),H=pJ("DndLiveRegion"),[Y,K]=F0.useState(!1);if(F0.useEffect(()=>{K(!0)},[]),zi(F0.useMemo(()=>({onDragStart(B){let{active:q}=B;z(Z.onDragStart({active:q}))},onDragMove(B){let{active:q,over:U}=B;if(Z.onDragMove)z(Z.onDragMove({active:q,over:U}))},onDragOver(B){let{active:q,over:U}=B;z(Z.onDragOver({active:q,over:U}))},onDragEnd(B){let{active:q,over:U}=B;z(Z.onDragEnd({active:q,over:U}))},onDragCancel(B){let{active:q,over:U}=B;z(Z.onDragCancel({active:q,over:U}))}}),[z,Z])),!Y)return null;let W=F0.default.createElement(F0.default.Fragment,null,F0.default.createElement(hP,{id:Q,value:X.draggable}),F0.default.createElement(gP,{id:H,announcement:G}));return J?h3.createPortal(W,J):W}var J8;(function($){$.DragStart="dragStart",$.DragMove="dragMove",$.DragEnd="dragEnd",$.DragCancel="dragCancel",$.DragOver="dragOver",$.RegisterDroppable="registerDroppable",$.SetDroppableDisabled="setDroppableDisabled",$.UnregisterDroppable="unregisterDroppable"})(J8||(J8={}));function mG(){}function QU($,Z){return F0.useMemo(()=>({sensor:$,options:Z!=null?Z:{}}),[$,Z])}function tP(){for(var $=arguments.length,Z=Array($),J=0;J<$;J++)Z[J]=arguments[J];return F0.useMemo(()=>[...Z].filter((Q)=>Q!=null),[...Z])}var L2=Object.freeze({x:0,y:0});function Wi($,Z){return Math.sqrt(Math.pow($.x-Z.x,2)+Math.pow($.y-Z.y,2))}function Bi($,Z){let J=cJ($);if(!J)return"0 0";let Q={x:(J.x-Z.left)/Z.width*100,y:(J.y-Z.top)/Z.height*100};return Q.x+"% "+Q.y+"%"}function qi($,Z){let{data:{value:J}}=$,{data:{value:Q}}=Z;return J-Q}function Ui($,Z){let{data:{value:J}}=$,{data:{value:Q}}=Z;return Q-J}function Fi($,Z){if(!$||$.length===0)return null;let[J]=$;return Z?J[Z]:J}function fP($,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 eP=($)=>{let{collisionRect:Z,droppableRects:J,droppableContainers:Q}=$,X=fP(Z,Z.left,Z.top),z=[];for(let G of Q){let{id:H}=G,Y=J.get(H);if(Y){let K=Wi(fP(Y),X);z.push({id:H,data:{droppableContainer:G,value:K}})}}return z.sort(qi)};function Ni($,Z){let J=Math.max(Z.top,$.top),Q=Math.max(Z.left,$.left),X=Math.min(Z.left+Z.width,$.left+$.width),z=Math.min(Z.top+Z.height,$.top+$.height),G=X-Q,H=z-J;if(Q<X&&J<z){let Y=Z.width*Z.height,K=$.width*$.height,W=G*H,B=W/(Y+K-W);return Number(B.toFixed(4))}return 0}var Vi=($)=>{let{collisionRect:Z,droppableRects:J,droppableContainers:Q}=$,X=[];for(let z of Q){let{id:G}=z,H=J.get(G);if(H){let Y=Ni(H,Z);if(Y>0)X.push({id:G,data:{droppableContainer:z,value:Y}})}}return X.sort(Ui)};function Li($,Z,J){return{...$,scaleX:Z&&J?Z.width/J.width:1,scaleY:Z&&J?Z.height/J.height:1}}function $w($,Z){return $&&Z?{x:$.left-Z.left,y:$.top-Z.top}:L2}function Mi($){return function(J){for(var Q=arguments.length,X=Array(Q>1?Q-1:0),z=1;z<Q;z++)X[z-1]=arguments[z];return X.reduce((G,H)=>({...G,top:G.top+$*H.y,bottom:G.bottom+$*H.y,left:G.left+$*H.x,right:G.right+$*H.x}),{...J})}}var Ai=Mi(1);function Zw($){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 _i($,Z,J){let Q=Zw(Z);if(!Q)return $;let{scaleX:X,scaleY:z,x:G,y:H}=Q,Y=$.left-G-(1-X)*parseFloat(J),K=$.top-H-(1-z)*parseFloat(J.slice(J.indexOf(" ")+1)),W=X?$.width/X:$.width,B=z?$.height/z:$.height;return{width:W,height:B,top:K,right:Y+W,bottom:K+B,left:Y}}var Di={ignoreTransform:!1};function iJ($,Z){if(Z===void 0)Z=Di;let J=$.getBoundingClientRect();if(Z.ignoreTransform){let{transform:K,transformOrigin:W}=b8($).getComputedStyle($);if(K)J=_i(J,K,W)}let{top:Q,left:X,width:z,height:G,bottom:H,right:Y}=J;return{top:Q,left:X,width:z,height:G,bottom:H,right:Y}}function mP($){return iJ($,{ignoreTransform:!0})}function Oi($){let{innerWidth:Z,innerHeight:J}=$;return{top:0,left:0,right:Z,bottom:J,width:Z,height:J}}function Pi($,Z){if(Z===void 0)Z=b8($).getComputedStyle($);return Z.position==="fixed"}function wi($,Z){if(Z===void 0)Z=b8($).getComputedStyle($);let J=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some((X)=>{let z=Z[X];return typeof z==="string"?J.test(z):!1})}function XU($,Z){let J=[];function Q(X){if(Z!=null&&J.length>=Z)return J;if(!X)return J;if(gG(X)&&X.scrollingElement!=null&&!J.includes(X.scrollingElement))return J.push(X.scrollingElement),J;if(!H$(X)||oq(X))return J;if(J.includes(X))return J;let z=b8($).getComputedStyle(X);if(X!==$){if(wi(X,z))J.push(X)}if(Pi(X,z))return J;return Q(X.parentNode)}if(!$)return J;return Q($)}function Jw($){let[Z]=XU($,1);return Z!=null?Z:null}function sq($){if(!gJ||!$)return null;if(R3($))return $;if(!hG($))return null;if(gG($)||$===y3($).scrollingElement)return window;if(H$($))return $;return null}function Qw($){if(R3($))return $.scrollX;return $.scrollLeft}function Xw($){if(R3($))return $.scrollY;return $.scrollTop}function $U($){return{x:Qw($),y:Xw($)}}var U8;(function($){$[$.Forward=1]="Forward",$[$.Backward=-1]="Backward"})(U8||(U8={}));function zw($){if(!gJ||!$)return!1;return $===document.scrollingElement}function Gw($){let Z={x:0,y:0},J=zw($)?{height:window.innerHeight,width:window.innerWidth}:{height:$.clientHeight,width:$.clientWidth},Q={x:$.scrollWidth-J.width,y:$.scrollHeight-J.height},X=$.scrollTop<=Z.y,z=$.scrollLeft<=Z.x,G=$.scrollTop>=Q.y,H=$.scrollLeft>=Q.x;return{isTop:X,isLeft:z,isBottom:G,isRight:H,maxScroll:Q,minScroll:Z}}var ji={x:0.2,y:0.2};function Ti($,Z,J,Q,X){let{top:z,left:G,right:H,bottom:Y}=J;if(Q===void 0)Q=10;if(X===void 0)X=ji;let{isTop:K,isBottom:W,isLeft:B,isRight:q}=Gw($),U={x:0,y:0},F={x:0,y:0},N={height:Z.height*X.y,width:Z.width*X.x};if(!K&&z<=Z.top+N.height)U.y=U8.Backward,F.y=Q*Math.abs((Z.top+N.height-z)/N.height);else if(!W&&Y>=Z.bottom-N.height)U.y=U8.Forward,F.y=Q*Math.abs((Z.bottom-N.height-Y)/N.height);if(!q&&H>=Z.right-N.width)U.x=U8.Forward,F.x=Q*Math.abs((Z.right-N.width-H)/N.width);else if(!B&&G<=Z.left+N.width)U.x=U8.Backward,F.x=Q*Math.abs((Z.left+N.width-G)/N.width);return{direction:U,speed:F}}function Ci($){if($===document.scrollingElement){let{innerWidth:z,innerHeight:G}=window;return{top:0,left:0,right:z,bottom:G,width:z,height:G}}let{top:Z,left:J,right:Q,bottom:X}=$.getBoundingClientRect();return{top:Z,left:J,right:Q,bottom:X,width:$.clientWidth,height:$.clientHeight}}function Hw($){return $.reduce((Z,J)=>{return b3(Z,$U(J))},L2)}function Ei($){return $.reduce((Z,J)=>{return Z+Qw(J)},0)}function Si($){return $.reduce((Z,J)=>{return Z+Xw(J)},0)}function Yw($,Z){if(Z===void 0)Z=iJ;if(!$)return;let{top:J,left:Q,bottom:X,right:z}=Z($);if(!Jw($))return;if(X<=0||z<=0||J>=window.innerHeight||Q>=window.innerWidth)$.scrollIntoView({block:"center",inline:"center"})}var ki=[["x",["left","right"],Ei],["y",["top","bottom"],Si]];class uG{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=XU(Z),Q=Hw(J);this.rect={...$},this.width=$.width,this.height=$.height;for(let[X,z,G]of ki)for(let H of z)Object.defineProperty(this,H,{get:()=>{let Y=G(J),K=Q[X]-Y;return this.rect[H]+K},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class W${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 Q;(Q=this.target)==null||Q.addEventListener($,Z,J),this.listeners.push([$,Z,J])}}function Ii($){let{EventTarget:Z}=b8($);return $ instanceof Z?$:y3($)}function tq($,Z){let J=Math.abs($.x),Q=Math.abs($.y);if(typeof Z==="number")return Math.sqrt(J**2+Q**2)>Z;if("x"in Z&&"y"in Z)return J>Z.x&&Q>Z.y;if("x"in Z)return J>Z.x;if("y"in Z)return Q>Z.y;return!1}var a4;(function($){$.Click="click",$.DragStart="dragstart",$.Keydown="keydown",$.ContextMenu="contextmenu",$.Resize="resize",$.SelectionChange="selectionchange",$.VisibilityChange="visibilitychange"})(a4||(a4={}));function pP($){$.preventDefault()}function Ri($){$.stopPropagation()}var b5;(function($){$.Space="Space",$.Down="ArrowDown",$.Right="ArrowRight",$.Left="ArrowLeft",$.Up="ArrowUp",$.Esc="Escape",$.Enter="Enter",$.Tab="Tab"})(b5||(b5={}));var Kw={start:[b5.Space,b5.Enter],cancel:[b5.Esc],end:[b5.Space,b5.Enter,b5.Tab]},yi=($,Z)=>{let{currentCoordinates:J}=Z;switch($.code){case b5.Right:return{...J,x:J.x+25};case b5.Left:return{...J,x:J.x-25};case b5.Down:return{...J,y:J.y+25};case b5.Up:return{...J,y:J.y-25}}return};class rJ{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 W$(y3(Z)),this.windowListeners=new W$(b8(Z)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(a4.Resize,this.handleCancel),this.windowListeners.add(a4.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(a4.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:$,onStart:Z}=this.props,J=$.node.current;if(J)Yw(J);Z(L2)}handleKeyDown($){if(vG($)){let{active:Z,context:J,options:Q}=this.props,{keyboardCodes:X=Kw,coordinateGetter:z=yi,scrollBehavior:G="smooth"}=Q,{code:H}=$;if(X.end.includes(H)){this.handleEnd($);return}if(X.cancel.includes(H)){this.handleCancel($);return}let{collisionRect:Y}=J.current,K=Y?{x:Y.left,y:Y.top}:L2;if(!this.referenceCoordinates)this.referenceCoordinates=K;let W=z($,{active:Z,context:J.current,currentCoordinates:K});if(W){let B=uJ(W,K),q={x:0,y:0},{scrollableAncestors:U}=J.current;for(let F of U){let N=$.code,{isTop:L,isRight:V,isLeft:M,isBottom:_,maxScroll:O,minScroll:D}=Gw(F),A=Ci(F),E={x:Math.min(N===b5.Right?A.right-A.width/2:A.right,Math.max(N===b5.Right?A.left:A.left+A.width/2,W.x)),y:Math.min(N===b5.Down?A.bottom-A.height/2:A.bottom,Math.max(N===b5.Down?A.top:A.top+A.height/2,W.y))},I=N===b5.Right&&!V||N===b5.Left&&!M,y=N===b5.Down&&!_||N===b5.Up&&!L;if(I&&E.x!==W.x){let C=F.scrollLeft+B.x,h=N===b5.Right&&C<=O.x||N===b5.Left&&C>=D.x;if(h&&!B.y){F.scrollTo({left:C,behavior:G});return}if(h)q.x=F.scrollLeft-C;else q.x=N===b5.Right?F.scrollLeft-O.x:F.scrollLeft-D.x;if(q.x)F.scrollBy({left:-q.x,behavior:G});break}else if(y&&E.y!==W.y){let C=F.scrollTop+B.y,h=N===b5.Down&&C<=O.y||N===b5.Up&&C>=D.y;if(h&&!B.x){F.scrollTo({top:C,behavior:G});return}if(h)q.y=F.scrollTop-C;else q.y=N===b5.Down?F.scrollTop-O.y:F.scrollTop-D.y;if(q.y)F.scrollBy({top:-q.y,behavior:G});break}}this.handleMove($,b3(uJ(W,this.referenceCoordinates),q))}}}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()}}rJ.activators=[{eventName:"onKeyDown",handler:($,Z,J)=>{let{keyboardCodes:Q=Kw,onActivation:X}=Z,{active:z}=J,{code:G}=$.nativeEvent;if(Q.start.includes(G)){let H=z.activatorNode.current;if(H&&$.target!==H)return!1;return $.preventDefault(),X==null||X({event:$.nativeEvent}),!0}return!1}}];function uP($){return Boolean($&&"distance"in $)}function cP($){return Boolean($&&"delay"in $)}class cG{constructor($,Z,J){var Q;if(J===void 0)J=Ii($.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:X}=$,{target:z}=X;this.props=$,this.events=Z,this.document=y3(z),this.documentListeners=new W$(this.document),this.listeners=new W$(J),this.windowListeners=new W$(b8(z)),this.initialCoordinates=(Q=cJ(X))!=null?Q:L2,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(a4.Resize,this.handleCancel),this.windowListeners.add(a4.DragStart,pP),this.windowListeners.add(a4.VisibilityChange,this.handleCancel),this.windowListeners.add(a4.ContextMenu,pP),this.documentListeners.add(a4.Keydown,this.handleKeydown),Z){if(J!=null&&J({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(cP(Z)){this.timeoutId=setTimeout(this.handleStart,Z.delay),this.handlePending(Z);return}if(uP(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:Q}=this.props;Q(J,$,this.initialCoordinates,Z)}handleStart(){let{initialCoordinates:$}=this,{onStart:Z}=this.props;if($)this.activated=!0,this.documentListeners.add(a4.Click,Ri,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(a4.SelectionChange,this.removeTextSelection),Z($)}handleMove($){var Z;let{activated:J,initialCoordinates:Q,props:X}=this,{onMove:z,options:{activationConstraint:G}}=X;if(!Q)return;let H=(Z=cJ($))!=null?Z:L2,Y=uJ(Q,H);if(!J&&G){if(uP(G)){if(G.tolerance!=null&&tq(Y,G.tolerance))return this.handleCancel();if(tq(Y,G.distance))return this.handleStart()}if(cP(G)){if(tq(Y,G.tolerance))return this.handleCancel()}this.handlePending(G,Y);return}if($.cancelable)$.preventDefault();z(H)}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===b5.Esc)this.handleCancel()}removeTextSelection(){var $;($=this.document.getSelection())==null||$.removeAllRanges()}}var bi={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class aJ extends cG{constructor($){let{event:Z}=$,J=y3(Z.target);super($,bi,J)}}aJ.activators=[{eventName:"onPointerDown",handler:($,Z)=>{let{nativeEvent:J}=$,{onActivation:Q}=Z;if(!J.isPrimary||J.button!==0)return!1;return Q==null||Q({event:J}),!0}}];var xi={move:{name:"mousemove"},end:{name:"mouseup"}},ZU;(function($){$[$.RightClick=2]="RightClick"})(ZU||(ZU={}));class Ww extends cG{constructor($){super($,xi,y3($.event.target))}}Ww.activators=[{eventName:"onMouseDown",handler:($,Z)=>{let{nativeEvent:J}=$,{onActivation:Q}=Z;if(J.button===ZU.RightClick)return!1;return Q==null||Q({event:J}),!0}}];var eq={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class Bw extends cG{constructor($){super($,eq)}static setup(){return window.addEventListener(eq.move.name,$,{capture:!1,passive:!1}),function(){window.removeEventListener(eq.move.name,$)};function $(){}}}Bw.activators=[{eventName:"onTouchStart",handler:($,Z)=>{let{nativeEvent:J}=$,{onActivation:Q}=Z,{touches:X}=J;if(X.length>1)return!1;return Q==null||Q({event:J}),!0}}];var dJ;(function($){$[$.Pointer=0]="Pointer",$[$.DraggableRect=1]="DraggableRect"})(dJ||(dJ={}));var pG;(function($){$[$.TreeOrder=0]="TreeOrder",$[$.ReversedTreeOrder=1]="ReversedTreeOrder"})(pG||(pG={}));function hi($){let{acceleration:Z,activator:J=dJ.Pointer,canScroll:Q,draggingRect:X,enabled:z,interval:G=5,order:H=pG.TreeOrder,pointerCoordinates:Y,scrollableAncestors:K,scrollableAncestorRects:W,delta:B,threshold:q}=$,U=vi({delta:B,disabled:!z}),[F,N]=yP(),L=F0.useRef({x:0,y:0}),V=F0.useRef({x:0,y:0}),M=F0.useMemo(()=>{switch(J){case dJ.Pointer:return Y?{top:Y.y,bottom:Y.y,left:Y.x,right:Y.x}:null;case dJ.DraggableRect:return X}},[J,X,Y]),_=F0.useRef(null),O=F0.useCallback(()=>{let A=_.current;if(!A)return;let E=L.current.x*V.current.x,I=L.current.y*V.current.y;A.scrollBy(E,I)},[]),D=F0.useMemo(()=>H===pG.TreeOrder?[...K].reverse():K,[H,K]);F0.useEffect(()=>{if(!z||!K.length||!M){N();return}for(let A of D){if((Q==null?void 0:Q(A))===!1)continue;let E=K.indexOf(A),I=W[E];if(!I)continue;let{direction:y,speed:C}=Ti(A,I,M,Z,q);for(let h of["x","y"])if(!U[h][y[h]])C[h]=0,y[h]=0;if(C.x>0||C.y>0){N(),_.current=A,F(O,G),L.current=C,V.current=y;return}}L.current={x:0,y:0},V.current={x:0,y:0},N()},[Z,O,Q,N,z,G,JSON.stringify(M),JSON.stringify(U),F,K,D,W,JSON.stringify(q)])}var gi={x:{[U8.Backward]:!1,[U8.Forward]:!1},y:{[U8.Backward]:!1,[U8.Forward]:!1}};function vi($){let{delta:Z,disabled:J}=$,Q=mJ(Z);return K$((X)=>{if(J||!Q||!X)return gi;let z={x:Math.sign(Z.x-Q.x),y:Math.sign(Z.y-Q.y)};return{x:{[U8.Backward]:X.x[U8.Backward]||z.x===-1,[U8.Forward]:X.x[U8.Forward]||z.x===1},y:{[U8.Backward]:X.y[U8.Backward]||z.y===-1,[U8.Forward]:X.y[U8.Forward]||z.y===1}}},[J,Z,Q])}function fi($,Z){let J=Z!=null?$.get(Z):void 0,Q=J?J.node.current:null;return K$((X)=>{var z;if(Z==null)return null;return(z=Q!=null?Q:X)!=null?z:null},[Q,Z])}function mi($,Z){return F0.useMemo(()=>$.reduce((J,Q)=>{let{sensor:X}=Q,z=X.activators.map((G)=>({eventName:G.eventName,handler:Z(G.handler,Q)}));return[...J,...z]},[]),[$,Z])}var lJ;(function($){$[$.Always=0]="Always",$[$.BeforeDragging=1]="BeforeDragging",$[$.WhileDragging=2]="WhileDragging"})(lJ||(lJ={}));var JU;(function($){$.Optimized="optimized"})(JU||(JU={}));var dP=new Map;function pi($,Z){let{dragging:J,dependencies:Q,config:X}=Z,[z,G]=F0.useState(null),{frequency:H,measure:Y,strategy:K}=X,W=F0.useRef($),B=L(),q=Y$(B),U=F0.useCallback(function(V){if(V===void 0)V=[];if(q.current)return;G((M)=>{if(M===null)return V;return M.concat(V.filter((_)=>!M.includes(_)))})},[q]),F=F0.useRef(null),N=K$((V)=>{if(B&&!J)return dP;if(!V||V===dP||W.current!==$||z!=null){let M=new Map;for(let _ of $){if(!_)continue;if(z&&z.length>0&&!z.includes(_.id)&&_.rect.current){M.set(_.id,_.rect.current);continue}let O=_.node.current,D=O?new uG(Y(O),O):null;if(_.rect.current=D,D)M.set(_.id,D)}return M}return V},[$,z,J,B,Y]);return F0.useEffect(()=>{W.current=$},[$]),F0.useEffect(()=>{if(B)return;U()},[J,B]),F0.useEffect(()=>{if(z&&z.length>0)G(null)},[JSON.stringify(z)]),F0.useEffect(()=>{if(B||typeof H!=="number"||F.current!==null)return;F.current=setTimeout(()=>{U(),F.current=null},H)},[H,B,U,...Q]),{droppableRects:N,measureDroppableContainers:U,measuringScheduled:z!=null};function L(){switch(K){case lJ.Always:return!1;case lJ.BeforeDragging:return J;default:return!J}}}function zU($,Z){return K$((J)=>{if(!$)return null;if(J)return J;return typeof Z==="function"?Z($):$},[Z,$])}function ui($,Z){return zU($,Z)}function ci($){let{callback:Z,disabled:J}=$,Q=vJ(Z),X=F0.useMemo(()=>{if(J||typeof window>"u"||typeof window.MutationObserver>"u")return;let{MutationObserver:z}=window;return new z(Q)},[Q,J]);return F0.useEffect(()=>{return()=>X==null?void 0:X.disconnect()},[X]),X}function dG($){let{callback:Z,disabled:J}=$,Q=vJ(Z),X=F0.useMemo(()=>{if(J||typeof window>"u"||typeof window.ResizeObserver>"u")return;let{ResizeObserver:z}=window;return new z(Q)},[J]);return F0.useEffect(()=>{return()=>X==null?void 0:X.disconnect()},[X]),X}function di($){return new uG(iJ($),$)}function lP($,Z,J){if(Z===void 0)Z=di;let[Q,X]=F0.useState(null);function z(){X((Y)=>{if(!$)return null;if($.isConnected===!1){var K;return(K=Y!=null?Y:J)!=null?K:null}let W=Z($);if(JSON.stringify(Y)===JSON.stringify(W))return Y;return W})}let G=ci({callback(Y){if(!$)return;for(let K of Y){let{type:W,target:B}=K;if(W==="childList"&&B instanceof HTMLElement&&B.contains($)){z();break}}}}),H=dG({callback:z});return t2(()=>{if(z(),$)H==null||H.observe($),G==null||G.observe(document.body,{childList:!0,subtree:!0});else H==null||H.disconnect(),G==null||G.disconnect()},[$]),Q}function li($){let Z=zU($);return $w($,Z)}var iP=[];function ii($){let Z=F0.useRef($),J=K$((Q)=>{if(!$)return iP;if(Q&&Q!==iP&&$&&Z.current&&$.parentNode===Z.current.parentNode)return Q;return XU($)},[$]);return F0.useEffect(()=>{Z.current=$},[$]),J}function ri($){let[Z,J]=F0.useState(null),Q=F0.useRef($),X=F0.useCallback((z)=>{let G=sq(z.target);if(!G)return;J((H)=>{if(!H)return null;return H.set(G,$U(G)),new Map(H)})},[]);return F0.useEffect(()=>{let z=Q.current;if($!==z){G(z);let H=$.map((Y)=>{let K=sq(Y);if(K)return K.addEventListener("scroll",X,{passive:!0}),[K,$U(K)];return null}).filter((Y)=>Y!=null);J(H.length?new Map(H):null),Q.current=$}return()=>{G($),G(z)};function G(H){H.forEach((Y)=>{let K=sq(Y);K==null||K.removeEventListener("scroll",X)})}},[X,$]),F0.useMemo(()=>{if($.length)return Z?Array.from(Z.values()).reduce((z,G)=>b3(z,G),L2):Hw($);return L2},[$,Z])}function rP($,Z){if(Z===void 0)Z=[];let J=F0.useRef(null);return F0.useEffect(()=>{J.current=null},Z),F0.useEffect(()=>{let Q=$!==L2;if(Q&&!J.current)J.current=$;if(!Q&&J.current)J.current=null},[$]),J.current?uJ($,J.current):L2}function ai($){F0.useEffect(()=>{if(!gJ)return;let Z=$.map((J)=>{let{sensor:Q}=J;return Q.setup==null?void 0:Q.setup()});return()=>{for(let J of Z)J==null||J()}},$.map((Z)=>{let{sensor:J}=Z;return J}))}function ni($,Z){return F0.useMemo(()=>{return $.reduce((J,Q)=>{let{eventName:X,handler:z}=Q;return J[X]=(G)=>{z(G,Z)},J},{})},[$,Z])}function qw($){return F0.useMemo(()=>$?Oi($):null,[$])}var aP=[];function oi($,Z){if(Z===void 0)Z=iJ;let[J]=$,Q=qw(J?b8(J):null),[X,z]=F0.useState(aP);function G(){z(()=>{if(!$.length)return aP;return $.map((Y)=>zw(Y)?Q:new uG(Z(Y),Y))})}let H=dG({callback:G});return t2(()=>{H==null||H.disconnect(),G(),$.forEach((Y)=>H==null?void 0:H.observe(Y))},[$]),X}function Uw($){if(!$)return null;if($.children.length>1)return $;let Z=$.children[0];return H$(Z)?Z:$}function si($){let{measure:Z}=$,[J,Q]=F0.useState(null),X=F0.useCallback((K)=>{for(let{target:W}of K)if(H$(W)){Q((B)=>{let q=Z(W);return B?{...B,width:q.width,height:q.height}:q});break}},[Z]),z=dG({callback:X}),G=F0.useCallback((K)=>{let W=Uw(K);if(z==null||z.disconnect(),W)z==null||z.observe(W);Q(W?Z(W):null)},[Z,z]),[H,Y]=fJ(G);return F0.useMemo(()=>({nodeRef:H,rect:J,setRef:Y}),[J,H,Y])}var ti=[{sensor:aJ,options:{}},{sensor:rJ,options:{}}],ei={current:{}},fG={draggable:{measure:mP},droppable:{measure:mP,strategy:lJ.WhileDragging,frequency:JU.Optimized},dragOverlay:{measure:iJ}};class B$ 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 $r={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new B$,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:mG},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:fG,measureDroppableContainers:mG,windowRect:null,measuringScheduled:!1},Fw={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:mG,draggableNodes:new Map,over:null,measureDroppableContainers:mG},nJ=F0.createContext(Fw),Nw=F0.createContext($r);function Zr(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new B$}}}function Jr($,Z){switch(Z.type){case J8.DragStart:return{...$,draggable:{...$.draggable,initialCoordinates:Z.initialCoordinates,active:Z.active}};case J8.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 J8.DragEnd:case J8.DragCancel:return{...$,draggable:{...$.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case J8.RegisterDroppable:{let{element:J}=Z,{id:Q}=J,X=new B$($.droppable.containers);return X.set(Q,J),{...$,droppable:{...$.droppable,containers:X}}}case J8.SetDroppableDisabled:{let{id:J,key:Q,disabled:X}=Z,z=$.droppable.containers.get(J);if(!z||Q!==z.key)return $;let G=new B$($.droppable.containers);return G.set(J,{...z,disabled:X}),{...$,droppable:{...$.droppable,containers:G}}}case J8.UnregisterDroppable:{let{id:J,key:Q}=Z,X=$.droppable.containers.get(J);if(!X||Q!==X.key)return $;let z=new B$($.droppable.containers);return z.delete(J),{...$,droppable:{...$.droppable,containers:z}}}default:return $}}function Qr($){let{disabled:Z}=$,{active:J,activatorEvent:Q,draggableNodes:X}=F0.useContext(nJ),z=mJ(Q),G=mJ(J==null?void 0:J.id);return F0.useEffect(()=>{if(Z)return;if(!Q&&z&&G!=null){if(!vG(z))return;if(document.activeElement===z.target)return;let H=X.get(G);if(!H)return;let{activatorNode:Y,node:K}=H;if(!Y.current&&!K.current)return;requestAnimationFrame(()=>{for(let W of[Y.current,K.current]){if(!W)continue;let B=xP(W);if(B){B.focus();break}}})}},[Q,Z,X,G,z]),null}function Vw($,Z){let{transform:J,...Q}=Z;return $!=null&&$.length?$.reduce((X,z)=>{return z({transform:X,...Q})},J):J}function Xr($){return F0.useMemo(()=>({draggable:{...fG.draggable,...$==null?void 0:$.draggable},droppable:{...fG.droppable,...$==null?void 0:$.droppable},dragOverlay:{...fG.dragOverlay,...$==null?void 0:$.dragOverlay}}),[$==null?void 0:$.draggable,$==null?void 0:$.droppable,$==null?void 0:$.dragOverlay])}function zr($){let{activeNode:Z,measure:J,initialRect:Q,config:X=!0}=$,z=F0.useRef(!1),{x:G,y:H}=typeof X==="boolean"?{x:X,y:X}:X;t2(()=>{if(!G&&!H||!Z){z.current=!1;return}if(z.current||!Q)return;let K=Z==null?void 0:Z.node.current;if(!K||K.isConnected===!1)return;let W=J(K),B=$w(W,Q);if(!G)B.x=0;if(!H)B.y=0;if(z.current=!0,Math.abs(B.x)>0||Math.abs(B.y)>0){let q=Jw(K);if(q)q.scrollBy({top:B.y,left:B.x})}},[Z,G,H,Q,J])}var lG=F0.createContext({...L2,scaleX:1,scaleY:1}),z6;(function($){$[$.Uninitialized=0]="Uninitialized",$[$.Initializing=1]="Initializing",$[$.Initialized=2]="Initialized"})(z6||(z6={}));var Lw=F0.memo(function(Z){var J,Q,X,z;let{id:G,accessibility:H,autoScroll:Y=!0,children:K,sensors:W=ti,collisionDetection:B=Vi,measuring:q,modifiers:U,...F}=Z,N=F0.useReducer(Jr,void 0,Zr),[L,V]=N,[M,_]=Gi(),[O,D]=F0.useState(z6.Uninitialized),A=O===z6.Initialized,{draggable:{active:E,nodes:I,translate:y},droppable:{containers:C}}=L,h=E!=null?I.get(E):null,k=F0.useRef({initial:null,translated:null}),S=F0.useMemo(()=>{var I0;return E!=null?{id:E,data:(I0=h==null?void 0:h.data)!=null?I0:ei,rect:k}:null},[E,h]),w=F0.useRef(null),[T,R]=F0.useState(null),[b,g]=F0.useState(null),u=Y$(F,Object.values(F)),j=pJ("DndDescribedBy",G),t=F0.useMemo(()=>C.getEnabled(),[C]),Q0=Xr(q),{droppableRects:x,measureDroppableContainers:e,measuringScheduled:M0}=pi(t,{dragging:A,dependencies:[y.x,y.y],config:Q0.droppable}),l=fi(I,E),H0=F0.useMemo(()=>b?cJ(b):null,[b]),B0=d5(),X0=ui(l,Q0.draggable.measure);zr({activeNode:E!=null?I.get(E):null,config:B0.layoutShiftCompensation,initialRect:X0,measure:Q0.draggable.measure});let Y0=lP(l,Q0.draggable.measure,X0),V0=lP(l?l.parentElement:null),i=F0.useRef({activatorEvent:null,active:null,activeNode:l,collisionRect:null,collisions:null,droppableRects:x,draggableNodes:I,draggingNode:null,draggingNodeRect:null,droppableContainers:C,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),$0=C.getNodeFor((J=i.current.over)==null?void 0:J.id),Z0=si({measure:Q0.dragOverlay.measure}),J0=(Q=Z0.nodeRef.current)!=null?Q:l,n=A?(X=Z0.rect)!=null?X:Y0:null,m=Boolean(Z0.nodeRef.current&&Z0.rect),c=li(m?null:Y0),f=qw(J0?b8(J0):null),a=ii(A?$0!=null?$0:l:null),o=oi(a),N0=Vw(U,{transform:{x:y.x-c.x,y:y.y-c.y,scaleX:1,scaleY:1},activatorEvent:b,active:S,activeNodeRect:Y0,containerNodeRect:V0,draggingNodeRect:n,over:i.current.over,overlayNodeRect:Z0.rect,scrollableAncestors:a,scrollableAncestorRects:o,windowRect:f}),j0=H0?b3(H0,y):null,h0=ri(a),u0=rP(h0),p=rP(h0,[Y0]),r=b3(N0,u0),z0=n?Ai(n,N0):null,L0=S&&z0?B({active:S,collisionRect:z0,droppableRects:x,droppableContainers:t,pointerCoordinates:j0}):null,P0=Fi(L0,"id"),[g0,e0]=F0.useState(null),U5=m?N0:b3(N0,p),d0=Li(U5,(z=g0==null?void 0:g0.rect)!=null?z:null,Y0),R0=F0.useRef(null),G0=F0.useCallback((I0,T0)=>{let{sensor:f0,options:$5}=T0;if(w.current==null)return;let H5=I.get(w.current);if(!H5)return;let S5=I0.nativeEvent,l5=new f0({active:w.current,activeNode:H5,event:S5,options:$5,context:i,onAbort(F5){if(!I.get(F5))return;let{onDragAbort:v1}=u.current,d1={id:F5};v1==null||v1(d1),M({type:"onDragAbort",event:d1})},onPending(F5,U1,v1,d1){if(!I.get(F5))return;let{onDragPending:J5}=u.current,c0={id:F5,constraint:U1,initialCoordinates:v1,offset:d1};J5==null||J5(c0),M({type:"onDragPending",event:c0})},onStart(F5){let U1=w.current;if(U1==null)return;let v1=I.get(U1);if(!v1)return;let{onDragStart:d1}=u.current,x0={activatorEvent:S5,active:{id:U1,data:v1.data,rect:k}};h3.unstable_batchedUpdates(()=>{d1==null||d1(x0),D(z6.Initializing),V({type:J8.DragStart,initialCoordinates:F5,active:U1}),M({type:"onDragStart",event:x0}),R(R0.current),g(S5)})},onMove(F5){V({type:J8.DragMove,coordinates:F5})},onEnd:i5(J8.DragEnd),onCancel:i5(J8.DragCancel)});R0.current=l5;function i5(F5){return async function(){let{active:v1,collisions:d1,over:x0,scrollAdjustedTranslate:J5}=i.current,c0=null;if(v1&&J5){let{cancelDrop:W5}=u.current;if(c0={activatorEvent:S5,active:v1,collisions:d1,delta:J5,over:x0},F5===J8.DragEnd&&typeof W5==="function"){if(await Promise.resolve(W5(c0)))F5=J8.DragCancel}}w.current=null,h3.unstable_batchedUpdates(()=>{V({type:F5}),D(z6.Uninitialized),e0(null),R(null),g(null),R0.current=null;let W5=F5===J8.DragEnd?"onDragEnd":"onDragCancel";if(c0){let I5=u.current[W5];I5==null||I5(c0),M({type:W5,event:c0})}})}}},[I]),A0=F0.useCallback((I0,T0)=>{return(f0,$5)=>{let H5=f0.nativeEvent,S5=I.get($5);if(w.current!==null||!S5||H5.dndKit||H5.defaultPrevented)return;let l5={active:S5};if(I0(f0,T0.options,l5)===!0)H5.dndKit={capturedBy:T0.sensor},w.current=$5,G0(f0,T0)}},[I,G0]),v0=mi(W,A0);ai(W),t2(()=>{if(Y0&&O===z6.Initializing)D(z6.Initialized)},[Y0,O]),F0.useEffect(()=>{let{onDragMove:I0}=u.current,{active:T0,activatorEvent:f0,collisions:$5,over:H5}=i.current;if(!T0||!f0)return;let S5={active:T0,activatorEvent:f0,collisions:$5,delta:{x:r.x,y:r.y},over:H5};h3.unstable_batchedUpdates(()=>{I0==null||I0(S5),M({type:"onDragMove",event:S5})})},[r.x,r.y]),F0.useEffect(()=>{let{active:I0,activatorEvent:T0,collisions:f0,droppableContainers:$5,scrollAdjustedTranslate:H5}=i.current;if(!I0||w.current==null||!T0||!H5)return;let{onDragOver:S5}=u.current,l5=$5.get(P0),i5=l5&&l5.rect.current?{id:l5.id,rect:l5.rect.current,data:l5.data,disabled:l5.disabled}:null,F5={active:I0,activatorEvent:T0,collisions:f0,delta:{x:H5.x,y:H5.y},over:i5};h3.unstable_batchedUpdates(()=>{e0(i5),S5==null||S5(F5),M({type:"onDragOver",event:F5})})},[P0]),t2(()=>{i.current={activatorEvent:b,active:S,activeNode:l,collisionRect:z0,collisions:L0,droppableRects:x,draggableNodes:I,draggingNode:J0,draggingNodeRect:n,droppableContainers:C,over:g0,scrollableAncestors:a,scrollAdjustedTranslate:r},k.current={initial:n,translated:z0}},[S,l,L0,z0,I,J0,n,x,C,g0,a,r]),hi({...B0,delta:y,draggingRect:z0,pointerCoordinates:j0,scrollableAncestors:a,scrollableAncestorRects:o});let D5=F0.useMemo(()=>{return{active:S,activeNode:l,activeNodeRect:Y0,activatorEvent:b,collisions:L0,containerNodeRect:V0,dragOverlay:Z0,draggableNodes:I,droppableContainers:C,droppableRects:x,over:g0,measureDroppableContainers:e,scrollableAncestors:a,scrollableAncestorRects:o,measuringConfiguration:Q0,measuringScheduled:M0,windowRect:f}},[S,l,Y0,b,L0,V0,Z0,I,C,x,g0,e,a,o,Q0,M0,f]),K5=F0.useMemo(()=>{return{activatorEvent:b,activators:v0,active:S,activeNodeRect:Y0,ariaDescribedById:{draggable:j},dispatch:V,draggableNodes:I,over:g0,measureDroppableContainers:e}},[b,v0,S,Y0,V,j,I,g0,e]);return F0.default.createElement(sP.Provider,{value:_},F0.default.createElement(nJ.Provider,{value:K5},F0.default.createElement(Nw.Provider,{value:D5},F0.default.createElement(lG.Provider,{value:d0},K)),F0.default.createElement(Qr,{disabled:(H==null?void 0:H.restoreFocus)===!1})),F0.default.createElement(Ki,{...H,hiddenTextDescribedById:j}));function d5(){let I0=(T==null?void 0:T.autoScrollEnabled)===!1,T0=typeof Y==="object"?Y.enabled===!1:Y===!1,f0=A&&!I0&&!T0;if(typeof Y==="object")return{...Y,enabled:f0};return{enabled:f0}}}),Gr=F0.createContext(null),nP="button",Hr="Draggable";function Mw($){let{id:Z,data:J,disabled:Q=!1,attributes:X}=$,z=pJ(Hr),{activators:G,activatorEvent:H,active:Y,activeNodeRect:K,ariaDescribedById:W,draggableNodes:B,over:q}=F0.useContext(nJ),{role:U=nP,roleDescription:F="draggable",tabIndex:N=0}=X!=null?X:{},L=(Y==null?void 0:Y.id)===Z,V=F0.useContext(L?lG:Gr),[M,_]=fJ(),[O,D]=fJ(),A=ni(G,Z),E=Y$(J);t2(()=>{return B.set(Z,{id:Z,key:z,node:M,activatorNode:O,data:E}),()=>{let y=B.get(Z);if(y&&y.key===z)B.delete(Z)}},[B,Z]);let I=F0.useMemo(()=>({role:U,tabIndex:N,"aria-disabled":Q,"aria-pressed":L&&U===nP?!0:void 0,"aria-roledescription":F,"aria-describedby":W.draggable}),[Q,U,N,L,F,W.draggable]);return{active:Y,activatorEvent:H,activeNodeRect:K,attributes:I,isDragging:L,listeners:Q?void 0:A,node:M,over:q,setNodeRef:_,setActivatorNodeRef:D,transform:V}}function Yr(){return F0.useContext(Nw)}var Kr="Droppable",Wr={timeout:25};function Aw($){let{data:Z,disabled:J=!1,id:Q,resizeObserverConfig:X}=$,z=pJ(Kr),{active:G,dispatch:H,over:Y,measureDroppableContainers:K}=F0.useContext(nJ),W=F0.useRef({disabled:J}),B=F0.useRef(!1),q=F0.useRef(null),U=F0.useRef(null),{disabled:F,updateMeasurementsFor:N,timeout:L}={...Wr,...X},V=Y$(N!=null?N:Q),M=F0.useCallback(()=>{if(!B.current){B.current=!0;return}if(U.current!=null)clearTimeout(U.current);U.current=setTimeout(()=>{K(Array.isArray(V.current)?V.current:[V.current]),U.current=null},L)},[L]),_=dG({callback:M,disabled:F||!G}),O=F0.useCallback((I,y)=>{if(!_)return;if(y)_.unobserve(y),B.current=!1;if(I)_.observe(I)},[_]),[D,A]=fJ(O),E=Y$(Z);return F0.useEffect(()=>{if(!_||!D.current)return;_.disconnect(),B.current=!1,_.observe(D.current)},[D,_]),F0.useEffect(()=>{return H({type:J8.RegisterDroppable,element:{id:Q,key:z,disabled:J,node:D,rect:q,data:E}}),()=>H({type:J8.UnregisterDroppable,key:z,id:Q})},[Q]),F0.useEffect(()=>{if(J!==W.current.disabled)H({type:J8.SetDroppableDisabled,id:Q,key:z,disabled:J}),W.current.disabled=J},[Q,z,J,H]),{active:G,rect:q,isOver:(Y==null?void 0:Y.id)===Q,node:D,over:Y,setNodeRef:A}}function Br($){let{animation:Z,children:J}=$,[Q,X]=F0.useState(null),[z,G]=F0.useState(null),H=mJ(J);if(!J&&!Q&&H)X(H);return t2(()=>{if(!z)return;let Y=Q==null?void 0:Q.key,K=Q==null?void 0:Q.props.id;if(Y==null||K==null){X(null);return}Promise.resolve(Z(K,z)).then(()=>{X(null)})},[Z,Q,z]),F0.default.createElement(F0.default.Fragment,null,J,Q?F0.cloneElement(Q,{ref:G}):null)}var qr={x:0,y:0,scaleX:1,scaleY:1};function Ur($){let{children:Z}=$;return F0.default.createElement(nJ.Provider,{value:Fw},F0.default.createElement(lG.Provider,{value:qr},Z))}var Fr={position:"fixed",touchAction:"none"},Nr=($)=>{return vG($)?"transform 250ms ease":void 0},Vr=F0.forwardRef(($,Z)=>{let{as:J,activatorEvent:Q,adjustScale:X,children:z,className:G,rect:H,style:Y,transform:K,transition:W=Nr}=$;if(!H)return null;let B=X?K:{...K,scaleX:1,scaleY:1},q={...Fr,width:H.width,height:H.height,top:H.top,left:H.left,transform:G$.Transform.toString(B),transformOrigin:X&&Q?Bi(Q,H):void 0,transition:typeof W==="function"?W(Q):W,...Y};return F0.default.createElement(J,{className:G,style:q,ref:Z},z)}),Lr=($)=>(Z)=>{let{active:J,dragOverlay:Q}=Z,X={},{styles:z,className:G}=$;if(z!=null&&z.active)for(let[H,Y]of Object.entries(z.active)){if(Y===void 0)continue;X[H]=J.node.style.getPropertyValue(H),J.node.style.setProperty(H,Y)}if(z!=null&&z.dragOverlay)for(let[H,Y]of Object.entries(z.dragOverlay)){if(Y===void 0)continue;Q.node.style.setProperty(H,Y)}if(G!=null&&G.active)J.node.classList.add(G.active);if(G!=null&&G.dragOverlay)Q.node.classList.add(G.dragOverlay);return function(){for(let[Y,K]of Object.entries(X))J.node.style.setProperty(Y,K);if(G!=null&&G.active)J.node.classList.remove(G.active)}},Mr=($)=>{let{transform:{initial:Z,final:J}}=$;return[{transform:G$.Transform.toString(Z)},{transform:G$.Transform.toString(J)}]},Ar={duration:250,easing:"ease",keyframes:Mr,sideEffects:Lr({styles:{active:{opacity:"0"}}})};function _r($){let{config:Z,draggableNodes:J,droppableContainers:Q,measuringConfiguration:X}=$;return vJ((z,G)=>{if(Z===null)return;let H=J.get(z);if(!H)return;let Y=H.node.current;if(!Y)return;let K=Uw(G);if(!K)return;let{transform:W}=b8(G).getComputedStyle(G),B=Zw(W);if(!B)return;let q=typeof Z==="function"?Z:Dr(Z);return Yw(Y,X.draggable.measure),q({active:{id:z,data:H.data,node:Y,rect:X.draggable.measure(Y)},draggableNodes:J,dragOverlay:{node:G,rect:X.dragOverlay.measure(K)},droppableContainers:Q,measuringConfiguration:X,transform:B})})}function Dr($){let{duration:Z,easing:J,sideEffects:Q,keyframes:X}={...Ar,...$};return(z)=>{let{active:G,dragOverlay:H,transform:Y,...K}=z;if(!Z)return;let W={x:H.rect.left-G.rect.left,y:H.rect.top-G.rect.top},B={scaleX:Y.scaleX!==1?G.rect.width*Y.scaleX/H.rect.width:1,scaleY:Y.scaleY!==1?G.rect.height*Y.scaleY/H.rect.height:1},q={x:Y.x-W.x,y:Y.y-W.y,...B},U=X({...K,active:G,dragOverlay:H,transform:{initial:Y,final:q}}),[F]=U,N=U[U.length-1];if(JSON.stringify(F)===JSON.stringify(N))return;let L=Q==null?void 0:Q({active:G,dragOverlay:H,...K}),V=H.node.animate(U,{duration:Z,easing:J,fill:"forwards"});return new Promise((M)=>{V.onfinish=()=>{L==null||L(),M()}})}}var oP=0;function Or($){return F0.useMemo(()=>{if($==null)return;return oP++,oP},[$])}var _w=F0.default.memo(($)=>{let{adjustScale:Z=!1,children:J,dropAnimation:Q,style:X,transition:z,modifiers:G,wrapperElement:H="div",className:Y,zIndex:K=999}=$,{activatorEvent:W,active:B,activeNodeRect:q,containerNodeRect:U,draggableNodes:F,droppableContainers:N,dragOverlay:L,over:V,measuringConfiguration:M,scrollableAncestors:_,scrollableAncestorRects:O,windowRect:D}=Yr(),A=F0.useContext(lG),E=Or(B==null?void 0:B.id),I=Vw(G,{activatorEvent:W,active:B,activeNodeRect:q,containerNodeRect:U,draggingNodeRect:L.rect,over:V,overlayNodeRect:L.rect,scrollableAncestors:_,scrollableAncestorRects:O,transform:A,windowRect:D}),y=zU(q),C=_r({config:Q,draggableNodes:F,droppableContainers:N,measuringConfiguration:M}),h=y?L.setRef:void 0;return F0.default.createElement(Ur,null,F0.default.createElement(Br,{animation:C},B&&E?F0.default.createElement(Vr,{key:E,id:B.id,ref:h,as:H,activatorEvent:W,adjustScale:Z,className:Y,transition:z,rect:y,style:{zIndex:K,...X},transform:I},J):null))});var g3=P(d(),1),Pr={start:[b5.Space],cancel:[b5.Esc],end:[b5.Space,b5.Tab]};function wr($,Z,J){let Q=$.indexOf(Z),X=$.indexOf(J);if(Q<0||X<0||Q===X)return $;let z=[...$],[G]=z.splice(Q,1);return z.splice(X,0,G),z}function iG({items:$,getId:Z,className:J,itemClassName:Q,dragDisabled:X=!1,onReorder:z,renderItem:G,renderPlaceholder:H,renderOverlay:Y}){let K=tP(QU(aJ,{activationConstraint:{distance:4}}),QU(rJ,{keyboardCodes:Pr})),[W,B]=G6.useState(null),[q,U]=G6.useState(null),F=G6.useRef(null),N=G6.useMemo(()=>$.map(Z),[$,Z]),L=G6.useMemo(()=>new Map($.map((E)=>[Z(E),E])),[$,Z]),M=(W&&q?q:N).map((E)=>L.get(E)).filter((E)=>Boolean(E)),_=W?L.get(W):void 0,O=X||$.length<2;return g3.jsxs(Lw,{sensors:K,collisionDetection:eP,onDragStart:(E)=>{let I=$.map(Z);B(String(E.active.id)),F.current=I,U(I)},onDragOver:(E)=>{let I=String(E.active.id),y=E.over?String(E.over.id):void 0,C=F.current;if(!y||y===I||!C)return;let h=wr(C,I,y);if(h===C)return;F.current=h,U(h)},onDragCancel:()=>{F.current=null,B(null),U(null)},onDragEnd:(E)=>{let I=String(E.active.id),y=F.current;if(F.current=null,B(null),U(null),!y||y.join("|")===N.join("|"))return;if(!y.includes(I))return;z(y)},children:[g3.jsx("div",{className:J,children:M.map((E)=>g3.jsx(jr,{id:Z(E),item:E,disabled:O,itemClassName:Q,renderItem:G,renderPlaceholder:H},Z(E)))}),g3.jsx(_w,{dropAnimation:null,children:_&&Y?Y(_):null})]})}function jr({id:$,item:Z,disabled:J,itemClassName:Q,renderItem:X,renderPlaceholder:z}){let{setNodeRef:G,isOver:H}=Aw({id:$,disabled:J}),{attributes:Y,listeners:K,setNodeRef:W,isDragging:B}=Mw({id:$,disabled:J,attributes:{roleDescription:"sortable item"}}),q=(F)=>{G(F),W(F)},U={isDragging:B,isOver:H,dragDisabled:J,dragHandleProps:J?{}:{...Y,...K}};return g3.jsxs(p5.div,{layout:!0,ref:q,className:s("relative",Q?.(Z,U)),transition:{type:"spring",duration:0.25,bounce:0},children:[B&&z?.(Z),X(Z,U)]})}var u5=P(d(),1);function Tr($){return s(oJ({variant:"ghost",size:"icon"}),$&&"bg-accent text-accent-foreground")}function rG({children:$,showWorkspaces:Z=!0}){let{data:J}=KG(),Q=o0();return Z8((X)=>{if(X.type==="workspace:updated"||X.type==="workspaces-list:updated")Q.invalidateQueries({queryKey:S0.all,exact:!0})}),u5.jsxs("div",{className:s("flex h-dvh bg-muted"),children:[u5.jsx(Cr,{workspaces:Z?J??[]:[]}),u5.jsx("main",{className:"flex min-w-0 flex-1 flex-col",children:$})]})}function Cr({workspaces:$}){let Z=CO();return u5.jsxs("aside",{className:"flex h-full shrink-0 flex-col items-center gap-4 px-2 py-5 [font-family:var(--default-sans)]",children:[u5.jsx(nZ,{href:"/","aria-label":"Home",title:"Home",className:Tr,children:u5.jsx(Ow,{stroke:1.5})}),u5.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&&u5.jsxs(u5.Fragment,{children:[u5.jsx("div",{className:"no-scrollbar min-h-0 scroll-fade overflow-y-auto [--scroll-fade-reveal:16px]",children:u5.jsx(iG,{items:$,getId:(J)=>J.id,className:"flex flex-col gap-4",onReorder:(J)=>Z.mutate(J),renderPlaceholder:()=>u5.jsx("div",{className:"pointer-events-none absolute top-0 left-1 size-10 rounded-xl bg-accent"}),renderOverlay:(J)=>u5.jsx(Dw,{workspace:J,dragOverlay:!0}),renderItem:(J,Q)=>u5.jsx(Dw,{workspace:J,dragState:Q})})}),u5.jsx("div",{className:"shrink-0",children:u5.jsx(hJ,{trigger:u5.jsx(k0,{type:"button",variant:"ghost",size:"icon-lg","aria-label":"Create new workspace",title:"Create new workspace",className:"text-muted-foreground hover:text-foreground",children:u5.jsx(K4,{"data-icon":"inline-start",stroke:1.5})})})})]})}),u5.jsx("div",{"aria-hidden":"true",className:"size-8 shrink-0"})]})}function Dw({workspace:$,dragOverlay:Z=!1,dragState:J}){let[Q]=g4(),X=`/workspace/${$.id}`,z=I3($),G=Q===X||Q.startsWith(`${X}/`),H=u5.jsxs(u5.Fragment,{children:[u5.jsx("div",{className:s(oJ({variant:"ghost",size:"icon-lg"}),"pointer-events-none size-12",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",G&&!Z&&"bg-accent text-accent-foreground"),children:u5.jsx("img",{src:$.icon??V2[$.type??"claude-code"],alt:"",className:"size-7 shrink-0 rounded-xs"})}),u5.jsx("span",{className:"mt-0.5 line-clamp-2 w-full text-center text-[11px] leading-snug font-medium text-ellipsis text-foreground",children:z})]});if(Z)return u5.jsx("span",{className:"flex w-14 flex-col items-center",children:H});return u5.jsx(nZ,{href:X,"aria-label":z,title:z,onClick:(Y)=>{if(J?.isDragging)Y.preventDefault()},className:s("group flex w-14 flex-col items-center rounded-lg outline-none",J?.isDragging&&"invisible"),...J?.dragHandleProps,children:H})}var Pw=P(v(),1);var q$=P(d(),1);function Er({choice:$,availability:Z,isPending:J,errorMessage:Q,onTypeChange:X,onCancel:z,onSubmit:G}){return q$.jsx(bG,{title:`Import ${I3($.workspace)}`,selectedType:$.selectedType,detectedTypes:$.workspace.types,availability:Z,isPending:J,errorMessage:Q,secondaryAction:q$.jsx(k0,{variant:"secondary",onClick:z,disabled:J,children:"Cancel"}),primaryLabel:"Add workspace",pendingLabel:"Adding…",onTypeChange:X,onSubmit:G})}function ww({choice:$,availability:Z,isPending:J,errorMessage:Q,onTypeChange:X,onSubmit:z,onReset:G}){let[H,Y]=Pw.useState(!0);function K(B){if(!B&&J)return;Y(B)}function W(B){if(!B)G()}return q$.jsx($$,{open:H,onOpenChange:K,onOpenChangeComplete:W,children:q$.jsx(xG,{closeDisabled:J,children:q$.jsx(Er,{choice:$,availability:Z,isPending:J,errorMessage:Q,onTypeChange:X,onCancel:()=>Y(!1),onSubmit:z})})})}var jw=P(v(),1);function Sr($){return $.types[0]??X$[0]}function Tw({onSuccess:$}){let Z=jO(),[J,Q]=jw.useState(null);function X(Y){Z.reset(),Q({workspace:Y,selectedType:Sr(Y)})}function z(Y){Q((K)=>K?{...K,selectedType:Y}:K)}function G(){if(!J||Z.isPending)return;Z.mutate({path:J.workspace.path,type:J.selectedType},{onSuccess:$})}function H(){Q(null),Z.reset()}return{choice:J,isPending:Z.isPending,error:Z.error,startImport:X,selectType:z,submit:G,reset:H}}var tJ=P(v(),1);var eJ=P(d(),1),kr=[["OOOOO","O.O.O","O.O.O"],["OOO","O.O","OOO"],["O","O","O"]],H6=10,aG=3,Ir=2.5,Rr={O:1,o:0.5,".":0},yr=3000,br=2,Cw=3,Y6=3,Ew=0.001,v3={courantSquared:0.14,damping:0.976,driveAmplitude:1.4,driveFrequency:0.027,gain:0.65,fadeIn:0.36,fadeOut:0.1};function xr($){let Z=Math.max(...$.map((z)=>z.length)),J=Z*H6+(Z-1)*aG,Q=$.length*H6+($.length-1)*aG,X=[];return $.forEach((z,G)=>{Array.from(z).forEach((H,Y)=>{let K=Rr[H];if(K===void 0)return;let W=Y*(H6+aG),B=G*(H6+aG);X.push({x:W,y:B,centerX:W+H6/2,centerY:B+H6/2,targetOpacity:K})})}),{width:J,height:Q,fieldColumns:Math.round(J/Y6)+1,fieldRows:Math.round(Q/Y6)+1,pixels:X}}var hr=kr.map(xr);function sJ($,Z,J){return $<Z?Z:$>J?J:$}function gr($){return $<0.5?2*$*$:1-(-2*$+2)**2/2}class Sw{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 Q=J.fieldColumns*J.fieldRows;this.field=new Float32Array(Q),this.previousField=new Float32Array(Q),this.nextField=new Float32Array(Q)}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/Y6),Z=Math.round(this.geometry.height/2/Y6),J=2*Cw*Cw;for(let Q=0;Q<this.geometry.fieldRows;Q++)for(let X=0;X<this.geometry.fieldColumns;X++){let z=(X-$)**2+(Q-Z)**2,G=br*Math.exp(-z/J),H=Q*this.geometry.fieldColumns+X;this.field[H]=G,this.previousField[H]=G}}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)/yr;if(this.activation=1-gr(Math.min(1,J)),J>=1)this.intro=!1}else{this.intro=!1;let J=this.pointerActive?1:0,Q=this.pointerActive?v3.fadeIn:v3.fadeOut;this.activation+=(J-this.activation)*Q}let Z=this.renderWave();if(this.intro||this.pointerActive||this.activation>Ew||Z>Ew){this.animationFrame=requestAnimationFrame(this.animate);return}this.running=!1,this.activation=0,this.renderTargets()};stepWave(){let{fieldColumns:$,fieldRows:Z}=this.geometry;for(let Q=1;Q<Z-1;Q++)for(let X=1;X<$-1;X++){let z=Q*$+X,G=this.field[z-1]+this.field[z+1]+this.field[z-$]+this.field[z+$]-4*this.field[z];this.nextField[z]=(2*this.field[z]-this.previousField[z]+v3.courantSquared*G)*v3.damping}let J=this.previousField;this.previousField=this.field,this.field=this.nextField,this.nextField=J}driveWave($){let Z=sJ(Math.round(this.pointerX/Y6),1,this.geometry.fieldColumns-2),J=sJ(Math.round(this.pointerY/Y6),1,this.geometry.fieldRows-2);this.field[J*this.geometry.fieldColumns+Z]=v3.driveAmplitude*Math.sin($*v3.driveFrequency)}sampleField($,Z){let J=sJ($/Y6,0,this.geometry.fieldColumns-1),Q=sJ(Z/Y6,0,this.geometry.fieldRows-1),X=Math.floor(J),z=Math.floor(Q),G=Math.min(X+1,this.geometry.fieldColumns-1),H=Math.min(z+1,this.geometry.fieldRows-1),Y=J-X,K=Q-z,{fieldColumns:W}=this.geometry,B=this.field[z*W+X],q=this.field[z*W+G],U=this.field[H*W+X],F=this.field[H*W+G];return(B*(1-Y)+q*Y)*(1-K)+(U*(1-Y)+F*Y)*K}renderWave(){let $=0;return this.geometry.pixels.forEach((Z,J)=>{let Q=this.rects[J];if(!Q)return;let X=this.sampleField(Z.centerX,Z.centerY);$=Math.max($,Math.abs(X));let z=sJ(0.5+X*v3.gain,0,1),G=Z.targetOpacity*(1-this.activation)+z*this.activation;Q.setAttribute("opacity",G.toFixed(3))}),$}renderTargets(){this.geometry.pixels.forEach(($,Z)=>{this.rects[Z]?.setAttribute("opacity",String($.targetOpacity))})}}function vr({geometry:$}){let Z=tJ.useRef([]),J=tJ.useRef(null);return tJ.useEffect(()=>{let Q=J.current;if(!Q||window.matchMedia("(prefers-reduced-motion: reduce)").matches)return;let X=new Sw(Z.current,Q,$);return X.start(),window.addEventListener("pointermove",X.handlePointerMove),()=>{X.stop(),window.removeEventListener("pointermove",X.handlePointerMove)}},[$]),eJ.jsx("svg",{ref:J,className:"h-8 w-auto",viewBox:`0 0 ${$.width} ${$.height}`,fill:"currentColor","aria-hidden":"true",children:$.pixels.map((Q,X)=>eJ.jsx("rect",{ref:(z)=>{Z.current[X]=z},x:Q.x,y:Q.y,width:H6,height:H6,rx:Ir,opacity:Q.targetOpacity},`${Q.x}-${Q.y}`))})}function kw({className:$}){return eJ.jsx("div",{role:"img","aria-label":"moi",className:s("flex items-center gap-2 text-accent",$),children:hr.map((Z,J)=>eJ.jsx(vr,{geometry:Z},J))})}var U$={};_4(U$,{Trigger:()=>gw,Root:()=>hw,Panel:()=>mw});var $Q=P(v(),1);var C4=P(v(),1);function Iw($){let{open:Z,defaultOpen:J,onOpenChange:Q,disabled:X}=$,z=Z!==void 0,[G,H]=r4({controlled:Z,default:J,name:"Collapsible",state:"open"}),{mounted:Y,setMounted:K,transitionStatus:W}=p4(G,!0,!0),[B,q]=C4.useState(G),[{height:U,width:F},N]=C4.useState({height:void 0,width:void 0}),L=s0(),[V,M]=C4.useState(),_=V??L,[O,D]=C4.useState(!1),[A,E]=C4.useState(!1),I=C4.useRef(null),y=C4.useRef(null),C=C4.useRef(null),h=C4.useRef(null),k=v2(h,!1),S=U0((w)=>{let T=!G,R=D0(K0.triggerPress,w.nativeEvent);if(Q(T,R),R.isCanceled)return;let b=h.current;if(y.current==="css-animation"&&b!=null)b.style.removeProperty("animation-name");if(!O&&!A){if(y.current!=null&&y.current!=="css-animation"){if(!Y&&T)K(!0)}if(y.current==="css-animation"){if(!B&&T)q(!0);if(!Y&&T)K(!0)}}if(H(T),y.current==="none"&&Y&&!T)K(!1)});return q0(()=>{if(z&&y.current==="none"&&!A&&!G)K(!1)},[z,A,G,Z,K]),C4.useMemo(()=>({abortControllerRef:I,animationTypeRef:y,disabled:X,handleTrigger:S,height:U,mounted:Y,open:G,panelId:_,panelRef:h,runOnceAnimationsFinish:k,setDimensions:N,setHiddenUntilFound:D,setKeepMounted:E,setMounted:K,setOpen:H,setPanelIdState:M,setVisible:q,transitionDimensionRef:C,transitionStatus:W,visible:B,width:F}),[I,y,X,S,U,Y,G,_,h,k,N,D,E,K,H,q,C,W,B,F])}var nG=P(v(),1),GU=nG.createContext(void 0);function oG(){let $=nG.useContext(GU);if($===void 0)throw Error(C0(15));return $}var f3=function($){return $.open="data-open",$.closed="data-closed",$[$.startingStyle=g2.startingStyle]="startingStyle",$[$.endingStyle=g2.endingStyle]="endingStyle",$}({});var Rw=function($){return $.panelOpen="data-panel-open",$}({});var fr={[f3.open]:""},mr={[f3.closed]:""},yw={open($){if($)return{[Rw.panelOpen]:""};return null}},bw={open($){if($)return fr;return mr}};var sG={...bw,...m5};var xw=P(d(),1),hw=$Q.forwardRef(function(Z,J){let{render:Q,className:X,defaultOpen:z=!1,disabled:G=!1,onOpenChange:H,open:Y,...K}=Z,W=U0(H),B=Iw({open:Y,defaultOpen:z,onOpenChange:W,disabled:G}),q=$Q.useMemo(()=>({open:B.open,disabled:B.disabled,transitionStatus:B.transitionStatus}),[B.open,B.disabled,B.transitionStatus]),U=$Q.useMemo(()=>({...B,onOpenChange:W,state:q}),[B,W,q]),F=W0("div",Z,{state:q,ref:J,props:K,stateAttributesMapping:sG});return xw.jsx(GU.Provider,{value:U,children:F})});var tG=P(v(),1);var pr={...yw,...m5},gw=tG.forwardRef(function(Z,J){let{panelId:Q,open:X,handleTrigger:z,state:G,disabled:H}=oG(),{className:Y,disabled:K=H,id:W,render:B,nativeButton:q=!0,...U}=Z,{getButtonProps:F,buttonRef:N}=f1({disabled:K,focusableWhenDisabled:!0,native:q}),L=tG.useMemo(()=>({"aria-controls":X?Q:void 0,"aria-expanded":X,onClick:z}),[Q,X,z]);return W0("button",Z,{state:G,ref:[J,N],props:[L,U,F],stateAttributesMapping:pr})});var eG=P(v(),1);var e2=P(v(),1);var vw=function($){return $.disabled="data-disabled",$.orientation="data-orientation",$}({});function fw($){let{abortControllerRef:Z,animationTypeRef:J,externalRef:Q,height:X,hiddenUntilFound:z,keepMounted:G,id:H,mounted:Y,onOpenChange:K,open:W,panelRef:B,runOnceAnimationsFinish:q,setDimensions:U,setMounted:F,setOpen:N,setVisible:L,transitionDimensionRef:V,visible:M,width:_}=$,O=e2.useRef(!1),D=e2.useRef(null),A=e2.useRef(W),E=e2.useRef(W),I=z4(),y=e2.useMemo(()=>{if(J.current==="css-animation")return!M;return!W&&!Y},[W,Y,M,J]),C=U0((k)=>{if(!k)return;if(J.current==null||V.current==null){let T=getComputedStyle(k),R=T.animationName!=="none"&&T.animationName!=="",b=T.transitionDuration!=="0s"&&T.transitionDuration!=="";if(R&&b);else if(T.animationName==="none"&&T.transitionDuration!=="0s")J.current="css-transition";else if(T.animationName!=="none"&&T.transitionDuration==="0s")J.current="css-animation";else J.current="none";if(k.getAttribute(vw.orientation)==="horizontal"||T.transitionProperty.indexOf("width")>-1)V.current="width";else V.current="height"}if(J.current!=="css-transition")return;if(X===void 0||_===void 0){if(U({height:k.scrollHeight,width:k.scrollWidth}),E.current)k.style.setProperty("transition-duration","0s")}let S=-1,w=-1;return S=G1.request(()=>{E.current=!1,w=G1.request(()=>{setTimeout(()=>{k.style.removeProperty("transition-duration")})})}),()=>{G1.cancel(S),G1.cancel(w)}}),h=O4(Q,B,C);return q0(()=>{if(J.current!=="css-transition")return;let k=B.current;if(!k)return;let S=-1;if(Z.current!=null)Z.current.abort(),Z.current=null;if(W){let w={"justify-content":k.style.justifyContent,"align-items":k.style.alignItems,"align-content":k.style.alignContent,"justify-items":k.style.justifyItems};if(Object.keys(w).forEach((T)=>{k.style.setProperty(T,"initial","important")}),!E.current&&!G)k.setAttribute(f3.startingStyle,"");U({height:k.scrollHeight,width:k.scrollWidth}),S=G1.request(()=>{Object.entries(w).forEach(([T,R])=>{if(R==="")k.style.removeProperty(T);else k.style.setProperty(T,R)})})}else{if(k.scrollHeight===0&&k.scrollWidth===0)return;U({height:k.scrollHeight,width:k.scrollWidth});let w=new AbortController;Z.current=w;let T=w.signal,R=null,b=f3.endingStyle;return R=new MutationObserver((g)=>{if(g.some((j)=>j.type==="attributes"&&j.attributeName===b))R?.disconnect(),R=null,q(()=>{if(U({height:0,width:0}),k.style.removeProperty("content-visibility"),F(!1),Z.current===w)Z.current=null},T)}),R.observe(k,{attributes:!0,attributeFilter:[b]}),()=>{if(R?.disconnect(),I.cancel(),Z.current===w)w.abort(),Z.current=null}}return()=>{G1.cancel(S)}},[Z,J,I,z,G,Y,W,B,q,U,F]),q0(()=>{if(J.current!=="css-animation")return;let k=B.current;if(!k)return;if(D.current=k.style.animationName||D.current,k.style.setProperty("animation-name","none"),U({height:k.scrollHeight,width:k.scrollWidth}),!A.current&&!O.current)k.style.removeProperty("animation-name");if(W){if(Z.current!=null)Z.current.abort(),Z.current=null;F(!0),L(!0)}else Z.current=new AbortController,q(()=>{F(!1),L(!1),Z.current=null},Z.current.signal)},[Z,J,W,B,q,U,F,L,M]),T8(()=>{let k=G1.request(()=>{A.current=!1});return()=>G1.cancel(k)}),q0(()=>{if(!z)return;let k=B.current;if(!k)return;let S=-1,w=-1;if(W&&O.current)k.style.transitionDuration="0s",U({height:k.scrollHeight,width:k.scrollWidth}),S=G1.request(()=>{O.current=!1,w=G1.request(()=>{setTimeout(()=>{k.style.removeProperty("transition-duration")})})});return()=>{G1.cancel(S),G1.cancel(w)}},[z,W,B,U]),q0(()=>{let k=B.current;if(k&&z&&y){if(k.setAttribute("hidden","until-found"),J.current==="css-transition")k.setAttribute(f3.startingStyle,"")}},[z,y,J,B]),e2.useEffect(function(){let S=B.current;if(!S)return;function w(T){O.current=!0,N(!0),K(!0,D0(K0.none,T))}return S.addEventListener("beforematch",w),()=>{S.removeEventListener("beforematch",w)}},[K,B,N]),e2.useMemo(()=>({props:{hidden:y,id:H,ref:h}}),[y,H,h])}var HU=function($){return $.collapsiblePanelHeight="--collapsible-panel-height",$.collapsiblePanelWidth="--collapsible-panel-width",$}({});var mw=eG.forwardRef(function(Z,J){let{className:Q,hiddenUntilFound:X,keepMounted:z,render:G,id:H,...Y}=Z,{abortControllerRef:K,animationTypeRef:W,height:B,mounted:q,onOpenChange:U,open:F,panelId:N,panelRef:L,runOnceAnimationsFinish:V,setDimensions:M,setHiddenUntilFound:_,setKeepMounted:O,setMounted:D,setPanelIdState:A,setOpen:E,setVisible:I,state:y,transitionDimensionRef:C,visible:h,width:k,transitionStatus:S}=oG(),w=X??!1,T=z??!1;q0(()=>{if(H)return A(H),()=>{A(void 0)};return},[H,A]),q0(()=>{_(w)},[_,w]),q0(()=>{O(T)},[O,T]);let{props:R}=fw({abortControllerRef:K,animationTypeRef:W,externalRef:J,height:B,hiddenUntilFound:w,id:N,keepMounted:T,mounted:q,onOpenChange:U,open:F,panelRef:L,runOnceAnimationsFinish:V,setDimensions:M,setMounted:D,setOpen:E,setVisible:I,transitionDimensionRef:C,visible:h,width:k});I1({open:F&&S==="idle",ref:L,onComplete(){if(!F)return;M({height:void 0,width:void 0})}});let b=eG.useMemo(()=>({...y,transitionStatus:S}),[y,S]),g=W0("div",Z,{state:b,ref:[J,L],props:[R,{style:{[HU.collapsiblePanelHeight]:B===void 0?"auto":`${B}px`,[HU.collapsiblePanelWidth]:k===void 0?"auto":`${k}px`}},Y],stateAttributesMapping:sG});if(!(T||w||!T&&q))return null;return g});var QH=P(d(),1);function $H({...$}){return QH.jsx(U$.Root,{"data-slot":"collapsible",...$})}function ZH({...$}){return QH.jsx(U$.Trigger,{"data-slot":"collapsible-trigger",...$})}function JH({...$}){return QH.jsx(U$.Panel,{"data-slot":"collapsible-content",...$})}var vH=P(v(),1);var ur=($,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}},XH=ur;var cr={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},pw=cr;var dr=($)=>{return XH(pw[$.toLowerCase()],6)},uw=dr;var lr=/^#?([0-9a-f]{8}|[0-9a-f]{6}|[0-9a-f]{4}|[0-9a-f]{3})$/i,ir=($)=>{let Z;return(Z=$.match(lr))?XH(parseInt(Z[1],16),Z[1].length):void 0},cw=ir;var zH="([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)";var m3="([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%";var ZQ="(?:([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%|([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?))";var dw="(?:([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)(deg|grad|rad|turn)|([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?))";var K6="\\s*,\\s*";var IO0=new RegExp("^(?:([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%|([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)|none)$");var rr=new RegExp(`^rgba?\\(\\s*${zH}${K6}${zH}${K6}${zH}\\s*(?:,\\s*${ZQ}\\s*)?\\)$`),ar=new RegExp(`^rgba?\\(\\s*${m3}${K6}${m3}${K6}${m3}\\s*(?:,\\s*${ZQ}\\s*)?\\)$`),nr=($)=>{let Z={mode:"rgb"},J;if(J=$.match(rr)){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(ar)){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},lw=nr;var or=($,Z)=>$===void 0?void 0:typeof $!=="object"?rw($):$.mode!==void 0?$:Z?{...$,mode:Z}:void 0,iw=or;var sr=($="rgb")=>(Z)=>(Z=iw(Z,$))!==void 0?Z.mode===$?Z:M2[Z.mode][$]?M2[Z.mode][$](Z):$==="rgb"?M2[Z.mode].rgb(Z):M2.rgb[$](M2[Z.mode].rgb(Z)):void 0,GH=sr;var M2={},aw={},JQ=[],YU={},tr=($)=>$,v5=($)=>{if(M2[$.mode]={...M2[$.mode],...$.toMode},Object.keys($.fromMode||{}).forEach((Z)=>{if(!M2[Z])M2[Z]={};M2[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=tr}),aw[$.mode]=$,($.parse||[]).forEach((Z)=>{er(Z,$.mode)}),GH($.mode)},nw=($)=>aw[$],er=($,Z)=>{if(typeof $==="string"){if(!Z)throw Error("'mode' required when 'parser' is a string");YU[$]=Z}else if(typeof $==="function"){if(JQ.indexOf($)<0)JQ.push($)}};var KU=/[^\x00-\x7F]|[a-zA-Z_]/,$a=/[^\x00-\x7F]|[-\w]/,_0={Function:"function",Ident:"ident",Number:"number",Percentage:"percentage",ParenClose:")",None:"none",Hue:"hue",Alpha:"alpha"},t0=0;function HH($){let Z=$[t0],J=$[t0+1];if(Z==="-"||Z==="+")return/\d/.test(J)||J==="."&&/\d/.test($[t0+2]);if(Z===".")return/\d/.test(J);return/\d/.test(Z)}function WU($){if(t0>=$.length)return!1;let Z=$[t0];if(KU.test(Z))return!0;if(Z==="-"){if($.length-t0<2)return!1;let J=$[t0+1];if(J==="-"||KU.test(J))return!0;return!1}return!1}var Za={deg:1,rad:180/Math.PI,grad:0.9,turn:360};function QQ($){let Z="";if($[t0]==="-"||$[t0]==="+")Z+=$[t0++];if(Z+=YH($),$[t0]==="."&&/\d/.test($[t0+1]))Z+=$[t0++]+YH($);if($[t0]==="e"||$[t0]==="E"){if(($[t0+1]==="-"||$[t0+1]==="+")&&/\d/.test($[t0+2]))Z+=$[t0++]+$[t0++]+YH($);else if(/\d/.test($[t0+1]))Z+=$[t0++]+YH($)}if(WU($)){let J=KH($);if(J==="deg"||J==="rad"||J==="turn"||J==="grad")return{type:_0.Hue,value:Z*Za[J]};return}if($[t0]==="%")return t0++,{type:_0.Percentage,value:+Z};return{type:_0.Number,value:+Z}}function YH($){let Z="";while(/\d/.test($[t0]))Z+=$[t0++];return Z}function KH($){let Z="";while(t0<$.length&&$a.test($[t0]))Z+=$[t0++];return Z}function Ja($){let Z=KH($);if($[t0]==="(")return t0++,{type:_0.Function,value:Z};if(Z==="none")return{type:_0.None,value:void 0};return{type:_0.Ident,value:Z}}function Qa($=""){let Z=$.trim(),J=[],Q;t0=0;while(t0<Z.length){if(Q=Z[t0++],Q===`
28
+ `||Q==="\t"||Q===" "){while(t0<Z.length&&(Z[t0]===`
29
+ `||Z[t0]==="\t"||Z[t0]===" "))t0++;continue}if(Q===",")return;if(Q===")"){J.push({type:_0.ParenClose});continue}if(Q==="+"){if(t0--,HH(Z)){J.push(QQ(Z));continue}return}if(Q==="-"){if(t0--,HH(Z)){J.push(QQ(Z));continue}if(WU(Z)){J.push({type:_0.Ident,value:KH(Z)});continue}return}if(Q==="."){if(t0--,HH(Z)){J.push(QQ(Z));continue}return}if(Q==="/"){while(t0<Z.length&&(Z[t0]===`
30
+ `||Z[t0]==="\t"||Z[t0]===" "))t0++;let X;if(HH(Z)){if(X=QQ(Z),X.type!==_0.Hue){J.push({type:_0.Alpha,value:X});continue}}if(WU(Z)){if(KH(Z)==="none"){J.push({type:_0.Alpha,value:{type:_0.None,value:void 0}});continue}}return}if(/\d/.test(Q)){t0--,J.push(QQ(Z));continue}if(KU.test(Q)){t0--,J.push(Ja(Z));continue}return}return J}function Xa($){$._i=0;let Z=$[$._i++];if(!Z||Z.type!==_0.Function||Z.value!=="color")return;if(Z=$[$._i++],Z.type!==_0.Ident)return;let J=YU[Z.value];if(!J)return;let Q={mode:J},X=ow($,!1);if(!X)return;let z=nw(J).channels;for(let G=0,H,Y;G<z.length;G++)if(H=X[G],Y=z[G],H.type!==_0.None){if(Q[Y]=H.type===_0.Number?H.value:H.value/100,Y==="alpha")Q[Y]=Math.max(0,Math.min(1,Q[Y]))}return Q}function ow($,Z){let J=[],Q;while($._i<$.length){if(Q=$[$._i++],Q.type===_0.None||Q.type===_0.Number||Q.type===_0.Alpha||Q.type===_0.Percentage||Z&&Q.type===_0.Hue){J.push(Q);continue}if(Q.type===_0.ParenClose){if($._i<$.length)return;continue}return}if(J.length<3||J.length>4)return;if(J.length===4){if(J[3].type!==_0.Alpha)return;J[3]=J[3].value}if(J.length===3)J.push({type:_0.None,value:void 0});return J.every((X)=>X.type!==_0.Alpha)?J:void 0}function za($,Z){$._i=0;let J=$[$._i++];if(!J||J.type!==_0.Function)return;let Q=ow($,Z);if(!Q)return;return Q.unshift(J.value),Q}var Ga=($)=>{if(typeof $!=="string")return;let Z=Qa($),J=Z?za(Z,!0):void 0,Q=void 0,X=0,z=JQ.length;while(X<z)if((Q=JQ[X++]($,J))!==void 0)return Q;return Z?Xa(Z):void 0},rw=Ga;function Ha($,Z){if(!Z||Z[0]!=="rgb"&&Z[0]!=="rgba")return;let J={mode:"rgb"},[,Q,X,z,G]=Z;if(Q.type===_0.Hue||X.type===_0.Hue||z.type===_0.Hue)return;if(Q.type!==_0.None)J.r=Q.type===_0.Number?Q.value/255:Q.value/100;if(X.type!==_0.None)J.g=X.type===_0.Number?X.value/255:X.value/100;if(z.type!==_0.None)J.b=z.type===_0.Number?z.value/255:z.value/100;if(G.type!==_0.None)J.alpha=Math.min(1,Math.max(0,G.type===_0.Number?G.value:G.value/100));return J}var sw=Ha;var Ya=($)=>$==="transparent"?{mode:"rgb",r:0,g:0,b:0,alpha:0}:void 0,tw=Ya;var ew=($,Z,J)=>$+J*(Z-$);var Ka=($)=>{let Z=[];for(let J=0;J<$.length-1;J++){let Q=$[J],X=$[J+1];if(Q===void 0&&X===void 0)Z.push(void 0);else if(Q!==void 0&&X!==void 0)Z.push([Q,X]);else Z.push(Q!==void 0?[Q,Q]:[X,X])}return Z},$j=($)=>(Z)=>{let J=Ka(Z);return(Q)=>{let X=Q*J.length,z=Q>=1?J.length-1:Math.max(Math.floor(X),0),G=J[z];return G===void 0?void 0:$(G[0],G[1],X-z)}};var O0=$j(ew);var V5=($)=>{let Z=!1,J=$.map((Q)=>{if(Q!==void 0)return Z=!0,Q;return 1});return Z?J:$};var Wa={mode:"rgb",channels:["r","g","b","alpha"],parse:[sw,cw,lw,uw,tw,"srgb"],serialize:"srgb",interpolate:{r:O0,g:O0,b:O0,alpha:{use:O0,fixup:V5}},gamut:!0,white:{r:1,g:1,b:1},black:{r:0,g:0,b:0}},n4=Wa;var BU=($=0)=>Math.pow(Math.abs($),2.19921875)*Math.sign($),Ba=($)=>{let Z=BU($.r),J=BU($.g),Q=BU($.b),X={mode:"xyz65",x:0.5766690429101305*Z+0.1855582379065463*J+0.1882286462349947*Q,y:0.297344975250536*Z+0.6273635662554661*J+0.0752914584939979*Q,z:0.0270313613864123*Z+0.0706888525358272*J+0.9913375368376386*Q};if($.alpha!==void 0)X.alpha=$.alpha;return X},qU=Ba;var UU=($)=>Math.pow(Math.abs($),0.4547069271758437)*Math.sign($),qa=({x:$,y:Z,z:J,alpha:Q})=>{if($===void 0)$=0;if(Z===void 0)Z=0;if(J===void 0)J=0;let X={mode:"a98",r:UU($*2.0415879038107465-Z*0.5650069742788597-0.3447313507783297*J),g:UU($*-0.9692436362808798+Z*1.8759675015077206+0.0415550574071756*J),b:UU($*0.0134442806320312-Z*0.1183623922310184+1.0151749943912058*J)};if(Q!==void 0)X.alpha=Q;return X},FU=qa;var NU=($=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)},Ua=({r:$,g:Z,b:J,alpha:Q})=>{let X={mode:"lrgb",r:NU($),g:NU(Z),b:NU(J)};if(Q!==void 0)X.alpha=Q;return X},o4=Ua;var Fa=($)=>{let{r:Z,g:J,b:Q,alpha:X}=o4($),z={mode:"xyz65",x:0.4123907992659593*Z+0.357584339383878*J+0.1804807884018343*Q,y:0.2126390058715102*Z+0.715168678767756*J+0.0721923153607337*Q,z:0.0193308187155918*Z+0.119194779794626*J+0.9505321522496607*Q};if(X!==void 0)z.alpha=X;return z},W4=Fa;var VU=($=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},Na=({r:$,g:Z,b:J,alpha:Q},X="rgb")=>{let z={mode:X,r:VU($),g:VU(Z),b:VU(J)};if(Q!==void 0)z.alpha=Q;return z},s4=Na;var Va=({x:$,y:Z,z:J,alpha:Q})=>{if($===void 0)$=0;if(Z===void 0)Z=0;if(J===void 0)J=0;let X=s4({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(Q!==void 0)X.alpha=Q;return X},B4=Va;var La={...n4,mode:"a98",parse:["a98-rgb"],serialize:"a98-rgb",fromMode:{rgb:($)=>FU(W4($)),xyz65:FU},toMode:{rgb:($)=>B4(qU($)),xyz65:qU}},Zj=La;var Ma=($)=>($=$%360)<0?$+360:$,a5=Ma;var Aa=($,Z)=>{return $.map((J,Q,X)=>{if(J===void 0)return J;let z=a5(J);if(Q===0||$[Q-1]===void 0)return z;return Z(z-a5(X[Q-1]))}).reduce((J,Q)=>{if(!J.length||Q===void 0||J[J.length-1]===void 0)return J.push(Q),J;return J.push(Q+J[J.length-1]),J},[])},F8=($)=>Aa($,(Z)=>Math.abs(Z)<=180?Z:Z-360*Math.sign(Z));var n1=[-0.14861,1.78277,-0.29227,-0.90649,1.97294,0],Jj=Math.PI/180,Qj=180/Math.PI;var Xj=n1[3]*n1[4],zj=n1[1]*n1[4],Gj=n1[1]*n1[2]-n1[0]*n1[3],_a=({r:$,g:Z,b:J,alpha:Q})=>{if($===void 0)$=0;if(Z===void 0)Z=0;if(J===void 0)J=0;let X=(Gj*J+$*Xj-Z*zj)/(Gj+Xj-zj),z=J-X,G=(n1[4]*(Z-X)-n1[2]*z)/n1[3],H={mode:"cubehelix",l:X,s:X===0||X===1?void 0:Math.sqrt(z*z+G*G)/(n1[4]*X*(1-X))};if(H.s)H.h=Math.atan2(G,z)*Qj-120;if(Q!==void 0)H.alpha=Q;return H},Hj=_a;var Da=({h:$,s:Z,l:J,alpha:Q})=>{let X={mode:"rgb"};if($=($===void 0?0:$+120)*Jj,J===void 0)J=0;let z=Z===void 0?0:Z*J*(1-J),G=Math.cos($),H=Math.sin($);if(X.r=J+z*(n1[0]*G+n1[1]*H),X.g=J+z*(n1[2]*G+n1[3]*H),X.b=J+z*(n1[4]*G+n1[5]*H),Q!==void 0)X.alpha=Q;return X},Yj=Da;var W6=($,Z)=>{if($.h===void 0||Z.h===void 0||!$.s||!Z.s)return 0;let J=a5($.h),Q=a5(Z.h),X=Math.sin((Q-J+360)/2*Math.PI/180);return 2*Math.sqrt($.s*Z.s)*X},Kj=($,Z)=>{if($.h===void 0||Z.h===void 0)return 0;let J=a5($.h),Q=a5(Z.h);if(Math.abs(Q-J)>180)return J-(Q-360*Math.sign(Q-J));return Q-J},B6=($,Z)=>{if($.h===void 0||Z.h===void 0||!$.c||!Z.c)return 0;let J=a5($.h),Q=a5(Z.h),X=Math.sin((Q-J+360)/2*Math.PI/180);return 2*Math.sqrt($.c*Z.c)*X};var N8=($)=>{let Z=$.reduce((Q,X)=>{if(X!==void 0){let z=X*Math.PI/180;Q.sin+=Math.sin(z),Q.cos+=Math.cos(z)}return Q},{sin:0,cos:0}),J=Math.atan2(Z.sin,Z.cos)*180/Math.PI;return J<0?360+J:J};var Oa={mode:"cubehelix",channels:["h","s","l","alpha"],parse:["--cubehelix"],serialize:"--cubehelix",ranges:{h:[0,360],s:[0,4.614],l:[0,1]},fromMode:{rgb:Hj},toMode:{rgb:Yj},interpolate:{h:{use:O0,fixup:F8},s:O0,l:O0,alpha:{use:O0,fixup:V5}},difference:{h:W6},average:{h:N8}},Wj=Oa;var Pa=({l:$,a:Z,b:J,alpha:Q},X="lch")=>{if(Z===void 0)Z=0;if(J===void 0)J=0;let z=Math.sqrt(Z*Z+J*J),G={mode:X,l:$,c:z};if(z)G.h=a5(Math.atan2(J,Z)*180/Math.PI);if(Q!==void 0)G.alpha=Q;return G},E4=Pa;var wa=({l:$,c:Z,h:J,alpha:Q},X="lab")=>{if(J===void 0)J=0;let z={mode:X,l:$,a:Z?Z*Math.cos(J/180*Math.PI):0,b:Z?Z*Math.sin(J/180*Math.PI):0};if(Q!==void 0)z.alpha=Q;return z},S4=wa;var WH=Math.pow(29,3)/Math.pow(3,3),BH=Math.pow(6,3)/Math.pow(29,3);var O1={X:0.9642956764295677,Y:1,Z:0.8251046025104602},q6={X:0.9504559270516716,Y:1,Z:1.0890577507598784},dP0=Math.pow(29,3)/Math.pow(3,3),lP0=Math.pow(6,3)/Math.pow(29,3);var LU=($)=>Math.pow($,3)>BH?Math.pow($,3):(116*$-16)/WH,ja=({l:$,a:Z,b:J,alpha:Q})=>{if($===void 0)$=0;if(Z===void 0)Z=0;if(J===void 0)J=0;let X=($+16)/116,z=Z/500+X,G=X-J/200,H={mode:"xyz65",x:LU(z)*q6.X,y:LU(X)*q6.Y,z:LU(G)*q6.Z};if(Q!==void 0)H.alpha=Q;return H},qH=ja;var Ta=($)=>B4(qH($)),U6=Ta;var MU=($)=>$>BH?Math.cbrt($):(WH*$+16)/116,Ca=({x:$,y:Z,z:J,alpha:Q})=>{if($===void 0)$=0;if(Z===void 0)Z=0;if(J===void 0)J=0;let X=MU($/q6.X),z=MU(Z/q6.Y),G=MU(J/q6.Z),H={mode:"lab65",l:116*z-16,a:500*(X-z),b:200*(z-G)};if(Q!==void 0)H.alpha=Q;return H},UH=Ca;var Ea=($)=>{let Z=UH(W4($));if($.r===$.b&&$.b===$.g)Z.a=Z.b=0;return Z},F6=Ea;var F$=1,FH=1,p3=0.14444444444444443*Math.PI,N$=Math.cos(p3),V$=Math.sin(p3),NH=100/Math.log(1.39);var Sa=({l:$,c:Z,h:J,alpha:Q})=>{if($===void 0)$=0;if(Z===void 0)Z=0;if(J===void 0)J=0;let X={mode:"lab65",l:(Math.exp($*F$/NH)-1)/0.0039},z=(Math.exp(0.0435*Z*FH*F$)-1)/0.075,G=z*Math.cos(J/180*Math.PI-p3),H=z*Math.sin(J/180*Math.PI-p3);if(X.a=G*N$-H/0.83*V$,X.b=G*V$+H/0.83*N$,Q!==void 0)X.alpha=Q;return X},XQ=Sa;var ka=({l:$,a:Z,b:J,alpha:Q})=>{if($===void 0)$=0;if(Z===void 0)Z=0;if(J===void 0)J=0;let X=Z*N$+J*V$,z=0.83*(J*N$-Z*V$),G=Math.sqrt(X*X+z*z),H={mode:"dlch",l:NH/F$*Math.log(1+0.0039*$),c:Math.log(1+0.075*G)/(0.0435*FH*F$)};if(H.c)H.h=a5((Math.atan2(z,X)+p3)/Math.PI*180);if(Q!==void 0)H.alpha=Q;return H},zQ=ka;var Bj=($)=>XQ(E4($,"dlch")),qj=($)=>S4(zQ($),"dlab"),Ia={mode:"dlab",parse:["--din99o-lab"],serialize:"--din99o-lab",toMode:{lab65:Bj,rgb:($)=>U6(Bj($))},fromMode:{lab65:qj,rgb:($)=>qj(F6($))},channels:["l","a","b","alpha"],ranges:{l:[0,100],a:[-40.09,45.501],b:[-40.469,44.344]},interpolate:{l:O0,a:O0,b:O0,alpha:{use:O0,fixup:V5}}},Uj=Ia;var Ra={mode:"dlch",parse:["--din99o-lch"],serialize:"--din99o-lch",toMode:{lab65:XQ,dlab:($)=>S4($,"dlab"),rgb:($)=>U6(XQ($))},fromMode:{lab65:zQ,dlab:($)=>E4($,"dlch"),rgb:($)=>zQ(F6($))},channels:["l","c","h","alpha"],ranges:{l:[0,100],c:[0,51.484],h:[0,360]},interpolate:{l:O0,c:O0,h:{use:O0,fixup:F8},alpha:{use:O0,fixup:V5}},difference:{h:B6},average:{h:N8}},Fj=Ra;function AU({h:$,s:Z,i:J,alpha:Q}){if($=a5($!==void 0?$:0),Z===void 0)Z=0;if(J===void 0)J=0;let X=Math.abs($/60%2-1),z;switch(Math.floor($/60)){case 0:z={r:J*(1+Z*(3/(2-X)-1)),g:J*(1+Z*(3*(1-X)/(2-X)-1)),b:J*(1-Z)};break;case 1:z={r:J*(1+Z*(3*(1-X)/(2-X)-1)),g:J*(1+Z*(3/(2-X)-1)),b:J*(1-Z)};break;case 2:z={r:J*(1-Z),g:J*(1+Z*(3/(2-X)-1)),b:J*(1+Z*(3*(1-X)/(2-X)-1))};break;case 3:z={r:J*(1-Z),g:J*(1+Z*(3*(1-X)/(2-X)-1)),b:J*(1+Z*(3/(2-X)-1))};break;case 4:z={r:J*(1+Z*(3*(1-X)/(2-X)-1)),g:J*(1-Z),b:J*(1+Z*(3/(2-X)-1))};break;case 5:z={r:J*(1+Z*(3/(2-X)-1)),g:J*(1-Z),b:J*(1+Z*(3*(1-X)/(2-X)-1))};break;default:z={r:J*(1-Z),g:J*(1-Z),b:J*(1-Z)}}if(z.mode="rgb",Q!==void 0)z.alpha=Q;return z}function _U({r:$,g:Z,b:J,alpha:Q}){if($===void 0)$=0;if(Z===void 0)Z=0;if(J===void 0)J=0;let X=Math.max($,Z,J),z=Math.min($,Z,J),G={mode:"hsi",s:$+Z+J===0?0:1-3*z/($+Z+J),i:($+Z+J)/3};if(X-z!==0)G.h=(X===$?(Z-J)/(X-z)+(Z<J)*6:X===Z?(J-$)/(X-z)+2:($-Z)/(X-z)+4)*60;if(Q!==void 0)G.alpha=Q;return G}var ya={mode:"hsi",toMode:{rgb:AU},parse:["--hsi"],serialize:"--hsi",fromMode:{rgb:_U},channels:["h","s","i","alpha"],ranges:{h:[0,360]},gamut:"rgb",interpolate:{h:{use:O0,fixup:F8},s:O0,i:O0,alpha:{use:O0,fixup:V5}},difference:{h:W6},average:{h:N8}},Nj=ya;function DU({h:$,s:Z,l:J,alpha:Q}){if($=a5($!==void 0?$:0),Z===void 0)Z=0;if(J===void 0)J=0;let X=J+Z*(J<0.5?J:1-J),z=X-(X-J)*2*Math.abs($/60%2-1),G;switch(Math.floor($/60)){case 0:G={r:X,g:z,b:2*J-X};break;case 1:G={r:z,g:X,b:2*J-X};break;case 2:G={r:2*J-X,g:X,b:z};break;case 3:G={r:2*J-X,g:z,b:X};break;case 4:G={r:z,g:2*J-X,b:X};break;case 5:G={r:X,g:2*J-X,b:z};break;default:G={r:2*J-X,g:2*J-X,b:2*J-X}}if(G.mode="rgb",Q!==void 0)G.alpha=Q;return G}function OU({r:$,g:Z,b:J,alpha:Q}){if($===void 0)$=0;if(Z===void 0)Z=0;if(J===void 0)J=0;let X=Math.max($,Z,J),z=Math.min($,Z,J),G={mode:"hsl",s:X===z?0:(X-z)/(1-Math.abs(X+z-1)),l:0.5*(X+z)};if(X-z!==0)G.h=(X===$?(Z-J)/(X-z)+(Z<J)*6:X===Z?(J-$)/(X-z)+2:($-Z)/(X-z)+4)*60;if(Q!==void 0)G.alpha=Q;return G}var ba=($,Z)=>{switch(Z){case"deg":return+$;case"rad":return $/Math.PI*180;case"grad":return $/10*9;case"turn":return $*360}},Vj=ba;var xa=new RegExp(`^hsla?\\(\\s*${dw}${K6}${m3}${K6}${m3}\\s*(?:,\\s*${ZQ}\\s*)?\\)$`),ha=($)=>{let Z=$.match(xa);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=Vj(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},Lj=ha;function ga($,Z){if(!Z||Z[0]!=="hsl"&&Z[0]!=="hsla")return;let J={mode:"hsl"},[,Q,X,z,G]=Z;if(Q.type!==_0.None){if(Q.type===_0.Percentage)return;J.h=Q.value}if(X.type!==_0.None){if(X.type===_0.Hue)return;J.s=X.value/100}if(z.type!==_0.None){if(z.type===_0.Hue)return;J.l=z.value/100}if(G.type!==_0.None)J.alpha=Math.min(1,Math.max(0,G.type===_0.Number?G.value:G.value/100));return J}var Mj=ga;var va={mode:"hsl",toMode:{rgb:DU},fromMode:{rgb:OU},channels:["h","s","l","alpha"],ranges:{h:[0,360]},gamut:"rgb",parse:[Mj,Lj],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:O0,fixup:F8},s:O0,l:O0,alpha:{use:O0,fixup:V5}},difference:{h:W6},average:{h:N8}},VH=va;function GQ({h:$,s:Z,v:J,alpha:Q}){if($=a5($!==void 0?$:0),Z===void 0)Z=0;if(J===void 0)J=0;let X=Math.abs($/60%2-1),z;switch(Math.floor($/60)){case 0:z={r:J,g:J*(1-Z*X),b:J*(1-Z)};break;case 1:z={r:J*(1-Z*X),g:J,b:J*(1-Z)};break;case 2:z={r:J*(1-Z),g:J,b:J*(1-Z*X)};break;case 3:z={r:J*(1-Z),g:J*(1-Z*X),b:J};break;case 4:z={r:J*(1-Z*X),g:J*(1-Z),b:J};break;case 5:z={r:J,g:J*(1-Z),b:J*(1-Z*X)};break;default:z={r:J*(1-Z),g:J*(1-Z),b:J*(1-Z)}}if(z.mode="rgb",Q!==void 0)z.alpha=Q;return z}function HQ({r:$,g:Z,b:J,alpha:Q}){if($===void 0)$=0;if(Z===void 0)Z=0;if(J===void 0)J=0;let X=Math.max($,Z,J),z=Math.min($,Z,J),G={mode:"hsv",s:X===0?0:1-z/X,v:X};if(X-z!==0)G.h=(X===$?(Z-J)/(X-z)+(Z<J)*6:X===Z?(J-$)/(X-z)+2:($-Z)/(X-z)+4)*60;if(Q!==void 0)G.alpha=Q;return G}var fa={mode:"hsv",toMode:{rgb:GQ},parse:["--hsv"],serialize:"--hsv",fromMode:{rgb:HQ},channels:["h","s","v","alpha"],ranges:{h:[0,360]},gamut:"rgb",interpolate:{h:{use:O0,fixup:F8},s:O0,v:O0,alpha:{use:O0,fixup:V5}},difference:{h:W6},average:{h:N8}},LH=fa;function PU({h:$,w:Z,b:J,alpha:Q}){if(Z===void 0)Z=0;if(J===void 0)J=0;if(Z+J>1){let X=Z+J;Z/=X,J/=X}return GQ({h:$,s:J===1?1:1-Z/(1-J),v:1-J,alpha:Q})}function wU($){let Z=HQ($);if(Z===void 0)return;let J=Z.s!==void 0?Z.s:0,Q=Z.v!==void 0?Z.v:0,X={mode:"hwb",w:(1-J)*Q,b:1-Q};if(Z.h!==void 0)X.h=Z.h;if(Z.alpha!==void 0)X.alpha=Z.alpha;return X}function ma($,Z){if(!Z||Z[0]!=="hwb")return;let J={mode:"hwb"},[,Q,X,z,G]=Z;if(Q.type!==_0.None){if(Q.type===_0.Percentage)return;J.h=Q.value}if(X.type!==_0.None){if(X.type===_0.Hue)return;J.w=X.value/100}if(z.type!==_0.None){if(z.type===_0.Hue)return;J.b=z.value/100}if(G.type!==_0.None)J.alpha=Math.min(1,Math.max(0,G.type===_0.Number?G.value:G.value/100));return J}var Aj=ma;var pa={mode:"hwb",toMode:{rgb:PU},fromMode:{rgb:wU},channels:["h","w","b","alpha"],ranges:{h:[0,360]},gamut:"rgb",parse:[Aj],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:O0,fixup:F8},w:O0,b:O0,alpha:{use:O0,fixup:V5}},difference:{h:Kj},average:{h:N8}},_j=pa;var MH=203;var AH=0.1593017578125;var _H=0.8359375,DH=18.8515625,OH=18.6875;function PH($){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 wH($){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 jU=($)=>Math.max($/MH,0),ua=({i:$,t:Z,p:J,alpha:Q})=>{if($===void 0)$=0;if(Z===void 0)Z=0;if(J===void 0)J=0;let X=PH($+0.008609037037932761*Z+0.11102962500302593*J),z=PH($-0.00860903703793275*Z-0.11102962500302599*J),G=PH($+0.5600313357106791*Z-0.32062717498731885*J),H={mode:"xyz65",x:jU(2.070152218389422*X-1.3263473389671556*z+0.2066510476294051*G),y:jU(0.3647385209748074*X+0.680566024947227*z-0.0453045459220346*G),z:jU(-0.049747207535812*X-0.0492609666966138*z+1.1880659249923042*G)};if(Q!==void 0)H.alpha=Q;return H},TU=ua;var CU=($=0)=>Math.max($*MH,0),ca=({x:$,y:Z,z:J,alpha:Q})=>{let X=CU($),z=CU(Z),G=CU(J),H=wH(0.3592832590121217*X+0.6976051147779502*z-0.0358915932320289*G),Y=wH(-0.1920808463704995*X+1.1004767970374323*z+0.0753748658519118*G),K=wH(0.0070797844607477*X+0.0748396662186366*z+0.8433265453898765*G),W=0.5*H+0.5*Y,B=1.61376953125*H-3.323486328125*Y+1.709716796875*K,q=4.378173828125*H-4.24560546875*Y-0.132568359375*K,U={mode:"itp",i:W,t:B,p:q};if(Q!==void 0)U.alpha=Q;return U},EU=ca;var da={mode:"itp",channels:["i","t","p","alpha"],parse:["--ictcp"],serialize:"--ictcp",toMode:{xyz65:TU,rgb:($)=>B4(TU($))},fromMode:{xyz65:EU,rgb:($)=>EU(W4($))},ranges:{i:[0,0.581],t:[-0.369,0.272],p:[-0.164,0.331]},interpolate:{i:O0,t:O0,p:O0,alpha:{use:O0,fixup:V5}}},Dj=da;var la=134.03437499999998,ia=0.000000000016295499532821565,SU=($)=>{if($<0)return 0;let Z=Math.pow($/1e4,AH);return Math.pow((_H+DH*Z)/(1+OH*Z),la)},kU=($=0)=>Math.max($*203,0),ra=({x:$,y:Z,z:J,alpha:Q})=>{$=kU($),Z=kU(Z),J=kU(J);let X=1.15*$-0.15*J,z=0.66*Z+0.34*$,G=SU(0.41478972*X+0.579999*z+0.014648*J),H=SU(-0.20151*X+1.120649*z+0.0531008*J),Y=SU(-0.0166008*X+0.2648*z+0.6684799*J),K=(G+H)/2,W={mode:"jab",j:0.44*K/(1-0.56*K)-ia,a:3.524*G-4.066708*H+0.542708*Y,b:0.199076*G+1.096799*H-1.295875*Y};if(Q!==void 0)W.alpha=Q;return W},jH=ra;var aa=134.03437499999998,Oj=0.000000000016295499532821565,IU=($)=>{if($<0)return 0;let Z=Math.pow($,1/aa);return 1e4*Math.pow((_H-Z)/(OH*Z-DH),1/AH)},RU=($)=>$/203,na=({j:$,a:Z,b:J,alpha:Q})=>{if($===void 0)$=0;if(Z===void 0)Z=0;if(J===void 0)J=0;let X=($+Oj)/(0.44+0.56*($+Oj)),z=IU(X+0.13860504*Z+0.058047316*J),G=IU(X-0.13860504*Z-0.058047316*J),H=IU(X-0.096019242*Z-0.8118919*J),Y={mode:"xyz65",x:RU(1.661373024652174*z-0.914523081304348*G+0.23136208173913045*H),y:RU(-0.3250758611844533*z+1.571847026732543*G-0.21825383453227928*H),z:RU(-0.090982811*z-0.31272829*G+1.5227666*H)};if(Q!==void 0)Y.alpha=Q;return Y},TH=na;var oa=($)=>{let Z=jH(W4($));if($.r===$.b&&$.b===$.g)Z.a=Z.b=0;return Z},CH=oa;var sa=($)=>B4(TH($)),EH=sa;var ta={mode:"jab",channels:["j","a","b","alpha"],parse:["--jzazbz"],serialize:"--jzazbz",fromMode:{rgb:CH,xyz65:jH},toMode:{rgb:EH,xyz65:TH},ranges:{j:[0,0.222],a:[-0.109,0.129],b:[-0.185,0.134]},interpolate:{j:O0,a:O0,b:O0,alpha:{use:O0,fixup:V5}}},Pj=ta;var ea=({j:$,a:Z,b:J,alpha:Q})=>{if(Z===void 0)Z=0;if(J===void 0)J=0;let X=Math.sqrt(Z*Z+J*J),z={mode:"jch",j:$,c:X};if(X)z.h=a5(Math.atan2(J,Z)*180/Math.PI);if(Q!==void 0)z.alpha=Q;return z},yU=ea;var $n=({j:$,c:Z,h:J,alpha:Q})=>{if(J===void 0)J=0;let X={mode:"jab",j:$,a:Z?Z*Math.cos(J/180*Math.PI):0,b:Z?Z*Math.sin(J/180*Math.PI):0};if(Q!==void 0)X.alpha=Q;return X},bU=$n;var Zn={mode:"jch",parse:["--jzczhz"],serialize:"--jzczhz",toMode:{jab:bU,rgb:($)=>EH(bU($))},fromMode:{rgb:($)=>yU(CH($)),jab:yU},channels:["j","c","h","alpha"],ranges:{j:[0,0.221],c:[0,0.19],h:[0,360]},interpolate:{h:{use:O0,fixup:F8},c:O0,j:O0,alpha:{use:O0,fixup:V5}},difference:{h:B6},average:{h:N8}},wj=Zn;var N6=Math.pow(29,3)/Math.pow(3,3),L$=Math.pow(6,3)/Math.pow(29,3);var xU=($)=>Math.pow($,3)>L$?Math.pow($,3):(116*$-16)/N6,Jn=({l:$,a:Z,b:J,alpha:Q})=>{if($===void 0)$=0;if(Z===void 0)Z=0;if(J===void 0)J=0;let X=($+16)/116,z=Z/500+X,G=X-J/200,H={mode:"xyz50",x:xU(z)*O1.X,y:xU(X)*O1.Y,z:xU(G)*O1.Z};if(Q!==void 0)H.alpha=Q;return H},M$=Jn;var Qn=({x:$,y:Z,z:J,alpha:Q})=>{if($===void 0)$=0;if(Z===void 0)Z=0;if(J===void 0)J=0;let X=s4({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(Q!==void 0)X.alpha=Q;return X},$9=Qn;var Xn=($)=>$9(M$($)),SH=Xn;var zn=($)=>{let{r:Z,g:J,b:Q,alpha:X}=o4($),z={mode:"xyz50",x:0.436065742824811*Z+0.3851514688337912*J+0.14307845442264197*Q,y:0.22249319175623702*Z+0.7168870538238823*J+0.06061979053616537*Q,z:0.013923904500943465*Z+0.09708128566574634*J+0.7140993584005155*Q};if(X!==void 0)z.alpha=X;return z},Z9=zn;var hU=($)=>$>L$?Math.cbrt($):(N6*$+16)/116,Gn=({x:$,y:Z,z:J,alpha:Q})=>{if($===void 0)$=0;if(Z===void 0)Z=0;if(J===void 0)J=0;let X=hU($/O1.X),z=hU(Z/O1.Y),G=hU(J/O1.Z),H={mode:"lab",l:116*z-16,a:500*(X-z),b:200*(z-G)};if(Q!==void 0)H.alpha=Q;return H},A$=Gn;var Hn=($)=>{let Z=A$(Z9($));if($.r===$.b&&$.b===$.g)Z.a=Z.b=0;return Z},kH=Hn;function Yn($,Z){if(!Z||Z[0]!=="lab")return;let J={mode:"lab"},[,Q,X,z,G]=Z;if(Q.type===_0.Hue||X.type===_0.Hue||z.type===_0.Hue)return;if(Q.type!==_0.None)J.l=Math.min(Math.max(0,Q.value),100);if(X.type!==_0.None)J.a=X.type===_0.Number?X.value:X.value*125/100;if(z.type!==_0.None)J.b=z.type===_0.Number?z.value:z.value*125/100;if(G.type!==_0.None)J.alpha=Math.min(1,Math.max(0,G.type===_0.Number?G.value:G.value/100));return J}var jj=Yn;var Kn={mode:"lab",toMode:{xyz50:M$,rgb:SH},fromMode:{xyz50:A$,rgb:kH},channels:["l","a","b","alpha"],ranges:{l:[0,100],a:[-125,125],b:[-125,125]},parse:[jj],serialize:($)=>`lab(${$.l!==void 0?$.l:"none"} ${$.a!==void 0?$.a:"none"} ${$.b!==void 0?$.b:"none"}${$.alpha<1?` / ${$.alpha}`:""})`,interpolate:{l:O0,a:O0,b:O0,alpha:{use:O0,fixup:V5}}},_$=Kn;var Wn={..._$,mode:"lab65",parse:["--lab-d65"],serialize:"--lab-d65",toMode:{xyz65:qH,rgb:U6},fromMode:{xyz65:UH,rgb:F6},ranges:{l:[0,100],a:[-125,125],b:[-125,125]}},Tj=Wn;function Bn($,Z){if(!Z||Z[0]!=="lch")return;let J={mode:"lch"},[,Q,X,z,G]=Z;if(Q.type!==_0.None){if(Q.type===_0.Hue)return;J.l=Math.min(Math.max(0,Q.value),100)}if(X.type!==_0.None)J.c=Math.max(0,X.type===_0.Number?X.value:X.value*150/100);if(z.type!==_0.None){if(z.type===_0.Percentage)return;J.h=z.value}if(G.type!==_0.None)J.alpha=Math.min(1,Math.max(0,G.type===_0.Number?G.value:G.value/100));return J}var Cj=Bn;var qn={mode:"lch",toMode:{lab:S4,rgb:($)=>SH(S4($))},fromMode:{rgb:($)=>E4(kH($)),lab:E4},channels:["l","c","h","alpha"],ranges:{l:[0,100],c:[0,150],h:[0,360]},parse:[Cj],serialize:($)=>`lch(${$.l!==void 0?$.l:"none"} ${$.c!==void 0?$.c:"none"} ${$.h!==void 0?$.h:"none"}${$.alpha<1?` / ${$.alpha}`:""})`,interpolate:{h:{use:O0,fixup:F8},c:O0,l:O0,alpha:{use:O0,fixup:V5}},difference:{h:B6},average:{h:N8}},D$=qn;var Un={...D$,mode:"lch65",parse:["--lch-d65"],serialize:"--lch-d65",toMode:{lab65:($)=>S4($,"lab65"),rgb:($)=>U6(S4($,"lab65"))},fromMode:{rgb:($)=>E4(F6($),"lch65"),lab65:($)=>E4($,"lch65")},ranges:{l:[0,100],c:[0,150],h:[0,360]}},Ej=Un;var Fn=({l:$,u:Z,v:J,alpha:Q})=>{if(Z===void 0)Z=0;if(J===void 0)J=0;let X=Math.sqrt(Z*Z+J*J),z={mode:"lchuv",l:$,c:X};if(X)z.h=a5(Math.atan2(J,Z)*180/Math.PI);if(Q!==void 0)z.alpha=Q;return z},gU=Fn;var Nn=({l:$,c:Z,h:J,alpha:Q})=>{if(J===void 0)J=0;let X={mode:"luv",l:$,u:Z?Z*Math.cos(J/180*Math.PI):0,v:Z?Z*Math.sin(J/180*Math.PI):0};if(Q!==void 0)X.alpha=Q;return X},vU=Nn;var Sj=($,Z,J)=>4*$/($+15*Z+3*J),kj=($,Z,J)=>9*Z/($+15*Z+3*J),Vn=Sj(O1.X,O1.Y,O1.Z),Ln=kj(O1.X,O1.Y,O1.Z),Mn=($)=>$<=L$?N6*$:116*Math.cbrt($)-16,An=({x:$,y:Z,z:J,alpha:Q})=>{if($===void 0)$=0;if(Z===void 0)Z=0;if(J===void 0)J=0;let X=Mn(Z/O1.Y),z=Sj($,Z,J),G=kj($,Z,J);if(!isFinite(z)||!isFinite(G))X=z=G=0;else z=13*X*(z-Vn),G=13*X*(G-Ln);let H={mode:"luv",l:X,u:z,v:G};if(Q!==void 0)H.alpha=Q;return H},YQ=An;var _n=($,Z,J)=>4*$/($+15*Z+3*J),Dn=($,Z,J)=>9*Z/($+15*Z+3*J),On=_n(O1.X,O1.Y,O1.Z),Pn=Dn(O1.X,O1.Y,O1.Z),wn=({l:$,u:Z,v:J,alpha:Q})=>{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 X=Z/(13*$)+On,z=J/(13*$)+Pn,G=O1.Y*($<=8?$/N6:Math.pow(($+16)/116,3)),H=G*(9*X)/(4*z),Y=G*(12-3*X-20*z)/(4*z),K={mode:"xyz50",x:H,y:G,z:Y};if(Q!==void 0)K.alpha=Q;return K},KQ=wn;var jn=($)=>gU(YQ(Z9($))),Tn=($)=>$9(KQ(vU($))),Cn={mode:"lchuv",toMode:{luv:vU,rgb:Tn},fromMode:{rgb:jn,luv:gU},channels:["l","c","h","alpha"],parse:["--lchuv"],serialize:"--lchuv",ranges:{l:[0,100],c:[0,176.956],h:[0,360]},interpolate:{h:{use:O0,fixup:F8},c:O0,l:O0,alpha:{use:O0,fixup:V5}},difference:{h:B6},average:{h:N8}},Ij=Cn;var En={...n4,mode:"lrgb",toMode:{rgb:s4},fromMode:{rgb:o4},parse:["srgb-linear"],serialize:"srgb-linear"},Rj=En;var Sn={mode:"luv",toMode:{xyz50:KQ,rgb:($)=>$9(KQ($))},fromMode:{xyz50:YQ,rgb:($)=>YQ(Z9($))},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:O0,u:O0,v:O0,alpha:{use:O0,fixup:V5}}},yj=Sn;var kn=({r:$,g:Z,b:J,alpha:Q})=>{if($===void 0)$=0;if(Z===void 0)Z=0;if(J===void 0)J=0;let X=Math.cbrt(0.412221469470763*$+0.5363325372617348*Z+0.0514459932675022*J),z=Math.cbrt(0.2119034958178252*$+0.6806995506452344*Z+0.1073969535369406*J),G=Math.cbrt(0.0883024591900564*$+0.2817188391361215*Z+0.6299787016738222*J),H={mode:"oklab",l:0.210454268309314*X+0.7936177747023054*z-0.0040720430116193*G,a:1.9779985324311684*X-2.42859224204858*z+0.450593709617411*G,b:0.0259040424655478*X+0.7827717124575296*z-0.8086757549230774*G};if(Q!==void 0)H.alpha=Q;return H},IH=kn;var In=($)=>{let Z=IH(o4($));if($.r===$.b&&$.b===$.g)Z.a=Z.b=0;return Z},V6=In;var Rn=({l:$,a:Z,b:J,alpha:Q})=>{if($===void 0)$=0;if(Z===void 0)Z=0;if(J===void 0)J=0;let X=Math.pow($+0.3963377773761749*Z+0.2158037573099136*J,3),z=Math.pow($-0.1055613458156586*Z-0.0638541728258133*J,3),G=Math.pow($-0.0894841775298119*Z-1.2914855480194092*J,3),H={mode:"lrgb",r:4.076741636075957*X-3.3077115392580616*z+0.2309699031821044*G,g:-1.2684379732850317*X+2.6097573492876887*z-0.3413193760026573*G,b:-0.0041960761386756*X-0.7034186179359362*z+1.7076146940746117*G};if(Q!==void 0)H.alpha=Q;return H},J9=Rn;var yn=($)=>s4(J9($)),L6=yn;function WQ($){return 0.5*(1.170873786407767*$-0.206+Math.sqrt((1.170873786407767*$-0.206)*(1.170873786407767*$-0.206)+0.14050485436893204*$))}function u3($){return($*$+0.206*$)/(1.170873786407767*($+0.03))}function bn($,Z){let J,Q,X,z,G,H,Y,K;if(-1.88170328*$-0.80936493*Z>1)J=1.19086277,Q=1.76576728,X=0.59662641,z=0.75515197,G=0.56771245,H=4.0767416621,Y=-3.3077115913,K=0.2309699292;else if(1.81444104*$-1.19445276*Z>1)J=0.73956515,Q=-0.45954404,X=0.08285427,z=0.1254107,G=0.14503204,H=-1.2684380046,Y=2.6097574011,K=-0.3413193965;else J=1.35733652,Q=-0.00915799,X=-1.1513021,z=-0.50559606,G=0.00692167,H=-0.0041960863,Y=-0.7034186147,K=1.707614701;let W=J+Q*$+X*Z+z*$*$+G*$*Z,B=0.3963377774*$+0.2158037573*Z,q=-0.1055613458*$-0.0638541728*Z,U=-0.0894841775*$-1.291485548*Z;{let F=1+W*B,N=1+W*q,L=1+W*U,V=F*F*F,M=N*N*N,_=L*L*L,O=3*B*F*F,D=3*q*N*N,A=3*U*L*L,E=6*B*B*F,I=6*q*q*N,y=6*U*U*L,C=H*V+Y*M+K*_,h=H*O+Y*D+K*A,k=H*E+Y*I+K*y;W=W-C*h/(h*h-0.5*C*k)}return W}function fU($,Z){let J=bn($,Z),Q=J9({l:1,a:J*$,b:J*Z}),X=Math.cbrt(1/Math.max(Q.r,Q.g,Q.b)),z=X*J;return[X,z]}function xn($,Z,J,Q,X,z=null){if(!z)z=fU($,Z);let G;if((J-X)*z[1]-(z[0]-X)*Q<=0)G=z[1]*X/(Q*z[0]+z[1]*(X-J));else{G=z[1]*(X-1)/(Q*(z[0]-1)+z[1]*(X-J));{let H=J-X,Y=Q,K=0.3963377774*$+0.2158037573*Z,W=-0.1055613458*$-0.0638541728*Z,B=-0.0894841775*$-1.291485548*Z,q=H+Y*K,U=H+Y*W,F=H+Y*B;{let N=X*(1-G)+G*J,L=G*Q,V=N+L*K,M=N+L*W,_=N+L*B,O=V*V*V,D=M*M*M,A=_*_*_,E=3*q*V*V,I=3*U*M*M,y=3*F*_*_,C=6*q*q*V,h=6*U*U*M,k=6*F*F*_,S=4.0767416621*O-3.3077115913*D+0.2309699292*A-1,w=4.0767416621*E-3.3077115913*I+0.2309699292*y,T=4.0767416621*C-3.3077115913*h+0.2309699292*k,R=w/(w*w-0.5*S*T),b=-S*R,g=-1.2684380046*O+2.6097574011*D-0.3413193965*A-1,u=-1.2684380046*E+2.6097574011*I-0.3413193965*y,j=-1.2684380046*C+2.6097574011*h-0.3413193965*k,t=u/(u*u-0.5*g*j),Q0=-g*t,x=-0.0041960863*O-0.7034186147*D+1.707614701*A-1,e=-0.0041960863*E-0.7034186147*I+1.707614701*y,M0=-0.0041960863*C-0.7034186147*h+1.707614701*k,l=e/(e*e-0.5*x*M0),H0=-x*l;b=R>=0?b:1e6,Q0=t>=0?Q0:1e6,H0=l>=0?H0:1e6,G+=Math.min(b,Math.min(Q0,H0))}}}return G}function BQ($,Z,J=null){if(!J)J=fU($,Z);let Q=J[0],X=J[1];return[X/Q,X/(1-Q)]}function RH($,Z,J){let Q=fU(Z,J),X=xn(Z,J,$,1,$,Q),z=BQ(Z,J,Q),G=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)))),H=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)))),Y=X/Math.min($*z[0],(1-$)*z[1]),K=$*G,W=(1-$)*H,B=0.9*Y*Math.sqrt(Math.sqrt(1/(1/(K*K*K*K)+1/(W*W*W*W))));return K=$*0.4,W=(1-$)*0.8,[Math.sqrt(1/(1/(K*K)+1/(W*W))),B,X]}function yH($){let Z=$.l!==void 0?$.l:0,J=$.a!==void 0?$.a:0,Q=$.b!==void 0?$.b:0,X={mode:"okhsl",l:WQ(Z)};if($.alpha!==void 0)X.alpha=$.alpha;let z=Math.sqrt(J*J+Q*Q);if(!z)return X.s=0,X;let[G,H,Y]=RH(Z,J/z,Q/z),K;if(z<H){let W=0,B=0.8*G,q=1-B/H;K=(z-W)/(B+q*(z-W))*0.8}else{let W=H,B=0.2*H*H*1.25*1.25/G,q=1-B/(Y-H);K=0.8+0.2*((z-W)/(B+q*(z-W)))}if(K)X.s=K,X.h=a5(Math.atan2(Q,J)*180/Math.PI);return X}function bH($){let Z=$.h!==void 0?$.h:0,J=$.s!==void 0?$.s:0,Q=$.l!==void 0?$.l:0,X={mode:"oklab",l:u3(Q)};if($.alpha!==void 0)X.alpha=$.alpha;if(!J||Q===1)return X.a=X.b=0,X;let z=Math.cos(Z/180*Math.PI),G=Math.sin(Z/180*Math.PI),[H,Y,K]=RH(X.l,z,G),W,B,q,U;if(J<0.8)W=1.25*J,B=0,q=0.8*H,U=1-q/Y;else W=5*(J-0.8),B=Y,q=0.2*Y*Y*1.25*1.25/H,U=1-q/(K-Y);let F=B+W*q/(1-U*W);return X.a=F*z,X.b=F*G,X}var hn={...VH,mode:"okhsl",channels:["h","s","l","alpha"],parse:["--okhsl"],serialize:"--okhsl",fromMode:{oklab:yH,rgb:($)=>yH(V6($))},toMode:{oklab:bH,rgb:($)=>L6(bH($))}},bj=hn;function xH($){let Z=$.l!==void 0?$.l:0,J=$.a!==void 0?$.a:0,Q=$.b!==void 0?$.b:0,X=Math.sqrt(J*J+Q*Q),z=X?J/X:1,G=X?Q/X:1,[H,Y]=BQ(z,G),K=0.5,W=1-K/H,B=Y/(X+Z*Y),q=B*Z,U=B*X,F=u3(q),N=U*F/q,L=J9({l:F,a:z*N,b:G*N}),V=Math.cbrt(1/Math.max(L.r,L.g,L.b,0));Z=Z/V,X=X/V*WQ(Z)/Z,Z=WQ(Z);let M={mode:"okhsv",s:X?(K+Y)*U/(Y*K+Y*W*U):0,v:Z?Z/q:0};if(M.s)M.h=a5(Math.atan2(Q,J)*180/Math.PI);if($.alpha!==void 0)M.alpha=$.alpha;return M}function hH($){let Z={mode:"oklab"};if($.alpha!==void 0)Z.alpha=$.alpha;let J=$.h!==void 0?$.h:0,Q=$.s!==void 0?$.s:0,X=$.v!==void 0?$.v:0,z=Math.cos(J/180*Math.PI),G=Math.sin(J/180*Math.PI),[H,Y]=BQ(z,G),K=0.5,W=1-K/H,B=1-Q*K/(K+Y-Y*W*Q),q=Q*Y*K/(K+Y-Y*W*Q),U=u3(B),F=q*U/B,N=J9({l:U,a:z*F,b:G*F}),L=Math.cbrt(1/Math.max(N.r,N.g,N.b,0)),V=u3(X*B),M=q*V/B;return Z.l=V*L,Z.a=M*z*L,Z.b=M*G*L,Z}var gn={...LH,mode:"okhsv",channels:["h","s","v","alpha"],parse:["--okhsv"],serialize:"--okhsv",fromMode:{oklab:xH,rgb:($)=>xH(V6($))},toMode:{oklab:hH,rgb:($)=>L6(hH($))}},xj=gn;function vn($,Z){if(!Z||Z[0]!=="oklab")return;let J={mode:"oklab"},[,Q,X,z,G]=Z;if(Q.type===_0.Hue||X.type===_0.Hue||z.type===_0.Hue)return;if(Q.type!==_0.None)J.l=Math.min(Math.max(0,Q.type===_0.Number?Q.value:Q.value/100),1);if(X.type!==_0.None)J.a=X.type===_0.Number?X.value:X.value*0.4/100;if(z.type!==_0.None)J.b=z.type===_0.Number?z.value:z.value*0.4/100;if(G.type!==_0.None)J.alpha=Math.min(1,Math.max(0,G.type===_0.Number?G.value:G.value/100));return J}var hj=vn;var fn={..._$,mode:"oklab",toMode:{lrgb:J9,rgb:L6},fromMode:{lrgb:IH,rgb:V6},ranges:{l:[0,1],a:[-0.4,0.4],b:[-0.4,0.4]},parse:[hj],serialize:($)=>`oklab(${$.l!==void 0?$.l:"none"} ${$.a!==void 0?$.a:"none"} ${$.b!==void 0?$.b:"none"}${$.alpha<1?` / ${$.alpha}`:""})`},gj=fn;function mn($,Z){if(!Z||Z[0]!=="oklch")return;let J={mode:"oklch"},[,Q,X,z,G]=Z;if(Q.type!==_0.None){if(Q.type===_0.Hue)return;J.l=Math.min(Math.max(0,Q.type===_0.Number?Q.value:Q.value/100),1)}if(X.type!==_0.None)J.c=Math.max(0,X.type===_0.Number?X.value:X.value*0.4/100);if(z.type!==_0.None){if(z.type===_0.Percentage)return;J.h=z.value}if(G.type!==_0.None)J.alpha=Math.min(1,Math.max(0,G.type===_0.Number?G.value:G.value/100));return J}var vj=mn;var pn={...D$,mode:"oklch",toMode:{oklab:($)=>S4($,"oklab"),rgb:($)=>L6(S4($,"oklab"))},fromMode:{rgb:($)=>E4(V6($),"oklch"),oklab:($)=>E4($,"oklch")},parse:[vj],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]}},fj=pn;var un=($)=>{let{r:Z,g:J,b:Q,alpha:X}=o4($),z={mode:"xyz65",x:0.486570948648216*Z+0.265667693169093*J+0.1982172852343625*Q,y:0.2289745640697487*Z+0.6917385218365062*J+0.079286914093745*Q,z:0*Z+0.0451133818589026*J+1.043944368900976*Q};if(X!==void 0)z.alpha=X;return z},mU=un;var cn=({x:$,y:Z,z:J,alpha:Q})=>{if($===void 0)$=0;if(Z===void 0)Z=0;if(J===void 0)J=0;let X=s4({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(Q!==void 0)X.alpha=Q;return X},pU=cn;var dn={...n4,mode:"p3",parse:["display-p3"],serialize:"display-p3",fromMode:{rgb:($)=>pU(W4($)),xyz65:pU},toMode:{rgb:($)=>B4(mU($)),xyz65:mU}},mj=dn;var uU=($)=>{let Z=Math.abs($);if(Z>=0.001953125)return Math.sign($)*Math.pow(Z,0.5555555555555556);return 16*$},ln=({x:$,y:Z,z:J,alpha:Q})=>{if($===void 0)$=0;if(Z===void 0)Z=0;if(J===void 0)J=0;let X={mode:"prophoto",r:uU($*1.3457868816471585-Z*0.2555720873797946-0.0511018649755453*J),g:uU($*-0.5446307051249019+Z*1.5082477428451466+0.0205274474364214*J),b:uU($*0+Z*0+1.2119675456389452*J)};if(Q!==void 0)X.alpha=Q;return X},cU=ln;var dU=($=0)=>{let Z=Math.abs($);if(Z>=0.03125)return Math.sign($)*Math.pow(Z,1.8);return $/16},rn=($)=>{let Z=dU($.r),J=dU($.g),Q=dU($.b),X={mode:"xyz50",x:0.7977666449006423*Z+0.1351812974005331*J+0.0313477341283922*Q,y:0.2880748288194013*Z+0.7118352342418731*J+0.0000899369387256*Q,z:0*Z+0*J+0.8251046025104602*Q};if($.alpha!==void 0)X.alpha=$.alpha;return X},lU=rn;var an={...n4,mode:"prophoto",parse:["prophoto-rgb"],serialize:"prophoto-rgb",fromMode:{xyz50:cU,rgb:($)=>cU(Z9($))},toMode:{xyz50:lU,rgb:($)=>$9(lU($))}},pj=an;var iU=($)=>{let Z=Math.abs($);if(Z>0.018053968510807)return(Math.sign($)||1)*(1.09929682680944*Math.pow(Z,0.45)-0.09929682680944008);return 4.5*$},nn=({x:$,y:Z,z:J,alpha:Q})=>{if($===void 0)$=0;if(Z===void 0)Z=0;if(J===void 0)J=0;let X={mode:"rec2020",r:iU($*1.7166511879712683-Z*0.3556707837763925-0.2533662813736599*J),g:iU($*-0.6666843518324893+Z*1.6164812366349395+0.0157685458139111*J),b:iU($*0.0176398574453108-Z*0.0427706132578085+0.9421031212354739*J)};if(Q!==void 0)X.alpha=Q;return X},rU=nn;var aU=($=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)},on=($)=>{let Z=aU($.r),J=aU($.g),Q=aU($.b),X={mode:"xyz65",x:0.6369580483012911*Z+0.1446169035862083*J+0.1688809751641721*Q,y:0.262700212011267*Z+0.6779980715188708*J+0.059301716469862*Q,z:0*Z+0.0280726930490874*J+1.0609850577107909*Q};if($.alpha!==void 0)X.alpha=$.alpha;return X},nU=on;var sn={...n4,mode:"rec2020",fromMode:{xyz65:rU,rgb:($)=>rU(W4($))},toMode:{xyz65:nU,rgb:($)=>B4(nU($))},parse:["rec2020"],serialize:"rec2020"},uj=sn;var M6=0.0037930732552754493,gH=Math.cbrt(0.0037930732552754493);var oU=($)=>Math.cbrt($)-gH,tn=($)=>{let{r:Z,g:J,b:Q,alpha:X}=o4($),z=oU(0.3*Z+0.622*J+0.078*Q+M6),G=oU(0.23*Z+0.692*J+0.078*Q+M6),H=oU(0.2434226892454782*Z+0.2047674442449682*J+0.5518098665095535*Q+M6),Y={mode:"xyb",x:(z-G)/2,y:(z+G)/2,b:H-(z+G)/2};if(X!==void 0)Y.alpha=X;return Y},cj=tn;var sU=($)=>Math.pow($+gH,3),en=({x:$,y:Z,b:J,alpha:Q})=>{if($===void 0)$=0;if(Z===void 0)Z=0;if(J===void 0)J=0;let X=sU($+Z)-M6,z=sU(Z-$)-M6,G=sU(J+Z)-M6,H=s4({r:11.031566904639861*X-9.866943908131562*z-0.16462299650829934*G,g:-3.2541473810744237*X+4.418770377582723*z-0.16462299650829934*G,b:-3.6588512867136815*X+2.7129230459360922*z+1.9459282407775895*G});if(Q!==void 0)H.alpha=Q;return H},dj=en;var $o={mode:"xyb",channels:["x","y","b","alpha"],parse:["--xyb"],serialize:"--xyb",toMode:{rgb:dj},fromMode:{rgb:cj},ranges:{x:[-0.0154,0.0281],y:[0,0.8453],b:[-0.2778,0.388]},interpolate:{x:O0,y:O0,b:O0,alpha:{use:O0,fixup:V5}}},lj=$o;var Zo={mode:"xyz50",parse:["xyz-d50"],serialize:"xyz-d50",toMode:{rgb:$9,lab:A$},fromMode:{rgb:Z9,lab:M$},channels:["x","y","z","alpha"],ranges:{x:[0,0.964],y:[0,0.999],z:[0,0.825]},interpolate:{x:O0,y:O0,z:O0,alpha:{use:O0,fixup:V5}}},ij=Zo;var Jo=($)=>{let{x:Z,y:J,z:Q,alpha:X}=$;if(Z===void 0)Z=0;if(J===void 0)J=0;if(Q===void 0)Q=0;let z={mode:"xyz50",x:1.0479298208405488*Z+0.0229467933410191*J-0.0501922295431356*Q,y:0.0296278156881593*Z+0.990434484573249*J-0.0170738250293851*Q,z:-0.0092430581525912*Z+0.0150551448965779*J+0.7518742899580008*Q};if(X!==void 0)z.alpha=X;return z},rj=Jo;var Qo=($)=>{let{x:Z,y:J,z:Q,alpha:X}=$;if(Z===void 0)Z=0;if(J===void 0)J=0;if(Q===void 0)Q=0;let z={mode:"xyz65",x:0.9554734527042182*Z-0.0230985368742614*J+0.0632593086610217*Q,y:-0.0283697069632081*Z+1.0099954580058226*J+0.021041398966943*Q,z:0.0123140016883199*Z-0.0205076964334779*J+1.3303659366080753*Q};if(X!==void 0)z.alpha=X;return z},aj=Qo;var Xo={mode:"xyz65",toMode:{rgb:B4,xyz50:rj},fromMode:{rgb:W4,xyz50:aj},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:O0,y:O0,z:O0,alpha:{use:O0,fixup:V5}}},nj=Xo;var zo=({r:$,g:Z,b:J,alpha:Q})=>{if($===void 0)$=0;if(Z===void 0)Z=0;if(J===void 0)J=0;let X={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(Q!==void 0)X.alpha=Q;return X},oj=zo;var Go=({y:$,i:Z,q:J,alpha:Q})=>{if($===void 0)$=0;if(Z===void 0)Z=0;if(J===void 0)J=0;let X={mode:"rgb",r:$+0.95608445*Z+0.6208885*J,g:$-0.27137664*Z-0.6486059*J,b:$-1.10561724*Z+1.70250126*J};if(Q!==void 0)X.alpha=Q;return X},sj=Go;var Ho={mode:"yiq",toMode:{rgb:sj},fromMode:{rgb:oj},channels:["y","i","q","alpha"],parse:["--yiq"],serialize:"--yiq",ranges:{i:[-0.595,0.595],q:[-0.522,0.522]},interpolate:{y:O0,i:O0,q:O0,alpha:{use:O0,fixup:V5}}},tj=Ho;function tU($){let Z=GH("lrgb")($);return 0.2126*Z.r+0.7152*Z.g+0.0722*Z.b}var mk0=v5(Zj),pk0=v5(Wj),uk0=v5(Uj),ck0=v5(Fj),dk0=v5(Nj),lk0=v5(VH),ik0=v5(LH),rk0=v5(_j),ak0=v5(Dj),nk0=v5(Pj),ok0=v5(wj),sk0=v5(_$),tk0=v5(Tj),ek0=v5(D$),$I0=v5(Ej),ZI0=v5(Ij),JI0=v5(Rj),QI0=v5(yj),XI0=v5(bj),zI0=v5(xj),GI0=v5(gj),HI0=v5(fj),YI0=v5(mj),KI0=v5(pj),WI0=v5(uj),BI0=v5(n4),qI0=v5(lj),UI0=v5(ij),FI0=v5(nj),NI0=v5(tj);var A6={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"}},qQ={squishy:{label:"Squishy",radius:"0.875rem"},soft:{label:"Soft",radius:"0.625rem"},subtle:{label:"Subtle",radius:"0.375rem"},square:{label:"Square",radius:"0"}},$T="oklch(0.205 0 0)";function ej($){return tU($)>0.3?"oklch(0 0 0)":"oklch(1 0 0)"}var ZT={workspace:{primary:($)=>$,primaryForeground:($)=>ej($),background:()=>"color-mix(in oklch, var(--primary) 3%, oklch(1 0 0) 97%)",foreground:()=>"color-mix(var(--primary) 20%, oklch(0 0 0) 80%)",muted:()=>"color-mix(in oklch, var(--background) 97%, var(--foreground) 3%)",mutedForeground:()=>"color-mix(var(--background) 50%, var(--foreground) 50%)",accent:()=>"color-mix(in oklch, var(--primary) 4%, var(--foreground) 4%)",accentForeground:()=>"var(--foreground)",border:()=>"color-mix(in oklch, var(--foreground) 7%, transparent)"},widget:{background:($)=>$,foreground:($)=>ej($),primary:()=>"color-mix(in oklch, var(--background) 3%, oklch(1 0 0) 97%)",primaryForeground:()=>"color-mix(var(--background) 20%, oklch(0 0 0) 80%)",muted:()=>"color-mix(in oklch, var(--background) 97%, var(--foreground) 3%)",mutedForeground:()=>"color-mix(var(--background) 50%, var(--foreground) 50%)",accent:()=>"color-mix(in oklch, var(--primary) 4%, var(--foreground) 4%)",accentForeground:()=>"var(--foreground)",border:()=>"color-mix(in oklch, var(--foreground) 15%, transparent)"}},eU=Object.keys(ZT.workspace);function JT($,Z="workspace"){let J={},Q=ZT[Z];for(let X of eU)J[X]=Q[X]($);return J}var UQ={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)"}},c3={font:"sans",color:"default",radius:"soft"};function FQ($){return{...c3,...$}}var $F="moi-fonts",QT="moi-font-previews",Yo=Object.values(A6).map(($)=>$.googleFontsQuery).filter(Boolean).join("&family="),zT=[["sans","--sans"],["mono","--mono"]],GT=eU.map(($)=>[$,Ko($)]),HT="--radius",XT=[...zT.map(([,$])=>$),...GT.map(([,$])=>$),HT];function Ko($){return`--${$.replace(/[A-Z]/g,(J)=>`-${J.toLowerCase()}`)}`}function Q9($,Z="workspace"){let J={},Q=FQ($),X=A6[Q.font]??A6[c3.font],G=(UQ[Q.color]??UQ[c3.color]).primary??(Z==="widget"?$T:void 0),H=G?JT(G,Z):void 0,Y=qQ[Q.radius]??qQ[c3.radius];for(let[K,W]of zT)J[W]=X[K];for(let[K,W]of GT)J[W]=H?.[K];return J[HT]=Y.radius,J}function fH(){vH.useEffect(()=>{if(document.getElementById(QT))return;let $=document.createElement("link");return $.id=QT,$.rel="stylesheet",$.href=`https://fonts.googleapis.com/css2?family=${Yo}&display=swap`,document.head.appendChild($),()=>{$.remove()}},[])}function Wo($){vH.useEffect(()=>{let Z=document.documentElement,J=Q9($);for(let Q of XT){let X=J[Q];if(X)Z.style.setProperty(Q,X);else Z.style.removeProperty(Q)}return()=>{for(let Q of XT)Z.style.removeProperty(Q)}},[$])}function YT($){let{font:Z}=FQ($);Wo($),vH.useEffect(()=>{let J=A6[Z]??A6[c3.font],Q=document.getElementById($F);if(!J.googleFontsQuery)Q?.remove();else{let X=`https://fonts.googleapis.com/css2?family=${J.googleFontsQuery}&display=swap`;if(Q)Q.href=X;else{let z=document.createElement("link");z.id=$F,z.rel="stylesheet",z.href=X,document.head.appendChild(z)}}return()=>{document.getElementById($F)?.remove()}},[Z])}var O$=P(v(),1);var V8=P(d(),1),NQ={width:320,height:180,radius:32,topLeftRadius:18,bodyTop:24,tabEnd:124,shoulder:{width:48,roundness:20}};function Bo($){let{width:Z,height:J,radius:Q,topLeftRadius:X,bodyTop:z,tabEnd:G,shoulder:H}=NQ,Y=Math.min(Z/2,Q*$),K=Math.min(Z/2,X*$),W=Math.max(0,H.width),B=G+W,q=Math.max(0,Math.min(H.roundness,W/2));return[`M ${K} 0`,`H ${G}`,`C ${G+q} 0 ${B-q} ${z} ${B} ${z}`,`H ${Z-Y}`,`Q ${Z} ${z} ${Z} ${z+Q}`,`V ${J-Q}`,`Q ${Z} ${J} ${Z-Y} ${J}`,`H ${Y}`,`Q 0 ${J} 0 ${J-Q}`,`V ${X}`,`Q 0 0 ${K} 0`,"Z"].join(" ")}function qo(){let $=O$.useRef(null),[Z,J]=O$.useState(1);return O$.useLayoutEffect(()=>{let Q=$.current;if(!Q)return;let X=(H,Y)=>{if(H<=0||Y<=0)return;let K=H/NQ.width,B=Y/NQ.height/K;J((q)=>Math.abs(q-B)<0.001?q:B)},z=Q.getBoundingClientRect();X(z.width,z.height);let G=new ResizeObserver(([H])=>{if(H)X(H.contentRect.width,H.contentRect.height)});return G.observe(Q),()=>G.disconnect()},[]),{ref:$,horizontalRadiusScale:Z}}var mH=[s("opacity-40","-translate-x-3 translate-y-3 -rotate-6","group-hover:translate-y-2 group-focus-visible:translate-y-2"),s("opacity-50","translate-x-3 translate-y-2 rotate-5","group-hover:translate-y-1 group-focus-visible:translate-y-1"),s("opacity-100","-translate-x-1 translate-y-1 -rotate-2","group-hover:-translate-y-2 group-focus-visible:-translate-y-2")];function KT({workspaceId:$}){let Z=WG($),J=Z.data?[...Z.data.thumbnails].reverse():[],Q=mH.slice(mH.length-J.length),X=Z.data?.firstUserMessage,z=Z.data?.theme,{ref:G,horizontalRadiusScale:H}=qo(),Y=Bo(H),K=`folder-noise-${$}`,W=Q9(z);return V8.jsxs("div",{ref:G,style:W,className:"relative h-45 w-full font-sans",children:[V8.jsxs("svg",{viewBox:`0 0 ${NQ.width} ${NQ.height}`,preserveAspectRatio:"none","aria-hidden":"true",className:"absolute inset-0 h-full w-full overflow-visible",children:[V8.jsx("defs",{children:V8.jsxs("filter",{id:K,x:"0%",y:"0%",width:"100%",height:"100%",colorInterpolationFilters:"sRGB",children:[V8.jsx("feTurbulence",{type:"fractalNoise",baseFrequency:"0.5",numOctaves:"3",seed:"7",result:"noise"}),V8.jsx("feColorMatrix",{in:"noise",type:"saturate",values:"0",result:"monochromeNoise"}),V8.jsx("feComponentTransfer",{in:"monochromeNoise",result:"faintNoise",children:V8.jsx("feFuncA",{type:"linear",slope:"0.24"})}),V8.jsx("feComposite",{in:"faintNoise",in2:"SourceAlpha",operator:"in",result:"clippedNoise"}),V8.jsx("feBlend",{in:"SourceGraphic",in2:"clippedNoise",mode:"soft-light"})]})}),V8.jsx("path",{d:Y,filter:`url(#${K})`,className:"fill-accent"})]}),J.map((B,q)=>V8.jsx("img",{src:B,alt:"",loading:"lazy",className:s("absolute top-[12%] left-[14%] aspect-4/3 w-[72%] rounded-lg object-cover object-top shadow-xs","animate-in transition-transform duration-300 ease-out fade-in",Q[q])},q)),J.length===0&&X&&V8.jsx("div",{className:"absolute inset-x-[12%] top-[22%] flex justify-end",children:V8.jsx("div",{"aria-hidden":"true",className:s("w-max max-w-40 origin-center rounded-lg bg-card px-3 py-2 shadow-xs","animate-in transition-transform duration-300 ease-out fade-in",mH[mH.length-1],"group-hover:translate-y-0.5 group-focus-visible:translate-y-0.5"),children:V8.jsx("p",{className:"line-clamp-3 text-sm leading-normal whitespace-normal",children:X})})}),V8.jsx("div",{className:s("absolute inset-x-2 top-[40%] bottom-2 rounded-2xl 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 Q5=P(d(),1);function BT(){fH();let[,$]=g4(),Z=KG(),J=wO(),Q=BG(),X=Tw({onSuccess:(B)=>$(`/workspace/${B.id}`)}),z=D1((B)=>B.discoveredWorkspacesOpen),G=D1((B)=>B.setDiscoveredWorkspacesOpen);if(Z.isPending||J.isPending)return Q5.jsx("div",{className:"flex min-h-[50vh] items-center justify-center",children:Q5.jsx(T1,{size:20,stroke:1.5,className:"animate-spin text-muted-foreground"})});if(Z.isError||J.isError)return Q5.jsx("div",{className:"flex min-h-[50vh] items-center justify-center",children:Q5.jsx("p",{className:"text-sm text-muted-foreground",children:"Could not load spaces."})});let H=Z.data,Y=J.data,K=H.length;function W(B){X.startImport(B)}return Q5.jsxs("div",{className:"mx-auto w-full max-w-3xl px-8 pt-14 pb-16",children:[Q5.jsx(kw,{className:"mb-10"}),K>0?Q5.jsxs("section",{className:"mb-12",children:[Q5.jsxs("div",{className:"mb-4 flex items-center justify-between gap-2",children:[Q5.jsx("h1",{className:"text-sm font-medium text-foreground",children:"My workspaces"}),Q5.jsx(hJ,{trigger:Q5.jsxs(k0,{variant:"outline",size:"sm",children:[Q5.jsx(K4,{"data-icon":"inline-start",stroke:1.75}),"New"]})})]}),Q5.jsx("div",{className:"grid grid-cols-1 gap-x-4 gap-y-8 sm:grid-cols-2 md:grid-cols-3",children:H.map((B)=>Q5.jsx(Uo,{workspace:B},B.id))})]}):Q5.jsxs("div",{className:"mb-10 flex flex-col items-center gap-4 px-8 pt-8 pb-16 text-center",children:[Q5.jsx(WT,{size:32,stroke:1.5,className:"text-muted-foreground"}),Q5.jsxs("div",{className:"flex flex-col gap-1.5",children:[Q5.jsx("h2",{className:"font-medium",children:"Let’s start with creating your first workspace"}),Q5.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."})]}),Q5.jsx(hJ,{trigger:Q5.jsx(k0,{children:"Create workspace"})})]}),Y.length>0&&Q5.jsx("section",{children:Q5.jsxs($H,{open:z,onOpenChange:G,className:"group",children:[Q5.jsxs(ZH,{className:s("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:[Q5.jsx("span",{className:"text-sm font-medium",children:"Import from this computer"}),Q5.jsx(d3,{size:16,stroke:2,className:s("opacity-0 transition-[opacity,transform]","group-hover/trigger:opacity-100 group-focus-visible/trigger:opacity-100 group-data-open:rotate-90")})]}),Q5.jsx(JH,{children:Q5.jsx("ul",{className:"border-t border-border",children:Y.map((B)=>Q5.jsx(Fo,{suggestion:B,onAdd:W},B.path))})})]})}),X.choice&&Q5.jsx(ww,{choice:X.choice,availability:Q.data?.availability,isPending:X.isPending,errorMessage:X.error?.message,onTypeChange:X.selectType,onSubmit:X.submit,onReset:X.reset})]})}function Uo({workspace:$}){let Z=I3($),J=WG($.id),Q=J.data?.theme,X=J.data?.updatedAt??new Date($.addedAt).getTime();return Q5.jsxs(nZ,{href:`/workspace/${$.id}`,className:"group flex min-w-0 flex-col gap-3",children:[Q5.jsx(KT,{workspaceId:$.id}),Q5.jsxs("div",{className:"flex min-w-0 flex-col gap-2 px-2",children:[Q5.jsxs("div",{className:"flex min-w-0 items-center gap-1.5 font-sans",style:Q9(Q),children:[Q5.jsx("img",{src:$.icon??V2[$.type??"claude-code"],alt:"",className:"size-4 shrink-0 rounded-xs"}),Q5.jsx("span",{className:"truncate text-sm font-medium text-foreground",children:Z})]}),Q5.jsx("span",{className:"text-xs text-muted-foreground",children:No(X)})]})]})}function Fo({suggestion:$,onAdd:Z}){let{path:J,types:Q}=$,X=I3($);return Q5.jsxs("li",{className:"flex items-center gap-2 border-b border-border px-1 py-3",children:[Q5.jsx(SP,{types:Q}),Q5.jsx("span",{className:"shrink-0 text-sm font-medium text-foreground",children:X}),Q5.jsx("span",{title:J,className:"min-w-0 flex-1 truncate text-xs text-muted-foreground",children:$.displayPath??J}),Q5.jsxs(k0,{variant:"outline",size:"sm",onClick:()=>Z($),children:[Q5.jsx(K4,{stroke:1.75}),"Add"]})]})}function No($){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 Q=Math.floor(J/60);if(Q<24)return`Updated ${Q} hour${Q===1?"":"s"} ago`;let X=Math.floor(Q/24);if(X<30)return`Updated ${X} day${X===1?"":"s"} ago`;return`Updated ${new Date($).toLocaleDateString()}`}var pH=P(d(),1);function qT(){return pH.jsx(rG,{showWorkspaces:!1,children:pH.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:pH.jsx(BT,{})})})}var uH=P(v(),1);var ZF=P(d(),1),NT=($)=>$.map((Z)=>[...Z].map((J)=>J==="#"?1:0)),Vo=["####.","#.#.#","#.#.#","#.#.#","#.#.#"],Lo=["###.#","#.#.#","#.#.#","#.#.#","###.#"],Mo=NT([".....","####.","#.#.#","#.#.#","#.#.#"]),Ao=NT(Vo.map(($,Z)=>`${$}.${Lo[Z]}`)),_o={moi:Mo,"moi-full":Ao};function VT($,Z,J){let Q=[];for(let X=0;X<Z;X++){let z=[];for(let G=0;G<$;G++)z.push(J(G,X));Q.push(z)}return Q}function UT($,Z,J){let Q=Math.sin($*12.9898+Z*78.233+J*37.719)*43758.5453;return Q-Math.floor(Q)}function Do($,Z,J){return VT(Z,J,(Q,X)=>{let z=UT(Q,X,0)*Math.PI*2,G=5+UT(Q,X,1)*6,H=0.5+0.5*Math.sin($*G+z);return H*H})}function Oo($,Z,J){return VT(Z,J,(X,z)=>0.5+0.5*Math.sin(X*0.5+z*0.32-$*6.5))}var LT=0.55;function Po($,Z){let J=$.length,Q=$.reduce((Y,K)=>Math.max(Y,K.length),0),X=Math.min(Z/LT,1),z=1-Math.pow(1-X,3),G=Math.round((1-z)*J),H=[];for(let Y=0;Y<J;Y++){let K=[];for(let W=0;W<Q;W++)K.push($[Y-G]?.[W]??0);H.push(K)}return H}function FT($,Z,J){let Q=_o[$];if(Z===void 0)return Po(Q,J);let X=Q.length,z=Q[0]?.length??0;return Z==="wave"?Oo(J,z,X):Do(J,z,X)}var wo=24;function jo($,Z,J){let[Q,X]=uH.useState(()=>FT($,Z,0));return uH.useEffect(()=>{let z=0,G=null,H=0,Y=1000/J,K=(W)=>{if(G===null)G=W;let B=(W-G)/1000;if(W-H>=Y){if(H=W,X(FT($,Z,B)),Z===void 0&&B>=LT)return}z=requestAnimationFrame(K)};return z=requestAnimationFrame(K),()=>cancelAnimationFrame(z)},[$,Z,J]),Q}function To($){return`rgba(23, 23, 23, ${(0.1+Math.max(0,Math.min(1,$))*0.9).toFixed(3)})`}function MT({sprite:$="moi",effect:Z,fps:J=wo,pixelSize:Q=3,gap:X=1,className:z}){let G=jo($,Z,J),H=G[0]?.length??0,Y=Z!==void 0;return ZF.jsx("div",{className:s("grid",z),style:{gridTemplateColumns:`repeat(${H}, ${Q}px)`,gap:`${X}px`},children:G.flatMap((K,W)=>K.map((B,q)=>ZF.jsx("div",{className:"rounded-[2px]",style:{width:Q,height:Q,background:To(B),boxShadow:Y?`0 0 ${(Q*(0.4+B)).toFixed(1)}px rgba(23, 23, 23, ${(B*0.35).toFixed(3)})`:void 0}},`${W}-${q}`)))})}var j$=P(v(),1);var dH=P(v(),1);var AT=()=>({emit($,...Z){for(let J=this.events[$]||[],Q=0,X=J.length;Q<X;Q++)J[Q](...Z)},events:{},on($,Z){return(this.events[$]||=[]).push(Z),()=>{this.events[$]=this.events[$]?.filter((J)=>Z!==J)}}});function JF($){return $==="agent"||$==="widgets"||$==="scratchpad"||typeof $==="string"&&(/^view:[^/]+$/.test($)||/^view-builder:[^/]+$/.test($))}function VQ($){return JF($)?$:null}function _T($,Z){return`/workspace/${$}/${Z}`}var QF=($)=>`view:${$}`,_6=($)=>$.startsWith("view:")?$.slice(5):null,l3=($)=>`view-builder:${$}`,i3=($)=>$.startsWith("view-builder:")?$.slice(13):null;function P$($){return typeof $==="object"&&$!==null&&!Array.isArray($)}function DT($){if(!P$($))return{};let Z=$.appletParams;return P$(Z)?Z:{}}var XF=2000;var Co=({kind:$,name:Z})=>`${$}:${Z}`,OT=1000,zF={cooldownMs:2000,windowMs:60000,maxPerWindow:10,maxKeys:64};function Eo($){let Z=AT(),J=zG(zF),Q=(z,G)=>{F2($,{source:"runtime",kind:z.kind,name:z.name,message:G})},X=(z,G,H)=>{let Y=J.admit(`${G}\x00${H}`);if(Y==="cooldown")return Q(z,`sendChatMessage("${H}") was dropped: the same message was already sent less than ${zF.cooldownMs/1000}s ago. Call it from an event handler, not during render.`),!1;if(Y==="window")return Q(z,`sendChatMessage("${H}") was dropped: more than ${zF.maxPerWindow} messages in a minute from this workspace. Each one starts an agent run, so send only on a real user action.`),!1;return!0};return{on(z,G){return Z.on(z,G)},connect(z){let G=!0,H=Co(z);return{bridge:{focusTab(K,W){if(!G)return;if(!JF(K))return;Z.emit("focusTab",K,P$(W)?W:void 0)},sendChatMessage(K,W){if(!G)return;if(typeof K!=="string")return;let B=K.trim();if(!B)return;if(B.length>OT){Q(z,`sendChatMessage() was dropped: the message is ${B.length} characters (max ${OT}). Put long content in the context argument, not the message.`);return}if(!X(z,H,B))return;Z.emit("sendChatMessage",{message:B,source:H,...W!==void 0?{context:So(z,W,Q)}:{}})}},dispose:()=>{G=!1}}}}}function So($,Z,J){if(!P$(Z)){J($,"sendChatMessage() ignored its context argument: it must be a plain object.");return}let Q;try{Q=JSON.stringify(Z)}catch{J($,"sendChatMessage() ignored its context argument: it is not JSON-serializable (cycles, functions, or BigInt).");return}if(Q.length>XF){J($,`sendChatMessage() ignored its context argument: ${Q.length} characters serialized (max ${XF}). Send an id the agent can look up instead of the whole payload.`);return}return Z}var PT=new Map;function wT($){let Z=PT.get($);if(!Z)Z=Eo($),PT.set($,Z);return Z}function lH($,Z,J){let Q=dH.useRef(J);Q.current=J,dH.useEffect(()=>{let X=(...z)=>Q.current(...z);return wT($).on(Z,X)},[$,Z])}var cH=new Map;function jT($,Z,J,Q){let X=$.__attachBridge;if(typeof X!=="function")return;cH.get(J)?.();let{bridge:z,dispose:G}=wT(Z).connect(Q);cH.set(J,G),X(z)}function GF($){let Z=cH.get($);if(!Z)return;cH.delete($),Z()}function iH($,Z,J){return`${$}/${Z}/${J}`}var w$=new Map,LQ=new Map;function ko($,Z,J){return w$.get(iH($,Z,J))??0}var Io="module";function TT($,Z,J){return`/api/workspaces/${Z}/${$}/${J}/${Io}?v=${ko($,Z,J)}`}function rH($,Z,J){return`/api/workspaces/${Z}/${$}/${J}`}function aH($,Z){return`${$==="widgets"?"widget":"view"}:${Z}`}function CT($){return LQ.get($)}function ET($,Z){LQ.set($,Z)}function nH($,Z,J){let Q=iH($,Z,J);LQ.delete(Q),w$.set(Q,(w$.get(Q)??0)+1),GF(Q)}function HF($){let Z=`${$}/`;for(let J of new Set([...LQ.keys(),...w$.keys()]))if(J.startsWith(Z))LQ.delete(J),w$.set(J,(w$.get(J)??0)+1),GF(J)}var Ro={kind:"widget",segment:"widgets",shouldReload:($,Z)=>$.type==="widget:updated"&&$.name===Z||$.type==="applets:refresh"&&$.only!=="views"},yo={kind:"view",segment:"views",shouldReload:($,Z)=>$.type==="view:updated"&&$.name===Z||$.type==="applets:refresh"&&$.only!=="widgets"};function bo($,Z,J){let{segment:Q}=$,X=iH(Q,Z,J),z=CT(X);if(z)return z;let G=import(TT(Q,Z,J)).then((H)=>{if(!H.default)throw Error(`"${J}" has no default export`);return jT(H,Z,X,{kind:$.kind,name:J}),H.default});return ET(X,G),G}function ST($,Z){let J=J1(),[Q,X]=j$.useState({status:"loading",version:0}),z=j$.useCallback(()=>{X((G)=>({status:"loading",version:G.version})),bo($,J,Z).then((G)=>X((H)=>({status:"ready",Component:G,version:H.version+1}))).catch((G)=>{F2(J,{source:"load",kind:$.kind,name:Z,message:String(G),...G instanceof Error&&G.stack?{stack:G.stack}:{}}),X((H)=>({status:"error",error:String(G),version:H.version+1}))})},[$,J,Z]);return j$.useEffect(()=>{z()},[z]),Z8((G)=>{if($.shouldReload(G,Z))nH($.segment,J,Z),z()}),Q}function kT($){return ST(Ro,$)}function IT($){return ST(yo,$)}function RT(){let $=J1();Z8((Z)=>{if(Z.type==="view:updated")nH("views",$,Z.name);else if(Z.type==="widget:updated")nH("widgets",$,Z.name);else if(Z.type==="applets:refresh"){if(Z.only!=="views")HF("widgets");if(Z.only!=="widgets")HF("views")}})}var t4=P(v(),1);var A2={staleTime:0,gcTime:300000,refetchOnMount:!0,refetchOnWindowFocus:!0};function yT($){return X1({queryKey:S0.layout($),queryFn:()=>C5(`/api/workspaces/${$}`),...A2})}function X9($){let Z=o0();return Z8((J)=>{if(J.type==="agent:updated"&&J.workspaceId===$)Z.setQueryData(S0.agent($),(Q)=>Q?{...Q,availability:J.availability,login:J.login}:Q);if(J.type==="env:updated"&&J.workspaceId===$)Z.invalidateQueries({queryKey:S0.agent($)})}),X1({queryKey:S0.agent($),queryFn:()=>C5(`/api/workspaces/${$}/agent`),staleTime:30000,refetchOnWindowFocus:!0})}function bT($){return C5(`/api/workspaces/${$}/auth/login`,{method:"POST"},"Could not start sign-in")}function xT($){return X1({queryKey:S0.skills($),queryFn:()=>C5(`/api/workspaces/${$}/skills`),...A2})}async function xo($){let Z=await fetch(`/api/workspaces/${$}/skills/update`,{method:"POST"}),J=await Z.text(),Q=null;try{Q=JSON.parse(J)}catch{}if(!Z.ok){let X=Q&&"error"in Q?Q.error:J,z=Error(X||"Failed to update workspace skill");if(Q?.skills)z.status={skills:Q.skills,updateAvailable:Q.updateAvailable};throw z}if(!Q)throw Error("Invalid workspace skill update response");return Q}function hT($){let Z=o0();return t5({mutationFn:()=>xo($),onSuccess:(J)=>{Z.setQueryData(S0.skills($),J)},onError:(J)=>{if(J.status)Z.setQueryData(S0.skills($),J.status)}})}function gT($){return X1({queryKey:S0.widgets($),queryFn:async()=>{return(await C5(`/api/workspaces/${$}/widgets`)).widgets},...A2})}function oH($){return X1({queryKey:S0.views($),queryFn:async()=>{return(await C5(`/api/workspaces/${$}/views`)).views},...A2})}function vT($){let Z=o0();return t5({mutationFn:(J)=>T4(`/api/workspaces/${$}`,r1("PUT",J),"Failed to save layout"),onSuccess:()=>{Z.invalidateQueries({queryKey:S0.preview($)})}})}function YF(){return{open:["agent","widgets","scratchpad"],active:"agent"}}function fT(){return{version:1,widgetGrid:[],layoutMode:"split",tabs:YF()}}var cT=P(d(),1),KF=t4.createContext(null);function n5(){let $=t4.useContext(KF);if(!$)throw Error("useWorkspaceLayoutCtx must be used within <WorkspaceLayoutProvider>");return $}function pT(){return t4.useContext(KF)?.layout.theme}function mT($){let{cwd:Z,name:J,provider:Q,agentId:X,...z}=$;return z}function uT({id:$,children:Z}){let J=o0(),Q=yT($),X=vT($),z=t4.useRef(X.mutate);z.current=X.mutate;let G=t4.useRef(null),H=t4.useCallback((K)=>{let W=S0.layout($),B=J.getQueryData(W);if(!B)return;let q={...B,...K};if(J.setQueryData(W,q),G.current)clearTimeout(G.current);G.current=setTimeout(()=>{G.current=null,z.current(mT(q))},600)},[$,J]),Y=t4.useMemo(()=>({layout:Q.data?mT(Q.data):fT(),setLayout:H,name:Q.data?.name??null,icon:Q.data?.icon??null,cwd:Q.data?.cwd??null,provider:Q.data?.provider??null,workspaceId:$,isLoading:Q.isLoading}),[Q.data,Q.isLoading,H,$]);return cT.jsx(KF,{value:Y,children:Z})}var X4=P(v(),1);var C9=P(d(),1),ho="M5 11a7 7 0 0 1 14 0v7a1.78 1.78 0 0 1 -3.1 1.4a1.65 1.65 0 0 0 -2.6 0a1.65 1.65 0 0 1 -2.6 0a1.65 1.65 0 0 0 -2.6 0a1.78 1.78 0 0 1 -3.1 -1.4v-7",go=18.85;function D6($){return $.toFixed(3)}function vo($){let Z="";for(let J=0;J<$.length-1;J+=1){let Q=$[J-1]??$[J],X=$[J],z=$[J+1],G=$[J+2]??z,H=J===0?{x:X.x,y:X.y+0.4}:{x:X.x+(z.x-Q.x)/6,y:X.y+(z.y-Q.y)/6},Y=J===$.length-2?{x:z.x,y:z.y+0.4}:{x:z.x-(G.x-X.x)/6,y:z.y-(G.y-X.y)/6};Z+=`C${D6(H.x)} ${D6(H.y)} ${D6(Y.x)} ${D6(Y.y)} ${D6(z.x)} ${D6(z.y)}`}return Z}function fo($){let Z=$*Math.PI*2,Q=(1-Math.abs($*2-1))*1.55,X=go+Q,z=Array.from({length:13},(H,Y)=>{let K=Y/12,W=Math.sin(Math.PI*K)**0.35,B=X+0.3*W,q=0.55*W*Math.sin(5*Math.PI*K-Z);return{x:5+14*K,y:B+q}}),G=X-11;return`M5 11a7 7 0 0 1 14 0v${D6(G)}${vo(z.reverse())}v-${D6(G)}`}var dT=Array.from({length:17},($,Z)=>fo(Z/16));function O6({animated:$=!1,color:Z="currentColor",size:J=24,stroke:Q=2,title:X,className:z,children:G,ref:H,...Y}){let K=lT(),W=$&&!K;return C9.jsxs("svg",{ref:H,xmlns:"http://www.w3.org/2000/svg",width:J,height:J,viewBox:"0 0 24 24",fill:"none",stroke:Z,strokeWidth:Q,strokeLinecap:"round",strokeLinejoin:"round",className:s("tabler-icon tabler-icon-ghost",z),...Y,children:[X&&C9.jsx("title",{children:X}),W?C9.jsx(p5.path,{d:dT[0],animate:{d:dT},transition:{duration:2,ease:"linear",repeat:1/0}}):C9.jsx("path",{d:ho}),C9.jsx("path",{d:"M10 10l.01 0"}),C9.jsx("path",{d:"M14 10l.01 0"}),C9.jsx("path",{d:"M10 14a3.5 3.5 0 0 0 4 0"}),G]})}function iT($,Z,J){if(!Z)return!1;return $==="widgets"||$.startsWith("view:")&&J}var tH=P(d(),1);function sH({visible:$,editing:Z,canvasRef:J,width:Q,height:X,pointerProps:z,onKeyDown:G,children:H}){if(!$)return null;return tH.jsxs("div",{className:"absolute inset-0 animate-in duration-100 fade-in",onKeyDown:G,children:[tH.jsx("canvas",{ref:J,...z,width:Q,height:X,"aria-label":"Drawing area",tabIndex:0,className:"absolute inset-0 size-full cursor-pencil touch-none outline-none"}),Z&&H]})}var l0=P(v(),1);function BF($,Z,J){let Q=Math.max($,Z);if(Q<=0)return 1;return Math.min(Math.max(J,1),1568/Q)}function mo($){return new Promise((Z,J)=>{setTimeout(()=>J(Error("Annotation capture timed out")),$)})}async function rT($){let Z=$.getBoundingClientRect();if(Z.width<=0||Z.height<=0)throw Error("Annotation target is not visible");let{createContext:J,destroyContext:Q,domToCanvas:X}=await import("/chunk-pp62fnxh.js"),z=async()=>{let G=await J($,{width:Math.round(Z.width),height:Math.round(Z.height),scale:BF(Z.width,Z.height,window.devicePixelRatio),type:"image/png",backgroundColor:getComputedStyle($).backgroundColor,timeout:1000,features:{restoreScrollPosition:!0},style:{overflow:"hidden"}});try{return await X(G)}finally{Q(G)}};return Promise.race([z(),mo(1e4)])}var qF={past:[],present:[],future:[]};function po($,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 oT($,Z,J){let Q=$.getBoundingClientRect();return{x:(Z-Q.left)/Q.width*$.width,y:(J-Q.top)/Q.height*$.height}}function aT($,Z){let J=Z.getCoalescedEvents?.()??[];return(J.length>0?J:[Z]).map((X)=>oT($,X.clientX,X.clientY))}var uo={canUndo:!1,canRedo:!1,hasStrokes:!1};function eH($){return l0.useSyncExternalStore($.subscribeHistory,$.getHistoryState,$.getHistoryState)}function nT($,Z,J,Q){let X=Z.points[0];if(!X)return;$.beginPath(),$.lineCap="round",$.lineJoin="round",$.lineWidth=Q,$.strokeStyle=J,$.moveTo(X.x,X.y);for(let z=1;z<Z.points.length;z++){let G=Z.points[z];$.lineTo(G.x,G.y)}if(Z.points.length===1)$.lineTo(X.x+0.01,X.y+0.01);$.stroke()}function sT($,Z,J,Q,X,z=null){let G=Math.max(3,Math.min(Z,J)*0.005),H=G+Math.max(2,G*0.75),Y=z?[...X,z]:X;for(let K of Y)nT($,K,Q.haloColor,H);for(let K of Y)nT($,K,Q.strokeColor,G)}function co($,Z,J,Q=null){let X=$.getContext("2d");if(!X)return;X.clearRect(0,0,$.width,$.height),sT(X,$.width,$.height,Z,J,Q)}function lo($,Z,J){let Q=$.getContext("2d");if(!Q)return;Q.clearRect(0,0,$.width,$.height),Q.drawImage(Z.snapshot,0,0,$.width,$.height),sT(Q,$.width,$.height,Z,J)}function io($){return new Promise((Z,J)=>{$.toBlob((Q)=>{if(Q)Z(Q);else J(Error("Could not export drawing"))},"image/png")})}function ro($,Z,J){let Q=$.getBoundingClientRect();if(Q.width<=0||Q.height<=0)return null;let X=getComputedStyle($),z=BF(Q.width,Q.height,window.devicePixelRatio),G=Math.max(1,Math.round(Q.width*z)),H=Math.max(1,Math.round(Q.height*z)),Y=document.createElement("canvas");Y.width=G,Y.height=H;let K=X.getPropertyValue("--background").trim()||"#ffffff",W=Y.getContext("2d");if(W)W.fillStyle=K,W.fillRect(0,0,G,H);return Z.width=G,Z.height=H,{id:J,snapshot:Y,strokeColor:X.getPropertyValue("--primary").trim()||"#2563eb",haloColor:K,targetWidth:Q.width,targetHeight:Q.height}}function ao($){return $ instanceof HTMLInputElement||$ instanceof HTMLTextAreaElement||$ instanceof HTMLElement&&$.isContentEditable}function $Y({mode:$="annotation",onChange:Z,onEditingStart:J,onFinish:Q}={}){let X=l0.useRef(null),z=l0.useRef(null),[G,H]=l0.useState(null),Y=l0.useRef(G),[K,W]=l0.useState(!1),B=l0.useRef(!1),q=l0.useRef(qF),U=l0.useRef(uo),F=l0.useRef(new Set),N=l0.useRef(0),L=l0.useRef(null),V=l0.useRef(null),M=l0.useRef(0),_=l0.useRef(0),O=l0.useRef(null),D=l0.useRef(null),[A,E]=l0.useState(!1),I=l0.useRef(!1),[y,C]=l0.useState(!1),h=l0.useRef(!1),k=l0.useRef(Z),S=l0.useRef(J),w=l0.useRef(Q);k.current=Z,S.current=J,w.current=Q;let T=l0.useCallback(()=>{let m=q.current,c=U.current,f={canUndo:m.past.length>0,canRedo:m.future.length>0,hasStrokes:m.present.length>0};if(f.canUndo===c.canUndo&&f.canRedo===c.canRedo&&f.hasStrokes===c.hasStrokes)return;U.current=f;for(let a of F.current)a()},[]),R=l0.useCallback((m)=>{return F.current.add(m),()=>{F.current.delete(m)}},[]),b=l0.useCallback(()=>U.current,[]),g=l0.useCallback((m,c=null)=>{if(M.current)cancelAnimationFrame(M.current),M.current=0;let f=z.current,a=Y.current;if(f&&a)co(f,a,m,c)},[]),u=l0.useCallback(()=>{if(M.current)return;M.current=requestAnimationFrame(()=>{M.current=0,g(q.current.present,L.current)})},[g]),j=l0.useCallback((m,c,f)=>{let a=O.current;if(a?.sessionId===m.id&&a.historyVersion===f)return Promise.resolve(a.blob);let o=D.current;if(o?.sessionId===m.id&&o.historyVersion===f)return o.promise;if(c.length===0)return O.current={sessionId:m.id,historyVersion:f,blob:null},k.current?.(null),Promise.resolve(null);let N0=document.createElement("canvas");N0.width=m.snapshot.width,N0.height=m.snapshot.height,lo(N0,m,c);let j0=io(N0).then((h0)=>{if(Y.current?.id!==m.id||N.current!==f)return h0;return O.current={sessionId:m.id,historyVersion:f,blob:h0},k.current?.(h0),h0}).catch(()=>{if(Y.current?.id===m.id&&N.current===f)c4.add({title:"Couldn’t export the drawing",type:"error"});return null}).finally(()=>{if(D.current?.promise===j0)D.current=null});return D.current={sessionId:m.id,historyVersion:f,promise:j0},j0},[]),t=l0.useCallback(()=>{if(!L.current)return;let m=z.current,c=V.current;if(m&&c!==null&&m.hasPointerCapture(c))m.releasePointerCapture(c);L.current=null,V.current=null,g(q.current.present)},[g]),Q0=l0.useCallback((m)=>{let c=Y.current;if(!c||h.current)return;let f=po(q.current,m);if(f===q.current)return;q.current=f,T(),L.current=null;let a=++N.current;g(f.present),j(c,f.present,a)},[j,T,g]),x=l0.useCallback((m)=>{q.current=qF,N.current=0,O.current=null,D.current=null,L.current=null,V.current=null,T(),Y.current=m,H(m)},[T]),e=l0.useCallback(()=>{if(B.current)return;B.current=!0,W(!0),S.current?.()},[]),M0=l0.useCallback(async()=>{let m=X.current;if(!m||Y.current||I.current)return!1;let c=++_.current;I.current=!0,E(!0);try{let f=await rT(m);if(c!==_.current||X.current!==m)return!1;let a=m.getBoundingClientRect(),o=getComputedStyle(m),N0={id:c,snapshot:f,strokeColor:o.getPropertyValue("--primary").trim()||"#2563eb",haloColor:o.getPropertyValue("--background").trim()||"#ffffff",targetWidth:a.width,targetHeight:a.height};return x(N0),e(),!0}finally{if(c===_.current)I.current=!1,E(!1)}},[e,x]),l=l0.useCallback(()=>{let m=Y.current;_.current+=1,I.current=!1,h.current=!1,E(!1),C(!1),B.current=!1,W(!1),t(),H(null),q.current=qF,T();let c=D.current;if(!m||c?.sessionId!==m.id)return Y.current=null,Promise.resolve();return c.promise.then(()=>{if(Y.current?.id===m.id)Y.current=null})},[t,T]),H0=l0.useCallback(async()=>{let m=Y.current;if(!m)return null;return t(),j(m,q.current.present,N.current)},[t,j]),B0=l0.useCallback(async()=>{return B.current=!1,W(!1),H0()},[H0]),X0=l0.useCallback(async()=>{let m=Y.current;if(!m||h.current)return null;h.current=!0,C(!0),t();let c=N.current,f=q.current.present,a=null;if(f.length>0||c>0)a=await j(m,f,c);if(Y.current?.id!==m.id)return a;try{await w.current?.(a)}finally{if(Y.current?.id===m.id)_.current+=1,B.current=!1,W(!1),Y.current=null,H(null),h.current=!1,C(!1)}return a},[t,j]),Y0=l0.useCallback(()=>Q0({type:"undo"}),[Q0]),V0=l0.useCallback(()=>Q0({type:"redo"}),[Q0]),i=l0.useCallback(()=>Q0({type:"clear"}),[Q0]),$0=l0.useMemo(()=>({onPointerDown:(m)=>{if(h.current||!m.isPrimary||m.pointerType==="mouse"&&m.button!==0)return;if(!Y.current&&$==="sketch"){let c=X.current;if(!c)return;let f=ro(c,m.currentTarget,++_.current);if(!f)return;x(f)}if(!Y.current)return;e(),V.current=m.pointerId,m.currentTarget.setPointerCapture(m.pointerId),L.current={points:[oT(m.currentTarget,m.clientX,m.clientY)]},g(q.current.present,L.current)},onPointerMove:(m)=>{if(m.pointerId!==V.current||!L.current)return;L.current.points.push(...aT(m.currentTarget,m.nativeEvent)),u()},onPointerUp:(m)=>{if(m.pointerId!==V.current||!L.current)return;let c=L.current;if(c.points.push(...aT(m.currentTarget,m.nativeEvent)),L.current=null,V.current=null,m.currentTarget.hasPointerCapture(m.pointerId))m.currentTarget.releasePointerCapture(m.pointerId);Q0({type:"commit",stroke:c})},onPointerCancel:(m)=>{if(m.pointerId===V.current)t()}}),[Q0,e,t,x,$,g,u]),Z0=l0.useCallback((m)=>{if(ao(m.target))return;if(m.key==="Escape"&&$==="annotation"){m.preventDefault(),X0();return}if(!(m.metaKey||m.ctrlKey)||m.key.toLowerCase()!=="z")return;if(m.preventDefault(),m.shiftKey)V0();else Y0()},[X0,$,V0,Y0]);l0.useLayoutEffect(()=>{if(!G)return;if(g(q.current.present,L.current),K)z.current?.focus()},[K,g,G]),l0.useEffect(()=>{if(!G||$==="sketch")return;let m=X.current;if(!m){l();return}let c=new ResizeObserver((f)=>{let a=f[0]?.contentRect;if(!a)return;if(Math.abs(a.width-G.targetWidth)>1||Math.abs(a.height-G.targetHeight)>1)l()});return c.observe(m),()=>c.disconnect()},[l,$,G]),l0.useEffect(()=>()=>{if(_.current+=1,B.current=!1,Y.current=null,M.current)cancelAnimationFrame(M.current)},[]);let J0=l0.useMemo(()=>({active:K,visible:$==="sketch"||G!==null,starting:A,finishing:y,open:M0,undo:Y0,redo:V0,clear:i,flush:H0,deactivate:B0,finish:X0,cancel:l,subscribeHistory:R,getHistoryState:b}),[K,$,G,A,y,M0,Y0,V0,i,H0,B0,X0,l,R,b]),n=l0.useMemo(()=>({visible:J0.visible,editing:J0.active,canvasRef:z,width:G?.snapshot.width??1,height:G?.snapshot.height??1,pointerProps:$0,onKeyDown:Z0}),[J0.active,J0.visible,G,$0,Z0]);return l0.useMemo(()=>({targetRef:X,controls:J0,layerProps:n}),[J0,n])}var p1=P(d(),1);function ZY({controls:$,title:Z,busy:J,onComplete:Q}){let{canUndo:X,canRedo:z,hasStrokes:G}=eH($);return p1.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:[p1.jsx("span",{className:"mr-2 ml-2 text-sm font-medium",children:Z}),p1.jsxs("div",{className:"flex gap-1",children:[p1.jsxs(M1,{children:[p1.jsx(A1,{render:p1.jsx(k0,{type:"button",variant:"outline",size:"icon-sm",onClick:$.undo,disabled:J||!X,"aria-label":"Undo",children:p1.jsx(tT,{stroke:1.75})})}),p1.jsx(_1,{children:"Undo"})]}),p1.jsxs(M1,{children:[p1.jsx(A1,{render:p1.jsx(k0,{type:"button",variant:"outline",size:"icon-sm",onClick:$.redo,disabled:J||!z,"aria-label":"Redo",children:p1.jsx(eT,{stroke:1.75})})}),p1.jsx(_1,{children:"Redo"})]}),p1.jsx(k0,{type:"button",variant:"outline",size:"sm",onClick:$.clear,disabled:J||!G,children:"Clear"})]}),p1.jsx(o8,{mode:"popLayout",initial:!1,children:p1.jsx(p5.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:p1.jsx(k0,{type:"button",variant:G?"default":"ghost",size:"icon-sm",onClick:Q,disabled:J,"aria-label":"Complete",className:s(!G&&"text-muted-foreground"),children:G?p1.jsx(T$,{stroke:1.75}):p1.jsx(m1,{stroke:1.75})})},G?"complete":"cancel")})]})}var y1=P(v(),1);async function UF($,Z){let J=new FormData;for(let X of Z)J.append("files",X);let Q=await fetch(`/api/workspaces/${$}/uploads`,{method:"POST",body:J});if(!Q.ok){let X=await Q.text().catch(()=>"");throw Error(X||`Upload failed (${Q.status})`)}return Q.json()}function $C({workspaceId:$,sessionId:Z},J){if(J.length===0)return;let Q=J.map((X)=>({kind:"file",localId:crypto.randomUUID(),name:X.name||"file",mediaType:X.type||"application/octet-stream",previewUrl:X.type.startsWith("image/")?URL.createObjectURL(X):void 0,status:"uploading"}));P5.getState().addAttachments($,Z,Q),Q.forEach((X,z)=>{UF($,[J[z]]).then(([G])=>{P5.getState().updateAttachment($,Z,X.localId,{status:"ready",upload:G,mediaType:G.mediaType})}).catch((G)=>{P5.getState().updateAttachment($,Z,X.localId,{status:"error",error:G instanceof Error?G.message:"Upload failed"})})})}function JY({workspaceId:$,sessionId:Z,localId:J,purpose:Q,sourceTab:X,blob:z}){let G=Q==="sketch"?"Sketch":"Annotation",H=URL.createObjectURL(z),Y=P5.getState();if(Y.attachments[n8($,Z)]?.some((W)=>W.localId===J))Y.updateAttachment($,Z,J,{previewUrl:H,status:"draft",upload:void 0,error:void 0});else Y.addAttachments($,Z,[{kind:"drawing",purpose:Q,localId:J,sourceTab:X,name:`${G}.png`,mediaType:"image/png",previewUrl:H,status:"draft"}])}async function QY({workspaceId:$,sessionId:Z,localId:J,purpose:Q,sourceTab:X,blob:z,isCurrent:G}){let H=Q==="sketch"?"Sketch":"Annotation",Y=URL.createObjectURL(z),K=P5.getState();if(K.attachments[n8($,Z)]?.some((B)=>B.localId===J))K.updateAttachment($,Z,J,{previewUrl:Y,status:"uploading",upload:void 0,error:void 0});else K.addAttachments($,Z,[{kind:"drawing",purpose:Q,localId:J,sourceTab:X,name:`${H}.png`,mediaType:"image/png",previewUrl:Y,status:"uploading"}]);try{let[B]=await UF($,[new File([z],`${H}.png`,{type:"image/png"})]);if(!G())return;P5.getState().updateAttachment($,Z,J,{status:"ready",upload:B,mediaType:B.mediaType,error:void 0})}catch{if(!G())return;P5.getState().removeAttachment($,Z,J)}}function ZC({workspaceId:$,sessionId:Z,activeTab:J,mode:Q,available:X,closePopup:z,openPopup:G}){let H=y1.useRef(null),Y=y1.useRef(null),K=y1.useRef(new Map),W=y1.useRef(z),B=y1.useRef(G);W.current=z,B.current=G;let q=y1.useCallback((w)=>{let T=H.current;if(!T)return;if(Y.current=w,!w){P5.getState().removeAttachment(T.workspaceId,T.sourceSessionId,T.attachmentId);return}JY({workspaceId:T.workspaceId,sessionId:T.sourceSessionId,localId:T.attachmentId,purpose:"annotation",sourceTab:T.sourceTab,blob:w})},[]),U=y1.useCallback((w,T)=>{let R=(K.current.get(w.attachmentId)??0)+1;return K.current.set(w.attachmentId,R),QY({workspaceId:w.workspaceId,sessionId:w.sourceSessionId,localId:w.attachmentId,purpose:"annotation",sourceTab:w.sourceTab,blob:T,isCurrent:()=>K.current.get(w.attachmentId)===R})},[]),F=y1.useCallback(async(w)=>{let T=H.current;if(H.current=null,Y.current=null,T&&w)await U(T,w);if(T?.origin==="popup")B.current()},[U]),N=$Y({onChange:q,onFinish:F}),{controls:L}=N,{active:V,starting:M,open:_,finish:O,cancel:D}=L,A=y1.useCallback(async(w)=>{if(!X||V||M)return;let T={workspaceId:$,sourceSessionId:Z,sourceTab:J,origin:w,attachmentId:crypto.randomUUID()};H.current=T;try{if(!await _()){if(H.current===T)H.current=null;return}if(w==="popup")W.current()}catch{if(H.current!==T)return;H.current=null,c4.add({title:"Couldn’t capture this page",type:"error"})}},[V,J,X,_,Z,M,$]),E=y1.useCallback(async()=>{let w=H.current;if(await D(),H.current!==w)return;H.current=null;let T=Y.current;if(Y.current=null,w&&T)U(w,T)},[D,U]),I=y1.useCallback((w)=>{let T=(K.current.get(w)??0)+1;if(K.current.set(w,T),P5.getState().removeAttachment($,Z,w),H.current?.attachmentId===w)H.current=null,Y.current=null,D()},[D,Z,$]),y=y1.useCallback(async()=>{if(M){await E();return}await O()},[E,O,M]),C=y1.useCallback(()=>{if(V||M)y();else A("docked")},[V,y,A,M]),h=y1.useCallback(()=>{if(V||M)y();else A("popup")},[V,y,A,M]);y1.useEffect(()=>{let w=H.current;if(!w)return;let T=w.origin==="docked"?"split":"fullscreen";if(w.workspaceId!==$||w.sourceSessionId!==Z||w.sourceTab!==J||Q!==T||!X)E()},[J,X,E,Q,Z,$]);let k=y1.useMemo(()=>X?{active:V||M,finish:y,onRemove:I,onToggle:C}:void 0,[X,V,M,y,I,C]),S=y1.useMemo(()=>X?{active:V||M,finish:y,onRemove:I,onToggle:h}:void 0,[X,V,M,y,I,h]);return y1.useMemo(()=>({...N,docked:k,popup:S}),[N,k,S])}var I4=P(v(),1);var JC=P(d(),1);function E9({className:$,...Z}){return JC.jsx(T1,{"data-slot":"spinner",role:"status","aria-label":"Loading",className:s("size-4 animate-spin",$),stroke:1.75,...Z})}var e4=P(d(),1);function FF($){if(!$)return;$.focus();let Z=$.value.length;$.setSelectionRange(Z,Z)}function XC({composerRef:$,className:Z,onMouseDown:J,children:Q,...X}){return e4.jsx("form",{...X,onMouseDown:(z)=>{if(J?.(z),z.defaultPrevented)return;if(z.target instanceof Element&&z.target.closest('button, input, textarea, select, a, [contenteditable="true"]'))return;FF($.current)},className:s("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:Q})}function zC({textareaRef:$,className:Z,...J}){return e4.jsx("textarea",{...J,ref:$,className:s("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 GC({className:$,children:Z,...J}){return e4.jsx("div",{...J,className:s("flex items-center justify-end gap-3",$),children:Z})}function no($){if($.status==="checking")return"Checking agent status…";return}function MQ($,Z,J){return $&&!Z&&J.status==="available"}function HC({label:$,hasContent:Z,busy:J=!1,loading:Q=!1,availability:X}){let z=MQ(Z,J||Q,X),G=no(X),H=e4.jsx(k0,{type:"submit",size:"icon",disabled:!z,"aria-label":$,children:Q?e4.jsx(E9,{}):e4.jsx(QC,{stroke:1.5})});if(Q||!G)return H;return e4.jsxs(M1,{children:[e4.jsx(A1,{render:e4.jsx("span",{className:"inline-flex",children:H})}),e4.jsx(_1,{className:"max-w-64 text-center",children:G})]})}var k4=P(v(),1),oo=48;function YC($,Z){let J=k4.useRef(!0),[Q,X]=k4.useState(!0),z=k4.useCallback((Y)=>{J.current=Y,X((K)=>K===Y?K:Y)},[]),G=k4.useCallback((Y="auto")=>{let K=$.current;if(!K)return;z(!0),K.scrollTo({top:K.scrollHeight,behavior:Y})},[$,z]),H=k4.useCallback(()=>{let Y=$.current;if(!Y)return;z(!1),Y.scrollTo({top:0,behavior:"auto"})},[$,z]);return k4.useEffect(()=>{let Y=$.current;if(!Y)return;let K=()=>{let W=Y.scrollHeight-Y.scrollTop-Y.clientHeight;z(W<=oo)};return Y.addEventListener("scroll",K,{passive:!0}),()=>Y.removeEventListener("scroll",K)},[$,z]),k4.useEffect(()=>{let Y=$.current;if(!Y)return;let K=Y.firstElementChild??Y,W=new ResizeObserver(()=>{if(J.current)Y.scrollTop=Y.scrollHeight});return W.observe(K),()=>W.disconnect()},[$]),k4.useLayoutEffect(()=>{G("auto")},[Z,G]),{atBottom:Q,scrollToBottom:G,scrollToTop:H}}function so($){return $.origin.kind!=="replay"&&$.origin.kind!=="synthetic"&&$.origin.kind!=="subagent-prompt"}function to($,Z){let J=$.meta||Z.meta?{...$.meta,...Z.meta}:void 0;return{...$,parts:[...$.parts,...Z.parts],timestamp:Z.timestamp??$.timestamp,meta:J}}function KC($){let Z=[];for(let J of $){if(!so(J))continue;if(J.role!=="assistant"){Z.push(J);continue}let Q=Z.length>0?Z[Z.length-1]:null;if(Q?.role==="assistant")Z[Z.length-1]=to(Q,J);else Z.push(J)}return Z.map((J,Q)=>{let X=Z[Q-1];if(J.role!=="assistant"||X?.role!=="user"||X.origin.kind!=="user-input"||!X.timestamp||!J.timestamp)return J;let z=Date.parse(X.timestamp),G=Date.parse(J.timestamp);if(!Number.isFinite(z)||!Number.isFinite(G)||G<z)return J;return{...J,meta:{...J.meta,durationMs:G-z}}})}function NF($){switch($.kind){case"compact":return"Context compacted";case"model-change":return $.prev?`Model changed to ${$.model} (was ${$.prev})`:`Model changed to ${$.model}`;case"rate-limit":case"api-retry":case"hook":case"session-state":case"files-persisted":case"elicitation":default:return null}}function WC($){if(!$)return;let Z=Date.parse($);return Number.isNaN(Z)?void 0:Z}function BC($,Z){let J=Z.filter((Y)=>NF(Y)!==null);if(J.length===0)return $.map((Y)=>({kind:"turn",turn:Y}));let Q=[],X=[];for(let Y of J){let K=WC(Y.at);if(K===void 0)X.push(Y);else Q.push({notice:Y,time:K})}Q.sort((Y,K)=>Y.time-K.time);let z=[],G=0,H=Number.NEGATIVE_INFINITY;for(let Y of $){H=Math.max(H,WC(Y.timestamp)??H);while(G<Q.length&&Q[G].time<=H)z.push({kind:"notice",notice:Q[G].notice}),G+=1;z.push({kind:"turn",turn:Y})}for(;G<Q.length;G+=1)z.push({kind:"notice",notice:Q[G].notice});for(let Y of X)z.push({kind:"notice",notice:Y});return z}var r$=P(v(),1);var w6={};_4(w6,{createHandle:()=>RC,Viewport:()=>IC,Trigger:()=>_C,Root:()=>VC,Positioner:()=>OC,Portal:()=>AC,Popup:()=>wC,Handle:()=>KY,Backdrop:()=>EC,Arrow:()=>TC});var P6=P(v(),1);var XY=P(v(),1),VF=XY.createContext(void 0);function q4($){let Z=XY.useContext(VF);if(Z===void 0&&!$)throw Error(C0(50));return Z}var UC=P(v(),1),FC=P(G4(),1);var qC=600,zY=300;var eo={...d2,instantType:E0(($)=>$.instantType),hasViewport:E0(($)=>$.hasViewport)};class C$ extends l8{constructor($){super({...$s(),...$},{popupRef:UC.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:new r8,closeDelayRef:{current:zY}},eo)}setOpen=($,Z)=>{let J=Z.reason,Q=J===K0.triggerHover,X=$&&J===K0.triggerFocus,z=!$&&(J===K0.triggerPress||J===K0.escapeKey);if(Z.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},this.context.onOpenChange?.($,Z),Z.isCanceled)return;let G=()=>{let H={open:$};if(X)H.instantType="focus";else if(z)H.instantType="dismiss";else if(J===K0.triggerHover)H.instantType=void 0;let Y=Z.trigger?.id??null;if(Y||$)H.activeTriggerId=Y,H.activeTriggerElement=Z.trigger??null;this.update(H)};if(Q)FC.flushSync(G);else G()};static useStore($,Z){let J=T5(()=>{return new C$(Z)}).current,Q=$??J,X=B2({popupStore:Q,onOpenChange:Q.setOpen});return Q.state.floatingRootContext=X,Q}}function $s(){return{...c2(),instantType:void 0,hasViewport:!1}}var NC=P(d(),1);function VC($){let{open:Z,defaultOpen:J=!1,onOpenChange:Q,onOpenChangeComplete:X,actionsRef:z,handle:G,triggerId:H,defaultTriggerId:Y=null,children:K}=$,W=C$.useStore(G?.store,{open:J,openProp:Z,activeTriggerId:Y,triggerIdProp:H});n2(()=>{if(Z===void 0&&W.state.open===!1&&J===!0)W.update({open:!0,activeTriggerId:Y})}),W.useControlledProp("openProp",Z),W.useControlledProp("triggerIdProp",H),W.useContextCallback("onOpenChange",Q),W.useContextCallback("onOpenChangeComplete",X);let B=W.useState("open"),q=W.useState("activeTriggerId"),U=W.useState("payload");p2(W);let{forceUnmount:F}=u2(B,W);q0(()=>{if(B){if(q==null)W.set("payload",void 0)}},[W,q,B]);let N=P6.useCallback(()=>{W.setOpen(!1,Zs(W,K0.imperativeAction))},[W]);P6.useImperativeHandle(z,()=>({unmount:F,close:N}),[F,N]);let L=W.useState("floatingRootContext"),V=W2(L),{getReferenceProps:M,getTriggerProps:_,getFloatingProps:O}=e1([V]),D=P6.useMemo(()=>M(),[M]),A=P6.useMemo(()=>_(),[_]),E=P6.useMemo(()=>O(),[O]);return W.useSyncedValues({activeTriggerProps:D,inactiveTriggerProps:A,popupProps:E}),NC.jsx(VF.Provider,{value:W,children:typeof K==="function"?K({payload:U}):K})}function Zs($,Z){let J=D0(Z);return J.preventUnmountOnClose=()=>{$.set("preventUnmountingOnClose",!0)},J}var MC=P(v(),1);var GY=P(v(),1),LF=GY.createContext(void 0);function LC(){let $=GY.useContext(LF);if($===void 0)throw Error(C0(48));return $}var MF=P(d(),1),AC=MC.forwardRef(function(Z,J){let{keepMounted:Q=!1,...X}=Z;if(!(q4().useState("mounted")||Q))return null;return MF.jsx(LF.Provider,{value:Q,children:MF.jsx(p7,{ref:J,...X})})});var HY=P(v(),1);var _C=HY.forwardRef(function(Z,J){let{render:Q,className:X,delay:z,closeDelay:G,id:H,payload:Y,handle:K,...W}=Z,B=q4(!0),q=K?.store??B;if(!q)throw Error(C0(89));let U=s0(H),F=q.useState("isTriggerActive",U),N=q.useState("isOpenedByTrigger",U),L=q.useState("floatingRootContext"),V=HY.useRef(null),M=z??qC,_=G??zY,{registerTrigger:O,isMountedByThisTrigger:D}=m2(U,V,q,{payload:Y});q0(()=>{if(D)q.context.closeDelayRef.current=_},[q,D,_]);let A=q2(L,{mouseOnly:!0,move:!1,handleClose:U2(),delay:()=>({open:M,close:_}),triggerElementRef:V,isActiveTrigger:F}),E=M3(L,{delay:M}),I={open:N},y=q.useState("triggerProps",D);return W0("a",Z,{state:I,ref:[J,O,V],props:[A,E.reference,y,{id:U},W],stateAttributesMapping:r2})});var AQ=P(v(),1);var YY=P(v(),1),AF=YY.createContext(void 0);function E$(){let $=YY.useContext(AF);if($===void 0)throw Error(C0(49));return $}var DC=P(d(),1),OC=AQ.forwardRef(function(Z,J){let{render:Q,className:X,anchor:z,positionMethod:G="absolute",side:H="bottom",align:Y="center",sideOffset:K=0,alignOffset:W=0,collisionBoundary:B="clipping-ancestors",collisionPadding:q=5,arrowPadding:U=5,sticky:F=!1,disableAnchorTracking:N=!1,collisionAvoidance:L=a2,...V}=Z,M=q4(),_=LC(),O=M.useState("open"),D=M.useState("mounted"),A=M.useState("floatingRootContext"),E=M.useState("instantType"),I=M.useState("transitionStatus"),y=M.useState("hasViewport"),C=i2({anchor:z,floatingRootContext:A,positionMethod:G,mounted:D,side:H,sideOffset:K,align:Y,alignOffset:W,arrowPadding:U,collisionBoundary:B,collisionPadding:q,sticky:F,disableAnchorTracking:N,keepMounted:_,collisionAvoidance:L,adaptiveOrigin:y?u7:void 0}),h=AQ.useMemo(()=>{let T={};if(!O)T.pointerEvents="none";return{role:"presentation",hidden:!D,style:{...C.positionerStyles,...T}}},[O,D,C.positionerStyles]),k={open:O,side:C.side,align:C.align,anchorHidden:C.anchorHidden,instant:E},S=AQ.useMemo(()=>({side:C.side,align:C.align,arrowRef:C.arrowRef,arrowUncentered:C.arrowUncentered,arrowStyles:C.arrowStyles}),[C.side,C.align,C.arrowRef,C.arrowUncentered,C.arrowStyles]),w=W0("div",Z,{state:k,props:[h,K8(I),V],ref:[J,M.useStateSetter("positionerElement")],stateAttributesMapping:N5});return DC.jsx(AF.Provider,{value:S,children:w})});var PC=P(v(),1);var Js={...N5,...m5},wC=PC.forwardRef(function(Z,J){let{className:Q,render:X,...z}=Z,G=q4(),{side:H,align:Y}=E$(),K=G.useState("open"),W=G.useState("instantType"),B=G.useState("transitionStatus"),q=G.useState("popupProps"),U=G.useState("floatingRootContext");I1({open:K,ref:G.context.popupRef,onComplete(){if(K)G.context.onOpenChangeComplete?.(!0)}});let F=U0(()=>G.context.closeDelayRef.current);return j9(U,{closeDelay:F}),W0("div",Z,{state:{open:K,side:H,align:Y,instant:W,transitionStatus:B},ref:[J,G.context.popupRef,G.useStateSetter("popupElement")],props:[q,K8(B),z],stateAttributesMapping:Js})});var jC=P(v(),1);var TC=jC.forwardRef(function(Z,J){let{render:Q,className:X,...z}=Z,G=q4(),{arrowRef:H,side:Y,align:K,arrowUncentered:W,arrowStyles:B}=E$(),U={open:G.useState("open"),side:Y,align:K,uncentered:W};return W0("div",Z,{state:U,ref:[H,J],props:[{style:B,"aria-hidden":!0},z],stateAttributesMapping:N5})});var CC=P(v(),1);var Qs={...N5,...m5},EC=CC.forwardRef(function(Z,J){let{render:Q,className:X,...z}=Z,G=q4(),H=G.useState("open"),Y=G.useState("mounted"),K=G.useState("transitionStatus");return W0("div",Z,{state:{open:H,transitionStatus:K},ref:[J],props:[{role:"presentation",hidden:!Y,style:{pointerEvents:"none",userSelect:"none",WebkitUserSelect:"none"}},z],stateAttributesMapping:Qs})});var kC=P(v(),1);var SC=function($){return $.popupWidth="--popup-width",$.popupHeight="--popup-height",$}({});var Xs={activationDirection:($)=>$?{"data-activation-direction":$}:null},IC=kC.forwardRef(function(Z,J){let{render:Q,className:X,children:z,...G}=Z,H=q4(),Y=E$(),K=H.useState("instantType"),{children:W,state:B}=r7({store:H,side:Y.side,cssVars:SC,children:z}),q={activationDirection:B.activationDirection,transitioning:B.transitioning,instant:K};return W0("div",Z,{state:q,ref:J,props:[G,{children:W}],stateAttributesMapping:Xs})});class KY{constructor(){this.store=new C$}open($){let Z=$?this.store.context.triggerElements.getById($):void 0;if($&&!Z)throw Error(C0(88,$));this.store.setOpen(!0,D0(K0.imperativeAction,void 0,Z))}close(){this.store.setOpen(!1,D0(K0.imperativeAction,void 0,void 0))}get isOpen(){return this.store.state.open}}function RC(){return new KY}var S$=P(d(),1);function yC({...$}){return S$.jsx(w6.Root,{"data-slot":"hover-card",...$})}function bC({...$}){return S$.jsx(w6.Trigger,{"data-slot":"hover-card-trigger",...$})}function xC({className:$,side:Z="bottom",sideOffset:J=4,align:Q="center",alignOffset:X=0,...z}){return S$.jsx(w6.Portal,{"data-slot":"hover-card-portal",children:S$.jsx(w6.Positioner,{align:Q,alignOffset:X,side:Z,sideOffset:J,className:"isolate z-50",children:S$.jsx(w6.Popup,{"data-slot":"hover-card-content",className:s("z-50 w-64 origin-(--transform-origin) rounded-xl bg-popover p-2.5 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",$),...z})})})}var i$=P(v(),1);function WY($){return X1({queryKey:S0.sessions($),queryFn:()=>C5(`/api/workspaces/${$}/sessions`),...A2})}function zs($,Z){return $?.filter((J)=>J.sessionId!==Z)}function hC($){let Z=o0();return t5({mutationFn:(J)=>T4(`/api/workspaces/${$}/sessions/${J}/archive`,{method:"POST"},"Couldn’t archive chat"),onSuccess:(J,Q)=>{Z.setQueryData(S0.sessions($),(X)=>zs(X,Q)),Z.removeQueries({queryKey:S0.events($,Q)}),Z.removeQueries({queryKey:S0.sessionConfig($,Q)}),Z.invalidateQueries({queryKey:S0.preview($)})}})}function gC($,Z){return X1({queryKey:S0.events($,Z??""),queryFn:async()=>{let J=await fetch(`/api/workspaces/${$}/sessions/${Z}/events`),Q=J.ok?await J.json():[];return qO(Q)},enabled:Boolean(Z),staleTime:1/0,gcTime:300000,refetchOnMount:!1,refetchOnWindowFocus:!1})}function BY($,Z){return X1({queryKey:S0.sessionConfig($,Z??""),queryFn:()=>C5(`/api/workspaces/${$}/sessions/${Z}/config`),enabled:Boolean(Z),staleTime:1/0,gcTime:300000,refetchOnMount:!1,refetchOnWindowFocus:!1})}function vC($){let Z=o0();return t5({mutationFn:({patch:J,sessionId:Q})=>C5(`/api/workspaces/${$}/sessions/${Q}/config`,r1("PUT",J),"Failed to save chat settings"),onSuccess:(J,{sessionId:Q})=>{Z.setQueryData(S0.sessionConfig($,Q),J)}})}var Gs=["fable","opus","sonnet","haiku"];function fC($){let Z=$.resolvedModel??$.value,J=Gs.findIndex((Q)=>Z===Q||Z.startsWith(`${Q}[`)||Z.includes(`-${Q}-`));return J===-1?void 0:J}function Hs($,Z){if($===void 0&&Z===void 0)return 0;if($===void 0)return-1;if(Z===void 0)return 1;return $-Z}function Ys($,Z){return Hs(fC($),fC(Z))}var Ks={"claude-code":Ys};function Ws($,Z){return $.map((J,Q)=>({model:J,index:Q})).sort((J,Q)=>Z(J.model,Q.model)||J.index-Q.index).map(({model:J})=>J)}function _F($,Z,J){if(Z&&$.includes(Z))return Z;if(J&&$.includes(J))return J;if($.includes("high"))return"high";return $[$.length-1]}function mC($,Z,J){let Q=_F($,Z,J);return Q?$.indexOf(Q):-1}function pC($){return $.length>1}function uC($,Z){if($.supportsFastMode!==!0)return!1;return Z??$.defaultFastMode??!1}function cC($,Z){let J=Ks[Z];return J?Ws($,J):$}function dC($,Z){let J=[];for(let Q of $){let X=Q.group??Z,z=J.find((G)=>G.label===X);if(z)z.models.push(Q);else J.push({label:X,models:[Q]})}return J}var s8={};_4(s8,{createHandle:()=>xE,Trigger:()=>IE,SubmenuTrigger:()=>bE,SubmenuRoot:()=>TE,Separator:()=>yE,Root:()=>bY,RadioItemIndicator:()=>PE,RadioItem:()=>OE,RadioGroup:()=>AE,Positioner:()=>VE,Portal:()=>UE,Popup:()=>WE,LinkItem:()=>YE,Item:()=>HE,Handle:()=>mY,GroupLabel:()=>zE,Group:()=>QE,CheckboxItemIndicator:()=>$E,CheckboxItem:()=>eC,Backdrop:()=>aC,Arrow:()=>iC});var lC=P(v(),1);var qY=P(v(),1),DF=qY.createContext(void 0);function U4($){let Z=qY.useContext(DF);if(Z===void 0&&!$)throw Error(C0(33));return Z}var UY=P(v(),1),OF=UY.createContext(void 0);function e5($){let Z=UY.useContext(OF);if(Z===void 0&&!$)throw Error(C0(36));return Z}var iC=lC.forwardRef(function(Z,J){let{className:Q,render:X,...z}=Z,{store:G}=e5(),{arrowRef:H,side:Y,align:K,arrowUncentered:W,arrowStyles:B}=U4(),U={open:G.useState("open"),side:Y,align:K,uncentered:W};return W0("div",Z,{ref:[H,J],stateAttributesMapping:N5,state:U,props:{style:B,"aria-hidden":!0,...z}})});var rC=P(v(),1);var FY=P(v(),1),Bs=FY.createContext(void 0);function z9($=!0){let Z=FY.useContext(Bs);if(Z===void 0&&!$)throw Error(C0(25));return Z}var qs={...N5,...m5},aC=rC.forwardRef(function(Z,J){let{className:Q,render:X,...z}=Z,{store:G}=e5(),H=G.useState("open"),Y=G.useState("mounted"),K=G.useState("transitionStatus"),W=G.useState("lastOpenChangeReason"),B=z9(),q={open:H,transitionStatus:K};return W0("div",Z,{ref:B?.backdropRef?[J,B.backdropRef]:J,state:q,stateAttributesMapping:qs,props:[{role:"presentation",hidden:!Y,style:{pointerEvents:W===K0.triggerHover?"none":void 0,userSelect:"none",WebkitUserSelect:"none"}},z]})});var MY=P(v(),1);var NY=P(v(),1),PF=NY.createContext(void 0);function nC(){let $=NY.useContext(PF);if($===void 0)throw Error(C0(30));return $}var k$=P(v(),1);var oC=P(v(),1);function VY($){let{closeOnClick:Z,highlighted:J,id:Q,nodeId:X,store:z,itemRef:G,itemMetadata:H}=$,{events:Y}=z.useState("floatingTreeRoot"),K=z9(!0),W=K!==void 0;return oC.useMemo(()=>({id:Q,role:"menuitem",tabIndex:J?0:-1,onMouseMove(B){if(!X)return;Y.emit("itemhover",{nodeId:X,target:B.currentTarget})},onClick(B){if(Z)Y.emit("close",{domEvent:B,reason:K0.itemPress})},onMouseUp(B){if(K){let q=K.initialCursorPointRef.current;if(K.initialCursorPointRef.current=null,W&&q&&Math.abs(B.clientX-q.x)<=1&&Math.abs(B.clientY-q.y)<=1)return}if(G.current&&z.context.allowMouseUpTriggerRef.current&&(!W||B.button===2)){if(!H||H.type==="regular-item")G.current.click()}}}),[Z,J,Q,Y,X,z,G,K,W,H])}var I$={type:"regular-item"};function j6($){let{closeOnClick:Z,disabled:J=!1,highlighted:Q,id:X,store:z,nativeButton:G,itemMetadata:H,nodeId:Y}=$,K=k$.useRef(null),{getButtonProps:W,buttonRef:B}=f1({disabled:J,focusableWhenDisabled:!0,native:G}),q=VY({closeOnClick:Z,highlighted:Q,id:X,nodeId:Y,store:z,itemRef:K,itemMetadata:H}),U=k$.useCallback((N)=>{return Y4(q,{onMouseEnter(){if(H.type!=="submenu-trigger")return;H.setActive()},onKeyUp(L){if(L.key===" "&&z.context.typingRef.current)L.preventBaseUIHandler()}},N,W)},[q,W,z,H]),F=O4(K,B);return k$.useMemo(()=>({getItemProps:U,itemRef:F}),[U,F])}var S9=P(v(),1);var LY=P(v(),1),wF=LY.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>{return()=>{}},elementsRef:{current:[]},nextIndexRef:{current:0}});function sC(){return LY.useContext(wF)}var Us=function($){return $[$.None=0]="None",$[$.GuessFromOrder=1]="GuessFromOrder",$}({});function F4($={}){let{label:Z,metadata:J,textRef:Q,indexGuessBehavior:X,index:z}=$,{register:G,unregister:H,subscribeMapChange:Y,elementsRef:K,labelsRef:W,nextIndexRef:B}=sC(),q=S9.useRef(-1),[U,F]=S9.useState(z??(X===Us.GuessFromOrder?()=>{if(q.current===-1){let V=B.current;B.current+=1,q.current=V}return q.current}:-1)),N=S9.useRef(null),L=S9.useCallback((V)=>{if(N.current=V,U!==-1&&V!==null){if(K.current[U]=V,W){let M=Z!==void 0;W.current[U]=M?Z:Q?.current?.textContent??V.textContent}}},[U,K,W,Z,Q]);return q0(()=>{if(z!=null)return;let V=N.current;if(V)return G(V,J),()=>{H(V)};return},[z,G,H,J]),q0(()=>{if(z!=null)return;return Y((V)=>{let M=N.current?V.get(N.current)?.index:null;if(M!=null)F(M)})},[z,Y,F]),S9.useMemo(()=>({ref:L,index:U}),[U,L])}var jF=function($){return $.checked="data-checked",$.unchecked="data-unchecked",$.disabled="data-disabled",$.highlighted="data-highlighted",$}({});var T6={checked($){if($)return{[jF.checked]:""};return{[jF.unchecked]:""}},...m5};var tC=P(d(),1),eC=MY.forwardRef(function(Z,J){let{render:Q,className:X,id:z,label:G,nativeButton:H=!1,disabled:Y=!1,closeOnClick:K=!1,checked:W,defaultChecked:B,onCheckedChange:q,...U}=Z,F=F4({label:G}),N=U4(!0),L=s0(z),{store:V}=e5(),M=V.useState("isActive",F.index),_=V.useState("itemProps"),[O,D]=r4({controlled:W,default:B??!1,name:"MenuCheckboxItem",state:"checked"}),{getItemProps:A,itemRef:E}=j6({closeOnClick:K,disabled:Y,highlighted:M,id:L,store:V,nativeButton:H,nodeId:N?.nodeId,itemMetadata:I$}),I=MY.useMemo(()=>({disabled:Y,highlighted:M,checked:O}),[Y,M,O]),y=U0((h)=>{let k={...D0(K0.itemPress,h.nativeEvent),preventUnmountOnClose:()=>{}};if(q?.(!O,k),k.isCanceled)return;D((S)=>!S)}),C=W0("div",Z,{state:I,stateAttributesMapping:T6,props:[_,{role:"menuitemcheckbox","aria-checked":O,onClick:y},U,A],ref:[E,J,F.ref]});return tC.jsx(PF.Provider,{value:I,children:C})});var AY=P(v(),1);var $E=AY.forwardRef(function(Z,J){let{render:Q,className:X,keepMounted:z=!1,...G}=Z,H=nC(),Y=AY.useRef(null),{transitionStatus:K,setMounted:W}=p4(H.checked);I1({open:H.checked,ref:Y,onComplete(){if(!H.checked)W(!1)}});let B={checked:H.checked,disabled:H.disabled,highlighted:H.highlighted,transitionStatus:K};return W0("span",Z,{state:B,ref:[J,Y],stateAttributesMapping:T6,props:{"aria-hidden":!0,...G},enabled:z||H.checked})});var R$=P(v(),1);var _Y=P(v(),1),TF=_Y.createContext(void 0);function ZE(){let $=_Y.useContext(TF);if($===void 0)throw Error(C0(31));return $}var JE=P(d(),1),QE=R$.forwardRef(function(Z,J){let{render:Q,className:X,...z}=Z,[G,H]=R$.useState(void 0),Y=R$.useMemo(()=>({setLabelId:H}),[H]),K=W0("div",Z,{ref:J,props:{role:"group","aria-labelledby":G,...z}});return JE.jsx(TF.Provider,{value:Y,children:K})});var XE=P(v(),1);var zE=XE.forwardRef(function(Z,J){let{className:Q,render:X,id:z,...G}=Z,H=s0(z),{setLabelId:Y}=ZE();return q0(()=>{return Y(H),()=>{Y(void 0)}},[Y,H]),W0("div",Z,{ref:J,props:{id:H,role:"presentation",...G}})});var GE=P(v(),1);var HE=GE.forwardRef(function(Z,J){let{render:Q,className:X,id:z,label:G,nativeButton:H=!1,disabled:Y=!1,closeOnClick:K=!0,...W}=Z,B=F4({label:G}),q=U4(!0),U=s0(z),{store:F}=e5(),N=F.useState("isActive",B.index),L=F.useState("itemProps"),{getItemProps:V,itemRef:M}=j6({closeOnClick:K,disabled:Y,highlighted:N,id:U,store:F,nativeButton:H,nodeId:q?.nodeId,itemMetadata:I$});return W0("div",Z,{state:{disabled:Y,highlighted:N},props:[L,W,V],ref:[M,J,B.ref]})});var y$=P(v(),1);var YE=y$.forwardRef(function(Z,J){let{render:Q,className:X,id:z,label:G,closeOnClick:H=!1,...Y}=Z,K=y$.useRef(null),W=F4({label:G}),q=U4(!0)?.nodeId,U=s0(z),{store:F}=e5(),N=F.useState("isActive",W.index),L=F.useState("itemProps"),V=VY({closeOnClick:H,highlighted:N,id:U,nodeId:q,store:F,itemRef:K}),M=y$.useMemo(()=>({highlighted:N}),[N]);return W0("a",Z,{state:M,props:[L,Y,V],ref:[K,J,W.ref]})});var PY=P(v(),1);var DY=P(v(),1),Fs=DY.createContext(void 0);function OY($){let Z=DY.useContext(Fs);if(Z===void 0&&!$)throw Error(C0(69));return Z}var KE=P(d(),1),Ns={...N5,...m5},WE=PY.forwardRef(function(Z,J){let{render:Q,className:X,finalFocus:z,...G}=Z,{store:H}=e5(),{side:Y,align:K}=U4(),W=OY(!0)!=null,B=H.useState("open"),q=H.useState("transitionStatus"),U=H.useState("popupProps"),F=H.useState("mounted"),N=H.useState("instantType"),L=H.useState("activeTriggerElement"),V=H.useState("parent"),M=H.useState("lastOpenChangeReason"),_=H.useState("rootId"),O=H.useState("floatingRootContext"),D=H.useState("floatingTreeRoot"),A=H.useState("closeDelay"),E=H.useState("activeTriggerElement"),I=V.type==="context-menu";I1({open:B,ref:H.context.popupRef,onComplete(){if(B)H.context.onOpenChangeComplete?.(!0)}}),PY.useEffect(()=>{function w(T){H.setOpen(!1,D0(T.reason,T.domEvent))}return D.events.on("close",w),()=>{D.events.off("close",w)}},[D.events,H]);let y=H.useState("hoverEnabled"),C=H.useState("disabled");j9(O,{enabled:y&&!C&&!I&&V.type!=="menubar",closeDelay:A});let h={transitionStatus:q,side:Y,align:K,open:B,nested:V.type==="menu",instant:N},k=W0("div",Z,{state:h,ref:[J,H.context.popupRef],stateAttributesMapping:Ns,props:[U,{onKeyDown(w){if(W&&J6.has(w.key))w.stopPropagation()}},K8(q),G,{"data-rootownerid":_}]}),S=V.type===void 0||I;if(L||V.type==="menubar"&&M!==K0.outsidePress)S=!0;return KE.jsx(V3,{context:O,modal:I,disabled:!F,returnFocus:z===void 0?S:z,initialFocus:V.type!=="menu",restoreFocus:!0,externalTree:V.type!=="menubar"?D:void 0,previousFocusableElement:E,nextFocusableElement:V.type===void 0?H.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:V.type===void 0?H.context.beforeContentFocusGuardRef:void 0,children:k})});var qE=P(v(),1);var wY=P(v(),1),CF=wY.createContext(void 0);function BE(){let $=wY.useContext(CF);if($===void 0)throw Error(C0(32));return $}var EF=P(d(),1),UE=qE.forwardRef(function(Z,J){let{keepMounted:Q=!1,...X}=Z,{store:z}=e5();if(!(z.useState("mounted")||Q))return null;return EF.jsx(CF.Provider,{value:Q,children:EF.jsx(N3,{ref:J,...X})})});var G9=P(v(),1);var C6=P(v(),1);var FE=P(d(),1);function jY($){let{children:Z,elementsRef:J,labelsRef:Q,onMapChange:X}=$,z=U0(X),G=C6.useRef(0),H=T5(Ls).current,Y=T5(Vs).current,[K,W]=C6.useState(0),B=C6.useRef(K),q=U0((V,M)=>{Y.set(V,M??null),B.current+=1,W(B.current)}),U=U0((V)=>{Y.delete(V),B.current+=1,W(B.current)}),F=C6.useMemo(()=>{As(K);let V=new Map;return Array.from(Y.keys()).filter((_)=>_.isConnected).sort(Ms).forEach((_,O)=>{let D=Y.get(_)??{};V.set(_,{...D,index:O})}),V},[Y,K]);q0(()=>{if(typeof MutationObserver!=="function"||F.size===0)return;let V=new MutationObserver((M)=>{let _=new Set,O=(D)=>_.has(D)?_.delete(D):_.add(D);if(M.forEach((D)=>{D.removedNodes.forEach(O),D.addedNodes.forEach(O)}),_.size===0)B.current+=1,W(B.current)});return F.forEach((M,_)=>{if(_.parentElement)V.observe(_.parentElement,{childList:!0})}),()=>{V.disconnect()}},[F]),q0(()=>{if(B.current===K){if(J.current.length!==F.size)J.current.length=F.size;if(Q&&Q.current.length!==F.size)Q.current.length=F.size;G.current=F.size}z(F)},[z,F,J,Q,K]),q0(()=>{return()=>{J.current=[]}},[J]),q0(()=>{return()=>{if(Q)Q.current=[]}},[Q]);let N=U0((V)=>{return H.add(V),()=>{H.delete(V)}});q0(()=>{H.forEach((V)=>V(F))},[H,F]);let L=C6.useMemo(()=>({register:q,unregister:U,subscribeMapChange:N,elementsRef:J,labelsRef:Q,nextIndexRef:G}),[q,U,N,J,Q,G]);return FE.jsx(wF.Provider,{value:L,children:Z})}function Vs(){return new Map}function Ls(){return new Set}function Ms($,Z){let J=$.compareDocumentPosition(Z);if(J&Node.DOCUMENT_POSITION_FOLLOWING||J&Node.DOCUMENT_POSITION_CONTAINED_BY)return-1;if(J&Node.DOCUMENT_POSITION_PRECEDING||J&Node.DOCUMENT_POSITION_CONTAINS)return 1;return 0}function As($){}var b$=P(d(),1),VE=G9.forwardRef(function(Z,J){let{anchor:Q,positionMethod:X="absolute",className:z,render:G,side:H,align:Y,sideOffset:K=0,alignOffset:W=0,collisionBoundary:B="clipping-ancestors",collisionPadding:q=5,arrowPadding:U=5,sticky:F=!1,disableAnchorTracking:N=!1,collisionAvoidance:L=NE,...V}=Z,{store:M}=e5(),_=BE(),O=z9(!0),D=M.useState("parent"),A=M.useState("floatingRootContext"),E=M.useState("floatingTreeRoot"),I=M.useState("mounted"),y=M.useState("open"),C=M.useState("modal"),h=M.useState("activeTriggerElement"),k=M.useState("transitionStatus"),S=M.useState("lastOpenChangeReason"),w=M.useState("floatingNodeId"),T=M.useState("floatingParentNodeId"),R=Q,b=K,g=W,u=Y,j=L;if(D.type==="context-menu"){if(R=Q??D.context?.anchor,u=u??"start",!H&&u!=="center")g=Z.alignOffset??2,b=Z.sideOffset??-5}let t=H,Q0=u;if(D.type==="menu")t=t??"inline-end",Q0=Q0??"start",j=Z.collisionAvoidance??a2;else if(D.type==="menubar")t=t??"bottom",Q0=Q0??"start";let x=D.type==="context-menu",e=i2({anchor:R,floatingRootContext:A,positionMethod:O?"fixed":X,mounted:I,side:t,sideOffset:b,align:Q0,alignOffset:g,arrowPadding:x?0:U,collisionBoundary:B,collisionPadding:q,sticky:F,nodeId:w,keepMounted:_,disableAnchorTracking:N,collisionAvoidance:j,shiftCrossAxis:x&&!(("side"in j)&&j.side==="flip"),externalTree:E}),M0=G9.useMemo(()=>{let V0={};if(!y)V0.pointerEvents="none";return{role:"presentation",hidden:!I,style:{...e.positionerStyles,...V0}}},[y,I,e.positionerStyles]);G9.useEffect(()=>{function V0(i){if(i.open){if(i.parentNodeId===w)M.set("hoverEnabled",!1);if(i.nodeId!==w&&i.parentNodeId===M.select("floatingParentNodeId"))M.setOpen(!1,D0(K0.siblingOpen))}}return E.events.on("menuopenchange",V0),()=>{E.events.off("menuopenchange",V0)}},[M,E.events,w]),G9.useEffect(()=>{if(M.select("floatingParentNodeId")==null)return;function V0(i){if(i.open||i.nodeId!==M.select("floatingParentNodeId"))return;let $0=i.reason??K0.siblingOpen;M.setOpen(!1,D0($0))}return E.events.on("menuopenchange",V0),()=>{E.events.off("menuopenchange",V0)}},[E.events,M]),G9.useEffect(()=>{function V0(i){if(!y||i.nodeId!==M.select("floatingParentNodeId"))return;if(i.target&&h&&h!==i.target)M.setOpen(!1,D0(K0.siblingOpen))}return E.events.on("itemhover",V0),()=>{E.events.off("itemhover",V0)}},[E.events,y,h,M]),G9.useEffect(()=>{let V0={open:y,nodeId:w,parentNodeId:T,reason:M.select("lastOpenChangeReason")};E.events.emit("menuopenchange",V0)},[E.events,y,M,w,T]);let l={open:y,side:e.side,align:e.align,anchorHidden:e.anchorHidden,nested:D.type==="menu"},H0=G9.useMemo(()=>({side:e.side,align:e.align,arrowRef:e.arrowRef,arrowUncentered:e.arrowUncentered,arrowStyles:e.arrowStyles,nodeId:e.context.nodeId}),[e.side,e.align,e.arrowRef,e.arrowUncentered,e.arrowStyles,e.context.nodeId]),B0=W0("div",Z,{state:l,stateAttributesMapping:N5,ref:[J,M.useStateSetter("positionerElement")],props:[M0,K8(k),V]}),X0=I&&D.type!=="menu"&&(D.type!=="menubar"&&C&&S!==K0.triggerHover||D.type==="menubar"&&D.context.modal),Y0=null;if(D.type==="menubar")Y0=D.context.contentElement;else if(D.type===void 0)Y0=h;return b$.jsxs(DF.Provider,{value:H0,children:[X0&&b$.jsx(o7,{ref:D.type==="context-menu"||D.type==="nested-context-menu"?D.context.internalBackdropRef:null,inert:x2(!y),cutout:Y0}),b$.jsx(XJ,{id:w,children:b$.jsx(jY,{elementsRef:M.context.itemDomElements,labelsRef:M.context.itemLabels,children:B0})})]})});var x$=P(v(),1);var TY=P(v(),1),SF=TY.createContext(void 0);function LE(){let $=TY.useContext(SF);if($===void 0)throw Error(C0(34));return $}var ME=P(d(),1),AE=x$.memo(x$.forwardRef(function(Z,J){let{render:Q,className:X,value:z,defaultValue:G,onValueChange:H,disabled:Y=!1,...K}=Z,[W,B]=r4({controlled:z,default:G,name:"MenuRadioGroup"}),q=U0(H),U=U0((V,M)=>{if(q?.(V,M),M.isCanceled)return;B(V)}),N=W0("div",Z,{state:{disabled:Y},ref:J,props:{role:"group","aria-disabled":Y||void 0,...K}}),L=x$.useMemo(()=>({value:W,setValue:U,disabled:Y}),[W,U,Y]);return ME.jsx(SF.Provider,{value:L,children:N})}));var EY=P(v(),1);var CY=P(v(),1),kF=CY.createContext(void 0);function _E(){let $=CY.useContext(kF);if($===void 0)throw Error(C0(35));return $}var DE=P(d(),1),OE=EY.forwardRef(function(Z,J){let{render:Q,className:X,id:z,label:G,nativeButton:H=!1,disabled:Y=!1,closeOnClick:K=!1,value:W,...B}=Z,q=F4({label:G}),U=U4(!0),F=s0(z),{store:N}=e5(),L=N.useState("isActive",q.index),V=N.useState("itemProps"),{value:M,setValue:_,disabled:O}=LE(),D=O||Y,A=M===W,{getItemProps:E,itemRef:I}=j6({closeOnClick:K,disabled:D,highlighted:L,id:F,store:N,nativeButton:H,nodeId:U?.nodeId,itemMetadata:I$}),y=EY.useMemo(()=>({disabled:D,highlighted:L,checked:A}),[D,L,A]),C=U0((k)=>{let S={...D0(K0.itemPress,k.nativeEvent),preventUnmountOnClose:()=>{}};_(W,S)}),h=W0("div",Z,{state:y,stateAttributesMapping:T6,props:[V,{role:"menuitemradio","aria-checked":A,onClick:C},B,E],ref:[I,J,q.ref]});return DE.jsx(kF.Provider,{value:y,children:h})});var SY=P(v(),1);var PE=SY.forwardRef(function(Z,J){let{render:Q,className:X,keepMounted:z=!1,...G}=Z,H=_E(),Y=SY.useRef(null),{transitionStatus:K,setMounted:W}=p4(H.checked);I1({open:H.checked,ref:Y,onComplete(){if(!H.checked)W(!1)}});let B={checked:H.checked,disabled:H.disabled,highlighted:H.highlighted,transitionStatus:K};return W0("span",Z,{state:B,stateAttributesMapping:T6,ref:[J,Y],props:{"aria-hidden":!0,...G},enabled:z||H.checked})});var C1=P(v(),1);var kY=P(v(),1),_s=kY.createContext(null);function IY($){let Z=kY.useContext(_s);if(Z===null&&!$)throw Error(C0(5));return Z}var _Q=P(v(),1);var Ds={...d2,disabled:E0(($)=>$.parent.type==="menubar"?$.parent.context.disabled||$.disabled:$.disabled),modal:E0(($)=>($.parent.type===void 0||$.parent.type==="context-menu")&&($.modal??!0)),allowMouseEnter:E0(($)=>$.allowMouseEnter),stickIfOpen:E0(($)=>$.stickIfOpen),parent:E0(($)=>$.parent),rootId:E0(($)=>{if($.parent.type==="menu")return $.parent.store.select("rootId");return $.parent.type!==void 0?$.parent.context.rootId:$.rootId}),activeIndex:E0(($)=>$.activeIndex),isActive:E0(($,Z)=>$.activeIndex===Z),hoverEnabled:E0(($)=>$.hoverEnabled),instantType:E0(($)=>$.instantType),lastOpenChangeReason:E0(($)=>$.openChangeReason),floatingTreeRoot:E0(($)=>{if($.parent.type==="menu")return $.parent.store.select("floatingTreeRoot");return $.floatingTreeRoot}),floatingNodeId:E0(($)=>$.floatingNodeId),floatingParentNodeId:E0(($)=>$.floatingParentNodeId),itemProps:E0(($)=>$.itemProps),closeDelay:E0(($)=>$.closeDelay),keyboardEventRelay:E0(($)=>{if($.keyboardEventRelay)return $.keyboardEventRelay;if($.parent.type==="menu")return $.parent.store.select("keyboardEventRelay");return})};class h$ extends l8{constructor($){super({...Os(),...$},{positionerRef:_Q.createRef(),popupRef:_Q.createRef(),typingRef:{current:!1},itemDomElements:{current:[]},itemLabels:{current:[]},allowMouseUpTriggerRef:{current:!1},triggerFocusTargetRef:_Q.createRef(),beforeContentFocusGuardRef:_Q.createRef(),onOpenChangeComplete:void 0,triggerElements:new r8},Ds);this.unsubscribeParentListener=this.observe("parent",(Z)=>{if(this.unsubscribeParentListener?.(),Z.type==="menu"){this.unsubscribeParentListener=Z.store.subscribe(()=>{this.notifyAll()}),this.context.allowMouseUpTriggerRef=Z.store.context.allowMouseUpTriggerRef;return}if(Z.type!==void 0)this.context.allowMouseUpTriggerRef=Z.context.allowMouseUpTriggerRef;this.unsubscribeParentListener=null})}setOpen($,Z){this.state.floatingRootContext.context.events.emit("setOpen",{open:$,eventDetails:Z})}static useStore($,Z){let J=T5(()=>{return new h$(Z)}).current;return $??J}unsubscribeParentListener=null}function Os(){return{...c2(),disabled:!1,modal:!0,allowMouseEnter:!1,stickIfOpen:!0,parent:{type:void 0},rootId:void 0,activeIndex:null,hoverEnabled:!0,instantType:void 0,openChangeReason:null,floatingTreeRoot:new B3,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:E5,keyboardEventRelay:void 0,closeDelay:0}}var RY=P(v(),1),IF=RY.createContext(void 0);function yY(){return RY.useContext(IF)}var RF=P(d(),1),bY=tZ(function(Z){let{children:J,open:Q,onOpenChange:X,onOpenChangeComplete:z,defaultOpen:G=!1,disabled:H=!1,modal:Y,loopFocus:K=!0,orientation:W="vertical",actionsRef:B,closeParentOnEsc:q=!1,handle:U,triggerId:F,defaultTriggerId:N=null,highlightItemOnHover:L=!0}=Z,V=z9(!0),M=e5(!0),_=IY(!0),O=yY(),D=C1.useMemo(()=>{if(O&&M)return{type:"menu",store:M.store};if(_)return{type:"menubar",context:_};if(V&&!M)return{type:"context-menu",context:V};return{type:void 0}},[V,M,_,O]),A=h$.useStore(U?.store,{open:G,openProp:Q,activeTriggerId:N,triggerIdProp:F,parent:D});n2(()=>{if(Q===void 0&&A.state.open===!1&&G===!0)A.update({open:!0,activeTriggerId:N})}),A.useControlledProp("openProp",Q),A.useControlledProp("triggerIdProp",F),A.useContextCallback("onOpenChangeComplete",z);let E=A.useState("floatingTreeRoot"),I=q3(E),y=s1();q0(()=>{if(V&&!M)A.update({parent:{type:"context-menu",context:V},floatingNodeId:I,floatingParentNodeId:y});else if(M)A.update({floatingNodeId:I,floatingParentNodeId:y})},[V,M,I,y,A]);let C=A.useState("open"),h=A.useState("activeTriggerElement"),k=A.useState("positionerElement"),S=A.useState("hoverEnabled"),w=A.useState("modal"),T=A.useState("disabled"),R=A.useState("lastOpenChangeReason"),b=A.useState("parent"),g=A.useState("activeIndex"),u=A.useState("payload"),j=A.useState("floatingParentNodeId"),t=C1.useRef(null),Q0=j!=null,x;A.useSyncedValues({disabled:H,modal:b.type===void 0?Y:void 0,rootId:Y8()});let{openMethod:e,triggerProps:M0,reset:l}=e7(C);p2(A);let{forceUnmount:H0}=u2(C,A,()=>{A.update({allowMouseEnter:!1,stickIfOpen:!0}),l()}),B0=C1.useRef(b.type!=="context-menu"),X0=V1();C1.useEffect(()=>{if(!C)t.current=null;if(b.type!=="context-menu")return;if(!C){X0.clear(),B0.current=!1;return}X0.start(500,()=>{B0.current=!0})},[X0,C,b.type]),s7(C&&w&&R!==K0.triggerHover&&e!=="touch",k),q0(()=>{if(!C&&!S)A.set("hoverEnabled",!0)},[C,S,A]);let Y0=C1.useRef(!0),V0=V1(),i=U0((d0,R0)=>{let G0=R0.reason;if(C===d0&&R0.trigger===h&&R===G0)return;if(R0.preventUnmountOnClose=()=>{A.set("preventUnmountingOnClose",!0)},!d0&&R0.trigger==null)R0.trigger=h??void 0;if(X?.(d0,R0),R0.isCanceled)return;let A0={open:d0,nativeEvent:R0.event,reason:R0.reason,nested:Q0};x?.emit("openchange",A0);let v0=R0.event;if(d0===!1&&v0?.type==="click"&&v0.pointerType==="touch"&&!Y0.current)return;if(!d0&&g!==null){let T0=A.context.itemDomElements.current[g];queueMicrotask(()=>{T0?.setAttribute("tabindex","-1")})}if(d0&&G0===K0.triggerFocus)Y0.current=!1,V0.start(300,()=>{Y0.current=!0});else Y0.current=!0,V0.clear();let D5=(G0===K0.triggerPress||G0===K0.itemPress)&&v0.detail===0&&v0?.isTrusted,K5=!d0&&(G0===K0.escapeKey||G0==null),d5={open:d0,openChangeReason:G0};t.current=R0.event??null;let I0=R0.trigger?.id??null;if(I0||d0)d5.activeTriggerId=I0,d5.activeTriggerElement=R0.trigger??null;if(A.update(d5),b.type==="menubar"&&(G0===K0.triggerFocus||G0===K0.focusOut||G0===K0.triggerHover||G0===K0.listNavigation||G0===K0.siblingOpen))A.set("instantType","group");else if(D5||K5)A.set("instantType",D5?"click":"dismiss");else A.set("instantType",void 0)}),$0=C1.useCallback((d0)=>{let R0=D0(d0);return R0.preventUnmountOnClose=()=>{A.set("preventUnmountingOnClose",!0)},R0},[A]),Z0=C1.useCallback(()=>{A.setOpen(!1,$0(K0.imperativeAction))},[A,$0]);C1.useImperativeHandle(B,()=>({unmount:H0,close:Z0}),[H0,Z0]);let J0;if(b.type==="context-menu")J0=b.context;C1.useImperativeHandle(J0?.positionerRef,()=>k,[k]),C1.useImperativeHandle(J0?.actionsRef,()=>({setOpen:i}),[i]);let n=B2({popupStore:A,onOpenChange:i});x=n.context.events,C1.useEffect(()=>{let d0=({open:R0,eventDetails:G0})=>i(R0,G0);return x.on("setOpen",d0),()=>{x?.off("setOpen",d0)}},[x,i]);let m=W2(n,{enabled:!T,bubbles:{escapeKey:q&&b.type==="menu"},outsidePress(){if(b.type!=="context-menu"||t.current?.type==="contextmenu")return!0;return B0.current},externalTree:Q0?E:void 0}),c=D3(n,{role:"menu"}),f=u4(),a=C1.useCallback((d0)=>{if(A.select("activeIndex")===d0)return;A.set("activeIndex",d0)},[A]),o=Nq(n,{enabled:!T,listRef:A.context.itemDomElements,activeIndex:g,nested:b.type!==void 0,loopFocus:K,orientation:W,parentOrientation:b.type==="menubar"?b.context.orientation:void 0,rtl:f==="rtl",disabledIndices:DQ,onNavigate:a,openOnArrowKeyDown:b.type!=="context-menu",externalTree:Q0?E:void 0,focusItemOnHover:L}),N0=C1.useCallback((d0)=>{A.context.typingRef.current=d0},[A]),j0=Vq(n,{listRef:A.context.itemLabels,activeIndex:g,resetMs:wE,onMatch:(d0)=>{if(C&&d0!==g)A.set("activeIndex",d0)},onTypingChange:N0}),{getReferenceProps:h0,getFloatingProps:u0,getItemProps:p,getTriggerProps:r}=e1([m,c,o,j0]),z0=C1.useMemo(()=>{let d0=Y4(h0(),{onMouseMove(){A.set("allowMouseEnter",!0)}},M0);return delete d0.role,d0},[h0,A,M0]),L0=C1.useMemo(()=>{let d0=r();if(!d0)return d0;let R0=Y4(d0,M0);return delete R0.role,delete R0["aria-controls"],R0},[r,M0]),P0=C1.useMemo(()=>u0({onMouseMove(){if(A.set("allowMouseEnter",!0),b.type==="menu")A.set("hoverEnabled",!1)},onClick(){if(A.select("hoverEnabled"))A.set("hoverEnabled",!1)},onKeyDown(d0){let R0=A.select("keyboardEventRelay");if(R0&&!d0.isPropagationStopped())R0(d0)}}),[u0,b.type,A]),g0=C1.useMemo(()=>p(),[p]);A.useSyncedValues({floatingRootContext:n,activeTriggerProps:z0,inactiveTriggerProps:L0,popupProps:P0,itemProps:g0});let e0=C1.useMemo(()=>({store:A,parent:D}),[A,D]),U5=RF.jsx(OF.Provider,{value:e0,children:typeof J==="function"?J({payload:u}):J});if(b.type===void 0||b.type==="context-menu")return RF.jsx(zJ,{externalTree:E,children:U5});return U5});var jE=P(v(),1);var yF=P(d(),1);function TE($){let Z=e5().store,J=jE.useMemo(()=>({parentMenu:Z}),[Z]);return yF.jsx(IF.Provider,{value:J,children:yF.jsx(bY,{...$})})}var x8=P(v(),1),xF=P(G4(),1);function CE($){let Z=$.getBoundingClientRect(),J=window.getComputedStyle($,"::before"),Q=window.getComputedStyle($,"::after");if(!(J.content!=="none"||Q.content!=="none"))return Z;let z=parseFloat(J.width)||0,G=parseFloat(J.height)||0,H=parseFloat(Q.width)||0,Y=parseFloat(Q.height)||0,K=Math.max(Z.width,z,H),W=Math.max(Z.height,G,Y),B=K-Z.width,q=W-Z.height;return{left:Z.left-B/2,right:Z.right+B/2,top:Z.top-q/2,bottom:Z.bottom+q/2}}var hY=P(v(),1);function EE($={}){let{highlightItemOnHover:Z,highlightedIndex:J,onHighlightedIndexChange:Q}=xY(),{ref:X,index:z}=F4($),G=J===z,H=hY.useRef(null),Y=O4(X,H);return{compositeProps:hY.useMemo(()=>({tabIndex:G?0:-1,onFocus(){Q(z)},onMouseMove(){let W=H.current;if(!Z||!W)return;let B=W.hasAttribute("disabled")||W.ariaDisabled==="true";if(!G&&!B)W.focus()}}),[G,Q,z,Z]),compositeRef:Y,index:z}}function SE($){let{render:Z,className:J,state:Q=E5,props:X=DQ,refs:z=DQ,metadata:G,stateAttributesMapping:H,tag:Y="div",...K}=$,{compositeProps:W,compositeRef:B}=EE({metadata:G});return W0(Y,$,{state:Q,ref:[...z,B],props:[W,...X,K],stateAttributesMapping:H})}function bF($){if(L1($)&&$.hasAttribute("data-rootownerid"))return $.getAttribute("data-rootownerid")??void 0;if(f7($))return;return bF(mz($))}var gY=P(v(),1);function kE($){let{enabled:Z=!0,mouseDownAction:J,open:Q}=$,X=gY.useRef(!1);return gY.useMemo(()=>{if(!Z)return E5;return{onMouseDown:(z)=>{if(J==="open"&&!Q||J==="close"&&Q)X.current=!0,p0(z.currentTarget).addEventListener("click",()=>{X.current=!1},{once:!0})},onClick:(z)=>{if(X.current)X.current=!1,z.preventBaseUIHandler()}}},[Z,J,Q])}var E6=P(d(),1),vY=2,IE=Jz(function(Z,J){let{render:Q,className:X,disabled:z=!1,nativeButton:G=!0,id:H,openOnHover:Y,delay:K=100,closeDelay:W=0,handle:B,payload:q,...U}=Z,F=e5(!0),N=B?.store??F?.store;if(!N)throw Error(C0(85));let L=s0(H),V=N.useState("isTriggerActive",L),M=N.useState("floatingRootContext"),_=N.useState("isOpenedByTrigger",L),O=x8.useRef(null),D=ws(),A=xY(!0),E=k8(),I=x8.useMemo(()=>{return E??new B3},[E]),y=q3(I),C=s1(),{registerTrigger:h,isMountedByThisTrigger:k}=m2(L,O,N,{payload:q,closeDelay:W,parent:D,floatingTreeRoot:I,floatingNodeId:y,floatingParentNodeId:C,keyboardEventRelay:A?.relayKeyboardEvent}),S=D.type==="menubar",w=N.useState("disabled"),T=z||w||S&&D.context.disabled,{getButtonProps:R,buttonRef:b}=f1({disabled:T,native:G});x8.useEffect(()=>{if(!_&&D.type===void 0)N.context.allowMouseUpTriggerRef.current=!1},[N,_,D.type]);let g=x8.useRef(null),u=V1(),j=U0((m)=>{if(!g.current)return;u.clear(),N.context.allowMouseUpTriggerRef.current=!1;let c=m.target;if(m0(g.current,c)||m0(N.select("positionerElement"),c)||c===g.current)return;if(c!=null&&bF(c)===N.select("rootId"))return;let f=CE(g.current);if(m.clientX>=f.left-vY&&m.clientX<=f.right+vY&&m.clientY>=f.top-vY&&m.clientY<=f.bottom+vY)return;I.events.emit("close",{domEvent:m,reason:K0.cancelOpen})});x8.useEffect(()=>{if(_&&N.select("lastOpenChangeReason")===K0.triggerHover)p0(g.current).addEventListener("mouseup",j,{once:!0})},[_,j,N]);let t=S&&D.context.hasSubmenuOpen,x=q2(M,{enabled:(Y??t)&&!T&&D.type!=="context-menu"&&(!S||t&&!k),handleClose:U2({blockPointerEvents:!S}),mouseOnly:!0,move:!1,restMs:D.type===void 0?K:void 0,delay:{close:W},triggerElementRef:O,externalTree:I,isActiveTrigger:V}),e=Ps(_,N.select("lastOpenChangeReason")),M0=w9(M,{enabled:!T&&D.type!=="context-menu",event:_&&S?"click":"mousedown",toggle:!0,ignoreMouse:!1,stickIfOpen:D.type===void 0?e:!1}),l=M3(M,{enabled:!T&&t}),H0=kE({open:_,enabled:S,mouseDownAction:"open"}),B0=e1([M0,l]),X0={disabled:T,open:_},Y0=N.useState("triggerProps",k),V0=[g,J,b,h,O],i=[B0.getReferenceProps(),x??E5,Y0,{"aria-haspopup":"menu",id:L,onMouseDown:(m)=>{if(N.select("open"))return;u.start(200,()=>{N.context.allowMouseUpTriggerRef.current=!0}),p0(m.currentTarget).addEventListener("mouseup",j,{once:!0})}},S?{role:"menuitem"}:{},H0,U,R],$0=x8.useRef(null),Z0=U0((m)=>{xF.flushSync(()=>{N.setOpen(!1,D0(K0.focusOut,m.nativeEvent,m.currentTarget))}),Tz($0.current)?.focus()}),J0=U0((m)=>{let c=N.select("positionerElement");if(c&&G2(m,c))N.context.beforeContentFocusGuardRef.current?.focus();else{xF.flushSync(()=>{N.setOpen(!1,D0(K0.focusOut,m.nativeEvent,m.currentTarget))});let f=jz(N.context.triggerFocusTargetRef.current||O.current);while(f!==null&&m0(c,f)){let a=f;if(f=a9(f),f===a)break}f?.focus()}}),n=W0("button",Z,{enabled:!S,stateAttributesMapping:VJ,state:X0,ref:V0,props:i});if(S)return E6.jsx(SE,{tag:"button",render:Q,className:X,state:X0,refs:V0,props:i,stateAttributesMapping:VJ});if(_)return E6.jsxs(x8.Fragment,{children:[E6.jsx(E8,{ref:$0,onFocus:Z0},`${L}-pre-focus-guard`),E6.jsx(x8.Fragment,{children:n},L),E6.jsx(E8,{ref:N.context.triggerFocusTargetRef,onFocus:J0},`${L}-post-focus-guard`)]});return E6.jsx(x8.Fragment,{children:n},L)});function Ps($,Z){let J=V1(),[Q,X]=x8.useState(!1);return q0(()=>{if($&&Z==="trigger-hover")X(!0),J.start(fY,()=>{X(!1)});else if(!$)J.clear(),X(!1)},[$,Z,J]),Q}function ws(){let $=z9(!0),Z=e5(!0),J=IY(!0);return x8.useMemo(()=>{if(J)return{type:"menubar",context:J};if($&&!Z)return{type:"context-menu",context:$};return{type:void 0}},[$,Z,J])}var RE=P(v(),1);var yE=RE.forwardRef(function(Z,J){let{className:Q,render:X,orientation:z="horizontal",...G}=Z;return W0("div",Z,{state:{orientation:z},ref:J,props:[{role:"separator","aria-orientation":z},G]})});var k9=P(v(),1);var bE=k9.forwardRef(function(Z,J){let{render:Q,className:X,label:z,id:G,nativeButton:H=!1,openOnHover:Y=!0,delay:K=100,closeDelay:W=0,disabled:B=!1,...q}=Z,U=F4(),F=U4(),{store:N}=e5(),L=s0(G),V=N.useState("open"),M=N.useState("floatingRootContext"),_=N.useState("floatingTreeRoot"),O=Kq(L,N),D=k9.useCallback((M0)=>{let l=O(M0);if(M0!==null&&N.select("open")&&N.select("activeTriggerId")==null)N.update({activeTriggerId:L,activeTriggerElement:M0,closeDelay:W});return l},[O,W,N,L]),A=k9.useRef(null),E=k9.useCallback((M0)=>{A.current=M0,N.set("activeTriggerElement",M0)},[N]),I=yY();if(!I?.parentMenu)throw Error(C0(37));N.useSyncedValue("closeDelay",W);let y=I.parentMenu,C=y.useState("itemProps"),h=y.useState("isActive",U.index),k=k9.useMemo(()=>({type:"submenu-trigger",setActive(){y.set("activeIndex",U.index)}}),[y,U.index]),S=N.useState("disabled"),w=B||S,{getItemProps:T,itemRef:R}=j6({closeOnClick:!1,disabled:w,highlighted:h,id:L,store:N,nativeButton:H,itemMetadata:k,nodeId:F?.nodeId}),b=N.useState("hoverEnabled"),g=y.useState("allowMouseEnter"),u=q2(M,{enabled:b&&Y&&!w,handleClose:U2({blockPointerEvents:!0}),mouseOnly:!0,move:!0,restMs:K,delay:g?{open:K,close:W}:0,triggerElementRef:A,externalTree:_}),j=w9(M,{enabled:!w,event:"mousedown",toggle:!Y,ignoreMouse:Y,stickIfOpen:!1}),t=e1([j]),Q0=N.useState("triggerProps",!0);return delete Q0.id,W0("div",Z,{state:{disabled:w,highlighted:h,open:V},stateAttributesMapping:r2,props:[t.getReferenceProps(),u,Q0,C,{tabIndex:V||h?0:-1,onBlur(){if(h)y.set("activeIndex",null)}},q,T],ref:[J,U.ref,R,D,E]})});class mY{constructor(){this.store=new h$}open($){let Z=$?this.store.context.triggerElements.getById($):void 0;if($&&!Z)throw Error(C0(83,$));this.store.setOpen(!0,D0("imperative-action",void 0,Z))}close(){this.store.setOpen(!1,D0("imperative-action",void 0,void 0))}get isOpen(){return this.store.state.open}}function xE(){return new mY}var h8=P(d(),1);function g$({...$}){return h8.jsx(s8.Root,{"data-slot":"dropdown-menu",...$})}function v$({...$}){return h8.jsx(s8.Trigger,{"data-slot":"dropdown-menu-trigger",...$})}function f$({align:$="start",alignOffset:Z=0,side:J="bottom",sideOffset:Q=4,className:X,...z}){return h8.jsx(s8.Portal,{children:h8.jsx(s8.Positioner,{className:"isolate z-50 outline-none",align:$,alignOffset:Z,side:J,sideOffset:Q,children:h8.jsx(s8.Popup,{"data-slot":"dropdown-menu-content",className:s("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 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",X),...z})})})}function m$({...$}){return h8.jsx(s8.Group,{"data-slot":"dropdown-menu-group",...$})}function pY({className:$,inset:Z,...J}){return h8.jsx(s8.GroupLabel,{"data-slot":"dropdown-menu-label","data-inset":Z,className:s("px-2 pt-1.5 pb-0.5 text-xs text-muted-foreground data-inset:pl-7",$),...J})}function OQ({className:$,inset:Z,variant:J="default",...Q}){return h8.jsx(s8.Item,{"data-slot":"dropdown-menu-item","data-inset":Z,"data-variant":J,className:s("group/dropdown-menu-item relative flex cursor-default items-center gap-2 rounded-md 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:pl-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",$),...Q})}function hE({...$}){return h8.jsx(s8.RadioGroup,{"data-slot":"dropdown-menu-radio-group",...$})}function gE({className:$,children:Z,inset:J,...Q}){return h8.jsxs(s8.RadioItem,{"data-slot":"dropdown-menu-radio-item","data-inset":J,className:s("relative flex cursor-default items-center gap-2 rounded-md py-1 pr-8 pl-2 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",$),...Q,children:[h8.jsx("span",{className:"pointer-events-none absolute right-2 flex items-center justify-center","data-slot":"dropdown-menu-radio-item-indicator",children:h8.jsx(s8.RadioItemIndicator,{children:h8.jsx(T$,{stroke:1.75})})}),Z]})}function vE({className:$,...Z}){return h8.jsx(s8.Separator,{"data-slot":"dropdown-menu-separator",className:s("mx-2 my-1 h-px bg-border",$),...Z})}var S6={};_4(S6,{createHandle:()=>KS,Viewport:()=>YS,Trigger:()=>cE,Title:()=>ZS,Root:()=>pE,Positioner:()=>rE,Portal:()=>iE,Popup:()=>nE,Handle:()=>iY,Description:()=>QS,Close:()=>zS,Backdrop:()=>eE,Arrow:()=>sE});var $2=P(v(),1);var uY=P(v(),1),hF=uY.createContext(void 0);function b1($){let Z=uY.useContext(hF);if(Z===void 0&&!$)throw Error(C0(47));return Z}var p$=P(v(),1),fE=P(G4(),1);function js(){return{...c2(),disabled:!1,modal:!1,instantType:void 0,openMethod:null,openChangeReason:null,titleElementId:void 0,descriptionElementId:void 0,stickIfOpen:!0,nested:!1,openOnHover:!1,closeDelay:0,hasViewport:!1}}var Ts={...d2,disabled:E0(($)=>$.disabled),instantType:E0(($)=>$.instantType),openMethod:E0(($)=>$.openMethod),openChangeReason:E0(($)=>$.openChangeReason),modal:E0(($)=>$.modal),stickIfOpen:E0(($)=>$.stickIfOpen),titleElementId:E0(($)=>$.titleElementId),descriptionElementId:E0(($)=>$.descriptionElementId),openOnHover:E0(($)=>$.openOnHover),closeDelay:E0(($)=>$.closeDelay),hasViewport:E0(($)=>$.hasViewport)};class u$ extends l8{constructor($){let Z={...js(),...$};if(Z.open&&$?.mounted===void 0)Z.mounted=!0;super(Z,{popupRef:p$.createRef(),backdropRef:p$.createRef(),internalBackdropRef:p$.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:p$.createRef(),beforeContentFocusGuardRef:p$.createRef(),stickIfOpenTimeout:new l1,triggerElements:new r8},Ts)}setOpen=($,Z)=>{let J=Z.reason===K0.triggerHover,Q=Z.reason===K0.triggerPress&&Z.event.detail===0,X=!$&&(Z.reason===K0.escapeKey||Z.reason==null);if(Z.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},this.context.onOpenChange?.($,Z),Z.isCanceled)return;let z={open:$,nativeEvent:Z.event,reason:Z.reason,nested:this.state.nested,triggerElement:Z.trigger};this.state.floatingRootContext.context.events?.emit("openchange",z);let H=()=>{let Y={open:$,openChangeReason:Z.reason},K=Z.trigger?.id??null;if(K||$)Y.activeTriggerId=K,Y.activeTriggerElement=Z.trigger??null;this.update(Y)};if(J)this.set("stickIfOpen",!0),this.context.stickIfOpenTimeout.start(fY,()=>{this.set("stickIfOpen",!1)}),fE.flushSync(H);else H();if(Q||X)this.set("instantType",Q?"click":"dismiss");else if(Z.reason===K0.focusOut)this.set("instantType","focus");else this.set("instantType",void 0)};static useStore($,Z){let J=T5(()=>{return new u$(Z)}).current,Q=$??J;return T8(J.disposeEffect),Q}disposeEffect=()=>{return this.context.stickIfOpenTimeout.disposeEffect()}}var PQ=P(d(),1);function mE({props:$}){let{children:Z,open:J,defaultOpen:Q=!1,onOpenChange:X,onOpenChangeComplete:z,modal:G=!1,handle:H,triggerId:Y,defaultTriggerId:K=null}=$,W=u$.useStore(H?.store,{modal:G,open:Q,openProp:J,activeTriggerId:K,triggerIdProp:Y});n2(()=>{if(J===void 0&&W.state.open===!1&&Q===!0)W.update({open:!0,activeTriggerId:K})}),W.useControlledProp("openProp",J),W.useControlledProp("triggerIdProp",Y);let B=W.useState("open"),q=W.useState("positionerElement"),U=W.useState("payload"),F=W.useState("openChangeReason");W.useContextCallback("onOpenChange",X),W.useContextCallback("onOpenChangeComplete",z);let{openMethod:N,triggerProps:L,reset:V}=e7(B);p2(W);let{forceUnmount:M}=u2(B,W,()=>{W.update({stickIfOpen:!0,openChangeReason:null}),V()});s7(B&&G===!0&&F!==K0.triggerHover&&N!=="touch",q),$2.useEffect(()=>{if(!B)W.context.stickIfOpenTimeout.clear()},[W,B]);let _=$2.useCallback((T)=>{let R=D0(T);return R.preventUnmountOnClose=()=>{W.set("preventUnmountingOnClose",!0)},R},[W]),O=$2.useCallback(()=>{W.setOpen(!1,_(K0.imperativeAction))},[W,_]);$2.useImperativeHandle($.actionsRef,()=>({unmount:M,close:O}),[M,O]);let D=B2({popupStore:W,onOpenChange:W.setOpen}),A=W2(D,{outsidePressEvent:{mouse:G==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}}),E=D3(D),{getReferenceProps:I,getFloatingProps:y,getTriggerProps:C}=e1([A,E]),h=$2.useMemo(()=>{return I(L)},[I,L]),k=$2.useMemo(()=>{return C(L)},[C,L]),S=$2.useMemo(()=>{return y()},[y]);W.useSyncedValues({modal:G,openMethod:N,activeTriggerProps:h,inactiveTriggerProps:k,popupProps:S,floatingRootContext:D,nested:s1()!=null});let w=$2.useMemo(()=>({store:W}),[W]);return PQ.jsx(hF.Provider,{value:w,children:typeof Z==="function"?Z({payload:U}):Z})}function pE($){if(b1(!0))return PQ.jsx(mE,{props:$});return PQ.jsx(zJ,{children:PQ.jsx(mE,{props:$})})}var _2=P(v(),1),gF=P(G4(),1);var uE=300;var r3=P(d(),1),cE=_2.forwardRef(function(Z,J){let{render:Q,className:X,disabled:z=!1,nativeButton:G=!0,handle:H,payload:Y,openOnHover:K=!1,delay:W=uE,closeDelay:B=0,id:q,...U}=Z,F=b1(!0),N=H?.store??F?.store;if(!N)throw Error(C0(74));let L=s0(q),V=N.useState("isTriggerActive",L),M=N.useState("floatingRootContext"),_=N.useState("isOpenedByTrigger",L),O=_2.useRef(null),{registerTrigger:D,isMountedByThisTrigger:A}=m2(L,O,N,{payload:Y,disabled:z,openOnHover:K,closeDelay:B}),E=N.useState("openChangeReason"),I=N.useState("stickIfOpen"),y=N.useState("openMethod"),C=q2(M,{enabled:M!=null&&K&&(y!=="touch"||E!==K0.triggerPress),mouseOnly:!0,move:!1,handleClose:U2(),restMs:W,delay:{close:B},triggerElementRef:O,isActiveTrigger:V}),h=w9(M,{enabled:M!=null,stickIfOpen:I}),k=e1([h]),S=N.useState("triggerProps",A),w={disabled:z,open:_},{getButtonProps:T,buttonRef:R}=f1({disabled:z,native:G}),b=_2.useMemo(()=>({open(Q0){if(Q0&&E===K0.triggerPress)return VJ.open(Q0);return r2.open(Q0)}}),[E]),g=W0("button",Z,{state:w,ref:[R,J,D,O],props:[k.getReferenceProps(),C,S,{[v7]:"",id:L},U,T],stateAttributesMapping:b}),u=_2.useRef(null),j=U0((Q0)=>{gF.flushSync(()=>{N.setOpen(!1,D0(K0.focusOut,Q0.nativeEvent,Q0.currentTarget))}),Tz(u.current)?.focus()}),t=U0((Q0)=>{let x=N.select("positionerElement");if(x&&G2(Q0,x))N.context.beforeContentFocusGuardRef.current?.focus();else{gF.flushSync(()=>{N.setOpen(!1,D0(K0.focusOut,Q0.nativeEvent,Q0.currentTarget))});let e=jz(N.context.triggerFocusTargetRef.current||O.current);while(e!==null&&m0(x,e)){let M0=e;if(e=a9(e),e===M0)break}e?.focus()}});if(V)return r3.jsxs(_2.Fragment,{children:[r3.jsx(E8,{ref:u,onFocus:j}),r3.jsx(_2.Fragment,{children:g},L),r3.jsx(E8,{ref:N.context.triggerFocusTargetRef,onFocus:t})]});return r3.jsx(_2.Fragment,{children:g},L)});var lE=P(v(),1);var cY=P(v(),1),vF=cY.createContext(void 0);function dE(){let $=cY.useContext(vF);if($===void 0)throw Error(C0(45));return $}var fF=P(d(),1),iE=lE.forwardRef(function(Z,J){let{keepMounted:Q=!1,...X}=Z,{store:z}=b1();if(!(z.useState("mounted")||Q))return null;return fF.jsx(vF.Provider,{value:Q,children:fF.jsx(N3,{ref:J,...X})})});var I9=P(v(),1);var dY=P(v(),1),mF=dY.createContext(void 0);function c$(){let $=dY.useContext(mF);if(!$)throw Error(C0(46));return $}var wQ=P(d(),1),rE=I9.forwardRef(function(Z,J){let{render:Q,className:X,anchor:z,positionMethod:G="absolute",side:H="bottom",align:Y="center",sideOffset:K=0,alignOffset:W=0,collisionBoundary:B="clipping-ancestors",collisionPadding:q=5,arrowPadding:U=5,sticky:F=!1,disableAnchorTracking:N=!1,collisionAvoidance:L=a2,...V}=Z,{store:M}=b1(),_=dE(),O=q3(),D=M.useState("floatingRootContext"),A=M.useState("mounted"),E=M.useState("open"),I=M.useState("openChangeReason"),y=M.useState("activeTriggerElement"),C=M.useState("modal"),h=M.useState("positionerElement"),k=M.useState("instantType"),S=M.useState("transitionStatus"),w=M.useState("hasViewport"),T=I9.useRef(null),R=v2(h,!1,!1),b=i2({anchor:z,floatingRootContext:D,positionMethod:G,mounted:A,side:H,sideOffset:K,align:Y,alignOffset:W,arrowPadding:U,collisionBoundary:B,collisionPadding:q,sticky:F,disableAnchorTracking:N,keepMounted:_,nodeId:O,collisionAvoidance:L,adaptiveOrigin:w?u7:void 0}),g=I9.useMemo(()=>{let e={};if(!E)e.pointerEvents="none";return{role:"presentation",hidden:!A,style:{...b.positionerStyles,...e}}},[E,A,b.positionerStyles]),u=I9.useMemo(()=>({props:g,...b}),[g,b]),j=D.useState("domReferenceElement");q0(()=>{let e=j,M0=T.current;if(e)T.current=e;if(M0&&e&&e!==M0){M.set("instantType",void 0);let l=new AbortController;return R(()=>{M.set("instantType","trigger-change")},l.signal),()=>{l.abort()}}return},[j,R,M]);let t={open:E,side:u.side,align:u.align,anchorHidden:u.anchorHidden,instant:k},Q0=I9.useCallback((e)=>{M.set("positionerElement",e)},[M]),x=W0("div",Z,{state:t,props:[u.props,K8(S),V],ref:[J,Q0],stateAttributesMapping:N5});return wQ.jsxs(mF.Provider,{value:u,children:[A&&C===!0&&I!==K0.triggerHover&&wQ.jsx(o7,{ref:M.context.internalBackdropRef,inert:x2(!E),cutout:y}),wQ.jsx(XJ,{id:O,children:x})]})});var lY=P(v(),1);var aE=P(d(),1),Cs={...N5,...m5},nE=lY.forwardRef(function(Z,J){let{className:Q,render:X,initialFocus:z,finalFocus:G,...H}=Z,{store:Y}=b1(),K=c$(),W=OY(!0)!=null,B=Y.useState("open"),q=Y.useState("openMethod"),U=Y.useState("instantType"),F=Y.useState("transitionStatus"),N=Y.useState("popupProps"),L=Y.useState("titleElementId"),V=Y.useState("descriptionElementId"),M=Y.useState("modal"),_=Y.useState("mounted"),O=Y.useState("openChangeReason"),D=Y.useState("activeTriggerElement"),A=Y.useState("floatingRootContext");I1({open:B,ref:Y.context.popupRef,onComplete(){if(B)Y.context.onOpenChangeComplete?.(!0)}});let E=Y.useState("disabled"),I=Y.useState("openOnHover"),y=Y.useState("closeDelay");j9(A,{enabled:I&&!E,closeDelay:y});function C(T){if(T==="touch")return Y.context.popupRef.current;return!0}let h=z===void 0?C:z,k={open:B,side:K.side,align:K.align,instant:U,transitionStatus:F},S=lY.useCallback((T)=>{Y.set("popupElement",T)},[Y]),w=W0("div",Z,{state:k,ref:[J,Y.context.popupRef,S],props:[N,{"aria-labelledby":L,"aria-describedby":V,onKeyDown(T){if(W&&J6.has(T.key))T.stopPropagation()}},K8(F),H],stateAttributesMapping:Cs});return aE.jsx(V3,{context:A,openInteractionType:q,modal:M==="trap-focus",disabled:!_||O===K0.triggerHover,initialFocus:h,returnFocus:G,restoreFocus:"popup",previousFocusableElement:L1(D)?D:void 0,nextFocusableElement:Y.context.triggerFocusTargetRef,beforeContentFocusGuardRef:Y.context.beforeContentFocusGuardRef,children:w})});var oE=P(v(),1);var sE=oE.forwardRef(function(Z,J){let{className:Q,render:X,...z}=Z,{store:G}=b1(),H=G.useState("open"),{arrowRef:Y,side:K,align:W,arrowUncentered:B,arrowStyles:q}=c$();return W0("div",Z,{state:{open:H,side:K,align:W,uncentered:B},ref:[J,Y],props:[{style:q,"aria-hidden":!0},z],stateAttributesMapping:N5})});var tE=P(v(),1);var Es={...N5,...m5},eE=tE.forwardRef(function(Z,J){let{className:Q,render:X,...z}=Z,{store:G}=b1(),H=G.useState("open"),Y=G.useState("mounted"),K=G.useState("transitionStatus"),W=G.useState("openChangeReason");return W0("div",Z,{state:{open:H,transitionStatus:K},ref:[G.context.backdropRef,J],props:[{role:"presentation",hidden:!Y,style:{pointerEvents:W===K0.triggerHover?"none":void 0,userSelect:"none",WebkitUserSelect:"none"}},z],stateAttributesMapping:Es})});var $S=P(v(),1);var ZS=$S.forwardRef(function(Z,J){let{render:Q,className:X,...z}=Z,{store:G}=b1(),H=s0(z.id);return q0(()=>{return G.set("titleElementId",H),()=>{G.set("titleElementId",void 0)}},[G,H]),W0("h2",Z,{ref:J,props:[{id:H},z]})});var JS=P(v(),1);var QS=JS.forwardRef(function(Z,J){let{render:Q,className:X,...z}=Z,{store:G}=b1(),H=s0(z.id);return q0(()=>{return G.set("descriptionElementId",H),()=>{G.set("descriptionElementId",void 0)}},[G,H]),W0("p",Z,{ref:J,props:[{id:H},z]})});var XS=P(v(),1);var zS=XS.forwardRef(function(Z,J){let{render:Q,className:X,disabled:z=!1,nativeButton:G=!0,...H}=Z,{buttonRef:Y,getButtonProps:K}=f1({disabled:z,focusableWhenDisabled:!1,native:G}),{store:W}=b1();return W0("button",Z,{ref:[J,Y],props:[{onClick(q){W.setOpen(!1,D0(K0.closePress,q.nativeEvent,q.currentTarget))}},H,K]})});var HS=P(v(),1);var GS=function($){return $.popupWidth="--popup-width",$.popupHeight="--popup-height",$}({});var Ss={activationDirection:($)=>$?{"data-activation-direction":$}:null},YS=HS.forwardRef(function(Z,J){let{render:Q,className:X,children:z,...G}=Z,{store:H}=b1(),{side:Y}=c$(),K=H.useState("instantType"),{children:W,state:B}=r7({store:H,side:Y,cssVars:GS,children:z}),q={activationDirection:B.activationDirection,transitioning:B.transitioning,instant:K};return W0("div",Z,{state:q,ref:J,props:[G,{children:W}],stateAttributesMapping:Ss})});class iY{constructor(){this.store=new u$}open($){let Z=$?this.store.context.triggerElements.getById($)??void 0:void 0;if($&&!Z)throw Error(C0(80,$));this.store.setOpen(!0,D0(K0.imperativeAction,void 0,Z))}close(){this.store.setOpen(!1,D0(K0.imperativeAction,void 0,void 0))}get isOpen(){return this.store.state.open}}function KS(){return new iY}var a3=P(d(),1);function rY({...$}){return a3.jsx(S6.Root,{"data-slot":"popover",...$})}function aY({...$}){return a3.jsx(S6.Trigger,{"data-slot":"popover-trigger",...$})}function nY({className:$,align:Z="center",alignOffset:J=0,disableAnchorTracking:Q=!1,positionMethod:X="absolute",side:z="bottom",sideOffset:G=4,keepMounted:H=!1,container:Y,...K}){return a3.jsx(S6.Portal,{keepMounted:H,container:Y,children:a3.jsx(S6.Positioner,{align:Z,alignOffset:J,disableAnchorTracking:Q,positionMethod:X,side:z,sideOffset:G,className:"isolate z-50",children:a3.jsx(S6.Popup,{"data-slot":"popover-content",className:s("z-50 flex w-72 origin-(--transform-origin) flex-col gap-3 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",$),...K})})})}function WS({className:$,...Z}){return a3.jsx("div",{"data-slot":"popover-header",className:s("flex flex-col gap-0.5 text-sm",$),...Z})}var GK=P(v(),1);var k6={};_4(k6,{Value:()=>NS,Track:()=>AS,Thumb:()=>jS,Root:()=>US,Indicator:()=>TS,Control:()=>LS});var x1=P(v(),1);var BS=P(v(),1);function oY($,Z){let J=BS.useRef($),Q=U0(Z);q0(()=>{if(J.current===$)return;Q(J.current)},[$,Q]),q0(()=>{J.current=$},[$])}function g8($,Z=Number.MIN_SAFE_INTEGER,J=Number.MAX_SAFE_INTEGER){return Math.max(Z,Math.min($,J))}function pF($,Z,J=(Q,X)=>Q===X){return $.length===Z.length&&$.every((Q,X)=>J(Q,Z[X]))}function sY($,Z){return $-Z}function qS($,Z,J){let Q=$.slice();return Q[Z]=J,Q.sort(sY)}function tY($,Z,J,Q,X,z){let G=$;if(G=g8(G,J,Q),X)G=qS(z,Z,g8(G,z[Z-1]||-1/0,z[Z+1]||1/0));return G}function eY($,Z,J){if(!Array.isArray($))return!0;let Q=$.reduce((X,z,G,H)=>{if(G===H.length-1)return X;return X.push(Math.abs(z-H[G+1])),X},[]);return Math.min(...Q)>=Z*J}var Z2={activeThumbIndex:()=>null,max:()=>null,min:()=>null,minStepsBetweenValues:()=>null,step:()=>null,values:()=>null,...y8};var $K=P(v(),1),uF=$K.createContext(void 0);function H9(){let $=$K.useContext(uF);if($===void 0)throw Error(C0(62));return $}var cF=P(d(),1);function ks($){return"key"in $?K0.keyboard:K0.inputChange}function Is($,Z){if(typeof $==="number"&&typeof Z==="number")return $===Z;if(Array.isArray($)&&Array.isArray(Z))return pF($,Z);return!1}var US=x1.forwardRef(function(Z,J){let{"aria-labelledby":Q,className:X,defaultValue:z,disabled:G=!1,id:H,format:Y,largeStep:K=10,locale:W,render:B,max:q=100,min:U=0,minStepsBetweenValues:F=0,name:N,onValueChange:L,onValueCommitted:V,orientation:M="horizontal",step:_=1,thumbCollisionBehavior:O="push",thumbAlignment:D="center",value:A,...E}=Z,I=s0(H),y=U0(L),C=U0(V),{clearErrors:h}=i4(),{state:k,disabled:S,name:w,setTouched:T,setDirty:R,validityData:b,shouldValidateOnChange:g,validation:u}=R1(),{labelId:j}=B8(),t=Q??j,Q0=S||G,x=w??N,[e,M0]=r4({controlled:A,default:z??U,name:"Slider"}),l=x1.useRef(null),H0=x1.useRef(null),B0=x1.useRef([]),X0=x1.useRef(null),Y0=x1.useRef(null),V0=x1.useRef(-1),i=x1.useRef(null),$0=x1.useRef(null),Z0=x1.useRef("none"),J0=w1(Y),[n,m]=x1.useState(-1),[c,f]=x1.useState(-1),[a,o]=x1.useState(!1),[N0,j0]=x1.useState(()=>new Map),[h0,u0]=x1.useState([void 0,void 0]),p=U0((R0)=>{if(m(R0),R0!==-1)f(R0)});Q$({id:I,commit:u.commit,value:e,controlRef:H0,name:x,getValue:()=>e}),oY(e,()=>{if(h(x),g())u.commit(e);else u.commit(e,!0);let R0=b.initialValue,G0;if(Array.isArray(e)&&Array.isArray(R0))G0=!pF(e,R0);else G0=e!==R0;R(G0)});let r=U0((R0)=>{if(R0)H0.current=R0}),z0=Array.isArray(e),L0=x1.useMemo(()=>{if(!z0)return[g8(e,U,q)];return e.slice().sort(sY)},[q,U,z0,e]),P0=U0((R0,G0)=>{if(Number.isNaN(R0)||Is(R0,e))return;let A0=G0??D0(K0.none,void 0,void 0,{activeThumbIndex:-1});Z0.current=A0.reason;let v0=A0.event,K5=new(v0.constructor??Event)(v0.type,v0);if(Object.defineProperty(K5,"target",{writable:!0,value:{value:R0,name:x}}),A0.event=K5,$0.current=R0,y(R0,A0),A0.isCanceled)return;M0(R0)}),g0=U0((R0,G0,A0)=>{let v0=tY(R0,G0,U,q,z0,L0);if(eY(v0,_,F)){let D5=ks(A0);P0(v0,D0(D5,A0.nativeEvent,void 0,{activeThumbIndex:G0})),T(!0);let K5=$0.current??v0;C(K5,bz(D5,A0.nativeEvent))}});if(q0(()=>{let R0=r5(p0(l.current));if(Q0&&R0&&l.current?.contains(R0))R0.blur()},[Q0]),Q0&&n!==-1)p(-1);let e0=x1.useMemo(()=>({...k,activeThumbIndex:n,disabled:Q0,dragging:a,orientation:M,max:q,min:U,minStepsBetweenValues:F,step:_,values:L0}),[k,n,Q0,a,q,U,F,M,_,L0]),U5=x1.useMemo(()=>({active:n,controlRef:H0,disabled:Q0,dragging:a,validation:u,formatOptionsRef:J0,handleInputChange:g0,indicatorPosition:h0,inset:D!=="center",labelId:t,largeStep:K,lastUsedThumbIndex:c,lastChangedValueRef:$0,lastChangeReasonRef:Z0,locale:W,max:q,min:U,minStepsBetweenValues:F,name:x,onValueCommitted:C,orientation:M,pressedInputRef:X0,pressedThumbCenterOffsetRef:Y0,pressedThumbIndexRef:V0,pressedValuesRef:i,registerFieldControlRef:r,renderBeforeHydration:D==="edge",setActive:p,setDragging:o,setIndicatorPosition:u0,setValue:P0,state:e0,step:_,thumbCollisionBehavior:O,thumbMap:N0,thumbRefs:B0,values:L0}),[n,H0,t,Q0,a,u,J0,g0,h0,K,c,$0,Z0,W,q,U,F,x,C,M,X0,Y0,V0,i,r,p,o,u0,P0,e0,_,O,D,N0,B0,L0]),d0=W0("div",Z,{state:e0,ref:[J,l],props:[{"aria-labelledby":t,id:I,role:"group"},u.getValidationProps,E],stateAttributesMapping:Z2});return cF.jsx(uF.Provider,{value:U5,children:cF.jsx(jY,{elementsRef:B0,onMapChange:j0,children:d0})})});var d$=P(v(),1);var FS=new Map;function Rs($,Z){let J=JSON.stringify({locale:$,options:Z}),Q=FS.get(J);if(Q)return Q;let X=new Intl.NumberFormat($,Z);return FS.set(J,X),X}function n3($,Z,J){if($==null)return"";return Rs(Z,J).format($)}var NS=d$.forwardRef(function(Z,J){let{"aria-live":Q="off",render:X,className:z,children:G,...H}=Z,{thumbMap:Y,state:K,values:W,formatOptionsRef:B,locale:q}=H9(),U=d$.useMemo(()=>{let V="";for(let M of Y.values())if(M?.inputId)V+=`${M.inputId} `;return V.trim()===""?void 0:V.trim()},[Y]),F=d$.useMemo(()=>{let V=[];for(let M=0;M<W.length;M+=1)V.push(n3(W[M],q,B.current??void 0));return V},[B,q,W]),N=d$.useMemo(()=>{let V=[];for(let M=0;M<W.length;M+=1)V.push(F[M]||W[M]);return V.join(" – ")},[W,F]);return W0("output",Z,{state:K,ref:J,props:[{"aria-live":Q,children:typeof G==="function"?G(F,W):N,htmlFor:U},H],stateAttributesMapping:Z2})});var D2=P(v(),1);function ZK($){let Z=$.getBoundingClientRect();return{x:(Z.left+Z.right)/2,y:(Z.top+Z.bottom)/2}}function ys($){if(Math.abs($)<1){let J=$.toExponential().split("e-"),Q=J[0].split(".")[1];return(Q?Q.length:0)+parseInt(J[1],10)}let Z=$.toString().split(".")[1];return Z?Z.length:0}function JK($,Z,J){let Q=Math.round(($-J)/Z)*Z+J;return Number(Q.toFixed(ys(Z)))}function dF({values:$,index:Z,nextValue:J,min:Q,max:X,step:z,minStepsBetweenValues:G,initialValues:H}){if($.length===0)return[];let Y=$.slice(),K=z*G,W=Y.length-1,B=H??$,q=Q+Z*K,U=X-(W-Z)*K;Y[Z]=g8(J,q,U);for(let F=Z+1;F<=W;F+=1){let N=Y[F-1]+K,L=X-(W-F)*K,V=B[F]??Y[F],M=Math.max(Y[F],N);if(V<M)M=Math.max(V,N);Y[F]=g8(M,N,L)}for(let F=Z-1;F>=0;F-=1){let N=Y[F+1]-K,L=Q+F*K,V=B[F]??Y[F],M=Math.min(Y[F],N);if(V>M)M=Math.min(V,N);Y[F]=g8(M,L,N)}for(let F=0;F<=W;F+=1)Y[F]=Number(Y[F].toFixed(12));return Y}function VS({behavior:$,values:Z,currentValues:J,initialValues:Q,pressedIndex:X,nextValue:z,min:G,max:H,step:Y,minStepsBetweenValues:K}){let W=J??Z,B=Q??Z;if(!(W.length>1))return{value:z,thumbIndex:0,didSwap:!1};let U=Y*K;switch($){case"swap":{let F=W[X],N=0.0000001,L=W.slice(),V=L[X-1],M=L[X+1],_=V!=null?V+U:G,O=M!=null?M-U:H,D=g8(z,_,O),A=Number(D.toFixed(12));L[X]=A;let E=z>F,I=z<F,y=E&&M!=null&&z>=M-0.0000001,C=I&&V!=null&&z<=V+0.0000001;if(!y&&!C)return{value:L,thumbIndex:X,didSwap:!1};let h=y?X+1:X-1,k=L.map((R,b)=>{if(b===X)return A;let g=B[b];if(g!=null)return g;return W[b]}),S=z;if(y)S=Math.max(z,L[h]);else S=Math.min(z,L[h]);let w=dF({values:L,index:h,nextValue:S,min:G,max:H,step:Y,minStepsBetweenValues:K,initialValues:k}),T=y?h-1:h+1;if(T>=0&&T<w.length){let R=w[T-1],b=w[T+1],g=R!=null?R+U:G;g=Math.max(g,G+T*U);let u=b!=null?b-U:H;u=Math.min(u,H-(w.length-1-T)*U);let j=g8(A,g,u);w[T]=Number(j.toFixed(12))}return{value:w,thumbIndex:h,didSwap:!0}}case"push":return{value:dF({values:W,index:X,nextValue:z,min:G,max:H,step:Y,minStepsBetweenValues:K}),thumbIndex:X,didSwap:!1};case"none":default:{let F=W.slice(),N=F[X-1],L=F[X+1],V=N!=null?N+U:G,M=L!=null?L-U:H,_=g8(z,V,M);return F[X]=Number(_.toFixed(12)),{value:F,thumbIndex:X,didSwap:!1}}}}var bs=2;function xs($,Z){if(!$)return{start:0,end:0};function J(z){let G=z!=null?parseFloat(z):0;return Number.isNaN(G)?0:G}let Q=!Z?"InlineStart":"Top",X=!Z?"InlineEnd":"Bottom";return{start:J($[`border${Q}Width`])+J($[`padding${Q}`]),end:J($[`border${X}Width`])+J($[`padding${X}`])}}function QK($,Z){if(Z.current!=null&&$.changedTouches){let J=$;for(let Q=0;Q<J.changedTouches.length;Q+=1){let X=J.changedTouches[Q];if(X.identifier===Z.current)return{x:X.clientX,y:X.clientY}}return null}return{x:$.clientX,y:$.clientY}}var LS=D2.forwardRef(function(Z,J){let{render:Q,className:X,...z}=Z,{disabled:G,dragging:H,validation:Y,inset:K,lastChangedValueRef:W,lastChangeReasonRef:B,max:q,min:U,minStepsBetweenValues:F,onValueCommitted:N,orientation:L,pressedInputRef:V,pressedThumbCenterOffsetRef:M,pressedThumbIndexRef:_,pressedValuesRef:O,registerFieldControlRef:D,renderBeforeHydration:A,setActive:E,setDragging:I,setValue:y,state:C,step:h,thumbCollisionBehavior:k,thumbRefs:S,values:w}=H9(),T=u4(),R=w.length>1,b=L==="vertical",g=D2.useRef(null),u=D2.useRef(null),j=U0((J0)=>{if(J0&&u.current==null){if(u.current==null)u.current=getComputedStyle(J0)}}),t=D2.useRef(null),Q0=D2.useRef(0),x=D2.useRef(0),e=w1(w),M0=U0((J0)=>{if(_.current!==J0)_.current=J0;let n=S.current[J0];if(!n){M.current=null,V.current=null;return}V.current=n.querySelector('input[type="range"]')}),l=U0((J0)=>{let n=g.current;if(!n)return null;let{width:m,height:c,bottom:f,left:a,right:o}=n.getBoundingClientRect(),N0=xs(u.current,b),j0=x.current,h0=(b?c:m)-N0.start-N0.end-j0*2,u0=M.current??0,p=J0.x-u0,r=J0.y-u0,z0=b?f-r-N0.end:(T==="rtl"?o-p:p-a)-N0.start,L0=g8((z0-j0)/h0,0,1),P0=(q-U)*L0+U;if(P0=JK(P0,h,U),P0=g8(P0,U,q),!R)return{value:P0,thumbIndex:0,didSwap:!1};let g0=_.current;if(g0<0)return null;let e0=VS({behavior:k,values:w,currentValues:e.current??w,initialValues:O.current,pressedIndex:g0,nextValue:P0,min:U,max:q,step:h,minStepsBetweenValues:F});if(k==="swap"&&e0.didSwap)M0(e0.thumbIndex);else _.current=e0.thumbIndex;return e0}),H0=U0((J0)=>{O.current=R?w.slice():null,e.current=w;let n=_.current,m=n;if(n>-1&&n<w.length){if(w[n]===q){let c=n;while(c>0&&w[c-1]===q)c-=1;m=c}}else{let c=!b?"x":"y",f;m=-1;for(let a=0;a<S.current.length;a+=1){let o=S.current[a];if(_5(o)){let N0=ZK(o),j0=Math.abs(J0[c]-N0[c]);if(f===void 0||j0<=f)m=a,f=j0}}}if(m>-1&&m!==n)M0(m);if(K){let c=S.current[m];if(_5(c)){let f=c.getBoundingClientRect(),a=!b?"width":"height";x.current=f[a]/2}}}),B0=U0((J0)=>{S.current?.[J0]?.querySelector('input[type="range"]')?.focus({preventScroll:!0})}),X0=U0((J0)=>{let n=QK(J0,t);if(n==null)return;if(Q0.current+=1,J0.type==="pointermove"&&J0.buttons===0){Y0(J0);return}let m=l(n);if(m==null)return;if(eY(m.value,h,F)){if(!H&&Q0.current>bs)I(!0);if(y(m.value,D0(K0.drag,J0,void 0,{activeThumbIndex:m.thumbIndex})),e.current=Array.isArray(m.value)?m.value:[m.value],m.didSwap)B0(m.thumbIndex)}});function Y0(J0){E(-1),I(!1),V.current=null,M.current=null;let n=QK(J0,t),m=n!=null?l(n):null;if(m!=null){let c=B.current;Y.commit(W.current??m.value),N(W.current??m.value,bz(c,J0))}if("pointerType"in J0&&g.current?.hasPointerCapture(J0.pointerId))g.current?.releasePointerCapture(J0.pointerId);_.current=-1,t.current=null,O.current=null,i()}let V0=U0((J0)=>{if(G)return;let n=J0.changedTouches[0];if(n!=null)t.current=n.identifier;let m=QK(J0,t);if(m!=null){H0(m);let f=l(m);if(f==null)return;if(B0(f.thumbIndex),y(f.value,D0(K0.trackPress,J0,void 0,{activeThumbIndex:f.thumbIndex})),e.current=Array.isArray(f.value)?f.value:[f.value],f.didSwap)B0(f.thumbIndex)}Q0.current=0;let c=p0(g.current);c.addEventListener("touchmove",X0,{passive:!0}),c.addEventListener("touchend",Y0,{passive:!0})}),i=U0(()=>{let J0=p0(g.current);J0.removeEventListener("pointermove",X0),J0.removeEventListener("pointerup",Y0),J0.removeEventListener("touchmove",X0),J0.removeEventListener("touchend",Y0),O.current=null}),$0=z4();return D2.useEffect(()=>{let J0=g.current;if(!J0)return()=>i();return J0.addEventListener("touchstart",V0,{passive:!0}),()=>{J0.removeEventListener("touchstart",V0),$0.cancel(),i()}},[i,V0,g,$0]),D2.useEffect(()=>{if(G)i()},[G,i]),W0("div",Z,{state:C,ref:[J,D,g,j],props:[{["data-base-ui-slider-control"]:A?"":void 0,onPointerDown(J0){let n=g.current;if(!n||G||J0.defaultPrevented||!_5(J0.target)||J0.button!==0)return;let m=QK(J0,t);if(m!=null){H0(m);let f=l(m);if(f==null)return;if(m0(S.current[f.thumbIndex],r5(p0(n))))J0.preventDefault();else $0.request(()=>{B0(f.thumbIndex)});if(I(!0),M.current==null){if(y(f.value,D0(K0.trackPress,J0.nativeEvent,void 0,{activeThumbIndex:f.thumbIndex})),e.current=Array.isArray(f.value)?f.value:[f.value],f.didSwap)B0(f.thumbIndex)}}if(J0.nativeEvent.pointerId)n.setPointerCapture(J0.nativeEvent.pointerId);Q0.current=0;let c=p0(g.current);c.addEventListener("pointermove",X0,{passive:!0}),c.addEventListener("pointerup",Y0,{once:!0})},tabIndex:-1},z],stateAttributesMapping:Z2})});var MS=P(v(),1);var AS=MS.forwardRef(function(Z,J){let{render:Q,className:X,...z}=Z,{state:G}=H9();return W0("div",Z,{state:G,ref:J,props:[{style:{position:"relative"}},z],stateAttributesMapping:Z2})});var N4=P(v(),1);function jQ($,Z,J){return($-Z)*100/(J-Z)}var XK=P(v(),1),hs=XK.createContext(void 0),gs={disableStyleElements:!1};function _S(){return XK.useContext(hs)??gs}var DS=function($){return $.index="data-index",$.dragging="data-dragging",$.orientation="data-orientation",$.disabled="data-disabled",$.valid="data-valid",$.invalid="data-invalid",$.touched="data-touched",$.dirty="data-dirty",$.focused="data-focused",$}({});var OS='!function(){const t=document.currentScript?.parentElement;if(!t)return;const e=t.closest("[data-base-ui-slider-control]");if(!e)return;const r=e.querySelector("[data-base-ui-slider-indicator]"),i=e.getBoundingClientRect(),n="vertical"===e.getAttribute("data-orientation")?"height":"width",o=e.querySelectorAll(\'input[type="range"]\'),l=o.length>1,s=o.length-1;let a=null,u=null;for(let t=0;t<o.length;t+=1){const e=o[t],y=parseFloat(e.getAttribute("value")??"");if(Number.isNaN(y))return;const c=e.parentElement;if(!c)return;const p=parseFloat(e.getAttribute("max")??"100"),g=parseFloat(e.getAttribute("min")??"0"),b=c?.getBoundingClientRect(),d=i[n]-b[n],m=100*(y-g)/(p-g),v=(b[n]/2+d*m/100)/i[n]*100;c.style.setProperty("--position",`${v}%`),Number.isFinite(v)&&(c.style.removeProperty("visibility"),r&&(0===t?(a=v,r.style.setProperty("--start-position",`${v}%`),l||r.style.removeProperty("visibility")):t===s&&(u=v-(a??0),r.style.setProperty("--end-position",`${v}%`),r.style.setProperty("--relative-size",`${u}%`),r.style.removeProperty("visibility"))))}}();';var TQ=P(d(),1),PS="PageUp",wS="PageDown",vs=new Set([PJ,wJ,jJ,TJ,CJ,EJ,PS,wS]);function fs($,Z,J,Q){if(Z<0)return;if($.length===2){if(Z===0)return`${n3($[Z],Q,J)} start range`;return`${n3($[Z],Q,J)} end range`}return J?n3($[Z],Q,J):void 0}function l$($,Z,J,Q,X){return J===1?Math.min($+Z,X):Math.max($-Z,Q)}var jS=N4.forwardRef(function(Z,J){let{render:Q,children:X,className:z,"aria-describedby":G,"aria-label":H,"aria-labelledby":Y,disabled:K=!1,getAriaLabel:W,getAriaValueText:B,id:q,index:U,inputRef:F,onBlur:N,onFocus:L,onKeyDown:V,tabIndex:M,..._}=Z,{nonce:O}=_S(),D=s0(q),{active:A,lastUsedThumbIndex:E,controlRef:I,disabled:y,validation:C,formatOptionsRef:h,handleInputChange:k,inset:S,labelId:w,largeStep:T,locale:R,max:b,min:g,minStepsBetweenValues:u,name:j,orientation:t,pressedInputRef:Q0,pressedThumbCenterOffsetRef:x,pressedThumbIndexRef:e,renderBeforeHydration:M0,setActive:l,setIndicatorPosition:H0,state:B0,step:X0,values:Y0}=H9(),V0=u4(),i=K||y,$0=Y0.length>1,Z0=t==="vertical",J0=V0==="rtl",{setTouched:n,setFocused:m,validationMode:c}=R1(),f=N4.useRef(null),a=N4.useRef(null),o=s0(),N0=J$(),j0=$0?o:N0,h0=N4.useMemo(()=>({inputId:j0}),[j0]),{ref:u0,index:p}=F4({metadata:h0}),r=!$0?0:U??p,z0=r===Y0.length-1,L0=Y0[r],P0=jQ(L0,g,b),[g0,e0]=N4.useState(!1),[U5,d0]=N4.useState();T8(()=>e0(!0));let R0=E>=0&&E<Y0.length?E:-1,G0=U0(()=>{let I0=I.current,T0=f.current;if(!I0||!T0)return;let f0=T0.getBoundingClientRect(),$5=I0.getBoundingClientRect(),H5=Z0?"height":"width",S5=$5[H5]-f0[H5],i5=(f0[H5]/2+S5*P0/100)/$5[H5]*100;if(d0(i5),r===0)H0((F5)=>[i5,F5[1]]);else if(z0)H0((F5)=>[F5[0],i5])});q0(()=>{if(S)queueMicrotask(G0)},[G0,S]),q0(()=>{if(S)G0()},[G0,S,P0]);let A0=N4.useCallback(()=>{let I0=Z0?"bottom":"insetInlineStart",T0=Z0?"left":"top",f0;if($0){if(A===r)f0=2;else if(R0===r)f0=1}else if(A===r)f0=1;if(!S){if(!Number.isFinite(P0))return H2;return{position:"absolute",[I0]:`${P0}%`,[T0]:"50%",translate:`${(Z0||!J0?-1:1)*50}% ${(Z0?1:-1)*50}%`,zIndex:f0}}return{["--position"]:`${U5}%`,visibility:M0&&!g0||U5===void 0?"hidden":void 0,position:"absolute",[I0]:"var(--position)",[T0]:"50%",translate:`${(Z0||!J0?-1:1)*50}% ${(Z0?1:-1)*50}%`,zIndex:f0}},[A,r,S,g0,U5,$0,M0,J0,R0,P0,Z0]),v0;if(t==="vertical")v0=J0?"vertical-rl":"vertical-lr";let D5=Y4({"aria-label":typeof W==="function"?W(r):H,"aria-labelledby":Y??w,"aria-describedby":G,"aria-orientation":t,"aria-valuenow":L0,"aria-valuetext":typeof B==="function"?B(n3(L0,R,h.current??void 0),L0,r):fs(Y0,r,h.current??void 0,R),disabled:i,id:j0,max:b,min:g,name:j,onChange(I0){k(I0.target.valueAsNumber,r,I0)},onFocus(){l(r),m(!0)},onBlur(){if(!f.current)return;if(l(-1),n(!0),m(!1),c==="onBlur")C.commit(tY(L0,r,g,b,$0,Y0))},onKeyDown(I0){if(!vs.has(I0.key))return;if(J6.has(I0.key))I0.stopPropagation();let T0=null,f0=JK(L0,X0,g);switch(I0.key){case PJ:T0=l$(f0,I0.shiftKey?T:X0,1,g,b);break;case TJ:T0=l$(f0,I0.shiftKey?T:X0,J0?-1:1,g,b);break;case wJ:T0=l$(f0,I0.shiftKey?T:X0,-1,g,b);break;case jJ:T0=l$(f0,I0.shiftKey?T:X0,J0?1:-1,g,b);break;case PS:T0=l$(f0,T,1,g,b);break;case wS:T0=l$(f0,T,-1,g,b);break;case EJ:if(T0=b,$0)T0=Number.isFinite(Y0[r+1])?Y0[r+1]-X0*u:b;break;case CJ:if(T0=g,$0)T0=Number.isFinite(Y0[r-1])?Y0[r-1]+X0*u:g;break;default:break}if(T0!==null)k(T0,r,I0),I0.preventDefault()},step:X0,style:{...H2,width:"100%",height:"100%",writingMode:v0},tabIndex:M??void 0,type:"range",value:L0??""},C.getInputValidationProps),K5=O4(a,C.inputRef,F);return W0("div",Z,{state:B0,ref:[J,u0,f],props:[{[DS.index]:r,children:TQ.jsxs(N4.Fragment,{children:[X,TQ.jsx("input",{ref:K5,...D5}),S&&!g0&&M0&&z0&&TQ.jsx("script",{nonce:O,dangerouslySetInnerHTML:{__html:OS},suppressHydrationWarning:!0})]}),id:D,onBlur:N,onFocus:L,onPointerDown(I0){if(e.current=r,f.current!=null){let T0=t==="horizontal"?"x":"y",f0=ZK(f.current),$5=(t==="horizontal"?I0.clientX:I0.clientY)-f0[T0];x.current=$5}if(a.current!=null&&Q0.current!==a.current)Q0.current=a.current},style:A0(),suppressHydrationWarning:M0||void 0,tabIndex:-1},_],stateAttributesMapping:Z2})});var zK=P(v(),1);function ms($,Z,J,Q,X,z){let G=J===void 0||Z&&Q===void 0?"hidden":void 0,H=$?"bottom":"insetInlineStart",Y=$?"height":"width",W={visibility:X&&!z?"hidden":G,position:$?"absolute":"relative",[$?"width":"height"]:"inherit"};if(W["--start-position"]=`${J??0}%`,!Z)return W[H]=0,W[Y]="var(--start-position)",W;return W["--relative-size"]=`${(Q??0)-(J??0)}%`,W[H]="var(--start-position)",W[Y]="var(--relative-size)",W}function ps($,Z,J,Q){let X=$?"bottom":"insetInlineStart",z=$?"height":"width",H={position:$?"absolute":"relative",[$?"width":"height"]:"inherit"};if(!Z)return H[X]=0,H[z]=`${J}%`,H;let Y=Q-J;return H[X]=`${J}%`,H[z]=`${Y}%`,H}var TS=zK.forwardRef(function(Z,J){let{render:Q,className:X,...z}=Z,{indicatorPosition:G,inset:H,max:Y,min:K,orientation:W,renderBeforeHydration:B,state:q,values:U}=H9(),[F,N]=zK.useState(!1);T8(()=>N(!0));let L=W==="vertical",V=U.length>1,M=H?ms(L,V,G[0],G[1],B,F):ps(L,V,jQ(U[0],K,Y),jQ(U[U.length-1],K,Y));return W0("div",Z,{state:q,ref:J,props:[{["data-base-ui-slider-indicator"]:B?"":void 0,style:M,suppressHydrationWarning:B||void 0},z],stateAttributesMapping:Z2})});var o3=P(d(),1);function CS({children:$,className:Z,defaultValue:J,value:Q,min:X=0,max:z=100,...G}){let[H,Y]=GK.useState(!1),K=Array.isArray(Q)?Q:Array.isArray(J)?J:[X,z];return GK.useEffect(()=>{let W=requestAnimationFrame(()=>Y(!0));return()=>cancelAnimationFrame(W)},[]),o3.jsx(k6.Root,{className:s("data-horizontal:w-full data-vertical:h-full",Z),"data-slot":"slider",defaultValue:J,value:Q,min:X,max:z,thumbAlignment:"edge",...G,children:o3.jsxs(k6.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:[o3.jsx(k6.Track,{"data-slot":"slider-track",className:"relative grow overflow-hidden rounded-full bg-muted select-none data-horizontal:h-1 data-horizontal:w-full data-vertical:h-full data-vertical:w-1",children:o3.jsx(k6.Indicator,{"data-slot":"slider-range",className:s("bg-primary select-none data-horizontal:h-full data-vertical:w-full",H&&"transition-[width] duration-150 ease-in-out")})}),$,Array.from({length:K.length},(W,B)=>o3.jsx(k6.Thumb,{"data-slot":"slider-thumb",className:s("relative block size-3 shrink-0 cursor-ew-resize rounded-full border border-ring bg-white 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",H&&"transition-[inset-inline-start,color,box-shadow] duration-150 ease-in-out")},B))]})})}var G5=P(d(),1);function us($){return $?.split(/\s*·\s*/)[0]??""}function ES($){return us($.description)||$.displayName}function cs($){return $.charAt(0).toUpperCase()+$.slice(1)}function ds($){return $==="xhigh"?"Extra":cs($)}function SS($){return typeof $==="number"?$:$[0]??0}var kS={from:{opacity:0,filter:"blur(4px)"},to:{opacity:1,filter:"blur(0px)"}},IS={type:"spring",duration:0.3,delay:0.1,bounce:0};function yS({label:$,leadingIcon:Z,className:J,...Q}){return G5.jsxs(k0,{...Q,variant:"ghost",className:s("group/picker max-w-56 min-w-0 px-2 text-muted-foreground hover:text-muted-foreground",J),children:[Z,G5.jsx("span",{className:"truncate font-normal",children:$})]})}function ls({current:$,model:Z,models:J,onValueChange:Q}){let X=ES(Z),z=dC(J,"Models");return G5.jsxs(g$,{children:[G5.jsx(v$,{render:G5.jsx(yS,{label:X,className:"shrink","aria-label":`Model: ${X}`})}),G5.jsx(f$,{align:"end",side:"top",className:"w-max max-w-64 min-w-40",children:G5.jsx(hE,{value:$,onValueChange:Q,children:z.map((G)=>G5.jsxs(m$,{children:[G5.jsx(pY,{children:G.label}),G.models.map((H)=>G5.jsx(gE,{value:H.value,closeOnClick:!0,children:ES(H)},H.value))]},G.label))})})]})}function is({currentEffort:$,effortLevels:Z,fastMode:J,showFastMode:Q,onFastModeChange:X,onValueChange:z}){let G=mC(Z,$),[H,Y]=i$.useState(!1),[K,W]=i$.useState(G),[B,q]=i$.useState(!1),F=Z[H?K:G]??$,N=ds(F),L=(M)=>{if(M)W(G);else q(!1);Y(M)},V=(M)=>{let _=Z[M];if(_&&_!==$)z(_)};return G5.jsxs(rY,{open:H,onOpenChange:L,children:[G5.jsx(aY,{render:G5.jsx(yS,{label:N,leadingIcon:J?G5.jsx(CQ,{stroke:1.5}):void 0,"aria-label":`Effort: ${N}`})}),G5.jsxs(nY,{align:"end",side:"top",className:"w-64",disableAnchorTracking:!0,children:[G5.jsx(WS,{className:"relative h-5 flex-row items-center",children:G5.jsx(o8,{mode:"popLayout",initial:!1,children:B?G5.jsxs(p5.div,{className:"flex h-5 w-full items-center justify-between text-sm text-muted-foreground","aria-hidden":"true",variants:kS,initial:"from",animate:"to",exit:"from",transition:IS,children:[G5.jsx("span",{children:"Faster"}),G5.jsx("span",{children:"Smarter"})]},"range"):G5.jsxs(p5.div,{className:"flex h-5 w-full items-center justify-between gap-2",variants:kS,initial:"from",animate:"to",exit:"from",transition:IS,children:[G5.jsxs("div",{className:"flex items-center gap-1",children:[G5.jsx("span",{className:"text-muted-foreground",children:"Effort"}),G5.jsx("output",{"aria-live":"polite",children:N})]}),Q&&G5.jsxs(M1,{children:[G5.jsx(A1,{render:G5.jsx(k0,{type:"button",variant:"ghost",size:"icon-sm","aria-label":J?"Turn off Fast mode":"Turn on Fast mode","aria-pressed":J,onClick:()=>X(!J),className:"-my-1 -mr-1",children:J?G5.jsx(RS,{className:"text-primary"}):G5.jsx(CQ,{className:"text-muted-foreground",stroke:1.5})})}),G5.jsxs(_1,{align:"center",className:"flex-col gap-0",children:[G5.jsx("span",{children:"Fast mode"}),G5.jsx("span",{className:"font-normal text-muted-foreground",children:"More usage"})]})]})]},"effort")})}),G5.jsxs("label",{className:"block",children:[G5.jsx("span",{className:"sr-only",children:"Reasoning effort"}),G5.jsx(CS,{value:K,min:0,max:Z.length-1,step:1,onPointerDown:(M)=>{if(M.button===0)q(!0)},onPointerCancel:()=>q(!1),onValueChange:(M)=>W(SS(M)),onValueCommitted:(M)=>{q(!1),V(SS(M))},className:s("**: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]:border-0 **:data-[slot=slider-thumb]:bg-card **:data-[slot=slider-thumb]:shadow-xs **:data-[slot=slider-thumb]:ring-0"),children:G5.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},(M,_)=>G5.jsx("span",{className:s("size-1 rounded-full",_<=K?"bg-primary-foreground/30":"bg-foreground/30")},_))})})]})]})]})}var bS=i$.memo(function({sessionId:Z}){let{workspaceId:J,layout:Q,setLayout:X}=n5(),{data:z}=X9(J),G=z?.models??[],H=G.find((y)=>y.value==="default"),Y=z?cC(G.filter((y)=>y.value!=="default"),z.provider):[],K=BY(J,Z).data,W=vC(J),B=(Z?K?.model:void 0)??Q.selectedModel,q=(Z?K?.effort:void 0)??Q.selectedEffort,U=(Z?K?.fastMode:void 0)??Q.selectedFastMode,F=(y)=>{if(Z)W.mutate({sessionId:Z,patch:{model:y}});else X({selectedModel:y})},N=(y)=>{if(Z)W.mutate({sessionId:Z,patch:{effort:y}});else X({selectedEffort:y})},L=(y)=>{if(Z)W.mutate({sessionId:Z,patch:{fastMode:y}});else X({selectedFastMode:y})};if(Y.length===0)return null;let V=Y.some((y)=>y.value===B)?B:void 0,M=Y.find((y)=>H?.resolvedModel&&y.resolvedModel===H.resolvedModel)??Y[0],_=V??M.value,O=Y.find((y)=>y.value===_)??Y[0],D=O.supportsEffort?O.supportedEffortLevels??[]:[],A=_F(D,q,O.defaultEffort),E=pC(D)&&A!==void 0,I=uC(O,U);return G5.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[G5.jsx(ls,{current:_,model:O,models:Y,onValueChange:F}),E&&G5.jsx(is,{currentEffort:A,effortLevels:D,fastMode:I,showFastMode:O.supportsFastMode===!0,onFastModeChange:L,onValueChange:N},O.value)]})});var Z5=P(d(),1);function hS({composerRef:$,onSend:Z,onStop:J,processing:Q,sessionId:X,modelSessionId:z,availability:G,annotation:H,onRemoveDrawing:Y,allowFiles:K=!0,placeholder:W,draft:B}){let q=r$.useRef(null),U=J1(),F=D1((w)=>w.composerDrafts[U]??""),N=D1((w)=>B?(w.viewBuilderDrafts??{})[B.id]:void 0),L=B?N??B.initialValue:F,V=r$.useRef(L);V.current=L;let M=j4((w)=>w.attachments[n8(U,X)]??rs),[_,O]=r$.useState(!1),D=M.some((w)=>w.status==="uploading"),A=M.some((w)=>w.status==="ready"||w.status==="draft"),E=L.trim().length>0||A,I=MQ(E,D,G),y=(w)=>{if(V.current=w,B)B.onChange(w);else D1.getState().setComposerDraft(U,w)},C=(w)=>{if(K)$C({workspaceId:U,sessionId:X},w)},h=r$.useRef(!1),k=(w)=>{if(w.kind==="drawing"&&Y){Y(w.localId);return}P5.getState().removeAttachment(U,X,w.localId)},S=async()=>{if(!I||h.current)return;h.current=!0;try{if(await H?.finish(),await Z(V.current),!B)V.current="",D1.getState().setComposerDraft(U,"")}finally{h.current=!1}};return Z5.jsxs(XC,{composerRef:$,onSubmit:(w)=>{w.preventDefault(),S()},onDragOver:(w)=>{if(!w.dataTransfer.types.includes("Files"))return;if(w.preventDefault(),K)O(!0)},onDragLeave:(w)=>{if(!K)return;if(w.currentTarget.contains(w.relatedTarget))return;O(!1)},onDrop:(w)=>{if(!w.dataTransfer.types.includes("Files"))return;w.preventDefault(),O(!1),C(Array.from(w.dataTransfer.files))},className:s(_&&"ring-2 ring-ring/60"),children:[M.length>0&&Z5.jsx("div",{className:"flex flex-wrap gap-2 px-1 pt-1 pb-1",children:M.map((w)=>Z5.jsx(as,{attachment:w,onRemove:()=>k(w)},w.localId))}),Z5.jsx(zC,{textareaRef:$,id:"chat-input",name:"message",value:L,onChange:(w)=>y(w.target.value),onKeyDown:(w)=>{if(w.key==="Enter"&&!w.shiftKey)w.preventDefault(),S()},onPaste:(w)=>{let T=Array.from(w.clipboardData?.files??[]);if(T.length===0)return;w.preventDefault(),C(T)},placeholder:Q?"Queue a follow-up":W??"Do anything",rows:1}),Z5.jsxs(GC,{children:[K&&Z5.jsx("input",{ref:q,type:"file",multiple:!0,hidden:!0,onChange:(w)=>{C(Array.from(w.target.files??[])),w.target.value=""}}),Z5.jsxs("div",{className:"mr-auto flex shrink-0 items-center gap-0.5",children:[K&&Z5.jsxs(M1,{children:[Z5.jsx(A1,{render:Z5.jsx(k0,{type:"button",variant:"ghost",size:"icon",onClick:()=>q.current?.click(),"aria-label":"Attach files",children:Z5.jsx(HK,{stroke:1.6,className:"size-4.5!"})})}),Z5.jsx(_1,{children:"Attach files"})]}),H&&Z5.jsxs(M1,{children:[Z5.jsx(A1,{render:Z5.jsx(k0,{type:"button",variant:"ghost",size:"icon",onClick:H.onToggle,className:s(H.active&&"bg-accent"),"aria-label":"Draw annotation","aria-pressed":H.active,children:Z5.jsx(EQ,{stroke:1.5})})}),Z5.jsx(_1,{children:"Draw annotation"})]})]}),Z5.jsx(bS,{sessionId:z}),Q?Z5.jsxs(M1,{children:[Z5.jsx(A1,{render:Z5.jsx(k0,{type:"button",size:"icon",onClick:J,"aria-label":"Stop agent",children:Z5.jsx(xS,{})})}),Z5.jsx(_1,{children:"Stop answering"})]}):Z5.jsx(HC,{label:"Send message",hasContent:E,busy:D,availability:G})]})]})}var rs=[];function as({attachment:$,onRemove:Z}){if($.kind==="drawing")return Z5.jsx(ns,{attachment:$,onRemove:Z});let{name:J,previewUrl:Q,status:X,error:z}=$,G=!!Q;return Z5.jsxs("div",{className:s("group relative flex items-center gap-2 overflow-hidden rounded-lg bg-accent text-accent-foreground ring-1 ring-border",G?"size-14":"h-10 max-w-52 pr-2 pl-2",X==="error"&&"border-destructive/50"),title:z??J,children:[G?Z5.jsx("img",{src:Q,alt:J,className:"size-full object-cover"}):Z5.jsxs(Z5.Fragment,{children:[Z5.jsx(a$,{size:16,stroke:1.75,className:"shrink-0 text-muted-foreground"}),Z5.jsx("span",{className:"truncate text-xs",children:J})]}),X==="uploading"&&Z5.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-background/70",children:Z5.jsx(T1,{size:16,stroke:1.75,className:"animate-spin text-muted-foreground"})}),X==="error"&&Z5.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-destructive/10 text-[10px] text-destructive",children:"Failed"}),Z5.jsx(k0,{type:"button",variant:"ghost",size:"icon-sm",onClick:Z,"aria-label":`Remove ${J}`,className:"absolute top-0.5 right-0.5 size-4 rounded-full bg-primary/70 text-primary-foreground opacity-0 transition-opacity group-hover:opacity-100 hover:bg-primary/80 [&_svg]:size-3",children:Z5.jsx(m1,{stroke:1.75})})]})}function ns({attachment:$,onRemove:Z}){let{previewUrl:J,purpose:Q}=$,X=Q==="sketch"?"Sketch":"Annotation";return Z5.jsxs(yC,{children:[Z5.jsxs(bC,{render:Z5.jsx("div",{tabIndex:0,className:"group flex h-7 cursor-default items-center rounded-md bg-background pr-2 pl-0.5 text-sm whitespace-nowrap text-foreground ring-1 ring-border outline-none focus-visible:ring-3 focus-visible:ring-ring/50"}),children:[Z5.jsxs(k0,{type:"button",variant:"ghost",size:"icon-sm",onClick:Z,"aria-label":`Remove ${X.toLowerCase()}`,className:"size-6 shrink-0 hover:bg-transparent hover:text-current",children:[Z5.jsx(EQ,{stroke:1.75,className:"group-focus-within:hidden group-hover:hidden"}),Z5.jsx(m1,{stroke:1.75,className:"hidden group-focus-within:block group-hover:block"})]}),Z5.jsx("span",{children:X})]}),J&&Z5.jsx(xC,{side:"top",align:"start",className:"w-60 max-w-[calc(100vw-2rem)]",children:Z5.jsx("img",{src:J,alt:`${X} preview`,className:"max-h-72 w-full rounded-md object-contain"})})]})}var s3=P(d(),1);function lF({className:$,prompt:Z,disabled:J=!1,onSelect:Q}){let X=Z.icon;return s3.jsxs(k0,{type:"button",size:"sm",disabled:J,onClick:()=>Q(Z),className:s("h-auto items-start justify-start gap-2 rounded-lg p-2 px-3 text-left leading-snug whitespace-normal",$),children:[s3.jsx(X,{stroke:2,"aria-hidden":!0,className:"mt-0.5"}),s3.jsx("span",{children:Z.label})]})}function gS({prompts:$,disabled:Z=!1,onSelect:J}){return s3.jsx("div",{className:"row-gap-2 grid w-full grid-cols-1 gap-x-3 gap-y-2 py-2 @md:grid-cols-3",children:$.map((Q,X)=>{return s3.jsx(lF,{prompt:Q,disabled:Z,onSelect:J,className:s("h-full w-fit @md:w-full",X===0&&"@md:translate-y-3 @md:rotate-3 @md:hover:translate-y-2.5",X===1&&"@md:-rotate-1",X===2&&"@md:translate-y-3 @md:-rotate-4 @md:hover:translate-y-2.5")},Q.prompt)})})}var $1=P(d(),1),iF="Keep the final reply brief and user-facing. Do not include file or storage links, file paths, or bundle, test, and runtime-log summaries.",os=[{label:"What's 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.",iF],icon:mS},{label:"Build a fun 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.",iF],icon:BK},{label:"Make a job tracker",prompt:"Build me a view with a visual job search board where I can add opportunities by pasting a job link, automatically extract the details, move opportunities through stages, and keep notes and related files in the workspace",context:["Build this onboarding example immediately without asking follow-up questions.","Create a visual View with Saved, Applied, Interviewing, Offer, and Closed stages.","Let the user add a job by pasting its URL, and use a server function to parse public metadata for the title, company, and location.","When a page blocks parsing or lacks metadata, keep the URL and provide editable manual fields.","Support moving opportunities between stages, editing their details and notes, and referencing related workspace files.","Persist the board in a workspace-local JSON file and include loading, empty, and error states.","Bundle the View and smoke-test its persistence and parsing functions before finishing.",iF],icon:KK}],ss={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:vS};function pS({isViewBuilderDraft:$,hasSentMessageFromMoi:Z,isWorkspacePendingAnalysis:J}){if($)return"view-builder";if(!Z)return"chat-welcome";if(J)return"workspace-welcome";return"empty"}var qK=s("flex flex-1 flex-col items-center justify-center");function uS({kind:$,disabled:Z=!1,onSelectPrompt:J}){switch($){case"view-builder":return $1.jsx(ts,{});case"chat-welcome":return $1.jsx(es,{disabled:Z,onSelectPrompt:J});case"workspace-welcome":return $1.jsx($t,{disabled:Z,onSelectPrompt:J});case"empty":return $1.jsx(Zt,{})}}function ts(){return $1.jsxs("div",{className:s(qK,"gap-2 text-center text-muted-foreground"),children:[$1.jsx(fS,{size:56,stroke:0.5}),$1.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 es({disabled:$=!1,onSelectPrompt:Z}){return $1.jsxs("div",{className:s(qK,"@container w-full max-w-md min-w-0"),children:[$1.jsxs("div",{className:"prose prose-sm min-w-0 wrap-anywhere prose-inherit",children:[$1.jsx("p",{children:"moi is the visual workspace for you and your agent. It grows and adapts to the work you're doing."}),$1.jsxs("p",{children:["Ask ",$1.jsx(YK,{Icon:WK,children:"Agent"})," to build"," ",$1.jsx(YK,{Icon:kQ,children:"Widgets"})," that surface information and quick actions, or entire ",$1.jsx(YK,{Icon:SQ,children:"Views"})," for more complex tools. Use ",$1.jsx(YK,{Icon:IQ,children:"Scratchpad"})," for exploring and shaping ideas with your agent."]}),$1.jsx("p",{children:"Give it a try:"})]}),$1.jsx(gS,{prompts:os,disabled:$,onSelect:Z})]})}function $t({disabled:$=!1,onSelectPrompt:Z}){return $1.jsxs("div",{className:s(qK,"gap-2"),children:[$1.jsx("div",{className:"prose prose-sm max-w-60 min-w-0 text-center wrap-anywhere text-muted-foreground prose-inherit",children:$1.jsx("p",{children:"See what moi can build for you"})}),$1.jsx(lF,{prompt:ss,disabled:$,onSelect:Z})]})}function Zt(){return $1.jsx("div",{className:s(qK,"gap-1 text-center"),children:$1.jsx("p",{className:"mx-auto max-w-sm px-8 text-sm text-muted-foreground",children:"Chat with your agent, create widgets and views, and manage your workspace context from here"})})}function YK({Icon:$,children:Z}){return $1.jsxs("strong",{className:"inline-flex items-center gap-0.5 align-bottom font-medium",children:[$1.jsx($,{size:16,stroke:2,"aria-hidden":!0}),Z]})}var RQ=P(v(),1);var k5=P(d(),1);function Jt($){if($.flavor==="cron"||$.flavor==="subagent")return $.flavor;let Z=$.origin?.provider.trim().toLowerCase();return Z?Z:null}function Qt({active:$,canArchive:Z,confirmingArchive:J,onArchive:Q,onRequestArchive:X,onSelect:z,session:G,workspaceId:H}){let Y=RQ.useRef(!1),[K,W]=RQ.useState(!1),B=j4((N)=>AJ(N.activity,H,G.sessionId)),q=Jt(G);function U(){X(G.sessionId)}async function F(){if(Y.current)return;Y.current=!0,W(!0);try{await Q(G.sessionId)}catch{c4.add({title:"Couldn’t archive chat",type:"error"})}finally{Y.current=!1,W(!1)}}return k5.jsxs("div",{className:"group/chat relative",children:[k5.jsx(OQ,{className:s("font-medium group-hover/chat:bg-accent group-hover/chat:text-accent-foreground",$&&"bg-accent text-accent-foreground"),onClick:()=>z(G.sessionId),children:k5.jsx("div",{className:s("flex min-w-0 flex-1 overflow-hidden",(B||K)&&"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:k5.jsxs("span",{className:s("flex min-w-0 items-baseline gap-1.5",(B||K)&&"-mr-4",J?"-mr-14":Z&&"group-focus-within/chat:-mr-4 group-hover/chat:-mr-4 [@media(hover:none)]:-mr-4"),children:[k5.jsx("span",{className:"min-w-0 truncate",children:G.summary}),q&&k5.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:q})]})})}),B&&k5.jsx(E9,{className:s("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||K)&&"hidden")}),Z&&k5.jsx("div",{className:s("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",K&&"opacity-100!"),children:J?k5.jsx(k0,{type:"button",variant:"secondary",size:"sm","aria-label":`Confirm archive ${G.summary}`,tabIndex:-1,className:"mr-1 h-5 rounded-sm px-1.5 text-xs hover:bg-accent",disabled:K,onClick:F,onPointerDown:(N)=>N.stopPropagation(),children:"Confirm"}):k5.jsxs(M1,{children:[k5.jsx(A1,{render:k5.jsx(k0,{type:"button",variant:"ghost",size:"icon-sm","aria-label":`Archive ${G.summary}`,tabIndex:-1,className:"text-muted-foreground hover:bg-transparent hover:text-foreground",disabled:K,onClick:U,onPointerDown:(N)=>N.stopPropagation(),children:k5.jsx(dS,{stroke:1.75})})}),k5.jsx(_1,{side:"right",children:"Archive chat"})]})})]})}function Xt($){return`${$.getFullYear()}-${$.getMonth()}-${$.getDate()}`}function cS($){return Date.UTC($.getFullYear(),$.getMonth(),$.getDate())/86400000}function zt($,Z){let J=cS(Z)-cS($);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 Gt($,Z=new Date){let J=new Map;for(let Q of $.slice().sort((X,z)=>z.lastModified-X.lastModified)){let X=new Date(Q.lastModified),z=Xt(X),G=J.get(z);if(G){G.sessions.push(Q);continue}J.set(z,{key:z,label:zt(X,Z),sessions:[Q]})}return[...J.values()]}function iS({onSelectSession:$,selectedSessionId:Z}){let J=J1(),[Q,X]=RQ.useState(null),{data:z=[]}=WY(J),G=X9(J).data?.supportsArchiving===!0,H=hC(J),Y=j4((N)=>YO(N.activity,J,Z)),W=z.find((N)=>N.sessionId===Z)?.summary??"New chat",B=Gt(z);function q(N){$(N)}function U(N){if(!N)X(null)}async function F(N){X(null),await H.mutateAsync(N);let L=P5.getState();if(L.clearAttachments(J,N),L.clearPreviewsForSession(J,N),Z===N)$(null)}return k5.jsxs(g$,{onOpenChange:U,children:[k5.jsx(v$,{render:k5.jsxs(k0,{className:"group",variant:"ghost",size:"sm",children:[k5.jsx("span",{className:"max-w-64 truncate",children:W}),Y?k5.jsx(E9,{className:"size-4!",stroke:2}):k5.jsx(UK,{className:"text-muted-foreground group-hover:text-foreground",stroke:1.75})]})}),k5.jsxs(f$,{align:"start",className:"flex max-h-100 w-max max-w-72 min-w-40 flex-col overflow-hidden",children:[k5.jsxs(OQ,{className:"shrink-0 gap-1 font-medium text-muted-foreground! **:text-muted-foreground!",onClick:()=>q(null),children:[k5.jsx(lS,{size:16,stroke:1.75}),"New chat"]}),B.length>0&&k5.jsxs(k5.Fragment,{children:[k5.jsx(vE,{className:"shrink-0"}),k5.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:B.map((N)=>k5.jsxs(m$,{children:[k5.jsx(pY,{children:N.label}),N.sessions.map((L)=>k5.jsx(Qt,{session:L,active:Z===L.sessionId,canArchive:G,confirmingArchive:Q===L.sessionId,onSelect:q,onArchive:F,onRequestArchive:X,workspaceId:J},L.sessionId))]},N.key))})]})]})]})}var Xh=P(v(),1);function x5(){}function FK(){}function rS($,Z){let J=Z||{};return($[$.length-1]===""?[...$,""]:$).join((J.padRight?" ":"")+","+(J.padLeft===!1?"":" ")).trim()}var Ht=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Yt=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Kt={};function NK($,Z){return((Z||Kt).jsx?Yt:Ht).test($)}var Wt=/[ \t\n\f\r]/g;function rF($){return typeof $==="object"?$.type==="text"?aS($.value):!1:aS($)}function aS($){return $.replace(Wt,"")===""}class I6{constructor($,Z,J){if(this.normal=Z,this.property=$,J)this.space=J}}I6.prototype.normal={};I6.prototype.property={};I6.prototype.space=void 0;function aF($,Z){let J={},Q={};for(let X of $)Object.assign(J,X.property),Object.assign(Q,X.normal);return new I6(J,Q,Z)}function yQ($){return $.toLowerCase()}class _8{constructor($,Z){this.attribute=Z,this.property=$}}_8.prototype.attribute="";_8.prototype.booleanish=!1;_8.prototype.boolean=!1;_8.prototype.commaOrSpaceSeparated=!1;_8.prototype.commaSeparated=!1;_8.prototype.defined=!1;_8.prototype.mustUseProperty=!1;_8.prototype.number=!1;_8.prototype.overloadedBoolean=!1;_8.prototype.property="";_8.prototype.spaceSeparated=!1;_8.prototype.space=void 0;var bQ={};_4(bQ,{spaceSeparated:()=>c5,overloadedBoolean:()=>VK,number:()=>w0,commaSeparated:()=>R6,commaOrSpaceSeparated:()=>V4,booleanish:()=>h1,boolean:()=>z5});var Bt=0,z5=t3(),h1=t3(),VK=t3(),w0=t3(),c5=t3(),R6=t3(),V4=t3();function t3(){return 2**++Bt}var nF=Object.keys(bQ);class n$ extends _8{constructor($,Z,J,Q){let X=-1;super($,Z);if(nS(this,"space",Q),typeof J==="number")while(++X<nF.length){let z=nF[X];nS(this,nF[X],(J&bQ[z])===bQ[z])}}}n$.prototype.defined=!0;function nS($,Z,J){if(J)$[Z]=J}function J2($){let Z={},J={};for(let[Q,X]of Object.entries($.properties)){let z=new n$(Q,$.transform($.attributes||{},Q),X,$.space);if($.mustUseProperty&&$.mustUseProperty.includes(Q))z.mustUseProperty=!0;Z[Q]=z,J[yQ(Q)]=Q,J[yQ(z.attribute)]=Q}return new I6(Z,J,$.space)}var oF=J2({properties:{ariaActiveDescendant:null,ariaAtomic:h1,ariaAutoComplete:null,ariaBusy:h1,ariaChecked:h1,ariaColCount:w0,ariaColIndex:w0,ariaColSpan:w0,ariaControls:c5,ariaCurrent:null,ariaDescribedBy:c5,ariaDetails:null,ariaDisabled:h1,ariaDropEffect:c5,ariaErrorMessage:null,ariaExpanded:h1,ariaFlowTo:c5,ariaGrabbed:h1,ariaHasPopup:null,ariaHidden:h1,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:c5,ariaLevel:w0,ariaLive:null,ariaModal:h1,ariaMultiLine:h1,ariaMultiSelectable:h1,ariaOrientation:null,ariaOwns:c5,ariaPlaceholder:null,ariaPosInSet:w0,ariaPressed:h1,ariaReadOnly:h1,ariaRelevant:null,ariaRequired:h1,ariaRoleDescription:c5,ariaRowCount:w0,ariaRowIndex:w0,ariaRowSpan:w0,ariaSelected:h1,ariaSetSize:w0,ariaSort:null,ariaValueMax:w0,ariaValueMin:w0,ariaValueNow:w0,ariaValueText:null,role:null},transform($,Z){return Z==="role"?Z:"aria-"+Z.slice(4).toLowerCase()}});function LK($,Z){return Z in $?$[Z]:Z}function MK($,Z){return LK($,Z.toLowerCase())}var oS=J2({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:R6,acceptCharset:c5,accessKey:c5,action:null,allow:null,allowFullScreen:z5,allowPaymentRequest:z5,allowUserMedia:z5,alt:null,as:null,async:z5,autoCapitalize:null,autoComplete:c5,autoFocus:z5,autoPlay:z5,blocking:c5,capture:null,charSet:null,checked:z5,cite:null,className:c5,cols:w0,colSpan:null,content:null,contentEditable:h1,controls:z5,controlsList:c5,coords:w0|R6,crossOrigin:null,data:null,dateTime:null,decoding:null,default:z5,defer:z5,dir:null,dirName:null,disabled:z5,download:VK,draggable:h1,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:z5,formTarget:null,headers:c5,height:w0,hidden:VK,high:w0,href:null,hrefLang:null,htmlFor:c5,httpEquiv:c5,id:null,imageSizes:null,imageSrcSet:null,inert:z5,inputMode:null,integrity:null,is:null,isMap:z5,itemId:null,itemProp:c5,itemRef:c5,itemScope:z5,itemType:c5,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:z5,low:w0,manifest:null,max:null,maxLength:w0,media:null,method:null,min:null,minLength:w0,multiple:z5,muted:z5,name:null,nonce:null,noModule:z5,noValidate:z5,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:z5,optimum:w0,pattern:null,ping:c5,placeholder:null,playsInline:z5,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:z5,referrerPolicy:null,rel:c5,required:z5,reversed:z5,rows:w0,rowSpan:w0,sandbox:c5,scope:null,scoped:z5,seamless:z5,selected:z5,shadowRootClonable:z5,shadowRootDelegatesFocus:z5,shadowRootMode:null,shape:null,size:w0,sizes:null,slot:null,span:w0,spellCheck:h1,src:null,srcDoc:null,srcLang:null,srcSet:null,start:w0,step:null,style:null,tabIndex:w0,target:null,title:null,translate:null,type:null,typeMustMatch:z5,useMap:null,value:h1,width:w0,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:c5,axis:null,background:null,bgColor:null,border:w0,borderColor:null,bottomMargin:w0,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:z5,declare:z5,event:null,face:null,frame:null,frameBorder:null,hSpace:w0,leftMargin:w0,link:null,longDesc:null,lowSrc:null,marginHeight:w0,marginWidth:w0,noResize:z5,noHref:z5,noShade:z5,noWrap:z5,object:null,profile:null,prompt:null,rev:null,rightMargin:w0,rules:null,scheme:null,scrolling:h1,standby:null,summary:null,text:null,topMargin:w0,valueType:null,version:null,vAlign:null,vLink:null,vSpace:w0,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:z5,disableRemotePlayback:z5,prefix:null,property:null,results:w0,security:null,unselectable:null},space:"html",transform:MK});var sS=J2({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:V4,accentHeight:w0,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:w0,amplitude:w0,arabicForm:null,ascent:w0,attributeName:null,attributeType:null,azimuth:w0,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:w0,by:null,calcMode:null,capHeight:w0,className:c5,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:w0,diffuseConstant:w0,direction:null,display:null,dur:null,divisor:w0,dominantBaseline:null,download:z5,dx:null,dy:null,edgeMode:null,editable:null,elevation:w0,enableBackground:null,end:null,event:null,exponent:w0,externalResourcesRequired:null,fill:null,fillOpacity:w0,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:R6,g2:R6,glyphName:R6,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:w0,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:w0,horizOriginX:w0,horizOriginY:w0,id:null,ideographic:w0,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:w0,k:w0,k1:w0,k2:w0,k3:w0,k4:w0,kernelMatrix:V4,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:w0,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:w0,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:w0,overlineThickness:w0,paintOrder:null,panose1:null,path:null,pathLength:w0,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:c5,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:w0,pointsAtY:w0,pointsAtZ:w0,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:V4,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:V4,rev:V4,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:V4,requiredFeatures:V4,requiredFonts:V4,requiredFormats:V4,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:w0,specularExponent:w0,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:w0,strikethroughThickness:w0,string:null,stroke:null,strokeDashArray:V4,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:w0,strokeOpacity:w0,strokeWidth:null,style:null,surfaceScale:w0,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:V4,tabIndex:w0,tableValues:null,target:null,targetX:w0,targetY:w0,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:V4,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:w0,underlineThickness:w0,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:w0,values:null,vAlphabetic:w0,vMathematical:w0,vectorEffect:null,vHanging:w0,vIdeographic:w0,version:null,vertAdvY:w0,vertOriginX:w0,vertOriginY:w0,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:w0,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:LK});var sF=J2({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 tF=J2({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:MK});var eF=J2({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform($,Z){return"xml:"+Z.slice(3).toLowerCase()}});var $N={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 qt=/[A-Z]/g,tS=/-[a-z]/g,Ut=/^data[-\w.:]+$/i;function ZN($,Z){let J=yQ(Z),Q=Z,X=_8;if(J in $.normal)return $.property[$.normal[J]];if(J.length>4&&J.slice(0,4)==="data"&&Ut.test(Z)){if(Z.charAt(4)==="-"){let z=Z.slice(5).replace(tS,Nt);Q="data"+z.charAt(0).toUpperCase()+z.slice(1)}else{let z=Z.slice(4);if(!tS.test(z)){let G=z.replace(qt,Ft);if(G.charAt(0)!=="-")G="-"+G;Z="data"+G}}X=n$}return new X(Q,Z)}function Ft($){return"-"+$.toLowerCase()}function Nt($){return $.charAt(1).toUpperCase()}var eS=aF([oF,oS,sF,tF,eF],"html"),AK=aF([oF,sS,sF,tF,eF],"svg");function $k($){return $.join(" ").trim()}var Lk=P(Uk(),1);var _K=Fk("end"),o$=Fk("start");function Fk($){return Z;function Z(J){let Q=J&&J.position&&J.position[$]||{};if(typeof Q.line==="number"&&Q.line>0&&typeof Q.column==="number"&&Q.column>0)return{line:Q.line,column:Q.column,offset:typeof Q.offset==="number"&&Q.offset>-1?Q.offset:void 0}}}function XN($){let Z=o$($),J=_K($);if(Z&&J)return{start:Z,end:J}}function y6($){if(!$||typeof $!=="object")return"";if("position"in $||"type"in $)return Nk($.position);if("start"in $||"end"in $)return Nk($);if("line"in $||"column"in $)return zN($);return""}function zN($){return Vk($&&$.line)+":"+Vk($&&$.column)}function Nk($){return zN($&&$.start)+"-"+zN($&&$.end)}function Vk($){return $&&typeof $==="number"?$:1}class o1 extends Error{constructor($,Z,J){super();if(typeof Z==="string")J=Z,Z=void 0;let Q="",X={},z=!1;if(Z)if("line"in Z&&"column"in Z)X={place:Z};else if("start"in Z&&"end"in Z)X={place:Z};else if("type"in Z)X={ancestors:[Z],place:Z.position};else X={...Z};if(typeof $==="string")Q=$;else if(!X.cause&&$)z=!0,Q=$.message,X.cause=$;if(!X.ruleId&&!X.source&&typeof J==="string"){let H=J.indexOf(":");if(H===-1)X.ruleId=J;else X.source=J.slice(0,H),X.ruleId=J.slice(H+1)}if(!X.place&&X.ancestors&&X.ancestors){let H=X.ancestors[X.ancestors.length-1];if(H)X.place=H.position}let G=X.place&&"start"in X.place?X.place.start:X.place;this.ancestors=X.ancestors||void 0,this.cause=X.cause||void 0,this.column=G?G.column:void 0,this.fatal=void 0,this.file="",this.message=Q,this.line=G?G.line:void 0,this.name=y6(X.place)||"1:1",this.place=X.place||void 0,this.reason=this.message,this.ruleId=X.ruleId||void 0,this.source=X.source||void 0,this.stack=z&&X.cause&&typeof X.cause.stack==="string"?X.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}o1.prototype.file="";o1.prototype.name="";o1.prototype.reason="";o1.prototype.message="";o1.prototype.stack="";o1.prototype.column=void 0;o1.prototype.line=void 0;o1.prototype.ancestors=void 0;o1.prototype.cause=void 0;o1.prototype.fatal=void 0;o1.prototype.place=void 0;o1.prototype.ruleId=void 0;o1.prototype.source=void 0;var GN={}.hasOwnProperty,pt=new Map,ut=/[A-Z]/g,ct=new Set(["table","tbody","thead","tfoot","tr"]),dt=new Set(["td","th"]),Mk="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function HN($,Z){if(!Z||Z.Fragment===void 0)throw TypeError("Expected `Fragment` in options");let J=Z.filePath||void 0,Q;if(Z.development){if(typeof Z.jsxDEV!=="function")throw TypeError("Expected `jsxDEV` in options when `development: true`");Q=tt(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");Q=st(J,Z.jsx,Z.jsxs)}let X={Fragment:Z.Fragment,ancestors:[],components:Z.components||{},create:Q,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"?AK:eS,stylePropertyNameCase:Z.stylePropertyNameCase||"dom",tableCellAlignToStyle:Z.tableCellAlignToStyle!==!1},z=Ak(X,$,void 0);if(z&&typeof z!=="string")return z;return X.create($,X.Fragment,{children:z||void 0},void 0)}function Ak($,Z,J){if(Z.type==="element")return lt($,Z,J);if(Z.type==="mdxFlowExpression"||Z.type==="mdxTextExpression")return it($,Z);if(Z.type==="mdxJsxFlowElement"||Z.type==="mdxJsxTextElement")return at($,Z,J);if(Z.type==="mdxjsEsm")return rt($,Z);if(Z.type==="root")return nt($,Z,J);if(Z.type==="text")return ot($,Z)}function lt($,Z,J){let Q=$.schema,X=Q;if(Z.tagName.toLowerCase()==="svg"&&Q.space==="html")X=AK,$.schema=X;$.ancestors.push(Z);let z=Dk($,Z.tagName,!1),G=et($,Z),H=KN($,Z);if(ct.has(Z.tagName))H=H.filter(function(Y){return typeof Y==="string"?!rF(Y):!0});return _k($,G,z,Z),YN(G,H),$.ancestors.pop(),$.schema=Q,$.create(Z,z,G,J)}function it($,Z){if(Z.data&&Z.data.estree&&$.evaluater){let Q=Z.data.estree.body[0];return x5(Q.type==="ExpressionStatement"),$.evaluater.evaluateExpression(Q.expression)}hQ($,Z.position)}function rt($,Z){if(Z.data&&Z.data.estree&&$.evaluater)return $.evaluater.evaluateProgram(Z.data.estree);hQ($,Z.position)}function at($,Z,J){let Q=$.schema,X=Q;if(Z.name==="svg"&&Q.space==="html")X=AK,$.schema=X;$.ancestors.push(Z);let z=Z.name===null?$.Fragment:Dk($,Z.name,!0),G=$e($,Z),H=KN($,Z);return _k($,G,z,Z),YN(G,H),$.ancestors.pop(),$.schema=Q,$.create(Z,z,G,J)}function nt($,Z,J){let Q={};return YN(Q,KN($,Z)),$.create(Z,$.Fragment,Q,J)}function ot($,Z){return Z.value}function _k($,Z,J,Q){if(typeof J!=="string"&&J!==$.Fragment&&$.passNode)Z.node=Q}function YN($,Z){if(Z.length>0){let J=Z.length>1?Z:Z[0];if(J)$.children=J}}function st($,Z,J){return Q;function Q(X,z,G,H){let K=Array.isArray(G.children)?J:Z;return H?K(z,G,H):K(z,G)}}function tt($,Z){return J;function J(Q,X,z,G){let H=Array.isArray(z.children),Y=o$(Q);return Z(X,z,G,H,{columnNumber:Y?Y.column-1:void 0,fileName:$,lineNumber:Y?Y.line:void 0},void 0)}}function et($,Z){let J={},Q,X;for(X in Z.properties)if(X!=="children"&&GN.call(Z.properties,X)){let z=Ze($,X,Z.properties[X]);if(z){let[G,H]=z;if($.tableCellAlignToStyle&&G==="align"&&typeof H==="string"&&dt.has(Z.tagName))Q=H;else J[G]=H}}if(Q){let z=J.style||(J.style={});z[$.stylePropertyNameCase==="css"?"text-align":"textAlign"]=Q}return J}function $e($,Z){let J={};for(let Q of Z.attributes)if(Q.type==="mdxJsxExpressionAttribute")if(Q.data&&Q.data.estree&&$.evaluater){let z=Q.data.estree.body[0];x5(z.type==="ExpressionStatement");let G=z.expression;x5(G.type==="ObjectExpression");let H=G.properties[0];x5(H.type==="SpreadElement"),Object.assign(J,$.evaluater.evaluateExpression(H.argument))}else hQ($,Z.position);else{let X=Q.name,z;if(Q.value&&typeof Q.value==="object")if(Q.value.data&&Q.value.data.estree&&$.evaluater){let H=Q.value.data.estree.body[0];x5(H.type==="ExpressionStatement"),z=$.evaluater.evaluateExpression(H.expression)}else hQ($,Z.position);else z=Q.value===null?!0:Q.value;J[X]=z}return J}function KN($,Z){let J=[],Q=-1,X=$.passKeys?new Map:pt;while(++Q<Z.children.length){let z=Z.children[Q],G;if($.passKeys){let Y=z.type==="element"?z.tagName:z.type==="mdxJsxFlowElement"||z.type==="mdxJsxTextElement"?z.name:void 0;if(Y){let K=X.get(Y)||0;G=Y+"-"+K,X.set(Y,K+1)}}let H=Ak($,z,G);if(H!==void 0)J.push(H)}return J}function Ze($,Z,J){let Q=ZN($.schema,Z);if(J===null||J===void 0||typeof J==="number"&&Number.isNaN(J))return;if(Array.isArray(J))J=Q.commaSeparated?rS(J):$k(J);if(Q.property==="style"){let X=typeof J==="object"?J:Je($,String(J));if($.stylePropertyNameCase==="css")X=Qe(X);return["style",X]}return[$.elementAttributeNameCase==="react"&&Q.space?$N[Q.property]||Q.property:Q.attribute,J]}function Je($,Z){try{return Lk.default(Z,{reactCompat:!0})}catch(J){if($.ignoreInvalidStyle)return{};let Q=J,X=new o1("Cannot parse `style` attribute",{ancestors:$.ancestors,cause:Q,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw X.file=$.filePath||void 0,X.url=Mk+"#cannot-parse-style-attribute",X}}function Dk($,Z,J){let Q;if(!J)Q={type:"Literal",value:Z};else if(Z.includes(".")){let X=Z.split("."),z=-1,G;while(++z<X.length){let H=NK(X[z])?{type:"Identifier",name:X[z]}:{type:"Literal",value:X[z]};G=G?{type:"MemberExpression",object:G,property:H,computed:Boolean(z&&H.type==="Literal"),optional:!1}:H}x5(G,"always a result"),Q=G}else Q=NK(Z)&&!/^[a-z]/.test(Z)?{type:"Identifier",name:Z}:{type:"Literal",value:Z};if(Q.type==="Literal"){let X=Q.value;return GN.call($.components,X)?$.components[X]:X}if($.evaluater)return $.evaluater.evaluateExpression(Q);hQ($)}function hQ($,Z){let J=new o1("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=Mk+"#cannot-handle-mdx-estrees-without-createevaluater",J}function Qe($){let Z={},J;for(J in $)if(GN.call($,J))Z[Xe(J)]=$[J];return Z}function Xe($){let Z=$.replace(ut,ze);if(Z.slice(0,3)==="ms-")Z="-"+Z;return Z}function ze($){return"-"+$.toLowerCase()}var gQ={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 XZ=P(d(),1),dI=P(v(),1);var Ge={};function $7($,Z){let J=Z||Ge,Q=typeof J.includeImageAlt==="boolean"?J.includeImageAlt:!0,X=typeof J.includeHtml==="boolean"?J.includeHtml:!0;return Pk($,Q,X)}function Pk($,Z,J){if(He($)){if("value"in $)return $.type==="html"&&!J?"":$.value;if(Z&&"alt"in $&&$.alt)return $.alt;if("children"in $)return Ok($.children,Z,J)}if(Array.isArray($))return Ok($,Z,J);return""}function Ok($,Z,J){let Q=[],X=-1;while(++X<$.length)Q[X]=Pk($[X],Z,J);return Q.join("")}function He($){return Boolean($&&typeof $==="object")}var wk=document.createElement("i");function s$($){let Z="&"+$+";";wk.innerHTML=Z;let J=wk.textContent;if(J.charCodeAt(J.length-1)===59&&$!=="semi")return!1;return J===Z?!1:J}function u1($,Z,J,Q){let X=$.length,z=0,G;if(Z<0)Z=-Z>X?0:X+Z;else Z=Z>X?X:Z;if(J=J>0?J:0,Q.length<1e4)G=Array.from(Q),G.unshift(Z,J),$.splice(...G);else{if(J)$.splice(Z,J);while(z<Q.length)G=Q.slice(z,z+1e4),G.unshift(Z,0),$.splice(...G),z+=1e4,Z+=1e4}}function t8($,Z){if($.length>0)return u1($,$.length,0,Z),$;return Z}var jk={}.hasOwnProperty;function DK($){let Z={},J=-1;while(++J<$.length)Ye(Z,$[J]);return Z}function Ye($,Z){let J;for(J in Z){let X=(jk.call($,J)?$[J]:void 0)||($[J]={}),z=Z[J],G;if(z)for(G in z){if(!jk.call(X,G))X[G]=[];let H=z[G];Ke(X[G],Array.isArray(H)?H:H?[H]:[])}}}function Ke($,Z){let J=-1,Q=[];while(++J<Z.length)(Z[J].add==="after"?$:Q).push(Z[J]);u1($,0,0,Q)}function OK($,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 v8($){return $.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}var Q8=b6(/[A-Za-z]/),g1=b6(/[\dA-Za-z]/),Tk=b6(/[#-'*+\--9=?A-Z^-~]/);function Z7($){return $!==null&&($<32||$===127)}var vQ=b6(/\d/),Ck=b6(/[\dA-Fa-f]/),Ek=b6(/[!-/:-@[-`{-~]/);function b0($){return $!==null&&$<-2}function L5($){return $!==null&&($<0||$===32)}function a0($){return $===-2||$===-1||$===32}var J7=b6(/\p{P}|\p{S}/u),Y9=b6(/\s/);function b6($){return Z;function Z(J){return J!==null&&J>-1&&$.test(String.fromCharCode(J))}}function Q2($){let Z=[],J=-1,Q=0,X=0;while(++J<$.length){let z=$.charCodeAt(J),G="";if(z===37&&g1($.charCodeAt(J+1))&&g1($.charCodeAt(J+2)))X=2;else if(z<128){if(!/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(z)))G=String.fromCharCode(z)}else if(z>55295&&z<57344){let H=$.charCodeAt(J+1);if(z<56320&&H>56319&&H<57344)G=String.fromCharCode(z,H),X=1;else G="�"}else G=String.fromCharCode(z);if(G)Z.push($.slice(Q,J),encodeURIComponent(G)),Q=J+X+1,G="";if(X)J+=X,X=0}return Z.join("")+$.slice(Q)}function i0($,Z,J,Q){let X=Q?Q-1:Number.POSITIVE_INFINITY,z=0;return G;function G(Y){if(a0(Y))return $.enter(J),H(Y);return Z(Y)}function H(Y){if(a0(Y)&&z++<X)return $.consume(Y),H;return $.exit(J),Z(Y)}}var Sk={tokenize:We};function We($){let Z=$.attempt(this.parser.constructs.contentInitial,Q,X),J;return Z;function Q(H){if(H===null){$.consume(H);return}return $.enter("lineEnding"),$.consume(H),$.exit("lineEnding"),i0($,Z,"linePrefix")}function X(H){return $.enter("paragraph"),z(H)}function z(H){let Y=$.enter("chunkText",{contentType:"text",previous:J});if(J)J.next=Y;return J=Y,G(H)}function G(H){if(H===null){$.exit("chunkText"),$.exit("paragraph"),$.consume(H);return}if(b0(H))return $.consume(H),$.exit("chunkText"),z;return $.consume(H),G}}var Ik={tokenize:Be},kk={tokenize:qe};function Be($){let Z=this,J=[],Q=0,X,z,G;return H;function H(_){if(Q<J.length){let O=J[Q];return Z.containerState=O[1],$.attempt(O[0].continuation,Y,K)(_)}return K(_)}function Y(_){if(Q++,Z.containerState._closeFlow){if(Z.containerState._closeFlow=void 0,X)M();let O=Z.events.length,D=O,A;while(D--)if(Z.events[D][0]==="exit"&&Z.events[D][1].type==="chunkFlow"){A=Z.events[D][1].end;break}V(Q);let E=O;while(E<Z.events.length)Z.events[E][1].end={...A},E++;return u1(Z.events,D+1,0,Z.events.slice(O)),Z.events.length=E,K(_)}return H(_)}function K(_){if(Q===J.length){if(!X)return q(_);if(X.currentConstruct&&X.currentConstruct.concrete)return F(_);Z.interrupt=Boolean(X.currentConstruct&&!X._gfmTableDynamicInterruptHack)}return Z.containerState={},$.check(kk,W,B)(_)}function W(_){if(X)M();return V(Q),q(_)}function B(_){return Z.parser.lazy[Z.now().line]=Q!==J.length,G=Z.now().offset,F(_)}function q(_){return Z.containerState={},$.attempt(kk,U,F)(_)}function U(_){return Q++,J.push([Z.currentConstruct,Z.containerState]),q(_)}function F(_){if(_===null){if(X)M();V(0),$.consume(_);return}return X=X||Z.parser.flow(Z.now()),$.enter("chunkFlow",{_tokenizer:X,contentType:"flow",previous:z}),N(_)}function N(_){if(_===null){L($.exit("chunkFlow"),!0),V(0),$.consume(_);return}if(b0(_))return $.consume(_),L($.exit("chunkFlow")),Q=0,Z.interrupt=void 0,H;return $.consume(_),N}function L(_,O){let D=Z.sliceStream(_);if(O)D.push(null);if(_.previous=z,z)z.next=_;if(z=_,X.defineSkip(_.start),X.write(D),Z.parser.lazy[_.start.line]){let A=X.events.length;while(A--)if(X.events[A][1].start.offset<G&&(!X.events[A][1].end||X.events[A][1].end.offset>G))return;let E=Z.events.length,I=E,y,C;while(I--)if(Z.events[I][0]==="exit"&&Z.events[I][1].type==="chunkFlow"){if(y){C=Z.events[I][1].end;break}y=!0}V(Q),A=E;while(A<Z.events.length)Z.events[A][1].end={...C},A++;u1(Z.events,I+1,0,Z.events.slice(E)),Z.events.length=A}}function V(_){let O=J.length;while(O-- >_){let D=J[O];Z.containerState=D[1],D[0].exit.call(Z,$)}J.length=_}function M(){X.write([null]),z=void 0,X=void 0,Z.containerState._closeFlow=void 0}}function qe($,Z,J){return i0($,$.attempt(this.parser.constructs.document,Z,J),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function R9($){if($===null||L5($)||Y9($))return 1;if(J7($))return 2}function x6($,Z,J){let Q=[],X=-1;while(++X<$.length){let z=$[X].resolveAll;if(z&&!Q.includes(z))Z=z(Z,J),Q.push(z)}return Z}var fQ={name:"attention",resolveAll:Ue,tokenize:Fe};function Ue($,Z){let J=-1,Q,X,z,G,H,Y,K,W;while(++J<$.length)if($[J][0]==="enter"&&$[J][1].type==="attentionSequence"&&$[J][1]._close){Q=J;while(Q--)if($[Q][0]==="exit"&&$[Q][1].type==="attentionSequence"&&$[Q][1]._open&&Z.sliceSerialize($[Q][1]).charCodeAt(0)===Z.sliceSerialize($[J][1]).charCodeAt(0)){if(($[Q][1]._close||$[J][1]._open)&&($[J][1].end.offset-$[J][1].start.offset)%3&&!(($[Q][1].end.offset-$[Q][1].start.offset+$[J][1].end.offset-$[J][1].start.offset)%3))continue;Y=$[Q][1].end.offset-$[Q][1].start.offset>1&&$[J][1].end.offset-$[J][1].start.offset>1?2:1;let B={...$[Q][1].end},q={...$[J][1].start};if(Rk(B,-Y),Rk(q,Y),G={type:Y>1?"strongSequence":"emphasisSequence",start:B,end:{...$[Q][1].end}},H={type:Y>1?"strongSequence":"emphasisSequence",start:{...$[J][1].start},end:q},z={type:Y>1?"strongText":"emphasisText",start:{...$[Q][1].end},end:{...$[J][1].start}},X={type:Y>1?"strong":"emphasis",start:{...G.start},end:{...H.end}},$[Q][1].end={...G.start},$[J][1].start={...H.end},K=[],$[Q][1].end.offset-$[Q][1].start.offset)K=t8(K,[["enter",$[Q][1],Z],["exit",$[Q][1],Z]]);if(K=t8(K,[["enter",X,Z],["enter",G,Z],["exit",G,Z],["enter",z,Z]]),K=t8(K,x6(Z.parser.constructs.insideSpan.null,$.slice(Q+1,J),Z)),K=t8(K,[["exit",z,Z],["enter",H,Z],["exit",H,Z],["exit",X,Z]]),$[J][1].end.offset-$[J][1].start.offset)W=2,K=t8(K,[["enter",$[J][1],Z],["exit",$[J][1],Z]]);else W=0;u1($,Q-1,J-Q+3,K),J=Q+K.length-W-2;break}}J=-1;while(++J<$.length)if($[J][1].type==="attentionSequence")$[J][1].type="data";return $}function Fe($,Z){let J=this.parser.constructs.attentionMarkers.null,Q=this.previous,X=R9(Q),z;return G;function G(Y){return z=Y,$.enter("attentionSequence"),H(Y)}function H(Y){if(Y===z)return $.consume(Y),H;let K=$.exit("attentionSequence"),W=R9(Y),B=!W||W===2&&X||J.includes(Y),q=!X||X===2&&W||J.includes(Q);return K._open=Boolean(z===42?B:B&&(X||!q)),K._close=Boolean(z===42?q:q&&(W||!B)),Z(Y)}}function Rk($,Z){$.column+=Z,$.offset+=Z,$._bufferIndex+=Z}var WN={name:"autolink",tokenize:Ne};function Ne($,Z,J){let Q=0;return X;function X(U){return $.enter("autolink"),$.enter("autolinkMarker"),$.consume(U),$.exit("autolinkMarker"),$.enter("autolinkProtocol"),z}function z(U){if(Q8(U))return $.consume(U),G;if(U===64)return J(U);return K(U)}function G(U){if(U===43||U===45||U===46||g1(U))return Q=1,H(U);return K(U)}function H(U){if(U===58)return $.consume(U),Q=0,Y;if((U===43||U===45||U===46||g1(U))&&Q++<32)return $.consume(U),H;return Q=0,K(U)}function Y(U){if(U===62)return $.exit("autolinkProtocol"),$.enter("autolinkMarker"),$.consume(U),$.exit("autolinkMarker"),$.exit("autolink"),Z;if(U===null||U===32||U===60||Z7(U))return J(U);return $.consume(U),Y}function K(U){if(U===64)return $.consume(U),W;if(Tk(U))return $.consume(U),K;return J(U)}function W(U){return g1(U)?B(U):J(U)}function B(U){if(U===46)return $.consume(U),Q=0,W;if(U===62)return $.exit("autolinkProtocol").type="autolinkEmail",$.enter("autolinkMarker"),$.consume(U),$.exit("autolinkMarker"),$.exit("autolink"),Z;return q(U)}function q(U){if((U===45||g1(U))&&Q++<63){let F=U===45?q:B;return $.consume(U),F}return J(U)}}var K9={partial:!0,tokenize:Ve};function Ve($,Z,J){return Q;function Q(z){return a0(z)?i0($,X,"linePrefix")(z):X(z)}function X(z){return z===null||b0(z)?Z(z):J(z)}}var PK={continuation:{tokenize:Me},exit:Ae,name:"blockQuote",tokenize:Le};function Le($,Z,J){let Q=this;return X;function X(G){if(G===62){let H=Q.containerState;if(!H.open)$.enter("blockQuote",{_container:!0}),H.open=!0;return $.enter("blockQuotePrefix"),$.enter("blockQuoteMarker"),$.consume(G),$.exit("blockQuoteMarker"),z}return J(G)}function z(G){if(a0(G))return $.enter("blockQuotePrefixWhitespace"),$.consume(G),$.exit("blockQuotePrefixWhitespace"),$.exit("blockQuotePrefix"),Z;return $.exit("blockQuotePrefix"),Z(G)}}function Me($,Z,J){let Q=this;return X;function X(G){if(a0(G))return i0($,z,"linePrefix",Q.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(G);return z(G)}function z(G){return $.attempt(PK,Z,J)(G)}}function Ae($){$.exit("blockQuote")}var wK={name:"characterEscape",tokenize:_e};function _e($,Z,J){return Q;function Q(z){return $.enter("characterEscape"),$.enter("escapeMarker"),$.consume(z),$.exit("escapeMarker"),X}function X(z){if(Ek(z))return $.enter("characterEscapeValue"),$.consume(z),$.exit("characterEscapeValue"),$.exit("characterEscape"),Z;return J(z)}}var jK={name:"characterReference",tokenize:De};function De($,Z,J){let Q=this,X=0,z,G;return H;function H(B){return $.enter("characterReference"),$.enter("characterReferenceMarker"),$.consume(B),$.exit("characterReferenceMarker"),Y}function Y(B){if(B===35)return $.enter("characterReferenceMarkerNumeric"),$.consume(B),$.exit("characterReferenceMarkerNumeric"),K;return $.enter("characterReferenceValue"),z=31,G=g1,W(B)}function K(B){if(B===88||B===120)return $.enter("characterReferenceMarkerHexadecimal"),$.consume(B),$.exit("characterReferenceMarkerHexadecimal"),$.enter("characterReferenceValue"),z=6,G=Ck,W;return $.enter("characterReferenceValue"),z=7,G=vQ,W(B)}function W(B){if(B===59&&X){let q=$.exit("characterReferenceValue");if(G===g1&&!s$(Q.sliceSerialize(q)))return J(B);return $.enter("characterReferenceMarker"),$.consume(B),$.exit("characterReferenceMarker"),$.exit("characterReference"),Z}if(G(B)&&X++<z)return $.consume(B),W;return J(B)}}var yk={partial:!0,tokenize:Pe},TK={concrete:!0,name:"codeFenced",tokenize:Oe};function Oe($,Z,J){let Q=this,X={partial:!0,tokenize:D},z=0,G=0,H;return Y;function Y(A){return K(A)}function K(A){let E=Q.events[Q.events.length-1];return z=E&&E[1].type==="linePrefix"?E[2].sliceSerialize(E[1],!0).length:0,H=A,$.enter("codeFenced"),$.enter("codeFencedFence"),$.enter("codeFencedFenceSequence"),W(A)}function W(A){if(A===H)return G++,$.consume(A),W;if(G<3)return J(A);return $.exit("codeFencedFenceSequence"),a0(A)?i0($,B,"whitespace")(A):B(A)}function B(A){if(A===null||b0(A))return $.exit("codeFencedFence"),Q.interrupt?Z(A):$.check(yk,N,O)(A);return $.enter("codeFencedFenceInfo"),$.enter("chunkString",{contentType:"string"}),q(A)}function q(A){if(A===null||b0(A))return $.exit("chunkString"),$.exit("codeFencedFenceInfo"),B(A);if(a0(A))return $.exit("chunkString"),$.exit("codeFencedFenceInfo"),i0($,U,"whitespace")(A);if(A===96&&A===H)return J(A);return $.consume(A),q}function U(A){if(A===null||b0(A))return B(A);return $.enter("codeFencedFenceMeta"),$.enter("chunkString",{contentType:"string"}),F(A)}function F(A){if(A===null||b0(A))return $.exit("chunkString"),$.exit("codeFencedFenceMeta"),B(A);if(A===96&&A===H)return J(A);return $.consume(A),F}function N(A){return $.attempt(X,O,L)(A)}function L(A){return $.enter("lineEnding"),$.consume(A),$.exit("lineEnding"),V}function V(A){return z>0&&a0(A)?i0($,M,"linePrefix",z+1)(A):M(A)}function M(A){if(A===null||b0(A))return $.check(yk,N,O)(A);return $.enter("codeFlowValue"),_(A)}function _(A){if(A===null||b0(A))return $.exit("codeFlowValue"),M(A);return $.consume(A),_}function O(A){return $.exit("codeFenced"),Z(A)}function D(A,E,I){let y=0;return C;function C(T){return A.enter("lineEnding"),A.consume(T),A.exit("lineEnding"),h}function h(T){return A.enter("codeFencedFence"),a0(T)?i0(A,k,"linePrefix",Q.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(T):k(T)}function k(T){if(T===H)return A.enter("codeFencedFenceSequence"),S(T);return I(T)}function S(T){if(T===H)return y++,A.consume(T),S;if(y>=G)return A.exit("codeFencedFenceSequence"),a0(T)?i0(A,w,"whitespace")(T):w(T);return I(T)}function w(T){if(T===null||b0(T))return A.exit("codeFencedFence"),E(T);return I(T)}}}function Pe($,Z,J){let Q=this;return X;function X(G){if(G===null)return J(G);return $.enter("lineEnding"),$.consume(G),$.exit("lineEnding"),z}function z(G){return Q.parser.lazy[Q.now().line]?J(G):Z(G)}}var mQ={name:"codeIndented",tokenize:je},we={partial:!0,tokenize:Te};function je($,Z,J){let Q=this;return X;function X(K){return $.enter("codeIndented"),i0($,z,"linePrefix",5)(K)}function z(K){let W=Q.events[Q.events.length-1];return W&&W[1].type==="linePrefix"&&W[2].sliceSerialize(W[1],!0).length>=4?G(K):J(K)}function G(K){if(K===null)return Y(K);if(b0(K))return $.attempt(we,G,Y)(K);return $.enter("codeFlowValue"),H(K)}function H(K){if(K===null||b0(K))return $.exit("codeFlowValue"),G(K);return $.consume(K),H}function Y(K){return $.exit("codeIndented"),Z(K)}}function Te($,Z,J){let Q=this;return X;function X(G){if(Q.parser.lazy[Q.now().line])return J(G);if(b0(G))return $.enter("lineEnding"),$.consume(G),$.exit("lineEnding"),X;return i0($,z,"linePrefix",5)(G)}function z(G){let H=Q.events[Q.events.length-1];return H&&H[1].type==="linePrefix"&&H[2].sliceSerialize(H[1],!0).length>=4?Z(G):b0(G)?X(G):J(G)}}var BN={name:"codeText",previous:Ee,resolve:Ce,tokenize:Se};function Ce($){let Z=$.length-4,J=3,Q,X;if(($[J][1].type==="lineEnding"||$[J][1].type==="space")&&($[Z][1].type==="lineEnding"||$[Z][1].type==="space")){Q=J;while(++Q<Z)if($[Q][1].type==="codeTextData"){$[J][1].type="codeTextPadding",$[Z][1].type="codeTextPadding",J+=2,Z-=2;break}}Q=J-1,Z++;while(++Q<=Z)if(X===void 0){if(Q!==Z&&$[Q][1].type!=="lineEnding")X=Q}else if(Q===Z||$[Q][1].type==="lineEnding"){if($[X][1].type="codeTextData",Q!==X+2)$[X][1].end=$[Q-1][1].end,$.splice(X+2,Q-X-2),Z-=Q-X-2,Q=X+2;X=void 0}return $}function Ee($){return $!==96||this.events[this.events.length-1][1].type==="characterEscape"}function Se($,Z,J){let Q=this,X=0,z,G;return H;function H(q){return $.enter("codeText"),$.enter("codeTextSequence"),Y(q)}function Y(q){if(q===96)return $.consume(q),X++,Y;return $.exit("codeTextSequence"),K(q)}function K(q){if(q===null)return J(q);if(q===32)return $.enter("space"),$.consume(q),$.exit("space"),K;if(q===96)return G=$.enter("codeTextSequence"),z=0,B(q);if(b0(q))return $.enter("lineEnding"),$.consume(q),$.exit("lineEnding"),K;return $.enter("codeTextData"),W(q)}function W(q){if(q===null||q===32||q===96||b0(q))return $.exit("codeTextData"),K(q);return $.consume(q),W}function B(q){if(q===96)return $.consume(q),z++,B;if(z===X)return $.exit("codeTextSequence"),$.exit("codeText"),Z(q);return G.type="codeTextData",W(q)}}class qN{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 Q=Z||0;this.setCursor(Math.trunc($));let X=this.right.splice(this.right.length-Q,Number.POSITIVE_INFINITY);if(J)pQ(this.left,J);return X.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),pQ(this.left,$)}unshift($){this.setCursor(0),this.right.push($)}unshiftMany($){this.setCursor(0),pQ(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);pQ(this.right,Z.reverse())}else{let Z=this.right.splice(this.left.length+this.right.length-$,Number.POSITIVE_INFINITY);pQ(this.left,Z.reverse())}}}function pQ($,Z){let J=0;if(Z.length<1e4)$.push(...Z);else while(J<Z.length)$.push(...Z.slice(J,J+1e4)),J+=1e4}function CK($){let Z={},J=-1,Q,X,z,G,H,Y,K,W=new qN($);while(++J<W.length){while(J in Z)J=Z[J];if(Q=W.get(J),J&&Q[1].type==="chunkFlow"&&W.get(J-1)[1].type==="listItemPrefix"){if(Y=Q[1]._tokenizer.events,z=0,z<Y.length&&Y[z][1].type==="lineEndingBlank")z+=2;if(z<Y.length&&Y[z][1].type==="content")while(++z<Y.length){if(Y[z][1].type==="content")break;if(Y[z][1].type==="chunkText")Y[z][1]._isInFirstContentOfListItem=!0,z++}}if(Q[0]==="enter"){if(Q[1].contentType)Object.assign(Z,ke(W,J)),J=Z[J],K=!0}else if(Q[1]._container){z=J,X=void 0;while(z--)if(G=W.get(z),G[1].type==="lineEnding"||G[1].type==="lineEndingBlank"){if(G[0]==="enter"){if(X)W.get(X)[1].type="lineEndingBlank";G[1].type="lineEnding",X=z}}else if(G[1].type==="linePrefix"||G[1].type==="listItemIndent");else break;if(X)Q[1].end={...W.get(X)[1].start},H=W.slice(X,J),H.unshift(Q),W.splice(X,J-X+1,H)}}return u1($,0,Number.POSITIVE_INFINITY,W.slice(0)),!K}function ke($,Z){let J=$.get(Z)[1],Q=$.get(Z)[2],X=Z-1,z=[],G=J._tokenizer;if(!G){if(G=Q.parser[J.contentType](J.start),J._contentTypeTextTrailing)G._contentTypeTextTrailing=!0}let H=G.events,Y=[],K={},W,B,q=-1,U=J,F=0,N=0,L=[N];while(U){while($.get(++X)[1]!==U);if(z.push(X),!U._tokenizer){if(W=Q.sliceStream(U),!U.next)W.push(null);if(B)G.defineSkip(U.start);if(U._isInFirstContentOfListItem)G._gfmTasklistFirstContentOfListItem=!0;if(G.write(W),U._isInFirstContentOfListItem)G._gfmTasklistFirstContentOfListItem=void 0}B=U,U=U.next}U=J;while(++q<H.length)if(H[q][0]==="exit"&&H[q-1][0]==="enter"&&H[q][1].type===H[q-1][1].type&&H[q][1].start.line!==H[q][1].end.line)N=q+1,L.push(N),U._tokenizer=void 0,U.previous=void 0,U=U.next;if(G.events=[],U)U._tokenizer=void 0,U.previous=void 0;else L.pop();q=L.length;while(q--){let V=H.slice(L[q],L[q+1]),M=z.pop();Y.push([M,M+V.length-1]),$.splice(M,2,V)}Y.reverse(),q=-1;while(++q<Y.length)K[F+Y[q][0]]=F+Y[q][1],F+=Y[q][1]-Y[q][0]-1;return K}var UN={resolve:Re,tokenize:ye},Ie={partial:!0,tokenize:be};function Re($){return CK($),$}function ye($,Z){let J;return Q;function Q(H){return $.enter("content"),J=$.enter("chunkContent",{contentType:"content"}),X(H)}function X(H){if(H===null)return z(H);if(b0(H))return $.check(Ie,G,z)(H);return $.consume(H),X}function z(H){return $.exit("chunkContent"),$.exit("content"),Z(H)}function G(H){return $.consume(H),$.exit("chunkContent"),J.next=$.enter("chunkContent",{contentType:"content",previous:J}),J=J.next,X}}function be($,Z,J){let Q=this;return X;function X(G){return $.exit("chunkContent"),$.enter("lineEnding"),$.consume(G),$.exit("lineEnding"),i0($,z,"linePrefix")}function z(G){if(G===null||b0(G))return J(G);let H=Q.events[Q.events.length-1];if(!Q.parser.constructs.disable.null.includes("codeIndented")&&H&&H[1].type==="linePrefix"&&H[2].sliceSerialize(H[1],!0).length>=4)return Z(G);return $.interrupt(Q.parser.constructs.flow,J,Z)(G)}}function EK($,Z,J,Q,X,z,G,H,Y){let K=Y||Number.POSITIVE_INFINITY,W=0;return B;function B(V){if(V===60)return $.enter(Q),$.enter(X),$.enter(z),$.consume(V),$.exit(z),q;if(V===null||V===32||V===41||Z7(V))return J(V);return $.enter(Q),$.enter(G),$.enter(H),$.enter("chunkString",{contentType:"string"}),N(V)}function q(V){if(V===62)return $.enter(z),$.consume(V),$.exit(z),$.exit(X),$.exit(Q),Z;return $.enter(H),$.enter("chunkString",{contentType:"string"}),U(V)}function U(V){if(V===62)return $.exit("chunkString"),$.exit(H),q(V);if(V===null||V===60||b0(V))return J(V);return $.consume(V),V===92?F:U}function F(V){if(V===60||V===62||V===92)return $.consume(V),U;return U(V)}function N(V){if(!W&&(V===null||V===41||L5(V)))return $.exit("chunkString"),$.exit(H),$.exit(G),$.exit(Q),Z(V);if(W<K&&V===40)return $.consume(V),W++,N;if(V===41)return $.consume(V),W--,N;if(V===null||V===32||V===40||Z7(V))return J(V);return $.consume(V),V===92?L:N}function L(V){if(V===40||V===41||V===92)return $.consume(V),N;return N(V)}}function SK($,Z,J,Q,X,z){let G=this,H=0,Y;return K;function K(U){return $.enter(Q),$.enter(X),$.consume(U),$.exit(X),$.enter(z),W}function W(U){if(H>999||U===null||U===91||U===93&&!Y||U===94&&!H&&"_hiddenFootnoteSupport"in G.parser.constructs)return J(U);if(U===93)return $.exit(z),$.enter(X),$.consume(U),$.exit(X),$.exit(Q),Z;if(b0(U))return $.enter("lineEnding"),$.consume(U),$.exit("lineEnding"),W;return $.enter("chunkString",{contentType:"string"}),B(U)}function B(U){if(U===null||U===91||U===93||b0(U)||H++>999)return $.exit("chunkString"),W(U);if($.consume(U),!Y)Y=!a0(U);return U===92?q:B}function q(U){if(U===91||U===92||U===93)return $.consume(U),H++,B;return B(U)}}function kK($,Z,J,Q,X,z){let G;return H;function H(q){if(q===34||q===39||q===40)return $.enter(Q),$.enter(X),$.consume(q),$.exit(X),G=q===40?41:q,Y;return J(q)}function Y(q){if(q===G)return $.enter(X),$.consume(q),$.exit(X),$.exit(Q),Z;return $.enter(z),K(q)}function K(q){if(q===G)return $.exit(z),Y(G);if(q===null)return J(q);if(b0(q))return $.enter("lineEnding"),$.consume(q),$.exit("lineEnding"),i0($,K,"linePrefix");return $.enter("chunkString",{contentType:"string"}),W(q)}function W(q){if(q===G||q===null||b0(q))return $.exit("chunkString"),K(q);return $.consume(q),q===92?B:W}function B(q){if(q===G||q===92)return $.consume(q),W;return W(q)}}function Q7($,Z){let J;return Q;function Q(X){if(b0(X))return $.enter("lineEnding"),$.consume(X),$.exit("lineEnding"),J=!0,Q;if(a0(X))return i0($,Q,J?"linePrefix":"lineSuffix")(X);return Z(X)}}var FN={name:"definition",tokenize:he},xe={partial:!0,tokenize:ge};function he($,Z,J){let Q=this,X;return z;function z(U){return $.enter("definition"),G(U)}function G(U){return SK.call(Q,$,H,J,"definitionLabel","definitionLabelMarker","definitionLabelString")(U)}function H(U){if(X=v8(Q.sliceSerialize(Q.events[Q.events.length-1][1]).slice(1,-1)),U===58)return $.enter("definitionMarker"),$.consume(U),$.exit("definitionMarker"),Y;return J(U)}function Y(U){return L5(U)?Q7($,K)(U):K(U)}function K(U){return EK($,W,J,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(U)}function W(U){return $.attempt(xe,B,B)(U)}function B(U){return a0(U)?i0($,q,"whitespace")(U):q(U)}function q(U){if(U===null||b0(U))return $.exit("definition"),Q.parser.defined.push(X),Z(U);return J(U)}}function ge($,Z,J){return Q;function Q(H){return L5(H)?Q7($,X)(H):J(H)}function X(H){return kK($,z,J,"definitionTitle","definitionTitleMarker","definitionTitleString")(H)}function z(H){return a0(H)?i0($,G,"whitespace")(H):G(H)}function G(H){return H===null||b0(H)?Z(H):J(H)}}var NN={name:"hardBreakEscape",tokenize:ve};function ve($,Z,J){return Q;function Q(z){return $.enter("hardBreakEscape"),$.consume(z),X}function X(z){if(b0(z))return $.exit("hardBreakEscape"),Z(z);return J(z)}}var VN={name:"headingAtx",resolve:fe,tokenize:me};function fe($,Z){let J=$.length-2,Q=3,X,z;if($[Q][1].type==="whitespace")Q+=2;if(J-2>Q&&$[J][1].type==="whitespace")J-=2;if($[J][1].type==="atxHeadingSequence"&&(Q===J-1||J-4>Q&&$[J-2][1].type==="whitespace"))J-=Q+1===J?2:4;if(J>Q)X={type:"atxHeadingText",start:$[Q][1].start,end:$[J][1].end},z={type:"chunkText",start:$[Q][1].start,end:$[J][1].end,contentType:"text"},u1($,Q,J-Q+1,[["enter",X,Z],["enter",z,Z],["exit",z,Z],["exit",X,Z]]);return $}function me($,Z,J){let Q=0;return X;function X(W){return $.enter("atxHeading"),z(W)}function z(W){return $.enter("atxHeadingSequence"),G(W)}function G(W){if(W===35&&Q++<6)return $.consume(W),G;if(W===null||L5(W))return $.exit("atxHeadingSequence"),H(W);return J(W)}function H(W){if(W===35)return $.enter("atxHeadingSequence"),Y(W);if(W===null||b0(W))return $.exit("atxHeading"),Z(W);if(a0(W))return i0($,H,"whitespace")(W);return $.enter("atxHeadingText"),K(W)}function Y(W){if(W===35)return $.consume(W),Y;return $.exit("atxHeadingSequence"),H(W)}function K(W){if(W===null||W===35||L5(W))return $.exit("atxHeadingText"),H(W);return $.consume(W),K}}var bk=["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"],LN=["pre","script","style","textarea"];var MN={concrete:!0,name:"htmlFlow",resolveTo:ce,tokenize:de},pe={partial:!0,tokenize:ie},ue={partial:!0,tokenize:le};function ce($){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 de($,Z,J){let Q=this,X,z,G,H,Y;return K;function K(x){return W(x)}function W(x){return $.enter("htmlFlow"),$.enter("htmlFlowData"),$.consume(x),B}function B(x){if(x===33)return $.consume(x),q;if(x===47)return $.consume(x),z=!0,N;if(x===63)return $.consume(x),X=3,Q.interrupt?Z:j;if(Q8(x))return $.consume(x),G=String.fromCharCode(x),L;return J(x)}function q(x){if(x===45)return $.consume(x),X=2,U;if(x===91)return $.consume(x),X=5,H=0,F;if(Q8(x))return $.consume(x),X=4,Q.interrupt?Z:j;return J(x)}function U(x){if(x===45)return $.consume(x),Q.interrupt?Z:j;return J(x)}function F(x){if(x==="CDATA[".charCodeAt(H++)){if($.consume(x),H===6)return Q.interrupt?Z:k;return F}return J(x)}function N(x){if(Q8(x))return $.consume(x),G=String.fromCharCode(x),L;return J(x)}function L(x){if(x===null||x===47||x===62||L5(x)){let e=x===47,M0=G.toLowerCase();if(!e&&!z&&LN.includes(M0))return X=1,Q.interrupt?Z(x):k(x);if(bk.includes(G.toLowerCase())){if(X=6,e)return $.consume(x),V;return Q.interrupt?Z(x):k(x)}return X=7,Q.interrupt&&!Q.parser.lazy[Q.now().line]?J(x):z?M(x):_(x)}if(x===45||g1(x))return $.consume(x),G+=String.fromCharCode(x),L;return J(x)}function V(x){if(x===62)return $.consume(x),Q.interrupt?Z:k;return J(x)}function M(x){if(a0(x))return $.consume(x),M;return C(x)}function _(x){if(x===47)return $.consume(x),C;if(x===58||x===95||Q8(x))return $.consume(x),O;if(a0(x))return $.consume(x),_;return C(x)}function O(x){if(x===45||x===46||x===58||x===95||g1(x))return $.consume(x),O;return D(x)}function D(x){if(x===61)return $.consume(x),A;if(a0(x))return $.consume(x),D;return _(x)}function A(x){if(x===null||x===60||x===61||x===62||x===96)return J(x);if(x===34||x===39)return $.consume(x),Y=x,E;if(a0(x))return $.consume(x),A;return I(x)}function E(x){if(x===Y)return $.consume(x),Y=null,y;if(x===null||b0(x))return J(x);return $.consume(x),E}function I(x){if(x===null||x===34||x===39||x===47||x===60||x===61||x===62||x===96||L5(x))return D(x);return $.consume(x),I}function y(x){if(x===47||x===62||a0(x))return _(x);return J(x)}function C(x){if(x===62)return $.consume(x),h;return J(x)}function h(x){if(x===null||b0(x))return k(x);if(a0(x))return $.consume(x),h;return J(x)}function k(x){if(x===45&&X===2)return $.consume(x),R;if(x===60&&X===1)return $.consume(x),b;if(x===62&&X===4)return $.consume(x),t;if(x===63&&X===3)return $.consume(x),j;if(x===93&&X===5)return $.consume(x),u;if(b0(x)&&(X===6||X===7))return $.exit("htmlFlowData"),$.check(pe,Q0,S)(x);if(x===null||b0(x))return $.exit("htmlFlowData"),S(x);return $.consume(x),k}function S(x){return $.check(ue,w,Q0)(x)}function w(x){return $.enter("lineEnding"),$.consume(x),$.exit("lineEnding"),T}function T(x){if(x===null||b0(x))return S(x);return $.enter("htmlFlowData"),k(x)}function R(x){if(x===45)return $.consume(x),j;return k(x)}function b(x){if(x===47)return $.consume(x),G="",g;return k(x)}function g(x){if(x===62){let e=G.toLowerCase();if(LN.includes(e))return $.consume(x),t;return k(x)}if(Q8(x)&&G.length<8)return $.consume(x),G+=String.fromCharCode(x),g;return k(x)}function u(x){if(x===93)return $.consume(x),j;return k(x)}function j(x){if(x===62)return $.consume(x),t;if(x===45&&X===2)return $.consume(x),j;return k(x)}function t(x){if(x===null||b0(x))return $.exit("htmlFlowData"),Q0(x);return $.consume(x),t}function Q0(x){return $.exit("htmlFlow"),Z(x)}}function le($,Z,J){let Q=this;return X;function X(G){if(b0(G))return $.enter("lineEnding"),$.consume(G),$.exit("lineEnding"),z;return J(G)}function z(G){return Q.parser.lazy[Q.now().line]?J(G):Z(G)}}function ie($,Z,J){return Q;function Q(X){return $.enter("lineEnding"),$.consume(X),$.exit("lineEnding"),$.attempt(K9,Z,J)}}var AN={name:"htmlText",tokenize:re};function re($,Z,J){let Q=this,X,z,G;return H;function H(j){return $.enter("htmlText"),$.enter("htmlTextData"),$.consume(j),Y}function Y(j){if(j===33)return $.consume(j),K;if(j===47)return $.consume(j),D;if(j===63)return $.consume(j),_;if(Q8(j))return $.consume(j),I;return J(j)}function K(j){if(j===45)return $.consume(j),W;if(j===91)return $.consume(j),z=0,F;if(Q8(j))return $.consume(j),M;return J(j)}function W(j){if(j===45)return $.consume(j),U;return J(j)}function B(j){if(j===null)return J(j);if(j===45)return $.consume(j),q;if(b0(j))return G=B,b(j);return $.consume(j),B}function q(j){if(j===45)return $.consume(j),U;return B(j)}function U(j){return j===62?R(j):j===45?q(j):B(j)}function F(j){if(j==="CDATA[".charCodeAt(z++))return $.consume(j),z===6?N:F;return J(j)}function N(j){if(j===null)return J(j);if(j===93)return $.consume(j),L;if(b0(j))return G=N,b(j);return $.consume(j),N}function L(j){if(j===93)return $.consume(j),V;return N(j)}function V(j){if(j===62)return R(j);if(j===93)return $.consume(j),V;return N(j)}function M(j){if(j===null||j===62)return R(j);if(b0(j))return G=M,b(j);return $.consume(j),M}function _(j){if(j===null)return J(j);if(j===63)return $.consume(j),O;if(b0(j))return G=_,b(j);return $.consume(j),_}function O(j){return j===62?R(j):_(j)}function D(j){if(Q8(j))return $.consume(j),A;return J(j)}function A(j){if(j===45||g1(j))return $.consume(j),A;return E(j)}function E(j){if(b0(j))return G=E,b(j);if(a0(j))return $.consume(j),E;return R(j)}function I(j){if(j===45||g1(j))return $.consume(j),I;if(j===47||j===62||L5(j))return y(j);return J(j)}function y(j){if(j===47)return $.consume(j),R;if(j===58||j===95||Q8(j))return $.consume(j),C;if(b0(j))return G=y,b(j);if(a0(j))return $.consume(j),y;return R(j)}function C(j){if(j===45||j===46||j===58||j===95||g1(j))return $.consume(j),C;return h(j)}function h(j){if(j===61)return $.consume(j),k;if(b0(j))return G=h,b(j);if(a0(j))return $.consume(j),h;return y(j)}function k(j){if(j===null||j===60||j===61||j===62||j===96)return J(j);if(j===34||j===39)return $.consume(j),X=j,S;if(b0(j))return G=k,b(j);if(a0(j))return $.consume(j),k;return $.consume(j),w}function S(j){if(j===X)return $.consume(j),X=void 0,T;if(j===null)return J(j);if(b0(j))return G=S,b(j);return $.consume(j),S}function w(j){if(j===null||j===34||j===39||j===60||j===61||j===96)return J(j);if(j===47||j===62||L5(j))return y(j);return $.consume(j),w}function T(j){if(j===47||j===62||L5(j))return y(j);return J(j)}function R(j){if(j===62)return $.consume(j),$.exit("htmlTextData"),$.exit("htmlText"),Z;return J(j)}function b(j){return $.exit("htmlTextData"),$.enter("lineEnding"),$.consume(j),$.exit("lineEnding"),g}function g(j){return a0(j)?i0($,u,"linePrefix",Q.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(j):u(j)}function u(j){return $.enter("htmlTextData"),G(j)}}var X7={name:"labelEnd",resolveAll:se,resolveTo:te,tokenize:ee},ae={tokenize:$00},ne={tokenize:Z00},oe={tokenize:J00};function se($){let Z=-1,J=[];while(++Z<$.length){let Q=$[Z][1];if(J.push($[Z]),Q.type==="labelImage"||Q.type==="labelLink"||Q.type==="labelEnd"){let X=Q.type==="labelImage"?4:2;Q.type="data",Z+=X}}if($.length!==J.length)u1($,0,$.length,J);return $}function te($,Z){let J=$.length,Q=0,X,z,G,H;while(J--)if(X=$[J][1],z){if(X.type==="link"||X.type==="labelLink"&&X._inactive)break;if($[J][0]==="enter"&&X.type==="labelLink")X._inactive=!0}else if(G){if($[J][0]==="enter"&&(X.type==="labelImage"||X.type==="labelLink")&&!X._balanced){if(z=J,X.type!=="labelLink"){Q=2;break}}}else if(X.type==="labelEnd")G=J;let Y={type:$[z][1].type==="labelLink"?"link":"image",start:{...$[z][1].start},end:{...$[$.length-1][1].end}},K={type:"label",start:{...$[z][1].start},end:{...$[G][1].end}},W={type:"labelText",start:{...$[z+Q+2][1].end},end:{...$[G-2][1].start}};return H=[["enter",Y,Z],["enter",K,Z]],H=t8(H,$.slice(z+1,z+Q+3)),H=t8(H,[["enter",W,Z]]),H=t8(H,x6(Z.parser.constructs.insideSpan.null,$.slice(z+Q+4,G-3),Z)),H=t8(H,[["exit",W,Z],$[G-2],$[G-1],["exit",K,Z]]),H=t8(H,$.slice(G+1)),H=t8(H,[["exit",Y,Z]]),u1($,z,$.length,H),$}function ee($,Z,J){let Q=this,X=Q.events.length,z,G;while(X--)if((Q.events[X][1].type==="labelImage"||Q.events[X][1].type==="labelLink")&&!Q.events[X][1]._balanced){z=Q.events[X][1];break}return H;function H(q){if(!z)return J(q);if(z._inactive)return B(q);return G=Q.parser.defined.includes(v8(Q.sliceSerialize({start:z.end,end:Q.now()}))),$.enter("labelEnd"),$.enter("labelMarker"),$.consume(q),$.exit("labelMarker"),$.exit("labelEnd"),Y}function Y(q){if(q===40)return $.attempt(ae,W,G?W:B)(q);if(q===91)return $.attempt(ne,W,G?K:B)(q);return G?W(q):B(q)}function K(q){return $.attempt(oe,W,B)(q)}function W(q){return Z(q)}function B(q){return z._balanced=!0,J(q)}}function $00($,Z,J){return Q;function Q(B){return $.enter("resource"),$.enter("resourceMarker"),$.consume(B),$.exit("resourceMarker"),X}function X(B){return L5(B)?Q7($,z)(B):z(B)}function z(B){if(B===41)return W(B);return EK($,G,H,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(B)}function G(B){return L5(B)?Q7($,Y)(B):W(B)}function H(B){return J(B)}function Y(B){if(B===34||B===39||B===40)return kK($,K,J,"resourceTitle","resourceTitleMarker","resourceTitleString")(B);return W(B)}function K(B){return L5(B)?Q7($,W)(B):W(B)}function W(B){if(B===41)return $.enter("resourceMarker"),$.consume(B),$.exit("resourceMarker"),$.exit("resource"),Z;return J(B)}}function Z00($,Z,J){let Q=this;return X;function X(H){return SK.call(Q,$,z,G,"reference","referenceMarker","referenceString")(H)}function z(H){return Q.parser.defined.includes(v8(Q.sliceSerialize(Q.events[Q.events.length-1][1]).slice(1,-1)))?Z(H):J(H)}function G(H){return J(H)}}function J00($,Z,J){return Q;function Q(z){return $.enter("reference"),$.enter("referenceMarker"),$.consume(z),$.exit("referenceMarker"),X}function X(z){if(z===93)return $.enter("referenceMarker"),$.consume(z),$.exit("referenceMarker"),$.exit("reference"),Z;return J(z)}}var _N={name:"labelStartImage",resolveAll:X7.resolveAll,tokenize:Q00};function Q00($,Z,J){let Q=this;return X;function X(H){return $.enter("labelImage"),$.enter("labelImageMarker"),$.consume(H),$.exit("labelImageMarker"),z}function z(H){if(H===91)return $.enter("labelMarker"),$.consume(H),$.exit("labelMarker"),$.exit("labelImage"),G;return J(H)}function G(H){return H===94&&"_hiddenFootnoteSupport"in Q.parser.constructs?J(H):Z(H)}}var DN={name:"labelStartLink",resolveAll:X7.resolveAll,tokenize:X00};function X00($,Z,J){let Q=this;return X;function X(G){return $.enter("labelLink"),$.enter("labelMarker"),$.consume(G),$.exit("labelMarker"),$.exit("labelLink"),z}function z(G){return G===94&&"_hiddenFootnoteSupport"in Q.parser.constructs?J(G):Z(G)}}var uQ={name:"lineEnding",tokenize:z00};function z00($,Z){return J;function J(Q){return $.enter("lineEnding"),$.consume(Q),$.exit("lineEnding"),i0($,Z,"linePrefix")}}var z7={name:"thematicBreak",tokenize:G00};function G00($,Z,J){let Q=0,X;return z;function z(K){return $.enter("thematicBreak"),G(K)}function G(K){return X=K,H(K)}function H(K){if(K===X)return $.enter("thematicBreakSequence"),Y(K);if(Q>=3&&(K===null||b0(K)))return $.exit("thematicBreak"),Z(K);return J(K)}function Y(K){if(K===X)return $.consume(K),Q++,Y;return $.exit("thematicBreakSequence"),a0(K)?i0($,H,"whitespace")(K):H(K)}}var f8={continuation:{tokenize:W00},exit:q00,name:"list",tokenize:K00},H00={partial:!0,tokenize:U00},Y00={partial:!0,tokenize:B00};function K00($,Z,J){let Q=this,X=Q.events[Q.events.length-1],z=X&&X[1].type==="linePrefix"?X[2].sliceSerialize(X[1],!0).length:0,G=0;return H;function H(U){let F=Q.containerState.type||(U===42||U===43||U===45?"listUnordered":"listOrdered");if(F==="listUnordered"?!Q.containerState.marker||U===Q.containerState.marker:vQ(U)){if(!Q.containerState.type)Q.containerState.type=F,$.enter(F,{_container:!0});if(F==="listUnordered")return $.enter("listItemPrefix"),U===42||U===45?$.check(z7,J,K)(U):K(U);if(!Q.interrupt||U===49)return $.enter("listItemPrefix"),$.enter("listItemValue"),Y(U)}return J(U)}function Y(U){if(vQ(U)&&++G<10)return $.consume(U),Y;if((!Q.interrupt||G<2)&&(Q.containerState.marker?U===Q.containerState.marker:U===41||U===46))return $.exit("listItemValue"),K(U);return J(U)}function K(U){return $.enter("listItemMarker"),$.consume(U),$.exit("listItemMarker"),Q.containerState.marker=Q.containerState.marker||U,$.check(K9,Q.interrupt?J:W,$.attempt(H00,q,B))}function W(U){return Q.containerState.initialBlankLine=!0,z++,q(U)}function B(U){if(a0(U))return $.enter("listItemPrefixWhitespace"),$.consume(U),$.exit("listItemPrefixWhitespace"),q;return J(U)}function q(U){return Q.containerState.size=z+Q.sliceSerialize($.exit("listItemPrefix"),!0).length,Z(U)}}function W00($,Z,J){let Q=this;return Q.containerState._closeFlow=void 0,$.check(K9,X,z);function X(H){return Q.containerState.furtherBlankLines=Q.containerState.furtherBlankLines||Q.containerState.initialBlankLine,i0($,Z,"listItemIndent",Q.containerState.size+1)(H)}function z(H){if(Q.containerState.furtherBlankLines||!a0(H))return Q.containerState.furtherBlankLines=void 0,Q.containerState.initialBlankLine=void 0,G(H);return Q.containerState.furtherBlankLines=void 0,Q.containerState.initialBlankLine=void 0,$.attempt(Y00,Z,G)(H)}function G(H){return Q.containerState._closeFlow=!0,Q.interrupt=void 0,i0($,$.attempt(f8,Z,J),"linePrefix",Q.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(H)}}function B00($,Z,J){let Q=this;return i0($,X,"listItemIndent",Q.containerState.size+1);function X(z){let G=Q.events[Q.events.length-1];return G&&G[1].type==="listItemIndent"&&G[2].sliceSerialize(G[1],!0).length===Q.containerState.size?Z(z):J(z)}}function q00($){$.exit(this.containerState.type)}function U00($,Z,J){let Q=this;return i0($,X,"listItemPrefixWhitespace",Q.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function X(z){let G=Q.events[Q.events.length-1];return!a0(z)&&G&&G[1].type==="listItemPrefixWhitespace"?Z(z):J(z)}}var IK={name:"setextUnderline",resolveTo:F00,tokenize:N00};function F00($,Z){let J=$.length,Q,X,z;while(J--)if($[J][0]==="enter"){if($[J][1].type==="content"){Q=J;break}if($[J][1].type==="paragraph")X=J}else{if($[J][1].type==="content")$.splice(J,1);if(!z&&$[J][1].type==="definition")z=J}let G={type:"setextHeading",start:{...$[Q][1].start},end:{...$[$.length-1][1].end}};if($[X][1].type="setextHeadingText",z)$.splice(X,0,["enter",G,Z]),$.splice(z+1,0,["exit",$[Q][1],Z]),$[Q][1].end={...$[z][1].end};else $[Q][1]=G;return $.push(["exit",G,Z]),$}function N00($,Z,J){let Q=this,X;return z;function z(K){let W=Q.events.length,B;while(W--)if(Q.events[W][1].type!=="lineEnding"&&Q.events[W][1].type!=="linePrefix"&&Q.events[W][1].type!=="content"){B=Q.events[W][1].type==="paragraph";break}if(!Q.parser.lazy[Q.now().line]&&(Q.interrupt||B))return $.enter("setextHeadingLine"),X=K,G(K);return J(K)}function G(K){return $.enter("setextHeadingLineSequence"),H(K)}function H(K){if(K===X)return $.consume(K),H;return $.exit("setextHeadingLineSequence"),a0(K)?i0($,Y,"lineSuffix")(K):Y(K)}function Y(K){if(K===null||b0(K))return $.exit("setextHeadingLine"),Z(K);return J(K)}}var xk={tokenize:V00};function V00($){let Z=this,J=$.attempt(K9,Q,$.attempt(this.parser.constructs.flowInitial,X,i0($,$.attempt(this.parser.constructs.flow,X,$.attempt(UN,X)),"linePrefix")));return J;function Q(z){if(z===null){$.consume(z);return}return $.enter("lineEndingBlank"),$.consume(z),$.exit("lineEndingBlank"),Z.currentConstruct=void 0,J}function X(z){if(z===null){$.consume(z);return}return $.enter("lineEnding"),$.consume(z),$.exit("lineEnding"),Z.currentConstruct=void 0,J}}var hk={resolveAll:mk()},gk=fk("string"),vk=fk("text");function fk($){return{resolveAll:mk($==="text"?L00:void 0),tokenize:Z};function Z(J){let Q=this,X=this.parser.constructs[$],z=J.attempt(X,G,H);return G;function G(W){return K(W)?z(W):H(W)}function H(W){if(W===null){J.consume(W);return}return J.enter("data"),J.consume(W),Y}function Y(W){if(K(W))return J.exit("data"),z(W);return J.consume(W),Y}function K(W){if(W===null)return!0;let B=X[W],q=-1;if(B)while(++q<B.length){let U=B[q];if(!U.previous||U.previous.call(Q,Q.previous))return!0}return!1}}}function mk($){return Z;function Z(J,Q){let X=-1,z;while(++X<=J.length)if(z===void 0){if(J[X]&&J[X][1].type==="data")z=X,X++}else if(!J[X]||J[X][1].type!=="data"){if(X!==z+2)J[z][1].end=J[X-1][1].end,J.splice(z+2,X-z-2),X=z+2;z=void 0}return $?$(J,Q):J}}function L00($,Z){let J=0;while(++J<=$.length)if((J===$.length||$[J][1].type==="lineEnding")&&$[J-1][1].type==="data"){let Q=$[J-1][1],X=Z.sliceStream(Q),z=X.length,G=-1,H=0,Y;while(z--){let K=X[z];if(typeof K==="string"){G=K.length;while(K.charCodeAt(G-1)===32)H++,G--;if(G)break;G=-1}else if(K===-2)Y=!0,H++;else if(K===-1);else{z++;break}}if(Z._contentTypeTextTrailing&&J===$.length)H=0;if(H){let K={type:J===$.length||Y||H<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:z?G:Q.start._bufferIndex+G,_index:Q.start._index+z,line:Q.end.line,column:Q.end.column-H,offset:Q.end.offset-H},end:{...Q.end}};if(Q.end={...K.start},Q.start.offset===Q.end.offset)Object.assign(Q,K);else $.splice(J,0,["enter",K,Z],["exit",K,Z]),J+=2}J++}return $}var ON={};_4(ON,{text:()=>P00,string:()=>O00,insideSpan:()=>w00,flowInitial:()=>_00,flow:()=>D00,document:()=>M00,disable:()=>T00,contentInitial:()=>A00,attentionMarkers:()=>j00});var M00={[42]:f8,[43]:f8,[45]:f8,[48]:f8,[49]:f8,[50]:f8,[51]:f8,[52]:f8,[53]:f8,[54]:f8,[55]:f8,[56]:f8,[57]:f8,[62]:PK},A00={[91]:FN},_00={[-2]:mQ,[-1]:mQ,[32]:mQ},D00={[35]:VN,[42]:z7,[45]:[IK,z7],[60]:MN,[61]:IK,[95]:z7,[96]:TK,[126]:TK},O00={[38]:jK,[92]:wK},P00={[-5]:uQ,[-4]:uQ,[-3]:uQ,[33]:_N,[38]:jK,[42]:fQ,[60]:[WN,AN],[91]:DN,[92]:[NN,wK],[93]:X7,[95]:fQ,[96]:BN},w00={null:[fQ,hk]},j00={null:[42,95]},T00={null:[]};function pk($,Z,J){let Q={_bufferIndex:-1,_index:0,line:J&&J.line||1,column:J&&J.column||1,offset:J&&J.offset||0},X={},z=[],G=[],H=[],Y=!0,K={attempt:y(E),check:y(I),consume:O,enter:D,exit:A,interrupt:y(I,{interrupt:!0})},W={code:null,containerState:{},defineSkip:V,events:[],now:L,parser:$,previous:null,sliceSerialize:F,sliceStream:N,write:U},B=Z.tokenize.call(W,K),q;if(Z.resolveAll)z.push(Z);return W;function U(S){if(G=t8(G,S),M(),G[G.length-1]!==null)return[];return C(Z,0),W.events=x6(z,W.events,W),W.events}function F(S,w){return E00(N(S),w)}function N(S){return C00(G,S)}function L(){let{_bufferIndex:S,_index:w,line:T,column:R,offset:b}=Q;return{_bufferIndex:S,_index:w,line:T,column:R,offset:b}}function V(S){X[S.line]=S.column,k()}function M(){let S;while(Q._index<G.length){let w=G[Q._index];if(typeof w==="string"){if(S=Q._index,Q._bufferIndex<0)Q._bufferIndex=0;while(Q._index===S&&Q._bufferIndex<w.length)_(w.charCodeAt(Q._bufferIndex))}else _(w)}}function _(S){Y=void 0,q=S,B=B(S)}function O(S){if(b0(S))Q.line++,Q.column=1,Q.offset+=S===-3?2:1,k();else if(S!==-1)Q.column++,Q.offset++;if(Q._bufferIndex<0)Q._index++;else if(Q._bufferIndex++,Q._bufferIndex===G[Q._index].length)Q._bufferIndex=-1,Q._index++;W.previous=S,Y=!0}function D(S,w){let T=w||{};return T.type=S,T.start=L(),W.events.push(["enter",T,W]),H.push(T),T}function A(S){let w=H.pop();return w.end=L(),W.events.push(["exit",w,W]),w}function E(S,w){C(S,w.from)}function I(S,w){w.restore()}function y(S,w){return T;function T(R,b,g){let u,j,t,Q0;return Array.isArray(R)?e(R):("tokenize"in R)?e([R]):x(R);function x(B0){return X0;function X0(Y0){let V0=Y0!==null&&B0[Y0],i=Y0!==null&&B0.null,$0=[...Array.isArray(V0)?V0:V0?[V0]:[],...Array.isArray(i)?i:i?[i]:[]];return e($0)(Y0)}}function e(B0){if(u=B0,j=0,B0.length===0)return g;return M0(B0[j])}function M0(B0){return X0;function X0(Y0){if(Q0=h(),t=B0,!B0.partial)W.currentConstruct=B0;if(B0.name&&W.parser.constructs.disable.null.includes(B0.name))return H0(Y0);return B0.tokenize.call(w?Object.assign(Object.create(W),w):W,K,l,H0)(Y0)}}function l(B0){return Y=!0,S(t,Q0),b}function H0(B0){if(Y=!0,Q0.restore(),++j<u.length)return M0(u[j]);return g}}}function C(S,w){if(S.resolveAll&&!z.includes(S))z.push(S);if(S.resolve)u1(W.events,w,W.events.length-w,S.resolve(W.events.slice(w),W));if(S.resolveTo)W.events=S.resolveTo(W.events,W)}function h(){let S=L(),w=W.previous,T=W.currentConstruct,R=W.events.length,b=Array.from(H);return{from:R,restore:g};function g(){Q=S,W.previous=w,W.currentConstruct=T,W.events.length=R,H=b,k()}}function k(){if(Q.line in X&&Q.column<2)Q.column=X[Q.line],Q.offset+=X[Q.line]-1}}function C00($,Z){let J=Z.start._index,Q=Z.start._bufferIndex,X=Z.end._index,z=Z.end._bufferIndex,G;if(J===X)G=[$[J].slice(Q,z)];else{if(G=$.slice(J,X),Q>-1){let H=G[0];if(typeof H==="string")G[0]=H.slice(Q);else G.shift()}if(z>0)G.push($[X].slice(0,z))}return G}function E00($,Z){let J=-1,Q=[],X;while(++J<$.length){let z=$[J],G;if(typeof z==="string")G=z;else switch(z){case-5:{G="\r";break}case-4:{G=`
31
+ `;break}case-3:{G=`\r
32
+ `;break}case-2:{G=Z?" ":"\t";break}case-1:{if(!Z&&X)continue;G=" ";break}default:G=String.fromCharCode(z)}X=z===-2,Q.push(G)}return Q.join("")}function PN($){let Q={constructs:DK([ON,...($||{}).extensions||[]]),content:X(Sk),defined:[],document:X(Ik),flow:X(xk),lazy:{},string:X(gk),text:X(vk)};return Q;function X(z){return G;function G(H){return pk(Q,z,H)}}}function wN($){while(!CK($));return $}var uk=/[\0\t\n\r]/g;function jN(){let $=1,Z="",J=!0,Q;return X;function X(z,G,H){let Y=[],K,W,B,q,U;if(z=Z+(typeof z==="string"?z.toString():new TextDecoder(G||void 0).decode(z)),B=0,Z="",J){if(z.charCodeAt(0)===65279)B++;J=void 0}while(B<z.length){if(uk.lastIndex=B,K=uk.exec(z),q=K&&K.index!==void 0?K.index:z.length,U=z.charCodeAt(q),!K){Z=z.slice(B);break}if(U===10&&B===q&&Q)Y.push(-3),Q=void 0;else{if(Q)Y.push(-5),Q=void 0;if(B<q)Y.push(z.slice(B,q)),$+=q-B;switch(U){case 0:{Y.push(65533),$++;break}case 9:{W=Math.ceil($/4)*4,Y.push(-2);while($++<W)Y.push(-1);break}case 10:{Y.push(-4),$=1;break}default:Q=!0,$=1}}B=q+1}if(H){if(Q)Y.push(-5);if(Z)Y.push(Z);Y.push(null)}return Y}}var S00=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function ck($){return $.replace(S00,k00)}function k00($,Z,J){if(Z)return Z;if(J.charCodeAt(0)===35){let X=J.charCodeAt(1),z=X===120||X===88;return OK(J.slice(z?2:1),z?16:10)}return s$(J)||$}var lk={}.hasOwnProperty;function TN($,Z,J){if(Z&&typeof Z==="object")J=Z,Z=void 0;return I00(J)(wN(PN(J).document().write(jN()($,Z,!0))))}function I00($){let Z={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:z(f),autolinkProtocol:y,autolinkEmail:y,atxHeading:z(J0),blockQuote:z(Y0),characterEscape:y,characterReference:y,codeFenced:z(V0),codeFencedFenceInfo:G,codeFencedFenceMeta:G,codeIndented:z(V0,G),codeText:z(i,G),codeTextData:y,data:y,codeFlowValue:y,definition:z($0),definitionDestinationString:G,definitionLabelString:G,definitionTitleString:G,emphasis:z(Z0),hardBreakEscape:z(n),hardBreakTrailing:z(n),htmlFlow:z(m,G),htmlFlowData:y,htmlText:z(m,G),htmlTextData:y,image:z(c),label:G,link:z(f),listItem:z(o),listItemValue:q,listOrdered:z(a,B),listUnordered:z(a),paragraph:z(N0),reference:x,referenceString:G,resourceDestinationString:G,resourceTitleString:G,setextHeading:z(J0),strong:z(j0),thematicBreak:z(u0)},exit:{atxHeading:Y(),atxHeadingSequence:D,autolink:Y(),autolinkEmail:X0,autolinkProtocol:B0,blockQuote:Y(),characterEscapeValue:C,characterReferenceMarkerHexadecimal:M0,characterReferenceMarkerNumeric:M0,characterReferenceValue:l,characterReference:H0,codeFenced:Y(L),codeFencedFence:N,codeFencedFenceInfo:U,codeFencedFenceMeta:F,codeFlowValue:C,codeIndented:Y(V),codeText:Y(T),codeTextData:C,data:C,definition:Y(),definitionDestinationString:O,definitionLabelString:M,definitionTitleString:_,emphasis:Y(),hardBreakEscape:Y(k),hardBreakTrailing:Y(k),htmlFlow:Y(S),htmlFlowData:C,htmlText:Y(w),htmlTextData:C,image:Y(b),label:u,labelText:g,lineEnding:h,link:Y(R),listItem:Y(),listOrdered:Y(),listUnordered:Y(),paragraph:Y(),referenceString:e,resourceDestinationString:j,resourceTitleString:t,resource:Q0,setextHeading:Y(I),setextHeadingLineSequence:E,setextHeadingText:A,strong:Y(),thematicBreak:Y()}};ik(Z,($||{}).mdastExtensions||[]);let J={};return Q;function Q(p){let r={type:"root",children:[]},z0={stack:[r],tokenStack:[],config:Z,enter:H,exit:K,buffer:G,resume:W,data:J},L0=[],P0=-1;while(++P0<p.length)if(p[P0][1].type==="listOrdered"||p[P0][1].type==="listUnordered")if(p[P0][0]==="enter")L0.push(P0);else{let g0=L0.pop();P0=X(p,g0,P0)}P0=-1;while(++P0<p.length){let g0=Z[p[P0][0]];if(lk.call(g0,p[P0][1].type))g0[p[P0][1].type].call(Object.assign({sliceSerialize:p[P0][2].sliceSerialize},z0),p[P0][1])}if(z0.tokenStack.length>0){let g0=z0.tokenStack[z0.tokenStack.length-1];(g0[1]||dk).call(z0,void 0,g0[0])}r.position={start:h6(p.length>0?p[0][1].start:{line:1,column:1,offset:0}),end:h6(p.length>0?p[p.length-2][1].end:{line:1,column:1,offset:0})},P0=-1;while(++P0<Z.transforms.length)r=Z.transforms[P0](r)||r;return r}function X(p,r,z0){let L0=r-1,P0=-1,g0=!1,e0,U5,d0,R0;while(++L0<=z0){let G0=p[L0];switch(G0[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{if(G0[0]==="enter")P0++;else P0--;R0=void 0;break}case"lineEndingBlank":{if(G0[0]==="enter"){if(e0&&!R0&&!P0&&!d0)d0=L0;R0=void 0}break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:R0=void 0}if(!P0&&G0[0]==="enter"&&G0[1].type==="listItemPrefix"||P0===-1&&G0[0]==="exit"&&(G0[1].type==="listUnordered"||G0[1].type==="listOrdered")){if(e0){let A0=L0;U5=void 0;while(A0--){let v0=p[A0];if(v0[1].type==="lineEnding"||v0[1].type==="lineEndingBlank"){if(v0[0]==="exit")continue;if(U5)p[U5][1].type="lineEndingBlank",g0=!0;v0[1].type="lineEnding",U5=A0}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(d0&&(!U5||d0<U5))e0._spread=!0;e0.end=Object.assign({},U5?p[U5][1].start:G0[1].end),p.splice(U5||L0,0,["exit",e0,G0[2]]),L0++,z0++}if(G0[1].type==="listItemPrefix"){let A0={type:"listItem",_spread:!1,start:Object.assign({},G0[1].start),end:void 0};e0=A0,p.splice(L0,0,["enter",A0,G0[2]]),L0++,z0++,d0=void 0,R0=!0}}}return p[r][1]._spread=g0,z0}function z(p,r){return z0;function z0(L0){if(H.call(this,p(L0),L0),r)r.call(this,L0)}}function G(){this.stack.push({type:"fragment",children:[]})}function H(p,r,z0){this.stack[this.stack.length-1].children.push(p),this.stack.push(p),this.tokenStack.push([r,z0||void 0]),p.position={start:h6(r.start),end:void 0}}function Y(p){return r;function r(z0){if(p)p.call(this,z0);K.call(this,z0)}}function K(p,r){let z0=this.stack.pop(),L0=this.tokenStack.pop();if(!L0)throw Error("Cannot close `"+p.type+"` ("+y6({start:p.start,end:p.end})+"): it’s not open");else if(L0[0].type!==p.type)if(r)r.call(this,p,L0[0]);else(L0[1]||dk).call(this,p,L0[0]);z0.position.end=h6(p.end)}function W(){return $7(this.stack.pop())}function B(){this.data.expectingFirstListItemValue=!0}function q(p){if(this.data.expectingFirstListItemValue){let r=this.stack[this.stack.length-2];r.start=Number.parseInt(this.sliceSerialize(p),10),this.data.expectingFirstListItemValue=void 0}}function U(){let p=this.resume(),r=this.stack[this.stack.length-1];r.lang=p}function F(){let p=this.resume(),r=this.stack[this.stack.length-1];r.meta=p}function N(){if(this.data.flowCodeInside)return;this.buffer(),this.data.flowCodeInside=!0}function L(){let p=this.resume(),r=this.stack[this.stack.length-1];r.value=p.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function V(){let p=this.resume(),r=this.stack[this.stack.length-1];r.value=p.replace(/(\r?\n|\r)$/g,"")}function M(p){let r=this.resume(),z0=this.stack[this.stack.length-1];z0.label=r,z0.identifier=v8(this.sliceSerialize(p)).toLowerCase()}function _(){let p=this.resume(),r=this.stack[this.stack.length-1];r.title=p}function O(){let p=this.resume(),r=this.stack[this.stack.length-1];r.url=p}function D(p){let r=this.stack[this.stack.length-1];if(!r.depth){let z0=this.sliceSerialize(p).length;r.depth=z0}}function A(){this.data.setextHeadingSlurpLineEnding=!0}function E(p){let r=this.stack[this.stack.length-1];r.depth=this.sliceSerialize(p).codePointAt(0)===61?1:2}function I(){this.data.setextHeadingSlurpLineEnding=void 0}function y(p){let z0=this.stack[this.stack.length-1].children,L0=z0[z0.length-1];if(!L0||L0.type!=="text")L0=h0(),L0.position={start:h6(p.start),end:void 0},z0.push(L0);this.stack.push(L0)}function C(p){let r=this.stack.pop();r.value+=this.sliceSerialize(p),r.position.end=h6(p.end)}function h(p){let r=this.stack[this.stack.length-1];if(this.data.atHardBreak){let z0=r.children[r.children.length-1];z0.position.end=h6(p.end),this.data.atHardBreak=void 0;return}if(!this.data.setextHeadingSlurpLineEnding&&Z.canContainEols.includes(r.type))y.call(this,p),C.call(this,p)}function k(){this.data.atHardBreak=!0}function S(){let p=this.resume(),r=this.stack[this.stack.length-1];r.value=p}function w(){let p=this.resume(),r=this.stack[this.stack.length-1];r.value=p}function T(){let p=this.resume(),r=this.stack[this.stack.length-1];r.value=p}function R(){let p=this.stack[this.stack.length-1];if(this.data.inReference){let r=this.data.referenceType||"shortcut";p.type+="Reference",p.referenceType=r,delete p.url,delete p.title}else delete p.identifier,delete p.label;this.data.referenceType=void 0}function b(){let p=this.stack[this.stack.length-1];if(this.data.inReference){let r=this.data.referenceType||"shortcut";p.type+="Reference",p.referenceType=r,delete p.url,delete p.title}else delete p.identifier,delete p.label;this.data.referenceType=void 0}function g(p){let r=this.sliceSerialize(p),z0=this.stack[this.stack.length-2];z0.label=ck(r),z0.identifier=v8(r).toLowerCase()}function u(){let p=this.stack[this.stack.length-1],r=this.resume(),z0=this.stack[this.stack.length-1];if(this.data.inReference=!0,z0.type==="link"){let L0=p.children;z0.children=L0}else z0.alt=r}function j(){let p=this.resume(),r=this.stack[this.stack.length-1];r.url=p}function t(){let p=this.resume(),r=this.stack[this.stack.length-1];r.title=p}function Q0(){this.data.inReference=void 0}function x(){this.data.referenceType="collapsed"}function e(p){let r=this.resume(),z0=this.stack[this.stack.length-1];z0.label=r,z0.identifier=v8(this.sliceSerialize(p)).toLowerCase(),this.data.referenceType="full"}function M0(p){this.data.characterReferenceType=p.type}function l(p){let r=this.sliceSerialize(p),z0=this.data.characterReferenceType,L0;if(z0)L0=OK(r,z0==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0;else L0=s$(r);let P0=this.stack[this.stack.length-1];P0.value+=L0}function H0(p){let r=this.stack.pop();r.position.end=h6(p.end)}function B0(p){C.call(this,p);let r=this.stack[this.stack.length-1];r.url=this.sliceSerialize(p)}function X0(p){C.call(this,p);let r=this.stack[this.stack.length-1];r.url="mailto:"+this.sliceSerialize(p)}function Y0(){return{type:"blockquote",children:[]}}function V0(){return{type:"code",lang:null,meta:null,value:""}}function i(){return{type:"inlineCode",value:""}}function $0(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Z0(){return{type:"emphasis",children:[]}}function J0(){return{type:"heading",depth:0,children:[]}}function n(){return{type:"break"}}function m(){return{type:"html",value:""}}function c(){return{type:"image",title:null,url:"",alt:null}}function f(){return{type:"link",title:null,url:"",children:[]}}function a(p){return{type:"list",ordered:p.type==="listOrdered",start:null,spread:p._spread,children:[]}}function o(p){return{type:"listItem",spread:p._spread,checked:null,children:[]}}function N0(){return{type:"paragraph",children:[]}}function j0(){return{type:"strong",children:[]}}function h0(){return{type:"text",value:""}}function u0(){return{type:"thematicBreak"}}}function h6($){return{line:$.line,column:$.column,offset:$.offset}}function ik($,Z){let J=-1;while(++J<Z.length){let Q=Z[J];if(Array.isArray(Q))ik($,Q);else R00($,Q)}}function R00($,Z){let J;for(J in Z)if(lk.call(Z,J))switch(J){case"canContainEols":{let Q=Z[J];if(Q)$[J].push(...Q);break}case"transforms":{let Q=Z[J];if(Q)$[J].push(...Q);break}case"enter":case"exit":{let Q=Z[J];if(Q)Object.assign($[J],Q);break}}}function dk($,Z){if($)throw Error("Cannot close `"+$.type+"` ("+y6({start:$.start,end:$.end})+"): a different token (`"+Z.type+"`, "+y6({start:Z.start,end:Z.end})+") is open");else throw Error("Cannot close document, a token (`"+Z.type+"`, "+y6({start:Z.start,end:Z.end})+") is still open")}function RK($){let Z=this;Z.parser=J;function J(Q){return TN(Q,{...Z.data("settings"),...$,extensions:Z.data("micromarkExtensions")||[],mdastExtensions:Z.data("fromMarkdownExtensions")||[]})}}var yK=-1,t$=0,G7=1,e$=2,cQ=3,dQ=4,lQ=5,iQ=6,bK=7,xK=8;var rk=typeof self==="object"?self:globalThis,y00=($,Z)=>{let J=(X,z)=>{return $.set(z,X),X},Q=(X)=>{if($.has(X))return $.get(X);let[z,G]=Z[X];switch(z){case t$:case yK:return J(G,X);case G7:{let H=J([],X);for(let Y of G)H.push(Q(Y));return H}case e$:{let H=J({},X);for(let[Y,K]of G)H[Q(Y)]=Q(K);return H}case cQ:return J(new Date(G),X);case dQ:{let{source:H,flags:Y}=G;return J(new RegExp(H,Y),X)}case lQ:{let H=J(new Map,X);for(let[Y,K]of G)H.set(Q(Y),Q(K));return H}case iQ:{let H=J(new Set,X);for(let Y of G)H.add(Q(Y));return H}case bK:{let{name:H,message:Y}=G;return J(new rk[H](Y),X)}case xK:return J(BigInt(G),X);case"BigInt":return J(Object(BigInt(G)),X);case"ArrayBuffer":return J(new Uint8Array(G).buffer,G);case"DataView":{let{buffer:H}=new Uint8Array(G);return J(new DataView(H),G)}}return J(new rk[z](G),X)};return Q},CN=($)=>y00(new Map,$)(0);var $Z="",{toString:b00}={},{keys:x00}=Object,rQ=($)=>{let Z=typeof $;if(Z!=="object"||!$)return[t$,Z];let J=b00.call($).slice(8,-1);switch(J){case"Array":return[G7,$Z];case"Object":return[e$,$Z];case"Date":return[cQ,$Z];case"RegExp":return[dQ,$Z];case"Map":return[lQ,$Z];case"Set":return[iQ,$Z];case"DataView":return[G7,J]}if(J.includes("Array"))return[G7,J];if(J.includes("Error"))return[bK,J];return[e$,J]},hK=([$,Z])=>$===t$&&(Z==="function"||Z==="symbol"),h00=($,Z,J,Q)=>{let X=(G,H)=>{let Y=Q.push(G)-1;return J.set(H,Y),Y},z=(G)=>{if(J.has(G))return J.get(G);let[H,Y]=rQ(G);switch(H){case t$:{let W=G;switch(Y){case"bigint":H=xK,W=G.toString();break;case"function":case"symbol":if($)throw TypeError("unable to serialize "+Y);W=null;break;case"undefined":return X([yK],G)}return X([H,W],G)}case G7:{if(Y){let q=G;if(Y==="DataView")q=new Uint8Array(G.buffer);else if(Y==="ArrayBuffer")q=new Uint8Array(G);return X([Y,[...q]],G)}let W=[],B=X([H,W],G);for(let q of G)W.push(z(q));return B}case e$:{if(Y)switch(Y){case"BigInt":return X([Y,G.toString()],G);case"Boolean":case"Number":case"String":return X([Y,G.valueOf()],G)}if(Z&&"toJSON"in G)return z(G.toJSON());let W=[],B=X([H,W],G);for(let q of x00(G))if($||!hK(rQ(G[q])))W.push([z(q),z(G[q])]);return B}case cQ:return X([H,G.toISOString()],G);case dQ:{let{source:W,flags:B}=G;return X([H,{source:W,flags:B}],G)}case lQ:{let W=[],B=X([H,W],G);for(let[q,U]of G)if($||!(hK(rQ(q))||hK(rQ(U))))W.push([z(q),z(U)]);return B}case iQ:{let W=[],B=X([H,W],G);for(let q of G)if($||!hK(rQ(q)))W.push(z(q));return B}}let{message:K}=G;return X([H,{name:Y,message:K}],G)};return z},EN=($,{json:Z,lossy:J}={})=>{let Q=[];return h00(!(Z||J),!!Z,new Map,Q)($),Q};var ZZ=typeof structuredClone==="function"?($,Z)=>Z&&(("json"in Z)||("lossy"in Z))?CN(EN($,Z)):structuredClone($):($,Z)=>CN(EN($,Z));function g00($,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 v00($,Z){return"Back to reference "+($+1)+(Z>1?"-"+Z:"")}function ak($){let Z=typeof $.options.clobberPrefix==="string"?$.options.clobberPrefix:"user-content-",J=$.options.footnoteBackContent||g00,Q=$.options.footnoteBackLabel||v00,X=$.options.footnoteLabel||"Footnotes",z=$.options.footnoteLabelTagName||"h2",G=$.options.footnoteLabelProperties||{className:["sr-only"]},H=[],Y=-1;while(++Y<$.footnoteOrder.length){let K=$.footnoteById.get($.footnoteOrder[Y]);if(!K)continue;let W=$.all(K),B=String(K.identifier).toUpperCase(),q=Q2(B.toLowerCase()),U=0,F=[],N=$.footnoteCounts.get(B);while(N!==void 0&&++U<=N){if(F.length>0)F.push({type:"text",value:" "});let M=typeof J==="string"?J:J(Y,U);if(typeof M==="string")M={type:"text",value:M};F.push({type:"element",tagName:"a",properties:{href:"#"+Z+"fnref-"+q+(U>1?"-"+U:""),dataFootnoteBackref:"",ariaLabel:typeof Q==="string"?Q:Q(Y,U),className:["data-footnote-backref"]},children:Array.isArray(M)?M:[M]})}let L=W[W.length-1];if(L&&L.type==="element"&&L.tagName==="p"){let M=L.children[L.children.length-1];if(M&&M.type==="text")M.value+=" ";else L.children.push({type:"text",value:" "});L.children.push(...F)}else W.push(...F);let V={type:"element",tagName:"li",properties:{id:Z+"fn-"+q},children:$.wrap(W,!0)};$.patch(K,V),H.push(V)}if(H.length===0)return;return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:z,properties:{...ZZ(G),id:"footnote-label"},children:[{type:"text",value:X}]},{type:"text",value:`
33
+ `},{type:"element",tagName:"ol",properties:{},children:$.wrap(H,!0)},{type:"text",value:`
34
+ `}]}}var W9=function($){if($===null||$===void 0)return u00;if(typeof $==="function")return gK($);if(typeof $==="object")return Array.isArray($)?f00($):m00($);if(typeof $==="string")return p00($);throw Error("Expected function, string, or object as test")};function f00($){let Z=[],J=-1;while(++J<$.length)Z[J]=W9($[J]);return gK(Q);function Q(...X){let z=-1;while(++z<Z.length)if(Z[z].apply(this,X))return!0;return!1}}function m00($){let Z=$;return gK(J);function J(Q){let X=Q,z;for(z in $)if(X[z]!==Z[z])return!1;return!0}}function p00($){return gK(Z);function Z(J){return J&&J.type===$}}function gK($){return Z;function Z(J,Q,X){return Boolean(c00(J)&&$.call(this,J,typeof Q==="number"?Q:void 0,X||void 0))}}function u00(){return!0}function c00($){return $!==null&&typeof $==="object"&&"type"in $}function nk($){return $}var ok=[],vK=!0,H7=!1,fK="skip";function aQ($,Z,J,Q){let X;if(typeof Z==="function"&&typeof J!=="function")Q=J,J=Z;else X=Z;let z=W9(X),G=Q?-1:1;H($,void 0,[])();function H(Y,K,W){let B=Y&&typeof Y==="object"?Y:{};if(typeof B.type==="string"){let U=typeof B.tagName==="string"?B.tagName:typeof B.name==="string"?B.name:void 0;Object.defineProperty(q,"name",{value:"node ("+nk(Y.type+(U?"<"+U+">":""))+")"})}return q;function q(){let U=ok,F,N,L;if(!Z||z(Y,K,W[W.length-1]||void 0)){if(U=d00(J(Y,W)),U[0]===H7)return U}if("children"in Y&&Y.children){let V=Y;if(V.children&&U[0]!==fK){N=(Q?V.children.length:-1)+G,L=W.concat(V);while(N>-1&&N<V.children.length){let M=V.children[N];if(F=H(M,N,L)(),F[0]===H7)return F;N=typeof F[1]==="number"?F[1]:N+G}}}return U}}}function d00($){if(Array.isArray($))return $;if(typeof $==="number")return[vK,$];return $===null||$===void 0?ok:[$]}function y9($,Z,J,Q){let X,z,G;if(typeof Z==="function"&&typeof J!=="function")z=void 0,G=Z,X=J;else z=Z,G=J,X=Q;aQ($,z,H,X);function H(Y,K){let W=K[K.length-1],B=W?W.children.indexOf(Y):void 0;return G(Y,B,W)}}function sk($,Z){let J={type:"element",tagName:"blockquote",properties:{},children:$.wrap($.all(Z),!0)};return $.patch(Z,J),$.applyData(Z,J)}function tk($,Z){let J={type:"element",tagName:"br",properties:{},children:[]};return $.patch(Z,J),[$.applyData(Z,J),{type:"text",value:`
35
+ `}]}function ek($,Z){let J=Z.value?Z.value+`
36
+ `:"",Q={},X=Z.lang?Z.lang.split(/\s+/):[];if(X.length>0)Q.className=["language-"+X[0]];let z={type:"element",tagName:"code",properties:Q,children:[{type:"text",value:J}]};if(Z.meta)z.data={meta:Z.meta};return $.patch(Z,z),z=$.applyData(Z,z),z={type:"element",tagName:"pre",properties:{},children:[z]},$.patch(Z,z),z}function $I($,Z){let J={type:"element",tagName:"del",properties:{},children:$.all(Z)};return $.patch(Z,J),$.applyData(Z,J)}function ZI($,Z){let J={type:"element",tagName:"em",properties:{},children:$.all(Z)};return $.patch(Z,J),$.applyData(Z,J)}function JI($,Z){let J=typeof $.options.clobberPrefix==="string"?$.options.clobberPrefix:"user-content-",Q=String(Z.identifier).toUpperCase(),X=Q2(Q.toLowerCase()),z=$.footnoteOrder.indexOf(Q),G,H=$.footnoteCounts.get(Q);if(H===void 0)H=0,$.footnoteOrder.push(Q),G=$.footnoteOrder.length;else G=z+1;H+=1,$.footnoteCounts.set(Q,H);let Y={type:"element",tagName:"a",properties:{href:"#"+J+"fn-"+X,id:J+"fnref-"+X+(H>1?"-"+H:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(G)}]};$.patch(Z,Y);let K={type:"element",tagName:"sup",properties:{},children:[Y]};return $.patch(Z,K),$.applyData(Z,K)}function QI($,Z){let J={type:"element",tagName:"h"+Z.depth,properties:{},children:$.all(Z)};return $.patch(Z,J),$.applyData(Z,J)}function XI($,Z){if($.options.allowDangerousHtml){let J={type:"raw",value:Z.value};return $.patch(Z,J),$.applyData(Z,J)}return}function mK($,Z){let J=Z.referenceType,Q="]";if(J==="collapsed")Q+="[]";else if(J==="full")Q+="["+(Z.label||Z.identifier)+"]";if(Z.type==="imageReference")return[{type:"text",value:"!["+Z.alt+Q}];let X=$.all(Z),z=X[0];if(z&&z.type==="text")z.value="["+z.value;else X.unshift({type:"text",value:"["});let G=X[X.length-1];if(G&&G.type==="text")G.value+=Q;else X.push({type:"text",value:Q});return X}function zI($,Z){let J=String(Z.identifier).toUpperCase(),Q=$.definitionById.get(J);if(!Q)return mK($,Z);let X={src:Q2(Q.url||""),alt:Z.alt};if(Q.title!==null&&Q.title!==void 0)X.title=Q.title;let z={type:"element",tagName:"img",properties:X,children:[]};return $.patch(Z,z),$.applyData(Z,z)}function GI($,Z){let J={src:Q2(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 Q={type:"element",tagName:"img",properties:J,children:[]};return $.patch(Z,Q),$.applyData(Z,Q)}function HI($,Z){let J={type:"text",value:Z.value.replace(/\r?\n|\r/g," ")};$.patch(Z,J);let Q={type:"element",tagName:"code",properties:{},children:[J]};return $.patch(Z,Q),$.applyData(Z,Q)}function YI($,Z){let J=String(Z.identifier).toUpperCase(),Q=$.definitionById.get(J);if(!Q)return mK($,Z);let X={href:Q2(Q.url||"")};if(Q.title!==null&&Q.title!==void 0)X.title=Q.title;let z={type:"element",tagName:"a",properties:X,children:$.all(Z)};return $.patch(Z,z),$.applyData(Z,z)}function KI($,Z){let J={href:Q2(Z.url)};if(Z.title!==null&&Z.title!==void 0)J.title=Z.title;let Q={type:"element",tagName:"a",properties:J,children:$.all(Z)};return $.patch(Z,Q),$.applyData(Z,Q)}function WI($,Z,J){let Q=$.all(Z),X=J?l00(J):BI(Z),z={},G=[];if(typeof Z.checked==="boolean"){let W=Q[0],B;if(W&&W.type==="element"&&W.tagName==="p")B=W;else B={type:"element",tagName:"p",properties:{},children:[]},Q.unshift(B);if(B.children.length>0)B.children.unshift({type:"text",value:" "});B.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:Z.checked,disabled:!0},children:[]}),z.className=["task-list-item"]}let H=-1;while(++H<Q.length){let W=Q[H];if(X||H!==0||W.type!=="element"||W.tagName!=="p")G.push({type:"text",value:`
37
+ `});if(W.type==="element"&&W.tagName==="p"&&!X)G.push(...W.children);else G.push(W)}let Y=Q[Q.length-1];if(Y&&(X||Y.type!=="element"||Y.tagName!=="p"))G.push({type:"text",value:`
38
+ `});let K={type:"element",tagName:"li",properties:z,children:G};return $.patch(Z,K),$.applyData(Z,K)}function l00($){let Z=!1;if($.type==="list"){Z=$.spread||!1;let J=$.children,Q=-1;while(!Z&&++Q<J.length)Z=BI(J[Q])}return Z}function BI($){let Z=$.spread;return Z===null||Z===void 0?$.children.length>1:Z}function qI($,Z){let J={},Q=$.all(Z),X=-1;if(typeof Z.start==="number"&&Z.start!==1)J.start=Z.start;while(++X<Q.length){let G=Q[X];if(G.type==="element"&&G.tagName==="li"&&G.properties&&Array.isArray(G.properties.className)&&G.properties.className.includes("task-list-item")){J.className=["contains-task-list"];break}}let z={type:"element",tagName:Z.ordered?"ol":"ul",properties:J,children:$.wrap(Q,!0)};return $.patch(Z,z),$.applyData(Z,z)}function UI($,Z){let J={type:"element",tagName:"p",properties:{},children:$.all(Z)};return $.patch(Z,J),$.applyData(Z,J)}function FI($,Z){let J={type:"root",children:$.wrap($.all(Z))};return $.patch(Z,J),$.applyData(Z,J)}function NI($,Z){let J={type:"element",tagName:"strong",properties:{},children:$.all(Z)};return $.patch(Z,J),$.applyData(Z,J)}function VI($,Z){let J=$.all(Z),Q=J.shift(),X=[];if(Q){let G={type:"element",tagName:"thead",properties:{},children:$.wrap([Q],!0)};$.patch(Z.children[0],G),X.push(G)}if(J.length>0){let G={type:"element",tagName:"tbody",properties:{},children:$.wrap(J,!0)},H=o$(Z.children[1]),Y=_K(Z.children[Z.children.length-1]);if(H&&Y)G.position={start:H,end:Y};X.push(G)}let z={type:"element",tagName:"table",properties:{},children:$.wrap(X,!0)};return $.patch(Z,z),$.applyData(Z,z)}function LI($,Z,J){let Q=J?J.children:void 0,z=(Q?Q.indexOf(Z):1)===0?"th":"td",G=J&&J.type==="table"?J.align:void 0,H=G?G.length:Z.children.length,Y=-1,K=[];while(++Y<H){let B=Z.children[Y],q={},U=G?G[Y]:void 0;if(U)q.align=U;let F={type:"element",tagName:z,properties:q,children:[]};if(B)F.children=$.all(B),$.patch(B,F),F=$.applyData(B,F);K.push(F)}let W={type:"element",tagName:"tr",properties:{},children:$.wrap(K,!0)};return $.patch(Z,W),$.applyData(Z,W)}function MI($,Z){let J={type:"element",tagName:"td",properties:{},children:$.all(Z)};return $.patch(Z,J),$.applyData(Z,J)}function _I($){let Z=String($),J=/\r?\n|\r/g,Q=J.exec(Z),X=0,z=[];while(Q)z.push(AI(Z.slice(X,Q.index),X>0,!0),Q[0]),X=Q.index+Q[0].length,Q=J.exec(Z);return z.push(AI(Z.slice(X),X>0,!1)),z.join("")}function AI($,Z,J){let Q=0,X=$.length;if(Z){let z=$.codePointAt(Q);while(z===9||z===32)Q++,z=$.codePointAt(Q)}if(J){let z=$.codePointAt(X-1);while(z===9||z===32)X--,z=$.codePointAt(X-1)}return X>Q?$.slice(Q,X):""}function DI($,Z){let J={type:"text",value:_I(String(Z.value))};return $.patch(Z,J),$.applyData(Z,J)}function OI($,Z){let J={type:"element",tagName:"hr",properties:{},children:[]};return $.patch(Z,J),$.applyData(Z,J)}var PI={blockquote:sk,break:tk,code:ek,delete:$I,emphasis:ZI,footnoteReference:JI,heading:QI,html:XI,imageReference:zI,image:GI,inlineCode:HI,linkReference:YI,link:KI,listItem:WI,list:qI,paragraph:UI,root:FI,strong:NI,table:VI,tableCell:MI,tableRow:LI,text:DI,thematicBreak:OI,toml:pK,yaml:pK,definition:pK,footnoteDefinition:pK};function pK(){return}var SN={}.hasOwnProperty,i00={};function jI($,Z){let J=Z||i00,Q=new Map,X=new Map,z=new Map,G={...PI,...J.handlers},H={all:K,applyData:a00,definitionById:Q,footnoteById:X,footnoteCounts:z,footnoteOrder:[],handlers:G,one:Y,options:J,patch:r00,wrap:o00};return y9($,function(W){if(W.type==="definition"||W.type==="footnoteDefinition"){let B=W.type==="definition"?Q:X,q=String(W.identifier).toUpperCase();if(!B.has(q))B.set(q,W)}}),H;function Y(W,B){let q=W.type,U=H.handlers[q];if(SN.call(H.handlers,q)&&U)return U(H,W,B);if(H.options.passThrough&&H.options.passThrough.includes(q)){if("children"in W){let{children:N,...L}=W,V=ZZ(L);return V.children=H.all(W),V}return ZZ(W)}return(H.options.unknownHandler||n00)(H,W,B)}function K(W){let B=[];if("children"in W){let q=W.children,U=-1;while(++U<q.length){let F=H.one(q[U],W);if(F){if(U&&q[U-1].type==="break"){if(!Array.isArray(F)&&F.type==="text")F.value=wI(F.value);if(!Array.isArray(F)&&F.type==="element"){let N=F.children[0];if(N&&N.type==="text")N.value=wI(N.value)}}if(Array.isArray(F))B.push(...F);else B.push(F)}}}return B}}function r00($,Z){if($.position)Z.position=XN($)}function a00($,Z){let J=Z;if($&&$.data){let Q=$.data.hName,X=$.data.hChildren,z=$.data.hProperties;if(typeof Q==="string")if(J.type==="element")J.tagName=Q;else{let G="children"in J?J.children:[J];J={type:"element",tagName:Q,properties:{},children:G}}if(J.type==="element"&&z)Object.assign(J.properties,ZZ(z));if("children"in J&&J.children&&X!==null&&X!==void 0)J.children=X}return J}function n00($,Z){let J=Z.data||{},Q="value"in Z&&!(SN.call(J,"hProperties")||SN.call(J,"hChildren"))?{type:"text",value:Z.value}:{type:"element",tagName:"div",properties:{},children:$.all(Z)};return $.patch(Z,Q),$.applyData(Z,Q)}function o00($,Z){let J=[],Q=-1;if(Z)J.push({type:"text",value:`
39
+ `});while(++Q<$.length){if(Q)J.push({type:"text",value:`
40
+ `});J.push($[Q])}if(Z&&$.length>0)J.push({type:"text",value:`
41
+ `});return J}function wI($){let Z=0,J=$.charCodeAt(Z);while(J===9||J===32)Z++,J=$.charCodeAt(Z);return $.slice(Z)}function uK($,Z){let J=jI($,Z),Q=J.one($,void 0),X=ak(J),z=Array.isArray(Q)?{type:"root",children:Q}:Q||{type:"root",children:[]};if(X)x5("children"in z),z.children.push({type:"text",value:`
42
+ `},X);return z}function cK($,Z){if($&&"run"in $)return async function(J,Q){let X=uK(J,{file:Q,...Z});await $.run(X,Q)};return function(J,Q){return uK(J,{file:Q,...$||Z})}}function kN($){if($)throw $}var iK=P(bI(),1);function nQ($){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 IN(){let $=[],Z={run:J,use:Q};return Z;function J(...X){let z=-1,G=X.pop();if(typeof G!=="function")throw TypeError("Expected function as last argument, not "+G);H(null,...X);function H(Y,...K){let W=$[++z],B=-1;if(Y){G(Y);return}while(++B<X.length)if(K[B]===null||K[B]===void 0)K[B]=X[B];if(X=K,W)xI(W,H)(...K);else G(null,...K)}}function Q(X){if(typeof X!=="function")throw TypeError("Expected `middelware` to be a function, not "+X);return $.push(X),Z}}function xI($,Z){let J;return Q;function Q(...G){let H=$.length>G.length,Y;if(H)G.push(X);try{Y=$.apply(this,G)}catch(K){let W=K;if(H&&J)throw W;return X(W)}if(!H)if(Y&&Y.then&&typeof Y.then==="function")Y.then(z,X);else if(Y instanceof Error)X(Y);else z(Y)}function X(G,...H){if(!J)J=!0,Z(G,...H)}function z(G){X(null,G)}}var O2={basename:s00,dirname:t00,extname:e00,join:$50,sep:"/"};function s00($,Z){if(Z!==void 0&&typeof Z!=="string")throw TypeError('"ext" argument must be a string');oQ($);let J=0,Q=-1,X=$.length,z;if(Z===void 0||Z.length===0||Z.length>$.length){while(X--)if($.codePointAt(X)===47){if(z){J=X+1;break}}else if(Q<0)z=!0,Q=X+1;return Q<0?"":$.slice(J,Q)}if(Z===$)return"";let G=-1,H=Z.length-1;while(X--)if($.codePointAt(X)===47){if(z){J=X+1;break}}else{if(G<0)z=!0,G=X+1;if(H>-1)if($.codePointAt(X)===Z.codePointAt(H--)){if(H<0)Q=X}else H=-1,Q=G}if(J===Q)Q=G;else if(Q<0)Q=$.length;return $.slice(J,Q)}function t00($){if(oQ($),$.length===0)return".";let Z=-1,J=$.length,Q;while(--J)if($.codePointAt(J)===47){if(Q){Z=J;break}}else if(!Q)Q=!0;return Z<0?$.codePointAt(0)===47?"/":".":Z===1&&$.codePointAt(0)===47?"//":$.slice(0,Z)}function e00($){oQ($);let Z=$.length,J=-1,Q=0,X=-1,z=0,G;while(Z--){let H=$.codePointAt(Z);if(H===47){if(G){Q=Z+1;break}continue}if(J<0)G=!0,J=Z+1;if(H===46){if(X<0)X=Z;else if(z!==1)z=1}else if(X>-1)z=-1}if(X<0||J<0||z===0||z===1&&X===J-1&&X===Q+1)return"";return $.slice(X,J)}function $50(...$){let Z=-1,J;while(++Z<$.length)if(oQ($[Z]),$[Z])J=J===void 0?$[Z]:J+"/"+$[Z];return J===void 0?".":Z50(J)}function Z50($){oQ($);let Z=$.codePointAt(0)===47,J=J50($,!Z);if(J.length===0&&!Z)J=".";if(J.length>0&&$.codePointAt($.length-1)===47)J+="/";return Z?"/"+J:J}function J50($,Z){let J="",Q=0,X=-1,z=0,G=-1,H,Y;while(++G<=$.length){if(G<$.length)H=$.codePointAt(G);else if(H===47)break;else H=47;if(H===47){if(X===G-1||z===1);else if(X!==G-1&&z===2){if(J.length<2||Q!==2||J.codePointAt(J.length-1)!==46||J.codePointAt(J.length-2)!==46){if(J.length>2){if(Y=J.lastIndexOf("/"),Y!==J.length-1){if(Y<0)J="",Q=0;else J=J.slice(0,Y),Q=J.length-1-J.lastIndexOf("/");X=G,z=0;continue}}else if(J.length>0){J="",Q=0,X=G,z=0;continue}}if(Z)J=J.length>0?J+"/..":"..",Q=2}else{if(J.length>0)J+="/"+$.slice(X+1,G);else J=$.slice(X+1,G);Q=G-X-1}X=G,z=0}else if(H===46&&z>-1)z++;else z=-1}return J}function oQ($){if(typeof $!=="string")throw TypeError("Path must be a string. Received "+JSON.stringify($))}var hI={cwd:Q50};function Q50(){return"/"}function JZ($){return Boolean($!==null&&typeof $==="object"&&"href"in $&&$.href&&"protocol"in $&&$.protocol&&$.auth===void 0)}function gI($){if(typeof $==="string")$=new URL($);else if(!JZ($)){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 X50($)}function X50($){if($.hostname!==""){let Q=TypeError('File URL host must be "localhost" or empty on darwin');throw Q.code="ERR_INVALID_FILE_URL_HOST",Q}let Z=$.pathname,J=-1;while(++J<Z.length)if(Z.codePointAt(J)===37&&Z.codePointAt(J+1)===50){let Q=Z.codePointAt(J+2);if(Q===70||Q===102){let X=TypeError("File URL path must not include encoded / characters");throw X.code="ERR_INVALID_FILE_URL_PATH",X}}return decodeURIComponent(Z)}var RN=["history","path","basename","stem","extname","dirname"];class QZ{constructor($){let Z;if(!$)Z={};else if(JZ($))Z={path:$};else if(typeof $==="string"||z50($))Z={value:$};else Z=$;this.cwd="cwd"in Z?"":hI.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let J=-1;while(++J<RN.length){let X=RN[J];if(X in Z&&Z[X]!==void 0&&Z[X]!==null)this[X]=X==="history"?[...Z[X]]:Z[X]}let Q;for(Q in Z)if(!RN.includes(Q))this[Q]=Z[Q]}get basename(){return typeof this.path==="string"?O2.basename(this.path):void 0}set basename($){bN($,"basename"),yN($,"basename"),this.path=O2.join(this.dirname||"",$)}get dirname(){return typeof this.path==="string"?O2.dirname(this.path):void 0}set dirname($){vI(this.basename,"dirname"),this.path=O2.join($||"",this.basename)}get extname(){return typeof this.path==="string"?O2.extname(this.path):void 0}set extname($){if(yN($,"extname"),vI(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=O2.join(this.dirname,this.stem+($||""))}get path(){return this.history[this.history.length-1]}set path($){if(JZ($))$=gI($);if(bN($,"path"),this.path!==$)this.history.push($)}get stem(){return typeof this.path==="string"?O2.basename(this.path,this.extname):void 0}set stem($){bN($,"stem"),yN($,"stem"),this.path=O2.join(this.dirname||"",$+(this.extname||""))}fail($,Z,J){let Q=this.message($,Z,J);throw Q.fatal=!0,Q}info($,Z,J){let Q=this.message($,Z,J);return Q.fatal=void 0,Q}message($,Z,J){let Q=new o1($,Z,J);if(this.path)Q.name=this.path+":"+Q.name,Q.file=this.path;return Q.fatal=!1,this.messages.push(Q),Q}toString($){if(this.value===void 0)return"";if(typeof this.value==="string")return this.value;return new TextDecoder($||void 0).decode(this.value)}}function yN($,Z){if($&&$.includes(O2.sep))throw Error("`"+Z+"` cannot be a path: did not expect `"+O2.sep+"`")}function bN($,Z){if(!$)throw Error("`"+Z+"` cannot be empty")}function vI($,Z){if(!$)throw Error("Setting `"+Z+"` requires `path` to be set too")}function z50($){return Boolean($&&typeof $==="object"&&"byteLength"in $&&"byteOffset"in $)}var fI=function($){let Q=this.constructor.prototype,X=Q[$],z=function(){return X.apply(z,arguments)};return Object.setPrototypeOf(z,Q),z};var G50={}.hasOwnProperty;class vN extends fI{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=IN()}copy(){let $=new vN,Z=-1;while(++Z<this.attachers.length){let J=this.attachers[Z];$.use(...J)}return $.data(iK.default(!0,{},this.namespace)),$}data($,Z){if(typeof $==="string"){if(arguments.length===2)return gN("data",this.frozen),this.namespace[$]=Z,this;return G50.call(this.namespace,$)&&this.namespace[$]||void 0}if($)return gN("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 Q=Z.call($,...J);if(typeof Q==="function")this.transformers.use(Q)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse($){this.freeze();let Z=lK($),J=this.parser||this.Parser;return xN("parse",J),J(String(Z),Z)}process($,Z){let J=this;return this.freeze(),xN("process",this.parser||this.Parser),hN("process",this.compiler||this.Compiler),Z?Q(void 0,Z):new Promise(Q);function Q(X,z){let G=lK($),H=J.parse(G);J.run(H,G,function(K,W,B){if(K||!W||!B)return Y(K);let q=W,U=J.stringify(q,B);if(Y50(U))B.value=U;else B.result=U;Y(K,B)});function Y(K,W){if(K||!W)z(K);else if(X)X(W);else x5(Z,"`done` is defined if `resolve` is not"),Z(void 0,W)}}}processSync($){let Z=!1,J;return this.freeze(),xN("processSync",this.parser||this.Parser),hN("processSync",this.compiler||this.Compiler),this.process($,Q),pI("processSync","process",Z),x5(J,"we either bailed on an error or have a tree"),J;function Q(X,z){Z=!0,kN(X),J=z}}run($,Z,J){mI($),this.freeze();let Q=this.transformers;if(!J&&typeof Z==="function")J=Z,Z=void 0;return J?X(void 0,J):new Promise(X);function X(z,G){x5(typeof Z!=="function","`file` can’t be a `done` anymore, we checked");let H=lK(Z);Q.run($,H,Y);function Y(K,W,B){let q=W||$;if(K)G(K);else if(z)z(q);else x5(J,"`done` is defined if `resolve` is not"),J(void 0,q,B)}}}runSync($,Z){let J=!1,Q;return this.run($,Z,X),pI("runSync","run",J),x5(Q,"we either bailed on an error or have a tree"),Q;function X(z,G){kN(z),Q=G,J=!0}}stringify($,Z){this.freeze();let J=lK(Z),Q=this.compiler||this.Compiler;return hN("stringify",Q),mI($),Q($,J)}use($,...Z){let J=this.attachers,Q=this.namespace;if(gN("use",this.frozen),$===null||$===void 0);else if(typeof $==="function")H($,Z);else if(typeof $==="object")if(Array.isArray($))G($);else z($);else throw TypeError("Expected usable value, not `"+$+"`");return this;function X(Y){if(typeof Y==="function")H(Y,[]);else if(typeof Y==="object")if(Array.isArray(Y)){let[K,...W]=Y;H(K,W)}else z(Y);else throw TypeError("Expected usable value, not `"+Y+"`")}function z(Y){if(!("plugins"in Y)&&!("settings"in Y))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(G(Y.plugins),Y.settings)Q.settings=iK.default(!0,Q.settings,Y.settings)}function G(Y){let K=-1;if(Y===null||Y===void 0);else if(Array.isArray(Y))while(++K<Y.length){let W=Y[K];X(W)}else throw TypeError("Expected a list of plugins, not `"+Y+"`")}function H(Y,K){let W=-1,B=-1;while(++W<J.length)if(J[W][0]===Y){B=W;break}if(B===-1)J.push([Y,...K]);else if(K.length>0){let[q,...U]=K,F=J[B][1];if(nQ(F)&&nQ(q))q=iK.default(!0,F,q);J[B]=[Y,q,...U]}}}}var fN=new vN().freeze();function xN($,Z){if(typeof Z!=="function")throw TypeError("Cannot `"+$+"` without `parser`")}function hN($,Z){if(typeof Z!=="function")throw TypeError("Cannot `"+$+"` without `compiler`")}function gN($,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 mI($){if(!nQ($)||typeof $.type!=="string")throw TypeError("Expected node, got `"+$+"`")}function pI($,Z,J){if(!J)throw Error("`"+$+"` finished async. Use `"+Z+"` instead")}function lK($){return H50($)?$:new QZ($)}function H50($){return Boolean($&&typeof $==="object"&&"message"in $&&"messages"in $)}function Y50($){return typeof $==="string"||K50($)}function K50($){return Boolean($&&typeof $==="object"&&"byteLength"in $&&"byteOffset"in $)}var W50="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",uI=[],cI={allowDangerousHtml:!0},B50=/^(https?|ircs?|mailto|xmpp)$/i,q50=[{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 rK($){let Z=U50($),J=F50($);return N50(Z.runSync(Z.parse(J),J),$)}function U50($){let Z=$.rehypePlugins||uI,J=$.remarkPlugins||uI,Q=$.remarkRehypeOptions?{...$.remarkRehypeOptions,...cI}:cI;return fN().use(RK).use(J).use(cK,Q).use(Z)}function F50($){let Z=$.children||"",J=new QZ;if(typeof Z==="string")J.value=Z;else FK("Unexpected value `"+Z+"` for `children` prop, expected `string`");return J}function N50($,Z){let{allowedElements:J,allowElement:Q,components:X,disallowedElements:z,skipHtml:G,unwrapDisallowed:H}=Z,Y=Z.urlTransform||lI;for(let W of q50)if(Object.hasOwn(Z,W.from))FK("Unexpected `"+W.from+"` prop, "+(W.to?"use `"+W.to+"` instead":"remove it")+" (see <"+W50+"#"+W.id+"> for more info)");if(J&&z)FK("Unexpected combined `allowedElements` and `disallowedElements`, expected one or the other");return y9($,K),HN($,{Fragment:XZ.Fragment,components:X,ignoreInvalidStyle:!0,jsx:XZ.jsx,jsxs:XZ.jsxs,passKeys:!0,passNode:!0});function K(W,B,q){if(W.type==="raw"&&q&&typeof B==="number"){if(G)q.children.splice(B,1);else q.children[B]={type:"text",value:W.value};return B}if(W.type==="element"){let U;for(U in gQ)if(Object.hasOwn(gQ,U)&&Object.hasOwn(W.properties,U)){let F=W.properties[U],N=gQ[U];if(N===null||N.includes(W.tagName))W.properties[U]=Y(String(F||""),U,W)}}if(W.type==="element"){let U=J?!J.includes(W.tagName):z?z.includes(W.tagName):!1;if(!U&&Q&&typeof B==="number")U=!Q(W,B,q);if(U&&q&&typeof B==="number"){if(H&&W.children)q.children.splice(B,1,...W.children);else q.children.splice(B,1);return B}}}}function lI($){let Z=$.indexOf(":"),J=$.indexOf("?"),Q=$.indexOf("#"),X=$.indexOf("/");if(Z===-1||X!==-1&&Z>X||J!==-1&&Z>J||Q!==-1&&Z>Q||B50.test($.slice(0,Z)))return $;return""}var aK=function($,Z,J){let Q=W9(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(Q($.children[Z],Z,$))return $.children[Z];return};var b9=function($){if($===null||$===void 0)return M50;if(typeof $==="string")return L50($);if(typeof $==="object")return V50($);if(typeof $==="function")return mN($);throw Error("Expected function, string, or array as `test`")};function V50($){let Z=[],J=-1;while(++J<$.length)Z[J]=b9($[J]);return mN(Q);function Q(...X){let z=-1;while(++z<Z.length)if(Z[z].apply(this,X))return!0;return!1}}function L50($){return mN(Z);function Z(J){return J.tagName===$}}function mN($){return Z;function Z(J,Q,X){return Boolean(A50(J)&&$.call(this,J,typeof Q==="number"?Q:void 0,X||void 0))}}function M50($){return Boolean($&&typeof $==="object"&&"type"in $&&$.type==="element"&&"tagName"in $&&typeof $.tagName==="string")}function A50($){return $!==null&&typeof $==="object"&&"type"in $&&"tagName"in $}var iI=/\n/g,rI=/[\t ]+/g,pN=b9("br"),aI=b9(T50),_50=b9("p"),nI=b9("tr"),D50=b9(["datalist","head","noembed","noframes","noscript","rp","script","style","template","title",j50,C50]),oI=b9(["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 uN($,Z){let J=Z||{},Q="children"in $?$.children:[],X=oI($),z=eI($,{whitespace:J.whitespace||"normal",breakBefore:!1,breakAfter:!1}),G=[];if($.type==="text"||$.type==="comment")G.push(...tI($,{whitespace:z,breakBefore:!0,breakAfter:!0}));let H=-1;while(++H<Q.length)G.push(...sI(Q[H],$,{whitespace:z,breakBefore:H?void 0:X,breakAfter:H<Q.length-1?pN(Q[H+1]):X}));let Y=[],K;H=-1;while(++H<G.length){let W=G[H];if(typeof W==="number"){if(K!==void 0&&W>K)K=W}else if(W){if(K!==void 0&&K>-1)Y.push(`
43
+ `.repeat(K)||" ");K=-1,Y.push(W)}}return Y.join("")}function sI($,Z,J){if($.type==="element")return O50($,Z,J);if($.type==="text")return J.whitespace==="normal"?tI($,J):P50($);return[]}function O50($,Z,J){let Q=eI($,J),X=$.children||[],z=-1,G=[];if(D50($))return G;let H,Y;if(pN($))Y=`
44
+ `;else if(nI($)&&aK(Z,$,nI))Y=`
45
+ `;else if(_50($))H=2,Y=2;else if(oI($))H=1,Y=1;while(++z<X.length)G=G.concat(sI(X[z],$,{whitespace:Q,breakBefore:z?void 0:H,breakAfter:z<X.length-1?pN(X[z+1]):Y}));if(aI($)&&aK(Z,$,aI))G.push("\t");if(H)G.unshift(H);if(Y)G.push(Y);return G}function tI($,Z){let J=String($.value),Q=[],X=[],z=0;while(z<=J.length){iI.lastIndex=z;let Y=iI.exec(J),K=Y&&"index"in Y?Y.index:J.length;Q.push(w50(J.slice(z,K).replace(/[\u061C\u200E\u200F\u202A-\u202E\u2066-\u2069]/g,""),z===0?Z.breakBefore:!0,K===J.length?Z.breakAfter:!0)),z=K+1}let G=-1,H;while(++G<Q.length)if(Q[G].charCodeAt(Q[G].length-1)===8203||G<Q.length-1&&Q[G+1].charCodeAt(0)===8203)X.push(Q[G]),H=void 0;else if(Q[G]){if(typeof H==="number")X.push(H);X.push(Q[G]),H=0}else if(G===0||G===Q.length-1)X.push(0);return X}function P50($){return[String($.value)]}function w50($,Z,J){let Q=[],X=0,z;while(X<$.length){rI.lastIndex=X;let G=rI.exec($);if(z=G?G.index:$.length,!X&&!z&&G&&!Z)Q.push("");if(X!==z)Q.push($.slice(X,z));X=G?z+G[0].length:z}if(X!==z&&!J)Q.push("");return Q.join(" ")}function eI($,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 j50($){return Boolean(($.properties||{}).hidden)}function T50($){return $.tagName==="td"||$.tagName==="th"}function C50($){return $.tagName==="dialog"&&!($.properties||{}).open}function E50($){let Z=$.regex,J=$.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),Q="decltype\\(auto\\)",X="[a-zA-Z_]\\w*::",z="<[^<>]+>",G="(?!struct)(decltype\\(auto\\)|"+Z.optional("[a-zA-Z_]\\w*::")+"[a-zA-Z_]\\w*"+Z.optional("<[^<>]+>")+")",H={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},Y="\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)",K={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})"/})]},W={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},B={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(K,{className:"string"}),{className:"string",begin:/<.*?>/},J,$.C_BLOCK_COMMENT_MODE]},q={className:"title",begin:Z.optional("[a-zA-Z_]\\w*::")+$.IDENT_RE,relevance:0},U=Z.optional("[a-zA-Z_]\\w*::")+$.IDENT_RE+"\\s*\\(",F=["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"],L=["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"],V=["abort","abs","acos","apply","as_const","asin","atan","atan2","calloc","ceil","cerr","cin","clog","cos","cosh","cout","declval","endl","exchange","exit","exp","fabs","floor","fmod","forward","fprintf","fputs","free","frexp","fscanf","future","invoke","isalnum","isalpha","iscntrl","isdigit","isgraph","islower","isprint","ispunct","isspace","isupper","isxdigit","labs","launder","ldexp","log","log10","make_pair","make_shared","make_shared_for_overwrite","make_tuple","make_unique","malloc","memchr","memcmp","memcpy","memset","modf","move","pow","printf","putchar","puts","realloc","scanf","sin","sinh","snprintf","sprintf","sqrt","sscanf","std","stderr","stdin","stdout","strcat","strchr","strcmp","strcpy","strcspn","strlen","strncat","strncmp","strncpy","strpbrk","strrchr","strspn","strstr","swap","tan","tanh","terminate","to_underlying","tolower","toupper","vfprintf","visit","vprintf","vsprintf"],O={type:N,keyword:F,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:L},D={className:"function.dispatch",relevance:0,keywords:{_hint:V},begin:Z.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,$.IDENT_RE,Z.lookahead(/(<[^<>]+>|)\s*\(/))},A=[D,B,H,J,$.C_BLOCK_COMMENT_MODE,W,K],E={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:O,contains:A.concat([{begin:/\(/,end:/\)/,keywords:O,contains:A.concat(["self"]),relevance:0}]),relevance:0},I={className:"function",begin:"("+G+"[\\*&\\s]+)+"+U,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:O,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:"decltype\\(auto\\)",keywords:O,relevance:0},{begin:U,returnBegin:!0,contains:[q],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[K,W]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:O,relevance:0,contains:[J,$.C_BLOCK_COMMENT_MODE,K,W,H,{begin:/\(/,end:/\)/,keywords:O,relevance:0,contains:["self",J,$.C_BLOCK_COMMENT_MODE,K,W,H]}]},H,J,$.C_BLOCK_COMMENT_MODE,B]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:O,illegal:"</",classNameAliases:{"function.dispatch":"built_in"},contains:[].concat(E,I,D,A,[B,{begin:"\\b(deque|list|queue|priority_queue|pair|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array|tuple|optional|variant|function|flat_map|flat_set)\\s*<(?!<)",end:">",keywords:O,contains:["self",H]},{begin:$.IDENT_RE+"::",keywords:O},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function $R($){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=E50($),Q=J.keywords;return Q.type=[...Q.type,...Z.type],Q.literal=[...Q.literal,...Z.literal],Q.built_in=[...Q.built_in,...Z.built_in],Q._hints=Z._hints,J.name="Arduino",J.aliases=["ino"],J.supersetOf="cpp",J}function ZR($){let Z=$.regex,J={},Q={begin:/\$\{/,end:/\}/,contains:["self",{begin:/:-/,contains:[J]}]};Object.assign(J,{className:"variable",variants:[{begin:Z.concat(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},Q]});let X={className:"subst",begin:/\$\(/,end:/\)/,contains:[$.BACKSLASH_ESCAPE]},z=$.inherit($.COMMENT(),{match:[/(^|\s)/,/#.*$/],scope:{2:"comment"}}),G={begin:/<<-?\s*(?=\w+)/,starts:{contains:[$.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:"string"})]}},H={className:"string",begin:/"/,end:/"/,contains:[$.BACKSLASH_ESCAPE,J,X]};X.contains.push(H);let Y={match:/\\"/},K={className:"string",begin:/'/,end:/'/},W={match:/\\'/},B={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},$.NUMBER_MODE,J]},q=["fish","bash","zsh","sh","csh","ksh","tcsh","dash","scsh"],U=$.SHEBANG({binary:`(${q.join("|")})`,relevance:10}),F={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"],L=["true","false"],V={match:/(\/[a-z._-]+)+/},M=["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset"],_=["alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","sudo","type","typeset","ulimit","unalias"],O=["autoload","bg","bindkey","bye","cap","chdir","clone","comparguments","compcall","compctl","compdescribe","compfiles","compgroups","compquote","comptags","comptry","compvalues","dirs","disable","disown","echotc","echoti","emulate","fc","fg","float","functions","getcap","getln","history","integer","jobs","kill","limit","log","noglob","popd","print","pushd","pushln","rehash","sched","setcap","setopt","stat","suspend","ttyctl","unfunction","unhash","unlimit","unsetopt","vared","wait","whence","where","which","zcompile","zformat","zftp","zle","zmodload","zparseopts","zprof","zpty","zregexparse","zsocket","zstyle","ztcp"],D=["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:L,built_in:[...M,..._,"set","shopt",...O,...D]},contains:[U,$.SHEBANG(),F,B,z,G,V,H,Y,K,W,J]}}function JR($){let Z=$.regex,J=$.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),Q="decltype\\(auto\\)",X="[a-zA-Z_]\\w*::",z="<[^<>]+>",G="(decltype\\(auto\\)|"+Z.optional("[a-zA-Z_]\\w*::")+"[a-zA-Z_]\\w*"+Z.optional("<[^<>]+>")+")",H={className:"type",variants:[{begin:"\\b[a-z\\d_]*_t\\b"},{match:/\batomic_[a-z]{3,6}\b/}]},Y="\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)",K={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})"/})]},W={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},B={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(K,{className:"string"}),{className:"string",begin:/<.*?>/},J,$.C_BLOCK_COMMENT_MODE]},q={className:"title",begin:Z.optional("[a-zA-Z_]\\w*::")+$.IDENT_RE,relevance:0},U=Z.optional("[a-zA-Z_]\\w*::")+$.IDENT_RE+"\\s*\\(",L={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"},V=[B,H,J,$.C_BLOCK_COMMENT_MODE,W,K],M={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:L,contains:V.concat([{begin:/\(/,end:/\)/,keywords:L,contains:V.concat(["self"]),relevance:0}]),relevance:0},_={begin:"("+G+"[\\*&\\s]+)+"+U,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:L,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:"decltype\\(auto\\)",keywords:L,relevance:0},{begin:U,returnBegin:!0,contains:[$.inherit(q,{className:"title.function"})],relevance:0},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:L,relevance:0,contains:[J,$.C_BLOCK_COMMENT_MODE,K,W,H,{begin:/\(/,end:/\)/,keywords:L,relevance:0,contains:["self",J,$.C_BLOCK_COMMENT_MODE,K,W,H]}]},H,J,$.C_BLOCK_COMMENT_MODE,B]};return{name:"C",aliases:["h"],keywords:L,disableAutodetect:!0,illegal:"</",contains:[].concat(M,_,V,[B,{begin:$.IDENT_RE+"::",keywords:L},{className:"class",beginKeywords:"enum class struct union",end:/[{;:<>=]/,contains:[{beginKeywords:"final class struct"},$.TITLE_MODE]}]),exports:{preprocessor:B,strings:K,keywords:L}}}function QR($){let Z=$.regex,J=$.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),Q="decltype\\(auto\\)",X="[a-zA-Z_]\\w*::",z="<[^<>]+>",G="(?!struct)(decltype\\(auto\\)|"+Z.optional("[a-zA-Z_]\\w*::")+"[a-zA-Z_]\\w*"+Z.optional("<[^<>]+>")+")",H={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},Y="\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)",K={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})"/})]},W={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},B={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(K,{className:"string"}),{className:"string",begin:/<.*?>/},J,$.C_BLOCK_COMMENT_MODE]},q={className:"title",begin:Z.optional("[a-zA-Z_]\\w*::")+$.IDENT_RE,relevance:0},U=Z.optional("[a-zA-Z_]\\w*::")+$.IDENT_RE+"\\s*\\(",F=["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"],L=["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"],V=["abort","abs","acos","apply","as_const","asin","atan","atan2","calloc","ceil","cerr","cin","clog","cos","cosh","cout","declval","endl","exchange","exit","exp","fabs","floor","fmod","forward","fprintf","fputs","free","frexp","fscanf","future","invoke","isalnum","isalpha","iscntrl","isdigit","isgraph","islower","isprint","ispunct","isspace","isupper","isxdigit","labs","launder","ldexp","log","log10","make_pair","make_shared","make_shared_for_overwrite","make_tuple","make_unique","malloc","memchr","memcmp","memcpy","memset","modf","move","pow","printf","putchar","puts","realloc","scanf","sin","sinh","snprintf","sprintf","sqrt","sscanf","std","stderr","stdin","stdout","strcat","strchr","strcmp","strcpy","strcspn","strlen","strncat","strncmp","strncpy","strpbrk","strrchr","strspn","strstr","swap","tan","tanh","terminate","to_underlying","tolower","toupper","vfprintf","visit","vprintf","vsprintf"],O={type:N,keyword:F,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:L},D={className:"function.dispatch",relevance:0,keywords:{_hint:V},begin:Z.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,$.IDENT_RE,Z.lookahead(/(<[^<>]+>|)\s*\(/))},A=[D,B,H,J,$.C_BLOCK_COMMENT_MODE,W,K],E={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:O,contains:A.concat([{begin:/\(/,end:/\)/,keywords:O,contains:A.concat(["self"]),relevance:0}]),relevance:0},I={className:"function",begin:"("+G+"[\\*&\\s]+)+"+U,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:O,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:"decltype\\(auto\\)",keywords:O,relevance:0},{begin:U,returnBegin:!0,contains:[q],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[K,W]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:O,relevance:0,contains:[J,$.C_BLOCK_COMMENT_MODE,K,W,H,{begin:/\(/,end:/\)/,keywords:O,relevance:0,contains:["self",J,$.C_BLOCK_COMMENT_MODE,K,W,H]}]},H,J,$.C_BLOCK_COMMENT_MODE,B]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:O,illegal:"</",classNameAliases:{"function.dispatch":"built_in"},contains:[].concat(E,I,D,A,[B,{begin:"\\b(deque|list|queue|priority_queue|pair|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array|tuple|optional|variant|function|flat_map|flat_set)\\s*<(?!<)",end:">",keywords:O,contains:["self",H]},{begin:$.IDENT_RE+"::",keywords:O},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function XR($){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"],Q=["default","false","null","true"],X=["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"],z=["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"],G={keyword:X.concat(z),built_in:Z,literal:Q},H=$.inherit($.TITLE_MODE,{begin:"[a-zA-Z](\\.?\\w)*"}),Y={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},K={className:"string",begin:/"""("*)(?!")(.|\n)*?"""\1/,relevance:1},W={className:"string",begin:'@"',end:'"',contains:[{begin:'""'}]},B=$.inherit(W,{illegal:/\n/}),q={className:"subst",begin:/\{/,end:/\}/,keywords:G},U=$.inherit(q,{illegal:/\n/}),F={className:"string",begin:/\$"/,end:'"',illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},$.BACKSLASH_ESCAPE,U]},N={className:"string",begin:/\$@"/,end:'"',contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},q]},L=$.inherit(N,{illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},U]});q.contains=[N,F,W,$.APOS_STRING_MODE,$.QUOTE_STRING_MODE,Y,$.C_BLOCK_COMMENT_MODE],U.contains=[L,F,B,$.APOS_STRING_MODE,$.QUOTE_STRING_MODE,Y,$.inherit($.C_BLOCK_COMMENT_MODE,{illegal:/\n/})];let V={variants:[K,N,F,W,$.APOS_STRING_MODE,$.QUOTE_STRING_MODE]},M={begin:"<",end:">",contains:[{beginKeywords:"in out"},H]},_=$.IDENT_RE+"(<"+$.IDENT_RE+"(\\s*,\\s*"+$.IDENT_RE+")*>)?(\\[\\])?",O={begin:"@"+$.IDENT_RE,relevance:0};return{name:"C#",aliases:["cs","c#"],keywords:G,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"}},V,Y,{beginKeywords:"class interface",relevance:0,end:/[{;=]/,illegal:/[^\s:,]/,contains:[{beginKeywords:"where class"},H,M,$.C_LINE_COMMENT_MODE,$.C_BLOCK_COMMENT_MODE]},{beginKeywords:"namespace",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[H,$.C_LINE_COMMENT_MODE,$.C_BLOCK_COMMENT_MODE]},{beginKeywords:"record",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[H,M,$.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:"("+_+"\\s+)+"+$.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,end:/\s*[{;=]/,excludeEnd:!0,keywords:G,contains:[{beginKeywords:J.join(" "),relevance:0},{begin:$.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,contains:[$.TITLE_MODE,M],relevance:0},{match:/\(\)/},{className:"params",begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:G,relevance:0,contains:[V,Y,$.C_BLOCK_COMMENT_MODE]},$.C_LINE_COMMENT_MODE,$.C_BLOCK_COMMENT_MODE]},O]}}var S50=($)=>{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_-]*/}}},k50=["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"],I50=["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"],R50=[...k50,...I50],y50=["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(),b50=["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(),x50=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),h50=["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 zR($){let Z=$.regex,J=S50($),Q={begin:/-(webkit|moz|ms|o)-(?=[a-z])/},X="and or not only",z=/@-?\w[\w]*(-\w+)*/,G="[a-zA-Z-][a-zA-Z0-9_-]*",H=[$.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,Q,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:":("+b50.join("|")+")"},{begin:":(:)?("+x50.join("|")+")"}]},J.CSS_VARIABLE,{className:"attribute",begin:"\\b("+h50.join("|")+")\\b"},{begin:/:/,end:/[;}{]/,contains:[J.BLOCK_COMMENT,J.HEXCOLOR,J.IMPORTANT,J.CSS_NUMBER_MODE,...H,{begin:/(url|data-uri)\(/,end:/\)/,relevance:0,keywords:{built_in:"url data-uri"},contains:[...H,{className:"string",begin:/[^)]/,endsWithParent:!0,excludeEnd:!0}]},J.FUNCTION_DISPATCH]},{begin:Z.lookahead(/@/),end:"[{;]",relevance:0,illegal:/:/,contains:[{className:"keyword",begin:z},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{$pattern:/[a-z-]+/,keyword:"and or not only",attribute:y50.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...H,J.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+R50.join("|")+")\\b"}]}}function GR($){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 HR($){let z={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:z,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:z,illegal:/["']/}]}]}}function YR($){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 KR($){let Z=$.regex,J={className:"number",relevance:0,variants:[{begin:/([+-]+)?[\d]+_[\d_]+/},{begin:$.NUMBER_RE}]},Q=$.COMMENT();Q.variants=[{begin:/;/,end:/$/},{begin:/#/,end:/$/}];let X={className:"variable",variants:[{begin:/\$[\w\d"][\w\d_]*/},{begin:/\$\{(.*?)\}/}]},z={className:"literal",begin:/\bon|off|true|false|yes|no\b/},G={className:"string",contains:[$.BACKSLASH_ESCAPE],variants:[{begin:"'''",end:"'''",relevance:10},{begin:'"""',end:'"""',relevance:10},{begin:'"',end:'"'},{begin:"'",end:"'"}]},H={begin:/\[/,end:/\]/,contains:[Q,z,X,G,J,"self"],relevance:0},Y=/[A-Za-z0-9_-]+/,K=/"(\\"|[^"])*"/,W=/'[^']*'/,B=Z.either(Y,K,W),q=Z.concat(B,"(\\s*\\.\\s*",B,")*",Z.lookahead(/\s*=\s*[^#\s]/));return{name:"TOML, also INI",aliases:["toml"],case_insensitive:!0,illegal:/\S/,contains:[Q,{className:"section",begin:/\[+/,end:/\]+/},{begin:q,className:"attr",starts:{end:/$/,contains:[Q,H,z,X,G,J]}}]}}var zZ="[0-9](_*[0-9])*",nK=`\\.(${zZ})`,oK="[0-9a-fA-F](_*[0-9a-fA-F])*",WR={className:"number",variants:[{begin:`(\\b(${zZ})((${nK})|\\.)?|(${nK}))[eE][+-]?(${zZ})[fFdD]?\\b`},{begin:`\\b(${zZ})((${nK})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${nK})[fFdD]?\\b`},{begin:`\\b(${zZ})[fFdD]\\b`},{begin:`\\b0[xX]((${oK})\\.?|(${oK})?\\.(${oK}))[pP][+-]?(${zZ})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${oK})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function BR($,Z,J){if(J===-1)return"";return $.replace(Z,(Q)=>{return BR($,Z,J-1)})}function qR($){let Z=$.regex,J="[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*",Q="[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*"+BR("(?:<"+"[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*"+"~~~(?:\\s*,\\s*"+"[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*"+"~~~)*>)?",/~~~/g,2),Y={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"]},K={className:"meta",begin:"@"+"[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*",contains:[{begin:/\(/,end:/\)/,contains:["self"]}]},W={className:"params",begin:/\(/,end:/\)/,keywords:Y,relevance:0,contains:[$.C_BLOCK_COMMENT_MODE],endsParent:!0};return{name:"Java",aliases:["jsp"],keywords:Y,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:[W,$.C_LINE_COMMENT_MODE,$.C_BLOCK_COMMENT_MODE]},{beginKeywords:"new throw return else",relevance:0},{begin:["(?:"+Q+"\\s+)",$.UNDERSCORE_IDENT_RE,/\s*(?=\()/],className:{2:"title.function"},keywords:Y,contains:[{className:"params",begin:/\(/,end:/\)/,keywords:Y,relevance:0,contains:[K,$.APOS_STRING_MODE,$.QUOTE_STRING_MODE,WR,$.C_BLOCK_COMMENT_MODE]},$.C_LINE_COMMENT_MODE,$.C_BLOCK_COMMENT_MODE]},WR,K]}}var g50=["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"],v50=["true","false","null","undefined","NaN","Infinity"],UR=["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"],FR=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],NR=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],f50=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],m50=[].concat(NR,UR,FR);function VR($){let Z=$.regex,J=(g,{after:u})=>{let j="</"+g[0].slice(1);return g.input.indexOf(j,u)!==-1},Q="[A-Za-z$_][0-9A-Za-z$_]*",X={begin:"<>",end:"</>"},z=/<[A-Za-z0-9\\._:-]+\s*\/>/,G={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(g,u)=>{let j=g[0].length+g.index,t=g.input[j];if(t==="<"||t===","){u.ignoreMatch();return}if(t===">"){if(!J(g,{after:j}))u.ignoreMatch()}let Q0,x=g.input.substring(j);if(Q0=x.match(/^\s*=/)){u.ignoreMatch();return}if(Q0=x.match(/^\s+extends\s+/)){if(Q0.index===0){u.ignoreMatch();return}}}},H={$pattern:"[A-Za-z$_][0-9A-Za-z$_]*",keyword:g50,literal:v50,built_in:m50,"variable.language":f50},Y="[0-9](_?[0-9])*",K="\\.([0-9](_?[0-9])*)",W="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",B={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},q={className:"subst",begin:"\\$\\{",end:"\\}",keywords:H,contains:[]},U={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[$.BACKSLASH_ESCAPE,q],subLanguage:"xml"}},F={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[$.BACKSLASH_ESCAPE,q],subLanguage:"css"}},N={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[$.BACKSLASH_ESCAPE,q],subLanguage:"graphql"}},L={className:"string",begin:"`",end:"`",contains:[$.BACKSLASH_ESCAPE,q]},M={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]},_=[$.APOS_STRING_MODE,$.QUOTE_STRING_MODE,U,F,N,L,{match:/\$\d+/},B];q.contains=_.concat({begin:/\{/,end:/\}/,keywords:H,contains:["self"].concat(_)});let O=[].concat(M,q.contains),D=O.concat([{begin:/(\s*)\(/,end:/\)/,keywords:H,contains:["self"].concat(O)}]),A={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:H,contains:D},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"}}]},I={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:{_:[...UR,...FR]}},y={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},C={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:[A],illegal:/%/},h={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function k(g){return Z.concat("(?!",g.join("|"),")")}let S={match:Z.concat(/\b/,k([...NR,"super","import"].map((g)=>`${g}\\s*\\(`)),"[A-Za-z$_][0-9A-Za-z$_]*",Z.lookahead(/\s*\(/)),className:"title.function",relevance:0},w={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},T={match:[/get|set/,/\s+/,"[A-Za-z$_][0-9A-Za-z$_]*",/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},A]},R="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+$.UNDERSCORE_IDENT_RE+")\\s*=>",b={match:[/const|var|let/,/\s+/,"[A-Za-z$_][0-9A-Za-z$_]*",/\s*/,/=\s*/,/(async\s*)?/,Z.lookahead(R)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[A]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:H,exports:{PARAMS_CONTAINS:D,CLASS_REFERENCE:I},illegal:/#(?![$_A-z])/,contains:[$.SHEBANG({label:"shebang",binary:"node",relevance:5}),y,$.APOS_STRING_MODE,$.QUOTE_STRING_MODE,U,F,N,L,M,{match:/\$\d+/},B,I,{scope:"attr",match:"[A-Za-z$_][0-9A-Za-z$_]*"+Z.lookahead(":"),relevance:0},b,{begin:"("+$.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[M,$.REGEXP_MODE,{className:"function",begin:R,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:$.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:H,contains:D}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:X.begin,end:X.end},{match:z},{begin:G.begin,"on:begin":G.isTrulyOpeningTag,end:G.end}],subLanguage:"xml",contains:[{begin:G.begin,end:G.end,skip:!0,contains:["self"]}]}]},C,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+$.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[A,$.inherit($.TITLE_MODE,{begin:"[A-Za-z$_][0-9A-Za-z$_]*",className:"title.function"})]},{match:/\.\.\./,relevance:0},w,{match:"\\$[A-Za-z$_][0-9A-Za-z$_]*",relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[A]},S,h,E,T,{match:/\$[(.]/}]}}function LR($){let Z={className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},J={match:/[{}[\],:]/,className:"punctuation",relevance:0},Q=["true","false","null"],X={scope:"literal",beginKeywords:Q.join(" ")};return{name:"JSON",aliases:["jsonc"],keywords:{literal:Q},contains:[Z,J,$.QUOTE_STRING_MODE,X,$.C_NUMBER_MODE,$.C_LINE_COMMENT_MODE,$.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}var GZ="[0-9](_*[0-9])*",sK=`\\.(${GZ})`,tK="[0-9a-fA-F](_*[0-9a-fA-F])*",p50={className:"number",variants:[{begin:`(\\b(${GZ})((${sK})|\\.)?|(${sK}))[eE][+-]?(${GZ})[fFdD]?\\b`},{begin:`\\b(${GZ})((${sK})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${sK})[fFdD]?\\b`},{begin:`\\b(${GZ})[fFdD]\\b`},{begin:`\\b0[xX]((${tK})\\.?|(${tK})?\\.(${tK}))[pP][+-]?(${GZ})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${tK})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function MR($){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+/}]}},Q={className:"symbol",begin:$.UNDERSCORE_IDENT_RE+"@"},X={className:"subst",begin:/\$\{/,end:/\}/,contains:[$.C_NUMBER_MODE]},z={className:"variable",begin:"\\$"+$.UNDERSCORE_IDENT_RE},G={className:"string",variants:[{begin:'"""',end:'"""(?=[^"])',contains:[z,X]},{begin:"'",end:"'",illegal:/\n/,contains:[$.BACKSLASH_ESCAPE]},{begin:'"',end:'"',illegal:/\n/,contains:[$.BACKSLASH_ESCAPE,z,X]}]};X.contains.push(G);let H={className:"meta",begin:"@(?:file|property|field|get|set|receiver|param|setparam|delegate)\\s*:(?:\\s*"+$.UNDERSCORE_IDENT_RE+")?"},Y={className:"meta",begin:"@"+$.UNDERSCORE_IDENT_RE,contains:[{begin:/\(/,end:/\)/,contains:[$.inherit(G,{className:"string"}),"self"]}]},K=p50,W=$.COMMENT("/\\*","\\*/",{contains:[$.C_BLOCK_COMMENT_MODE]}),B={variants:[{className:"type",begin:$.UNDERSCORE_IDENT_RE},{begin:/\(/,end:/\)/,contains:[]}]},q=B;return q.variants[1].contains=[B],B.variants[1].contains=[q],{name:"Kotlin",aliases:["kt","kts"],keywords:Z,contains:[$.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"}]}),$.C_LINE_COMMENT_MODE,W,J,Q,H,Y,{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:[B,$.C_LINE_COMMENT_MODE,W],relevance:0},$.C_LINE_COMMENT_MODE,W,H,Y,G,$.C_NUMBER_MODE]},W]},{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},H,Y]},G,{className:"meta",begin:"^#!/usr/bin/env",end:"$",illegal:`
46
+ `},K]}}var u50=($)=>{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_-]*/}}},c50=["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"],d50=["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"],l50=[...c50,...d50],i50=["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(),AR=["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(),_R=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),r50=["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(),a50=AR.concat(_R).sort().reverse();function DR($){let Z=u50($),J=a50,Q="and or not only",X="[\\w-]+",z="([\\w-]+|@\\{[\\w-]+\\})",G=[],H=[],Y=function(_){return{className:"string",begin:"~?"+_+".*?"+_}},K=function(_,O,D){return{className:_,begin:O,relevance:D}},W={$pattern:/[a-z-]+/,keyword:"and or not only",attribute:i50.join(" ")},B={begin:"\\(",end:"\\)",contains:H,keywords:W,relevance:0};H.push($.C_LINE_COMMENT_MODE,$.C_BLOCK_COMMENT_MODE,Y("'"),Y('"'),Z.CSS_NUMBER_MODE,{begin:"(url|data-uri)\\(",starts:{className:"string",end:"[\\)\\n]",excludeEnd:!0}},Z.HEXCOLOR,B,K("variable","@@?[\\w-]+",10),K("variable","@\\{[\\w-]+\\}"),K("built_in","~?`[^`]*?`"),{className:"attribute",begin:"[\\w-]+\\s*:",end:":",returnBegin:!0,excludeEnd:!0},Z.IMPORTANT,{beginKeywords:"and not"},Z.FUNCTION_DISPATCH);let q=H.concat({begin:/\{/,end:/\}/,contains:G}),U={beginKeywords:"when",endsWithParent:!0,contains:[{beginKeywords:"and not"}].concat(H)},F={begin:z+"\\s*:",returnBegin:!0,end:/[;}]/,relevance:0,contains:[{begin:/-(webkit|moz|ms|o)-/},Z.CSS_VARIABLE,{className:"attribute",begin:"\\b("+r50.join("|")+")\\b",end:/(?=:)/,starts:{endsWithParent:!0,illegal:"[<=$]",relevance:0,contains:H}}]},N={className:"keyword",begin:"@(import|media|charset|font-face|(-[a-z]+-)?keyframes|supports|document|namespace|page|viewport|host)\\b",starts:{end:"[;{}]",keywords:W,returnEnd:!0,contains:H,relevance:0}},L={className:"variable",variants:[{begin:"@[\\w-]+\\s*:",relevance:15},{begin:"@[\\w-]+"}],starts:{end:"[;}]",returnEnd:!0,contains:q}},V={variants:[{begin:"[\\.#:&\\[>]",end:"[;{}]"},{begin:z,end:/\{/}],returnBegin:!0,returnEnd:!0,illegal:`[<='$"]`,relevance:0,contains:[$.C_LINE_COMMENT_MODE,$.C_BLOCK_COMMENT_MODE,U,K("keyword","all\\b"),K("variable","@\\{[\\w-]+\\}"),{begin:"\\b("+l50.join("|")+")\\b",className:"selector-tag"},Z.CSS_NUMBER_MODE,K("selector-tag",z,0),K("selector-id","#"+z),K("selector-class","\\."+z,0),K("selector-tag","&",0),Z.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",begin:":("+AR.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+_R.join("|")+")"},{begin:/\(/,end:/\)/,relevance:0,contains:q},{begin:"!important"},Z.FUNCTION_DISPATCH]},M={begin:`[\\w-]+:(:)?(${J.join("|")})`,returnBegin:!0,contains:[V]};return G.push($.C_LINE_COMMENT_MODE,$.C_BLOCK_COMMENT_MODE,N,L,M,F,V,U,Z.FUNCTION_DISPATCH),{name:"Less",case_insensitive:!0,illegal:`[=>'/<($"]`,contains:G}}function OR($){let Q={begin:"\\[=*\\[",end:"\\]=*\\]",contains:["self"]},X=[$.COMMENT("--(?!\\[=*\\[)","$"),$.COMMENT("--\\[=*\\[","\\]=*\\]",{contains:[Q],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:X.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:X}].concat(X)},$.C_NUMBER_MODE,$.APOS_STRING_MODE,$.QUOTE_STRING_MODE,{className:"string",begin:"\\[=*\\[",end:"\\]=*\\]",contains:[Q],relevance:5}])}}function PR($){let Z={className:"variable",variants:[{begin:"\\$\\("+$.UNDERSCORE_IDENT_RE+"\\)",contains:[$.BACKSLASH_ESCAPE]},{begin:/\$[@%<?\^\+\*]/}]},J={className:"string",begin:/"/,end:/"/,contains:[$.BACKSLASH_ESCAPE,Z]},Q={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]},X={begin:"^"+$.UNDERSCORE_IDENT_RE+"\\s*(?=[:+?]?=)"},z={className:"meta",begin:/^\.PHONY:/,end:/$/,keywords:{$pattern:/[\.\w]+/,keyword:".PHONY"}},G={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,Q,X,z,G]}}function wR($){let Z=$.regex,J={begin:/<\/?[A-Za-z_]/,end:">",subLanguage:"xml",relevance:0},Q={begin:"^[-\\*]{3,}",end:"$"},X={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}]},z={className:"bullet",begin:"^[ \t]*([*+-]|(\\d+\\.))(?=\\s+)",end:"\\s+",excludeEnd:!0},G={begin:/^\[[^\n]+\]:/,returnBegin:!0,contains:[{className:"symbol",begin:/\[/,end:/\]/,excludeBegin:!0,excludeEnd:!0},{className:"link",begin:/:\s*/,end:/$/,excludeBegin:!0}]},H=/[A-Za-z][A-Za-z0-9+.-]*/,Y={variants:[{begin:/\[.+?\]\[.*?\]/,relevance:0},{begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,relevance:2},{begin:Z.concat(/\[.+?\]\(/,H,/:\/\/.*?\)/),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}]},K={className:"strong",contains:[],variants:[{begin:/_{2}(?!\s)/,end:/_{2}/},{begin:/\*{2}(?!\s)/,end:/\*{2}/}]},W={className:"emphasis",contains:[],variants:[{begin:/\*(?![*\s])/,end:/\*/},{begin:/_(?![_\s])/,end:/_/,relevance:0}]},B=$.inherit(K,{contains:[]}),q=$.inherit(W,{contains:[]});K.contains.push(q),W.contains.push(B);let U=[J,Y];return[K,W,B,q].forEach((V)=>{V.contains=V.contains.concat(U)}),U=U.concat(K,W),{name:"Markdown",aliases:["md","mkdown","mkd"],contains:[{className:"section",variants:[{begin:"^#{1,6}",end:"$",contains:U},{begin:"(?=^.+?\\n[=-]{2,}$)",contains:[{begin:"^[=-]*$"},{begin:"^",end:"\\n",contains:U}]}]},J,z,K,W,{className:"quote",begin:"^>\\s+",contains:U,end:"$"},X,Q,Y,G,{scope:"literal",match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}function jR($){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_]*/,H={"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"]},Y={$pattern:J,keyword:["@interface","@class","@protocol","@implementation"]};return{name:"Objective-C",aliases:["mm","objc","obj-c","obj-c++","objective-c++"],keywords:H,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:"("+Y.keyword.join("|")+")\\b",end:/(\{|$)/,excludeEnd:!0,keywords:Y,contains:[$.UNDERSCORE_TITLE_MODE]},{begin:"\\."+$.UNDERSCORE_IDENT_RE,relevance:0}]}}function TR($){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"],Q=/[dualxmsipngr]{0,12}/,X={$pattern:/[\w.]+/,keyword:J.join(" ")},z={className:"subst",begin:"[$@]\\{",end:"\\}",keywords:X},G={begin:/->\{/,end:/\}/},H={scope:"attr",match:/\s+:\s*\w+(\s*\(.*?\))?/},Y={scope:"variable",variants:[{begin:/\$\d/},{begin:Z.concat(/[$%@](?!")(\^\w\b|#\w+(::\w+)*|\{\w+\}|\w+(::\w*)*)/,"(?![A-Za-z])(?![@$%])")},{begin:/[$%@](?!")[^\s\w{=]|\$=/,relevance:0}],contains:[H]},K={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},W=[$.BACKSLASH_ESCAPE,z,Y],B=[/!/,/\//,/\|/,/\?/,/'/,/"/,/#/],q=(N,L,V="\\1")=>{let M=V==="\\1"?V:Z.concat(V,L);return Z.concat(Z.concat("(?:",N,")"),L,/(?:\\.|[^\\\/])*?/,M,/(?:\\.|[^\\\/])*?/,V,Q)},U=(N,L,V)=>{return Z.concat(Z.concat("(?:",N,")"),L,/(?:\\.|[^\\\/])*?/,V,Q)},F=[Y,$.HASH_COMMENT_MODE,$.COMMENT(/^=\w/,/=cut/,{endsWithParent:!0}),G,{className:"string",contains:W,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}]},K,{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:q("s|tr|y",Z.either(...B,{capture:!0}))},{begin:q("s|tr|y","\\(","\\)")},{begin:q("s|tr|y","\\[","\\]")},{begin:q("s|tr|y","\\{","\\}")}],relevance:2},{className:"regexp",variants:[{begin:/(m|qr)\/\//,relevance:0},{begin:U("(?:m|qr)?",/\//,/\//)},{begin:U("m|qr",Z.either(...B,{capture:!0}),/\1/)},{begin:U("m|qr",/\(/,/\)/)},{begin:U("m|qr",/\[/,/\]/)},{begin:U("m|qr",/\{/,/\}/)}]}]},{className:"function",beginKeywords:"sub method",end:"(\\s*\\(.*?\\))?[;{]",excludeEnd:!0,relevance:5,contains:[$.TITLE_MODE,H]},{className:"class",beginKeywords:"class",end:"[;{]",excludeEnd:!0,relevance:5,contains:[$.TITLE_MODE,H,K]},{begin:"-\\w\\b",relevance:0},{begin:"^__DATA__$",end:"^__END__$",subLanguage:"mojolicious",contains:[{begin:"^@@.*",end:"$",className:"comment"}]}];return z.contains=F,G.contains=F,{name:"Perl",aliases:["pl","pm"],keywords:X,contains:F}}function CR($){let Z=$.regex,J=/(?![A-Za-z0-9])(?![$])/,Q=Z.concat(/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/,J),X=Z.concat(/(\\?[A-Z][a-z0-9_\x7f-\xff]+|\\?[A-Z]+(?=[A-Z][a-z0-9_\x7f-\xff])){1,}/,J),z=Z.concat(/[A-Z]+/,J),G={scope:"variable",match:"\\$+"+Q},H={scope:"meta",variants:[{begin:/<\?php/,relevance:10},{begin:/<\?=/},{begin:/<\?/,relevance:0.1},{begin:/\?>/}]},Y={scope:"subst",variants:[{begin:/\$\w+/},{begin:/\{\$/,end:/\}/}]},K=$.inherit($.APOS_STRING_MODE,{illegal:null}),W=$.inherit($.QUOTE_STRING_MODE,{illegal:null,contains:$.QUOTE_STRING_MODE.contains.concat(Y)}),B={begin:/<<<[ \t]*(?:(\w+)|"(\w+)")\n/,end:/[ \t]*(\w+)\b/,contains:$.QUOTE_STRING_MODE.contains.concat(Y),"on:begin":(w,T)=>{T.data._beginMatch=w[1]||w[2]},"on:end":(w,T)=>{if(T.data._beginMatch!==w[1])T.ignoreMatch()}},q=$.END_SAME_AS_BEGIN({begin:/<<<[ \t]*'(\w+)'\n/,end:/[ \t]*(\w+)\b/}),U=`[
47
+ ]`,F={scope:"string",variants:[W,K,B,q]},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},L=["false","null","true"],V=["__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"],M=["Error|0","AppendIterator","ArgumentCountError","ArithmeticError","ArrayIterator","ArrayObject","AssertionError","BadFunctionCallException","BadMethodCallException","CachingIterator","CallbackFilterIterator","CompileError","Countable","DirectoryIterator","DivisionByZeroError","DomainException","EmptyIterator","ErrorException","Exception","FilesystemIterator","FilterIterator","GlobIterator","InfiniteIterator","InvalidArgumentException","IteratorIterator","LengthException","LimitIterator","LogicException","MultipleIterator","NoRewindIterator","OutOfBoundsException","OutOfRangeException","OuterIterator","OverflowException","ParentIterator","ParseError","RangeException","RecursiveArrayIterator","RecursiveCachingIterator","RecursiveCallbackFilterIterator","RecursiveDirectoryIterator","RecursiveFilterIterator","RecursiveIterator","RecursiveIteratorIterator","RecursiveRegexIterator","RecursiveTreeIterator","RegexIterator","RuntimeException","SeekableIterator","SplDoublyLinkedList","SplFileInfo","SplFileObject","SplFixedArray","SplHeap","SplMaxHeap","SplMinHeap","SplObjectStorage","SplObserver","SplPriorityQueue","SplQueue","SplStack","SplSubject","SplTempFileObject","TypeError","UnderflowException","UnexpectedValueException","UnhandledMatchError","ArrayAccess","BackedEnum","Closure","Fiber","Generator","Iterator","IteratorAggregate","Serializable","Stringable","Throwable","Traversable","UnitEnum","WeakReference","WeakMap","Directory","__PHP_Incomplete_Class","parent","php_user_filter","self","static","stdClass"],O={keyword:V,literal:((w)=>{let T=[];return w.forEach((R)=>{if(T.push(R),R.toLowerCase()===R)T.push(R.toUpperCase());else T.push(R.toLowerCase())}),T})(L),built_in:M},D=(w)=>{return w.map((T)=>{return T.replace(/\|\d+$/,"")})},A={variants:[{match:[/new/,Z.concat(`[
48
+ ]`,"+"),Z.concat("(?!",D(M).join("\\b|"),"\\b)"),X],scope:{1:"keyword",4:"title.class"}}]},E=Z.concat(Q,"\\b(?!\\()"),I={variants:[{match:[Z.concat(/::/,Z.lookahead(/(?!class\b)/)),E],scope:{2:"variable.constant"}},{match:[/::/,/class/],scope:{2:"variable.language"}},{match:[X,Z.concat(/::/,Z.lookahead(/(?!class\b)/)),E],scope:{1:"title.class",3:"variable.constant"}},{match:[X,Z.concat("::",Z.lookahead(/(?!class\b)/))],scope:{1:"title.class"}},{match:[X,/::/,/class/],scope:{1:"title.class",3:"variable.language"}}]},y={scope:"attr",match:Z.concat(Q,Z.lookahead(":"),Z.lookahead(/(?!::)/))},C={relevance:0,begin:/\(/,end:/\)/,keywords:O,contains:[y,G,I,$.C_BLOCK_COMMENT_MODE,F,N,A]},h={relevance:0,match:[/\b/,Z.concat("(?!fn\\b|function\\b|",D(V).join("\\b|"),"|",D(M).join("\\b|"),"\\b)"),Q,Z.concat(`[
49
+ ]`,"*"),Z.lookahead(/(?=\()/)],scope:{3:"title.function.invoke"},contains:[C]};C.contains.push(h);let k=[y,I,$.C_BLOCK_COMMENT_MODE,F,N,A],S={begin:Z.concat(/#\[\s*\\?/,Z.either(X,z)),beginScope:"meta",end:/]/,endScope:"meta",keywords:{literal:L,keyword:["new","array"]},contains:[{begin:/\[/,end:/]/,keywords:{literal:L,keyword:["new","array"]},contains:["self",...k]},...k,{scope:"meta",variants:[{match:X},{match:z}]}]};return{case_insensitive:!1,keywords:O,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}]}},H,{scope:"variable.language",match:/\$this\b/},G,h,I,{match:[/const/,/\s/,Q],scope:{1:"keyword",3:"variable.constant"}},A,{scope:"function",relevance:0,beginKeywords:"fn function",end:/[;{]/,excludeEnd:!0,illegal:"[$%\\[]",contains:[{beginKeywords:"use"},$.UNDERSCORE_TITLE_MODE,{begin:"=>",endsParent:!0},{scope:"params",begin:"\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0,keywords:O,contains:["self",S,G,I,$.C_BLOCK_COMMENT_MODE,F,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]},F,N]}}function ER($){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 SR($){return{name:"Plain text",aliases:["text","txt"],disableAutodetect:!0}}function kR($){let Z=$.regex,J=/[\p{XID_Start}_]\p{XID_Continue}*/u,Q=["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"],H={$pattern:/[A-Za-z]\w+|__\w+__/,keyword:Q,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"]},Y={className:"meta",begin:/^(>>>|\.\.\.) /},K={className:"subst",begin:/\{/,end:/\}/,keywords:H,illegal:/#/},W={begin:/\{\{/,relevance:0},B={className:"string",contains:[$.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[$.BACKSLASH_ESCAPE,Y],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[$.BACKSLASH_ESCAPE,Y],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[$.BACKSLASH_ESCAPE,Y,W,K]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[$.BACKSLASH_ESCAPE,Y,W,K]},{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,W,K]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[$.BACKSLASH_ESCAPE,W,K]},$.APOS_STRING_MODE,$.QUOTE_STRING_MODE]},q="[0-9](_?[0-9])*",U="(\\b([0-9](_?[0-9])*))?\\.([0-9](_?[0-9])*)|\\b([0-9](_?[0-9])*)\\.",F=`\\b|${Q.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]?(?=${F})`},{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]?(?=${F})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${F})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${F})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${F})`},{begin:`\\b([0-9](_?[0-9])*)[jJ](?=${F})`}]},L={className:"comment",begin:Z.lookahead(/# type:/),end:/$/,keywords:H,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},V={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:H,contains:["self",Y,N,B,$.HASH_COMMENT_MODE]}]};return K.contains=[B,N,Y],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:H,illegal:/(<\/|\?)|=>/,contains:[Y,N,{scope:"variable.language",match:/\bself\b/},{beginKeywords:"if",relevance:0},{match:/\bor\b/,scope:"keyword"},B,L,$.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,J],scope:{1:"keyword",3:"title.function"},contains:[V]},{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,V,B]}]}}function IR($){return{aliases:["pycon"],contains:[{className:"meta.prompt",starts:{end:/ |$/,starts:{end:"$",subLanguage:"python"}},variants:[{begin:/^>>>(?=[ ]|$)/},{begin:/^\.\.\.(?=[ ]|$)/}]}]}}function RR($){let Z=$.regex,J=/(?:(?:[a-zA-Z]|\.[._a-zA-Z])[._a-zA-Z0-9]*)|\.(?!\d)/,Q=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]?/),X=/[=!<>:]=|\|\||&&|:::?|<-|<<-|->>|->|\|>|[-+*\/?!$&|:<=>@^~]|\*\*/,z=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:[X,Q]},{scope:{1:"operator",2:"number"},match:[/%[^%]*%/,Q]},{scope:{1:"punctuation",2:"number"},match:[z,Q]},{scope:{2:"number"},match:[/[^a-zA-Z0-9._]|^/,Q]}]},{scope:{3:"operator"},match:[J,/\s+/,/<-/,/\s+/]},{scope:"operator",relevance:0,variants:[{match:X},{match:/%[^%]*%/}]},{scope:"punctuation",relevance:0,match:z},{begin:"`",end:"`",contains:[{begin:/\\./}]}]}}function yR($){let Z=$.regex,J="([a-zA-Z_]\\w*[!?=]?|[-+~]@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?)",Q=Z.either(/\b([A-Z]+[a-z0-9]+)+/,/\b([A-Z]+[a-z0-9]+)+[A-Z]+/),X=Z.concat(Q,/(::\w+)*/),G={"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"]},H={className:"doctag",begin:"@[A-Za-z]+"},Y={begin:"#<",end:">"},K=[$.COMMENT("#","$",{contains:[H]}),$.COMMENT("^=begin","^=end",{contains:[H],relevance:10}),$.COMMENT("^__END__",$.MATCH_NOTHING_RE)],W={className:"subst",begin:/#\{/,end:/\}/,keywords:G},B={className:"string",contains:[$.BACKSLASH_ESCAPE,W],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,W]})]}]},q="[1-9](_?[0-9])*|0",U="[0-9](_?[0-9])*",F={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:G}]},A=[B,{variants:[{match:[/class\s+/,X,/\s+<\s+/,X]},{match:[/\b(class|module)\s+/,X]}],scope:{2:"title.class",4:"title.class.inherited"},keywords:G},{match:[/(include|extend)\s+/,X],scope:{2:"title.class"},keywords:G},{relevance:0,match:[X,/\.new[. (]/],scope:{1:"title.class"}},{relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"},{relevance:0,match:Q,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:[B,{begin:"([a-zA-Z_]\\w*[!?=]?|[-+~]@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?)"}],relevance:0},F,{className:"variable",begin:"(\\$\\W)|((\\$|@@?)(\\w+))(?=[^@$?])(?![A-Za-z])(?![@$?'])"},{className:"params",begin:/\|(?!=)/,end:/\|/,excludeBegin:!0,excludeEnd:!0,relevance:0,keywords:G},{begin:"("+$.RE_STARTERS_RE+"|unless)\\s*",keywords:"unless",contains:[{className:"regexp",contains:[$.BACKSLASH_ESCAPE,W],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(Y,K),relevance:0}].concat(Y,K);W.contains=A,N.contains=A;let E="[>?]>",I="[\\w#]+\\(\\w+\\):\\d+:\\d+[>*]",y="(\\w+-)?\\d+\\.\\d+\\.\\d+(p\\d+)?[^\\d][^>]+>",C=[{begin:/^\s*=>/,starts:{end:"$",contains:A}},{className:"meta.prompt",begin:"^("+E+"|"+I+"|"+y+")(?=[ ])",starts:{end:"$",keywords:G,contains:A}}];return K.unshift(Y),{name:"Ruby",aliases:["rb","gemspec","podspec","thor","irb"],keywords:G,illegal:/\/\*/,contains:[$.SHEBANG({binary:"ruby"})].concat(C).concat(K).concat(A)}}function bR($){let Z=$.regex,J=/(r#)?/,Q=Z.concat(J,$.UNDERSCORE_IDENT_RE),X=Z.concat(J,$.IDENT_RE),z={className:"title.function.invoke",relevance:0,begin:Z.concat(/\b/,/(?!let|for|while|if|else|match\b)/,X,Z.lookahead(/\s*\(/))},G="([ui](8|16|32|64|128|size)|f(32|64))?",H=["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"],Y=["true","false","Some","None","Ok","Err"],K=["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!"],W=["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:W,keyword:H,literal:Y,built_in:K},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+/,Q],className:{1:"keyword",3:"title.function"}},{className:"meta",begin:"#!?\\[",end:"\\]",contains:[{className:"string",begin:/"/,end:/"/,contains:[$.BACKSLASH_ESCAPE]}]},{begin:[/let/,/\s+/,/(?:mut\s+)?/,Q],className:{1:"keyword",3:"keyword",4:"variable"}},{begin:[/for/,/\s+/,Q,/\s+/,/in/],className:{1:"keyword",3:"variable",5:"keyword"}},{begin:[/type/,/\s+/,Q],className:{1:"keyword",3:"title.class"}},{begin:[/(?:trait|enum|struct|union|impl|for)/,/\s+/,Q],className:{1:"keyword",3:"title.class"}},{begin:$.IDENT_RE+"::",keywords:{keyword:"Self",built_in:K,type:W}},{className:"punctuation",begin:"->"},z]}}var n50=($)=>{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_-]*/}}},o50=["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"],s50=["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"],t50=[...o50,...s50],e50=["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(),$10=["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(),Z10=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),J10=["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 xR($){let Z=n50($),J=Z10,Q=$10,X="@[a-z-]+",z="and or not only",G="[a-zA-Z-][a-zA-Z0-9_-]*",H={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("+t50.join("|")+")\\b",relevance:0},{className:"selector-pseudo",begin:":("+Q.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+J.join("|")+")"},H,{begin:/\(/,end:/\)/,contains:[Z.CSS_NUMBER_MODE]},Z.CSS_VARIABLE,{className:"attribute",begin:"\\b("+J10.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,H,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:e50.join(" ")},contains:[{begin:"@[a-z-]+",className:"keyword"},{begin:/[a-z-]+(?=:)/,className:"attribute"},H,$.QUOTE_STRING_MODE,$.APOS_STRING_MODE,Z.HEXCOLOR,Z.CSS_NUMBER_MODE]},Z.FUNCTION_DISPATCH]}}function hR($){return{name:"Shell Session",aliases:["console","shellsession"],contains:[{className:"meta.prompt",begin:/^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/,starts:{end:/[^\\](?=\s*$)/,subLanguage:"bash"}}]}}function gR($){let Z=$.regex,J=$.COMMENT("--","$"),Q={scope:"string",variants:[{begin:/'/,end:/'/,contains:[{match:/''/}]}]},X={begin:/"/,end:/"/,contains:[{match:/""/}]},z=["true","false","unknown"],G=["double precision","large object","with timezone","without timezone"],H=["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"],Y=["add","asc","collation","desc","final","first","last","view"],K=["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"],W=["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"],B=["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"],q=["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"],U=W,F=[...K,...Y].filter((D)=>{return!W.includes(D)}),N={scope:"variable",match:/@[a-z0-9][a-z0-9_]*/},L={scope:"operator",match:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0},V={match:Z.concat(/\b/,Z.either(...U),/\s*\(/),relevance:0,keywords:{built_in:U}};function M(D){return Z.concat(/\b/,Z.either(...D.map((A)=>{return A.replace(/\s+/,"\\s+")})),/\b/)}let _={scope:"keyword",match:M(q),relevance:0};function O(D,{exceptions:A,when:E}={}){let I=E;return A=A||[],D.map((y)=>{if(y.match(/\|\d+$/)||A.includes(y))return y;else if(I(y))return`${y}|0`;else return y})}return{name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:O(F,{when:(D)=>D.length<3}),literal:z,type:H,built_in:B},contains:[{scope:"type",match:M(G)},_,V,N,Q,X,$.C_NUMBER_MODE,$.C_BLOCK_COMMENT_MODE,J,L]}}function pR($){if(!$)return null;if(typeof $==="string")return $;return $.source}function sQ($){return o5("(?=",$,")")}function o5(...$){return $.map((J)=>pR(J)).join("")}function Q10($){let Z=$[$.length-1];if(typeof Z==="object"&&Z.constructor===Object)return $.splice($.length-1,1),Z;else return{}}function e8(...$){return"("+(Q10($).capture?"":"?:")+$.map((Q)=>pR(Q)).join("|")+")"}var lN=($)=>o5(/\b/,$,/\w$/.test($)?/\b/:/\B/),X10=["Protocol","Type"].map(lN),vR=["init","self"].map(lN),z10=["Any","Self"],cN=["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"],fR=["false","nil","true"],G10=["assignment","associativity","higherThan","left","lowerThan","none","right"],H10=["#colorLiteral","#column","#dsohandle","#else","#elseif","#endif","#error","#file","#fileID","#fileLiteral","#filePath","#function","#if","#imageLiteral","#keyPath","#line","#selector","#sourceLocation","#warning"],mR=["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"],uR=e8(/[/=\-+!*%<>&|^~?]/,/[\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]/),cR=e8(uR,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),dN=o5(uR,cR,"*"),dR=e8(/[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]/),$W=e8(dR,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),B9=o5(dR,$W,"*"),eK=o5(/[A-Z]/,$W,"*"),Y10=["attached","autoclosure",o5(/convention\(/,e8("swift","block","c"),/\)/),"discardableResult","dynamicCallable","dynamicMemberLookup","escaping","freestanding","frozen","GKInspectable","IBAction","IBDesignable","IBInspectable","IBOutlet","IBSegueAction","inlinable","main","nonobjc","NSApplicationMain","NSCopying","NSManaged",o5(/objc\(/,B9,/\)/),"objc","objcMembers","propertyWrapper","requires_stored_property_inits","resultBuilder","Sendable","testable","UIApplicationMain","unchecked","unknown","usableFromInline","warn_unqualified_access"],K10=["iOS","iOSApplicationExtension","macOS","macOSApplicationExtension","macCatalyst","macCatalystApplicationExtension","watchOS","watchOSApplicationExtension","tvOS","tvOSApplicationExtension","swift"];function lR($){let Z={match:/\s+/,relevance:0},J=$.COMMENT("/\\*","\\*/",{contains:["self"]}),Q=[$.C_LINE_COMMENT_MODE,J],X={match:[/\./,e8(...X10,...vR)],className:{2:"keyword"}},z={match:o5(/\./,e8(...cN)),relevance:0},G=cN.filter((n)=>typeof n==="string").concat(["_|0"]),H=cN.filter((n)=>typeof n!=="string").concat(z10).map(lN),Y={variants:[{className:"keyword",match:e8(...H,...vR)}]},K={$pattern:e8(/\b\w+/,/#\w+/),keyword:G.concat(H10),literal:fR},W=[X,z,Y],B={match:o5(/\./,e8(...mR)),relevance:0},q={className:"built_in",match:o5(/\b/,e8(...mR),/(?=\()/)},U=[B,q],F={match:/->/,relevance:0},N={className:"operator",relevance:0,variants:[{match:dN},{match:`\\.(\\.|${cR})+`}]},L=[F,N],V="([0-9]_*)+",M="([0-9a-fA-F]_*)+",_={className:"number",relevance:0,variants:[{match:"\\b(([0-9]_*)+)(\\.(([0-9]_*)+))?([eE][+-]?(([0-9]_*)+))?\\b"},{match:"\\b0x(([0-9a-fA-F]_*)+)(\\.(([0-9a-fA-F]_*)+))?([pP][+-]?(([0-9]_*)+))?\\b"},{match:/\b0o([0-7]_*)+\b/},{match:/\b0b([01]_*)+\b/}]},O=(n="")=>({className:"subst",variants:[{match:o5(/\\/,n,/[0\\tnr"']/)},{match:o5(/\\/,n,/u\{[0-9a-fA-F]{1,8}\}/)}]}),D=(n="")=>({className:"subst",match:o5(/\\/,n,/[\t ]*(?:[\r\n]|\r\n)/)}),A=(n="")=>({className:"subst",label:"interpol",begin:o5(/\\/,n,/\(/),end:/\)/}),E=(n="")=>({begin:o5(n,/"""/),end:o5(/"""/,n),contains:[O(n),D(n),A(n)]}),I=(n="")=>({begin:o5(n,/"/),end:o5(/"/,n),contains:[O(n),A(n)]}),y={className:"string",variants:[E(),E("#"),E("##"),E("###"),I(),I("#"),I("##"),I("###")]},C=[$.BACKSLASH_ESCAPE,{begin:/\[/,end:/\]/,relevance:0,contains:[$.BACKSLASH_ESCAPE]}],h={begin:/\/[^\s](?=[^/\n]*\/)/,end:/\//,contains:C},k=(n)=>{let m=o5(n,/\//),c=o5(/\//,n);return{begin:m,end:c,contains:[...C,{scope:"comment",begin:`#(?!.*${c})`,end:/$/}]}},S={scope:"regexp",variants:[k("###"),k("##"),k("#"),h]},w={match:o5(/`/,B9,/`/)},T={className:"variable",match:/\$\d+/},R={className:"variable",match:`\\$${$W}+`},b=[w,T,R],g={match:/(@|#(un)?)available/,scope:"keyword",starts:{contains:[{begin:/\(/,end:/\)/,keywords:K10,contains:[...L,_,y]}]}},u={scope:"keyword",match:o5(/@/,e8(...Y10),sQ(e8(/\(/,/\s+/)))},j={scope:"meta",match:o5(/@/,B9)},t=[g,u,j],Q0={match:sQ(/\b[A-Z]/),relevance:0,contains:[{className:"type",match:o5(/(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)/,$W,"+")},{className:"type",match:eK,relevance:0},{match:/[?!]+/,relevance:0},{match:/\.\.\./,relevance:0},{match:o5(/\s+&\s+/,sQ(eK)),relevance:0}]},x={begin:/</,end:/>/,keywords:K,contains:[...Q,...W,...t,F,Q0]};Q0.contains.push(x);let e={match:o5(B9,/\s*:/),keywords:"_|0",relevance:0},M0={begin:/\(/,end:/\)/,relevance:0,keywords:K,contains:["self",e,...Q,S,...W,...U,...L,_,y,...b,...t,Q0]},l={begin:/</,end:/>/,keywords:"repeat each",contains:[...Q,Q0]},H0={begin:e8(sQ(o5(B9,/\s*:/)),sQ(o5(B9,/\s+/,B9,/\s*:/))),end:/:/,relevance:0,contains:[{className:"keyword",match:/\b_\b/},{className:"params",match:B9}]},B0={begin:/\(/,end:/\)/,keywords:K,contains:[H0,...Q,...W,...L,_,y,...t,Q0,M0],endsParent:!0,illegal:/["']/},X0={match:[/(func|macro)/,/\s+/,e8(w.match,B9,dN)],className:{1:"keyword",3:"title.function"},contains:[l,B0,Z],illegal:[/\[/,/%/]},Y0={match:[/\b(?:subscript|init[?!]?)/,/\s*(?=[<(])/],className:{1:"keyword"},contains:[l,B0,Z],illegal:/\[|%/},V0={match:[/operator/,/\s+/,dN],className:{1:"keyword",3:"title"}},i={begin:[/precedencegroup/,/\s+/,eK],className:{1:"keyword",3:"title"},contains:[Q0],keywords:[...G10,...fR],end:/}/},$0={match:[/class\b/,/\s+/,/func\b/,/\s+/,/\b[A-Za-z_][A-Za-z0-9_]*\b/],scope:{1:"keyword",3:"keyword",5:"title.function"}},Z0={match:[/class\b/,/\s+/,/var\b/],scope:{1:"keyword",3:"keyword"}},J0={begin:[/(struct|protocol|class|extension|enum|actor)/,/\s+/,B9,/\s*/],beginScope:{1:"keyword",3:"title.class"},keywords:K,contains:[l,...W,{begin:/:/,end:/\{/,keywords:K,contains:[{scope:"title.class.inherited",match:eK},...W],relevance:0}]};for(let n of y.variants){let m=n.contains.find((f)=>f.label==="interpol");m.keywords=K;let c=[...W,...U,...L,_,y,...b];m.contains=[...c,{begin:/\(/,end:/\)/,contains:["self",...c]}]}return{name:"Swift",keywords:K,contains:[...Q,X0,Y0,$0,Z0,J0,V0,i,{beginKeywords:"import",end:/$/,contains:[...Q],relevance:0},S,...W,...U,...L,_,y,...b,...t,Q0,M0]}}var iR=["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"],rR=["true","false","null","undefined","NaN","Infinity"],aR=["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"],nR=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],oR=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],sR=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],tR=[].concat(oR,aR,nR);function W10($){let Z=$.regex,J=(g,{after:u})=>{let j="</"+g[0].slice(1);return g.input.indexOf(j,u)!==-1},Q="[A-Za-z$_][0-9A-Za-z$_]*",X={begin:"<>",end:"</>"},z=/<[A-Za-z0-9\\._:-]+\s*\/>/,G={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(g,u)=>{let j=g[0].length+g.index,t=g.input[j];if(t==="<"||t===","){u.ignoreMatch();return}if(t===">"){if(!J(g,{after:j}))u.ignoreMatch()}let Q0,x=g.input.substring(j);if(Q0=x.match(/^\s*=/)){u.ignoreMatch();return}if(Q0=x.match(/^\s+extends\s+/)){if(Q0.index===0){u.ignoreMatch();return}}}},H={$pattern:"[A-Za-z$_][0-9A-Za-z$_]*",keyword:iR,literal:rR,built_in:tR,"variable.language":sR},Y="[0-9](_?[0-9])*",K="\\.([0-9](_?[0-9])*)",W="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",B={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},q={className:"subst",begin:"\\$\\{",end:"\\}",keywords:H,contains:[]},U={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[$.BACKSLASH_ESCAPE,q],subLanguage:"xml"}},F={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[$.BACKSLASH_ESCAPE,q],subLanguage:"css"}},N={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[$.BACKSLASH_ESCAPE,q],subLanguage:"graphql"}},L={className:"string",begin:"`",end:"`",contains:[$.BACKSLASH_ESCAPE,q]},M={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]},_=[$.APOS_STRING_MODE,$.QUOTE_STRING_MODE,U,F,N,L,{match:/\$\d+/},B];q.contains=_.concat({begin:/\{/,end:/\}/,keywords:H,contains:["self"].concat(_)});let O=[].concat(M,q.contains),D=O.concat([{begin:/(\s*)\(/,end:/\)/,keywords:H,contains:["self"].concat(O)}]),A={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:H,contains:D},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"}}]},I={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:{_:[...aR,...nR]}},y={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},C={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:[A],illegal:/%/},h={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function k(g){return Z.concat("(?!",g.join("|"),")")}let S={match:Z.concat(/\b/,k([...oR,"super","import"].map((g)=>`${g}\\s*\\(`)),"[A-Za-z$_][0-9A-Za-z$_]*",Z.lookahead(/\s*\(/)),className:"title.function",relevance:0},w={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},T={match:[/get|set/,/\s+/,"[A-Za-z$_][0-9A-Za-z$_]*",/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},A]},R="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+$.UNDERSCORE_IDENT_RE+")\\s*=>",b={match:[/const|var|let/,/\s+/,"[A-Za-z$_][0-9A-Za-z$_]*",/\s*/,/=\s*/,/(async\s*)?/,Z.lookahead(R)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[A]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:H,exports:{PARAMS_CONTAINS:D,CLASS_REFERENCE:I},illegal:/#(?![$_A-z])/,contains:[$.SHEBANG({label:"shebang",binary:"node",relevance:5}),y,$.APOS_STRING_MODE,$.QUOTE_STRING_MODE,U,F,N,L,M,{match:/\$\d+/},B,I,{scope:"attr",match:"[A-Za-z$_][0-9A-Za-z$_]*"+Z.lookahead(":"),relevance:0},b,{begin:"("+$.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[M,$.REGEXP_MODE,{className:"function",begin:R,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:$.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:H,contains:D}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:X.begin,end:X.end},{match:z},{begin:G.begin,"on:begin":G.isTrulyOpeningTag,end:G.end}],subLanguage:"xml",contains:[{begin:G.begin,end:G.end,skip:!0,contains:["self"]}]}]},C,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+$.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[A,$.inherit($.TITLE_MODE,{begin:"[A-Za-z$_][0-9A-Za-z$_]*",className:"title.function"})]},{match:/\.\.\./,relevance:0},w,{match:"\\$[A-Za-z$_][0-9A-Za-z$_]*",relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[A]},S,h,E,T,{match:/\$[(.]/}]}}function eR($){let Z=$.regex,J=W10($),Q="[A-Za-z$_][0-9A-Za-z$_]*",X=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],z={begin:[/namespace/,/\s+/,$.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},G={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:X},contains:[J.exports.CLASS_REFERENCE]},H={className:"meta",relevance:10,begin:/^\s*['"]use strict['"]/},Y=["type","interface","public","private","protected","implements","declare","abstract","readonly","enum","override","satisfies"],K={$pattern:"[A-Za-z$_][0-9A-Za-z$_]*",keyword:iR.concat(Y),literal:rR,built_in:tR.concat(X),"variable.language":sR},W={className:"meta",begin:"@[A-Za-z$_][0-9A-Za-z$_]*"},B=(N,L,V)=>{let M=N.contains.findIndex((_)=>_.label===L);if(M===-1)throw Error("can not find mode to replace");N.contains.splice(M,1,V)};Object.assign(J.keywords,K),J.exports.PARAMS_CONTAINS.push(W);let q=J.contains.find((N)=>N.scope==="attr"),U=Object.assign({},q,{match:Z.concat("[A-Za-z$_][0-9A-Za-z$_]*",Z.lookahead(/\s*\?:/))});J.exports.PARAMS_CONTAINS.push([J.exports.CLASS_REFERENCE,q,U]),J.contains=J.contains.concat([W,z,G,U]),B(J,"shebang",$.SHEBANG()),B(J,"use_strict",H);let F=J.contains.find((N)=>N.label==="func.def");return F.relevance=0,Object.assign(J,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),J}function $y($){let Z=$.regex,J={className:"string",begin:/"(""|[^/n])"C\b/},Q={className:"string",begin:/"/,end:/"/,illegal:/\n/,contains:[{begin:/""/}]},X=/\d{1,2}\/\d{1,2}\/\d{4}/,z=/\d{4}-\d{1,2}-\d{1,2}/,G=/(\d|1[012])(:\d+){0,2} *(AM|PM)/,H=/\d{1,2}(:\d{1,2}){1,2}/,Y={className:"literal",variants:[{begin:Z.concat(/# */,Z.either(z,X),/ *#/)},{begin:Z.concat(/# */,H,/ *#/)},{begin:Z.concat(/# */,G,/ *#/)},{begin:Z.concat(/# */,Z.either(z,X),/ +/,Z.either(G,H),/ *#/)}]},K={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])|[%&])?/}]},W={className:"label",begin:/^\w+:/},B=$.COMMENT(/'''/,/$/,{contains:[{className:"doctag",begin:/<\/?/,end:/>/}]}),q=$.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,Q,Y,K,W,B,q,{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:[q]}]}}function Zy($){$.regex;let Z=$.COMMENT(/\(;/,/;\)/);Z.contains.push("self");let J=$.COMMENT(/;;/,/$/),Q=["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"],X={begin:[/(?:func|call|call_indirect)/,/\s+/,/\$[^\s)]+/],className:{1:"keyword",3:"title.function"}},z={className:"variable",begin:/\$[\w_]+/},G={match:/(\((?!;)|\))+/,className:"punctuation",relevance:0},H={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/},Y={match:/(i32|i64|f32|f64)(?!\.)/,className:"type"},K={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:Q},contains:[J,Z,{match:[/(?:offset|align)/,/\s*/,/=/],className:{1:"keyword",3:"operator"}},z,G,X,$.QUOTE_STRING_MODE,Y,K,H]}}function Jy($){let Z=$.regex,J=Z.concat(/[\p{L}_]/u,Z.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),Q=/[\p{L}0-9._:-]+/u,X={className:"symbol",begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},z={begin:/\s/,contains:[{className:"keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},G=$.inherit(z,{begin:/\(/,end:/\)/}),H=$.inherit($.APOS_STRING_MODE,{className:"string"}),Y=$.inherit($.QUOTE_STRING_MODE,{className:"string"}),K={endsWithParent:!0,illegal:/</,relevance:0,contains:[{className:"attr",begin:Q,relevance:0},{begin:/=\s*/,relevance:0,contains:[{className:"string",endsParent:!0,variants:[{begin:/"/,end:/"/,contains:[X]},{begin:/'/,end:/'/,contains:[X]},{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:[z,Y,H,G,{begin:/\[/,end:/\]/,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,contains:[z,G,Y,H]}]}]},$.COMMENT(/<!--/,/-->/,{relevance:10}),{begin:/<!\[CDATA\[/,end:/\]\]>/,relevance:10},X,{className:"meta",end:/\?>/,variants:[{begin:/<\?xml/,relevance:10,contains:[Y]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:"tag",begin:/<style(?=\s|>)/,end:/>/,keywords:{name:"style"},contains:[K],starts:{end:/<\/style>/,returnEnd:!0,subLanguage:["css","xml"]}},{className:"tag",begin:/<script(?=\s|>)/,end:/>/,keywords:{name:"script"},contains:[K],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:K}]},{className:"tag",begin:Z.concat(/<\//,Z.lookahead(Z.concat(J,/>/))),contains:[{className:"name",begin:J,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}}function Qy($){let Q={className:"attr",variants:[{begin:/[\w*@][\w*@ :()\./-]*:(?=[ \t]|$)/},{begin:/"[\w*@][\w*@ :()\./-]*":(?=[ \t]|$)/},{begin:/'[\w*@][\w*@ :()\./-]*':(?=[ \t]|$)/}]},X={className:"template-variable",variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]},z={className:"string",relevance:0,begin:/'/,end:/'/,contains:[{match:/''/,scope:"char.escape",relevance:0}]},G={className:"string",relevance:0,variants:[{begin:/"/,end:/"/},{begin:/\S+/}],contains:[$.BACKSLASH_ESCAPE,X]},H=$.inherit(G,{variants:[{begin:/'/,end:/'/,contains:[{begin:/''/,relevance:0}]},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),Y="[0-9]{4}(-[0-9][0-9]){0,2}",K="([Tt \\t][0-9][0-9]?(:[0-9][0-9]){2})?",W="(\\.[0-9]*)?",B="([ \\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?",q={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"},U={end:",",endsWithParent:!0,excludeEnd:!0,keywords:"true false yes no null",relevance:0},F={begin:/\{/,end:/\}/,contains:[U],illegal:"\\n",relevance:0},N={begin:"\\[",end:"\\]",contains:[U],illegal:"\\n",relevance:0},L=[Q,{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"}},q,{className:"number",begin:$.C_NUMBER_RE+"\\b",relevance:0},F,N,z,G],V=[...L];return V.pop(),V.push(H),U.contains=V,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:L}}var iN={arduino:$R,bash:ZR,c:JR,cpp:QR,csharp:XR,css:zR,diff:GR,go:HR,graphql:YR,ini:KR,java:qR,javascript:VR,json:LR,kotlin:MR,less:DR,lua:OR,makefile:PR,markdown:wR,objectivec:jR,perl:TR,php:CR,"php-template":ER,plaintext:SR,python:kR,"python-repl":IR,r:RR,ruby:yR,rust:bR,scss:xR,shell:hR,sql:gR,swift:lR,typescript:eR,vbnet:$y,wasm:Zy,xml:Jy,yaml:Qy};var Cy=P(Ty(),1);var Ey=Cy.default;var Sy={},$80="hljs-";function eN($){let Z=Ey.newInstance();if($)z($);return{highlight:J,highlightAuto:Q,listLanguages:X,register:z,registerAlias:G,registered:H};function J(Y,K,W){x5(typeof Y==="string","expected `string` as `name`"),x5(typeof K==="string","expected `string` as `value`");let B=W||Sy,q=typeof B.prefix==="string"?B.prefix:$80;if(!Z.getLanguage(Y))throw Error("Unknown language: `"+Y+"` is not registered");Z.configure({__emitter:ky,classPrefix:q});let U=Z.highlight(K,{ignoreIllegals:!0,language:Y});if(U.errorRaised)throw Error("Could not highlight with `Highlight.js`",{cause:U.errorRaised});let F=U._emitter.root,N=F.data;return N.language=U.language,N.relevance=U.relevance,F}function Q(Y,K){x5(typeof Y==="string","expected `string` as `value`");let B=(K||Sy).subset||X(),q=-1,U=0,F;while(++q<B.length){let N=B[q];if(!Z.getLanguage(N))continue;let L=J(N,Y,K);if(L.data&&L.data.relevance!==void 0&&L.data.relevance>U)U=L.data.relevance,F=L}return F||{type:"root",children:[],data:{language:void 0,relevance:U}}}function X(){return Z.listLanguages()}function z(Y,K){if(typeof Y==="string")x5(K!==void 0,"expected `grammar`"),Z.registerLanguage(Y,K);else{let W;for(W in Y)if(Object.hasOwn(Y,W))Z.registerLanguage(W,Y[W])}}function G(Y,K){if(typeof Y==="string")x5(K!==void 0),Z.registerAliases(typeof K==="string"?K:[...K],{languageName:Y});else{let W;for(W in Y)if(Object.hasOwn(Y,W)){let B=Y[W];Z.registerAliases(typeof B==="string"?B:[...B],{languageName:W})}}}function H(Y){return Boolean(Z.getLanguage(Y))}}class ky{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],Q=$.root.children;if(Z)J.children.push({type:"element",tagName:"span",properties:{className:[Z]},children:Q});else J.children.push(...Q)}openNode($){let Z=this,J=$.split(".").map(function(z,G){return G?z+"_".repeat(G):Z.options.classPrefix+z}),Q=this.stack[this.stack.length-1],X={type:"element",tagName:"span",properties:{className:J},children:[]};Q.children.push(X),this.stack.push(X)}closeNode(){this.stack.pop()}finalize(){}toHTML(){return""}}var Z80={};function XW($){let Z=$||Z80,J=Z.aliases,Q=Z.detect||!1,X=Z.languages||iN,z=Z.plainText,G=Z.prefix,H=Z.subset,Y="hljs",K=eN(X);if(J)K.registerAlias(J);if(G){let W=G.indexOf("-");Y=W===-1?G:G.slice(0,W)}return function(W,B){y9(W,"element",function(q,U,F){if(q.tagName!=="code"||!F||F.type!=="element"||F.tagName!=="pre")return;let N=J80(q);if(N===!1||!N&&!Q||N&&z&&z.includes(N))return;if(!Array.isArray(q.properties.className))q.properties.className=[];if(!q.properties.className.includes(Y))q.properties.className.unshift(Y);let L=uN(q,{whitespace:"pre"}),V;try{V=N?K.highlight(N,L,{prefix:G}):K.highlightAuto(L,{prefix:G,subset:H})}catch(M){let _=M;if(N&&/Unknown language/.test(_.message)){B.message("Cannot highlight as `"+N+"`, it’s not registered",{ancestors:[F,q],cause:_,place:q.position,ruleId:"missing-language",source:"rehype-highlight"});return}throw _}if(!N&&V.data&&V.data.language)q.properties.className.push("language-"+V.data.language);if(V.children.length>0)q.children=V.children})}}function J80($){let Z=$.properties.className,J=-1;if(!Array.isArray(Z))return;let Q;while(++J<Z.length){let X=String(Z[J]);if(X==="no-highlight"||X==="nohighlight")return!1;if(!Q&&X.slice(0,5)==="lang-")Q=X.slice(5);if(!Q&&X.slice(0,9)==="language-")Q=X.slice(9)}return Q}function $V($,Z){let J=String($);if(typeof Z!=="string")throw TypeError("Expected character");let Q=0,X=J.indexOf(Z);while(X!==-1)Q++,X=J.indexOf(Z,X+Z.length);return Q}function ZV($){if(typeof $!=="string")throw TypeError("Expected a string");return $.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function JV($,Z,J){let X=W9((J||{}).ignore||[]),z=Q80(Z),G=-1;while(++G<z.length)aQ($,"text",H);function H(K,W){let B=-1,q;while(++B<W.length){let U=W[B],F=q?q.children:void 0;if(X(U,F?F.indexOf(U):void 0,q))return;q=U}if(q)return Y(K,W)}function Y(K,W){let B=W[W.length-1],q=z[G][0],U=z[G][1],F=0,L=B.children.indexOf(K),V=!1,M=[];q.lastIndex=0;let _=q.exec(K.value);while(_){let O=_.index,D={index:_.index,input:_.input,stack:[...W,K]},A=U(..._,D);if(typeof A==="string")A=A.length>0?{type:"text",value:A}:void 0;if(A===!1)q.lastIndex=O+1;else{if(F!==O)M.push({type:"text",value:K.value.slice(F,O)});if(Array.isArray(A))M.push(...A);else if(A)M.push(A);F=O+_[0].length,V=!0}if(!q.global)break;_=q.exec(K.value)}if(V){if(F<K.value.length)M.push({type:"text",value:K.value.slice(F)});B.children.splice(L,1,...M)}else M=[K];return L+M.length}}function Q80($){let Z=[];if(!Array.isArray($))throw TypeError("Expected find and replace tuple or list of tuples");let J=!$[0]||Array.isArray($[0])?$:[$],Q=-1;while(++Q<J.length){let X=J[Q];Z.push([X80(X[0]),z80(X[1])])}return Z}function X80($){return typeof $==="string"?new RegExp(ZV($),"g"):$}function z80($){return typeof $==="function"?$:function(){return $}}var QV="phrasing",XV=["autolink","link","image","label"];function GV(){return{transforms:[B80],enter:{literalAutolink:G80,literalAutolinkEmail:zV,literalAutolinkHttp:zV,literalAutolinkWww:zV},exit:{literalAutolink:W80,literalAutolinkEmail:K80,literalAutolinkHttp:H80,literalAutolinkWww:Y80}}}function HV(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:QV,notInConstruct:XV},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:QV,notInConstruct:XV},{character:":",before:"[ps]",after:"\\/",inConstruct:QV,notInConstruct:XV}]}}function G80($){this.enter({type:"link",title:null,url:"",children:[]},$)}function zV($){this.config.enter.autolinkProtocol.call(this,$)}function H80($){this.config.exit.autolinkProtocol.call(this,$)}function Y80($){this.config.exit.data.call(this,$);let Z=this.stack[this.stack.length-1];x5(Z.type==="link"),Z.url="http://"+this.sliceSerialize($)}function K80($){this.config.exit.autolinkEmail.call(this,$)}function W80($){this.exit($)}function B80($){JV($,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,q80],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,U80]],{ignore:["link","linkReference"]})}function q80($,Z,J,Q,X){let z="";if(!Iy(X))return!1;if(/^w/i.test(Z))J=Z+J,Z="",z="http://";if(!F80(J))return!1;let G=N80(J+Q);if(!G[0])return!1;let H={type:"link",title:null,url:z+Z+G[0],children:[{type:"text",value:Z+G[0]}]};if(G[1])return[H,{type:"text",value:G[1]}];return H}function U80($,Z,J,Q){if(!Iy(Q,!0)||/[-\d_]$/.test(J))return!1;return{type:"link",title:null,url:"mailto:"+Z+"@"+J,children:[{type:"text",value:Z+"@"+J}]}}function F80($){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 N80($){let Z=/[!"&'),.:;<>?\]}]+$/.exec($);if(!Z)return[$,void 0];$=$.slice(0,Z.index);let J=Z[0],Q=J.indexOf(")"),X=$V($,"("),z=$V($,")");while(Q!==-1&&X>z)$+=J.slice(0,Q+1),J=J.slice(Q+1),Q=J.indexOf(")"),z++;return[$,J]}function Iy($,Z){let J=$.input.charCodeAt($.index-1);return($.index===0||Y9(J)||J7(J))&&(!Z||J!==47)}Ry.peek=w80;function V80(){this.buffer()}function L80($){this.enter({type:"footnoteReference",identifier:"",label:""},$)}function M80(){this.buffer()}function A80($){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},$)}function _80($){let Z=this.resume(),J=this.stack[this.stack.length-1];x5(J.type==="footnoteReference"),J.identifier=v8(this.sliceSerialize($)).toLowerCase(),J.label=Z}function D80($){this.exit($)}function O80($){let Z=this.resume(),J=this.stack[this.stack.length-1];x5(J.type==="footnoteDefinition"),J.identifier=v8(this.sliceSerialize($)).toLowerCase(),J.label=Z}function P80($){this.exit($)}function w80(){return"["}function Ry($,Z,J,Q){let X=J.createTracker(Q),z=X.move("[^"),G=J.enter("footnoteReference"),H=J.enter("reference");return z+=X.move(J.safe(J.associationId($),{after:"]",before:z})),H(),G(),z+=X.move("]"),z}function YV(){return{enter:{gfmFootnoteCallString:V80,gfmFootnoteCall:L80,gfmFootnoteDefinitionLabelString:M80,gfmFootnoteDefinition:A80},exit:{gfmFootnoteCallString:_80,gfmFootnoteCall:D80,gfmFootnoteDefinitionLabelString:O80,gfmFootnoteDefinition:P80}}}function KV($){let Z=!1;if($&&$.firstLineBlank)Z=!0;return{handlers:{footnoteDefinition:J,footnoteReference:Ry},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function J(Q,X,z,G){let H=z.createTracker(G),Y=H.move("[^"),K=z.enter("footnoteDefinition"),W=z.enter("label");if(Y+=H.move(z.safe(z.associationId(Q),{before:Y,after:"]"})),W(),Y+=H.move("]:"),Q.children&&Q.children.length>0)H.shift(4),Y+=H.move((Z?`
50
+ `:" ")+z.indentLines(z.containerFlow(Q,H.current()),Z?yy:j80));return K(),Y}}function j80($,Z,J){return Z===0?$:yy($,Z,J)}function yy($,Z,J){return(J?"":" ")+$}var T80=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];by.peek=S80;function WV(){return{canContainEols:["delete"],enter:{strikethrough:C80},exit:{strikethrough:E80}}}function BV(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:T80}],handlers:{delete:by}}}function C80($){this.enter({type:"delete",children:[]},$)}function E80($){this.exit($)}function by($,Z,J,Q){let X=J.createTracker(Q),z=J.enter("strikethrough"),G=X.move("~~");return G+=J.containerPhrasing($,{...X.current(),before:G,after:"~"}),G+=X.move("~~"),z(),G}function S80(){return"~"}function k80($){return $.length}function hy($,Z){let J=Z||{},Q=(J.align||[]).concat(),X=J.stringLength||k80,z=[],G=[],H=[],Y=[],K=0,W=-1;while(++W<$.length){let N=[],L=[],V=-1;if($[W].length>K)K=$[W].length;while(++V<$[W].length){let M=I80($[W][V]);if(J.alignDelimiters!==!1){let _=X(M);if(L[V]=_,Y[V]===void 0||_>Y[V])Y[V]=_}N.push(M)}G[W]=N,H[W]=L}let B=-1;if(typeof Q==="object"&&"length"in Q)while(++B<K)z[B]=xy(Q[B]);else{let N=xy(Q);while(++B<K)z[B]=N}B=-1;let q=[],U=[];while(++B<K){let N=z[B],L="",V="";if(N===99)L=":",V=":";else if(N===108)L=":";else if(N===114)V=":";let M=J.alignDelimiters===!1?1:Math.max(1,Y[B]-L.length-V.length),_=L+"-".repeat(M)+V;if(J.alignDelimiters!==!1){if(M=L.length+M+V.length,M>Y[B])Y[B]=M;U[B]=M}q[B]=_}G.splice(1,0,q),H.splice(1,0,U),W=-1;let F=[];while(++W<G.length){let N=G[W],L=H[W];B=-1;let V=[];while(++B<K){let M=N[B]||"",_="",O="";if(J.alignDelimiters!==!1){let D=Y[B]-(L[B]||0),A=z[B];if(A===114)_=" ".repeat(D);else if(A===99)if(D%2)_=" ".repeat(D/2+0.5),O=" ".repeat(D/2-0.5);else _=" ".repeat(D/2),O=_;else O=" ".repeat(D)}if(J.delimiterStart!==!1&&!B)V.push("|");if(J.padding!==!1&&!(J.alignDelimiters===!1&&M==="")&&(J.delimiterStart!==!1||B))V.push(" ");if(J.alignDelimiters!==!1)V.push(_);if(V.push(M),J.alignDelimiters!==!1)V.push(O);if(J.padding!==!1)V.push(" ");if(J.delimiterEnd!==!1||B!==K-1)V.push("|")}F.push(J.delimiterEnd===!1?V.join("").replace(/ +$/,""):V.join(""))}return F.join(`
51
+ `)}function I80($){return $===null||$===void 0?"":String($)}function xy($){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 gy($,Z,J,Q){let X=J.enter("blockquote"),z=J.createTracker(Q);z.move("> "),z.shift(2);let G=J.indentLines(J.containerFlow($,z.current()),R80);return X(),G}function R80($,Z,J){return">"+(J?"":" ")+$}function fy($,Z){return vy($,Z.inConstruct,!0)&&!vy($,Z.notInConstruct,!1)}function vy($,Z,J){if(typeof Z==="string")Z=[Z];if(!Z||Z.length===0)return J;let Q=-1;while(++Q<Z.length)if($.includes(Z[Q]))return!0;return!1}function qV($,Z,J,Q){let X=-1;while(++X<J.unsafe.length)if(J.unsafe[X].character===`
52
+ `&&fy(J.stack,J.unsafe[X]))return/[ \t]/.test(Q.before)?"":" ";return"\\\n"}function my($,Z){let J=String($),Q=J.indexOf(Z),X=Q,z=0,G=0;if(typeof Z!=="string")throw TypeError("Expected substring");while(Q!==-1){if(Q===X){if(++z>G)G=z}else z=1;X=Q+Z.length,Q=J.indexOf(Z,X)}return G}function py($,Z){return Boolean(Z.options.fences===!1&&$.value&&!$.lang&&/[^ \r\n]/.test($.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test($.value))}function uy($){let Z=$.options.fence||"`";if(Z!=="`"&&Z!=="~")throw Error("Cannot serialize code with `"+Z+"` for `options.fence`, expected `` ` `` or `~`");return Z}function cy($,Z,J,Q){let X=uy(J),z=$.value||"",G=X==="`"?"GraveAccent":"Tilde";if(py($,J)){let B=J.enter("codeIndented"),q=J.indentLines(z,y80);return B(),q}let H=J.createTracker(Q),Y=X.repeat(Math.max(my(z,X)+1,3)),K=J.enter("codeFenced"),W=H.move(Y);if($.lang){let B=J.enter(`codeFencedLang${G}`);W+=H.move(J.safe($.lang,{before:W,after:" ",encode:["`"],...H.current()})),B()}if($.lang&&$.meta){let B=J.enter(`codeFencedMeta${G}`);W+=H.move(" "),W+=H.move(J.safe($.meta,{before:W,after:`
53
+ `,encode:["`"],...H.current()})),B()}if(W+=H.move(`
54
+ `),z)W+=H.move(z+`
55
+ `);return W+=H.move(Y),K(),W}function y80($,Z,J){return(J?"":" ")+$}function KZ($){let Z=$.options.quote||'"';if(Z!=='"'&&Z!=="'")throw Error("Cannot serialize title with `"+Z+"` for `options.quote`, expected `\"`, or `'`");return Z}function dy($,Z,J,Q){let X=KZ(J),z=X==='"'?"Quote":"Apostrophe",G=J.enter("definition"),H=J.enter("label"),Y=J.createTracker(Q),K=Y.move("[");if(K+=Y.move(J.safe(J.associationId($),{before:K,after:"]",...Y.current()})),K+=Y.move("]: "),H(),!$.url||/[\0- \u007F]/.test($.url))H=J.enter("destinationLiteral"),K+=Y.move("<"),K+=Y.move(J.safe($.url,{before:K,after:">",...Y.current()})),K+=Y.move(">");else H=J.enter("destinationRaw"),K+=Y.move(J.safe($.url,{before:K,after:$.title?" ":`
56
+ `,...Y.current()}));if(H(),$.title)H=J.enter(`title${z}`),K+=Y.move(" "+X),K+=Y.move(J.safe($.title,{before:K,after:X,...Y.current()})),K+=Y.move(X),H();return G(),K}function ly($){let Z=$.options.emphasis||"*";if(Z!=="*"&&Z!=="_")throw Error("Cannot serialize emphasis with `"+Z+"` for `options.emphasis`, expected `*`, or `_`");return Z}function v6($){return"&#x"+$.toString(16).toUpperCase()+";"}function WZ($,Z,J){let Q=R9($),X=R9(Z);if(Q===void 0)return X===void 0?J==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:X===1?{inside:!0,outside:!0}:{inside:!1,outside:!0};if(Q===1)return X===void 0?{inside:!1,outside:!1}:X===1?{inside:!0,outside:!0}:{inside:!1,outside:!1};return X===void 0?{inside:!1,outside:!1}:X===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}UV.peek=b80;function UV($,Z,J,Q){let X=ly(J),z=J.enter("emphasis"),G=J.createTracker(Q),H=G.move(X),Y=G.move(J.containerPhrasing($,{after:X,before:H,...G.current()})),K=Y.charCodeAt(0),W=WZ(Q.before.charCodeAt(Q.before.length-1),K,X);if(W.inside)Y=v6(K)+Y.slice(1);let B=Y.charCodeAt(Y.length-1),q=WZ(Q.after.charCodeAt(0),B,X);if(q.inside)Y=Y.slice(0,-1)+v6(B);let U=G.move(X);return z(),J.attentionEncodeSurroundingInfo={after:q.outside,before:W.outside},H+Y+U}function b80($,Z,J){return J.options.emphasis||"*"}function iy($,Z){let J=!1;return y9($,function(Q){if("value"in Q&&/\r?\n|\r/.test(Q.value)||Q.type==="break")return J=!0,H7}),Boolean((!$.depth||$.depth<3)&&$7($)&&(Z.options.setext||J))}function ry($,Z,J,Q){let X=Math.max(Math.min(6,$.depth||1),1),z=J.createTracker(Q);if(iy($,J)){let W=J.enter("headingSetext"),B=J.enter("phrasing"),q=J.containerPhrasing($,{...z.current(),before:`
57
+ `,after:`
58
+ `});return B(),W(),q+`
59
+ `+(X===1?"=":"-").repeat(q.length-(Math.max(q.lastIndexOf("\r"),q.lastIndexOf(`
60
+ `))+1))}let G="#".repeat(X),H=J.enter("headingAtx"),Y=J.enter("phrasing");z.move(G+" ");let K=J.containerPhrasing($,{before:"# ",after:`
61
+ `,...z.current()});if(/^[\t ]/.test(K))K=v6(K.charCodeAt(0))+K.slice(1);if(K=K?G+" "+K:G,J.options.closeAtx)K+=" "+G;return Y(),H(),K}FV.peek=x80;function FV($){return $.value||""}function x80(){return"<"}NV.peek=h80;function NV($,Z,J,Q){let X=KZ(J),z=X==='"'?"Quote":"Apostrophe",G=J.enter("image"),H=J.enter("label"),Y=J.createTracker(Q),K=Y.move("![");if(K+=Y.move(J.safe($.alt,{before:K,after:"]",...Y.current()})),K+=Y.move("]("),H(),!$.url&&$.title||/[\0- \u007F]/.test($.url))H=J.enter("destinationLiteral"),K+=Y.move("<"),K+=Y.move(J.safe($.url,{before:K,after:">",...Y.current()})),K+=Y.move(">");else H=J.enter("destinationRaw"),K+=Y.move(J.safe($.url,{before:K,after:$.title?" ":")",...Y.current()}));if(H(),$.title)H=J.enter(`title${z}`),K+=Y.move(" "+X),K+=Y.move(J.safe($.title,{before:K,after:X,...Y.current()})),K+=Y.move(X),H();return K+=Y.move(")"),G(),K}function h80(){return"!"}VV.peek=g80;function VV($,Z,J,Q){let X=$.referenceType,z=J.enter("imageReference"),G=J.enter("label"),H=J.createTracker(Q),Y=H.move("!["),K=J.safe($.alt,{before:Y,after:"]",...H.current()});Y+=H.move(K+"]["),G();let W=J.stack;J.stack=[],G=J.enter("reference");let B=J.safe(J.associationId($),{before:Y,after:"]",...H.current()});if(G(),J.stack=W,z(),X==="full"||!K||K!==B)Y+=H.move(B+"]");else if(X==="shortcut")Y=Y.slice(0,-1);else Y+=H.move("]");return Y}function g80(){return"!"}LV.peek=v80;function LV($,Z,J){let Q=$.value||"",X="`",z=-1;while(new RegExp("(^|[^`])"+X+"([^`]|$)").test(Q))X+="`";if(/[^ \r\n]/.test(Q)&&(/^[ \r\n]/.test(Q)&&/[ \r\n]$/.test(Q)||/^`|`$/.test(Q)))Q=" "+Q+" ";while(++z<J.unsafe.length){let G=J.unsafe[z],H=J.compilePattern(G),Y;if(!G.atBreak)continue;while(Y=H.exec(Q)){let K=Y.index;if(Q.charCodeAt(K)===10&&Q.charCodeAt(K-1)===13)K--;Q=Q.slice(0,K)+" "+Q.slice(Y.index+1)}}return X+Q+X}function v80(){return"`"}function MV($,Z){let J=$7($);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))}AV.peek=f80;function AV($,Z,J,Q){let X=KZ(J),z=X==='"'?"Quote":"Apostrophe",G=J.createTracker(Q),H,Y;if(MV($,J)){let W=J.stack;J.stack=[],H=J.enter("autolink");let B=G.move("<");return B+=G.move(J.containerPhrasing($,{before:B,after:">",...G.current()})),B+=G.move(">"),H(),J.stack=W,B}H=J.enter("link"),Y=J.enter("label");let K=G.move("[");if(K+=G.move(J.containerPhrasing($,{before:K,after:"](",...G.current()})),K+=G.move("]("),Y(),!$.url&&$.title||/[\0- \u007F]/.test($.url))Y=J.enter("destinationLiteral"),K+=G.move("<"),K+=G.move(J.safe($.url,{before:K,after:">",...G.current()})),K+=G.move(">");else Y=J.enter("destinationRaw"),K+=G.move(J.safe($.url,{before:K,after:$.title?" ":")",...G.current()}));if(Y(),$.title)Y=J.enter(`title${z}`),K+=G.move(" "+X),K+=G.move(J.safe($.title,{before:K,after:X,...G.current()})),K+=G.move(X),Y();return K+=G.move(")"),H(),K}function f80($,Z,J){return MV($,J)?"<":"["}_V.peek=m80;function _V($,Z,J,Q){let X=$.referenceType,z=J.enter("linkReference"),G=J.enter("label"),H=J.createTracker(Q),Y=H.move("["),K=J.containerPhrasing($,{before:Y,after:"]",...H.current()});Y+=H.move(K+"]["),G();let W=J.stack;J.stack=[],G=J.enter("reference");let B=J.safe(J.associationId($),{before:Y,after:"]",...H.current()});if(G(),J.stack=W,z(),X==="full"||!K||K!==B)Y+=H.move(B+"]");else if(X==="shortcut")Y=Y.slice(0,-1);else Y+=H.move("]");return Y}function m80(){return"["}function BZ($){let Z=$.options.bullet||"*";if(Z!=="*"&&Z!=="+"&&Z!=="-")throw Error("Cannot serialize items with `"+Z+"` for `options.bullet`, expected `*`, `+`, or `-`");return Z}function ay($){let Z=BZ($),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 ny($){let Z=$.options.bulletOrdered||".";if(Z!=="."&&Z!==")")throw Error("Cannot serialize items with `"+Z+"` for `options.bulletOrdered`, expected `.` or `)`");return Z}function zW($){let Z=$.options.rule||"*";if(Z!=="*"&&Z!=="-"&&Z!=="_")throw Error("Cannot serialize rules with `"+Z+"` for `options.rule`, expected `*`, `-`, or `_`");return Z}function oy($,Z,J,Q){let X=J.enter("list"),z=J.bulletCurrent,G=$.ordered?ny(J):BZ(J),H=$.ordered?G==="."?")":".":ay(J),Y=Z&&J.bulletLastUsed?G===J.bulletLastUsed:!1;if(!$.ordered){let W=$.children?$.children[0]:void 0;if((G==="*"||G==="-")&&W&&(!W.children||!W.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)Y=!0;if(zW(J)===G&&W){let B=-1;while(++B<$.children.length){let q=$.children[B];if(q&&q.type==="listItem"&&q.children&&q.children[0]&&q.children[0].type==="thematicBreak"){Y=!0;break}}}}if(Y)G=H;J.bulletCurrent=G;let K=J.containerFlow($,Q);return J.bulletLastUsed=G,J.bulletCurrent=z,X(),K}function sy($){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 ty($,Z,J,Q){let X=sy(J),z=J.bulletCurrent||BZ(J);if(Z&&Z.type==="list"&&Z.ordered)z=(typeof Z.start==="number"&&Z.start>-1?Z.start:1)+(J.options.incrementListMarker===!1?0:Z.children.indexOf($))+z;let G=z.length+1;if(X==="tab"||X==="mixed"&&(Z&&Z.type==="list"&&Z.spread||$.spread))G=Math.ceil(G/4)*4;let H=J.createTracker(Q);H.move(z+" ".repeat(G-z.length)),H.shift(G);let Y=J.enter("listItem"),K=J.indentLines(J.containerFlow($,H.current()),W);return Y(),K;function W(B,q,U){if(q)return(U?"":" ".repeat(G))+B;return(U?z:z+" ".repeat(G-z.length))+B}}function ey($,Z,J,Q){let X=J.enter("paragraph"),z=J.enter("phrasing"),G=J.containerPhrasing($,Q);return z(),X(),G}var DV=W9(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function $b($,Z,J,Q){return($.children.some(function(G){return DV(G)})?J.containerPhrasing:J.containerFlow).call(J,$,Q)}function Zb($){let Z=$.options.strong||"*";if(Z!=="*"&&Z!=="_")throw Error("Cannot serialize strong with `"+Z+"` for `options.strong`, expected `*`, or `_`");return Z}OV.peek=p80;function OV($,Z,J,Q){let X=Zb(J),z=J.enter("strong"),G=J.createTracker(Q),H=G.move(X+X),Y=G.move(J.containerPhrasing($,{after:X,before:H,...G.current()})),K=Y.charCodeAt(0),W=WZ(Q.before.charCodeAt(Q.before.length-1),K,X);if(W.inside)Y=v6(K)+Y.slice(1);let B=Y.charCodeAt(Y.length-1),q=WZ(Q.after.charCodeAt(0),B,X);if(q.inside)Y=Y.slice(0,-1)+v6(B);let U=G.move(X+X);return z(),J.attentionEncodeSurroundingInfo={after:q.outside,before:W.outside},H+Y+U}function p80($,Z,J){return J.options.strong||"*"}function Jb($,Z,J,Q){return J.safe($.value,Q)}function Qb($){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 Xb($,Z,J){let Q=(zW(J)+(J.options.ruleSpaces?" ":"")).repeat(Qb(J));return J.options.ruleSpaces?Q.slice(0,-1):Q}var $X={blockquote:gy,break:qV,code:cy,definition:dy,emphasis:UV,hardBreak:qV,heading:ry,html:FV,image:NV,imageReference:VV,inlineCode:LV,link:AV,linkReference:_V,list:oy,listItem:ty,paragraph:ey,root:$b,strong:OV,text:Jb,thematicBreak:Xb};function wV(){return{enter:{table:u80,tableData:zb,tableHeader:zb,tableRow:d80},exit:{codeText:l80,table:c80,tableData:PV,tableHeader:PV,tableRow:PV}}}function u80($){let Z=$._align;x5(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 c80($){this.exit($),this.data.inTable=void 0}function d80($){this.enter({type:"tableRow",children:[]},$)}function PV($){this.exit($)}function zb($){this.enter({type:"tableCell",children:[]},$)}function l80($){let Z=this.resume();if(this.data.inTable)Z=Z.replace(/\\([\\|])/g,i80);let J=this.stack[this.stack.length-1];x5(J.type==="inlineCode"),J.value=Z,this.exit($)}function i80($,Z){return Z==="|"?Z:$}function jV($){let Z=$||{},J=Z.tableCellPadding,Q=Z.tablePipeAlign,X=Z.stringLength,z=J?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
62
+ `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[\t :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:q,table:G,tableCell:Y,tableRow:H}};function G(U,F,N,L){return K(W(U,N,L),U.align)}function H(U,F,N,L){let V=B(U,N,L),M=K([V]);return M.slice(0,M.indexOf(`
63
+ `))}function Y(U,F,N,L){let V=N.enter("tableCell"),M=N.enter("phrasing"),_=N.containerPhrasing(U,{...L,before:z,after:z});return M(),V(),_}function K(U,F){return hy(U,{align:F,alignDelimiters:Q,padding:J,stringLength:X})}function W(U,F,N){let L=U.children,V=-1,M=[],_=F.enter("table");while(++V<L.length)M[V]=B(L[V],F,N);return _(),M}function B(U,F,N){let L=U.children,V=-1,M=[],_=F.enter("tableRow");while(++V<L.length)M[V]=Y(L[V],U,F,N);return _(),M}function q(U,F,N){let L=$X.inlineCode(U,F,N);if(N.stack.includes("tableCell"))L=L.replace(/\|/g,"\\$&");return L}}function TV(){return{exit:{taskListCheckValueChecked:Gb,taskListCheckValueUnchecked:Gb,paragraph:r80}}}function CV(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:a80}}}function Gb($){let Z=this.stack[this.stack.length-2];x5(Z.type==="listItem"),Z.checked=$.type==="taskListCheckValueChecked"}function r80($){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];x5(J.type==="paragraph");let Q=J.children[0];if(Q&&Q.type==="text"){let X=Z.children,z=-1,G;while(++z<X.length){let H=X[z];if(H.type==="paragraph"){G=H;break}}if(G===J){if(Q.value=Q.value.slice(1),Q.value.length===0)J.children.shift();else if(J.position&&Q.position&&typeof Q.position.start.offset==="number")Q.position.start.column++,Q.position.start.offset++,J.position.start=Object.assign({},Q.position.start)}}}this.exit($)}function a80($,Z,J,Q){let X=$.children[0],z=typeof $.checked==="boolean"&&X&&X.type==="paragraph",G="["+($.checked?"x":" ")+"] ",H=J.createTracker(Q);if(z)H.move(G);let Y=$X.listItem($,Z,J,{...Q,...H.current()});if(z)Y=Y.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,K);return Y;function K(W){return W+G}}function EV(){return[GV(),YV(),WV(),wV(),TV()]}function SV($){return{extensions:[HV(),KV($),BV(),jV($),CV()]}}var n80={tokenize:$40,partial:!0},Hb={tokenize:Z40,partial:!0},Yb={tokenize:J40,partial:!0},Kb={tokenize:Q40,partial:!0},o80={tokenize:X40,partial:!0},Wb={name:"wwwAutolink",tokenize:t80,previous:qb},Bb={name:"protocolAutolink",tokenize:e80,previous:Ub},x9={name:"emailAutolink",tokenize:s80,previous:Fb},q9={};function IV(){return{text:q9}}var W7=48;while(W7<123)if(q9[W7]=x9,W7++,W7===58)W7=65;else if(W7===91)W7=97;q9[43]=x9;q9[45]=x9;q9[46]=x9;q9[95]=x9;q9[72]=[x9,Bb];q9[104]=[x9,Bb];q9[87]=[x9,Wb];q9[119]=[x9,Wb];function s80($,Z,J){let Q=this,X,z;return G;function G(B){if(!kV(B)||!Fb.call(Q,Q.previous)||RV(Q.events))return J(B);return $.enter("literalAutolink"),$.enter("literalAutolinkEmail"),H(B)}function H(B){if(kV(B))return $.consume(B),H;if(B===64)return $.consume(B),Y;return J(B)}function Y(B){if(B===46)return $.check(o80,W,K)(B);if(B===45||B===95||g1(B))return z=!0,$.consume(B),Y;return W(B)}function K(B){return $.consume(B),X=!0,Y}function W(B){if(z&&X&&Q8(Q.previous))return $.exit("literalAutolinkEmail"),$.exit("literalAutolink"),Z(B);return J(B)}}function t80($,Z,J){let Q=this;return X;function X(G){if(G!==87&&G!==119||!qb.call(Q,Q.previous)||RV(Q.events))return J(G);return $.enter("literalAutolink"),$.enter("literalAutolinkWww"),$.check(n80,$.attempt(Hb,$.attempt(Yb,z),J),J)(G)}function z(G){return $.exit("literalAutolinkWww"),$.exit("literalAutolink"),Z(G)}}function e80($,Z,J){let Q=this,X="",z=!1;return G;function G(B){if((B===72||B===104)&&Ub.call(Q,Q.previous)&&!RV(Q.events))return $.enter("literalAutolink"),$.enter("literalAutolinkHttp"),X+=String.fromCodePoint(B),$.consume(B),H;return J(B)}function H(B){if(Q8(B)&&X.length<5)return X+=String.fromCodePoint(B),$.consume(B),H;if(B===58){let q=X.toLowerCase();if(q==="http"||q==="https")return $.consume(B),Y}return J(B)}function Y(B){if(B===47){if($.consume(B),z)return K;return z=!0,Y}return J(B)}function K(B){return B===null||Z7(B)||L5(B)||Y9(B)||J7(B)?J(B):$.attempt(Hb,$.attempt(Yb,W),J)(B)}function W(B){return $.exit("literalAutolinkHttp"),$.exit("literalAutolink"),Z(B)}}function $40($,Z,J){let Q=0;return X;function X(G){if((G===87||G===119)&&Q<3)return Q++,$.consume(G),X;if(G===46&&Q===3)return $.consume(G),z;return J(G)}function z(G){return G===null?J(G):Z(G)}}function Z40($,Z,J){let Q,X,z;return G;function G(K){if(K===46||K===95)return $.check(Kb,Y,H)(K);if(K===null||L5(K)||Y9(K)||K!==45&&J7(K))return Y(K);return z=!0,$.consume(K),G}function H(K){if(K===95)Q=!0;else X=Q,Q=void 0;return $.consume(K),G}function Y(K){if(X||Q||!z)return J(K);return Z(K)}}function J40($,Z){let J=0,Q=0;return X;function X(G){if(G===40)return J++,$.consume(G),X;if(G===41&&Q<J)return z(G);if(G===33||G===34||G===38||G===39||G===41||G===42||G===44||G===46||G===58||G===59||G===60||G===63||G===93||G===95||G===126)return $.check(Kb,Z,z)(G);if(G===null||L5(G)||Y9(G))return Z(G);return $.consume(G),X}function z(G){if(G===41)Q++;return $.consume(G),X}}function Q40($,Z,J){return Q;function Q(H){if(H===33||H===34||H===39||H===41||H===42||H===44||H===46||H===58||H===59||H===63||H===95||H===126)return $.consume(H),Q;if(H===38)return $.consume(H),z;if(H===93)return $.consume(H),X;if(H===60||H===null||L5(H)||Y9(H))return Z(H);return J(H)}function X(H){if(H===null||H===40||H===91||L5(H)||Y9(H))return Z(H);return Q(H)}function z(H){return Q8(H)?G(H):J(H)}function G(H){if(H===59)return $.consume(H),Q;if(Q8(H))return $.consume(H),G;return J(H)}}function X40($,Z,J){return Q;function Q(z){return $.consume(z),X}function X(z){return g1(z)?J(z):Z(z)}}function qb($){return $===null||$===40||$===42||$===95||$===91||$===93||$===126||L5($)}function Ub($){return!Q8($)}function Fb($){return!($===47||kV($))}function kV($){return $===43||$===45||$===46||$===95||g1($)}function RV($){let Z=$.length,J=!1;while(Z--){let Q=$[Z][1];if((Q.type==="labelLink"||Q.type==="labelImage")&&!Q._balanced){J=!0;break}if(Q._gfmAutolinkLiteralWalkedInto){J=!1;break}}if($.length>0&&!J)$[$.length-1][1]._gfmAutolinkLiteralWalkedInto=!0;return J}var z40={tokenize:q40,partial:!0};function yV(){return{document:{[91]:{name:"gfmFootnoteDefinition",tokenize:K40,continuation:{tokenize:W40},exit:B40}},text:{[91]:{name:"gfmFootnoteCall",tokenize:Y40},[93]:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:G40,resolveTo:H40}}}}function G40($,Z,J){let Q=this,X=Q.events.length,z=Q.parser.gfmFootnotes||(Q.parser.gfmFootnotes=[]),G;while(X--){let Y=Q.events[X][1];if(Y.type==="labelImage"){G=Y;break}if(Y.type==="gfmFootnoteCall"||Y.type==="labelLink"||Y.type==="label"||Y.type==="image"||Y.type==="link")break}return H;function H(Y){if(!G||!G._balanced)return J(Y);let K=v8(Q.sliceSerialize({start:G.end,end:Q.now()}));if(K.codePointAt(0)!==94||!z.includes(K.slice(1)))return J(Y);return $.enter("gfmFootnoteCallLabelMarker"),$.consume(Y),$.exit("gfmFootnoteCallLabelMarker"),Z(Y)}}function H40($,Z){let J=$.length,Q;while(J--)if($[J][1].type==="labelImage"&&$[J][0]==="enter"){Q=$[J][1];break}$[J+1][1].type="data",$[J+3][1].type="gfmFootnoteCallLabelMarker";let X={type:"gfmFootnoteCall",start:Object.assign({},$[J+3][1].start),end:Object.assign({},$[$.length-1][1].end)},z={type:"gfmFootnoteCallMarker",start:Object.assign({},$[J+3][1].end),end:Object.assign({},$[J+3][1].end)};z.end.column++,z.end.offset++,z.end._bufferIndex++;let G={type:"gfmFootnoteCallString",start:Object.assign({},z.end),end:Object.assign({},$[$.length-1][1].start)},H={type:"chunkString",contentType:"string",start:Object.assign({},G.start),end:Object.assign({},G.end)},Y=[$[J+1],$[J+2],["enter",X,Z],$[J+3],$[J+4],["enter",z,Z],["exit",z,Z],["enter",G,Z],["enter",H,Z],["exit",H,Z],["exit",G,Z],$[$.length-2],$[$.length-1],["exit",X,Z]];return $.splice(J,$.length-J+1,...Y),$}function Y40($,Z,J){let Q=this,X=Q.parser.gfmFootnotes||(Q.parser.gfmFootnotes=[]),z=0,G;return H;function H(B){return $.enter("gfmFootnoteCall"),$.enter("gfmFootnoteCallLabelMarker"),$.consume(B),$.exit("gfmFootnoteCallLabelMarker"),Y}function Y(B){if(B!==94)return J(B);return $.enter("gfmFootnoteCallMarker"),$.consume(B),$.exit("gfmFootnoteCallMarker"),$.enter("gfmFootnoteCallString"),$.enter("chunkString").contentType="string",K}function K(B){if(z>999||B===93&&!G||B===null||B===91||L5(B))return J(B);if(B===93){$.exit("chunkString");let q=$.exit("gfmFootnoteCallString");if(!X.includes(v8(Q.sliceSerialize(q))))return J(B);return $.enter("gfmFootnoteCallLabelMarker"),$.consume(B),$.exit("gfmFootnoteCallLabelMarker"),$.exit("gfmFootnoteCall"),Z}if(!L5(B))G=!0;return z++,$.consume(B),B===92?W:K}function W(B){if(B===91||B===92||B===93)return $.consume(B),z++,K;return K(B)}}function K40($,Z,J){let Q=this,X=Q.parser.gfmFootnotes||(Q.parser.gfmFootnotes=[]),z,G=0,H;return Y;function Y(F){return $.enter("gfmFootnoteDefinition")._container=!0,$.enter("gfmFootnoteDefinitionLabel"),$.enter("gfmFootnoteDefinitionLabelMarker"),$.consume(F),$.exit("gfmFootnoteDefinitionLabelMarker"),K}function K(F){if(F===94)return $.enter("gfmFootnoteDefinitionMarker"),$.consume(F),$.exit("gfmFootnoteDefinitionMarker"),$.enter("gfmFootnoteDefinitionLabelString"),$.enter("chunkString").contentType="string",W;return J(F)}function W(F){if(G>999||F===93&&!H||F===null||F===91||L5(F))return J(F);if(F===93){$.exit("chunkString");let N=$.exit("gfmFootnoteDefinitionLabelString");return z=v8(Q.sliceSerialize(N)),$.enter("gfmFootnoteDefinitionLabelMarker"),$.consume(F),$.exit("gfmFootnoteDefinitionLabelMarker"),$.exit("gfmFootnoteDefinitionLabel"),q}if(!L5(F))H=!0;return G++,$.consume(F),F===92?B:W}function B(F){if(F===91||F===92||F===93)return $.consume(F),G++,W;return W(F)}function q(F){if(F===58){if($.enter("definitionMarker"),$.consume(F),$.exit("definitionMarker"),!X.includes(z))X.push(z);return i0($,U,"gfmFootnoteDefinitionWhitespace")}return J(F)}function U(F){return Z(F)}}function W40($,Z,J){return $.check(K9,Z,$.attempt(z40,Z,J))}function B40($){$.exit("gfmFootnoteDefinition")}function q40($,Z,J){let Q=this;return i0($,X,"gfmFootnoteDefinitionIndent",5);function X(z){let G=Q.events[Q.events.length-1];return G&&G[1].type==="gfmFootnoteDefinitionIndent"&&G[2].sliceSerialize(G[1],!0).length===4?Z(z):J(z)}}function bV($){let J=($||{}).singleTilde,Q={name:"strikethrough",tokenize:z,resolveAll:X};if(J===null||J===void 0)J=!0;return{text:{[126]:Q},insideSpan:{null:[Q]},attentionMarkers:{null:[126]}};function X(G,H){let Y=-1;while(++Y<G.length)if(G[Y][0]==="enter"&&G[Y][1].type==="strikethroughSequenceTemporary"&&G[Y][1]._close){let K=Y;while(K--)if(G[K][0]==="exit"&&G[K][1].type==="strikethroughSequenceTemporary"&&G[K][1]._open&&G[Y][1].end.offset-G[Y][1].start.offset===G[K][1].end.offset-G[K][1].start.offset){G[Y][1].type="strikethroughSequence",G[K][1].type="strikethroughSequence";let W={type:"strikethrough",start:Object.assign({},G[K][1].start),end:Object.assign({},G[Y][1].end)},B={type:"strikethroughText",start:Object.assign({},G[K][1].end),end:Object.assign({},G[Y][1].start)},q=[["enter",W,H],["enter",G[K][1],H],["exit",G[K][1],H],["enter",B,H]],U=H.parser.constructs.insideSpan.null;if(U)u1(q,q.length,0,x6(U,G.slice(K+1,Y),H));u1(q,q.length,0,[["exit",B,H],["enter",G[Y][1],H],["exit",G[Y][1],H],["exit",W,H]]),u1(G,K-1,Y-K+3,q),Y=K+q.length-2;break}}Y=-1;while(++Y<G.length)if(G[Y][1].type==="strikethroughSequenceTemporary")G[Y][1].type="data";return G}function z(G,H,Y){let K=this.previous,W=this.events,B=0;return q;function q(F){if(K===126&&W[W.length-1][1].type!=="characterEscape")return Y(F);return G.enter("strikethroughSequenceTemporary"),U(F)}function U(F){let N=R9(K);if(F===126){if(B>1)return Y(F);return G.consume(F),B++,U}if(B<2&&!J)return Y(F);let L=G.exit("strikethroughSequenceTemporary"),V=R9(F);return L._open=!V||V===2&&Boolean(N),L._close=!N||N===2&&Boolean(V),H(F)}}}class xV{constructor(){this.map=[]}add($,Z,J){U40(this,$,Z,J)}consume($){if(this.map.sort(function(X,z){return X[0]-z[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 Q=J.pop();while(Q){for(let X of Q)$.push(X);Q=J.pop()}this.map.length=0}}function U40($,Z,J,Q){let X=0;if(J===0&&Q.length===0)return;while(X<$.map.length){if($.map[X][0]===Z){$.map[X][1]+=J,$.map[X][2].push(...Q);return}X+=1}$.map.push([Z,J,Q])}function Nb($,Z){let J=!1,Q=[];while(Z<$.length){let X=$[Z];if(J){if(X[0]==="enter"){if(X[1].type==="tableContent")Q.push($[Z+1][1].type==="tableDelimiterMarker"?"left":"none")}else if(X[1].type==="tableContent"){if($[Z-1][1].type==="tableDelimiterMarker"){let z=Q.length-1;Q[z]=Q[z]==="left"?"center":"right"}}else if(X[1].type==="tableDelimiterRow")break}else if(X[0]==="enter"&&X[1].type==="tableDelimiterRow")J=!0;Z+=1}return Q}function hV(){return{flow:{null:{name:"table",tokenize:F40,resolveAll:N40}}}}function F40($,Z,J){let Q=this,X=0,z=0,G;return H;function H(C){let h=Q.events.length-1;while(h>-1){let w=Q.events[h][1].type;if(w==="lineEnding"||w==="linePrefix")h--;else break}let k=h>-1?Q.events[h][1].type:null,S=k==="tableHead"||k==="tableRow"?A:Y;if(S===A&&Q.parser.lazy[Q.now().line])return J(C);return S(C)}function Y(C){return $.enter("tableHead"),$.enter("tableRow"),K(C)}function K(C){if(C===124)return W(C);return G=!0,z+=1,W(C)}function W(C){if(C===null)return J(C);if(b0(C)){if(z>1)return z=0,Q.interrupt=!0,$.exit("tableRow"),$.enter("lineEnding"),$.consume(C),$.exit("lineEnding"),U;return J(C)}if(a0(C))return i0($,W,"whitespace")(C);if(z+=1,G)G=!1,X+=1;if(C===124)return $.enter("tableCellDivider"),$.consume(C),$.exit("tableCellDivider"),G=!0,W;return $.enter("data"),B(C)}function B(C){if(C===null||C===124||L5(C))return $.exit("data"),W(C);return $.consume(C),C===92?q:B}function q(C){if(C===92||C===124)return $.consume(C),B;return B(C)}function U(C){if(Q.interrupt=!1,Q.parser.lazy[Q.now().line])return J(C);if($.enter("tableDelimiterRow"),G=!1,a0(C))return i0($,F,"linePrefix",Q.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(C);return F(C)}function F(C){if(C===45||C===58)return L(C);if(C===124)return G=!0,$.enter("tableCellDivider"),$.consume(C),$.exit("tableCellDivider"),N;return D(C)}function N(C){if(a0(C))return i0($,L,"whitespace")(C);return L(C)}function L(C){if(C===58)return z+=1,G=!0,$.enter("tableDelimiterMarker"),$.consume(C),$.exit("tableDelimiterMarker"),V;if(C===45)return z+=1,V(C);if(C===null||b0(C))return O(C);return D(C)}function V(C){if(C===45)return $.enter("tableDelimiterFiller"),M(C);return D(C)}function M(C){if(C===45)return $.consume(C),M;if(C===58)return G=!0,$.exit("tableDelimiterFiller"),$.enter("tableDelimiterMarker"),$.consume(C),$.exit("tableDelimiterMarker"),_;return $.exit("tableDelimiterFiller"),_(C)}function _(C){if(a0(C))return i0($,O,"whitespace")(C);return O(C)}function O(C){if(C===124)return F(C);if(C===null||b0(C)){if(!G||X!==z)return D(C);return $.exit("tableDelimiterRow"),$.exit("tableHead"),Z(C)}return D(C)}function D(C){return J(C)}function A(C){return $.enter("tableRow"),E(C)}function E(C){if(C===124)return $.enter("tableCellDivider"),$.consume(C),$.exit("tableCellDivider"),E;if(C===null||b0(C))return $.exit("tableRow"),Z(C);if(a0(C))return i0($,E,"whitespace")(C);return $.enter("data"),I(C)}function I(C){if(C===null||C===124||L5(C))return $.exit("data"),E(C);return $.consume(C),C===92?y:I}function y(C){if(C===92||C===124)return $.consume(C),I;return I(C)}}function N40($,Z){let J=-1,Q=!0,X=0,z=[0,0,0,0],G=[0,0,0,0],H=!1,Y=0,K,W,B,q=new xV;while(++J<$.length){let U=$[J],F=U[1];if(U[0]==="enter"){if(F.type==="tableHead"){if(H=!1,Y!==0)Vb(q,Z,Y,K,W),W=void 0,Y=0;K={type:"table",start:Object.assign({},F.start),end:Object.assign({},F.end)},q.add(J,0,[["enter",K,Z]])}else if(F.type==="tableRow"||F.type==="tableDelimiterRow"){if(Q=!0,B=void 0,z=[0,0,0,0],G=[0,J+1,0,0],H)H=!1,W={type:"tableBody",start:Object.assign({},F.start),end:Object.assign({},F.end)},q.add(J,0,[["enter",W,Z]]);X=F.type==="tableDelimiterRow"?2:W?3:1}else if(X&&(F.type==="data"||F.type==="tableDelimiterMarker"||F.type==="tableDelimiterFiller")){if(Q=!1,G[2]===0){if(z[1]!==0)G[0]=G[1],B=GW(q,Z,z,X,void 0,B),z=[0,0,0,0];G[2]=J}}else if(F.type==="tableCellDivider")if(Q)Q=!1;else{if(z[1]!==0)G[0]=G[1],B=GW(q,Z,z,X,void 0,B);z=G,G=[z[1],J,0,0]}}else if(F.type==="tableHead")H=!0,Y=J;else if(F.type==="tableRow"||F.type==="tableDelimiterRow"){if(Y=J,z[1]!==0)G[0]=G[1],B=GW(q,Z,z,X,J,B);else if(G[1]!==0)B=GW(q,Z,G,X,J,B);X=0}else if(X&&(F.type==="data"||F.type==="tableDelimiterMarker"||F.type==="tableDelimiterFiller"))G[3]=J}if(Y!==0)Vb(q,Z,Y,K,W);q.consume(Z.events),J=-1;while(++J<Z.events.length){let U=Z.events[J];if(U[0]==="enter"&&U[1].type==="table")U[1]._align=Nb(Z.events,J)}return $}function GW($,Z,J,Q,X,z){let G=Q===1?"tableHeader":Q===2?"tableDelimiter":"tableData",H="tableContent";if(J[0]!==0)z.end=Object.assign({},qZ(Z.events,J[0])),$.add(J[0],0,[["exit",z,Z]]);let Y=qZ(Z.events,J[1]);if(z={type:G,start:Object.assign({},Y),end:Object.assign({},Y)},$.add(J[1],0,[["enter",z,Z]]),J[2]!==0){let K=qZ(Z.events,J[2]),W=qZ(Z.events,J[3]),B={type:"tableContent",start:Object.assign({},K),end:Object.assign({},W)};if($.add(J[2],0,[["enter",B,Z]]),Q!==2){let q=Z.events[J[2]],U=Z.events[J[3]];if(q[1].end=Object.assign({},U[1].end),q[1].type="chunkText",q[1].contentType="text",J[3]>J[2]+1){let F=J[2]+1,N=J[3]-J[2]-1;$.add(F,N,[])}}$.add(J[3]+1,0,[["exit",B,Z]])}if(X!==void 0)z.end=Object.assign({},qZ(Z.events,X)),$.add(X,0,[["exit",z,Z]]),z=void 0;return z}function Vb($,Z,J,Q,X){let z=[],G=qZ(Z.events,J);if(X)X.end=Object.assign({},G),z.push(["exit",X,Z]);Q.end=Object.assign({},G),z.push(["exit",Q,Z]),$.add(J+1,0,z)}function qZ($,Z){let J=$[Z],Q=J[0]==="enter"?"start":"end";return J[1][Q]}var V40={name:"tasklistCheck",tokenize:L40};function gV(){return{text:{[91]:V40}}}function L40($,Z,J){let Q=this;return X;function X(Y){if(Q.previous!==null||!Q._gfmTasklistFirstContentOfListItem)return J(Y);return $.enter("taskListCheck"),$.enter("taskListCheckMarker"),$.consume(Y),$.exit("taskListCheckMarker"),z}function z(Y){if(L5(Y))return $.enter("taskListCheckValueUnchecked"),$.consume(Y),$.exit("taskListCheckValueUnchecked"),G;if(Y===88||Y===120)return $.enter("taskListCheckValueChecked"),$.consume(Y),$.exit("taskListCheckValueChecked"),G;return J(Y)}function G(Y){if(Y===93)return $.enter("taskListCheckMarker"),$.consume(Y),$.exit("taskListCheckMarker"),$.exit("taskListCheck"),H;return J(Y)}function H(Y){if(b0(Y))return Z(Y);if(a0(Y))return $.check({tokenize:M40},Z,J)(Y);return J(Y)}}function M40($,Z,J){return i0($,Q,"whitespace");function Q(X){return X===null?J(X):Z(X)}}function Lb($){return DK([IV(),yV(),bV($),hV(),gV()])}var A40={};function HW($){let Z=this,J=$||A40,Q=Z.data(),X=Q.micromarkExtensions||(Q.micromarkExtensions=[]),z=Q.fromMarkdownExtensions||(Q.fromMarkdownExtensions=[]),G=Q.toMarkdownExtensions||(Q.toMarkdownExtensions=[]);X.push(Lb(J)),z.push(EV()),G.push(SV(J))}var B7=P(d(),1),_40=[HW],D40=[XW],O40={code({className:$,children:Z,...J}){return B7.jsx("code",{className:s("rounded-xs bg-accent px-1 py-0.5 font-mono font-normal before:content-none after:content-none",$),...J,children:Z})},pre({children:$}){return B7.jsx("div",{className:"not-prose my-2 rounded-lg border border-border bg-accent px-3 py-2.5",children:B7.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 Mb({size:$="sm",content:Z}){return B7.jsx("div",{className:s("prose max-w-full min-w-0 wrap-anywhere prose-inherit",$==="sm"&&"prose-sm"),children:B7.jsx(rK,{remarkPlugins:_40,rehypePlugins:D40,components:O40,children:Z})})}function Ab({content:$}){return B7.jsx(rK,{allowedElements:[],skipHtml:!0,unwrapDisallowed:!0,children:$})}var zL=P(v(),1);var _b="/agentation-4s0nn45p.png";var Db="/airtable-hsa66v6q.png";var Ob="/apollo-2ed5dy2d.png";var Pb="/asana-tvgtwbx2.png";var wb="/atlassian-b3tq39hs.png";var jb="/box-w3n36t5g.png";var vV="/chrome-tspm94rw.svg";var Tb="/clickup-qqrqqvqb.png";var Cb="/cloudflare-j9p931v6.png";var Eb="/context7-8ht0xjfy.png";var Sb="/datadog-70ne3yzt.png";var kb="/discord-vejhptwx.png";var Ib="/dropbox-4m5s9mgr.png";var Rb="/elevenlabs-2nzzej1t.png";var yb="/exa-qqj3vr0x.png";var bb="/figma-y9898rry.png";var xb="/firecrawl-w2t8nehx.png";var hb="/github-av5r5y3e.png";var gb="/gitlab-4pv5vm6b.png";var vb="/gmail-sg6a5v3x.png";var fb="/googlecalendar-nqhh2v7r.png";var mb="/googledrive-6s8xyab7.png";var pb="/grafana-1yfsnwr6.png";var ub="/granola-7j3b0nk2.png";var cb="/hubspot-hghcmc2t.png";var db="/huggingface-kxzaxj83.png";var lb="/intercom-td763jt8.png";var ib="/linear-v9s3az2d.png";var rb="/monday-jdbs4wwf.png";var ab="/mongodb-emzxvhd5.png";var nb="/neon-zj4qar44.png";var ob="/notion-w034c0b8.png";var sb="/paper-zbt34fab.png";var tb="/paypal-kwwf7xsc.png";var eb="/perplexity-4y63rxvj.png";var $x="/postgresql-qsspbsr1.png";var Zx="/posthog-sphppc4w.png";var Jx="/puppeteer-2xjt1a9b.png";var Qx="/railway-834de8d2.png";var Xx="/redis-spm6w2m1.png";var zx="/salesforce-1mk56v4z.png";var Gx="/sentry-hdwpmvek.png";var Hx="/shopify-90dadaav.png";var Yx="/slack-1c1wj62s.png";var Kx="/snowflake-hfpykpgy.png";var Wx="/stripe-zrfaqbj3.png";var Bx="/supabase-4vg33zf2.png";var qx="/telegram-v6tjyrs7.png";var Ux="/twilio-dpyjdwpj.png";var Fx="/vercel-7d0ssw28.png";var Nx="/zapier-p67qfch0.png";var _20={agentation:_b,airtable:Db,apollo:Ob,asana:Pb,atlassian:wb,box:jb,chrome:vV,"chrome-devtools":vV,clickup:Tb,cloudflare:Cb,context7:Eb,datadog:Sb,discord:kb,dropbox:Ib,elevenlabs:Rb,exa:yb,figma:bb,firecrawl:xb,github:hb,gitlab:gb,gmail:vb,googlecalendar:fb,googledrive:mb,grafana:pb,granola:ub,hubspot:cb,huggingface:db,intercom:lb,linear:ib,monday:rb,mongodb:ab,neon:nb,notion:ob,paper:sb,paypal:tb,perplexity:eb,postgresql:$x,posthog:Zx,puppeteer:Jx,railway:Qx,redis:Xx,salesforce:zx,sentry:Gx,shopify:Hx,slack:Yx,snowflake:Kx,stripe:Wx,supabase:Bx,telegram:qx,twilio:Ux,vercel:Fx,zapier:Nx},D20={"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 Vx($){let Z=$.match(/^claude[._]ai[._\s]+(.+)$/i);if(!Z)return $;return Z[1].replace(/_/g," ")}function YW($){return $.toLowerCase().replace(/[\s._-]+/g,"")}var O20=new Map(Object.entries(_20).map(([$,Z])=>[YW($),Z])),P20=new Map(Object.entries(D20).map(([$,Z])=>[YW($),YW(Z)]));function KW($){let Z=YW(Vx($));return O20.get(P20.get(Z)??Z)}function WW($){return Vx($).split(/[\s._-]+/).filter(Boolean).map((Z)=>Z[0].toUpperCase()+Z.slice(1)).join(" ")}var fV=P(d(),1);function ZX({open:$,children:Z}){return fV.jsx(o8,{initial:!1,children:$&&fV.jsx(p5.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 Lx=P(v(),1);var _x=P(d(),1),w20=/\.(png|jpe?g|gif|webp|avif|svg)$/i;function Mx($,Z){if($.name!=="Read"||!Z)return null;let J=$.input,Q=typeof J.file_path==="string"?J.file_path:null;if(!Q||!w20.test(Q))return null;let X=Z.endsWith("/")?Z:`${Z}/`;if(!Q.startsWith(X))return null;return Q.slice(X.length)}function Ax({relPath:$}){let Z=J1(),[J,Q]=Lx.useState(!1);if(J)return null;let X=`/api/workspaces/${Z}/preview/${$.split("/").map(encodeURIComponent).join("/")}`;return _x.jsx("img",{src:X,alt:$,loading:"lazy",onError:()=>Q(!0),className:"max-h-64 max-w-full self-start rounded-lg border border-border object-contain"})}var zX=P(v(),1);var Ox=P(d(),1),j20=s("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 Dx({children:$,active:Z=!0,className:J}){return Ox.jsx("span",{className:s(J,Z&&j20),children:$})}var JX=P(d(),1);function BW({className:$}){return JX.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:[JX.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"}),JX.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 X8=P(d(),1),qW="group/row flex w-full items-center gap-2 py-1.5 text-left select-none";function FZ({isFirst:$,isLast:Z,marker:J,loading:Q=!1,isError:X=!1,children:z}){let G=J!=null||Q;return X8.jsxs("div",{className:"relative flex gap-2.5",children:[X8.jsxs("div",{className:"relative w-[13px] shrink-0",children:[!$&&X8.jsx("span",{className:s("absolute top-0 left-1/2 w-px -translate-x-1/2 bg-border",G?"h-1":"h-2.5")}),!Z&&X8.jsx("span",{className:s("absolute bottom-0 left-1/2 w-px -translate-x-1/2 bg-border",G?"top-[26px]":"top-5")}),J?X8.jsx("span",{className:"absolute top-[15px] left-1/2 z-10 -translate-x-1/2 -translate-y-1/2",children:J}):Q?X8.jsx("span",{className:"absolute top-[15px] left-1/2 z-10 flex -translate-x-1/2 -translate-y-1/2 p-0.5",children:X8.jsx(T1,{size:12,stroke:1.75,className:"animate-spin text-muted-foreground"})}):X8.jsx("span",{className:s("absolute top-[15px] left-1/2 z-10 size-[5px] -translate-x-1/2 -translate-y-1/2 rounded-full",X?"bg-destructive":"bg-border")})]}),z]})}function QX({open:$}){return X8.jsx(p5.span,{animate:{rotate:$?90:0},transition:{type:"spring",duration:0.2,bounce:0.1},className:s("flex shrink-0",$?"opacity-100":"opacity-0 group-hover/row:opacity-100"),children:X8.jsx(d3,{size:12,stroke:1.75})})}function UZ({children:$,className:Z}){return X8.jsx("span",{className:s("flex size-4 items-center justify-center overflow-hidden rounded-xs bg-muted",Z),children:$})}function Px({icon:$,size:Z=12,stroke:J=1.75}){return X8.jsx(UZ,{children:X8.jsx($,{size:Z,stroke:J,className:"text-muted-foreground"})})}function wx({src:$}){if(!$)return X8.jsx(UZ,{children:X8.jsx(BW,{className:"size-3 text-muted-foreground"})});return X8.jsx(UZ,{children:X8.jsx("img",{src:$,alt:"",className:"size-full object-cover"})})}var T20=/^[A-Za-z]:\//;function C20($=""){if(!$)return $;return $.replace(/\\/g,"/").replace(T20,(Z)=>Z.toUpperCase())}var E20=/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;var jx=/^\/([A-Za-z]:)?$/;function S20(){if(typeof process<"u"&&typeof process.cwd==="function")return process.cwd().replace(/\\/g,"/");return"/"}var mV=function(...$){$=$.map((Q)=>C20(Q));let Z="",J=!1;for(let Q=$.length-1;Q>=-1&&!J;Q--){let X=Q>=0?$[Q]:S20();if(!X||X.length===0)continue;Z=`${X}/${Z}`,J=pV(X)}if(Z=Tx(Z,!J),J&&!pV(Z))return`/${Z}`;return Z.length>0?Z:"."};function Tx($,Z){let J="",Q=0,X=-1,z=0,G=null;for(let H=0;H<=$.length;++H){if(H<$.length)G=$[H];else if(G==="/")break;else G="/";if(G==="/"){if(X===H-1||z===1);else if(z===2){if(J.length<2||Q!==2||J[J.length-1]!=="."||J[J.length-2]!=="."){if(J.length>2){let Y=J.lastIndexOf("/");if(Y===-1)J="",Q=0;else J=J.slice(0,Y),Q=J.length-1-J.lastIndexOf("/");X=H,z=0;continue}else if(J.length>0){J="",Q=0,X=H,z=0;continue}}if(Z)J+=J.length>0?"/..":"..",Q=2}else{if(J.length>0)J+=`/${$.slice(X+1,H)}`;else J=$.slice(X+1,H);Q=H-X-1}X=H,z=0}else if(G==="."&&z!==-1)++z;else z=-1}return J}var pV=function($){return E20.test($)};var uV=function($,Z){let J=mV($).replace(jx,"$1").split("/"),Q=mV(Z).replace(jx,"$1").split("/");if(Q[0][1]===":"&&J[0][1]===":"&&J[0]!==Q[0])return Q.join("/");let X=[...J];for(let z of X){if(Q[0]!==z)break;J.shift(),Q.shift()}return[...J.map(()=>".."),...Q].join("/")};function NZ($){return $.input??{}}function X5($,Z){let J=$[Z];return typeof J==="string"?J:""}function Cx($){return(Z)=>Z.replace(/\/[^\s"']+/g,(J)=>{if(!$)return J;let Q=uV($,J);return Q.startsWith("..")?J:Q})}function q7($){let Z=Math.max(1,Math.round($/1000));if(Z<60)return`${Z}s`;let J=Math.floor(Z/60),Q=Z%60;return Q?`${J}m ${Q}s`:`${J}m`}var k20={ToolSearch:"Tool search",WebSearch:"Web search",WebFetch:"Web fetch"};function I20($){if(!$.startsWith("mcp__"))return $;let Z=$.slice(5).split("__");return Z.length>=2?Z.slice(1).join("__"):Z[0]}function R20($,Z){let J=$.name,Q=NZ($);if(J==="Bash")return Z(`$ ${X5(Q,"command")}`);if(J==="Read"||J==="Write"||J==="Edit")return Z(X5(Q,"file_path"));if(J==="Glob")return Z(X5(Q,"pattern"));if(J==="Grep")return`/${X5(Q,"pattern")}/ ${Z(X5(Q,"path"))}`;if(J==="WebSearch")return X5(Q,"query");if(J==="WebFetch")return X5(Q,"url");if(J==="ToolSearch"){let X=X5(Q,"query");if(X.startsWith("select:"))return X.slice(7).split(",").map(I20).join(", ");return X}return""}var XX={displayName:($)=>k20[$.name]??$.name,brief:R20};var cV={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"},Sx={read:"Read",listFiles:"List files",search:"Search"};function kx($){let Z=$?.commandActions;if(!Array.isArray(Z)||Z.length===0)return null;let J=Z[0],Q=J?.type;if(!Q||!(Q in Sx))return null;if(Z.some((X)=>X?.type!==Q))return null;return J}var Ex={spawn_agent:"Run sub-agent",send_input:"Message the agent",resume_agent:"Resume the agent",close_agent:"Stopping the agent"};function y20($){if($.name==="exec"){let Z=kx($.input);if(Z?.type)return Sx[Z.type]}if($.name==="subagent"){let Z=$.input?.action;if(typeof Z==="string"&&Z in Ex)return Ex[Z]}return cV[$.name]??$.name}function b20($,Z){let J=$.name,Q=NZ($);if(J==="exec"){let X=kx(Q);if(X?.type==="read")return Z(X.path||X.name||"");if(X?.type==="search")return[X.query&&`/${X.query}/`,X.path&&Z(X.path)].filter(Boolean).join(" ");if(X?.type==="listFiles")return X.path?Z(X.path):"";return Z(`$ ${X5(Q,"command")}`)}if(J==="apply_patch"){let X=Q.changes;if(Array.isArray(X))return X.map((G)=>G&&typeof G==="object"?G.path:void 0).filter((G)=>typeof G==="string").map(Z).join(", ");return""}if(J==="web_search"){let X=Q.queries;if(Array.isArray(X)&&X.length>0)return X.filter((z)=>typeof z==="string").join(" · ");return X5(Q,"query")}if(J==="update_plan"){let X=Q.plan;return typeof X==="string"?X.split(`
64
+ `)[0]:""}if(J==="subagent"){if(X5(Q,"action")==="close_agent")return"";return X5(Q,"prompt")}if(J==="subagent_activity")return X5(Q,"kind");if(J==="generate_image")return X5(Q,"prompt").split(`
65
+ `)[0];if(J==="read_mcp_resource")return X5(Q,"uri");if(J==="list_mcp_resources"||J==="list_mcp_resource_templates")return X5(Q,"server");return""}var Ix={displayName:y20,brief:b20};function Rx($){let Z=$.indexOf(":"),J=(Z>0?$.slice(0,Z):$).trim(),Q=Z>0?$.slice(Z+1).trim():"",X=J.match(/^(.*?)\s*\(([^)]*)\)$/);if(!X)return{action:J,qualifier:"",detail:Q};return{action:X[1].trim(),qualifier:X[2].trim(),detail:Q}}var x20={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 h20($){let{action:Z}=Rx($.name),J=x20[Z];if(J)return J;let Q=Z.replace(/_/g," ");return Q.charAt(0).toUpperCase()+Q.slice(1)}function g20($,Z){let{action:J,qualifier:Q,detail:X}=Rx($.name),z=X||Q;if(!z)return"";return J==="terminal"?`$ ${z}`:Z(z)}var yx={displayName:h20,brief:g20};var v20={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 f20($,Z){let J=$.name,Q=NZ($);if(J==="read"||J==="write"||J==="edit")return Z(X5(Q,"path"));if(J==="apply_patch"){let X=Q.changes;if(Array.isArray(X)&&X.length>0){let H=X.map((Y)=>Y&&typeof Y==="object"?X5(Y,"path"):"").filter(Boolean);if(H.length===1)return Z(H[0]);if(H.length>1)return`${H.length} files`}let z=X5(Q,"patch")||X5(Q,"input"),G=z.split(`
66
+ `).find((H)=>H.startsWith("*** "))??z.split(`
67
+ `)[0];return Z(G??"")}if(J==="exec"||J==="bash"){let X=X5(Q,"command")||X5(Q,"code");return X?Z(`$ ${X}`):""}if(J==="ls"||J==="find"||J==="grep")return Z(X5(Q,"path")||X5(Q,"pattern"));if(J==="process"){let X=X5(Q,"action"),z=X5(Q,"name");return[X,z].filter(Boolean).join(" ")||Z(X5(Q,"command"))}if(J==="web_search"||J==="x_search")return X5(Q,"query");if(J==="web_fetch")return X5(Q,"url");if(J==="memory_search")return X5(Q,"query");if(J==="memory_get")return X5(Q,"key")||X5(Q,"name");if(J==="sessions_history"||J==="sessions_send"||J==="sessions_yield")return X5(Q,"sessionKey")||X5(Q,"agentId");if(J==="sessions_list"||J==="agents_list")return X5(Q,"agentId");if(J==="subagents"||J==="sessions_spawn")return X5(Q,"task")||X5(Q,"agentId");if(J==="image"||J==="image_generate")return X5(Q,"prompt")||Z(X5(Q,"path"));if(J==="message")return X5(Q,"recipient")||X5(Q,"to");if(J==="update_plan"){let X=Q.plan;if(Array.isArray(X)){let G=X.find((H)=>!!H&&typeof H==="object"&&H.status==="in_progress")?.step??X[0]?.step;if(typeof G==="string")return G}return""}return""}var bx={displayName:($)=>v20[$.name]??XX.displayName($),brief:($,Z)=>f20($,Z)||XX.brief($,Z)};function dV($){if(!($.name==="Bash"||$.name==="exec"))return null;let J=$.input??{},Q=typeof J.command==="string"?J.command:"";if(!Q)return null;let X=Q.match(/(?:^|\s|\$\()mcporter(?:\)?)\s+call\s+([A-Za-z0-9_-]+)\.([A-Za-z0-9_-]+)((?:\s+(?!&&|\|\||;|\|)\S+)*)/);if(!X)return null;return{server:X[1],tool:X[2],rest:(X[3]??"").trim()}}function lV($){let Z=$.name;if(!Z.startsWith("mcp__"))return null;let J=Z.slice(5),Q=J.indexOf("__");if(Q<=0)return null;return{server:J.slice(0,Q),tool:J.slice(Q+2),rest:""}}function iV($){if($.provider!=="codex"||!$.mcpServer)return null;if($.name in cV)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 rV($,Z){let J=Z.toLowerCase();return["-","_","."].find((X)=>J.startsWith($.toLowerCase()+X))?Z.slice($.length+1):Z}var m20={"claude-code":XX,openclaw:bx,codex:Ix,hermes:yx};function xx($){return m20[$.provider??"claude-code"]}function hx($){return xx($).displayName($)}function gx($,Z){return xx($).brief($,Cx(Z))}var c1=P(d(),1),vx=[fx,mx,aV];function p20(){let[$,Z]=zX.useState(0);zX.useEffect(()=>{let Q=setInterval(()=>Z((X)=>(X+1)%vx.length),600);return()=>clearInterval(Q)},[]);let J=vx[$];return c1.jsx(UZ,{className:"size-5",children:c1.jsx(J,{size:16,stroke:1.75,className:"text-foreground"})})}function px({call:$,cwd:Z,isFirst:J,isLast:Q,renderNestedParts:X}){let[z,G]=zX.useState(!1),H=$.subagent,Y=$.input??{},K=H?.description??Y.description??"Subtask",W=H?.status,B=$.state==="error"||W==="failed",q=$.state==="running"||W==="running",U=H?.usage?.toolUses,F=H?.usage?.durationMs,L=(q&&H?.progress?.length?H.progress[H.progress.length-1]:null)??(U!=null?`Took ${U} step${U===1?"":"s"}`:null),V=(H?.transcript??[]).flatMap((O)=>O.parts),M=typeof $.output==="string"?$.output:"",_=V.length>0||!!M;return c1.jsx(FZ,{isFirst:J,isLast:Q,marker:q?c1.jsx(p20,{}):c1.jsx(UZ,{className:"size-5",children:c1.jsx(aV,{size:16,stroke:1.75,className:"text-foreground"})}),isError:B,children:c1.jsxs("div",{className:"min-w-0 flex-1",children:[c1.jsxs("button",{type:"button",title:`Agent: ${K}`,onClick:()=>_&&G((O)=>!O),className:s("group/row flex w-full flex-col items-start gap-0.5 py-1.5 text-left select-none",_?"cursor-pointer":"cursor-default"),children:[c1.jsxs("span",{className:"flex w-full items-center gap-2",children:[c1.jsxs(Dx,{active:q,className:"min-w-0 flex-1 truncate text-xs font-medium",children:["Agent: ",K]}),!q&&F!=null&&c1.jsx("span",{className:"shrink-0 rounded-full border border-border px-1.5 text-[10px] font-medium text-muted-foreground tabular-nums",children:q7(F)}),W==="failed"&&c1.jsx("span",{className:"shrink-0 text-xs text-destructive",children:"✗"}),W==="stopped"&&c1.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:"✗"}),_&&c1.jsx(QX,{open:z})]}),L&&c1.jsx("span",{className:"w-full truncate text-xs text-muted-foreground",children:L})]}),_&&c1.jsx(ZX,{open:z,children:c1.jsxs("div",{className:"mt-1 mb-1 overflow-hidden rounded-lg border border-border",children:[V.length>0&&c1.jsx("div",{className:"py-1.5 pr-2 pl-3",children:X(V,Z)}),M&&c1.jsx("div",{className:s("bg-muted/30 px-3.5 py-3 text-xs leading-relaxed whitespace-pre-wrap text-muted-foreground",V.length>0&&"border-t border-border"),children:M})]})})]})})}var U7=P(v(),1);var sx=P(v(),1);var sV=new Set(["<",">","{","}","[","]"]),ZL=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"]),u20=new Set([...ZL,"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"]),lx=new Set(["+","-","*","/","%","=","!","&","|","^","~","!","?",":",".",",",";","'",'"',".","(",")","[","]","#","@","\\",...sV]),c20={keywords:ZL,onCommentStart:nx,onCommentEnd:t20};function d20($){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 l20($,Z){if($[Z]!=="<")return!1;let J=0,Q=!1;for(let X=Z;X<$.length;X++){let z=$[X];if(z==="<"){J++;continue}if(z===">"){if(J--,J===0){let G=X+1;while(G<$.length&&/\s/.test($[G]))G++;if(!(Q&&$[G]==="("))return!1;let H=$.slice(G,G+320);return/\)\s*(?::[\s\S]{0,120}?)?=>/.test(H)}continue}if(J===0)continue;if(/[$A-Za-z_]/.test(z)){Q=!0;continue}if(/[\s,\.\=\?\:\|\&\[\]]/.test(z))continue;return!1}return!1}var UW=["identifier","keyword","string","class","property","entity","jsxliterals","sign","comment","break","space"],[VZ,i20,f6,nV,oV,r20,a20,U9,ux,tV,cx]=UW.map(($,Z)=>Z);function GX($){return/^[^\S\r\n]+$/g.test($)}function n20($){return lx.has($)}function o20($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function FW($){return/^[\w_]+$/.test($)||ix($)}function dx($){let Z=$[0];return FW(Z)&&Z===Z.toUpperCase()||$==="null"}function ix($){return/[^\u0000-\u007f]/.test($)}function rx($){return/^[a-zA-Z]$/.test($)}function ax($){return rx($)||ix($)}function LZ($){return ax($[0])&&($.length===1||FW($.slice(1)))}function eV($){return $==="`"}function $L($){return $==='"'||$==="'"}function s20($){return $L($)||eV($)}function nx($,Z){let J=$+Z;if(J==="/*")return 2;return J==="//"?1:0}function t20($,Z){return $+Z==="*/"?2:Z===`
68
+ `?1:0}function e20($){return $[0]==="/"&&!nx($[0],$[1])}function $90($,Z){let J={...c20,...Z},Q=!!(Z&&Z.keywords instanceof Set),X=d20($),z=Q?J.keywords:X?u20:ZL,{onCommentStart:G,onCommentEnd:H}=J,Y=J.typeKeywords instanceof Set?J.typeKeywords:null,K="",W=-1,B=[-1,""],q=[-2,""],U=[],F=!1,N=0,L=!1,V=0,M=()=>F&&!L&&!N,_=()=>N&&!M(),O=()=>!N&&M()&&!L&&V>0,D=null,A=!1,E=0,I=0,y=()=>D!==null,C=()=>A,h=()=>I>E,k=()=>I>0&&I===E,S=()=>y()||h();function w(R){let b=R===`
69
+ `;if(_()){if(y())return f6;let[,u]=B;if(LZ(R)){if(u==="<"||u==="</")return r20}}if(O())return a20;if(y()||h())return f6;else if(Y&&Y.has(R))return B[1]==="."?VZ:nV;else if(z.has(R))return B[1]==="."?VZ:i20;else if(b)return tV;else if(GX(R))return cx;else if(R.split("").every(n20))return U9;else if(dx(R))return _()?VZ:nV;else{if(LZ(R)){let u=B[1]==="."&&LZ(q[1]);if(!S()&&!u)return VZ;if(u)return oV}return f6}}let T=(R,b)=>{if(b)K=b;if(K){W=typeof R==="number"?R:w(K);let g=[W,K];if(W!==cx&&W!==tV)q=B,B=g;U.push(g)}K=""};for(let R=0;R<$.length;R++){let b=$[R],g=$[R-1],u=$[R+1],j=g+b,t=b+u;if(typeof J.onQuote==="function"&&b==="'"&&!y()&&!O()&&!h()){let l=J.onQuote(b,R,$);if(typeof l==="number"&&l>=1&&!Number.isNaN(l)){let H0=Math.min(l,$.length-R),B0=R+H0;T(),K=$.slice(R,B0),T(VZ),R=B0-1;continue}}if($L(b)&&!O()&&!h()){if(T(),g!=="\\"){if(D&&b===D)D=null;else if(!D)D=b}T(f6,b);continue}if(!h()){if(g!=="\\n"&&eV(b)){T(),T(f6,b),I++;continue}}if(h()){if(g!=="\\n"&&eV(b)){if(I>0){T(),I--,T(f6,b);continue}}if(t==="${"){E++,T(f6),T(U9,t),R++;continue}}if(k()&&b==="}"){T(),E--,T(U9,b);continue}if(M()){if(b==="{"){T(),T(U9,b),L=!0;continue}}if(F){if(!N&&b==="<"){if(T(),u==="/")N=2,K=t,R++;else N=1,K=b;T(U9);continue}if(N){if(b===">"&&!"/=".includes(g)){if(T(),N===1)N=0,V++;else N=0,F=!1;T(U9,b);continue}if(t==="/>"||t==="</"){if(K!=="<"&&K!=="/")T();if(t==="/>")N=0;else V--;if(!V)F=!1;K=t,R++,T(U9);continue}if(b==="<"){T(),K=b,T(U9);continue}if(u==="-"&&!S()&&!O()){if(K){T(oV,K+b+u),R++;continue}}if(u==="="&&!S()){if(!GX(b)){if(GX(K))T();let l=K+b;if(LZ(l)){T(oV,l);continue}}}}}if(!N&&(b==="<"&&ax(u)||t==="</")){let l=R-1;while(l>=0&&/\s/.test($[l]))l--;let H0=l>=0?$[l]:"",[B0,X0]=B,Y0=!1,V0=!1;if(K&&!GX(K)){let Z0=K;if(dx(Z0)||Z0==="true"||Z0==="false")Y0=!0;else if(z.has(Z0)&&LZ(Z0))V0=!0;else if(LZ(Z0))Y0=!0}let i=b==="<"&&/[$\w\]\)]/.test(H0)&&(Y0||!V0&&(B0===VZ||B0===nV||B0===U9&&(X0===")"||X0==="]"))),$0=b==="<"&&l20($,R);if(!i&&!$0)N=u==="/"?2:1;if(b==="<"&&(u==="/"||rx(u))){if(!i&&!$0&&!S()&&!O()&&!C())F=!0}}let Q0=s20(b),x=h(),e=!F&&e20(t),M0=O();if(Q0||x||$L(D))K+=b;else if(e){T();let[l,H0]=B;if(e&&l!==-1&&!(l===U9&&H0!==")"||l===ux)){K=b,T();continue}A=!0;let B0=R++,X0=()=>R>=$.length,Y0=()=>X0()||$[R]===`
70
+ `,V0=!1,i=!1;for(;!Y0();R++){let $0=$[R],Z0=$[R-1]==="\\";if(!Z0&&$0==="[")i=!0;if(!Z0&&$0==="]")i=!1;if($0==="/"&&!i&&!Z0){V0=!0;while(B0!==R&&/^[a-z]$/.test($[R+1])&&!Y0())R++;break}}if(A=!1,B0!==R&&V0)K=$.slice(B0,R+1),T(f6);else K=b,T(),R=B0}else if(G(b,u)){T();let l=R,H0=G(b,u);if(H0){for(;R<$.length;R++)if(H($[R-1],$[R])==H0)break}K=$.slice(l,R+1),T(ux)}else if(b===" "||b===`
71
+ `)if(b===" "&&(GX(K)||!K||M0)){if(K+=b,u==="<")T()}else T(),K=b,T();else if(L&&b==="}")T(),K=b,T(),L=!1;else if(M0&&!sV.has(b)||h()||(FW(b)===FW(K[K.length-1])||M())&&!lx.has(b))K+=b;else{if(j==="</")K=j;if(T(),j!=="</")K=b;if(t==="</"||t==="/>")K=t,T(),R++;else if(sV.has(b))T()}}return T(),U}function Z90($,Z){let J=[],Q=Z&&typeof Z.lineClassName==="function"?Z.lineClassName:null,X=0,z=(K,W)=>{let B=Q?Q(W,X):"";return X++,{type:"element",tagName:"span",children:K,properties:{className:B?`sh__line ${B}`:"sh__line"}}};function G(K){let W=K.map(([,q])=>q).join(""),B=K.map(([q,U])=>{let F=UW[q];return{type:"element",tagName:"span",children:[{type:"text",value:U}],properties:{className:`sh__token--${F}`,style:{color:`var(--sh-${F})`}}}});J.push(z(B,W))}let H=[],Y=!1;for(let K=0;K<$.length;K++){let W=$[K],[B,q]=W,U=K===$.length-1;if(B!==tV){if(q.includes(`
72
+ `)){let F=q.split(`
73
+ `);for(let N=0;N<F.length;N++)if(H.push([B,F[N]]),N<F.length-1)G(H),H.length=0}else H.push(W);Y=!1}else{if(Y)G([]);else G(H),H.length=0;if(U)G([]);Y=!0}}if(H.length)G(H);return J}var J90=($)=>{let Z=`class="${$.className}"`;if($.style){let J=Object.entries($.style).map(([Q,X])=>`${Q}:${X}`).join(";");Z+=` style="${J}"`}return Z};function Q90($){return $.map((Z)=>{let{tagName:J}=Z,Q=Z.children.map((X)=>{let{tagName:z,children:G,properties:H}=X;return`<${z} ${J90(H)}>${o20(G[0].value)}</${z}>`}).join("");return`<${J} class="${Z.properties.className}">${Q}</${J}>`}).join(`
74
+ `)}function ox($,Z){let J=$90($,Z),Q=Z90(J,Z);return Q90(Q)}var A65={TokenTypes:UW,TokenMap:new Map(UW.map(($,Z)=>[$,Z]))};var JL=P(d(),1),X90=s("[--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 tx({code:$,className:Z}){let J=sx.useMemo(()=>ox($),[$]);return JL.jsx("pre",{className:s("overflow-auto font-mono text-xs leading-relaxed whitespace-pre",X90,Z),children:JL.jsx("code",{className:"font-mono",dangerouslySetInnerHTML:{__html:J}})})}var z90={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 G90($){let Z=$.split(/[\\/]/).pop()??"",J=Z.lastIndexOf("."),Q=J>0?Z.slice(J+1).toLowerCase():"";return z90[Q]??null}function H90($){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 Y90($){let Z=$.split(`
75
+ `);if(!Z.some((J)=>/^\s*\d+\t/.test(J)))return $;return Z.map((J)=>J.replace(/^\s*\d+\t/,"")).join(`
76
+ `)}function ex($,Z){let J=$.input??{},Q=typeof J.file_path==="string"?J.file_path:typeof J.path==="string"?J.path:"",X=Q?G90(Q):null,z=$.name==="Read"||$.name==="read",G=$.name==="Write"||$.name==="write";if(X&&z&&Z)return{kind:"highlight",code:Y90(Z),label:X};if(X&&G&&typeof J.content==="string"&&J.content)return{kind:"highlight",code:J.content,label:X};let H=H90(Z);if(H)return{kind:"highlight",code:H,label:"json"};return{kind:"plain"}}var $4=P(d(),1),QL="max-h-[280px] overflow-auto px-3 py-2.5 font-mono text-xs leading-relaxed";function Zh({call:$,output:Z,isError:J}){let[Q,X]=U7.useState(!1),z=U7.useMemo(()=>J?{kind:"plain"}:ex($,Z),[$,Z,J]);if(z.kind==="plain")return $4.jsx("div",{className:s("rounded-lg border",J?"border-destructive/30 bg-destructive/10":"border-border bg-muted"),children:$4.jsx("pre",{className:s(QL,"break-all whitespace-pre-wrap",J?"text-destructive":"text-muted-foreground"),children:Z||"(empty)"})});return $4.jsxs("div",{className:"overflow-hidden rounded-lg border border-border bg-muted",children:[$4.jsx(K90,{raw:Q,onRaw:X,label:z.label,copyText:Q?Z:z.code}),Q?$4.jsx("pre",{className:s(QL,"break-all whitespace-pre-wrap text-muted-foreground"),children:Z||"(empty)"}):$4.jsx(tx,{code:z.code,className:s(QL,"text-muted-foreground")})]})}function K90({raw:$,onRaw:Z,label:J,copyText:Q}){return $4.jsxs("div",{className:"flex items-center gap-1 border-b border-border p-2",children:[[[!1,J],[!0,"raw"]].map(([z,G])=>$4.jsx(k0,{type:"button",variant:$===z?"outline":"ghost",size:"sm",onClick:()=>Z(z),className:"rounded-full text-xs uppercase",children:G},G)),$4.jsx("div",{className:"flex-1"}),$4.jsx(W90,{text:Q})]})}function W90({text:$}){let[Z,J]=U7.useState(!1);return U7.useEffect(()=>{if(!Z)return;let X=setTimeout(()=>J(!1),1500);return()=>clearTimeout(X)},[Z]),$4.jsx(k0,{type:"button",variant:"ghost",size:"icon-sm",onClick:()=>{navigator.clipboard?.writeText($).then(()=>J(!0)).catch(()=>{})},"aria-label":Z?"Copied":"Copy",children:Z?$4.jsx(T$,{stroke:1.75}):$4.jsx($h,{stroke:1.75})})}var w5=P(d(),1);function NW({parts:$,cwd:Z=null,processing:J=!1}){let Q=$.filter((X)=>X.type==="reasoning"||X.type==="tool-call");return w5.jsx("div",{className:"flex flex-col",children:Q.map((X,z)=>{let G=z===Q.length-1,H={isFirst:z===0,isLast:G};if(X.type==="reasoning")return w5.jsx(B90,{text:X.text,durationMs:X.durationMs,inProgress:J&&G,...H},z);return w5.jsx(q90,{call:X.call,cwd:Z,...H},X.call.toolCallId||z)})})}function XL({isFirst:$,isLast:Z,call:J,leading:Q,marker:X,name:z,brief:G,preview:H}){let[Y,K]=zL.useState(!1),W=J.state==="error",B=J.state==="running"||J.state==="pending",q=W?J.errorText??"":typeof J.output==="string"?J.output:"",U=!!(q||W||H),F=G?`${z}: ${G}`:z;return w5.jsx(FZ,{isFirst:$,isLast:Z,marker:X,loading:B,isError:W,children:w5.jsxs("div",{className:"min-w-0 flex-1",children:[w5.jsxs("button",{type:"button",title:F,onClick:()=>U&&K((N)=>!N),className:s(qW,U?"cursor-pointer":"cursor-default"),children:[Q,w5.jsx("span",{className:"shrink-0 text-xs font-medium whitespace-nowrap",children:z}),G&&w5.jsx("span",{className:"min-w-0 self-baseline truncate text-[12px] text-muted-foreground",children:G}),B&&X&&w5.jsx(T1,{size:12,stroke:1.75,className:"shrink-0 animate-spin text-muted-foreground"}),U&&w5.jsx(QX,{open:Y})]}),U&&w5.jsx(ZX,{open:Y,children:w5.jsxs("div",{className:"mt-1 mb-1 flex flex-col gap-1.5",children:[H,(q||W)&&w5.jsx(Zh,{call:J,output:q,isError:W})]})})]})})}function B90({isFirst:$,isLast:Z,text:J,inProgress:Q=!1,durationMs:X}){let[z,G]=zL.useState(!1);if(!J){let K=X===void 0?"Thought":`Thought for ${q7(X)}`;return w5.jsx(FZ,{isFirst:$,isLast:Z,loading:Q,children:w5.jsx("div",{className:s(qW,"min-w-0 flex-1 cursor-default"),children:w5.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:Q?"Thinking":K})})})}let H=Q?"Thinking":"Thought",Y=Q||z;return w5.jsx(FZ,{isFirst:$,isLast:Z,loading:Q,children:w5.jsxs("div",{className:"min-w-0 flex-1",children:[w5.jsxs("button",{type:"button","aria-expanded":Y,onClick:()=>G((K)=>!K),className:s(qW,"cursor-pointer"),children:[w5.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:H}),w5.jsx(QX,{open:Y})]}),w5.jsx(ZX,{open:Y,children:w5.jsx("div",{className:"mt-1 mb-1 pr-2 text-xs leading-relaxed whitespace-pre-wrap text-muted-foreground",children:w5.jsx(Ab,{content:J})})})]})})}function q90({call:$,cwd:Z,isFirst:J,isLast:Q}){if($.caller==="subagent")return w5.jsx(px,{call:$,cwd:Z,isFirst:J,isLast:Q,renderNestedParts:(G,H)=>w5.jsx(NW,{parts:G,cwd:H})});if($.name==="Skill"&&$.skill){let G=$.state==="success";return w5.jsx(XL,{isFirst:J,isLast:Q,call:$,marker:G?w5.jsx(Px,{icon:Jh,size:16,stroke:1.75}):void 0,name:"Loading skill",brief:$.skill.skillName})}let X=dV($)??lV($)??iV($);if(X){let G=rV(X.server,X.tool);return w5.jsx(XL,{isFirst:J,isLast:Q,call:$,marker:w5.jsx(wx,{src:KW(X.server)}),name:WW(X.server),brief:X.rest?`${G} ${X.rest}`:G})}let z=$.state==="error"?null:Mx($,Z);return w5.jsx(XL,{isFirst:J,isLast:Q,call:$,leading:w5.jsx(U90,{call:$}),name:hx($),brief:gx($,Z),preview:z?w5.jsx(Ax,{relPath:z}):void 0})}function U90({call:$}){if($.caller!=="mcp"&&$.caller!=="server-tool")return null;let Z=$.caller==="mcp"?`mcp${$.mcpServer?`:${$.mcpServer.slice(0,8)}`:""}`:"server";return w5.jsx("span",{className:"shrink-0 rounded border border-border px-1 text-[9px] text-muted-foreground uppercase",children:Z})}var M5=P(d(),1);function zh(){return M5.jsx("div",{className:"flex items-center gap-1 px-1 py-3",children:[0,1,2].map(($)=>M5.jsx("span",{className:"block h-1 w-1 rounded-full bg-ring",style:{animation:"pulse-dot 1.4s ease-in-out infinite",animationDelay:`${$*0.2}s`}},$))})}function Gh($){if($.type==="reasoning")return!0;if($.type==="tool-call")return!0;return!1}function F90($){let Z=[];for(let J of $)if(Gh(J)){let Q=Z[Z.length-1];if(Q&&Q.kind==="run")Q.parts.push(J);else Z.push({kind:"run",parts:[J]})}else Z.push({kind:"single",part:J});return Z}function VW({parts:$,cwd:Z,processing:J=!1}){let Q=F90($);return M5.jsx("div",{className:"flex flex-col",children:Q.map((X,z)=>{let G=z===0?"":"mt-3",H=z===Q.length-1;return M5.jsx("div",{className:G,children:X.kind==="run"?M5.jsx(NW,{parts:X.parts,cwd:Z,processing:J&&H}):M5.jsx(A90,{part:X.part})},z)})})}function N90($){return $.some((Z)=>Z.type!=="text"||Z.text.trim().length>0)}function V90($){let Z=-1;for(let Q=$.length-1;Q>=0;Q--)if(Gh($[Q])){Z=Q;break}if(Z<0)return null;let J=$.slice(Z+1);if(!N90(J))return null;return{work:$.slice(0,Z+1),response:J}}function L90({parts:$,cwd:Z,durationMs:J,defaultOpen:Q}){let X=J===void 0?"Worked":`Worked for ${q7(J)}`;return M5.jsxs($H,{defaultOpen:Q,className:"group/collapsible",children:[M5.jsxs(ZH,{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:[M5.jsx("span",{children:X}),M5.jsx(d3,{size:16,stroke:1.5,className:"shrink-0 transition-transform group-data-open/collapsible:rotate-90"})]}),M5.jsx(JH,{className:"overflow-hidden pt-2",children:M5.jsx(VW,{parts:$,cwd:Z})})]})}function M90({parts:$,cwd:Z,processing:J=!1,durationMs:Q}){let X=J?null:V90($);return M5.jsx("div",{className:"w-full min-w-0",children:J?M5.jsx(VW,{parts:$,cwd:Z,processing:!0}):X?M5.jsxs("div",{className:"flex flex-col gap-3",children:[M5.jsx(L90,{parts:X.work,cwd:Z,durationMs:Q}),M5.jsx(VW,{parts:X.response,cwd:Z})]}):M5.jsx(VW,{parts:$,cwd:Z})})}var Hh=Xh.memo(function({turn:Z,processing:J=!1}){let Q=n5().cwd;if(Z.role==="user"&&Z.origin.kind==="user-input"){let X=Z.parts.filter((G)=>G.type==="file"),z=Z.parts.filter((G)=>G.type==="text").map((G)=>G.type==="text"?G.text:"").join(`
77
+ `);if(!z&&X.length===0)return null;return M5.jsxs("div",{className:"flex w-full min-w-0 flex-col items-end gap-1.5 pl-8",children:[X.map((G,H)=>M5.jsx(Yh,{mediaType:G.mediaType,url:G.url,filename:G.filename},H)),z&&M5.jsx("p",{className:s("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:z})]})}return M5.jsx(M90,{parts:Z.parts,cwd:Q,processing:J,durationMs:Z.meta?.durationMs})});function A90({part:$}){switch($.type){case"text":return M5.jsx(Mb,{content:$.text});case"tool-call":return M5.jsx(NW,{parts:[$],cwd:null});case"file":return M5.jsx(Yh,{mediaType:$.mediaType,url:$.url,filename:$.filename});case"source-url":return M5.jsx(Qh,{url:$.url,title:$.title});case"source-document":return M5.jsx(Qh,{url:"#",title:$.title});case"data":return M5.jsx(_90,{name:$.name,data:$.data});case"reasoning":return null}}function Yh({mediaType:$,url:Z,filename:J}){if($.startsWith("image/")&&Z)return M5.jsx("img",{src:Z,alt:J??"attachment",className:"max-h-64 max-w-full rounded-lg border border-border object-contain"});return M5.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:[M5.jsx(a$,{size:16,stroke:1.75}),M5.jsx("span",{className:"truncate",children:J??$})]})}function Qh({url:$,title:Z}){return M5.jsx("a",{href:$,target:"_blank",rel:"noreferrer",className:"text-xs underline",children:Z??$})}function _90({name:$,data:Z}){return M5.jsxs("details",{children:[M5.jsxs("summary",{className:"cursor-pointer text-xs text-muted-foreground",children:["data:",$]}),M5.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 Z1=P(d(),1),D90=[],O90=[];function LW({active:$=!0,focusRequest:Z=0,docked:J=!1,chatLoaded:Q,view:X,previewTurn:z,sessionId:G,processing:H,composerBanner:Y,composerAvailability:K,annotation:W,send:B,stop:q,onSelectSession:U,onClose:F,builderDraft:N}){let L=J1(),V=I4.useRef(null),M=I4.useRef(null),_=N?.sessionId??G??null,O=N?null:G??null,D=N?D90:X.turns,A=D1((x)=>x.hasSentMessageFromMoi),E=D1((x)=>(x.workspaceIdsPendingAnalysis??[]).includes(L)),I=j4((x)=>(x.attachments[n8(L,_)]??[]).some((e)=>e.status==="uploading")),y=!MQ(!0,I,K),C=N?null:z,h=N?O90:X.notices,k=I4.useMemo(()=>KC(C?[...D,C]:D),[D,C]),S=I4.useMemo(()=>BC(k,h),[k,h]),w=k.length>0?k[k.length-1].id:null,T=N?!1:H,R=!!N||Q&&S.length===0&&!T,b=pS({isViewBuilderDraft:!!N,hasSentMessageFromMoi:A,isWorkspacePendingAnalysis:E}),{atBottom:g,scrollToBottom:u,scrollToTop:j}=YC(M,_);I4.useLayoutEffect(()=>{if(R&&b!=="empty")j()},[R,b,j]),I4.useEffect(()=>{if($)FF(V.current)},[$,Z]);let t=I4.useCallback(async(x,e)=>{if(N)await N.onSubmit(x);else B(x,e);u()},[N,B,u]),Q0=I4.useCallback((x)=>{if(y)return;t(x.prompt,{directives:x.context})},[t,y]);return Z1.jsxs("div",{className:"flex min-h-0 flex-1 flex-col pt-2 pb-3",children:[Z1.jsxs("header",{className:"mx-auto flex w-full max-w-[calc(var(--chat-max-container)+40px)] items-center justify-between pr-2 pb-2 pl-2",children:[N?Z1.jsx("div",{className:"flex h-7 items-center px-2.5 text-sm font-medium",children:"Build a new view"}):Z1.jsx(iS,{selectedSessionId:G??null,onSelectSession:U}),F&&J&&Z1.jsxs(M1,{children:[Z1.jsx(A1,{render:Z1.jsx(k0,{variant:"ghost",size:"icon-sm",onClick:F,"aria-label":"Undock agent",children:Z1.jsx(Kh,{className:"size-5! text-muted-foreground",stroke:1.5})})}),Z1.jsx(_1,{children:"Undock agent"})]}),!N&&F&&!J&&Z1.jsx(k0,{variant:"ghost",size:"icon-sm",onClick:F,"aria-label":"Close chat",children:Z1.jsx(m1,{stroke:2})})]}),Z1.jsxs("div",{className:"relative flex min-h-0 flex-1 flex-col",children:[Z1.jsx("div",{ref:M,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:Z1.jsxs("div",{className:"mx-auto flex w-full max-w-(--chat-max-container) flex-1 flex-col items-center gap-6",children:[R&&Z1.jsx(uS,{kind:b,disabled:y,onSelectPrompt:Q0}),S.map((x)=>x.kind==="notice"?Z1.jsx(P90,{notice:x.notice},`notice:${x.notice.id}`):Z1.jsx(Hh,{turn:x.turn,processing:T&&x.turn.id===w},x.turn.id)),T&&!C&&Z1.jsx(zh,{})]})}),!g&&D.length>0&&Z1.jsx(k0,{type:"button",variant:"outline",size:"icon",onClick:()=>u("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:Z1.jsx(UK,{stroke:1.5})})]}),Z1.jsx("div",{className:"mx-auto flex w-full max-w-[calc(var(--chat-max-container)+24px)] flex-col px-3",children:Z1.jsxs("div",{className:s("@container flex w-full flex-col transition-[padding]",Y&&"gap-2 rounded-t-lg rounded-b-2xl p-2",Y?.tone==="default"&&"bg-accent",Y?.tone==="error"&&"bg-destructive/10"),children:[Y?.content,Z1.jsx(hS,{composerRef:V,onSend:t,onStop:q,processing:T,sessionId:_,modelSessionId:O,availability:K,annotation:N?void 0:W,onRemoveDrawing:N?.onRemoveDrawing??W?.onRemove,allowFiles:!N,placeholder:N?"Drop in the details":void 0,draft:N?{id:N.builderId,initialValue:N.initialValue,onChange:N.onChange}:void 0})]})})]})}function P90({notice:$}){let Z=NF($);if(!Z)return null;return Z1.jsx("div",{className:"flex justify-center",children:Z1.jsx("span",{className:"max-w-full truncate text-xs text-muted-foreground",children:Z})})}var h9=P(d(),1);function Wh({loading:$,open:Z,onOpenChange:J,onOpenChangeComplete:Q,children:X}){let z=()=>J(!1);return h9.jsxs(rY,{open:Z,onOpenChange:(H,Y)=>{if(!H&&Y.reason==="outside-press"){Y.cancel();return}J(H)},onOpenChangeComplete:Q,children:[h9.jsx(aY,{render:h9.jsx("div",{className:"fixed right-4 bottom-4 sm:right-6 sm:bottom-6",children:h9.jsx(p5.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:Z?"invisible":"to",transition:{type:"spring",duration:0.3,delay:0.2,bounce:0},children:h9.jsx(k0,{variant:"outline",size:"icon-lg",className:"bg-card shadow-md hover:shadow-lg","aria-label":"Agent",children:h9.jsx(O6,{animated:$,stroke:1.75})})})})}),h9.jsx(nY,{positionMethod:"fixed",side:"top",sideOffset:-48,align:"end",alignOffset:-8,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:X(z)})]})}var m6=P(d(),1);function MW({className:$,title:Z,children:J,onClose:Q,ref:X}){return m6.jsxs(p5.div,{ref:X,className:s("absolute inset-x-4 bottom-4 no-scrollbar flex max-h-full flex-col gap-4 overflow-y-auto rounded-2xl bg-card text-card-foreground shadow-md","mx-auto max-w-[calc(var(--chat-max-container)+var(--page-pad)*2)] p-(--page-pad) pb-0",$),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:[m6.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-4",children:[m6.jsx("p",{className:"text-sm font-medium",children:Z}),m6.jsx(k0,{type:"button",variant:"ghost",size:"icon-sm",onClick:Q,"aria-label":"Close panel",children:m6.jsx(m1,{stroke:1.75})})]}),m6.jsx("div",{className:"flex-1 pb-(--page-pad)",children:J})]})}var E1=P(d(),1),w90=Object.entries(A6),j90=Object.entries(UQ),T90=Object.entries(qQ);function GL({children:$,label:Z}){return E1.jsxs("div",{className:"flex flex-col gap-2",children:[E1.jsx("p",{className:"text-xs font-medium",children:Z}),E1.jsx("div",{role:"group","aria-label":Z,className:"grid grid-cols-4 gap-2",children:$})]})}function HL({active:$,children:Z,className:J,onSelect:Q,style:X}){return E1.jsxs("button",{type:"button","aria-pressed":$,onClick:Q,className:s("relative w-full rounded-lg bg-card text-left ring-1 ring-border transition-opacity outline-none focus-visible:ring-3 focus-visible:ring-ring/50","flex items-center gap-2 p-3",J,!$&&"cursor-pointer pr-9 opacity-70 hover:opacity-100"),style:X,children:[E1.jsx("div",{className:"flex flex-1 flex-col justify-center",children:Z}),$&&E1.jsx(yG,{size:20,stroke:1.5,"aria-hidden":"true"})]})}function Bh({onClose:$,ref:Z}){fH();let{layout:J,setLayout:Q}=n5(),X=FQ(J.theme);function z(G){Q({theme:{...X,...G}})}return E1.jsx(MW,{ref:Z,title:"Customize",onClose:$,children:E1.jsxs("div",{className:"flex flex-col gap-4",children:[E1.jsx(GL,{label:"Font",children:w90.map(([G,H])=>E1.jsx(HL,{active:G===X.font,onSelect:()=>z({font:G}),style:{fontFamily:H.sans},children:E1.jsx("span",{className:"text-sm font-medium",children:H.label})},G))}),E1.jsx(GL,{label:"Colors",children:j90.map(([G,H])=>E1.jsx(HL,{active:G===X.color,className:H.primary&&"bg-background text-foreground",onSelect:()=>z({color:G}),style:Q9({...X,color:G}),children:E1.jsxs("div",{className:"flex gap-2",children:[E1.jsx("span",{className:s("flex size-5 shrink-0 items-center justify-center rounded-sm text-[9px] leading-none font-bold",H.primary?"bg-primary text-primary-foreground":"bg-foreground text-background"),children:"Aa"}),E1.jsx("span",{className:"text-sm font-medium",children:H.label})]})},G))}),E1.jsx(GL,{label:"Radius",children:T90.map(([G,H])=>E1.jsx(HL,{active:G===X.radius,onSelect:()=>z({radius:G}),style:Q9({...X,radius:G}),children:E1.jsxs("div",{className:"flex items-center gap-2",children:[E1.jsx("span",{className:"size-5 shrink-0 rounded-sm bg-card texture-checker-2.5 shadow-xs","aria-hidden":"true"}),E1.jsx("span",{className:"text-sm font-medium",children:H.label})]})},G))})]})})}var CZ=P(v(),1);function HX($,Z,J,Q){let X=$.reduce((z,G)=>Math.max(z,G.y+G.h),0);for(let z=0;z<=X+J;z++)for(let G=0;G<=Q-Z;G++)if(!$.some((Y)=>!(G+Z<=Y.x||Y.x+Y.w<=G||z+J<=Y.y||Y.y+Y.h<=z)))return{x:G,y:z};return{x:0,y:X}}function YX($,Z=[],J=4){let Q=[];for(let X of $){let{x:z,y:G}=X.x!==void 0&&X.y!==void 0?{x:X.x,y:X.y}:HX([...Z,...Q],X.w,X.h,J);Q.push({i:X.id,x:z,y:G,w:X.w,h:X.h})}return Q}var YL=P(v(),1),AW=new Map;function C90($){let Z=window.__moiAppletCss?.get($)??"",J=AW.get($);if(!J){let z=document.createElement("style");z.dataset.appletStyle=$,document.head.appendChild(z),J={el:z,refs:0},AW.set($,J)}if(J.el.textContent!==Z)J.el.textContent=Z;J.refs++;let Q=J,X=!1;return()=>{if(X)return;if(X=!0,Q.refs--,Q.refs<=0)Q.el.remove(),AW.delete($)}}function E90($){let Z=AW.get($);if(!Z||Z.el===document.head.lastElementChild)return;document.head.appendChild(Z.el)}function _W($,Z,J=!1){YL.useInsertionEffect(()=>C90($),[$,Z]),YL.useInsertionEffect(()=>{if(J)E90($)},[$,J,Z])}var Uh=P(d(),1);function qh({segment:$,name:Z,version:J,children:Q}){let X=J1();return _W(rH($,X,Z),J),Uh.jsx("div",{"data-applet":aH($,Z),className:"size-full",children:Q})}var Fh=P(v(),1);var MZ=P(d(),1);class KX extends Fh.Component{state={error:null};static getDerivedStateFromError($){return{error:$}}componentDidCatch($,Z){console.error(`[widget:${this.props.name}]`,$,Z.componentStack),F2(this.props.workspaceId,{source:"render",kind:this.props.kind,name:this.props.name,message:$.message||String($),stack:[$.stack,Z.componentStack].filter(Boolean).join(`
78
+ `)})}componentDidUpdate($){if($.resetKey!==this.props.resetKey&&this.state.error)this.setState({error:null})}render(){if(this.state.error)return MZ.jsxs("div",{className:"flex h-full w-full flex-col items-start justify-start gap-1.5 p-4 text-xs",children:[MZ.jsxs("div",{className:"flex items-center gap-1.5 font-semibold text-destructive",children:[MZ.jsx(sz,{size:16,stroke:1.75}),"Widget crashed"]}),MZ.jsx("div",{className:"font-mono break-words text-muted-foreground",children:this.state.error.message})]});return this.props.children}}var p6=P(d(),1);function Nh({name:$}){let Z=J1(),J=kT($);return p6.jsxs(o8,{mode:"wait",initial:!1,children:[J.status==="ready"&&p6.jsx(p5.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:p6.jsx(KX,{name:$,kind:"widget",workspaceId:Z,resetKey:J.version,children:p6.jsx(qh,{segment:"widgets",name:$,version:J.version,children:p6.jsx(J.Component,{})})})},J.version),J.status==="error"&&p6.jsx(p5.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 Vh=P(d(),1);function AZ({className:$,...Z}){return Vh.jsx("div",{"data-slot":"skeleton",className:s("animate-pulse rounded-lg bg-muted",$),...Z})}var Mh=P(v(),1);var u6=P(d(),1);function DW({editing:$,hidden:Z,onRemove:J,children:Q}){let X=pT();return u6.jsxs(p5.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:[u6.jsx("div",{"data-widget-chrome":!0,style:Q9(X,"widget"),className:s("absolute inset-0 overflow-hidden rounded-2xl text-foreground [corner-shape:superellipse(1.2)]","shadow-[0_1px_2px_-1px_rgba(0,0,0,0.08),0_2px_4px_0_rgba(0,0,0,0.03)]","after:pointer-events-none after:absolute after:inset-0 after:rounded-[inherit]","after:content-[''] after:[corner-shape:inherit]","after:shadow-[inset_0_0_0_1px_rgba(0,0,0,0.05)]",$&&"pointer-events-none"),children:Q}),$&&J&&u6.jsx("div",{className:"absolute -top-2 -right-2 opacity-0 transition-opacity group-hover/widget:opacity-100",children:u6.jsx(k0,{size:"icon-sm",variant:"outline",className:"rounded-full",onClick:J,children:Z?u6.jsx(K4,{stroke:1.75}):u6.jsx(Lh,{stroke:1.75})})})]})}var _Z=P(d(),1),S90={0:"col-start-1",1:"col-start-2",2:"col-start-3",3:"col-start-4"},k90={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"},I90={1:"col-span-1",2:"col-span-2",3:"col-span-3",4:"col-span-4"},R90={1:"row-span-1",2:"row-span-2",3:"row-span-3",4:"row-span-4"};function Ah({items:$,renderItem:Z,onClose:J,onRestore:Q,ref:X}){let z=Mh.useMemo(()=>YX($),[$]);return _Z.jsx(MW,{ref:X,title:"Hidden widgets",onClose:J,className:"max-h-[60vh]",children:_Z.jsx("div",{className:"grid auto-rows-[160px] grid-cols-4 gap-2",children:_Z.jsx(o8,{children:z.map((G)=>_Z.jsx(p5.div,{layoutId:G.i,className:s(S90[G.x],k90[G.y],I90[G.w],R90[G.h]),transition:{type:"spring",duration:0.35,bounce:0},children:_Z.jsx(DW,{editing:!0,onRemove:()=>Q(G.i),hidden:!0,children:Z(G.i)})},G.i))})})})}var PX=P(v(),1);function d6($){let{margin:Z,containerPadding:J,containerWidth:Q,cols:X}=$;return(Q-Z[0]*(X-1)-J[0]*2)/X}function P2($,Z,J){if(!Number.isFinite($))return $;return Math.round(Z*$+Math.max(0,$-1)*J)}function BX($,Z,J,Q,X,z,G){let{margin:H,containerPadding:Y,rowHeight:K}=$,W=d6($),B,q,U,F;if(G)B=Math.round(G.width),q=Math.round(G.height);else B=P2(Q,W,H[0]),q=P2(X,K,H[1]);if(z)U=Math.round(z.top),F=Math.round(z.left);else if(G)U=Math.round(G.top),F=Math.round(G.left);else U=Math.round((K+H[1])*J+Y[1]),F=Math.round((W+H[0])*Z+Y[0]);if(!z&&!G){if(Number.isFinite(Q)){let L=Math.round((W+H[0])*(Z+Q)+Y[0])-F-B;if(L!==H[0])B+=L-H[0]}if(Number.isFinite(X)){let L=Math.round((K+H[1])*(J+X)+Y[1])-U-q;if(L!==H[1])q+=L-H[1]}}return{top:U,left:F,width:B,height:q}}function Dh($,Z,J,Q,X){let{margin:z,containerPadding:G,cols:H,rowHeight:Y,maxRows:K}=$,W=d6($),B=Math.round((J-G[0])/(W+z[0])),q=Math.round((Z-G[1])/(Y+z[1]));return B=WX(B,0,H-Q),q=WX(q,0,K-X),{x:B,y:q}}function qX($,Z,J){let{margin:Q,containerPadding:X,rowHeight:z}=$,G=d6($),H=Math.round((J-X[0])/(G+Q[0])),Y=Math.round((Z-X[1])/(z+Q[1]));return{x:H,y:Y}}function Oh($,Z,J){let{margin:Q,rowHeight:X}=$,z=d6($),G=Math.max(1,Math.round((Z+Q[0])/(z+Q[0]))),H=Math.max(1,Math.round((J+Q[1])/(X+Q[1])));return{w:G,h:H}}function WX($,Z,J){return Math.max(Math.min($,J),Z)}function PW($,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 l6($,Z){for(let J=0;J<$.length;J++){let Q=$[J];if(Q!==void 0&&PW(Q,Z))return Q}return}function KL($,Z){return $.filter((J)=>PW(J,Z))}function y90($,Z){if(Z==="horizontal")return WL($);if(Z==="vertical")return OW($);if(Z==="wrap")return OW($);return[...$]}function OW($){return[...$].sort((Z,J)=>{if(Z.y!==J.y)return Z.y-J.y;return Z.x-J.x})}function WL($){return[...$].sort((Z,J)=>{if(Z.x!==J.x)return Z.x-J.x;return Z.y-J.y})}function UX($){let Z=0;for(let J=0;J<$.length;J++){let Q=$[J];if(Q!==void 0){let X=Q.y+Q.h;if(X>Z)Z=X}}return Z}function i6($,Z){for(let J=0;J<$.length;J++){let Q=$[J];if(Q!==void 0&&Q.i===Z)return Q}return}function FX($){return $.filter((Z)=>Z.static===!0)}function g9($){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 DZ($){let Z=Array($.length);for(let J=0;J<$.length;J++){let Q=$[J];if(Q!==void 0)Z[J]=g9(Q)}return Z}function b90($,Z){let J=Array($.length);for(let Q=0;Q<$.length;Q++){let X=$[Q];if(X!==void 0)if(Z.i===X.i)J[Q]=Z;else J[Q]=X}return J}function Ph($,Z,J){let Q=i6($,Z);if(!Q)return[[...$],null];return Q=J(g9(Q)),[b90($,Q),Q]}function BL($,Z){let J=FX($);for(let Q=0;Q<$.length;Q++){let X=$[Q];if(X===void 0)continue;if(X.x+X.w>Z.cols)X.x=Z.cols-X.w;if(X.x<0)X.x=0,X.w=Z.cols;if(!X.static)J.push(X);else while(l6(J,X))X.y++}return $}function c6($,Z,J,Q,X,z,G,H,Y){if(Z.static&&Z.isDraggable!==!0)return[...$];if(Z.y===Q&&Z.x===J)return[...$];let{x:K,y:W}=Z;if(typeof J==="number")Z.x=J;if(typeof Q==="number")Z.y=Q;Z.moved=!0;let B=y90($,G);if(G==="vertical"&&typeof Q==="number"?W>=Q:G==="horizontal"&&typeof J==="number"?K>=J:!1)B=B.reverse();let U=KL(B,Z),F=U.length>0;if(F&&Y)return DZ($);if(F&&z)return Z.x=K,Z.y=W,Z.moved=!1,$;let N=[...$];for(let L=0;L<U.length;L++){let V=U[L];if(V===void 0)continue;if(V.moved)continue;if(V.static)N=_h(N,V,Z,X,G);else N=_h(N,Z,V,X,G)}return N}function _h($,Z,J,Q,X,z){let G=X==="horizontal",H=X==="vertical",Y=Z.static;if(Q){Q=!1;let B={x:G?Math.max(Z.x-J.w,0):J.x,y:H?Math.max(Z.y-J.h,0):J.y,w:J.w,h:J.h,i:"-1"},q=l6($,B),U=q!==void 0&&q.y+q.h>Z.y,F=q!==void 0&&Z.x+Z.w>q.x;if(!q)return c6($,J,G?B.x:void 0,H?B.y:void 0,Q,Y,X);if(U&&H)return c6($,J,void 0,J.y+1,Q,Y,X);if(U&&X===null)return Z.y=J.y,J.y=J.y+J.h,[...$];if(F&&G)return c6($,Z,J.x,void 0,Q,Y,X)}let K=G?J.x+1:void 0,W=H?J.y+1:void 0;if(K===void 0&&W===void 0)return[...$];return c6($,J,K,W,Q,Y,X)}function OZ($,Z,J){return Math.max(Z,Math.min(J,$))}var x90={name:"gridBounds",constrainPosition($,Z,J,{cols:Q,maxRows:X}){return{x:OZ(Z,0,Math.max(0,Q-$.w)),y:OZ(J,0,Math.max(0,X-$.h))}},constrainSize($,Z,J,Q,{cols:X,maxRows:z}){let G=Q==="w"||Q==="nw"||Q==="sw"?$.x+$.w:X-$.x,H=Q==="n"||Q==="nw"||Q==="ne"?$.y+$.h:z-$.y;return{w:OZ(Z,1,Math.max(1,G)),h:OZ(J,1,Math.max(1,H))}}},h90={name:"minMaxSize",constrainSize($,Z,J){return{w:OZ(Z,$.minW??1,$.maxW??1/0),h:OZ(J,$.minH??1,$.maxH??1/0)}}};var qL=[x90,h90];function NX($,Z,J,Q,X){let z={x:J,y:Q};for(let G of $)if(G.constrainPosition)z=G.constrainPosition(Z,z.x,z.y,X);if(Z.constraints){for(let G of Z.constraints)if(G.constrainPosition)z=G.constrainPosition(Z,z.x,z.y,X)}return z}function wh($,Z,J,Q,X,z){let G={w:J,h:Q};for(let H of $)if(H.constrainSize)G=H.constrainSize(Z,G.w,G.h,X,z);if(Z.constraints){for(let H of Z.constraints)if(H.constrainSize)G=H.constrainSize(Z,G.w,G.h,X,z)}return G}function jW({top:$,left:Z,width:J,height:Q}){let X=`translate(${Z}px,${$}px)`;return{transform:X,WebkitTransform:X,MozTransform:X,msTransform:X,OTransform:X,width:`${J}px`,height:`${Q}px`,position:"absolute"}}function UL({top:$,left:Z,width:J,height:Q}){return{top:`${$}px`,left:`${Z}px`,width:`${J}px`,height:`${Q}px`,position:"absolute"}}function FL($){return $*100+"%"}function g90($,Z,J,Q){return $+J>Q?Z:J}function jh($,Z,J){return $<0?Z:J}function v90($){return Math.max(0,$)}function wW($){return Math.max(0,$)}var NL=($,Z,J)=>{let{left:Q,height:X,width:z}=Z,G=$.top-(X-$.height);return{left:Q,width:z,height:jh(G,$.height,X),top:wW(G)}},VL=($,Z,J)=>{let{top:Q,left:X,height:z,width:G}=Z;return{top:Q,height:z,width:g90($.left,$.width,G,J),left:v90(X)}},LL=($,Z,J)=>{let{top:Q,height:X,width:z}=Z,G=$.left+$.width-z;if(G<0)return{height:X,width:$.left+$.width,top:wW(Q),left:0};return{height:X,width:z,top:wW(Q),left:G}},ML=($,Z,J)=>{let{top:Q,left:X,height:z,width:G}=Z;return{width:G,left:X,height:jh(Q,$.height,z),top:wW(Q)}},f90=($,Z,J)=>NL($,VL($,Z,J)),m90=($,Z,J)=>NL($,LL($,Z)),p90=($,Z,J)=>ML($,VL($,Z,J)),u90=($,Z,J)=>ML($,LL($,Z)),c90={n:NL,ne:f90,e:VL,se:p90,s:ML,sw:u90,w:LL,nw:m90};function Th($,Z,J,Q){let X=c90[$];if(!X)return J;return X(Z,{...Z,...J},Q)}var d90={type:"transform",scale:1,calcStyle($){return jW($)}};var Ch=d90,Eh={cols:12,rowHeight:150,margin:[10,10],containerPadding:null,maxRows:1/0},Sh={enabled:!0,bounded:!1,threshold:3},kh={enabled:!0,handles:["se"]},Ih={enabled:!1,defaultItem:{w:1,h:1}};function AL($,Z,J,Q,X){let z=Q==="x"?"w":"h";Z[Q]+=1;let G=$.findIndex((Y)=>Y.i===Z.i),H=X??FX($).length>0;for(let Y=G+1;Y<$.length;Y++){let K=$[Y];if(K===void 0)continue;if(K.static)continue;if(!H&&K.y>Z.y+Z.h)break;if(PW(Z,K))AL($,K,J+Z[z],Q,H)}Z[Q]=J}function l90($,Z,J,Q){Z.x=Math.max(Z.x,0),Z.y=Math.max(Z.y,0),Z.y=Math.min(Q,Z.y);while(Z.y>0&&!l6($,Z))Z.y--;let X;while((X=l6($,Z))!==void 0)AL(J,Z,X.y+X.h,"y");return Z.y=Math.max(Z.y,0),Z}function i90($,Z,J,Q){Z.x=Math.max(Z.x,0),Z.y=Math.max(Z.y,0);while(Z.x>0&&!l6($,Z))Z.x--;let X;while((X=l6($,Z))!==void 0)if(AL(Q,Z,X.x+X.w,"x"),Z.x+Z.w>J){Z.x=J-Z.w,Z.y++;while(Z.x>0&&!l6($,Z))Z.x--}return Z.x=Math.max(Z.x,0),Z}var VX={type:"vertical",allowOverlap:!1,compact($,Z){let J=FX($),Q=UX(J),X=OW($),z=Array($.length);for(let G=0;G<X.length;G++){let H=X[G];if(H===void 0)continue;let Y=g9(H);if(!Y.static)Y=l90(J,Y,X,Q),Q=Math.max(Q,Y.y+Y.h),J.push(Y);let K=$.indexOf(H);z[K]=Y,Y.moved=!1}return z}},_L={type:"horizontal",allowOverlap:!1,compact($,Z){let J=FX($),Q=WL($),X=Array($.length);for(let z=0;z<Q.length;z++){let G=Q[z];if(G===void 0)continue;let H=g9(G);if(!H.static)H=i90(J,H,Z,Q),J.push(H);let Y=$.indexOf(G);X[Y]=H,H.moved=!1}return X}},DL={type:null,allowOverlap:!1,compact($,Z){return DZ($)}},r90={...VX,allowOverlap:!0,compact($,Z){return DZ($)}},a90={..._L,allowOverlap:!0,compact($,Z){return DZ($)}},n90={...DL,allowOverlap:!0};function OL($,Z=!1,J=!1){let Q;if(Z)if($==="vertical")Q=r90;else if($==="horizontal")Q=a90;else Q=n90;else if($==="vertical")Q=VX;else if($==="horizontal")Q=_L;else Q=DL;if(J)return{...Q,preventCollision:J};return Q}var w2=P(v(),1);function PL($={}){let{measureBeforeMount:Z=!1,initialWidth:J=1280}=$,[Q,X]=w2.useState(J),[z,G]=w2.useState(!Z),H=w2.useRef(null),Y=w2.useRef(null),K=w2.useCallback(()=>{let W=H.current;if(W){let B=W.offsetWidth;if(X(B),!z)G(!0)}},[z]);return w2.useEffect(()=>{let W=H.current;if(!W)return;if(K(),typeof ResizeObserver<"u"){let B=null;return Y.current=new ResizeObserver((q)=>{let U=q[0];if(U){let F=U.contentRect.width;if(B!==null)cancelAnimationFrame(B);B=requestAnimationFrame(()=>{X(F),B=null})}}),Y.current.observe(W),()=>{if(B!==null)cancelAnimationFrame(B);if(Y.current)Y.current.disconnect(),Y.current=null}}return()=>{if(Y.current)Y.current.disconnect(),Y.current=null}},[K]),{width:Q,mounted:z,containerRef:H,measureWidth:K}}var y0=P(v(),1),Sg=P(bW(),1),kg=P(Tg(),1);var f9=P(d(),1),F7=P(yh(),1);function cL($){let{children:Z,cols:J,containerWidth:Q,margin:X,containerPadding:z,rowHeight:G,maxRows:H,isDraggable:Y,isResizable:K,isBounded:W,static:B,useCSSTransforms:q=!0,usePercentages:U=!1,transformScale:F=1,positionStrategy:N,dragThreshold:L=0,droppingPosition:V,className:M="",style:_,handle:O="",cancel:D="",x:A,y:E,w:I,h:y,minW:C=1,maxW:h=1/0,minH:k=1,maxH:S=1/0,i:w,resizeHandles:T,resizeHandle:R,constraints:b=qL,layoutItem:g,layout:u=[],onDragStart:j,onDrag:t,onDragStop:Q0,onResizeStart:x,onResize:e,onResizeStop:M0}=$,[l,H0]=y0.useState(!1),[B0,X0]=y0.useState(!1),Y0=y0.useRef(null),V0=y0.useRef({left:0,top:0}),i=y0.useRef({top:0,left:0,width:0,height:0}),$0=y0.useRef(void 0),Z0=y0.useRef(u);Z0.current=u;let J0=y0.useRef(null),n=y0.useRef(null),m=y0.useRef(!1),c=y0.useRef({x:0,y:0}),f=y0.useRef(!1),a=y0.useMemo(()=>({cols:J,containerPadding:z,containerWidth:Q,margin:X,maxRows:H,rowHeight:G}),[J,z,Q,X,H,G]),o=y0.useMemo(()=>({cols:J,maxRows:H,containerWidth:Q,containerHeight:0,rowHeight:G,margin:X,layout:[]}),[J,H,Q,G,X]),N0=y0.useCallback(()=>({...o,layout:Z0.current}),[o]),j0=y0.useMemo(()=>g??{i:w,x:A,y:E,w:I,h:y,minW:C,maxW:h,minH:k,maxH:S},[g,w,A,E,I,y,C,h,k,S]),h0=y0.useCallback((I0)=>{if(N?.calcStyle)return N.calcStyle(I0);if(q)return jW(I0);let T0=UL(I0);if(U)return{...T0,left:FL(I0.left/Q),width:FL(I0.width/Q)};return T0},[N,q,U,Q]),u0=y0.useCallback((I0,{node:T0})=>{if(!j)return;let{offsetParent:f0}=T0;if(!f0)return;let $5=f0.getBoundingClientRect(),H5=T0.getBoundingClientRect(),S5=H5.left/F,l5=$5.left/F,i5=H5.top/F,F5=$5.top/F,U1;if(N?.calcDragPosition){let J5=I0;U1=N.calcDragPosition(J5.clientX,J5.clientY,J5.clientX-H5.left,J5.clientY-H5.top)}else U1={left:S5-l5+f0.scrollLeft,top:i5-F5+f0.scrollTop};if(V0.current=U1,L>0){let J5=I0;c.current={x:J5.clientX,y:J5.clientY},m.current=!0,f.current=!1,H0(!0);return}H0(!0);let v1=qX(a,U1.top,U1.left),{x:d1,y:x0}=NX(b,j0,v1.x,v1.y,N0());j(w,d1,x0,{e:I0,node:T0,newPosition:U1})},[j,F,a,N,L,b,j0,N0,w]),p=y0.useCallback((I0,{node:T0,deltaX:f0,deltaY:$5})=>{if(!t||!l)return;let H5=I0;if(m.current&&!f.current){let d1=H5.clientX-c.current.x,x0=H5.clientY-c.current.y;if(Math.hypot(d1,x0)<L)return;if(f.current=!0,m.current=!1,j){let c0=qX(a,V0.current.top,V0.current.left),{x:W5,y:I5}=NX(b,j0,c0.x,c0.y,N0());j(w,W5,I5,{e:I0,node:T0,newPosition:V0.current})}}let S5=V0.current.top+$5,l5=V0.current.left+f0;if(W){let{offsetParent:d1}=T0;if(d1){let x0=d1.clientHeight-P2(y,G,X[1]);S5=WX(S5,0,x0);let J5=d6(a),c0=Q-P2(I,J5,X[0]);l5=WX(l5,0,c0)}}let i5={top:S5,left:l5};V0.current=i5;let F5=qX(a,S5,l5),{x:U1,y:v1}=NX(b,j0,F5.x,F5.y,N0());t(w,U1,v1,{e:I0,node:T0,newPosition:i5})},[t,j,l,L,W,y,G,X,a,Q,I,w,b,j0,N0]),r=y0.useCallback((I0,{node:T0})=>{if(!Q0||!l)return;let f0=m.current;if(m.current=!1,f.current=!1,c.current={x:0,y:0},f0){H0(!1),V0.current={left:0,top:0};return}let{left:$5,top:H5}=V0.current,S5={top:H5,left:$5};H0(!1),V0.current={left:0,top:0};let l5=qX(a,H5,$5),{x:i5,y:F5}=NX(b,j0,l5.x,l5.y,N0());Q0(w,i5,F5,{e:I0,node:T0,newPosition:S5})},[Q0,l,a,b,j0,N0,w]);J0.current=u0,n.current=p;let z0=y0.useCallback((I0,{node:T0,size:f0,handle:$5},H5,S5)=>{let l5=S5==="onResizeStart"?x:S5==="onResize"?e:M0;if(!l5)return;let i5;if(T0)i5=Th($5,H5,f0,Q);else i5={...f0,top:H5.top,left:H5.left};i.current=i5;let F5=Oh(a,i5.width,i5.height),{w:U1,h:v1}=wh(b,j0,F5.w,F5.h,$5,N0());l5(w,U1,v1,{e:I0.nativeEvent,node:T0,size:i5,handle:$5})},[x,e,M0,Q,a,w,b,j0,N0]),L0=y0.useCallback((I0,T0)=>{X0(!0);let f0=BX(a,A,E,I,y),$5={...T0,handle:T0.handle};z0(I0,$5,f0,"onResizeStart")},[z0,a,A,E,I,y]),P0=y0.useCallback((I0,T0)=>{let f0=BX(a,A,E,I,y),$5={...T0,handle:T0.handle};z0(I0,$5,f0,"onResize")},[z0,a,A,E,I,y]),g0=y0.useCallback((I0,T0)=>{X0(!1),i.current={top:0,left:0,width:0,height:0};let f0=BX(a,A,E,I,y),$5={...T0,handle:T0.handle};z0(I0,$5,f0,"onResizeStop")},[z0,a,A,E,I,y]);y0.useEffect(()=>{if(!V)return;let I0=Y0.current;if(!I0)return;let T0=$0.current||{left:0,top:0},f0=l&&(V.left!==T0.left||V.top!==T0.top);if(!l){let $5={node:I0,deltaX:V.left,deltaY:V.top,lastX:0,lastY:0,x:V.left,y:V.top};J0.current?.(V.e,$5)}else if(f0){let $5=V.left-V0.current.left,H5=V.top-V0.current.top,S5={node:I0,deltaX:$5,deltaY:H5,lastX:V0.current.left,lastY:V0.current.top,x:V.left,y:V.top};n.current?.(V.e,S5)}$0.current=V},[V,l,w]);let e0=BX(a,A,E,I,y,l?V0.current:null,B0?i.current:null),U5=y0.default.Children.only(Z),d0=d6(a),R0=[P2(C,d0,X[0]),P2(k,G,X[1])],G0=[P2(h,d0,X[0]),P2(S,G,X[1])],A0=U5.props,v0=A0.className,D5=A0.style,K5=y0.default.cloneElement(U5,{ref:Y0,className:dL("react-grid-item",v0,M,{static:B,resizing:B0,"react-draggable":Y,"react-draggable-dragging":l,dropping:Boolean(V),cssTransforms:q}),style:{..._,...D5,...h0(e0)}}),d5=R;return K5=f9.jsx(kg.Resizable,{draggableOpts:{disabled:!K},className:K?void 0:"react-resizable-hide",width:e0.width,height:e0.height,minConstraints:R0,maxConstraints:G0,onResizeStart:L0,onResize:P0,onResizeStop:g0,transformScale:F,resizeHandles:T,handle:d5,children:K5}),K5=f9.jsx(Sg.DraggableCore,{disabled:!Y,onStart:u0,onDrag:p,onStop:r,handle:O,cancel:".react-resizable-handle"+(D?","+D:""),scale:F,nodeRef:Y0,children:K5}),K5}var v9=()=>{},Cg="react-grid-layout",Ig=!1;try{Ig=/firefox/i.test(navigator.userAgent)}catch{}function Y70($,Z){let J=y0.default.Children.toArray($),Q=y0.default.Children.toArray(Z);if(J.length!==Q.length)return!1;for(let X=0;X<J.length;X++){let z=J[X],G=Q[X];if(z?.key!==G?.key)return!1}return!0}function Eg($,Z,J,Q){let X=[],z=new Set;y0.default.Children.forEach(Z,(H)=>{if(!y0.default.isValidElement(H)||H.key===null)return;let Y=String(H.key);z.add(Y);let K=$.find((W)=>W.i===Y);if(K)X.push(g9(K));else{let B=H.props["data-grid"];if(B)X.push({i:Y,x:B.x??0,y:B.y??0,w:B.w??1,h:B.h??1,minW:B.minW,maxW:B.maxW,minH:B.minH,maxH:B.maxH,static:B.static,isDraggable:B.isDraggable,isResizable:B.isResizable,resizeHandles:B.resizeHandles,isBounded:B.isBounded});else X.push({i:Y,x:0,y:UX(X),w:1,h:1})}});let G=BL(X,{cols:J});return Q.compact(G,J)}function OX($){let{children:Z,width:J,gridConfig:Q,dragConfig:X,resizeConfig:z,dropConfig:G,positionStrategy:H=Ch,compactor:Y,constraints:K=qL,layout:W=[],droppingItem:B,autoSize:q=!0,className:U="",style:F={},innerRef:N,onLayoutChange:L=v9,onDragStart:V=v9,onDrag:M=v9,onDragStop:_=v9,onResizeStart:O=v9,onResize:D=v9,onResizeStop:A=v9,onDrop:E=v9,onDropDragOver:I=v9}=$,y=y0.useMemo(()=>({...Eh,...Q}),[Q]),C=y0.useMemo(()=>({...Sh,...X}),[X]),h=y0.useMemo(()=>({...kh,...z}),[z]),k=y0.useMemo(()=>({...Ih,...G}),[G]),{cols:S,rowHeight:w,maxRows:T,margin:R,containerPadding:b}=y,{enabled:g,bounded:u,handle:j,cancel:t,threshold:Q0}=C,{enabled:x,handles:e,handleComponent:M0}=h,{enabled:l,defaultItem:H0,onDragOver:B0}=k,X0=Y??OL("vertical"),Y0=X0.type,V0=X0.allowOverlap,i=X0.preventCollision??!1,$0=y0.useMemo(()=>B??{i:"__dropping-elem__",...H0},[B,H0]),Z0=H.type==="transform",J0=H.scale,n=b??R,[m,c]=y0.useState(!1),[f,a]=y0.useState(()=>Eg(W,Z,S,X0)),[o,N0]=y0.useState(null),[j0,h0]=y0.useState(!1),[u0,p]=y0.useState(null),[r,z0]=y0.useState(),L0=y0.useRef(null),P0=y0.useRef(null),g0=y0.useRef(null),e0=y0.useRef(0),U5=y0.useRef(f),d0=y0.useRef(W),R0=y0.useRef(Z),G0=y0.useRef(Y0),A0=y0.useRef(f);A0.current=f,y0.useEffect(()=>{if(c(!0),!F7.deepEqual(f,W))L(f)},[]),y0.useEffect(()=>{if(o)return;if(u0)return;let x0=!F7.deepEqual(W,d0.current),J5=!Y70(Z,R0.current),c0=Y0!==G0.current;if(x0||J5||c0){let I5=Eg(x0?W:f,Z,S,X0);if(!F7.deepEqual(I5,f))a(I5)}d0.current=W,R0.current=Z,G0.current=Y0},[W,Z,S,Y0,X0,o,u0,f]),y0.useEffect(()=>{if(!o&&!F7.deepEqual(f,U5.current)){U5.current=f;let x0=f.filter((J5)=>J5.i!==$0.i);L(x0)}},[f,o,L,$0.i]);let v0=y0.useMemo(()=>{if(!q)return;let x0=UX(f),J5=n[1];return x0*w+(x0-1)*R[1]+J5*2+"px"},[q,f,w,R,n]),D5=y0.useCallback((x0,J5,c0,W5)=>{let I5=A0.current,h5=i6(I5,x0);if(!h5)return;let F1={w:h5.w,h:h5.h,x:h5.x,y:h5.y,i:x0};L0.current=g9(h5),g0.current=I5,N0(F1),V(I5,h5,h5,null,W5.e,W5.node)},[V]),K5=y0.useCallback((x0,J5,c0,W5)=>{let I5=A0.current,h5=L0.current,F1=i6(I5,x0);if(!F1)return;let H8={w:F1.w,h:F1.h,x:F1.x,y:F1.y,i:x0},N1=c6(I5,F1,J5,c0,!0,i,Y0,S,V0);M(N1,h5,F1,H8,W5.e,W5.node),a(X0.compact(N1,S)),N0(H8)},[i,Y0,S,V0,X0,M]),d5=y0.useCallback((x0,J5,c0,W5)=>{if(!o)return;let I5=A0.current,h5=L0.current,F1=i6(I5,x0);if(!F1)return;let H8=c6(I5,F1,J5,c0,!0,i,Y0,S,V0),N1=X0.compact(H8,S);_(N1,h5,F1,null,W5.e,W5.node);let j8=g0.current;if(L0.current=null,g0.current=null,N0(null),a(N1),j8&&!F7.deepEqual(j8,N1))L(N1)},[o,i,Y0,S,V0,X0,_,L]),I0=y0.useCallback((x0,J5,c0,W5)=>{let I5=A0.current,h5=i6(I5,x0);if(!h5)return;P0.current=g9(h5),g0.current=I5,h0(!0),O(I5,h5,h5,null,W5.e,W5.node)},[O]),T0=y0.useCallback((x0,J5,c0,W5)=>{let I5=A0.current,h5=P0.current,{handle:F1}=W5,H8=!1,N1,j8,[xX,_9]=Ph(I5,x0,(P1)=>{if(N1=P1.x,j8=P1.y,["sw","w","nw","n","ne"].includes(F1)){if(["sw","nw","w"].includes(F1))N1=P1.x+(P1.w-J5),J5=P1.x!==N1&&N1<0?P1.w:J5,N1=N1<0?0:N1;if(["ne","n","nw"].includes(F1))j8=P1.y+(P1.h-c0),c0=P1.y!==j8&&j8<0?P1.h:c0,j8=j8<0?0:j8;H8=!0}if(i&&!V0){if(KL(I5,{...P1,w:J5,h:c0,x:N1??P1.x,y:j8??P1.y}).filter((gX)=>gX.i!==P1.i).length>0)j8=P1.y,c0=P1.h,N1=P1.x,J5=P1.w,H8=!1}return P1.w=J5,P1.h=c0,P1});if(!_9)return;let pZ=xX;if(H8&&N1!==void 0&&j8!==void 0)pZ=c6(xX,_9,N1,j8,!0,i,Y0,S,V0);let hX={w:_9.w,h:_9.h,x:_9.x,y:_9.y,i:x0,static:!0};D(pZ,h5,_9,hX,W5.e,W5.node),a(X0.compact(pZ,S)),N0(hX)},[i,Y0,S,V0,X0,D]),f0=y0.useCallback((x0,J5,c0,W5)=>{let I5=A0.current,h5=P0.current,F1=i6(I5,x0),H8=X0.compact(I5,S);A(H8,h5,F1??null,null,W5.e,W5.node);let N1=g0.current;if(P0.current=null,g0.current=null,N0(null),h0(!1),a(H8),N1&&!F7.deepEqual(N1,H8))L(H8)},[S,X0,A,L]),$5=y0.useCallback(()=>{let x0=A0.current;if(!x0.some((W5)=>W5.i===$0.i)){p(null),N0(null),z0(void 0);return}let c0=X0.compact(x0.filter((W5)=>W5.i!==$0.i),S);a(c0),p(null),N0(null),z0(void 0)},[$0.i,S,X0]),H5=y0.useCallback((x0)=>{if(x0.preventDefault(),x0.stopPropagation(),Ig&&!x0.nativeEvent.target?.classList.contains(Cg))return!1;let J5=B0?B0(x0.nativeEvent):I(x0);if(J5===!1){if(u0)$5();return!1}let{dragOffsetX:c0=0,dragOffsetY:W5=0,...I5}=J5??{},h5={...$0,...I5},F1=x0.currentTarget.getBoundingClientRect(),H8={cols:S,margin:R,maxRows:T,rowHeight:w,containerWidth:J,containerPadding:n},N1=d6(H8),j8=P2(h5.w,N1,R[0]),xX=P2(h5.h,w,R[1]),_9=j8/2,pZ=xX/2,hX=x0.clientX-F1.left+c0-_9,P1=x0.clientY-F1.top+W5-pZ,WB=Math.max(0,hX),gX=Math.max(0,P1),vX={left:WB/J0,top:gX/J0,e:x0.nativeEvent};if(!u0){let BB=Dh(H8,gX,WB,h5.w,h5.h);p(f9.jsx("div",{},h5.i)),z0(vX);let ap=A0.current.filter((np)=>np.i!==h5.i);a([...ap,{...h5,x:BB.x,y:BB.y,static:!1,isDraggable:!0}])}else if(r){if(r.left!==vX.left||r.top!==vX.top)z0(vX)}},[u0,r,$0,B0,I,$5,J0,S,R,T,w,J,n]),S5=y0.useCallback((x0)=>{if(x0.preventDefault(),x0.stopPropagation(),e0.current--,e0.current<0)e0.current=0;if(e0.current===0)$5()},[$5]),l5=y0.useCallback((x0)=>{x0.preventDefault(),x0.stopPropagation(),e0.current++},[]),i5=y0.useCallback((x0)=>{x0.preventDefault(),x0.stopPropagation();let J5=A0.current,c0=J5.find((W5)=>W5.i===$0.i);e0.current=0,$5(),E(J5,c0,x0.nativeEvent)},[$0.i,$5,E]),F5=y0.useCallback((x0,J5)=>{if(!x0||!x0.key)return null;let c0=i6(f,String(x0.key));if(!c0)return null;let W5=typeof c0.isDraggable==="boolean"?c0.isDraggable:!c0.static&&g,I5=typeof c0.isResizable==="boolean"?c0.isResizable:!c0.static&&x,h5=c0.resizeHandles||[...e],F1=W5&&u&&c0.isBounded!==!1,H8=M0;return f9.jsx(cL,{containerWidth:J,cols:S,margin:R,containerPadding:n,maxRows:T,rowHeight:w,cancel:t,handle:j,onDragStart:D5,onDrag:K5,onDragStop:d5,onResizeStart:I0,onResize:T0,onResizeStop:f0,isDraggable:W5,isResizable:I5,isBounded:F1,useCSSTransforms:Z0&&m,usePercentages:!m,transformScale:J0,positionStrategy:H,dragThreshold:Q0,w:c0.w,h:c0.h,x:c0.x,y:c0.y,i:c0.i,minH:c0.minH,minW:c0.minW,maxH:c0.maxH,maxW:c0.maxW,static:c0.static,droppingPosition:J5?r:void 0,resizeHandles:h5,resizeHandle:H8,constraints:K,layoutItem:c0,layout:f,children:x0},c0.i)},[f,J,S,R,n,T,w,t,j,D5,K5,d5,I0,T0,f0,g,x,u,Z0,m,J0,H,Q0,r,e,M0,K]),U1=()=>{if(!o)return null;return f9.jsx(cL,{w:o.w,h:o.h,x:o.x,y:o.y,i:o.i,className:`react-grid-placeholder ${j0?"placeholder-resizing":""}`,containerWidth:J,cols:S,margin:R,containerPadding:n,maxRows:T,rowHeight:w,isDraggable:!1,isResizable:!1,isBounded:!1,useCSSTransforms:Z0,transformScale:J0,constraints:K,layout:f,children:f9.jsx("div",{})})},v1=dL(Cg,U),d1={height:v0,...F};return f9.jsxs("div",{ref:N,className:v1,style:d1,onDrop:l?i5:void 0,onDragLeave:l?S5:void 0,onDragEnter:l?l5:void 0,onDragOver:l?H5:void 0,children:[y0.default.Children.map(Z,(x0)=>{if(!y0.default.isValidElement(x0))return null;return F5(x0)}),l&&u0&&F5(u0,!0),U1()]})}var N7=P(d(),1);function lL({items:$,editing:Z,renderItem:J,onLayoutChange:Q}){let[X,z]=PX.useState(()=>YX($,[])),[G,H]=PX.useState($),{width:Y,containerRef:K,mounted:W}=PL({measureBeforeMount:!0});if(G!==$)H($),z((q)=>{let U=new Map(q.map((V)=>[V.i,V])),F=$.filter((V)=>U.has(V.id)).map((V)=>({...U.get(V.id),w:V.w,h:V.h})),N=new Set(F.map((V)=>V.i)),L=YX($.filter((V)=>!N.has(V.id)),F);return[...F,...L]});let B=PX.useCallback((q)=>{z(q),Q?.(q.map((U)=>({id:U.i,w:U.w,h:U.h,x:U.x,y:U.y})))},[Q]);return N7.jsx("div",{ref:K,className:"mx-auto w-full max-w-[var(--column-w)]",children:W&&N7.jsx(OX,{width:Y,layout:X,gridConfig:{cols:4,rowHeight:160,margin:[8,8],containerPadding:[0,0]},dragConfig:{enabled:!!Z},resizeConfig:{enabled:!1},compactor:VX,onLayoutChange:B,children:X.map((q)=>N7.jsx("div",{children:N7.jsx(p5.div,{layoutId:q.i,"data-snapshot-widget":q.i,className:"size-full",transition:{type:"spring",duration:0.35,bounce:0},children:J(q.i)})},q.i))})})}function Rg({items:$,editing:Z,renderItem:J,onLayoutChange:Q,onRemove:X}){return N7.jsx(lL,{items:$,editing:Z,onLayoutChange:Q,renderItem:(z)=>N7.jsx(DW,{editing:Z,onRemove:X?()=>X(z):void 0,children:J(z)})})}var V7=P(v(),1);function yg($){let Z=o0();return t5({mutationFn:({key:J,thumbnails:Q})=>T4(`/api/workspaces/${$}/thumbnails`,r1("PUT",{key:J,thumbnails:Q}),"Failed to save thumbnails"),onMutate:({key:J})=>{Z.setQueryData(S0.layout($),(Q)=>Q?{...Q,widgetThumbnails:{key:J,at:new Date().toISOString()}}:Q)},onSuccess:()=>{Z.invalidateQueries({queryKey:S0.preview($)})}})}var W70=($)=>Math.min(1,400/Math.max($.offsetWidth,$.offsetHeight)),bg=($,Z)=>{let J=new Map(Z.map((Q)=>[Q.id,Q.tag]));return[...$].sort().map((Q)=>`${Q}@${J.get(Q)??""}`).join(" ")},B70=($)=>new Promise((Z)=>{setTimeout(()=>Z(null),$)});async function xg($){let{createContext:Z,destroyContext:J,domToDataUrl:Q}=await import("/chunk-pp62fnxh.js"),X=async()=>{let z=await Z($,{scale:W70($),type:"image/webp",quality:0.8,backgroundColor:"#ffffff",timeout:1000,onCreateForeignObjectSvg:(G)=>{let H=document.createElement("style");H.textContent="[data-widget-chrome] { border-radius: 0 !important; box-shadow: none !important; }[data-widget-chrome]::after { display: none !important; }",G.append(H)}});try{return await Q(z)}finally{J(z)}};return Promise.race([X(),B70(1e4)])}var q70=5000,U70=10800000;function hg({containerRef:$,widgets:Z,visibleIds:J,editing:Q}){let{layout:X,workspaceId:z}=n5(),G=yg(z),H=V7.useRef(G.mutate);H.current=G.mutate;let Y=V7.useRef(!1),[K,W]=V7.useState(0),B=bg(J,Z),q=Date.parse(X.widgetThumbnails?.at??""),U=!Number.isFinite(q)||Date.now()-q>U70,F=B!==""&&(B!==X.widgetThumbnails?.key||U);V7.useEffect(()=>{if(!F||Q)return;if(document.visibilityState!=="visible"){let V=()=>W((M)=>M+1);return document.addEventListener("visibilitychange",V,{once:!0}),()=>document.removeEventListener("visibilitychange",V)}let N=!1,L=setTimeout(async()=>{if(Y.current)return;Y.current=!0;try{let V={};for(let M of J){if(N)return;let _=$.current?.querySelector(`[data-snapshot-widget="${CSS.escape(M)}"]`),O=_?await xg(_):null;if(O)V[M]=O}if(N)return;H.current({key:B,thumbnails:V})}finally{Y.current=!1,W((V)=>V+1)}},q70);return()=>{N=!0,clearTimeout(L)}},[B,F,Q,K])}var j5=P(d(),1);function gg($){return j5.jsx(Nh,{name:$})}var F70=Array.from({length:10},($,Z)=>({id:`empty-widget-${Z}`,w:2,h:1}));function N70(){return j5.jsx(AZ,{className:"size-full animate-none rounded-2xl [corner-shape:superellipse(1.2)]"})}function V70({onCreateWidget:$}){return j5.jsxs("div",{className:"relative min-h-0 flex-1 pt-7",children:[j5.jsx("div",{"aria-hidden":"true",children:j5.jsx(lL,{items:F70,renderItem:N70})}),j5.jsx("div",{className:"absolute inset-0 flex items-center justify-center p-6",children:j5.jsxs("div",{className:"flex h-full w-full max-w-(--column-w) flex-col items-center justify-center gap-4 bg-radial from-background from-50% to-transparent to-75% text-center",children:[j5.jsxs("div",{className:"flex flex-col gap-1.5",children:[j5.jsx("h2",{className:"font-medium",children:"A little empty here"}),j5.jsx("p",{className:"mx-auto max-w-sm text-sm text-muted-foreground",children:"Widgets are small apps that can read data, perform tasks, and show a compact view of the information that matters."})]}),j5.jsxs(k0,{type:"button",variant:"secondary",size:"sm",onClick:$,children:[j5.jsx(K4,{"data-icon":"inline-start",stroke:1.5}),"Create widget"]})]})})]})}function L70({editing:$,onCreateWidget:Z,onEditingChange:J}){return j5.jsxs("div",{className:"mx-auto mb-4 flex w-full max-w-(--column-w) shrink-0 items-center justify-end gap-2",children:[$&&j5.jsxs(k0,{type:"button",variant:"ghost",size:"sm",className:"mr-auto",onClick:Z,children:[j5.jsx(K4,{"data-icon":"inline-start",stroke:1.75}),"New widget"]}),j5.jsx(o8,{mode:"popLayout",initial:!1,children:j5.jsx(p5.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.3,bounce:0},children:j5.jsx(k0,{type:"button",variant:$?"default":"ghost",size:"sm",className:s(!$&&"text-muted-foreground group-hover/widgets:opacity-100 [@media(hover:hover)]:opacity-0"),onClick:()=>J(!$),children:$?"Done":"Edit widgets"})},$?"done":"edit")})]})}function M70(){return j5.jsx("div",{className:"flex min-h-0 flex-1 flex-col items-center justify-center gap-3",children:j5.jsx("p",{className:"text-sm text-muted-foreground",children:"No widgets added yet"})})}function A70(){let[$,Z]=CZ.useState(0);return[CZ.useCallback((Q)=>{if(!Q)return;let X=new ResizeObserver(([z])=>{let G=z.borderBoxSize?.[0];Z(G?G.blockSize:z.contentRect.height)});return X.observe(Q),()=>X.disconnect()},[]),$]}function fg({onCreateWidget:$,editing:Z,onEditingChange:J,widgets:Q}){let{layout:X,setLayout:z}=n5(),G=Q.length>0,H=new Set(X.widgetGrid.map((L)=>L.i)),Y=X.widgetGrid.filter((L)=>Q.some((V)=>V.id===L.i)).map((L)=>{let V=Q.find((M)=>M.id===L.i);return{id:L.i,w:V.config.colSpan,h:V.config.rowSpan,x:L.x,y:L.y}}),K=Q.filter((L)=>!H.has(L.id)).map((L)=>({id:L.id,w:L.config.colSpan,h:L.config.rowSpan})),[W,B]=A70(),q=Z&&K.length>0,U=CZ.useRef(null);hg({containerRef:U,widgets:Q,visibleIds:Y.map((L)=>L.id),editing:Z});function F(L){z({widgetGrid:X.widgetGrid.filter((V)=>V.i!==L)})}function N(L){let V=Q.find((O)=>O.id===L);if(!V)return;let M=X.widgetGrid.map((O)=>{let D=Q.find((A)=>A.id===O.i);return{...O,w:D?.config.colSpan??1,h:D?.config.rowSpan??1}}),_=HX(M,V.config.colSpan,V.config.rowSpan,4);z({widgetGrid:[...X.widgetGrid,{i:L,x:_.x,y:_.y}]})}return j5.jsx("div",{ref:U,className:"group/widgets relative min-h-0 flex-1",children:j5.jsxs(vg,{children:[j5.jsx("div",{className:s("relative flex h-full flex-col p-4",G?"overflow-y-auto":"overflow-hidden"),children:G?j5.jsxs(j5.Fragment,{children:[j5.jsx(L70,{editing:Z,onCreateWidget:$,onEditingChange:J}),Y.length===0?j5.jsx(p5.div,{className:"mx-auto flex min-h-0 w-full max-w-[var(--column-w)] flex-1 flex-col",animate:{paddingBottom:q?B:0},transition:{type:"spring",duration:0.3,bounce:0},children:j5.jsx(M70,{})}):j5.jsx(p5.div,{animate:{marginBottom:q?B:0},transition:{type:"spring",duration:0.3,bounce:0},children:j5.jsx(Rg,{items:Y,editing:Z,renderItem:gg,onRemove:F,onLayoutChange:(L)=>z({widgetGrid:L.map((V)=>({i:V.id,x:V.x??0,y:V.y??0}))})})})]}):j5.jsx(V70,{onCreateWidget:$})}),j5.jsx(o8,{children:G&&Z&&K.length>0&&j5.jsx(Ah,{ref:W,items:K,renderItem:gg,onClose:()=>J(!1),onRestore:N})})]})})}var pg=P(d(),1);function mg({children:$}){return pg.jsx("header",{className:s("@container relative flex shrink-0 items-center gap-2.5 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 GM=P(v(),1);var L8=P(d(),1);function _70($){if($==="needs-auth")return"Needs auth";return $[0].toUpperCase()+$.slice(1)}function D70({name:$,status:Z}){let J=KW($),Q="size-full rounded-lg ring-2 ring-background";return L8.jsxs("span",{className:"relative size-10 shrink-0",children:[J?L8.jsx("img",{src:J,alt:"",className:"size-full rounded-lg ring-2 ring-background"}):L8.jsx("span",{className:"flex size-full items-center justify-center rounded-lg bg-muted text-muted-foreground ring-2 ring-background",children:L8.jsx(BW,{className:"size-5"})}),Z!=="connected"&&L8.jsx(ug,{"aria-hidden":"true",size:16,stroke:1.75,className:"absolute -top-1 -right-1 rounded-full bg-card text-amber-400"})]})}function cg($){return[...$].sort((Z,J)=>Number(J.status==="connected")-Number(Z.status==="connected"))}function dg({icon:$,children:Z}){return L8.jsxs("div",{className:"flex items-center gap-3 text-card-foreground",children:[$,L8.jsx("div",{className:"flex min-w-0 flex-1 flex-col justify-center gap-0.5",children:Z})]})}function lg({server:$}){return L8.jsxs(dg,{icon:L8.jsx(D70,{name:$.name,status:$.status}),children:[L8.jsx("div",{className:"truncate text-sm font-medium text-foreground",children:WW($.name)}),L8.jsx("span",{className:"text-sm text-muted-foreground",children:_70($.status)})]})}function ig(){return L8.jsxs(dg,{icon:L8.jsx(AZ,{className:"size-10 shrink-0 rounded-lg"}),children:[L8.jsx(AZ,{className:"h-4 w-36 max-w-full"}),L8.jsx(AZ,{className:"h-4 w-20"})]})}function iL({children:$}){return L8.jsx("div",{className:"grid grid-cols-1 gap-6 sm:grid-cols-2",children:$})}function rg($,Z){return X1({queryKey:S0.mcp($),queryFn:()=>C5(`/api/workspaces/${$}/mcp`),enabled:Z,staleTime:1/0,gcTime:1/0,refetchOnMount:!1,refetchOnWindowFocus:!1})}var L4=P(d(),1);function EZ({title:$,description:Z,children:J}){return L4.jsxs("div",{className:"flex flex-col gap-6",children:[L4.jsxs("header",{className:"flex flex-col gap-0.5",children:[L4.jsx("h2",{className:"text-lg font-medium tracking-tight",children:$}),Z&&L4.jsx("p",{className:"text-sm text-muted-foreground",children:Z})]}),J]})}function SZ({label:$,children:Z}){return L4.jsxs("section",{className:"flex flex-col gap-2",children:[$&&L4.jsx("p",{className:"px-0.5 text-xs font-medium text-muted-foreground",children:$}),L4.jsx("div",{className:"flex flex-col divide-y divide-dashed divide-border overflow-hidden rounded-xl border border-border bg-card text-card-foreground",children:Z})]})}function kZ({title:$,description:Z,control:J}){return L4.jsxs("div",{className:"flex items-center gap-3 px-3.5 py-3",children:[L4.jsxs("div",{className:"flex min-w-0 flex-col",children:[L4.jsx("span",{className:"text-sm font-medium",children:$}),Z&&L4.jsx("span",{className:"text-xs text-muted-foreground",children:Z})]}),J&&L4.jsx("div",{className:"ml-auto flex shrink-0 items-center pl-3",children:J})]})}var p8=P(d(),1),O70=Array.from({length:4},($,Z)=>Z);function P70({connectors:$}){if($.isPending)return p8.jsx("div",{role:"status","aria-label":"Loading connectors",children:p8.jsx(iL,{children:O70.map((Z)=>p8.jsx(ig,{},Z))})});if($.isError)return p8.jsxs(ag,{children:[p8.jsx("p",{className:"text-sm text-muted-foreground",children:"Could not load connectors."}),p8.jsx(k0,{variant:"outline",size:"sm",onClick:()=>$.refetch(),children:"Retry"})]});if($.data.length===0)return p8.jsxs(ag,{children:[p8.jsx(vW,{size:24,stroke:1.5,className:"text-muted-foreground"}),p8.jsx("p",{className:"text-sm text-foreground",children:"No connectors configured."})]});return p8.jsx(iL,{children:cg($.data).map((Z)=>p8.jsx(lg,{server:Z},Z.name))})}function ag({children:$}){return p8.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 ng(){let{workspaceId:$}=n5(),Z=rg($,!0);return p8.jsx(EZ,{title:"Connectors",description:"Connectors available to the agent in this workspace.",children:p8.jsx(P70,{connectors:Z})})}var sL=P(v(),1);var jX={};_4(jX,{Thumb:()=>eg,Root:()=>sg});var n6=P(v(),1);var fW=P(v(),1),rL=fW.createContext(void 0);function og(){let $=fW.useContext(rL);if($===void 0)throw Error(C0(63));return $}var aL=function($){return $.checked="data-checked",$.unchecked="data-unchecked",$.disabled="data-disabled",$.readonly="data-readonly",$.required="data-required",$.valid="data-valid",$.invalid="data-invalid",$.touched="data-touched",$.dirty="data-dirty",$.filled="data-filled",$.focused="data-focused",$}({});var mW={...y8,checked($){if($)return{[aL.checked]:""};return{[aL.unchecked]:""}}};var wX=P(d(),1),sg=n6.forwardRef(function(Z,J){let{checked:Q,className:X,defaultChecked:z,id:G,inputRef:H,name:Y,nativeButton:K=!1,onCheckedChange:W,readOnly:B=!1,required:q=!1,disabled:U=!1,render:F,uncheckedValue:N,value:L,...V}=Z,{clearErrors:M}=i4(),{state:_,setTouched:O,setDirty:D,validityData:A,setFilled:E,setFocused:I,shouldValidateOnChange:y,validationMode:C,disabled:h,name:k,validation:S}=R1(),{labelId:w}=B8(),T=h||U,R=k??Y,b=U0(W),g=n6.useRef(null),u=O4(g,H,S.inputRef),j=n6.useRef(null),t=s0(),Q0=J$({id:G,implicit:!1,controlRef:j}),x=K?void 0:Q0,[e,M0]=r4({controlled:Q,default:Boolean(z),name:"Switch",state:"checked"});Q$({id:t,commit:S.commit,value:e,controlRef:j,name:R,getValue:()=>e}),q0(()=>{if(g.current)E(g.current.checked)},[g,E]),oY(e,()=>{if(M(R),D(e!==A.initialValue),E(e),y())S.commit(e);else S.commit(e,!0)});let{getButtonProps:l,buttonRef:H0}=f1({disabled:T,native:K}),B0={id:K?Q0:t,role:"switch","aria-checked":e,"aria-readonly":B||void 0,"aria-required":q||void 0,"aria-labelledby":w,onFocus(){if(!T)I(!0)},onBlur(){let i=g.current;if(!i||T)return;if(O(!0),I(!1),C==="onBlur")S.commit(i.checked)},onClick(i){if(B||T)return;i.preventDefault(),g.current?.dispatchEvent(new PointerEvent("click",{bubbles:!0,shiftKey:i.shiftKey,ctrlKey:i.ctrlKey,altKey:i.altKey,metaKey:i.metaKey}))}},X0=n6.useMemo(()=>Y4({checked:e,disabled:T,id:x,name:R,required:q,style:R?q_:H2,tabIndex:-1,type:"checkbox","aria-hidden":!0,ref:u,onChange(i){if(i.nativeEvent.defaultPrevented)return;let $0=i.target.checked,Z0=D0(K0.none,i.nativeEvent);if(b?.($0,Z0),Z0.isCanceled)return;M0($0)},onFocus(){j.current?.focus()}},S.getInputValidationProps,L!==void 0?{value:L}:E5),[e,T,u,x,R,b,q,M0,S,L]),Y0=n6.useMemo(()=>({..._,checked:e,disabled:T,readOnly:B,required:q}),[_,e,T,B,q]),V0=W0("span",Z,{state:Y0,ref:[J,j,H0],props:[B0,S.getValidationProps,V,l],stateAttributesMapping:mW});return wX.jsxs(rL.Provider,{value:Y0,children:[V0,!e&&R&&N!==void 0&&wX.jsx("input",{type:"hidden",name:R,value:N}),wX.jsx("input",{...X0})]})});var tg=P(v(),1);var eg=tg.forwardRef(function(Z,J){let{render:Q,className:X,...z}=Z,{state:G}=R1(),H=og(),Y={...G,...H};return W0("span",Z,{state:Y,ref:J,stateAttributesMapping:mW,props:z})});var nL=P(d(),1);function $v({className:$,...Z}){return nL.jsx(jX.Root,{"data-slot":"switch",className:s("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border border-transparent shadow-xs transition-colors outline-none focus-visible:ring-2 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 data-checked:bg-primary data-unchecked:bg-input",$),...Z,children:nL.jsx(jX.Thumb,{"data-slot":"switch-thumb",className:"pointer-events-none block size-4 rounded-full bg-background shadow-sm ring-0 transition-transform data-checked:translate-x-4 data-unchecked:translate-x-0.5"})})}var oL=["app-settings"];function Zv(){let $=o0();return Z8((Z)=>{if(Z.type==="settings:updated")$.setQueryData(oL,Z.settings)}),X1({queryKey:oL,queryFn:()=>C5("/api/settings"),staleTime:30000})}function Jv(){let $=o0();return t5({mutationFn:(Z)=>C5("/api/settings",r1("PATCH",Z),"Failed to save settings"),onSuccess:(Z)=>{$.setQueryData(oL,Z)}})}function Qv($){return X1({queryKey:S0.env($),queryFn:()=>C5(`/api/workspaces/${$}/env`),...A2})}function Xv($){let Z=o0();return t5({mutationFn:(J)=>C5(`/api/workspaces/${$}/env`,r1("PUT",J)),onSuccess:(J)=>{Z.setQueryData(S0.env($),J)}})}function zv($){let Z=o0();return t5({mutationFn:(J)=>T4(`/api/workspaces/${$}/config`,r1("PUT",{name:J}),"Failed to save name"),onSuccess:()=>{Z.invalidateQueries({queryKey:S0.layout($)}),Z.invalidateQueries({queryKey:S0.all})}})}function Gv($){let Z=o0();return t5({scope:{id:`workspace-icon:${$}`},mutationFn:(J)=>C5(`/api/workspaces/${$}/icon`,{method:"PUT",headers:{"Content-Type":J.type||"application/octet-stream"},body:J}),onSuccess:()=>{Z.invalidateQueries({queryKey:S0.layout($)}),Z.invalidateQueries({queryKey:S0.all})}})}function Hv($){let Z=o0();return t5({scope:{id:`workspace-icon:${$}`},mutationFn:()=>T4(`/api/workspaces/${$}/icon`,{method:"DELETE"},"Failed to reset icon"),onSuccess:()=>{Z.invalidateQueries({queryKey:S0.layout($)}),Z.invalidateQueries({queryKey:S0.all})}})}function Yv($){let Z=o0();return Z8((J)=>{if(J.type==="env:updated"&&J.workspaceId===$)Z.invalidateQueries({queryKey:S0.env($)})}),{env:Qv($),update:Xv($)}}var S1=P(d(),1),w70={dotenv:".env",custom:"secret",both:"override"},j70=/^[A-Za-z_][A-Za-z0-9_]*$/;function Wv(){let{workspaceId:$}=n5(),{env:Z,update:J}=Yv($),[Q,X]=sL.useState(""),[z,G]=sL.useState(""),H=j70.test(Q),Y=H&&z.length>0&&!J.isPending,K=()=>{if(!Y)return;J.mutate({set:{[Q]:z}},{onSuccess:()=>{X(""),G("")}})},W=Z.data?.vars??[],B=Z.data?.files.reduce((U,F)=>U+F.count,0)??0,q=Z.data?.files.length??0;return S1.jsxs(EZ,{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:[S1.jsxs(SZ,{label:"Variables",children:[Z.isLoading?S1.jsx("div",{className:"flex items-center justify-center px-3.5 py-6 text-muted-foreground",children:S1.jsx(T1,{className:"size-4 animate-spin",stroke:1.75})}):W.length===0?S1.jsx("p",{className:"px-3.5 py-4 text-sm text-muted-foreground",children:"No variables yet."}):W.map((U)=>{let F=U.source!=="dotenv";return S1.jsxs("div",{className:"flex items-center gap-3 px-3.5 py-2.5",children:[S1.jsx("code",{className:"min-w-0 flex-1 truncate font-mono text-xs text-foreground",children:U.key}),S1.jsx("span",{className:"text-xs tracking-widest text-muted-foreground/60 select-none",children:"••••••"}),S1.jsx("span",{className:s("rounded-lg px-1.5 py-0.5 text-[11px] font-medium",U.source==="dotenv"?"bg-muted text-muted-foreground":"bg-primary/10 text-primary"),children:w70[U.source]}),!F&&S1.jsx("span",{className:"text-right text-[11px] text-muted-foreground/60",children:"from file"}),S1.jsx(k0,{type:"button",variant:"ghost",size:"icon-sm",onClick:()=>J.mutate({remove:[U.key]}),disabled:!F,"aria-label":`Delete ${U.key}`,className:"disabled:invisible",children:S1.jsx(Kv,{stroke:1.75})})]},U.key)}),S1.jsxs("div",{className:"flex items-center gap-2 px-3.5 py-2.5",children:[S1.jsx(X6,{value:Q,onChange:(U)=>X(U.target.value),placeholder:"NEW_KEY","aria-invalid":Q.length>0&&!H,className:"h-7 w-40 font-mono text-xs"}),S1.jsx(X6,{value:z,onChange:(U)=>G(U.target.value),onKeyDown:(U)=>{if(U.key==="Enter")K()},type:"password",placeholder:"value",className:"h-7 flex-1 text-xs"}),S1.jsxs(k0,{variant:"outline",size:"sm",onClick:K,disabled:!Y,children:[J.isPending?S1.jsx(T1,{stroke:1.75,className:"animate-spin"}):S1.jsx(K4,{stroke:1.75}),"Add"]})]})]}),S1.jsx(SZ,{label:"From .env files",children:S1.jsx(kZ,{title:"Inherit .env files",description:q>0?`Discovered ${B} ${B===1?"key":"keys"} across ${q} ${q===1?"file":"files"} in this space.`:"No .env files found in this space.",control:S1.jsx($v,{checked:Z.data?.inheritDotenv??!0,disabled:Z.isLoading,onCheckedChange:(U)=>J.mutate({inheritDotenv:U})})})})]})}var qm=P(v(),1);var O8=P(v(),1);var r0=P(v(),1),IZ=P(v(),1),x4=P(v(),1),Rv=P(d(),1),uW=P(v(),1),cW=P(v(),1),A5=P(d(),1),T70=Object.defineProperty,C70=($,Z)=>{for(var J in Z)T70($,J,{get:Z[J],enumerable:!0})},m9={};C70(m9,{ActiveEmoji:()=>av,Empty:()=>rv,List:()=>dv,Loading:()=>iv,Root:()=>gv,Search:()=>vv,SkinTone:()=>nv,SkinToneSelector:()=>lv,Viewport:()=>fv});var Tv="'Apple Color Emoji', 'Noto Color Emoji', 'Twemoji Mozilla', 'Android Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', EmojiSymbols, sans-serif",$M=["none","light","medium-light","medium","medium-dark","dark"];function tL($){return $.charAt(0).toUpperCase()+$.slice(1)}var T2=2,u8=null;function Bv($){try{u8??=document.createElement("canvas").getContext("2d",{willReadFrequently:!0})}catch{}if(!u8||(queueMicrotask(()=>{u8&&(u8=null)}),u8.canvas.width=T2,u8.canvas.height=T2,u8.font=`2px ${Tv}`,u8.textBaseline="middle",u8.measureText($).width>=T2*2))return!1;u8.fillStyle="#00f",u8.fillText($,0,0);let Z=u8.getImageData(0,0,T2,T2).data;u8.clearRect(0,0,T2,T2),u8.fillStyle="#f00",u8.fillText($,0,0);let J=u8.getImageData(0,0,T2,T2).data;for(let Q=0;Q<T2*T2*4;Q+=4)if(Z[Q]!==J[Q]||Z[Q+1]!==J[Q+1]||Z[Q+2]!==J[Q+2])return!1;return!0}function qv($,Z,J){try{let Q=$.getItem(Z);if(!Q)throw Error(`No value found for "${Z}".`);let X=JSON.parse(Q);return J(X)}catch{return null}}function Cv($,Z,J){$.setItem(Z,JSON.stringify(J))}function Uv($){return(Z)=>Z===void 0?void 0:$(Z)}function Fv($){return(Z)=>Z===null?null:$(Z)}function D8($){if(typeof $!="string")throw Error();return $}function pW($){if(typeof $!="number")throw Error();return $}function Ev($){if(typeof $!="boolean")throw Error();return $}function o6($){return(Z)=>{if(typeof Z!="object"||Z===null)throw Error();let J={};for(let Q in $){let X=Z[Q];X===void 0&&$[Q](void 0),J[Q]=$[Q](X)}return J}}function eL($){return(Z)=>{if(!Array.isArray(Z))throw Error();return Z.length>0&&$(Z[0]),Z}}var Sv=($,Z)=>`${$}/${Z}/data.json`,kv=($,Z)=>`${$}/${Z}/messages.json`,E70=["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"],Nv="en",Iv=($)=>`frimousse/data/${$}`,Vv="frimousse/metadata";async function Lv($,Z){try{return(await fetch($,{method:"HEAD",signal:Z})).headers.get("etag")}catch{return null}}async function S70($,Z,J){let[{emojis:Q,emojisEtag:X},{messages:z,messagesEtag:G}]=await Promise.all([fetch(Sv($,Z),{signal:J}).then(async(H)=>({emojis:await H.json(),emojisEtag:H.headers.get("etag")})),fetch(kv($,Z),{signal:J}).then(async(H)=>({messages:await H.json(),messagesEtag:H.headers.get("etag")}))]);return{emojis:Q,messages:z,emojisEtag:X,messagesEtag:G}}async function k70($,Z,J){let[Q,X]=await Promise.all([Lv(Sv($,Z),J),Lv(kv($,Z),J)]);return{emojisEtag:Q,messagesEtag:X}}function I70($){return $.skins?$.skins.filter((Z)=>typeof Z.tone=="number").reduce((Z,J)=>{let Q=$M[J.tone];return Z[Q]=J.emoji,Z},{}):void 0}async function Mv($,Z,J){let{emojis:Q,emojisEtag:X,messages:z,messagesEtag:G}=await S70($,Z,J),H=z.subgroups.find((F)=>F.key==="country-flag"||F.key==="subdivision-flag"),Y=z.groups.filter((F)=>F.key!=="component"),K=Q.filter((F)=>("group"in F)),W=Y.map((F)=>({index:F.order,label:tL(F.message)})),B=z.skinTones.reduce((F,N)=>(F[N.key]=tL(N.message),F),{}),q=K.map((F)=>({emoji:F.emoji,category:F.group,version:F.version,label:tL(F.label),tags:F.tags??[],countryFlag:H&&F.subgroup===H.order||void 0,skins:I70(F)})),U={locale:Z,emojis:q,categories:W,skinTones:B};return Cv(localStorage,Iv(Z),{data:U,metadata:{emojisEtag:X,messagesEtag:G}}),U}function R70($,Z){let J=new Map;for(let G of $)J.has(G.version)||J.set(G.version,G.emoji);let Q=[...J.keys()].sort((G,H)=>H-G),X=Q[0]??0,z=Bv("\uD83C\uDDEA\uD83C\uDDFA");if(typeof Z=="number")return{emojiVersion:Z,countryFlags:z};for(let G of Q){let H=J.get(G);if(Bv(H))return{emojiVersion:G,countryFlags:z}}return{emojiVersion:X,countryFlags:z}}var y70=o6({emojiVersion:pW,countryFlags:Ev}),b70=o6({data:o6({locale:D8,emojis:eL(o6({emoji:D8,category:pW,label:D8,version:pW,tags:eL(D8),countryFlag:Uv(Ev),skins:Uv(o6({light:D8,"medium-light":D8,medium:D8,"medium-dark":D8,dark:D8}))})),categories:eL(o6({index:pW,label:D8})),skinTones:o6({light:D8,"medium-light":D8,medium:D8,"medium-dark":D8,dark:D8})}),metadata:o6({emojisEtag:Fv(D8),messagesEtag:Fv(D8)})});async function x70({locale:$,emojiVersion:Z,emojibaseUrl:J,signal:Q}){let X=typeof J=="string"?J:`https://cdn.jsdelivr.net/npm/emojibase-data@${typeof Z=="number"?Math.floor(Z):"latest"}`,z=qv(sessionStorage,Vv,y70),G=qv(localStorage,Iv($),b70),H;if(!G)H=await Mv(X,$,Q);else if(z)H=G.data;else try{let{emojisEtag:K,messagesEtag:W}=await k70(X,$,Q);H=!K||!W||K!==G.metadata.emojisEtag||W!==G.metadata.messagesEtag?await Mv(X,$,Q):G.data}catch{H=G.data}z??=R70(H.emojis,Z),Cv(sessionStorage,Vv,z);let Y=H.emojis.filter((K)=>{let W=K.version<=z.emojiVersion;return K.countryFlag?W&&z.countryFlags:W});return{locale:$,emojis:Y,categories:H.categories,skinTones:H.skinTones}}function Av($){return E70.includes($)?$:(console.warn(`Locale "${$}" is not supported, using "${Nv}" instead.`),Nv)}function _v($){return $M.includes($)?$:(console.warn(`Skin tone "${$}" is not valid, using "none" instead.`),"none")}function h70($,Z){let J=[];if(Z<=0)return J;for(let Q=0,X=$.length;Q<X;Q+=Z)J.push($.slice(Q,Q+Z));return J}function g70($,Z){if(!Z)return $;let J=Z.toLowerCase().trim(),Q=new WeakMap;return $.filter((X)=>{let z=0;X.label.toLowerCase().includes(J)&&(z+=10);for(let G of X.tags)G.toLowerCase().includes(J)&&(z+=1);return z>0?(Q.set(X,z),!0):!1}).sort((X,z)=>(Q.get(z)??0)-(Q.get(X)??0))}function v70($,Z,J,Q){let X=g70($.emojis,Q),z=[],G=[],H=[],Y={},K=0,W=0;for(let B of X)Y[B.category]||(Y[B.category]=[]),Y[B.category].push({emoji:J&&J!=="none"&&B.skins?B.skins[J]:B.emoji,label:B.label});for(let B of $.categories){let q=Y[B.index];if(!q||q.length===0)continue;let U=h70(Array.from(q),Z).map((F)=>({categoryIndex:K,emojis:F}));z.push(...U),G.push({label:B.label,rowsCount:U.length,startRowIndex:W}),H.push(W),K++,W+=U.length}return{count:X.length,categories:G,categoriesStartRowIndices:H,rows:z,skinTones:$.skinTones}}function f70($){let Z={},J=null,Q=null,X=new Set,z=()=>{if(J){Z=J,J=null;for(let K of X)K(Z)}Q=null},G=()=>J??Z,H=(K)=>{J??=Z,Object.assign(J,typeof K=="function"?K(G()):K),Q||(Q=requestAnimationFrame(z))},Y=(K)=>(X.add(K),()=>X.delete(K));return Z=$(H,G),{get:G,set:H,subscribe:Y}}function m70($){let[Z]=x4.useState($);return Z}function p70($){let Z=x4.createContext(null);return{useStore:()=>{let J=x4.useContext(Z);if(!J)throw Error($);return J},Provider:({store:J,children:Q})=>Rv.jsx(Z.Provider,{value:J,children:Q})}}function b4($,Z,J=Object.is){let[Q,X]=x4.useState(()=>Z($.get()));return x4.useEffect(()=>$.subscribe(()=>{let z=Z($.get());X((G)=>J(G,z)?G:z)}),[$,Z,J]),x4.useDebugValue(Q),Q}function F9($,Z,J){let Q=x4.useCallback((X)=>X[Z],[Z]);return b4($,Q,J)}var Dv=2;function u70($,Z,J,Q,X){let z=0;return f70((G,H)=>({locale:Z,columns:J,sticky:Q,skinTone:X,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:(Y)=>{let K=H(),W=Y?.data??K.data,B=Y?.categoryHeaderHeight??K.categoryHeaderHeight,q=Y?.rowHeight??K.rowHeight,U=Y?.viewportHeight??K.viewportHeight;if(!W||W.rows.length===0||!B||!q||!U)return G({...Y,viewportStartCategoryIndex:0,viewportStartRowIndex:0,viewportEndRowIndex:0});let F=0,N=0;for(let I of W.categories)if(N++*B+I.startRowIndex*q<z)F+=B;else break;let L=W.categories.length*B+W.rows.length*q,V=Math.floor(Dv*q/2),M=Math.ceil(Dv*q/2),_=Math.min(z-F-V,L-U),O=_+U+M,D=Math.max(0,Math.floor(_/q)),A=Math.min(W.rows.length-1,Math.ceil(O/q)),E=W.rows[D]?.categoryIndex;return G(E===void 0&&Y?Y:{...Y,viewportStartCategoryIndex:E,viewportStartRowIndex:D,viewportEndRowIndex:A})},onDataChange:(Y)=>{H().updateViewportState({data:Y,activeColumnIndex:0,activeRowIndex:0})},onSearchChange:(Y)=>{G({search:Y,interaction:Y?"keyboard":"none"})},onActiveEmojiChange:(Y,K,W)=>{if(G({interaction:Y,activeColumnIndex:K,activeRowIndex:W}),Y!=="keyboard")return;let{listRef:B,viewportRef:q,sticky:U,rowHeight:F,viewportHeight:N,categoryHeaderHeight:L}=H(),V=B?.current,M=q?.current;if(!V||!M||!F||!L||!N)return;let _=W;_===0&&M.scrollTo({top:0,behavior:"instant"});let O=V.querySelector(`[aria-rowindex="${_}"]`);if(!(O instanceof HTMLElement))return;let D=O.offsetTop,A=getComputedStyle(O),E=Number.parseFloat(A.scrollMarginTop),I=Number.parseFloat(A.scrollMarginBottom),y=z+E;U&&D<z+N/2&&(y+=L);let C=y+N-I;(D<y||D+F>C)&&M.scrollTo({top:Math.max(D<y+L?D-Math.max(U?L:0,E):D-N+F+I,0),behavior:"instant"})},onActiveEmojiReset:()=>{G({interaction:"none",activeColumnIndex:0,activeRowIndex:0})},onRowHeightChange:(Y)=>{H().updateViewportState({rowHeight:Y})},onCategoryHeaderHeightChange:(Y)=>{H().updateViewportState({categoryHeaderHeight:Y})},onViewportSizeChange:(Y,K)=>{H().updateViewportState({viewportWidth:Y,viewportHeight:K})},onViewportScroll:(Y)=>{z=Y,H().updateViewportState()}}))}var{useStore:M4,Provider:c70}=p70("EmojiPicker.Root is missing.");function d70($){return $.search}function ZM($){return $.interaction==="none"?void 0:$.data?.rows[$.activeRowIndex]?.emojis[$.activeColumnIndex]}function l70($){return $.data===void 0||typeof $.data?.count=="number"&&$.data.count===0}function i70($){return $.data===null||$.viewportHeight===null||$.rowHeight===null||$.categoryHeaderHeight===null}function yv($){return $.data?.rows.length}function r70($){return $.data?.categories.length}function a70($){return $.data?.categoriesStartRowIndices}function n70($){return $.data?.skinTones}function bv($,Z){return $?.emoji===Z?.emoji}function o70($,Z){return $?.categoryIndex!==Z?.categoryIndex||$?.emojis.length!==Z?.emojis.length?!1:!!$?.emojis.every((J,Q)=>bv(J,Z?.emojis[Q]))}var TX="‍",Ov=/\p{Emoji_Modifier_Base}/u,s70=/\uFE0F$/,t70=/\u{1F3FB}|\u{1F3FC}|\u{1F3FD}|\u{1F3FE}|\u{1F3FF}/gu,e70={light:"\uD83C\uDFFB","medium-light":"\uD83C\uDFFC",medium:"\uD83C\uDFFD","medium-dark":"\uD83C\uDFFE",dark:"\uD83C\uDFFF"};function $$0($,Z){if(!$.split(TX).some((Q)=>Ov.test(Q)))return $;let J=$.split(TX).map((Q)=>Q.replace(t70,"")).join(TX);return Z==="none"?J:J.split(TX).map((Q,X,z)=>{let G=z.length>1;return!Ov.test(Q)||G&&Q==="\uD83E\uDD1D"?Q:Q.replace(s70,"")+e70[Z]}).join(TX)}function Z$0($){return $M.map((Z)=>({skinTone:Z,emoji:$$0($,Z)}))}function xv(){let $=M4(),Z=b4($,ZM,bv);return IZ.useDeferredValue(Z)}function hv($="✋"){let Z=M4(),J=F9(Z,"skinTone"),Q=IZ.useMemo(()=>Z$0($),[$]),X=IZ.useCallback((z)=>{Z.set({skinTone:z})},[]);return[J,X,Q]}function JM($,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($),Q=Object.keys(Z);return J.length!==Q.length?!1:J.every((X)=>(X in Z)&&$[X]===Z[X])}function J$0(...$){}function Q$0($,Z){let J=null;if(typeof window.requestIdleCallback=="function")J=window.requestIdleCallback($,Z);else{let Q=Date.now();J=window.setTimeout(()=>{$({didTimeout:!1,timeRemaining:()=>Math.max(0,(Z?.timeout??50)-(Date.now()-Q))})},10)}return()=>{typeof window.cancelIdleCallback=="function"?window.cancelIdleCallback(J):window.clearTimeout(J)}}var C2=typeof window<"u"?uW.useLayoutEffect:uW.useEffect;function X$0($){let Z=cW.useRef($);return C2(()=>{Z.current=$}),cW.useCallback((...J)=>Z.current(...J),[])}function z$0({emojiVersion:$,emojibaseUrl:Z}){let[J,Q]=r0.useState(void 0),X=M4(),z=F9(X,"locale"),G=F9(X,"columns"),H=F9(X,"skinTone"),Y=F9(X,"search");return r0.useEffect(()=>{let K=new AbortController,W=K.signal;return x70({locale:z,emojiVersion:$,emojibaseUrl:Z,signal:W}).then((B)=>{Q(B)}).catch((B)=>{W.aborted||console.error(B)}),()=>{K.abort()}},[$,Z,z]),r0.useEffect(()=>{if(J)return Q$0(()=>{X.get().onDataChange(v70(J,G,H,Y))},{timeout:100})},[J,G,H,Y]),null}var gv=r0.forwardRef(({locale:$="en",columns:Z=9,skinTone:J="none",onEmojiSelect:Q=J$0,emojiVersion:X,emojibaseUrl:z,onFocusCapture:G,onBlurCapture:H,children:Y,style:K,sticky:W=!0,...B},q)=>{let U=X$0(Q),F=m70(()=>u70(U,Av($),Z,W,_v(J))),[N,L]=r0.useState(!1),V=r0.useRef(null),M=r0.useCallback((D)=>{D&&(V.current=D,F.set({rootRef:V}))},[]);C2(()=>{F.set({locale:Av($)})},[$]),C2(()=>{F.set({columns:Z})},[Z]),C2(()=>{F.set({sticky:W})},[W]),C2(()=>{F.set({skinTone:_v(J)})},[J]);let _=r0.useCallback((D)=>{G?.(D);let{searchRef:A,viewportRef:E}=F.get(),I=D.target===A?.current||D.target.hasAttribute("frimousse-search"),y=D.target===E?.current||D.target.hasAttribute("frimousse-viewport");D.isDefaultPrevented()||(L(I||y),D.isDefaultPrevented()||(L(I||y),y?F.get().onActiveEmojiChange("keyboard",0,0):I&&F.get().search===""&&F.set({interaction:"none"})))},[G]),O=r0.useCallback((D)=>{H?.(D),!D.isDefaultPrevented()&&!D.currentTarget.contains(D.relatedTarget)&&L(!1)},[H]);return C2(()=>{N||F.get().onActiveEmojiReset()},[N]),r0.useImperativeHandle(q,()=>V.current),r0.useEffect(()=>{if(!N)return;function D(A){if(A.defaultPrevented||!A.key.startsWith("Arrow")&&A.key!=="Enter")return;let{data:E,onEmojiSelect:I,onActiveEmojiChange:y,interaction:C,activeColumnIndex:h,activeRowIndex:k}=F.get();if(A.key==="Enter"){let S=ZM(F.get());S&&(A.preventDefault(),I(S))}if(A.key.startsWith("Arrow")){let S=h,w=k;if(A.preventDefault(),C!=="none"){if(E?.rows&&E.rows.length>0)switch(A.key){case"ArrowLeft":{if(S===0){let T=w-1,R=E.rows[T];R&&(w=T,S=R.emojis.length-1)}else S-=1;break}case"ArrowRight":{if(S===E.rows[w].emojis.length-1){let T=w+1;E.rows[T]&&(w=T,S=0)}else S+=1;break}case"ArrowUp":{let T=E.rows[w-1];T&&(w-=1,T.emojis[S]||(S=T.emojis.length-1));break}case"ArrowDown":{let T=E.rows[w+1];T&&(w+=1,T.emojis[S]||(S=T.emojis.length-1));break}}y("keyboard",S,w)}else y("keyboard",0,0)}}return document.addEventListener("keydown",D),()=>{document.removeEventListener("keydown",D)}},[N]),C2(()=>{let D=null,A=null,E=null,I=null,y=F.subscribe((w)=>{V.current&&(D!==w.viewportWidth&&(D=w.viewportWidth,V.current.style.setProperty("--frimousse-viewport-width",`${w.viewportWidth}px`)),A!==w.viewportHeight&&(A=w.viewportHeight,V.current.style.setProperty("--frimousse-viewport-height",`${w.viewportHeight}px`)),E!==w.rowHeight&&(E=w.rowHeight,V.current.style.setProperty("--frimousse-row-height",`${w.rowHeight}px`)),I!==w.categoryHeaderHeight&&(I=w.categoryHeaderHeight,V.current.style.setProperty("--frimousse-category-header-height",`${w.categoryHeaderHeight}px`)))}),{viewportWidth:C,viewportHeight:h,rowHeight:k,categoryHeaderHeight:S}=F.get();return C&&V.current.style.setProperty("--frimousse-viewport-width",`${C}px`),h&&V.current.style.setProperty("--frimousse-viewport-height",`${h}px`),k&&V.current.style.setProperty("--frimousse-row-height",`${k}px`),S&&V.current.style.setProperty("--frimousse-category-header-height",`${S}px`),y},[]),A5.jsx("div",{"data-focused":N?"":void 0,"frimousse-root":"",onBlurCapture:O,onFocusCapture:_,...B,ref:M,style:{"--frimousse-emoji-font":Tv,...K},children:A5.jsxs(c70,{store:F,children:[A5.jsx(z$0,{emojiVersion:X,emojibaseUrl:z}),Y]})})}),vv=r0.forwardRef(({value:$,defaultValue:Z,onChange:J,...Q},X)=>{let z=M4(),G=r0.useRef(null),H=r0.useCallback((B)=>{B&&(G.current=B,z.set({searchRef:G}))},[]),Y=typeof $=="string",K=r0.useRef(Y);r0.useEffect(()=>{K.current=Y},[Y]),C2(()=>{z.set({search:typeof $=="string"?$:typeof Z=="string"?Z:""})},[]),C2(()=>{typeof $=="string"&&z.get().onSearchChange($)},[$]);let W=r0.useCallback((B)=>{J?.(B),B.isDefaultPrevented()||z.get().onSearchChange(B.target.value)},[J]);return r0.useImperativeHandle(X,()=>G.current),A5.jsx("input",{autoCapitalize:"off",autoComplete:"off",autoCorrect:"off",enterKeyHint:"done","frimousse-search":"",placeholder:"Search…",spellCheck:!1,type:"search",...Q,defaultValue:Z,onChange:W,ref:H,value:$})}),G$0=r0.memo(()=>{let $=xv();return $?A5.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}),fv=r0.forwardRef(({children:$,onScroll:Z,onKeyDown:J,style:Q,...X},z)=>{let G=M4(),H=r0.useRef(null),Y=r0.useCallback((q)=>{q&&(H.current=q,G.set({viewportRef:H}))},[]),K=b4(G,yv),W=b4(G,r70),B=r0.useCallback((q)=>{Z?.(q),G.get().onViewportScroll(q.currentTarget.scrollTop)},[Z]);return C2(()=>{if(!H.current)return;let q=new ResizeObserver(([U])=>{let F=U?.borderBoxSize[0]?.inlineSize??0,N=U?.borderBoxSize[0]?.blockSize??0,{onViewportSizeChange:L,viewportHeight:V,viewportWidth:M}=G.get();(V!==N||M!==F)&&L(F,N)});return q.observe(H.current),G.get().onViewportSizeChange(H.current.offsetWidth,H.current.clientHeight),()=>{q.disconnect()}},[]),r0.useImperativeHandle(z,()=>H.current),A5.jsxs("div",{"frimousse-viewport":"",...X,onScroll:B,ref:Y,style:{position:"relative",boxSizing:"border-box",contain:"layout paint",containIntrinsicSize:typeof K=="number"&&typeof W=="number"?`var(--frimousse-viewport-width, auto) calc(${K} * var(--frimousse-row-height) + ${W} * var(--frimousse-category-header-height))`:void 0,overflowY:"auto",overscrollBehavior:"contain",scrollbarGutter:"stable",willChange:"scroll-position",...Q},children:[A5.jsx(G$0,{}),$]})});function mv($,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 pv($,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 uv($,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 cv($,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 Pv($,Z,J,Q){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) + ${Q} * var(--frimousse-category-header-height))`}}}function wv($,Z,J){return{"aria-colcount":$,"aria-rowcount":Z,"frimousse-list":"",style:{"--frimousse-list-columns":$,...J},role:"grid"}}function H$0($){$.preventDefault()}var Y$0=r0.memo(({Emoji:$,emoji:Z,columnIndex:J,rowIndex:Q})=>{let X=M4(),z=b4(X,(K)=>ZM(K)?.emoji===Z.emoji),G=r0.useCallback(()=>{X.get().onEmojiSelect(Z)},[Z]),H=r0.useCallback(()=>{X.get().onActiveEmojiChange("pointer",J,Q)},[J,Q]),Y=r0.useCallback(()=>{X.get().onActiveEmojiReset()},[]);return A5.jsx($,{...mv(Z,J,z),onClick:G,onPointerDown:H$0,onPointerEnter:H,onPointerLeave:Y})}),K$0=r0.memo(({Row:$,Emoji:Z,rowIndex:J})=>{let Q=M4(),X=b4(Q,(z)=>z.data?.rows[J],o70);return X?A5.jsx($,{...pv(J),children:X.emojis.map((z,G)=>A5.jsx(Y$0,{Emoji:Z,columnIndex:G,emoji:z,rowIndex:J},z.label))}):null}),W$0=r0.memo(({CategoryHeader:$,categoryIndex:Z})=>{let J=M4(),Q=b4(J,(z)=>z.data?.categories[Z],JM),X=F9(J,"sticky");return Q?A5.jsx("div",{...uv(Z,Q),children:A5.jsx($,{...cv({label:Q.label},!1,X)})}):null}),jv=r0.memo(({CategoryHeader:$,Row:Z,Emoji:J})=>{let Q=r0.useRef(null),X=M4(),z=F9(X,"columns"),G=r0.useMemo(()=>Array(z).fill({emoji:"\uD83D\uDE42",label:""}),[z]),H=r0.useMemo(()=>({label:"Category"}),[]),Y=r0.useRef(null),K=r0.useRef(null);return C2(()=>{let W=Q.current?.parentElement?.parentElement;if(!W||!Y.current||!K.current)return;let B=new ResizeObserver((F)=>{for(let N of F){let L=N.contentRect.height,{onRowHeightChange:V,onCategoryHeaderHeightChange:M,rowHeight:_,categoryHeaderHeight:O}=X.get();N.target===Y.current&&_!==L&&V(L),N.target===K.current&&O!==L&&M(L)}});B.observe(W),B.observe(Y.current),B.observe(K.current);let{onRowHeightChange:q,onCategoryHeaderHeightChange:U}=X.get();return q(Y.current.clientHeight),U(K.current.clientHeight),()=>{B.disconnect()}},[]),A5.jsxs("div",{"aria-hidden":!0,ref:Q,style:{height:0,visibility:"hidden"},children:[A5.jsx("div",{"frimousse-row-sizer":"",ref:Y,children:A5.jsx(Z,{...pv(-1,!0),children:G.map((W,B)=>A5.jsx(J,{...mv(W,B,!1)},B))})}),A5.jsx("div",{...uv(-1),children:A5.jsx("div",{"frimousse-category-header-sizer":"",ref:K,children:A5.jsx($,{...cv(H,!0)})})})]})});function B$0({category:$,...Z}){return A5.jsx("div",{...Z,children:$.label})}function q$0({emoji:$,...Z}){return A5.jsx("button",{type:"button",...Z,children:$.emoji})}function U$0({...$}){return A5.jsx("div",{...$})}var dv=r0.forwardRef(({style:$,components:Z,...J},Q)=>{let X=M4(),z=r0.useRef(null),G=r0.useCallback((V)=>{V&&(z.current=V,X.set({listRef:z}))},[]),H=Z?.CategoryHeader??B$0,Y=Z?.Emoji??q$0,K=Z?.Row??U$0,W=F9(X,"columns"),B=F9(X,"viewportStartRowIndex"),q=F9(X,"viewportEndRowIndex"),U=b4(X,yv),F=b4(X,a70,JM),N=r0.useMemo(()=>F?.filter((V)=>V<B).length??0,[F,B]),L=F?.length??0;return r0.useImperativeHandle(Q,()=>z.current),!U||!F||L===0?A5.jsx("div",{...wv(W,0,$),...J,children:A5.jsx("div",{...Pv(0,0,0,0),children:A5.jsx(jv,{CategoryHeader:H,Emoji:Y,Row:K})})}):A5.jsx("div",{...wv(W,U,$),...J,ref:G,children:A5.jsxs("div",{...Pv(U,L,B,N),children:[A5.jsx(jv,{CategoryHeader:H,Emoji:Y,Row:K}),Array.from({length:q-B+1},(V,M)=>{let _=B+M,O=F.indexOf(_);return A5.jsxs(r0.Fragment,{children:[O>=0&&A5.jsx("div",{style:{height:"var(--frimousse-category-header-height)"}}),A5.jsx(K$0,{Emoji:Y,Row:K,rowIndex:_})]},_)}),Array.from({length:L},(V,M)=>A5.jsx(W$0,{CategoryHeader:H,categoryIndex:M},M))]})})}),lv=r0.forwardRef(({emoji:$,onClick:Z,"aria-label":J="Change skin tone",...Q},X)=>{let z=M4(),G=b4(z,n70,JM),[H,Y,K]=hv($),W=r0.useMemo(()=>Math.max(0,K.findIndex((L)=>L.skinTone===H)),[H,K]),B=K[W],q=K[(W+1)%K.length].skinTone,U=H==="none"?void 0:G?.[H],F=q==="none"?void 0:G?.[q],N=r0.useCallback((L)=>{Z?.(L),L.isDefaultPrevented()||Y(q)},[Z,Y,q]);return A5.jsx("button",{type:"button",...Q,"aria-label":J+(F?` (${F})`:""),"aria-live":"polite","aria-valuetext":U,"frimousse-skin-tone-selector":"",onClick:N,ref:X,children:B.emoji})});function iv({children:$,...Z}){let J=M4();return b4(J,i70)?A5.jsx("span",{"frimousse-loading":"",...Z,children:$}):null}function F$0({children:$}){let Z=M4(),J=b4(Z,d70);return $({search:J})}function rv({children:$,...Z}){let J=M4();return b4(J,l70)?A5.jsx("span",{"frimousse-empty":"",...Z,children:typeof $=="function"?A5.jsx(F$0,{children:$}):$}):null}function av({children:$}){let Z=xv();return $({emoji:Z})}function nv({children:$,emoji:Z}){let[J,Q,X]=hv(Z);return $({skinTone:J,setSkinTone:Q,skinToneVariations:X})}gv.displayName="EmojiPicker.Root";vv.displayName="EmojiPicker.Search";fv.displayName="EmojiPicker.Viewport";dv.displayName="EmojiPicker.List";iv.displayName="EmojiPicker.Loading";rv.displayName="EmojiPicker.Empty";lv.displayName="EmojiPicker.SkinToneSelector";av.displayName="EmojiPicker.ActiveEmoji";nv.displayName="EmojiPicker.SkinTone";var CX=["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","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"],N$0=new Set(CX);function ov($){return N$0.has($)}var ef={rocket:vf,sparkles:uf,bolt:CQ,flame:Mf,star:cf,heart:Pf,diamond:Vf,trophy:nf,target:lf,bulb:Xf,brain:Jf,robot:gf,wand:sf,atom:ev,flask:Af,cpu:qf,code:Wf,terminal:rf,api:tv,database:Ff,cube:Uf,hexagon:wf,plug:hf,tool:af,settings:EX,bug:Qf,activity:sv,chart:Hf,briefcase:KK,folder:_f,file:a$,book:Zf,message:Sf,mail:Cf,bell:$f,paperclip:HK,key:dW,shield:ff,user:of,home:jf,globe:Of,world:tf,planet:xf,compass:Bf,map:Ef,calendar:zf,cloud:Kf,sun:df,moon:kf,snowflake:pf,leaf:Tf,mountain:If,feather:Lf,ghost:WK,music:Rf,piano:BK,camera:Gf,photo:bf,palette:yf,gamepad:Nf,gift:Df,cart:mf,chef:Yf},QM=CX.map(($)=>({id:$,Icon:ef[$]}));function lW($){return $&&ov($)?ef[$]:null}var zM=[{id:"sunrise",gradient:{angle:140,stops:["#FFE29F","#FFA99F","#FF719A"]}},{id:"ocean",gradient:{angle:135,stops:["#67E8F9","#3B82F6","#4F46E5"]}},{id:"meadow",gradient:{angle:135,stops:["#A7F3D0","#34D399","#059669"]}},{id:"dusk",gradient:{angle:120,stops:["#C471F5","#FA71CD"]}},{id:"midnight",gradient:{angle:135,stops:["#30CFD0","#330867"]}}];function XM($,Z,J){let Q=J*Math.PI/180,X=Z*Math.cos(Q),z=Z*Math.sin(Q),G=($+0.3963377774*X+0.2158037573*z)**3,H=($-0.1055613458*X-0.0638541728*z)**3,Y=($-0.0894841775*X-1.291485548*z)**3;return`#${[4.0767416621*G-3.3077115913*H+0.2309699292*Y,-1.2684380046*G+2.6097574011*H-0.3413193965*Y,-0.0041960863*G-0.7034186147*H+1.707614701*Y].map((W)=>{let B=Math.min(1,Math.max(0,W)),q=B<=0.0031308?12.92*B:1.055*B**0.4166666666666667-0.055;return Math.round(q*255).toString(16).padStart(2,"0")}).join("")}`}function $m(){let $=Math.random()*360,Z=(35+Math.random()*55)*(Math.random()<0.5?-1:1),J=Math.round(115+Math.random()*55),Q=XM(0.83+Math.random()*0.06,0.09+Math.random()*0.06,$),X=XM(0.5+Math.random()*0.14,0.17+Math.random()*0.07,$+Z);if(Math.random()<0.4){let z=XM(0.7+Math.random()*0.05,0.15,$+Z/2);return{angle:J,stops:[Q,z,X]}}return{angle:J,stops:[Q,X]}}var V$0="radial-gradient(120% 100% at 28% 12%, rgba(255,255,255,0.32), rgba(255,255,255,0) 58%)";function iW($){return`${V$0}, linear-gradient(${$.angle}deg, ${$.stops.join(", ")})`}var z8=256;function Zm($,Z){let J=Z.angle*Math.PI/180,Q=Math.sin(J),X=-Math.cos(J),z=z8*(Math.abs(Q)+Math.abs(X))/2,G=z8/2,H=$.createLinearGradient(G-Q*z,G-X*z,G+Q*z,G+X*z),Y=Z.stops.length-1;Z.stops.forEach((W,B)=>H.addColorStop(Y===0?0:B/Y,W)),$.fillStyle=H,$.fillRect(0,0,z8,z8);let K=$.createRadialGradient(z8*0.28,z8*0.12,0,z8*0.28,z8*0.12,z8*1.1);K.addColorStop(0,"rgba(255,255,255,0.32)"),K.addColorStop(0.58,"rgba(255,255,255,0)"),$.fillStyle=K,$.fillRect(0,0,z8,z8)}function Jm($){return new Promise((Z,J)=>{$.toBlob((Q)=>Q?Z(Q):J(Error("Canvas is empty")),"image/png")})}function Qm(){let $=document.createElement("canvas");$.width=z8,$.height=z8;let Z=$.getContext("2d");if(!Z)throw Error("2D canvas unavailable");return[$,Z]}var L$0=0.92,M$0=0.68;async function Xm($,Z){let[J,Q]=Qm();if(Z)Zm(Q,Z);Q.textAlign="center",Q.textBaseline="middle";let X=Z?M$0:L$0;return Q.font=`${Math.round(z8*X)}px "Apple Color Emoji","Segoe UI Emoji","Noto Color Emoji",sans-serif`,Q.fillText($,z8/2,z8/2+z8*0.04),Jm(J)}function A$0($){return new Promise((Z,J)=>{let Q=new Image;Q.onload=()=>Z(Q),Q.onerror=()=>J(Error("Failed to load SVG")),Q.src=$})}var _$0=0.78,D$0=0.6;async function zm($,Z){let[J,Q]=Qm();if(Z)Zm(Q,Z);let X=Z?"#ffffff":"#18181b",z=$.replace(/currentColor/g,X),G=await A$0(`data:image/svg+xml;utf8,${encodeURIComponent(z)}`),H=z8*(Z?D$0:_$0),Y=(z8-H)/2;return Q.drawImage(G,Y,Y,H,H),Jm(J)}var Gm=["\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","☕"],rW="font-[Apple_Color_Emoji,Segoe_UI_Emoji,Noto_Color_Emoji,sans-serif]";var n0=P(d(),1);function O$0({category:$,...Z}){return n0.jsx("div",{className:"bg-background px-2.5 pt-2.5 pb-1 text-xs font-medium text-muted-foreground",...Z,children:$.label})}function P$0({children:$,...Z}){return n0.jsx("div",{className:"scroll-my-1 px-1.5",...Z,children:$})}function w$0({emoji:$,...Z}){return n0.jsx("button",{className:s("flex size-9 items-center justify-center rounded-xl text-[22px] transition-colors duration-75 data-active:bg-muted",rW),...Z,children:$.emoji})}function Bm({icon:$}){let{workspaceId:Z,provider:J}=n5(),{isPending:Q,mutateAsync:X}=Gv(Z),{isPending:z,mutate:G}=Hv(Z),[H,Y]=O8.useState("emoji"),[K,W]=O8.useState({id:"sunrise",gradient:zM[0].gradient}),[B,q]=O8.useState(null),[U,F]=O8.useState(null),[N,L]=O8.useState(""),[V,M]=O8.useState(null),[_,O]=O8.useState(null),[D,A]=O8.useState(!1),[E,I]=O8.useState(null),y=O8.useRef(null),C=O8.useRef(null),h=O8.useRef(null),k=QM.find((j)=>j.id===V),S=K.gradient!==null,w=Q||z,T=()=>{let j=$m();q(j),W({id:"shuffle",gradient:j})},R=(j)=>{I(null),h.current=j,Y("upload"),O(URL.createObjectURL(j))};O8.useEffect(()=>{let j=!1,t=async()=>{let x;if(H==="upload"){if(!h.current)return;x=h.current}else if(H==="emoji"){if(!U)return;x=await Xm(U,K.gradient)}else{let e=C.current?.querySelector("svg");if(!e)return;x=await zm(new XMLSerializer().serializeToString(e),K.gradient)}if(!j)await X(x)};I(null);let Q0=window.setTimeout(()=>{t().catch((x)=>{if(!j)I(x instanceof Error?x.message:"Failed to save icon")})},150);return()=>{j=!0,window.clearTimeout(Q0)}},[K.gradient,U,H,X,k,_]),O8.useEffect(()=>{return()=>{if(_)URL.revokeObjectURL(_)}},[_]);let b=()=>{h.current=null,F(null),M(null),O(null),I(null),G()},g=H==="emoji"&&U?"emoji":H==="icon"&&k?"glyph":"image",u=H==="upload"&&_?_:$??V2[J??"claude-code"];return n0.jsxs("div",{className:"flex gap-6",children:[n0.jsxs("div",{className:"flex w-24 shrink-0 flex-col items-center gap-2.5",children:[n0.jsx("div",{className:s("flex size-24 items-center justify-center overflow-hidden rounded-xl",g!=="image"&&!S&&"bg-[repeating-conic-gradient(#0000000d_0%_25%,transparent_0%_50%)] bg-size-[16px_16px]"),style:g!=="image"&&K.gradient?{background:iW(K.gradient)}:void 0,children:g==="emoji"?n0.jsx("span",{className:s("leading-none",rW,S?"text-[64px]":"text-[86px]"),children:U}):g==="glyph"&&k?n0.jsx(k.Icon,{stroke:1.5,className:s(S?"size-14 text-white":"size-18 text-foreground")}):n0.jsx("img",{src:u,alt:"",className:"size-full object-cover"})}),n0.jsx("button",{type:"button",onClick:b,disabled:w,className:"text-xs text-muted-foreground transition-colors hover:text-foreground disabled:opacity-50",children:"Reset to default"})]}),n0.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-3",children:[n0.jsx("div",{className:"flex gap-1 self-start rounded-xl bg-muted p-0.5",children:["emoji","icon","upload"].map((j)=>n0.jsx("button",{type:"button",onClick:()=>Y(j),className:s("rounded-lg px-3.5 py-1 text-xs font-medium capitalize transition-colors",H===j?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:j},j))}),n0.jsxs("div",{className:s("flex items-center gap-2",H==="upload"&&"pointer-events-none opacity-35"),children:[n0.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Background"}),n0.jsxs("div",{className:"flex items-center gap-2",children:[n0.jsx("button",{type:"button","aria-label":"No background",onClick:()=>W({id:"none",gradient:null}),className:s("flex size-7 items-center justify-center rounded-full bg-muted ring-offset-2 ring-offset-card transition-shadow",K.id==="none"?"ring-2 ring-primary":"ring-1 ring-border hover:ring-muted-foreground/30"),children:n0.jsx(Ym,{size:16,stroke:1.75,className:"text-muted-foreground"})}),zM.map((j)=>n0.jsx("button",{type:"button","aria-label":`${j.id} background`,onClick:()=>W({id:j.id,gradient:j.gradient}),style:{background:iW(j.gradient)},className:s("size-7 rounded-full ring-offset-2 ring-offset-card transition-shadow",K.id===j.id?"ring-2 ring-primary":"hover:ring-2 hover:ring-muted-foreground/30")},j.id)),n0.jsx("button",{type:"button","aria-label":"Random background",title:"Surprise me",onClick:T,style:B?{background:iW(B)}:void 0,className:s("flex size-7 items-center justify-center rounded-full ring-offset-2 ring-offset-card transition-shadow",B?"text-white":"bg-muted text-muted-foreground ring-1 ring-border",K.id==="shuffle"?"ring-2 ring-primary":"hover:ring-2 hover:ring-muted-foreground/30"),children:n0.jsx(Hm,{size:16,stroke:1.75})})]})]}),H==="emoji"?n0.jsxs(m9.Root,{onEmojiSelect:(j)=>F(j.emoji),emojibaseUrl:"/vendor/emojibase",columns:13,className:"isolate flex h-72 flex-col overflow-hidden rounded-xl border border-border bg-background",children:[n0.jsxs("div",{className:"flex items-center gap-1.5 p-1.5 pb-0",children:[n0.jsx(m9.Search,{placeholder:"Search emoji…",onChange:(j)=>L(j.target.value),className:"h-8 min-w-0 flex-1 appearance-none rounded-lg bg-muted px-2.5 text-sm outline-none placeholder:text-muted-foreground"}),n0.jsx(m9.SkinToneSelector,{className:"size-8 shrink-0 rounded-lg text-lg hover:bg-accent"})]}),n0.jsxs(m9.Viewport,{className:"relative scrollbar-thin flex-1 overflow-y-auto outline-none",children:[n0.jsxs(m9.Loading,{className:"absolute inset-0 flex items-center justify-center gap-2 text-xs text-muted-foreground",children:[n0.jsx(T1,{size:16,stroke:1.75,className:"animate-spin"}),"Loading emoji…"]}),N.trim()===""&&n0.jsxs("div",{className:"border-b border-dashed border-border pb-1.5",children:[n0.jsx("p",{className:"px-2.5 pt-2.5 pb-1 text-xs font-medium text-muted-foreground",children:"Favorites"}),n0.jsx("div",{className:"grid grid-cols-13 justify-items-start px-1.5",children:Gm.map((j)=>n0.jsx("button",{type:"button",onClick:()=>F(j),className:s("flex size-9 items-center justify-center rounded-xl text-[22px] transition-colors duration-75",rW,U===j?"bg-primary/10":"hover:bg-accent"),children:j},j))})]}),n0.jsxs(m9.Empty,{className:"absolute inset-0 flex flex-col items-center justify-center gap-1 text-xs text-muted-foreground",children:[n0.jsx(Km,{size:20,stroke:1.5}),"No emoji found"]}),n0.jsx(m9.List,{className:"pb-1.5 select-none",components:{CategoryHeader:O$0,Row:P$0,Emoji:w$0}})]})]}):H==="icon"?n0.jsx("div",{className:"grid scrollbar-thin h-72 grid-cols-[repeat(auto-fill,minmax(2.25rem,1fr))] content-start gap-1 overflow-y-auto rounded-xl border border-border bg-background p-1.5",children:QM.map(({id:j,Icon:t})=>n0.jsx("button",{type:"button","aria-label":j,onClick:()=>M(j),className:s("flex aspect-square items-center justify-center rounded-xl text-muted-foreground transition-colors [&_svg]:size-5",V===j?"bg-primary/10 text-primary":"hover:bg-accent hover:text-accent-foreground"),children:n0.jsx(t,{stroke:1.5})},j))}):n0.jsxs("button",{type:"button",onClick:()=>y.current?.click(),onDragOver:(j)=>{j.preventDefault(),A(!0)},onDragLeave:()=>A(!1),onDrop:(j)=>{j.preventDefault(),A(!1);let t=j.dataTransfer.files?.[0];if(t)R(t)},className:s("flex h-72 flex-col items-center justify-center gap-2 rounded-xl border border-dashed transition-colors",D?"border-primary bg-primary/5 text-primary":"border-border text-muted-foreground hover:border-muted-foreground/30 hover:text-foreground"),children:[n0.jsx(Wm,{size:24,stroke:1.5}),n0.jsx("span",{className:"text-xs font-medium",children:"Click or drop an image"}),n0.jsx("span",{className:"text-[11px] text-muted-foreground/70",children:"PNG, JPG, GIF, or WebP"})]}),n0.jsx("div",{className:"min-h-4","aria-live":"polite",children:E?n0.jsx("p",{className:"text-xs text-destructive",children:E}):w?n0.jsx("p",{className:"text-xs text-muted-foreground",children:"Saving…"}):null})]}),n0.jsx("input",{ref:y,type:"file",accept:"image/png,image/jpeg,image/gif,image/webp",className:"hidden",onChange:(j)=>{let t=j.target.files?.[0];if(t)R(t);j.target.value=""}}),n0.jsx("span",{ref:C,"aria-hidden":!0,className:"hidden",children:k&&n0.jsx(k.Icon,{stroke:1.5})})]})}var M8=P(d(),1);function Um(){let{name:$,icon:Z,cwd:J,workspaceId:Q}=n5(),[,X]=g4(),z=zv(Q),G=EO(),[H,Y]=qm.useState($??"");return M8.jsxs(EZ,{title:"General",description:"Basic details for this space.",children:[M8.jsxs(SZ,{children:[M8.jsx(kZ,{title:"Name",description:"Shown in the sidebar and the workspace header.",control:M8.jsx(X6,{value:H,onChange:(B)=>Y(B.target.value),onBlur:()=>{let B=H.trim();if(B===($??""))return;z.mutate(B===""?null:B)},onKeyDown:(B)=>{if(B.key==="Enter")B.currentTarget.blur()},placeholder:"Space name",className:"w-56"})}),M8.jsx(kZ,{title:"Path",control:M8.jsx(X6,{value:J??"",readOnly:!0,"aria-label":"Workspace path",title:J??void 0,className:"w-56"})}),M8.jsxs("div",{className:"flex flex-col gap-4 px-3.5 py-3.5",children:[M8.jsxs("div",{className:"flex flex-col",children:[M8.jsx("span",{className:"text-sm font-medium",children:"Icon"}),M8.jsx("span",{className:"text-xs text-muted-foreground",children:"Pick an emoji or a glyph on a generated background, or upload an image."})]}),M8.jsx(Bm,{icon:Z})]})]}),M8.jsxs(SZ,{label:"Danger zone",children:[M8.jsx(kZ,{title:"Remove space",description:"Remove this space from moi. Its folder and sessions stay on disk.",control:M8.jsxs(k0,{type:"button",variant:"destructive",size:"sm",onClick:()=>{let q=`Remove "${$??J??"this space"}" from your workspaces?
79
+
80
+ This only removes it from your list. The folder and its sessions stay on disk. You can add it back any time.`;if(!window.confirm(q))return;G.mutate(Q,{onSuccess:()=>X("/")})},disabled:G.isPending,children:[G.isPending&&M8.jsx(T1,{"data-icon":"inline-start",stroke:1.75,className:"animate-spin"}),"Remove"]})}),G.isError&&M8.jsx("p",{className:"px-3.5 py-3 text-xs text-destructive",children:G.error.message})]})]})}var B1=P(d(),1),j$0=[{id:"general",label:"General",icon:EX},{id:"connectors",label:"Connectors",icon:vW},{id:"environment",label:"Environment",icon:dW}];function Fm(){let[$,Z]=GM.useState(!1),[J,Q]=GM.useState("general");return B1.jsxs(B1.Fragment,{children:[B1.jsxs(M1,{children:[B1.jsx(A1,{render:B1.jsx(k0,{variant:"ghost",size:"icon-sm","aria-label":"Settings",onClick:()=>Z(!0),children:B1.jsx(EX,{stroke:1.75})})}),B1.jsx(_1,{children:"Settings"})]}),B1.jsx($$,{open:$,onOpenChange:Z,children:B1.jsxs(_G,{className:"flex h-[min(680px,90vh)] w-[880px] max-w-[94vw]",children:[B1.jsx(Z$,{className:"sr-only",children:"Space settings"}),B1.jsxs("nav",{className:"flex w-48 shrink-0 flex-col gap-0.5 border-r border-border bg-muted/30 p-3",children:[B1.jsx("p",{className:"px-2.5 pt-4 pb-2 text-[11px] font-semibold tracking-wider text-muted-foreground/80 uppercase",children:"Settings"}),j$0.map((X)=>B1.jsxs(k0,{type:"button",variant:J===X.id?"secondary":"ghost",size:"sm",onClick:()=>Q(X.id),className:"justify-start",children:[B1.jsx(X.icon,{stroke:1.75}),X.label]},X.id))]}),B1.jsxs("div",{className:"relative scrollbar-thin min-w-0 flex-1 overflow-y-auto",children:[B1.jsxs("div",{className:"px-8 py-7",children:[J==="general"&&B1.jsx(Um,{}),J==="connectors"&&B1.jsx(ng,{}),J==="environment"&&B1.jsx(Wv,{})]}),B1.jsx(AG,{render:B1.jsx(k0,{variant:"ghost",size:"icon","aria-label":"Close",className:"absolute top-3 right-3",children:B1.jsx(m1,{stroke:1.5})})})]})]})})]})}function T$0($){if($.status==="available")return null;if($.status==="checking")return"this workspace's agent availability has not resolved yet";return"this workspace's agent is unavailable"}function Nm({send:$,revealChat:Z,composerAvailability:J}){let Q=J1();lH(Q,"sendChatMessage",(X)=>{let z=T$0(J);if(z){F2(Q,{source:"runtime",message:`sendChatMessage("${X.message}") was dropped: ${z}.`});return}let{message:G,...H}=X;Z(),$(G,{applet:H})})}var RZ=P(v(),1);var Dm=P(v(),1);function aW($,Z){let J=$??[];if(J.findIndex((X)=>X.id===Z.id)===-1)return[...J,Z];return J.map((X)=>X.id===Z.id&&X.updatedAt<=Z.updatedAt?Z:X)}function nW($){let Z=o0();return Z8((J)=>{if(J.type==="view-builder:updated"&&J.workspaceId===$)Z.setQueryData(S0.viewBuilders($),(Q)=>aW(Q,J.builder));else if(J.type==="view-builder:deleted"&&J.workspaceId===$)Z.setQueryData(S0.viewBuilders($),(Q)=>(Q??[]).filter((X)=>X.id!==J.builderId))}),X1({queryKey:S0.viewBuilders($),queryFn:async()=>{return(await C5(`/api/workspaces/${$}/view-builders`)).builders},...A2})}function Vm($){let Z=o0();return t5({mutationFn:()=>C5(`/api/workspaces/${$}/view-builders`,r1("POST"),"Failed to create view builder"),onSuccess:(J)=>{Z.setQueryData(S0.viewBuilders($),(Q)=>aW(Q,J))}})}function Lm($){let Z=o0();return t5({mutationFn:({builderId:J,requirements:Q})=>C5(`/api/workspaces/${$}/view-builders/${J}`,r1("PATCH",{input:{requirements:Q}}),"Failed to save view requirements"),onSuccess:(J)=>{Z.setQueryData(S0.viewBuilders($),(Q)=>aW(Q,J))}})}function Mm($){let Z=o0();return t5({mutationFn:({builderId:J,requirements:Q,...X})=>C5(`/api/workspaces/${$}/view-builders/${J}/submit`,r1("POST",{input:{requirements:Q},availableIcons:CX,...X}),"Failed to start view builder"),onSuccess:(J)=>{Z.setQueryData(S0.viewBuilders($),(Q)=>aW(Q,J))}})}function Am($){let Z=o0();return t5({mutationFn:(J)=>T4(`/api/workspaces/${$}/view-builders/${J}`,{method:"DELETE"},"Failed to discard view builder"),onSuccess:(J,Q)=>{Z.setQueryData(S0.viewBuilders($),(X)=>(X??[]).filter((z)=>z.id!==Q))}})}var _m=new Map;function C$0($){let Z=_m.get($)??[];return _m.delete($),Z}function E$0($,Z=[]){return[...C$0($),...Z]}function S$0($,Z){if(!$.startsWith("view:"))return;return Object.keys(Z).length>0?Z:void 0}function k$0($,Z,J){if($.startsWith("view:"))return Z?.find((Q)=>Q.id===$.slice(5))?.config.title||void 0;if($.startsWith("view-builder:"))return J?.find((Q)=>Q.id===$.slice(13))?.title||void 0;return}function Om({activeTab:$,appletParams:Z}){let J=J1(),Q=oH(J).data,X=nW(J).data;return Dm.useCallback((z={})=>{let G=E$0(J,z.directives??[]),H=S$0($,Z);return{activeTab:$,tabTitle:k$0($,Q,X),...H?{tabParams:H}:{},...z.applet?{applet:z.applet}:{},...G.length>0?{directives:G}:{}}},[J,$,Z,Q,X])}var Pm=!0;function wm($,Z=[]){return($.trim()||Z.filter(Boolean).join(", ")).replace(/\s+/gu," ").trim().slice(0,64).trimEnd()}function oW($){return!$?.applet}function sW($,Z,J){if(!oW(J))return[];return(P5.getState().attachments[n8($,Z)]??[]).filter((X)=>X.status==="ready"&&X.upload)}function tW($){return $.map((Z)=>{if(Z.upload?.kind==="image"&&Z.previewUrl)return{type:"file",mediaType:Z.mediaType,url:Z.previewUrl,filename:Z.name};return{type:"file",mediaType:Z.mediaType,url:"",filename:Z.name}})}function jm($,Z){if(!oW($))return $;let J=[],Q=[],X=0;for(let G of Z){if(G.upload?.kind!=="image")continue;if(X+=1,G.kind==="drawing"&&G.purpose==="annotation")J.push(`${X}. ${JSON.stringify(G.sourceTab)}`);if(G.kind==="drawing"&&G.purpose==="sketch")Q.push(`${X}. ${JSON.stringify(G.sourceTab)}`)}if(J.length===0&&Q.length===0)return $;let z=[...$?.directives??[]];if(J.length>0)z.push(`Annotation attachment sources in attachment order: ${J.join("; ")}.`);if(Q.length>0)z.push(`Sketch attachment sources in attachment order: ${Q.join("; ")}. Each sketch shows the intended layout of a new view.`);return{...$,directives:z}}function eW({queryClient:$,workspaceId:Z,sessionId:J,parts:Q}){let X=`optimistic:${crypto.randomUUID()}`;return $.setQueryData(S0.events(Z,J),(z)=>OJ(z??DJ(),{kind:"turn",turn:{id:X,role:"user",origin:{kind:"user-input"},parts:Q,timestamp:new Date().toISOString()}})),P5.getState().setActivity(Z,J,"running"),P5.getState().setError(Z,J,null),X}function $B({queryClient:$,workspaceId:Z,sessionId:J,text:Q,filenames:X=[]}){let z=wm(Q,X);if(!z)return;$.setQueryData(S0.sessions(Z),(G)=>[{sessionId:J,summary:z,lastModified:Date.now()},...(G??[]).filter((H)=>H.sessionId!==J)])}function ZB($,Z,J,Q){let X=$?.models,z=!Z||!X||X.some((W)=>W.value===Z)?Z:void 0,G=X?.find((W)=>W.value===z),H=J&&(!G||(G.supportedEffortLevels??[]).includes(J))?J:void 0,Y=Q===void 0||!G||G.supportsFastMode?Q:!1,K=Pm&&$?.supportsStreaming?!0:void 0;return{model:z,effort:H,...Y!==void 0?{fastMode:Y}:{},stream:K}}function I$0($){return $.filter((Z)=>Z.text.length>0).map((Z)=>Z.kind==="reasoning"?{type:"reasoning",text:Z.text}:{type:"text",text:Z.text})}function Tm($){let Z=I$0($?.blocks??[]);if(Z.length===0)return null;return{id:"live-preview",role:"assistant",origin:{kind:"user-input"},parts:Z}}var R$0=DJ();function Cm($){let Z=J1(),J=o0(),{layout:Q}=n5(),[X,z]=a7(),G=X??null,H=X9(Z).data,Y=WY(Z).data,K=Om($),W=j4((A)=>G?A.activity[`${Z}:${G}`]??"idle":"idle"),B=MJ(W),q=j4((A)=>G?A.errors[`${Z}:${G}`]??null:null),U=gC(Z,G),F=U.data??R$0,N=Y!==void 0&&(G===null||U.data!==void 0),L=j4((A)=>A.previews),V=RZ.useMemo(()=>Tm(KO(L,Z,G).root),[L,Z,G]),M=BY(Z,G).data,_=RZ.useCallback((A,E)=>{let I=A.trim(),y=sW(Z,G,E);if(!I&&y.length===0)return;let C=G,h=!1;if(!C)C=crypto.randomUUID(),h=!0,z(C),$B({queryClient:J,workspaceId:Z,sessionId:C,text:I,filenames:y.map((t)=>t.name)});let k=tW(y);if(I)k.push({type:"text",text:I});let S=eW({queryClient:J,workspaceId:Z,sessionId:C,parts:k}),w=M?.model??Q.selectedModel,T=M?.effort??Q.selectedEffort,R=M?.fastMode??Q.selectedFastMode,{model:b,effort:g,fastMode:u,stream:j}=ZB(H,w,T,R);if(YG({type:"chat",workspaceId:Z,content:I,sessionId:C,isNew:h,optimisticId:S,model:b,effort:g,fastMode:u,stream:j,context:K(jm(E,y)),...y.length>0?{attachments:y.map((t)=>t.upload.id)}:{}}),D1.getState().markMessageSentFromMoi(Z),h)J.invalidateQueries({queryKey:S0.preview(Z)});if(oW(E))P5.getState().clearAttachments(Z,G)},[G,Z,J,Q.selectedModel,Q.selectedEffort,Q.selectedFastMode,K,M?.model,M?.effort,M?.fastMode,z,H]),O=RZ.useCallback(()=>{if(!G)return;P5.getState().setError(Z,G,null)},[G,Z]),D=RZ.useCallback(()=>{if(!B||!G)return;YG({type:"stop",workspaceId:Z,sessionId:G})},[B,G,Z]);return{view:F,chatLoaded:N,previewTurn:V,sessionId:G,processing:B,error:q,send:_,stop:D,selectSession:z,dismissError:O}}var Sm=P(v(),1);var G8=P(v(),1);function Em({active:$,builderId:Z,sessionId:J,sourceTab:Q,workspaceId:X,onEditingStart:z,onContinueInChat:G}){let H=G8.useRef(`sketch:${Z}`),Y=G8.useRef(0),K=G8.useRef(null),W=G8.useRef(null),B=G8.useRef(!0),[q,U]=G8.useState(!1),F=G8.useRef(z),N=G8.useRef(G);F.current=z,N.current=G;let L=G8.useCallback((I)=>{if(!B.current)return;if(!I){Y.current+=1,K.current=null,W.current=null,P5.getState().removeAttachment(X,J,H.current);return}JY({workspaceId:X,sessionId:J,localId:H.current,purpose:"sketch",sourceTab:Q,blob:I})},[J,Q,X]),V=G8.useCallback((I)=>{if(!I)return W.current??Promise.resolve();if(I===K.current){if(P5.getState().attachments[n8(X,J)]?.some((k)=>k.localId===H.current&&(k.status==="ready"||k.status==="uploading")))return W.current??Promise.resolve()}K.current=I;let y=++Y.current,C=QY({workspaceId:X,sessionId:J,localId:H.current,purpose:"sketch",sourceTab:Q,blob:I,isCurrent:()=>Y.current===y});return W.current=C,C},[J,Q,X]),M=$Y({mode:"sketch",onChange:L,onEditingStart:()=>F.current()}),{controls:_}=M,O=G8.useCallback(async()=>{await V(await _.flush())},[_,V]),D=G8.useCallback(async()=>{await V(await _.deactivate())},[_,V]),A=G8.useCallback(async()=>{if(q)return;U(!0);try{await D(),N.current()}finally{U(!1)}},[q,D]),E=G8.useCallback(async()=>{B.current=!1,Y.current+=1,K.current=null,W.current=null,P5.getState().removeAttachment(X,J,H.current);try{await _.cancel()}finally{B.current=!0}},[_,J,X]);return G8.useEffect(()=>{if(!$&&_.active)D()},[$,_.active,D]),{...M,continuing:q,continueInChat:A,prepareForSend:O,resetDocument:E}}var q1=P(d(),1);function km({ref:$,active:Z,builder:J,chatDocked:Q,workspaceId:X,onEditingStart:z,onContinueInChat:G,onOpenChat:H,onDiscard:Y}){let K=Em({active:Z&&J.status==="draft",builderId:J.id,sessionId:J.sessionId,sourceTab:l3(J.id),workspaceId:X,onEditingStart:z,onContinueInChat:G});switch(Sm.useImperativeHandle($,()=>({prepareSketchForSend:K.prepareForSend,resetSketch:K.resetDocument}),[K.prepareForSend,K.resetDocument]),J.status){case"ready":return null;case"draft":case"waiting":case"building":return q1.jsx(y$0,{active:Z,chatDocked:Q,error:J.error,sketch:K,status:J.status,onDiscard:Y,onOpenChat:H})}}function y$0({active:$,chatDocked:Z,error:J,sketch:Q,status:X,onDiscard:z,onOpenChat:G}){let H=X==="draft";return q1.jsxs("div",{className:s("relative min-h-0 flex-1 overflow-hidden bg-background",$?"flex":"hidden"),children:[H&&q1.jsx(b$0,{chatDocked:Z,sketch:Q}),q1.jsx("div",{inert:H?void 0:!0,className:s("absolute inset-0",X==="building"&&"pointer-events-none opacity-50",X==="waiting"&&"invisible"),children:q1.jsx(sH,{...Q.layerProps,children:H&&q1.jsx(ZY,{controls:Q.controls,title:"Sketch the view",busy:Q.continuing,onComplete:()=>void Q.continueInChat()})})}),q1.jsx("div",{"aria-hidden":!0,className:s("pointer-events-none absolute inset-0 transition-shadow duration-500 ease-in-out",X==="building"&&"animate-glow texture-inset-shadow-50% motion-reduce:animate-none")}),X==="building"&&q1.jsx(h$0,{}),X==="waiting"&&q1.jsx(x$0,{error:J,onDiscard:z,onOpenChat:G})]})}function b$0({chatDocked:$,sketch:Z}){let{hasStrokes:J}=eH(Z.controls);return q1.jsx("div",{ref:Z.targetRef,className:"absolute inset-0 flex items-center justify-center texture-checker-20",children:!Z.controls.active&&!J&&q1.jsxs("div",{className:s("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:[q1.jsx(EQ,{size:56,stroke:0.5}),q1.jsx("span",{className:"max-w-32",children:"Sketch how the view should look"})]})})}function x$0({error:$,onDiscard:Z,onOpenChat:J}){return q1.jsx(Im,{children:q1.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:[q1.jsxs("div",{className:"flex flex-col gap-1",children:[q1.jsx("h1",{className:"font-medium",children:"The view needs your attention"}),q1.jsx("p",{className:"text-sm text-muted-foreground",children:$??"Open the chat to answer or ask the agent to continue"})]}),q1.jsxs("div",{className:"flex gap-2",children:[q1.jsx(k0,{onClick:J,children:"Open chat"}),q1.jsx(k0,{variant:"secondary",onClick:Z,children:"Discard view"})]})]})})}function h$0(){return q1.jsx(Im,{})}function Im({children:$,className:Z}){return q1.jsx("div",{className:s("relative flex min-h-0 flex-1 items-center justify-center texture-checker-20",Z),children:$})}var A4=P(v(),1);function Rm($,{activeId:Z,available:J,now:Q}){let X=[];if(Z!==null&&J.has(Z))X.push({id:Z,releasedAt:null});for(let z of $){if(z.id===Z||!J.has(z.id))continue;let G=z.releasedAt??Q;if(Q-G>=60000)continue;if(X.length>=4)break;X.push({id:z.id,releasedAt:G})}return X}function ym($,Z){let J=null;for(let{releasedAt:Q}of $){if(Q===null)continue;let X=Q+60000;if(J===null||X<J)J=X}return J===null?null:Math.max(0,J-Z)}function bm($,Z){return $.length===Z.length&&$.every((J,Q)=>{let X=Z[Q];return J.id===X.id&&J.releasedAt===X.releasedAt})}var P8=P(d(),1);function hm({views:$,activeViewId:Z,params:J}){let Q=g$0(Z,$),X=new Set(Q.map((z)=>z.id));return P8.jsx("div",{className:s("relative min-h-0 flex-1 overflow-hidden",!Z&&"hidden"),children:$.filter((z)=>X.has(z.id)).map((z)=>P8.jsx(v$0,{view:z,active:z.id===Z,params:J},z.id))})}function g$0($,Z){let[J,Q]=A4.useState([]),X=A4.useRef(Z);X.current=Z;let z=Z.map((H)=>H.id).join(`
81
+ `),G=A4.useCallback(()=>{Q((H)=>{let Y=Rm(H,{activeId:$,available:new Set(X.current.map((K)=>K.id)),now:Date.now()});return bm(H,Y)?H:Y})},[$]);return A4.useEffect(()=>{G()},[z,G]),A4.useEffect(()=>{let H=ym(J,Date.now());if(H===null)return;let Y=setTimeout(G,H);return()=>clearTimeout(Y)},[G,J]),J}function v$0({view:$,active:Z,params:J}){let Q=J1(),X=IT($.id),{current:z,outgoing:G}=m$0(X,Z),[H,Y]=A4.useState(J);if(Z&&H!==J)Y(J);_W(rH("views",Q,$.id),z?.version??X.version,Z);let K=X.status==="error";return P8.jsxs(P8.Fragment,{children:[Z&&K&&P8.jsx("p",{className:"absolute inset-0 p-4 text-xs text-destructive",children:X.error}),Z&&!K&&!z&&P8.jsx(p$0,{}),z&&!K&&P8.jsxs(A4.Activity,{mode:Z?"visible":"hidden",children:[G&&P8.jsx(xm,{view:$,build:G,params:H},G.version),P8.jsx(xm,{view:$,build:z,params:H,entering:G!==null},z.version)]})]})}function xm({view:$,build:Z,params:J,entering:Q}){let X=J1();return P8.jsx("div",{"data-applet":aH("views",$.id),className:s("absolute inset-0 overflow-auto",Q&&"animate-in duration-200 ease-out blur-in-4 fade-in"),children:P8.jsx(KX,{name:$.id,kind:"view",workspaceId:X,resetKey:Z.version,children:P8.jsx(Z.Component,{params:J})})})}var f$0=200;function m$0($,Z){let[J,Q]=A4.useState({current:null,outgoing:null});if($.status==="ready"&&J.current?.version!==$.version){let X={Component:$.Component,version:$.version};Q((z)=>({current:X,outgoing:Z?z.current:null}))}return A4.useEffect(()=>{if(!J.outgoing)return;let X=setTimeout(()=>Q((z)=>({...z,outgoing:null})),f$0);return()=>clearTimeout(X)},[J.outgoing]),J}function p$0(){return P8.jsx("div",{className:"absolute inset-0 flex animate-in items-center justify-center delay-150 duration-200 fill-mode-both fade-in",children:P8.jsx(E9,{className:"text-muted-foreground"})})}function gm(){let $=o0(),{workspaceId:Z,layout:J}=n5(),[,Q]=a7(),X=X9(Z).data,z=Vm(Z),G=Lm(Z),H=Mm(Z),Y=Am(Z);return{create:()=>z.mutateAsync(),save:(U,F)=>G.mutateAsync({builderId:U,requirements:F}),submit:async(U,F)=>{let N=F.trim(),L=sW(Z,U.sessionId);if(!N&&L.length===0)return;$B({queryClient:$,workspaceId:Z,sessionId:U.sessionId,text:N,filenames:L.map((E)=>E.name)});let V=tW(L);if(N)V.push({type:"text",text:N});let M=eW({queryClient:$,workspaceId:Z,sessionId:U.sessionId,parts:V});Q(U.sessionId);let{model:_,effort:O,fastMode:D,stream:A}=ZB(X,J.selectedModel,J.selectedEffort,J.selectedFastMode);try{await H.mutateAsync({builderId:U.id,requirements:N,optimisticId:M,...L.length>0?{attachments:L.map((E)=>E.upload.id)}:{},model:_,effort:O,fastMode:D,stream:A}),P5.getState().clearAttachments(Z,U.sessionId)}catch(E){throw P5.getState().setActivity(Z,U.sessionId,"idle"),P5.getState().setError(Z,U.sessionId,E instanceof Error?E.message:"Could not start view builder"),E}},discard:(U)=>Y.mutateAsync(U)}}var N9=P(v(),1);function vm({builders:$,onSave:Z}){let J=N9.useRef(new Map),Q=N9.useRef($),X=N9.useRef(Z);Q.current=$,X.current=Z;let z=N9.useCallback((H)=>{let Y=J.current.get(H);if(Y)clearTimeout(Y);J.current.delete(H),D1.getState().setViewBuilderDraft(H,null)},[]),G=N9.useCallback((H,Y)=>{D1.getState().setViewBuilderDraft(H,Y);let K=J.current.get(H);if(K)clearTimeout(K);J.current.set(H,setTimeout(()=>{J.current.delete(H);let W=Q.current.find((B)=>B.id===H);if(!W||W.status!=="draft")return;X.current(H,Y).catch(()=>{c4.add({title:"Couldn’t save view description",type:"error"})})},500))},[]);return N9.useEffect(()=>{for(let H of $)if(H.status!=="draft")z(H.id)},[$,z]),N9.useEffect(()=>()=>{for(let H of J.current.values())clearTimeout(H)},[]),{change:G,clear:z}}var yZ=P(v(),1);function HM($){let Z=document.documentElement,J=getComputedStyle(Z).getPropertyValue($).trim(),Q=Number.parseFloat(J);if(!Number.isFinite(Q))return 0;return J.endsWith("rem")?Q*Number.parseFloat(getComputedStyle(Z).fontSize):Q}function fm(){let $=yZ.useRef(null),[Z,J]=yZ.useState(null);return yZ.useLayoutEffect(()=>{let Q=$.current;if(!Q)return;let X=(G)=>{let H=HM("--column-w"),Y=HM("--chat-min"),K=HM("--chat-max"),W={fits:G-Y>=H,workspaceMinWidth:H,chatMinWidth:Y,chatMaxWidth:K};J((B)=>B?.fits===W.fits&&B.workspaceMinWidth===W.workspaceMinWidth&&B.chatMinWidth===W.chatMinWidth&&B.chatMaxWidth===W.chatMaxWidth?B:W)};X(Q.getBoundingClientRect().width);let z=()=>X(Q.getBoundingClientRect().width);return window.addEventListener("resize",z),()=>window.removeEventListener("resize",z)},[]),{ref:$,fits:Z?.fits??!1,constraints:Z?{workspaceMinWidth:Z.workspaceMinWidth,chatMinWidth:Z.chatMinWidth,chatMaxWidth:Z.chatMaxWidth}:null}}var mm=P(d(),1);function YM({agentUnavailable:$,chatError:Z,skillUpdate:J}){return $??Z??J}function L7({className:$,...Z}){return mm.jsx("div",{...Z,className:s("w-full p-2 text-sm @xl:p-1 @xl:pl-3",$)})}var bZ=P(d(),1);function pm({error:$,onDismiss:Z}){return bZ.jsxs(L7,{role:"alert",className:"flex items-center gap-2 text-destructive",children:[bZ.jsx("span",{className:"flex-1 wrap-break-word",children:$}),bZ.jsx(k0,{type:"button",variant:"ghost",size:"icon-sm",onClick:Z,className:"text-destructive hover:text-destructive","aria-label":"Dismiss error",children:bZ.jsx(m1,{stroke:1.75})})]})}var SX=P(v(),1);var p9=P(d(),1);function cm({availability:$,login:Z,onStartLogin:J}){let[Q,X]=SX.useState("idle"),[z,G]=SX.useState(null);SX.useEffect(()=>{if(Z?.state!=="pending")X("idle")},[Z?.state]);let H=Z?.state==="pending"||Q==="waiting",Y=Z?.state==="failed"?Z.reason:null,K=H||Q==="starting",W=async()=>{let B=window.open("about:blank","moi-agent-login");if(B)B.opener=null;X("starting"),G(null);try{let q=await J();if(q.url){if(!B)throw Error("Allow pop-ups, then try again");B.location.href=q.url}else B?.close();X("waiting")}catch(q){B?.close(),X("idle"),G(q instanceof Error?q.message:"Could not start sign-in")}};return p9.jsxs(L7,{role:"alert",className:"flex items-center gap-2",children:[p9.jsx(um,{size:20,stroke:1.5}),p9.jsxs("div",{className:"min-w-0 flex-1 space-y-1",children:[p9.jsx("div",{className:"wrap-break-word",children:"Log in to your agent to send messages"}),(z??Y)&&p9.jsx("div",{className:"wrap-break-word text-destructive",children:z??Y})]}),$.loginCommand&&p9.jsxs(k0,{type:"button",size:"sm",onClick:()=>void W(),disabled:K,children:[K&&p9.jsx(T1,{stroke:1.75,className:"animate-spin"}),Q==="starting"?"Opening browser to sign in…":H?"Waiting for log in…":"Log in"]})]})}var w8=P(d(),1);function lm({error:$,pendingAction:Z,onUpdate:J,onDismiss:Q}){if(!$&&Z==="auto")return w8.jsxs(L7,{role:"status",className:"flex items-center gap-1.5 text-muted-foreground",children:[w8.jsx(T1,{size:20,stroke:1.5,className:"shrink-0 animate-spin"}),w8.jsx("span",{className:"wrap-break-word",children:"Updating moi skills…"})]});let X=Z!==null;return w8.jsxs(L7,{role:$?"alert":"status",className:s("grid grid-cols-[minmax(0,1fr)_auto] gap-x-2 gap-y-2","@xl:flex @xl:items-center",$&&"text-destructive"),children:[w8.jsxs("div",{className:"flex min-w-0 items-start gap-1.5 @xl:order-1 @xl:flex-1 @xl:items-center",children:[w8.jsx(dm,{size:20,stroke:1.5,className:"shrink-0"}),$?w8.jsx("span",{className:"wrap-break-word",children:`Update failed: ${$}`}):w8.jsx("span",{className:"wrap-break-word",children:"This workspace is using old moi skills"})]}),w8.jsx(k0,{type:"button",variant:"ghost",size:"icon-sm",onClick:Q,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:w8.jsx(m1,{stroke:1.75})}),w8.jsxs("div",{className:"col-span-2 flex flex-wrap gap-1.5 @xl:contents",children:[w8.jsxs(k0,{type:"button",variant:"default",size:"sm",onClick:()=>J("auto"),disabled:X,className:"@xl:order-2",children:[Z==="auto"&&w8.jsx(T1,{stroke:1.75,className:"animate-spin"}),Z==="auto"?"Updating…":"Auto-update"]}),w8.jsxs(k0,{type:"button",variant:"secondary",size:"sm",onClick:()=>J("once"),disabled:X,className:"@xl:order-3",children:[Z==="once"&&w8.jsx(T1,{stroke:1.75,className:"animate-spin"}),Z==="once"?"Updating…":"Update once"]})]})]})}var s6=P(v(),1);function KM($){return{workspaceId:$,phase:"idle",pendingAction:null,error:null}}function u$0($){return $.phase==="active"||$.phase==="idle"&&$.updateAvailable&&!$.autoUpdateEnabled}function c$0($){return $.updateAvailable&&$.autoUpdateEnabled&&!$.updatePending&&$.phase==="idle"}function im($){let Z=xT($),{isPending:J,mutate:Q,reset:X}=hT($),z=Zv(),{mutate:G}=Jv(),H=z.data!==void 0,Y=z.data?.autoUpdateSkills??!1,K=s6.useCallback(()=>G({autoUpdateSkills:!0}),[G]),[W,B]=s6.useState(()=>KM($)),q=W.workspaceId===$?W:KM($);s6.useEffect(()=>{B(KM($)),X()},[$,X]);let U=s6.useCallback((L)=>{if(J)return;if(L==="auto")K();B({workspaceId:$,phase:"active",pendingAction:L,error:null}),Q(void 0,{onSuccess:()=>{B((V)=>V.workspaceId===$?{...V,phase:"dismissed",pendingAction:null,error:null}:V)},onError:(V)=>{B((M)=>M.workspaceId===$&&M.phase!=="dismissed"?{...M,phase:"active",pendingAction:null,error:V.message}:M)}})},[K,J,Q,$]),F=Z.data?.updateAvailable??!1;return s6.useEffect(()=>{if(H&&c$0({updateAvailable:F,autoUpdateEnabled:Y,updatePending:J,phase:q.phase}))U("auto")},[Y,q.phase,U,H,F,J]),{bannerProps:H&&u$0({updateAvailable:F,autoUpdateEnabled:Y,phase:q.phase})?{error:q.error,pendingAction:q.pendingAction,onUpdate:U,onDismiss:()=>{B((L)=>L.workspaceId===$?{...L,phase:"dismissed",pendingAction:null,error:null}:L)}}:null}}var JB=P(d(),1);function rm($,{chatError:Z,onDismissChatError:J}){let{data:Q,error:X}=X9($),z=Q?.availability,{bannerProps:G}=im($),H=z?.available===!1?z:void 0;if(X)H={available:!1,reason:`Could not check agent status: ${X.message}`};let Y={status:"checking"};if(H)Y={status:"unavailable"};else if(z)Y={status:"available"};let K=H?{tone:"default",content:JB.jsx(cm,{availability:H,login:Q?.login,onStartLogin:()=>bT($)})}:void 0,W=Z?{tone:"error",content:JB.jsx(pm,{error:Z,onDismiss:J})}:void 0,B=G?{tone:"default",content:JB.jsx(lm,{...G})}:void 0,q=YM({agentUnavailable:K,chatError:W,skillUpdate:B}),U=YM({agentUnavailable:K,skillUpdate:B});return{composerAvailability:Y,composerBanner:q,builderComposerBanner:U}}var WM=YF();function QB($){if(!$||!Array.isArray($.open))return WM;let Z=$.open.filter((J,Q,X)=>X.indexOf(J)===Q);if(Z.length===0)return WM;return{open:Z,active:Z.includes($.active)?$.active:Z[0]}}function kX($,Z,J){if($==="agent"||$==="widgets"||$==="scratchpad")return!0;let Q=i3($);if(Q)return J.some((z)=>z.id===Q);let X=_6($);return X?Z.some((z)=>z.id===X):!1}function XB($,Z,J){let Q=$.open.filter((X)=>kX(X,Z,J));return Q.length>0?Q:WM.open}function am($){if(!$)return!1;let Z=VQ($);return Z===null||_6(Z)!==null}function nm($,Z,J,Q,X){if($!==null&&kX($,J,Q)&&!(X&&$==="agent"))return $;let z=XB(Z,J,Q),G=X?z.filter((H)=>H!=="agent"):z;return G.includes(Z.active)?Z.active:G[0]??"agent"}var V9=P(v(),1);function om({views:$,builders:Z,split:J}){let{layout:Q,setLayout:X,workspaceId:z}=n5(),[,G]=g4(),H=RB()["*"]??null,Y=BA(),K=V9.useMemo(()=>DT(Y),[Y]),W=QB(Q.tabs),B=V9.useRef(W);B.current=W;let q=VQ(H),U=nm(q,W,$,Z,J),F=q!==null&&q===U,N=V9.useCallback((V,M)=>{G(_T(z,V),{replace:!0,...M?{state:{appletParams:M}}:{}})},[G,z]),L=V9.useCallback((V)=>{B.current=V,X({tabs:V})},[X]);return V9.useEffect(()=>{if(H===U)return;if(am(H))d$0(z,H,U);N(U)},[U,N,H,z]),V9.useEffect(()=>{if(!F)return;let V=B.current,M=V.open.includes(U)?V.open:[...V.open,U];if(M===V.open&&V.active===U)return;L({open:M,active:U})},[U,L,F]),{tabsState:W,activeTab:U,appletParams:K,navigateToTab:N,setTabs:L}}function d$0($,Z,J){let Q=VQ(Z),X=Q?_6(Q):null;F2($,{source:"runtime",...X?{kind:"view",name:X}:{},message:`Tab "${Z}" does not exist in this workspace — the URL redirected to "${J}". A link, bookmark, or focusTab call is pointing at a tab that was deleted or renamed.`})}var Q1=P(d(),1),l$0=tm([oJ({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 i$0({items:$}){return Q1.jsxs(g$,{children:[Q1.jsx(v$,{render:Q1.jsx(k0,{type:"button",variant:"ghost",size:"icon-sm",className:"text-muted-foreground","aria-label":"Create tab",children:Q1.jsx(K4,{stroke:1.75})})}),Q1.jsx(f$,{align:"start",className:"min-w-48",children:Q1.jsx(m$,{children:$.map(({key:Z,Icon:J,label:Q,onClick:X})=>Q1.jsxs(OQ,{onClick:X,className:"font-medium",children:[Q1.jsx(J,{stroke:2}),Q]},Z))})})]})}function sm($){let{tab:Z,active:J}=$,Q=$.preview===!0;return Q1.jsxs("button",{type:"button","aria-hidden":Q||void 0,"aria-label":Z.label,disabled:Q,tabIndex:Q?-1:void 0,onClick:$.preview?void 0:()=>$.onSelect(Z.key),className:l$0({active:J,dragging:$.preview?!1:$.state.isDragging,preview:Q}),...$.preview?{}:$.state.dragHandleProps,children:[Q1.jsxs("div",{className:s("flex items-center gap-1 overflow-hidden select-none",Z.closable&&"group-hover/tab:mr-3"),children:[Z.Icon===O6?Q1.jsx(O6,{"data-icon":"inline-start",stroke:2,animated:Z.loading}):Z.loading?Q1.jsx(E9,{"data-icon":"inline-start"}):Q1.jsx(Z.Icon,{"data-icon":"inline-start",stroke:2}),Q1.jsx("span",{className:s("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&&Q1.jsx("div",{"aria-label":`Close ${Z.label}`,tabIndex:Q?-1:void 0,className:s("absolute right-2 hidden size-3 items-center justify-center text-muted-foreground group-hover/tab:flex hover:text-foreground",Q&&"pointer-events-none"),onClick:$.preview?void 0:(X)=>{X.stopPropagation(),$.onClose(Z.key)},children:Q1.jsx(m1,{stroke:1.75})})]})}function em({tabs:$,active:Z,createItems:J,onSelect:Q,onClose:X,onReorder:z}){return Q1.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-1",children:[Q1.jsx("div",{className:"no-scrollbar min-w-0 scroll-fade-x overflow-x-auto overflow-y-hidden [--scroll-fade-reveal:16px]",children:Q1.jsx(iG,{items:$,getId:(G)=>G.key,className:"flex w-max items-center gap-1",onReorder:(G)=>z(G),renderPlaceholder:()=>Q1.jsx("div",{className:"pointer-events-none absolute inset-0 rounded-md bg-muted"}),renderOverlay:(G)=>Q1.jsx(sm,{tab:G,active:Z===G.key,preview:!0}),renderItem:(G,H)=>Q1.jsx(sm,{tab:G,active:Z===G.key,state:H,onSelect:Q,onClose:X})})}),Q1.jsx("div",{className:"shrink-0",children:Q1.jsx(i$0,{items:J})})]})}var $3=P(v(),1);var fZ=P(d(),1),q5=P(v(),1);function r$0($,Z){let J=getComputedStyle($),Q=parseFloat(J.fontSize);return Z*Q}function a$0($,Z){let J=getComputedStyle($.ownerDocument.documentElement),Q=parseFloat(J.fontSize);return Z*Q}function n$0($){return $/100*window.innerHeight}function o$0($){return $/100*window.innerWidth}function s$0($){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 IX({groupSize:$,panelElement:Z,styleProp:J}){let Q,[X,z]=s$0(J);switch(z){case"%":{Q=X/100*$;break}case"px":{Q=X;break}case"rem":{Q=a$0(Z,X);break}case"em":{Q=r$0(Z,X);break}case"vh":{Q=n$0(X);break}case"vw":{Q=o$0(X);break}}return Q}function Q4($){return parseFloat($.toFixed(3))}function mZ({group:$}){let{orientation:Z,panels:J}=$;return J.reduce((Q,X)=>(Q+=Z==="horizontal"?X.element.offsetWidth:X.element.offsetHeight,Q),0)}function qM($){let{panels:Z}=$,J=mZ({group:$});return J===0?Z.map((Q)=>({groupResizeBehavior:Q.panelConstraints.groupResizeBehavior,collapsedSize:0,collapsible:Q.panelConstraints.collapsible===!0,defaultSize:void 0,disabled:Q.panelConstraints.disabled,minSize:0,maxSize:100,panelId:Q.id})):Z.map((Q)=>{let{element:X,panelConstraints:z}=Q,G=0;if(z.collapsedSize!==void 0){let W=IX({groupSize:J,panelElement:X,styleProp:z.collapsedSize});G=Q4(W/J*100)}let H;if(z.defaultSize!==void 0){let W=IX({groupSize:J,panelElement:X,styleProp:z.defaultSize});H=Q4(W/J*100)}let Y=0;if(z.minSize!==void 0){let W=IX({groupSize:J,panelElement:X,styleProp:z.minSize});Y=Q4(W/J*100)}let K=100;if(z.maxSize!==void 0){let W=IX({groupSize:J,panelElement:X,styleProp:z.maxSize});K=Q4(W/J*100)}return{groupResizeBehavior:z.groupResizeBehavior,collapsedSize:G,collapsible:z.collapsible===!0,defaultSize:H,disabled:z.disabled,minSize:Y,maxSize:K,panelId:Q.id}})}function s5($,Z="Assertion error"){if(!$)throw Error(Z)}function UM($,Z){return Array.from(Z).sort($==="horizontal"?t$0:e$0)}function t$0($,Z){let J=$.element.offsetLeft-Z.element.offsetLeft;return J!==0?J:$.element.offsetWidth-Z.element.offsetWidth}function e$0($,Z){let J=$.element.offsetTop-Z.element.offsetTop;return J!==0?J:$.element.offsetHeight-Z.element.offsetHeight}function Lp($){return $!==null&&typeof $=="object"&&"nodeType"in $&&$.nodeType===Node.ELEMENT_NODE}function Mp($,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 $Z0({orientation:$,rects:Z,targetRect:J}){let Q={x:J.x+J.width/2,y:J.y+J.height/2},X,z=Number.MAX_VALUE;for(let G of Z){let{x:H,y:Y}=Mp(Q,G),K=$==="horizontal"?H:Y;K<z&&(z=K,X=G)}return s5(X,"No rect found"),X}var zB;function ZZ0(){return zB===void 0&&(typeof matchMedia=="function"?zB=!!matchMedia("(pointer:coarse)").matches:zB=!1),zB}function Ap($){let{element:Z,orientation:J,panels:Q,separators:X}=$,z=UM(J,Array.from(Z.children).filter(Lp).map((F)=>({element:F}))).map(({element:F})=>F),G=[],H=!1,Y=!1,K=-1,W=-1,B=0,q,U=[];{let F=-1;for(let N of z)N.hasAttribute("data-panel")&&(F++,N.hasAttribute("data-disabled")||(B++,K===-1&&(K=F),W=F))}if(B>1){let F=-1;for(let N of z)if(N.hasAttribute("data-panel")){F++;let L=Q.find((V)=>V.element===N);if(L){if(q){let V=q.element.getBoundingClientRect(),M=N.getBoundingClientRect(),_;if(Y){let O=J==="horizontal"?new DOMRect(V.right,V.top,0,V.height):new DOMRect(V.left,V.bottom,V.width,0),D=J==="horizontal"?new DOMRect(M.left,M.top,0,M.height):new DOMRect(M.left,M.top,M.width,0);switch(U.length){case 0:{_=[O,D];break}case 1:{let A=U[0],E=$Z0({orientation:J,rects:[V,M],targetRect:A.element.getBoundingClientRect()});_=[A,E===V?D:O];break}default:{_=U;break}}}else U.length?_=U:_=[J==="horizontal"?new DOMRect(V.right,M.top,M.left-V.right,M.height):new DOMRect(M.left,V.bottom,M.width,M.top-V.bottom)];for(let O of _){let D="width"in O?O:O.element.getBoundingClientRect(),A=ZZ0()?$.resizeTargetMinimumSize.coarse:$.resizeTargetMinimumSize.fine;if(D.width<A){let I=A-D.width;D=new DOMRect(D.x-I/2,D.y,D.width+I,D.height)}if(D.height<A){let I=A-D.height;D=new DOMRect(D.x,D.y-I/2,D.width,D.height+I)}let E=F<=K||F>W;!H&&!E&&G.push({group:$,groupSize:mZ({group:$}),panels:[q,L],separator:"width"in O?void 0:O,rect:D}),H=!1}}Y=!1,q=L,U=[]}}else if(N.hasAttribute("data-separator")){N.ariaDisabled!==null&&(H=!0);let L=X.find((V)=>V.element===N);L?U.push(L):(q=void 0,U=[])}else Y=!0}return G}class FM{#$={};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 Q=!1,X=null,z=Array.from(J);for(let G=0;G<z.length;G++){let H=z[G];try{H.call(null,Z)}catch(Y){X===null&&(Q=!0,X=Y)}}if(Q)throw X}}removeAllListeners(){this.#$={}}removeListener($,Z){let J=this.#$[$];if(J!==void 0){let Q=J.indexOf(Z);Q>=0&&J.splice(Q,1)}}}var gZ={cursorFlags:0,state:"inactive"},NM=new FM;function A7(){return gZ}function JZ0($){return NM.addListener("change",$)}function QZ0($){let Z=gZ,J={...gZ};J.cursorFlags=$,gZ=J,NM.emit("change",{prev:Z,next:J})}function vZ($){let Z=gZ;gZ=$,NM.emit("change",{prev:Z,next:$})}var XZ0=($)=>$,BM=()=>{},_p=1,Dp=2,Op=4,Pp=8,$p=3,Zp=12,GB;function Jp(){return GB===void 0&&(GB=!1,typeof window<"u"&&(window.navigator.userAgent.includes("Chrome")||window.navigator.userAgent.includes("Firefox"))&&(GB=!0)),GB}function zZ0({cursorFlags:$,groups:Z,state:J}){let Q=0,X=0;switch(J){case"active":case"hover":Z.forEach((z)=>{if(!z.mutableState.disableCursor)switch(z.orientation){case"horizontal":{Q++;break}case"vertical":{X++;break}}})}if(!(Q===0&&X===0)){switch(J){case"active":{if($&&Jp()){let z=($&_p)!==0,G=($&Dp)!==0,H=($&Op)!==0,Y=($&Pp)!==0;if(z)return H?"se-resize":Y?"ne-resize":"e-resize";if(G)return H?"sw-resize":Y?"nw-resize":"w-resize";if(H)return"s-resize";if(Y)return"n-resize"}break}}return Jp()?Q>0&&X>0?"move":Q>0?"ew-resize":"ns-resize":Q>0&&X>0?"grab":Q>0?"col-resize":"row-resize"}}var Qp=new WeakMap;function VM($){if($.defaultView===null||$.defaultView===void 0)return;let{prevStyle:Z,styleSheet:J}=Qp.get($)??{};J===void 0&&(J=new $.defaultView.CSSStyleSheet,$.adoptedStyleSheets&&(Object.isExtensible($.adoptedStyleSheets)?$.adoptedStyleSheets.push(J):$.adoptedStyleSheets=[...$.adoptedStyleSheets,J]));let Q=A7();switch(Q.state){case"active":case"hover":{let X=zZ0({cursorFlags:Q.cursorFlags,groups:Q.hitRegions.map((G)=>G.group),state:Q.state}),z=`*, *:hover {cursor: ${X} !important; }`;if(Z===z)return;Z=z,X?J.cssRules.length===0?J.insertRule(z):J.replaceSync(z):J.cssRules.length===1&&J.deleteRule(0);break}case"inactive":{Z=void 0,J.cssRules.length===1&&J.deleteRule(0);break}}Qp.set($,{prevStyle:Z,styleSheet:J})}var M9=new Map,wp=new FM;function GZ0($){M9=new Map(M9),M9.delete($)}function Xp($,Z){for(let[J]of M9)if(J.id===$)return J}function t6($,Z){for(let[J,Q]of M9)if(J.id===$)return Q;if(Z)throw Error(`Could not find data for Group with id ${$}`)}function O7(){return M9}function LM($,Z){return wp.addListener("groupChange",(J)=>{J.group.id===$&&Z(J)})}function u9($,Z,J){let Q=M9.get($);M9=new Map(M9),M9.set($,Z),wp.emit("groupChange",{group:$,isUserInteraction:J?.isUserInteraction===!0,prev:Q,next:Z})}function jp($){let Z=A7(),J=!1;switch(Z.state){case"active":vZ({cursorFlags:0,state:"inactive"}),Z.hitRegions.length>0&&(VM($),J=!0,Z.hitRegions.forEach((Q)=>{let X=t6(Q.group.id,!0);u9(Q.group,X,{isUserInteraction:!0})}))}return J}function zp($){$.defaultPrevented||jp($.currentTarget)}function HZ0($,Z,J){let Q,X={x:1/0,y:1/0};for(let z of Z){let G=Mp(J,z.rect);switch($){case"horizontal":{G.x<=X.x&&(Q=z,X=G);break}case"vertical":{G.y<=X.y&&(Q=z,X=G);break}}}return Q?{distance:X,hitRegion:Q}:void 0}function YZ0($){return $!==null&&typeof $=="object"&&"nodeType"in $&&$.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function KZ0($,Z){if($===Z)throw Error("Cannot compare node with itself");let J={a:Yp($),b:Yp(Z)},Q;for(;J.a.at(-1)===J.b.at(-1);)Q=J.a.pop(),J.b.pop();s5(Q,"Stacking order can only be calculated for elements with a common ancestor");let X={a:Hp(Gp(J.a)),b:Hp(Gp(J.b))};if(X.a===X.b){let z=Q.childNodes,G={a:J.a.at(-1),b:J.b.at(-1)},H=z.length;for(;H--;){let Y=z[H];if(Y===G.a)return 1;if(Y===G.b)return-1}}return Math.sign(X.a-X.b)}var WZ0=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function BZ0($){let Z=getComputedStyle(Tp($)??$).display;return Z==="flex"||Z==="inline-flex"}function qZ0($){let Z=getComputedStyle($);return!!(Z.position==="fixed"||Z.zIndex!=="auto"&&(Z.position!=="static"||BZ0($))||+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"||WZ0.test(Z.willChange)||Z.webkitOverflowScrolling==="touch")}function Gp($){let Z=$.length;for(;Z--;){let J=$[Z];if(s5(J,"Missing node"),qZ0(J))return J}return null}function Hp($){return $&&Number(getComputedStyle($).zIndex)||0}function Yp($){let Z=[];for(;$;)Z.push($),$=Tp($);return Z}function Tp($){let{parentNode:Z}=$;return YZ0(Z)?Z.host:Z}function UZ0($,Z){return $.x<Z.x+Z.width&&$.x+$.width>Z.x&&$.y<Z.y+Z.height&&$.y+$.height>Z.y}function FZ0({groupElement:$,hitRegion:Z,pointerEventTarget:J}){if(!Lp(J)||J.contains($)||$.contains(J))return!0;if(KZ0(J,$)>0){let Q=J;for(;Q;){if(Q.contains($))return!0;if(UZ0(Q.getBoundingClientRect(),Z))return!1;Q=Q.parentElement}}return!0}function MM($,Z){let J=[];return Z.forEach((Q,X)=>{if(X.disabled)return;let z=Ap(X),G=HZ0(X.orientation,z,{x:$.clientX,y:$.clientY});G&&G.distance.x<=0&&G.distance.y<=0&&FZ0({groupElement:X.element,hitRegion:G.hitRegion.rect,pointerEventTarget:$.target})&&J.push(G.hitRegion)}),J}function NZ0($,Z){if($.length!==Z.length)return!1;for(let J=0;J<$.length;J++)if($[J]!=Z[J])return!1;return!0}function c8($,Z,J=0){return Math.abs(Q4($)-Q4(Z))<=J}function L9($,Z){return c8($,Z)?0:$>Z?1:-1}function hZ({overrideDisabledPanels:$,panelConstraints:Z,prevSize:J,size:Q}){let{collapsedSize:X=0,collapsible:z,disabled:G,maxSize:H=100,minSize:Y=0}=Z;if(G&&!$)return J;if(L9(Q,Y)<0)if(z){let K=(X+Y)/2;L9(Q,K)<0?Q=X:Q=Y}else Q=Y;return Q=Math.min(H,Q),Q=Q4(Q),Q}function yX({delta:$,initialLayout:Z,panelConstraints:J,pivotIndices:Q,prevLayout:X,trigger:z}){if(c8($,0))return Z;let G=z==="imperative-api",H=Object.values(Z),Y=Object.values(X),K=[...H],[W,B]=Q;s5(W!=null,"Invalid first pivot index"),s5(B!=null,"Invalid second pivot index");let q=0;switch(z){case"keyboard":{{let N=$<0?B:W,L=J[N];s5(L,`Panel constraints not found for index ${N}`);let{collapsedSize:V=0,collapsible:M,minSize:_=0}=L;if(M){let O=H[N];if(s5(O!=null,`Previous layout not found for panel index ${N}`),c8(O,V)){let D=_-O;L9(D,Math.abs($))>0&&($=$<0?0-D:D)}}}{let N=$<0?W:B,L=J[N];s5(L,`No panel constraints found for index ${N}`);let{collapsedSize:V=0,collapsible:M,minSize:_=0}=L;if(M){let O=H[N];if(s5(O!=null,`Previous layout not found for panel index ${N}`),c8(O,_)){let D=O-V;L9(D,Math.abs($))>0&&($=$<0?0-D:D)}}}break}default:{let N=$<0?B:W,L=J[N];s5(L,`Panel constraints not found for index ${N}`);let V=H[N],{collapsible:M,collapsedSize:_,minSize:O}=L;if(M&&L9(V,O)<0)if($>0){let D=O-_,A=D/2,E=V+$;L9(E,O)<0&&($=L9($,A)<=0?0:D)}else{let D=O-_,A=100-D/2,E=V-$;L9(E,O)<0&&($=L9(100+$,A)>0?0:-D)}break}}{let N=$<0?1:-1,L=$<0?B:W,V=0;for(;;){let _=H[L];s5(_!=null,`Previous layout not found for panel index ${L}`);let O=hZ({overrideDisabledPanels:G,panelConstraints:J[L],prevSize:_,size:100})-_;if(V+=O,L+=N,L<0||L>=J.length)break}let M=Math.min(Math.abs($),Math.abs(V));$=$<0?0-M:M}{let N=$<0?W:B;for(;N>=0&&N<J.length;){let L=Math.abs($)-Math.abs(q),V=H[N];s5(V!=null,`Previous layout not found for panel index ${N}`);let M=V-L,_=hZ({overrideDisabledPanels:G,panelConstraints:J[N],prevSize:V,size:M});if(!c8(V,_)&&(q+=V-_,K[N]=_,q.toFixed(3).localeCompare(Math.abs($).toFixed(3),void 0,{numeric:!0})>=0))break;$<0?N--:N++}}if(NZ0(Y,K))return X;{let N=$<0?B:W,L=H[N];s5(L!=null,`Previous layout not found for panel index ${N}`);let V=L+q,M=hZ({overrideDisabledPanels:G,panelConstraints:J[N],prevSize:L,size:V});if(K[N]=M,!c8(M,V)){let _=V-M,O=$<0?B:W;for(;O>=0&&O<J.length;){let D=K[O];s5(D!=null,`Previous layout not found for panel index ${O}`);let A=D+_,E=hZ({overrideDisabledPanels:G,panelConstraints:J[O],prevSize:D,size:A});if(c8(D,E)||(_-=E-D,K[O]=E),c8(_,0))break;$>0?O--:O++}}}let U=Object.values(K).reduce((N,L)=>L+N,0);if(!c8(U,100,0.1))return X;let F=Object.keys(X);return K.reduce((N,L,V)=>(N[F[V]]=L,N),{})}function _7($,Z){if(Object.keys($).length!==Object.keys(Z).length)return!1;for(let J in $)if(Z[J]===void 0||L9($[J],Z[J])!==0)return!1;return!0}function D7({layout:$,panelConstraints:Z}){let J=Object.values($),Q=[...J],X=Q.reduce((H,Y)=>H+Y,0);if(Q.length!==Z.length)throw Error(`Invalid ${Z.length} panel layout: ${Q.map((H)=>`${H}%`).join(", ")}`);if(!c8(X,100)&&Q.length>0)for(let H=0;H<Z.length;H++){let Y=Q[H];s5(Y!=null,`No layout data found for index ${H}`);let K=100/X*Y;Q[H]=K}let z=0;for(let H=0;H<Z.length;H++){let Y=J[H];s5(Y!=null,`No layout data found for index ${H}`);let K=Q[H];s5(K!=null,`No layout data found for index ${H}`);let W=hZ({overrideDisabledPanels:!0,panelConstraints:Z[H],prevSize:Y,size:K});K!=W&&(z+=K-W,Q[H]=W)}if(!c8(z,0))for(let H=0;H<Z.length;H++){let Y=Q[H];s5(Y!=null,`No layout data found for index ${H}`);let K=Y+z,W=hZ({overrideDisabledPanels:!0,panelConstraints:Z[H],prevSize:Y,size:K});if(Y!==W&&(z-=W-Y,Q[H]=W,c8(z,0)))break}let G=Object.keys($);return Q.reduce((H,Y,K)=>(H[G[K]]=Y,H),{})}function Cp({groupId:$,panelId:Z}){let J=()=>{let Y=O7();for(let[K,{defaultLayoutDeferred:W,derivedPanelConstraints:B,layout:q,groupSize:U,separatorToPanels:F}]of Y)if(K.id===$)return{defaultLayoutDeferred:W,derivedPanelConstraints:B,group:K,groupSize:U,layout:q,separatorToPanels:F};throw Error(`Group ${$} not found`)},Q=()=>{let Y=J().derivedPanelConstraints.find((K)=>K.panelId===Z);if(Y!==void 0)return Y;throw Error(`Panel constraints not found for Panel ${Z}`)},X=()=>{let Y=J().group.panels.find((K)=>K.id===Z);if(Y!==void 0)return Y;throw Error(`Layout not found for Panel ${Z}`)},z=()=>{let Y=J().layout[Z];if(Y!==void 0)return Y;throw Error(`Layout not found for Panel ${Z}`)},G=({nextSize:Y,panels:K,prevLayout:W,derivedPanelConstraints:B})=>{let q=z(),U=K.findIndex((L)=>L.id===Z),F=U===0,N=U===K.length-1;if(N&&Y<q&&(F||K.slice(0,U).every((L,V)=>{let M=B[V];return M?.collapsible&&c8(M.collapsedSize,W[M.panelId])}))){let L=K.slice(0,U).reduce((V,M)=>V+W[M.id],0);return{...W,[Z]:Q4(100-L)}}return yX({delta:N?q-Y:Y-q,initialLayout:W,panelConstraints:B,pivotIndices:N?[U-1,U]:[U,U+1],prevLayout:W,trigger:"imperative-api"})},H=(Y)=>{let K=z();if(Y===K)return;let{defaultLayoutDeferred:W,derivedPanelConstraints:B,group:q,groupSize:U,layout:F,separatorToPanels:N}=J(),L=G({nextSize:Y,panels:q.panels,prevLayout:F,derivedPanelConstraints:B}),V=D7({layout:L,panelConstraints:B});_7(F,V)||u9(q,{defaultLayoutDeferred:W,derivedPanelConstraints:B,groupSize:U,layout:V,separatorToPanels:N})};return{collapse:()=>{let{collapsible:Y,collapsedSize:K}=Q(),{mutableValues:W}=X(),B=z();Y&&B!==K&&(W.expandToSize=B,H(K))},expand:()=>{let{collapsible:Y,collapsedSize:K,minSize:W}=Q(),{mutableValues:B}=X(),q=z();if(Y&&q===K){let U=B.expandToSize??W;U===0&&(U=1),H(U)}},getSize:()=>{let{group:Y}=J(),K=z(),{element:W}=X(),B=Y.orientation==="horizontal"?W.offsetWidth:W.offsetHeight;return{asPercentage:K,inPixels:B}},isCollapsed:()=>{let{collapsible:Y,collapsedSize:K}=Q(),W=z();return Y&&c8(K,W)},resize:(Y)=>{let{group:K}=J(),{element:W}=X(),B=mZ({group:K}),q=IX({groupSize:B,panelElement:W,styleProp:Y}),U=Q4(q/B*100);H(U)}}}function Kp($){if($.defaultPrevented)return;let Z=O7();MM($,Z).forEach((J)=>{if(J.separator&&!J.separator.disableDoubleClick){let Q=J.panels.find((X)=>X.panelConstraints.defaultSize!==void 0);if(Q){let X=Q.panelConstraints.defaultSize,z=Cp({groupId:J.group.id,panelId:Q.id});z&&X!==void 0&&(z.resize(X),$.preventDefault())}}})}function HB($){let Z=O7();for(let[J]of Z)if(J.separators.some((Q)=>Q.element===$))return J;throw Error("Could not find parent Group for separator element")}function Ep({groupId:$}){let Z=()=>{let J=O7();for(let[Q,X]of J)if(Q.id===$)return{group:Q,...X};throw Error(`Could not find Group with id "${$}"`)};return{getLayout(){let{defaultLayoutDeferred:J,layout:Q}=Z();return J?{}:Q},setLayout(J){let{defaultLayoutDeferred:Q,derivedPanelConstraints:X,group:z,groupSize:G,layout:H,separatorToPanels:Y}=Z(),K=D7({layout:J,panelConstraints:X});return Q?H:(_7(H,K)||u9(z,{defaultLayoutDeferred:Q,derivedPanelConstraints:X,groupSize:G,layout:K,separatorToPanels:Y}),K)}}}function M7($,Z){let J=HB($),Q=t6(J.id,!0),X=J.separators.find((W)=>W.element===$);s5(X,"Matching separator not found");let z=Q.separatorToPanels.get(X);s5(z,"Matching panels not found");let G=z.map((W)=>J.panels.indexOf(W)),H=Ep({groupId:J.id}).getLayout(),Y=yX({delta:Z,initialLayout:H,panelConstraints:Q.derivedPanelConstraints,pivotIndices:G,prevLayout:H,trigger:"keyboard"}),K=D7({layout:Y,panelConstraints:Q.derivedPanelConstraints});_7(H,K)||u9(J,{defaultLayoutDeferred:Q.defaultLayoutDeferred,derivedPanelConstraints:Q.derivedPanelConstraints,groupSize:Q.groupSize,layout:K,separatorToPanels:Q.separatorToPanels},{isUserInteraction:!0})}function Wp($){if($.defaultPrevented)return;let Z=$.currentTarget,J=HB(Z);if(!J.disabled)switch($.key){case"ArrowDown":{$.preventDefault(),J.orientation==="vertical"&&M7(Z,5);break}case"ArrowLeft":{$.preventDefault(),J.orientation==="horizontal"&&M7(Z,-5);break}case"ArrowRight":{$.preventDefault(),J.orientation==="horizontal"&&M7(Z,5);break}case"ArrowUp":{$.preventDefault(),J.orientation==="vertical"&&M7(Z,-5);break}case"End":{$.preventDefault(),M7(Z,100);break}case"Enter":{$.preventDefault();let Q=HB(Z),X=t6(Q.id,!0),{derivedPanelConstraints:z,layout:G,separatorToPanels:H}=X,Y=Q.separators.find((q)=>q.element===Z);s5(Y,"Matching separator not found");let K=H.get(Y);s5(K,"Matching panels not found");let W=K[0],B=z.find((q)=>q.panelId===W.id);if(s5(B,"Panel metadata not found"),B.collapsible){let q=G[W.id],U=B.collapsedSize===q?Q.mutableState.expandedPanelSizes[W.id]??B.minSize:B.collapsedSize;M7(Z,U-q)}break}case"F6":{$.preventDefault();let Q=HB(Z).separators.map((G)=>G.element),X=Array.from(Q).findIndex((G)=>G===$.currentTarget);s5(X!==null,"Index not found");let z=$.shiftKey?X>0?X-1:Q.length-1:X+1<Q.length?X+1:0;Q[z].focus({preventScroll:!0});break}case"Home":{$.preventDefault(),M7(Z,-100);break}}}function Bp($){if($.defaultPrevented)return;if($.pointerType==="mouse"&&$.button>0)return;let Z=O7(),J=MM($,Z),Q=new Map,X=!1;J.forEach((z)=>{z.separator&&(X||(X=!0,z.separator.element.focus({focusVisible:!1,preventScroll:!0})));let G=Z.get(z.group);G&&Q.set(z.group,G.layout)}),vZ({cursorFlags:0,hitRegions:J,initialLayoutMap:Q,pointerDownAtPoint:{x:$.clientX,y:$.clientY},state:"active"}),J.length&&$.preventDefault()}function Sp({document:$,event:Z,hitRegions:J,initialLayoutMap:Q,mountedGroups:X,pointerDownAtPoint:z,prevCursorFlags:G}){let H=0;J.forEach((K)=>{let{group:W,groupSize:B}=K,{orientation:q,panels:U}=W,{disableCursor:F}=W.mutableState,N=0;z?q==="horizontal"?N=(Z.clientX-z.x)/B*100:N=(Z.clientY-z.y)/B*100:q==="horizontal"?N=Z.clientX<0?-100:100:N=Z.clientY<0?-100:100;let L=Q.get(W),V=X.get(W);if(!L||!V)return;let{defaultLayoutDeferred:M,derivedPanelConstraints:_,groupSize:O,layout:D,separatorToPanels:A}=V;if(_&&D&&A){let E=yX({delta:N,initialLayout:L,panelConstraints:_,pivotIndices:K.panels.map((I)=>U.indexOf(I)),prevLayout:D,trigger:"mouse-or-touch"});if(_7(E,D)){if(N!==0&&!F)switch(q){case"horizontal":{H|=N<0?_p:Dp;break}case"vertical":{H|=N<0?Op:Pp;break}}}else u9(K.group,{defaultLayoutDeferred:M,derivedPanelConstraints:_,groupSize:O,layout:E,separatorToPanels:A})}});let Y=0;Z.movementX===0?Y|=G&$p:Y|=H&$p,Z.movementY===0?Y|=G&Zp:Y|=H&Zp,QZ0(Y),VM($)}function qp($){let Z=O7(),J=A7();switch(J.state){case"active":Sp({document:$.currentTarget,event:$,hitRegions:J.hitRegions,initialLayoutMap:J.initialLayoutMap,mountedGroups:Z,prevCursorFlags:J.cursorFlags})}}function Up($){if($.defaultPrevented)return;let Z=A7(),J=O7();switch(Z.state){case"active":{if($.buttons===0){vZ({cursorFlags:0,state:"inactive"}),Z.hitRegions.forEach((Q)=>{let X=t6(Q.group.id,!0);u9(Q.group,X,{isUserInteraction:!0})});return}for(let Q of Z.hitRegions)if(Q.separator){let{element:X}=Q.separator;X.hasPointerCapture?.($.pointerId)||X.setPointerCapture?.($.pointerId)}Sp({document:$.currentTarget,event:$,hitRegions:Z.hitRegions,initialLayoutMap:Z.initialLayoutMap,mountedGroups:J,pointerDownAtPoint:Z.pointerDownAtPoint,prevCursorFlags:Z.cursorFlags});break}default:{let Q=MM($,J);Q.length===0?Z.state!=="inactive"&&vZ({cursorFlags:0,state:"inactive"}):vZ({cursorFlags:0,hitRegions:Q,state:"hover"}),VM($.currentTarget);break}}}function Fp($){if($.relatedTarget instanceof HTMLIFrameElement)switch(A7().state){case"hover":vZ({cursorFlags:0,state:"inactive"})}}function Np($){if($.defaultPrevented)return;if($.pointerType==="mouse"&&$.button>0)return;jp($.currentTarget)&&$.preventDefault()}function Vp($){let Z=0,J=0,Q={};for(let z of $)if(z.defaultSize!==void 0){Z++;let G=Q4(z.defaultSize);J+=G,Q[z.panelId]=G}else Q[z.panelId]=void 0;let X=$.length-Z;if(X!==0){let z=Q4((100-J)/X);for(let G of $)G.defaultSize===void 0&&(Q[G.panelId]=z)}return Q}function VZ0($,Z,J){if(!J[0])return;let Q=$.panels.find((Y)=>Y.element===Z);if(!Q||!Q.onResize)return;let X=mZ({group:$}),z=$.orientation==="horizontal"?Q.element.offsetWidth:Q.element.offsetHeight,G=Q.mutableValues.prevSize,H={asPercentage:Q4(z/X*100),inPixels:z};Q.mutableValues.prevSize=H,Q.onResize(H,Q.id,G)}function LZ0($,Z){if(Object.keys($).length!==Object.keys(Z).length)return!1;for(let J in $)if($[J]!==Z[J])return!1;return!0}function MZ0({group:$,nextGroupSize:Z,prevGroupSize:J,prevLayout:Q}){if(J<=0||Z<=0||J===Z)return Q;let X=0,z=0,G=!1,H=new Map,Y=[];for(let B of $.panels){let q=Q[B.id]??0;switch(B.panelConstraints.groupResizeBehavior){case"preserve-pixel-size":{G=!0;let U=q/100*J,F=Q4(U/Z*100);H.set(B.id,F),X+=F;break}case"preserve-relative-size":default:{Y.push(B.id),z+=q;break}}}if(!G||Y.length===0)return Q;let K=100-X,W={...Q};if(H.forEach((B,q)=>{W[q]=B}),z>0)for(let B of Y){let q=Q[B]??0;W[B]=Q4(q/z*K)}else{let B=Q4(K/Y.length);for(let q of Y)W[q]=B}return W}function AZ0($,Z){let J=$.map((X)=>X.id),Q=Object.keys(Z);if(J.length!==Q.length)return!1;for(let X of J)if(!Q.includes(X))return!1;return!0}var xZ=new Map;function _Z0($){let Z=!0;s5($.element.ownerDocument.defaultView,"Cannot register an unmounted Group");let J=$.element.ownerDocument.defaultView.ResizeObserver,Q=new Set,X=new Set,z=new J((F)=>{for(let N of F){let{borderBoxSize:L,target:V}=N;if(V===$.element){if(Z){let M=mZ({group:$});if(M===0)return;let _=t6($.id);if(!_)return;let O=qM($),D=_.defaultLayoutDeferred?Vp(O):_.layout,A=MZ0({group:$,nextGroupSize:M,prevGroupSize:_.groupSize,prevLayout:D}),E=D7({layout:A,panelConstraints:O});if(!_.defaultLayoutDeferred&&_7(_.layout,E)&&LZ0(_.derivedPanelConstraints,O)&&_.groupSize===M)return;u9($,{defaultLayoutDeferred:!1,derivedPanelConstraints:O,groupSize:M,layout:E,separatorToPanels:_.separatorToPanels})}}else VZ0($,V,L)}});z.observe($.element),$.panels.forEach((F)=>{s5(!Q.has(F.id),`Panel ids must be unique; id "${F.id}" was used more than once`),Q.add(F.id),F.onResize&&z.observe(F.element)});let G=mZ({group:$}),H=qM($),Y=$.panels.map(({id:F})=>F).join(","),K=$.mutableState.defaultLayout;K&&(AZ0($.panels,K)||(K=void 0));let W=$.mutableState.layouts[Y]??K??Vp(H),B=D7({layout:W,panelConstraints:H}),q=$.element.ownerDocument;xZ.set(q,(xZ.get(q)??0)+1);let U=new Map;return Ap($).forEach((F)=>{F.separator&&U.set(F.separator,F.panels)}),u9($,{defaultLayoutDeferred:G===0,derivedPanelConstraints:H,groupSize:G,layout:B,separatorToPanels:U}),$.separators.forEach((F)=>{s5(!X.has(F.id),`Separator ids must be unique; id "${F.id}" was used more than once`),X.add(F.id),F.element.addEventListener("keydown",Wp)}),xZ.get(q)===1&&(q.addEventListener("contextmenu",zp,!0),q.addEventListener("dblclick",Kp,!0),q.addEventListener("pointerdown",Bp,!0),q.addEventListener("pointerleave",qp),q.addEventListener("pointermove",Up),q.addEventListener("pointerout",Fp),q.addEventListener("pointerup",Np,!0)),function(){Z=!1,xZ.set(q,Math.max(0,(xZ.get(q)??0)-1)),GZ0($),$.separators.forEach((F)=>{F.element.removeEventListener("keydown",Wp)}),xZ.get(q)||(q.removeEventListener("contextmenu",zp,!0),q.removeEventListener("dblclick",Kp,!0),q.removeEventListener("pointerdown",Bp,!0),q.removeEventListener("pointerleave",qp),q.removeEventListener("pointermove",Up),q.removeEventListener("pointerout",Fp),q.removeEventListener("pointerup",Np,!0)),z.disconnect()}}function DZ0(){let[$,Z]=q5.useState({}),J=q5.useCallback(()=>Z({}),[]);return[$,J]}function AM($){let Z=q5.useId();return`${$??Z}`}var P7=typeof window<"u"?q5.useLayoutEffect:q5.useEffect;function RX($){let Z=q5.useRef($);return P7(()=>{Z.current=$},[$]),q5.useCallback((...J)=>Z.current?.(...J),[Z])}function _M(...$){return RX((Z)=>{$.forEach((J)=>{if(J)switch(typeof J){case"function":{J(Z);break}case"object":{J.current=Z;break}}})})}function DM($){let Z=q5.useRef({...$});return P7(()=>{for(let J in $)Z.current[J]=$[J]},[$]),Z.current}var kp=q5.createContext(null);function OZ0($,Z){let J=q5.useRef({getLayout:()=>({}),setLayout:XZ0});q5.useImperativeHandle(Z,()=>J.current,[]),P7(()=>{Object.assign(J.current,Ep({groupId:$}))})}function OM({children:$,className:Z,defaultLayout:J,disableCursor:Q,disabled:X,elementRef:z,groupRef:G,id:H,onLayoutChange:Y,onLayoutChanged:K,orientation:W="horizontal",resizeTargetMinimumSize:B={coarse:20,fine:10},style:q,...U}){let F=q5.useRef({onLayoutChange:{},onLayoutChanged:{}}),N=RX((h)=>{_7(F.current.onLayoutChange,h)||(F.current.onLayoutChange=h,Y?.(h))}),L=RX((h,k)=>{_7(F.current.onLayoutChanged,h)||(F.current.onLayoutChanged=h,K?.(h,{isUserInteraction:k}))}),V=AM(H),M=q5.useRef(null),[_,O]=DZ0(),D=q5.useRef({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:B,separators:[]}),A=_M(M,z);OZ0(V,G);let E=RX((h,k)=>{let S=A7(),w=Xp(h),T=t6(h);if(T){let R=!1;switch(S.state){case"active":{R=S.hitRegions.some((b)=>b.group===w);break}}return{flexGrow:T.layout[k]??1,pointerEvents:R?"none":void 0}}if(J?.[k])return{flexGrow:J?.[k]}}),I=DM({defaultLayout:J,disableCursor:Q}),y=q5.useMemo(()=>({get disableCursor(){return!!I.disableCursor},getPanelStyles:E,id:V,orientation:W,registerPanel:(h)=>{let k=D.current;return k.panels=UM(W,[...k.panels,h]),O(),()=>{k.panels=k.panels.filter((S)=>S!==h),O()}},registerSeparator:(h)=>{let k=D.current;return k.separators=UM(W,[...k.separators,h]),O(),()=>{k.separators=k.separators.filter((S)=>S!==h),O()}},updatePanelProps:(h,{disabled:k})=>{let S=D.current.panels.find((R)=>R.id===h);S&&(S.panelConstraints.disabled=k);let w=Xp(V),T=t6(V);w&&T&&u9(w,{...T,derivedPanelConstraints:qM(w)})},updateSeparatorProps:(h,{disabled:k,disableDoubleClick:S})=>{let w=D.current.separators.find((T)=>T.id===h);w&&(w.disabled=k,w.disableDoubleClick=S)}}),[E,V,O,W,I]),C=q5.useRef(null);return P7(()=>{let h=M.current;if(h===null)return;let k=D.current,S;if(I.defaultLayout!==void 0&&Object.keys(I.defaultLayout).length===k.panels.length){S={};for(let j of k.panels){let t=I.defaultLayout[j.id];t!==void 0&&(S[j.id]=t)}}let w={disabled:!!X,element:h,id:V,mutableState:{defaultLayout:S,disableCursor:!!I.disableCursor,expandedPanelSizes:D.current.lastExpandedPanelSizes,layouts:D.current.layouts},orientation:W,panels:k.panels,resizeTargetMinimumSize:k.resizeTargetMinimumSize,separators:k.separators};C.current=w;let T=_Z0(w),{defaultLayoutDeferred:R,derivedPanelConstraints:b,layout:g}=t6(w.id,!0);!R&&b.length>0&&(N(g),L(g,!1));let u=LM(V,(j)=>{let{defaultLayoutDeferred:t,derivedPanelConstraints:Q0,layout:x}=j.next;if(t||Q0.length===0)return;let e=w.panels.map(({id:l})=>l).join(",");w.mutableState.layouts[e]=x,Q0.forEach((l)=>{if(l.collapsible){let{layout:H0}=j.prev??{};if(H0){let B0=c8(l.collapsedSize,x[l.panelId]),X0=c8(l.collapsedSize,H0[l.panelId]);B0&&!X0&&(w.mutableState.expandedPanelSizes[l.panelId]=H0[l.panelId])}}});let M0=A7().state!=="active";N(x),M0&&L(x,j.isUserInteraction)});return()=>{C.current=null,T(),u()}},[X,V,L,N,W,_,I]),q5.useEffect(()=>{let h=C.current;h&&(h.mutableState.defaultLayout=J,h.mutableState.disableCursor=!!Q)}),fZ.jsx(kp.Provider,{value:y,children:fZ.jsx("div",{...U,className:Z,"data-group":!0,"data-testid":V,id:V,ref:A,style:{height:"100%",width:"100%",overflow:"hidden",...q,display:"flex",flexDirection:W==="horizontal"?"row":"column",flexWrap:"nowrap",touchAction:W==="horizontal"?"pan-y":"pan-x"},children:$})})}OM.displayName="Group";function PM(){let $=q5.useContext(kp);return s5($,"Group Context not found; did you render a Panel or Separator outside of a Group?"),$}function PZ0($,Z){let{id:J}=PM(),Q=q5.useRef({collapse:BM,expand:BM,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:BM});q5.useImperativeHandle(Z,()=>Q.current,[]),P7(()=>{Object.assign(Q.current,Cp({groupId:J,panelId:$}))})}function wM({children:$,className:Z,collapsedSize:J="0%",collapsible:Q=!1,defaultSize:X,disabled:z,elementRef:G,groupResizeBehavior:H="preserve-relative-size",id:Y,maxSize:K="100%",minSize:W="0%",onResize:B,panelRef:q,style:U,...F}){let N=!!Y,L=AM(Y),V=DM({disabled:z}),M=q5.useRef(null),_=_M(M,G),{getPanelStyles:O,id:D,orientation:A,registerPanel:E,updatePanelProps:I}=PM(),y=B!==null,C=RX((w,T,R)=>{B?.(w,Y,R)});P7(()=>{let w=M.current;if(w!==null){let T={element:w,id:L,idIsStable:N,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:y?C:void 0,panelConstraints:{groupResizeBehavior:H,collapsedSize:J,collapsible:Q,defaultSize:X,disabled:V.disabled,maxSize:K,minSize:W}};return E(T)}},[H,J,Q,X,y,L,N,K,W,C,E,V]),q5.useEffect(()=>{I(L,{disabled:z})},[z,L,I]),PZ0(L,q);let h=()=>{let w=O(D,L);if(w)return JSON.stringify(w)},k=q5.useSyncExternalStore((w)=>LM(D,w),h,h),S;return k?S=JSON.parse(k):X!==void 0?S={flexGrow:void 0,flexShrink:void 0,flexBasis:X}:S={flexGrow:1},fZ.jsx("div",{...F,"data-disabled":z||void 0,"data-panel":!0,"data-testid":L,id:L,ref:_,style:{...wZ0,display:"flex",flexBasis:0,flexShrink:1,overflow:"visible",...S},children:fZ.jsx("div",{className:Z,style:{maxHeight:"100%",maxWidth:"100%",flexGrow:1,overflow:"auto",...U,touchAction:A==="horizontal"?"pan-y":"pan-x"},children:$})})}wM.displayName="Panel";var wZ0={minHeight:0,maxHeight:"100%",height:"auto",minWidth:0,maxWidth:"100%",width:"auto",border:"none",borderWidth:0,padding:0,margin:0};function jZ0({layout:$,panelConstraints:Z,panelId:J,panelIndex:Q}){let X,z,G=$[J],H=Z.find((Y)=>Y.panelId===J);if(H){let Y=H.maxSize,K=H.collapsible?H.collapsedSize:H.minSize,W=[Q,Q+1];z=D7({layout:yX({delta:K-G,initialLayout:$,panelConstraints:Z,pivotIndices:W,prevLayout:$}),panelConstraints:Z})[J],X=D7({layout:yX({delta:Y-G,initialLayout:$,panelConstraints:Z,pivotIndices:W,prevLayout:$}),panelConstraints:Z})[J]}return{valueControls:J,valueMax:X,valueMin:z,valueNow:G}}function jM({children:$,className:Z,disabled:J,disableDoubleClick:Q,elementRef:X,id:z,style:G,...H}){let Y=AM(z),K=DM({disabled:J,disableDoubleClick:Q}),[W,B]=q5.useState({}),[q,U]=q5.useState("inactive"),[F,N]=q5.useState(!1),L=q5.useRef(null),V=_M(L,X),{disableCursor:M,id:_,orientation:O,registerSeparator:D,updateSeparatorProps:A}=PM(),E=O==="horizontal"?"vertical":"horizontal";P7(()=>{let C=L.current;if(C!==null){let h={disabled:K.disabled,disableDoubleClick:K.disableDoubleClick,element:C,id:Y},k=D(h),S=JZ0((T)=>{U(T.next.state!=="inactive"&&T.next.hitRegions.some((R)=>R.separator===h)?T.next.state:"inactive")}),w=LM(_,(T)=>{let{derivedPanelConstraints:R,layout:b,separatorToPanels:g}=T.next,u=g.get(h);if(u){let j=u[0],t=u.indexOf(j);B(jZ0({layout:b,panelConstraints:R,panelId:j.id,panelIndex:t}))}});return()=>{S(),w(),k()}}},[_,Y,D,K]),q5.useEffect(()=>{A(Y,{disabled:J,disableDoubleClick:Q})},[J,Q,Y,A]);let I;J&&!M&&(I="not-allowed");let y;if(J)y="disabled";else switch(q){case"active":{y="active";break}default:F?y="focus":y=q}return fZ.jsx("div",{...H,"aria-controls":W.valueControls,"aria-disabled":J||void 0,"aria-orientation":E,"aria-valuemax":W.valueMax,"aria-valuemin":W.valueMin,"aria-valuenow":W.valueNow,children:$,className:Z,"data-separator":y,"data-testid":Y,id:Y,onBlur:()=>N(!1),onFocus:()=>N(!0),ref:V,role:"separator",style:{flexBasis:"auto",cursor:I,...G,flexGrow:0,flexShrink:0,touchAction:"none"},tabIndex:J?void 0:0})}jM.displayName="Separator";var bX=P(d(),1);function Ip({className:$,...Z}){return bX.jsx(OM,{"data-slot":"resizable-panel-group",className:s("flex h-full w-full aria-[orientation=vertical]:flex-col",$),...Z})}function TM({...$}){return bX.jsx(wM,{"data-slot":"resizable-panel",...$})}function Rp({withHandle:$,className:Z,...J}){return bX.jsx(jM,{"data-slot":"resizable-handle",className:s("relative flex w-0 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]:h-0 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 [&[aria-orientation=horizontal]>div]:rotate-90",Z),...J,children:$&&bX.jsx("div",{className:"flex h-6 w-1 shrink-0 rounded-lg bg-border"})})}var e6=P(d(),1);function yp({workspace:$,chat:Z,open:J,workspaceMinWidth:Q,chatMinWidth:X,chatMaxWidth:z,chatWidth:G,onCollapse:H,onChatWidthChange:Y}){let K=$3.useRef(null),W=$3.useRef(null),[B,q]=$3.useState(!1),U=Math.min(Math.max(G,X),z),F=$3.useRef(J?U:0).current;return $3.useLayoutEffect(()=>{let N=K.current;if(!N)return;if(J)N.resize(U);else N.collapse()},[U,J]),e6.jsxs(Ip,{orientation:"horizontal",className:s("overflow-visible!",B&&"[&>#chat]:transition-[flex-grow] [&>#chat]:duration-200 [&>#chat]:ease-in-out motion-reduce:[&>#chat]:transition-none!",B&&"has-[[data-separator=active]]:[&>#chat]:transition-none!"),onLayoutChanged:(N,L)=>{if(!B&&W.current===null)W.current=requestAnimationFrame(()=>{q(!0)});if(L.isUserInteraction)requestAnimationFrame(()=>{let V=K.current;if(!V)return;let M=V.getSize();if(M.inPixels>0)Y(Math.round(M.inPixels))})},children:[e6.jsx(TM,{id:"workspace",className:"overflow-visible!",minSize:Q,children:e6.jsx("div",{"data-slot":"workspace-split-workspace",className:"flex h-full min-h-0 min-w-0 flex-col",children:$})}),e6.jsx(Rp,{"aria-label":"Resize chat",hidden:!J,disabled:!J}),e6.jsx(TM,{id:"chat","aria-hidden":!J,inert:!J,collapsible:!0,collapsedSize:0,defaultSize:F,minSize:X,maxSize:z,groupResizeBehavior:"preserve-pixel-size",panelRef:K,onResize:(N,L,V)=>{if(J&&N.inPixels===0&&V&&V.inPixels>0)H()},className:s("overflow-hidden!",B&&"transition-opacity duration-200 ease-in-out motion-reduce:transition-none",J?"opacity-100":"opacity-0"),children:e6.jsx("div",{"data-slot":"workspace-split-chat",className:"flex h-full min-h-0 min-w-(--chat-min) flex-col",children:Z})})]})}var Y5=P(d(),1),CZ0=X4.lazy(()=>import("/chunk-6w6j9g4b.js").then(($)=>({default:$.Scratchpad}))),gp=($)=>$.config.title||$.id,vp=($)=>lW($.icon)??SQ;function fp($,Z){let J=Z.find((Q)=>Q.viewId===$.id);return lW($.config.icon)??lW(J?.icon)??SQ}function EZ0({onToggleMode:$}){return Y5.jsxs(M1,{children:[Y5.jsx(A1,{render:Y5.jsx(k0,{variant:"ghost",size:"icon-sm",onClick:$,"aria-label":"Dock agent",children:Y5.jsx(xp,{stroke:1.75})})}),Y5.jsx(_1,{children:"Dock agent"})]})}function SZ0({active:$,onToggle:Z}){return Y5.jsxs(M1,{children:[Y5.jsx(A1,{render:Y5.jsx(k0,{variant:"ghost",size:"icon-sm","aria-label":"Customize","aria-pressed":$,onClick:Z,className:s($&&"bg-accent"),children:Y5.jsx(hp,{stroke:1.75})})}),Y5.jsx(_1,{children:"Customize"})]})}function kZ0($,Z,J,Q,X,z){if($==="agent")return{key:$,Icon:O6,label:"Agent",closable:Q,loading:X};if($==="widgets")return{key:$,Icon:kQ,label:"Widgets",closable:Q};if($==="scratchpad")return{key:$,Icon:IQ,label:"Scratchpad",closable:Q};let G=i3($),H=G?J.find((W)=>W.id===G):null;if(H)return{key:$,Icon:vp(H),label:H.title||H.viewId||"New view",closable:Q,loading:z(H.sessionId)};let Y=_6($),K=Y?Z.find((W)=>W.id===Y):null;return K?{key:$,Icon:fp(K,J),label:gp(K),closable:Q}:null}function IZ0($,Z,J){let Q=new Set(Z),X=0;return $.map((z)=>Q.has(z)?J[X++]:z)}function mp({widgets:$,views:Z,builders:J}){let{layout:Q,setLayout:X,name:z,icon:G,provider:H,workspaceId:Y}=n5(),K=gm(),{ref:W,fits:B,constraints:q}=fm(),[U,F]=X4.useState("idle"),[N,L]=X4.useState(!1),[V,M]=X4.useState(0),_=X4.useRef(new Map),O=D1((G0)=>G0.dockedChatWidth),D=D1((G0)=>G0.setDockedChatWidth),A=j4((G0)=>G0.activity),E=HO(A,Y),I=vm({builders:J,onSave:(G0,A0)=>K.save(G0,A0)});YT(Q.theme);let y=XB(QB(Q.tabs),Z,J),C=y.filter((G0)=>G0!=="agent"),h=C.length>0,S=Q.layoutMode==="split"&&h&&B?"split":"fullscreen",w=S==="split",{tabsState:T,activeTab:R,appletParams:b,navigateToTab:g,setTabs:u}=om({views:Z,builders:J,split:w}),{view:j,chatLoaded:t,previewTurn:Q0,sessionId:x,processing:e,error:M0,send:l,stop:H0,selectSession:B0,dismissError:X0}=Cm({activeTab:R,appletParams:b}),{composerBanner:Y0,builderComposerBanner:V0,composerAvailability:i}=rm(Y,{chatError:M0,onDismissChatError:X0}),$0=new Set(T.open),Z0=(G0)=>{X({layoutMode:G0})},J0=w?C:y,n=y.length>1,m=J0.map((G0)=>kZ0(G0,Z,J,n||i3(G0)!==null,E,(A0)=>AJ(A,Y,A0))).filter((G0)=>Boolean(G0)),c=_6(R),f=c?Z.find((G0)=>G0.id===c):void 0,a=i3(R),o=a?J.find((G0)=>G0.id===a):void 0,N0=o?.status==="draft"&&!AJ(A,Y,o.sessionId)?o:void 0,j0=N0?.id,h0=iT(R,U==="idle",f!==void 0),u0=ZC({workspaceId:Y,sessionId:x,activeTab:R,mode:S,available:h0,closePopup:()=>L(!1),openPopup:()=>L(!0)});X4.useEffect(()=>{if(T.open.filter((v0)=>kX(v0,Z,J)).length===T.open.length)return;let A0=XB(T,Z,J);X({tabs:{open:A0,active:A0.includes(T.active)?T.active:A0[0]}})},[J,X,T,Z]),X4.useEffect(()=>{let G0=new Map;for(let T0 of J){if(T0.status!=="ready"||!T0.viewId)continue;if(!Z.some((f0)=>f0.id===T0.viewId))continue;G0.set(l3(T0.id),QF(T0.viewId))}if(G0.size===0)return;let A0=G0.get(R);if(A0)g(A0);let v0=new Set(G0.values()),D5=new Map([...G0].map(([T0,f0])=>[f0,T0])),K5=[],d5=!1;for(let T0 of T.open){let f0=D5.get(T0);if(v0.has(T0)&&f0&&T.open.includes(f0)){d5=!0;continue}let $5=G0.get(T0),H5=$5??T0;if($5)d5=!0;if(!K5.includes(H5))K5.push(H5)}if(!d5)return;let I0=G0.get(T.active)??T.active;X({tabs:{open:K5.length>0?K5:["agent"],active:I0}})},[R,J,g,X,T,Z]),X4.useEffect(()=>{if(S!=="fullscreen"||R==="agent")L(!1)},[R,S]),X4.useEffect(()=>{if(!j0)return;if(S==="fullscreen")L(!0);M((G0)=>G0+1)},[j0,S]);let p=(G0,A0)=>{if(g(G0,A0),G0==="agent")L(!1),M((v0)=>v0+1)};lH(Y,"focusTab",p),Z8((G0)=>{if(G0.type==="tab:focus"&&G0.workspaceId===Y)p(G0.tab,G0.params)});let r=(G0)=>{let A0=i3(G0),v0=A0?J.find((T0)=>T0.id===A0):void 0;if(!n&&!v0||!$0.has(G0))return;let D5=T.open.filter((T0)=>T0!==G0);if(D5.length===0)D5=["agent"];let K5=J0.indexOf(G0),d5=J0[K5+1]??J0[K5-1]??D5.find((T0)=>kX(T0,Z,J))??"agent",I0=T.active===G0||!D5.includes(T.active)?d5:T.active;if(u({open:D5,active:I0}),R===G0)g(d5);if(v0?.status==="draft")_.current.get(v0.id)?.resetSketch(),I.clear(v0.id),K.discard(v0.id)},z0=(G0)=>{let A0=l3(G0.id);if($0.has(A0)){let v0=T.open.filter((D5)=>D5!==A0);if(v0.length===0)v0=["agent"];if(u({open:v0,active:T.active===A0?v0[0]:T.active}),R===A0)g(v0[0])}_.current.get(G0.id)?.resetSketch(),I.clear(G0.id),K.discard(G0.id)},L0=(G0)=>{let A0=IZ0(T.open,J0,G0);if(A0===T.open)return;u({open:A0,active:T.active})},P0=(G0)=>{if(G0!==void 0)D1.getState().setComposerDraft(Y,G0);if(S==="fullscreen"&&R!=="agent"){if(L(!0),N)M((A0)=>A0+1);return}M((A0)=>A0+1)};Nm({send:l,revealChat:P0,composerAvailability:i});let g0=[...!w&&!$0.has("agent")?[{key:"agent",Icon:O6,label:"Agent",onClick:()=>p("agent")}]:[],...!$0.has("widgets")?[{key:"widgets",Icon:kQ,label:"Widgets",onClick:()=>p("widgets")}]:[],...!$0.has("scratchpad")?[{key:"scratchpad",Icon:IQ,label:"Scratchpad",onClick:()=>p("scratchpad")}]:[],...Z.map((G0)=>({view:G0,tab:QF(G0.id)})).filter(({tab:G0})=>!$0.has(G0)).map(({view:G0,tab:A0})=>({key:A0,Icon:fp(G0,J),label:gp(G0),onClick:()=>p(A0)})),...J.filter((G0)=>G0.status!=="ready").map((G0)=>({builder:G0,tab:l3(G0.id)})).filter(({tab:G0})=>!$0.has(G0)).map(({builder:G0,tab:A0})=>({key:A0,Icon:vp(G0),label:G0.title||G0.viewId||"New view",onClick:()=>p(A0)})),{key:"create-view",Icon:bp,label:"New view",onClick:()=>{K.create().then((G0)=>p(l3(G0.id)))}}],e0=N0?{sessionId:N0.sessionId,builderId:N0.id,initialValue:N0.input.requirements,onChange:(G0)=>I.change(N0.id,G0),onRemoveDrawing:()=>{_.current.get(N0.id)?.resetSketch()},onSubmit:async(G0)=>{await _.current.get(N0.id)?.prepareSketchForSend(),await K.submit(N0,G0),I.clear(N0.id)}}:void 0,U5=Y5.jsx(LW,{active:S==="split",focusRequest:V,chatLoaded:t,view:j,previewTurn:Q0,sessionId:x,processing:e,composerBanner:e0?V0:Y0,composerAvailability:i,send:l,stop:H0,onSelectSession:B0,onClose:()=>Z0("fullscreen"),annotation:u0.docked,builderDraft:e0,docked:!0}),d0=Y5.jsx(LW,{active:S==="fullscreen"&&R==="agent",focusRequest:V,chatLoaded:t,view:j,previewTurn:Q0,sessionId:x,processing:e,composerBanner:Y0,composerAvailability:i,send:l,stop:H0,onSelectSession:B0}),R0=Y5.jsxs("div",{className:s("flex h-full min-h-0 min-w-0 flex-1 flex-col-reverse overflow-hidden bg-background shadow-md transition-[border-radius]",S==="split"&&"rounded-xl"),children:[Y5.jsxs("div",{className:"relative flex min-h-0 flex-1",children:[Y5.jsxs("div",{ref:u0.targetRef,inert:u0.controls.active||void 0,"aria-hidden":u0.controls.active||void 0,className:"flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden bg-background",children:[R==="agent"?d0:R==="widgets"?Y5.jsx(fg,{editing:U==="editing",onEditingChange:(G0)=>F(G0?"editing":"idle"),widgets:$,onCreateWidget:()=>{B0(null),P0("Create widget")}}):R==="scratchpad"?Y5.jsx(X4.Suspense,{fallback:null,children:Y5.jsx(CZ0,{})}):null,J.filter((G0)=>G0.status!=="ready").map((G0)=>Y5.jsx(km,{ref:(A0)=>{if(A0)_.current.set(G0.id,A0);else _.current.delete(G0.id)},active:o?.id===G0.id,builder:G0,chatDocked:S==="split",workspaceId:Y,onEditingStart:()=>{if(S==="fullscreen")L(!1)},onContinueInChat:P0,onOpenChat:()=>{B0(G0.sessionId),P0()},onDiscard:()=>z0(G0)},G0.id)),Y5.jsx(hm,{views:Z,activeViewId:f?.id??null,params:b})]}),Y5.jsx(sH,{...u0.layerProps,children:Y5.jsx(ZY,{controls:u0.controls,title:"Draw annotation",busy:u0.controls.finishing,onComplete:()=>void u0.controls.finish()})})]}),Y5.jsxs(mg,{children:[Y5.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-4",children:[Y5.jsxs("div",{className:"flex items-center gap-2",children:[Y5.jsx("img",{src:G??V2[H??"claude-code"],alt:"",className:"size-5 shrink-0 rounded-xs"}),z&&Y5.jsx("span",{className:"truncate text-sm font-medium text-foreground",children:z})]}),Y5.jsx(em,{tabs:m,active:R,createItems:g0,onSelect:p,onClose:r,onReorder:L0})]}),Y5.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[Y5.jsx(SZ0,{active:U==="customizing",onToggle:()=>F(U==="customizing"?"idle":"customizing")}),Y5.jsx(Fm,{}),h&&B&&S==="fullscreen"&&Y5.jsx(EZ0,{onToggleMode:()=>Z0("split")})]})]})]});return Y5.jsxs("div",{className:"relative flex h-full min-h-0 flex-col font-sans text-foreground",children:[Y5.jsx("div",{ref:W,className:"flex min-h-0 flex-1",children:h&&B&&q?Y5.jsx(yp,{...q,workspace:R0,chat:U5,open:S==="split",chatWidth:O,onCollapse:()=>Z0("fullscreen"),onChatWidthChange:D}):R0}),Y5.jsx(o8,{children:U==="customizing"&&Y5.jsx(Bh,{onClose:()=>F("idle")})}),S==="fullscreen"&&R!=="agent"&&h&&Y5.jsx(Wh,{loading:E,open:N,onOpenChange:L,onOpenChangeComplete:(G0)=>{if(G0)M((A0)=>A0+1)},children:(G0)=>Y5.jsx(LW,{active:N,focusRequest:V,chatLoaded:t,view:j,previewTurn:Q0,sessionId:x,processing:e,composerBanner:e0?V0:Y0,composerAvailability:i,send:l,stop:H0,onSelectSession:B0,onClose:G0,annotation:u0.popup,builderDraft:e0})})]})}var YB=P(v(),1);function pp($,Z,J,Q){let X=YB.useRef(null);YB.useEffect(()=>{if(!Z)return;let z=new Map(Z.map((U)=>[U.id,{w:U.config.colSpan,h:U.config.rowSpan}]));if(X.current?.workspaceId!==$){X.current={workspaceId:$,sizes:z};return}let G=X.current.sizes,H=new Set(J.widgetGrid.map((U)=>U.i)),Y=Z.filter((U)=>{if(!G.has(U.id))return!H.has(U.id);if(!H.has(U.id))return!1;let N=G.get(U.id);return N.w!==U.config.colSpan||N.h!==U.config.rowSpan});if(X.current={workspaceId:$,sizes:z},Y.length===0)return;let K=new Map(Z.map((U)=>[U.id,U.config])),W=J.widgetGrid.filter((U)=>!Y.some((F)=>F.id===U.i)&&K.has(U.i)).map((U)=>{let F=K.get(U.i);return{i:U.i,x:U.x,y:U.y,w:F.colSpan,h:F.rowSpan}}),B=W.map(({i:U,x:F,y:N})=>({i:U,x:F,y:N})),q=[...W];for(let U of Y){let F=HX(q,U.config.colSpan,U.config.rowSpan,4);B.push({i:U.id,x:F.x,y:F.y}),q.push({i:U.id,x:F.x,y:F.y,w:U.config.colSpan,h:U.config.rowSpan})}Q({widgetGrid:B})},[$,Z,J.widgetGrid,Q])}var E2=P(d(),1);function cp({id:$}){return E2.jsx(up,{id:$,children:E2.jsx(uT,{id:$,children:E2.jsx(RZ0,{id:$})})})}function RZ0({id:$}){let Z=o0(),[J]=a7(),{layout:Q,setLayout:X,isLoading:z}=n5(),G=gT($),H=oH($),Y=nW($);pp($,G.data,Q,X),RT(),Z8((W)=>{if(W.type==="theme:updated"||W.type==="workspace:updated")Z.invalidateQueries({queryKey:S0.layout($)});else if(W.type==="widget-layout:updated"||W.type==="widget:updated")Z.invalidateQueries({queryKey:S0.widgets($)});else if(W.type==="view-layout:updated")Z.invalidateQueries({queryKey:S0.views($)})});let K=z||J===void 0||G.isLoading||H.isLoading||Y.isLoading;return E2.jsx(E2.Fragment,{children:E2.jsx(rG,{children:K?E2.jsx("div",{className:"flex h-full items-center justify-center",children:E2.jsx(MT,{sprite:"moi",effect:"chaos"})}):E2.jsx(mp,{widgets:G.data??[],views:H.data??[],builders:Y.data??[]})})})}var A9=P(d(),1),dp=null;function yZ0(){if(!dp)return A9.jsx(jA,{to:"/"});return A9.jsx(KB.Suspense,{fallback:null,children:A9.jsx(dp,{})})}function lp(){let[,$]=g4();return KB.useEffect(()=>{return hq((Z)=>$(`/workspace/${Z}`)),()=>hq(null)},[$]),A9.jsxs(wA,{children:[A9.jsx(sX,{path:"/",component:qT}),A9.jsx(sX,{path:"/dev/*?",component:yZ0}),A9.jsx(sX,{path:"/workspace/:id/*?",children:(Z)=>A9.jsx(cp,{id:Z.id},Z.id)})]})}var Z3=P(d(),1),rp=new OB;MO(rp);XO();function qG5($){function Z(){return Z3.jsx(wB,{client:rp,children:Z3.jsxs(ZO,{children:[Z3.jsx(yB,{children:Z3.jsx(lp,{})}),Z3.jsx(jD,{}),!1]})})}ip.createRoot($).render(Z3.jsx(Z,{}))}export{qG5 as mount};