orcaq 1.1.6 → 1.1.8

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 (196) hide show
  1. package/.output/nitro.json +1 -1
  2. package/.output/public/_nuxt/-7uW7YTy.js +1 -0
  3. package/.output/public/_nuxt/{wH-P-_6A.js → 5450EsIE.js} +1 -1
  4. package/.output/public/_nuxt/6mVUr42b.js +1 -0
  5. package/.output/public/_nuxt/7H5y5euK.js +1 -0
  6. package/.output/public/_nuxt/7iCr9_qw.js +26 -0
  7. package/.output/public/_nuxt/{C4-wpUAK.js → B0gkARnK.js} +1 -1
  8. package/.output/public/_nuxt/B21nC2NZ.js +1 -0
  9. package/.output/public/_nuxt/B232GDut.js +2 -0
  10. package/.output/public/_nuxt/{x85BV7y_.js → B6N_D8QI.js} +1 -1
  11. package/.output/public/_nuxt/B7C8fo37.js +1 -0
  12. package/.output/public/_nuxt/BC82eJHt.js +1 -0
  13. package/.output/public/_nuxt/BHr4_sbs.js +9 -0
  14. package/.output/public/_nuxt/{DYqShb5v.js → BJvJ0Hlu.js} +4 -4
  15. package/.output/public/_nuxt/BK-6CJ0A.js +1 -0
  16. package/.output/public/_nuxt/BMVgfiQu.js +1 -0
  17. package/.output/public/_nuxt/BNh4NY7v.js +1 -0
  18. package/.output/public/_nuxt/{3jfBYqJb.js → BO3FEgXG.js} +1 -1
  19. package/.output/public/_nuxt/BQm1mt0O.js +1 -0
  20. package/.output/public/_nuxt/BRCvv3op.js +1 -0
  21. package/.output/public/_nuxt/{DLA-ioQ4.js → BRWis86L.js} +1 -1
  22. package/.output/public/_nuxt/{Bgj8Q52i.js → BRzWRTTF.js} +1 -1
  23. package/.output/public/_nuxt/{BWg3wiuc.js → BWTTrGtY.js} +2 -2
  24. package/.output/public/_nuxt/{BJoSd_uV.js → BXMKgn-J.js} +1 -1
  25. package/.output/public/_nuxt/{BoUZO_NV.js → BYaoWfSN.js} +1 -1
  26. package/.output/public/_nuxt/B_G752SV.js +20 -0
  27. package/.output/public/_nuxt/{B5HZeat4.js → BalNYDR1.js} +1 -1
  28. package/.output/public/_nuxt/{DYPm3mWQ.js → BmfnP4qD.js} +1 -1
  29. package/.output/public/_nuxt/Bn6_QGSK.js +1 -0
  30. package/.output/public/_nuxt/{CROH8wgk.js → BsCPQnkm.js} +1 -1
  31. package/.output/public/_nuxt/{wrneOCBW.js → Bu6ybm3Z.js} +1 -1
  32. package/.output/public/_nuxt/{DDsaDrGo.js → BuTCm7Bo.js} +1 -1
  33. package/.output/public/_nuxt/BuzCyLCh.js +1 -0
  34. package/.output/public/_nuxt/{4LC09zKL.js → BzNEuLKx.js} +1 -1
  35. package/.output/public/_nuxt/{C9ZBCJdc.js → BzNNFvTW.js} +1 -1
  36. package/.output/public/_nuxt/{CoQ_oOia.js → BzqjH2-H.js} +1 -1
  37. package/.output/public/_nuxt/{BCa-NKh0.js → C-e53AuW.js} +1 -1
  38. package/.output/public/_nuxt/C0jXhwNq.js +1 -0
  39. package/.output/public/_nuxt/C6K-C4_d.js +1 -0
  40. package/.output/public/_nuxt/{DgGwe7jd.js → C6teO48Y.js} +133 -133
  41. package/.output/public/_nuxt/{CCK1so3F.js → C874itvn.js} +1 -1
  42. package/.output/public/_nuxt/C8ZJ2pm_.js +1 -0
  43. package/.output/public/_nuxt/CA3O4M9L.js +1 -0
  44. package/.output/public/_nuxt/{Cf6n9dsT.js → CAjVwGyz.js} +1 -1
  45. package/.output/public/_nuxt/{uDsvlLN0.js → CCC5u9Ni.js} +1 -1
  46. package/.output/public/_nuxt/{BmEIj9l9.js → CCCJ2fw7.js} +1 -1
  47. package/.output/public/_nuxt/{dDqgUqt5.js → CFi6G8Aj.js} +2 -2
  48. package/.output/public/_nuxt/CKlMKmo6.js +1 -0
  49. package/.output/public/_nuxt/{FHx3Ejt6.js → CMDq7o88.js} +1 -1
  50. package/.output/public/_nuxt/CMI-3q_e.js +1 -0
  51. package/.output/public/_nuxt/{CBjcd4cE.js → CMnjMfEQ.js} +1 -1
  52. package/.output/public/_nuxt/{Ci7hrFNN.js → CQFANjzf.js} +1 -1
  53. package/.output/public/_nuxt/{BuSZbOQO.js → CU5cwnUW.js} +1 -1
  54. package/.output/public/_nuxt/{Bibtvqd8.js → CXQ2zrsE.js} +1 -1
  55. package/.output/public/_nuxt/{Dd89Vyx8.js → CXbrqQhC.js} +1 -1
  56. package/.output/public/_nuxt/CZXyfpHW.js +1 -0
  57. package/.output/public/_nuxt/CZgTP5wX.js +1 -0
  58. package/.output/public/_nuxt/{BxZgIpkD.js → Cd_fVKDw.js} +1 -1
  59. package/.output/public/_nuxt/CeXnSKvd.js +1 -0
  60. package/.output/public/_nuxt/Chw5tFzx.js +1 -0
  61. package/.output/public/_nuxt/CkLSGVwV.js +1 -0
  62. package/.output/public/_nuxt/Cqk0ImDE.js +1 -0
  63. package/.output/public/_nuxt/{BAasx5OS.js → CuXTA7ZW.js} +1 -1
  64. package/.output/public/_nuxt/Cv9v5fHN.js +1 -0
  65. package/.output/public/_nuxt/{CE0zlNDo.js → CvbYm0uB.js} +1 -1
  66. package/.output/public/_nuxt/{BJ8qQpib.js → Cw1HIv3s.js} +1 -1
  67. package/.output/public/_nuxt/{7nPLTDFM.js → CyEOtFwE.js} +1 -1
  68. package/.output/public/_nuxt/CyKRjZZo.js +1 -0
  69. package/.output/public/_nuxt/{Bap1X7GD.js → D4DMGxvZ.js} +1 -1
  70. package/.output/public/_nuxt/{DP6Az3fC.js → D5GonnbJ.js} +1 -1
  71. package/.output/public/_nuxt/D5Oboajo.js +1 -0
  72. package/.output/public/_nuxt/D8egDyEO.js +1 -0
  73. package/.output/public/_nuxt/DBSV6YXN.js +1 -0
  74. package/.output/public/_nuxt/{habs8oz6.js → DCewvWOu.js} +1 -1
  75. package/.output/public/_nuxt/{CP-7VdtS.js → DG9CsZCx.js} +1 -1
  76. package/.output/public/_nuxt/{DViCRsmA.js → DH2V7e8U.js} +1 -1
  77. package/.output/public/_nuxt/{C6bwwZAc.js → DHXwq7wT.js} +1 -1
  78. package/.output/public/_nuxt/DJXrgohw.js +2 -0
  79. package/.output/public/_nuxt/{Cl3VX8Um.js → DQRyK9Io.js} +1 -1
  80. package/.output/public/_nuxt/{ZNDxw-7x.js → DXVrM3CN.js} +1 -1
  81. package/.output/public/_nuxt/{Un5zjlKE.js → DZ4xLzJg.js} +1 -1
  82. package/.output/public/_nuxt/DZIoL4RO.js +1 -0
  83. package/.output/public/_nuxt/D_kY6P5P.js +1 -0
  84. package/.output/public/_nuxt/DgxTwFGe.js +7 -0
  85. package/.output/public/_nuxt/DkX74xDd.js +1 -0
  86. package/.output/public/_nuxt/{B_hWP06g.js → DmnufEYq.js} +1 -1
  87. package/.output/public/_nuxt/{BCazdlgN.js → Dopm1f4X.js} +1 -1
  88. package/.output/public/_nuxt/{C6CFIGob.js → Dpkaavgs.js} +1 -1
  89. package/.output/public/_nuxt/DpsqSAMo.js +20 -0
  90. package/.output/public/_nuxt/{DHyymmeR.js → DrkGD_bQ.js} +1 -1
  91. package/.output/public/_nuxt/{yLATXAxG.js → Dtry_3Qa.js} +1 -1
  92. package/.output/public/_nuxt/DwPmcz47.js +1 -0
  93. package/.output/public/_nuxt/DyjsVMbv.js +1 -0
  94. package/.output/public/_nuxt/{CNPNWuzz.js → FmHWbXNk.js} +1 -1
  95. package/.output/public/_nuxt/{BbLqUOHs.js → JxgekUqn.js} +1 -1
  96. package/.output/public/_nuxt/KoGK2wLb.js +1 -0
  97. package/.output/public/_nuxt/LU_a7qLd.js +1 -0
  98. package/.output/public/_nuxt/{Lh0RfwhV.js → LxqkguPP.js} +1 -1
  99. package/.output/public/_nuxt/Q8x88Gcd.js +1 -0
  100. package/.output/public/_nuxt/{DRX1aIGD.js → R04uZjs6.js} +1 -1
  101. package/.output/public/_nuxt/So0hX8V0.js +31 -0
  102. package/.output/public/_nuxt/WGDY9i_Q.js +1 -0
  103. package/.output/public/_nuxt/{Df4wU3r0.js → WZQ8mcv9.js} +1 -1
  104. package/.output/public/_nuxt/{CO0Pa76w.js → XjywAggc.js} +1 -1
  105. package/.output/public/_nuxt/{_fileId_.DxhkUVGK.css → _fileId_.CiauI_x3.css} +1 -1
  106. package/.output/public/_nuxt/{C445d10Z.js → _uLivI44.js} +1 -1
  107. package/.output/public/_nuxt/builds/latest.json +1 -1
  108. package/.output/public/_nuxt/builds/meta/30582efd-125a-4f88-bd89-20a7b2ba8697.json +1 -0
  109. package/.output/public/_nuxt/{EZ0owjER.js → eQskTKIU.js} +1 -1
  110. package/.output/public/_nuxt/ecWNT6PZ.js +1 -0
  111. package/.output/public/_nuxt/entry.BcHy7sxf.css +1 -0
  112. package/.output/public/_nuxt/{BEvswgw7.js → f6XRRKUb.js} +1 -1
  113. package/.output/public/_nuxt/jtwYTq7X.js +52 -0
  114. package/.output/public/_nuxt/{Cvkyd5iW.js → mcYTISF7.js} +1 -1
  115. package/.output/public/_nuxt/mcfKrWU-.js +1 -0
  116. package/.output/public/_nuxt/{BnZ5qYkP.js → soHTUlpn.js} +9 -9
  117. package/.output/public/_nuxt/tc7vkD0J.js +3 -0
  118. package/.output/public/_nuxt/vEHvfalB.js +53 -0
  119. package/.output/public/_nuxt/vP25tZUh.js +2 -0
  120. package/.output/public/_nuxt/{F8eHh68O.js → zndqWf9s.js} +8 -8
  121. package/.output/server/chunks/_/registry.mjs +116 -0
  122. package/.output/server/chunks/_/registry.mjs.map +1 -0
  123. package/.output/server/chunks/_/{native-backup.mjs → runtime.mjs} +325 -164
  124. package/.output/server/chunks/_/runtime.mjs.map +1 -0
  125. package/.output/server/chunks/_/{native-backup-jobs.mjs → service.mjs} +185 -248
  126. package/.output/server/chunks/_/service.mjs.map +1 -0
  127. package/.output/server/chunks/_/tables.factory.mjs +1 -1
  128. package/.output/server/chunks/build/client.manifest.mjs +802 -727
  129. package/.output/server/chunks/build/client.manifest.mjs.map +1 -1
  130. package/.output/server/chunks/nitro/nitro.mjs +683 -648
  131. package/.output/server/chunks/routes/api/database-backup/capability.get.mjs +7 -2
  132. package/.output/server/chunks/routes/api/database-backup/capability.get.mjs.map +1 -1
  133. package/.output/server/chunks/routes/api/database-export/export-database.mjs +4 -3
  134. package/.output/server/chunks/routes/api/database-export/export-database.mjs.map +1 -1
  135. package/.output/server/chunks/routes/api/database-export/jobs/_jobId/download.get.mjs +1 -20
  136. package/.output/server/chunks/routes/api/database-export/jobs/_jobId/download.get.mjs.map +1 -1
  137. package/.output/server/chunks/routes/api/database-export/jobs/_jobId_.get.mjs +1 -20
  138. package/.output/server/chunks/routes/api/database-export/jobs/_jobId_.get.mjs.map +1 -1
  139. package/.output/server/chunks/routes/api/database-import/import-database.mjs +14 -3
  140. package/.output/server/chunks/routes/api/database-import/import-database.mjs.map +1 -1
  141. package/.output/server/chunks/routes/api/database-import/jobs/_jobId_.get.mjs +1 -20
  142. package/.output/server/chunks/routes/api/database-import/jobs/_jobId_.get.mjs.map +1 -1
  143. package/.output/server/package.json +1 -1
  144. package/package.json +1 -1
  145. package/.output/public/_nuxt/27ZsWTm2.js +0 -1
  146. package/.output/public/_nuxt/4OV_5qQE.js +0 -1
  147. package/.output/public/_nuxt/6NXhlm49.js +0 -1
  148. package/.output/public/_nuxt/6wO6CbCo.js +0 -1
  149. package/.output/public/_nuxt/B10QBDL6.js +0 -1
  150. package/.output/public/_nuxt/B3iNzG14.js +0 -1
  151. package/.output/public/_nuxt/BKAEFZqP.js +0 -1
  152. package/.output/public/_nuxt/BTvOPFKG.js +0 -1
  153. package/.output/public/_nuxt/BbawOYVr.js +0 -1
  154. package/.output/public/_nuxt/Bf2bW_MY.js +0 -7
  155. package/.output/public/_nuxt/BhzzQZRC.js +0 -1
  156. package/.output/public/_nuxt/Bok35x_B.js +0 -1
  157. package/.output/public/_nuxt/BusLuQ4Q.js +0 -1
  158. package/.output/public/_nuxt/C7C1kq_N.js +0 -1
  159. package/.output/public/_nuxt/CCOlJAKS.js +0 -2
  160. package/.output/public/_nuxt/CEoM97rJ.js +0 -1
  161. package/.output/public/_nuxt/CHAVZu6b.js +0 -2
  162. package/.output/public/_nuxt/CN8b9qPP.js +0 -1
  163. package/.output/public/_nuxt/CUws2Uv7.js +0 -1
  164. package/.output/public/_nuxt/CZLVBTJx.js +0 -1
  165. package/.output/public/_nuxt/Cl5p4EQY.js +0 -1
  166. package/.output/public/_nuxt/CnQob-tn.js +0 -1
  167. package/.output/public/_nuxt/CoX1_N4R.js +0 -1
  168. package/.output/public/_nuxt/CvDZBOay.js +0 -1
  169. package/.output/public/_nuxt/D29mzs5t.js +0 -1
  170. package/.output/public/_nuxt/D9MMtvTu.js +0 -52
  171. package/.output/public/_nuxt/DM8LJTsg.js +0 -1
  172. package/.output/public/_nuxt/DZFq5yqu.js +0 -1
  173. package/.output/public/_nuxt/DZVfXu09.js +0 -1
  174. package/.output/public/_nuxt/DdbhVPqD.js +0 -1
  175. package/.output/public/_nuxt/DeVs4gEL.js +0 -53
  176. package/.output/public/_nuxt/DlymFQ5D.js +0 -26
  177. package/.output/public/_nuxt/DoNLWeqB.js +0 -20
  178. package/.output/public/_nuxt/Dpm6rnHk.js +0 -1
  179. package/.output/public/_nuxt/DsPClaxV.js +0 -1
  180. package/.output/public/_nuxt/DtOg0Asw.js +0 -1
  181. package/.output/public/_nuxt/DyDU0wFf.js +0 -1
  182. package/.output/public/_nuxt/G40WRC_L.js +0 -1
  183. package/.output/public/_nuxt/NMm6Vanu.js +0 -1
  184. package/.output/public/_nuxt/ORit_vRp.js +0 -1
  185. package/.output/public/_nuxt/P_2SRa71.js +0 -2
  186. package/.output/public/_nuxt/XETGYn3c.js +0 -1
  187. package/.output/public/_nuxt/ZVYA9HBl.js +0 -1
  188. package/.output/public/_nuxt/ZhP2FY6Y.js +0 -1
  189. package/.output/public/_nuxt/_TExiQQQ.js +0 -3
  190. package/.output/public/_nuxt/__PEYcIB.js +0 -9
  191. package/.output/public/_nuxt/builds/meta/47c294b1-d6b3-4974-bd50-5046ae0a393e.json +0 -1
  192. package/.output/public/_nuxt/dSX5D8ur.js +0 -28
  193. package/.output/public/_nuxt/entry.CGwcggc4.css +0 -1
  194. package/.output/public/_nuxt/o60RgyTd.js +0 -1
  195. package/.output/server/chunks/_/native-backup-jobs.mjs.map +0 -1
  196. package/.output/server/chunks/_/native-backup.mjs.map +0 -1
@@ -0,0 +1,26 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./BuTCm7Bo.js","./C6teO48Y.js","./entry.BcHy7sxf.css","./BzqjH2-H.js","./BJvJ0Hlu.js"])))=>i.map(i=>d[i]);
2
+ var wu=Object.defineProperty;var Su=e=>{throw TypeError(e)};var Tu=(e,t,s)=>t in e?wu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s;var Ye=(e,t,s)=>Tu(e,typeof t!="symbol"?t+"":t,s);var je=(e,t,s)=>t.has(e)?Su("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,s);import{eT as ku,d as Y,aj as $o,ak as Vo,a0 as Vs,bF as Oo,c as P,k as F,o as x,w as T,E as $t,l as q,g,bG as Lo,p as wt,bf as Jn,ab as Qn,bV as Au,aa as Bo,f as b,c7 as Cu,bE as Eu,r as W,ao as Na,bH as mn,bI as Pu,ap as Iu,a5 as No,aK as jo,eU as ja,dc as Mu,am as ge,aJ as Ru,an as Os,aI as ea,aD as Fo,eV as Du,eW as $u,ar as Pt,eX as Vu,eY as Ou,da as Lu,j as ta,q as zo,M as Vt,n as re,K as Gs,eZ as sa,at as Yt,e as A,t as I,aC as Bu,au as Nu,s as Se,ag as Pe,d4 as qo,m as w,O as Ls,J as Bs,N as ye,A as pe,L as Ns,F as le,z as B,cC as Uo,bJ as ju,a4 as Fu,bi as Ce,cp as os,bj as Zs,ck as Ho,bA as zu,bB as qu,bC as ys,ai as Uu,cL as Hu,bO as Gu,bU as Zu,bP as Wu,bQ as Ku,bR as Yu,bT as Xu,e_ as Ju,aq as Fe,bm as Qu,dh as ec,di as tc,a1 as Fa,a2 as za,dr as sc,ds as nc,du as ac,H as Go,e$ as Zo,dV as ic,f0 as oc,f1 as rc,f2 as ke,cx as $,f3 as As,f4 as Wo,f5 as lc,f6 as Xt,cA as te,f7 as H,f8 as xe,f9 as Xe,fa as uc,fb as rs,fc as cc,fd as dc,fe as ne,ff as pc,cB as Ko,fg as vs,a$ as fc,V as mc,fh as hc,fi as gc,Q as yc,dW as vc,eh as bc,bk as xc,fj as _c,i as qa,fk as wc}from"./C6teO48Y.js";import{a as Sc,b as Tc,_ as kc}from"./D8egDyEO.js";import{g as Ac,c as Cc,a as Ec,b as Pc,d as Ic}from"./BuTCm7Bo.js";import{u as na,_ as Mc}from"./Cv9v5fHN.js";import{_ as Rc}from"./eQskTKIU.js";import{_ as Dc}from"./BRCvv3op.js";import{C as $c}from"./BzqjH2-H.js";import"./CCC5u9Ni.js";import{b as aa,a as ia,D as oa,_ as ra}from"./C0jXhwNq.js";import{b as Vc,a as Oc,E as Lc,c as Bc,d as Nc,_ as jc}from"./soHTUlpn.js";import{V as Fc,ai as zc,ak as qc,aj as Uc,al as Hc,am as Gc,an as Zc,ah as Wc}from"./vEHvfalB.js";import{i as Kc,a as Yc}from"./LU_a7qLd.js";import"./BHr4_sbs.js";import"./C6K-C4_d.js";import"./WGDY9i_Q.js";import"./B5rxJs06.js";import"./D5GonnbJ.js";import"./CFi6G8Aj.js";const Xc="radio.select";function Jc(e,t,s){ku(Xc,s,{originalEvent:e,value:t})}var Qc=Y({__name:"Radio",props:{id:{type:String,required:!1},value:{type:null,required:!1},disabled:{type:Boolean,required:!1,default:!1},checked:{type:Boolean,required:!1,default:void 0},asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:"button"},name:{type:String,required:!1},required:{type:Boolean,required:!1}},emits:["update:checked","select"],setup(e,{emit:t}){const s=e,n=t,a=$o(s,"checked",n,{passive:s.checked===void 0}),{value:i}=Vo(s),{forwardRef:o,currentElement:r}=Vs(),u=Oo(r),l=P(()=>{var d;return s.id&&r.value?((d=document.querySelector(`[for="${s.id}"]`))==null?void 0:d.innerText)??s.value:void 0});function c(d){s.disabled||Jc(d,s.value,p=>{n("select",p),!(p!=null&&p.defaultPrevented)&&(a.value=!0,u.value&&p.stopPropagation())})}return(d,p)=>(x(),F(g(Qn),wt(d.$attrs,{id:d.id,ref:g(o),role:"radio",type:d.as==="button"?"button":void 0,as:d.as,"aria-checked":g(a),"aria-label":l.value,"as-child":d.asChild,disabled:d.disabled?"":void 0,"data-state":g(a)?"checked":"unchecked","data-disabled":d.disabled?"":void 0,value:g(i),required:d.required,name:d.name,onClick:Jn(c,["stop"])}),{default:T(()=>[$t(d.$slots,"default",{checked:g(a)}),g(u)&&d.name?(x(),F(g(Lo),{key:0,type:"radio",tabindex:"-1",value:g(i),checked:!!g(a),name:d.name,disabled:d.disabled,required:d.required},null,8,["value","checked","name","disabled","required"])):q("v-if",!0)]),_:3},16,["id","type","as","aria-checked","aria-label","as-child","disabled","data-state","data-disabled","value","required","name"]))}}),ed=Qc;const[td,sd]=Bo("RadioGroupRoot");var nd=Y({__name:"RadioGroupRoot",props:{modelValue:{type:null,required:!1},defaultValue:{type:null,required:!1},disabled:{type:Boolean,required:!1,default:!1},orientation:{type:String,required:!1,default:void 0},dir:{type:String,required:!1},loop:{type:Boolean,required:!1,default:!0},asChild:{type:Boolean,required:!1},as:{type:null,required:!1},name:{type:String,required:!1},required:{type:Boolean,required:!1,default:!1}},emits:["update:modelValue"],setup(e,{emit:t}){const s=e,n=t,{forwardRef:a,currentElement:i}=Vs(),o=$o(s,"modelValue",n,{defaultValue:s.defaultValue,passive:s.modelValue===void 0}),{disabled:r,loop:u,orientation:l,name:c,required:d,dir:p}=Vo(s),f=Au(p),y=Oo(i);return sd({modelValue:o,changeModelValue:_=>{o.value=_},disabled:r,loop:u,orientation:l,name:c==null?void 0:c.value,required:d}),(_,v)=>(x(),F(g(Cu),{"as-child":"",orientation:g(l),dir:g(f),loop:g(u)},{default:T(()=>[b(g(Qn),{ref:g(a),role:"radiogroup","data-disabled":g(r)?"":void 0,"as-child":_.asChild,as:_.as,"aria-orientation":g(l),"aria-required":g(d),dir:g(f)},{default:T(()=>[$t(_.$slots,"default",{modelValue:g(o)}),g(y)&&g(c)?(x(),F(g(Lo),{key:0,required:g(d),disabled:g(r),value:g(o),name:g(c)},null,8,["required","disabled","value","name"])):q("v-if",!0)]),_:3},8,["data-disabled","as-child","as","aria-orientation","aria-required","dir"])]),_:3},8,["orientation","dir","loop"]))}}),ad=nd;const[id,od]=Bo("RadioGroupItem");var rd=Y({inheritAttrs:!1,__name:"RadioGroupItem",props:{id:{type:String,required:!1},value:{type:null,required:!1},disabled:{type:Boolean,required:!1,default:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:"button"},name:{type:String,required:!1},required:{type:Boolean,required:!1}},emits:["select"],setup(e,{emit:t}){const s=e,n=t,{forwardRef:a,currentElement:i}=Vs(),o=td(),r=P(()=>o.disabled.value||s.disabled),u=P(()=>o.required.value||s.required),l=P(()=>{var f;return Eu((f=o.modelValue)==null?void 0:f.value,s.value)});od({disabled:r,checked:l});const c=W(!1),d=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"];Na("keydown",f=>{d.includes(f.key)&&(c.value=!0)}),Na("keyup",()=>{c.value=!1});function p(){setTimeout(()=>{var f;c.value&&((f=i.value)==null||f.click())},0)}return(f,y)=>(x(),F(g(Pu),{checked:l.value,disabled:r.value,"as-child":"",focusable:!r.value,active:l.value},{default:T(()=>[b(ed,wt({...f.$attrs,...s},{ref:g(a),checked:l.value,required:u.value,disabled:r.value,"onUpdate:checked":y[0]||(y[0]=_=>g(o).changeModelValue(f.value)),onSelect:y[1]||(y[1]=_=>n("select",_)),onKeydown:y[2]||(y[2]=mn(Jn(()=>{},["prevent"]),["enter"])),onFocus:p}),{default:T(()=>[$t(f.$slots,"default",{checked:l.value,required:u.value,disabled:r.value})]),_:3},16,["checked","required","disabled"])]),_:3},8,["checked","disabled","focusable","active"]))}}),ld=rd,ud=Y({__name:"RadioGroupIndicator",props:{forceMount:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:"span"}},setup(e){const{forwardRef:t}=Vs(),s=id();return(n,a)=>(x(),F(g(Iu),{present:n.forceMount||g(s).checked.value},{default:T(()=>[b(g(Qn),wt({ref:g(t),"data-state":g(s).checked.value?"checked":"unchecked","data-disabled":g(s).disabled.value?"":void 0,"as-child":n.asChild,as:n.as},n.$attrs),{default:T(()=>[$t(n.$slots,"default")]),_:3},16,["data-state","data-disabled","as-child","as"])]),_:3},8,["present"]))}}),cd=ud;function ls(e,t){const s=typeof e=="string"?`${e}Context`:t,n=Symbol(s);return[o=>{const r=No(n,o);if(r===void 0)throw new Error(`Injection \`${n.toString()}\` not found. Component must be used within ${Array.isArray(e)?`one of the following components: ${e.join(", ")}`:`\`${e}\``}`);return r},o=>(jo(n,o),o),n]}function dd(e,t){const{layoutGroup:s,presenceContext:n,config:a}=t,i=s.id&&e.layoutId?`${s.id}-${e.layoutId}`:e.layoutId||void 0;return{...e,layoutId:i,transition:e.transition??a.transition,layoutGroup:s,motionConfig:a,inViewOptions:e.inViewOptions??a.inViewOptions,presenceContext:n,initial:n.initial===!1?n.initial:e.initial===!0?void 0:e.initial}}function la(e,t){e.indexOf(t)===-1&&e.push(t)}function Cs(e,t){const s=e.indexOf(t);s>-1&&e.splice(s,1)}const Ue=(e,t,s)=>s>t?t:s<e?e:s;let ua=()=>{};const Ze={},Yo=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e);function Xo(e){return typeof e=="object"&&e!==null}const Jo=e=>/^0[^.\s]+$/u.test(e);function Qo(e){let t;return()=>(t===void 0&&(t=e()),t)}const De=e=>e,pd=(e,t)=>s=>t(e(s)),us=(...e)=>e.reduce(pd),Jt=(e,t,s)=>{const n=t-e;return n===0?1:(s-e)/n};class ca{constructor(){this.subscriptions=[]}add(t){return la(this.subscriptions,t),()=>Cs(this.subscriptions,t)}notify(t,s,n){const a=this.subscriptions.length;if(a)if(a===1)this.subscriptions[0](t,s,n);else for(let i=0;i<a;i++){const o=this.subscriptions[i];o&&o(t,s,n)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const $e=e=>e*1e3,Re=e=>e/1e3;function er(e,t){return t?e*(1e3/t):0}const tr=(e,t,s)=>(((1-3*s+3*t)*e+(3*s-6*t))*e+3*t)*e,fd=1e-7,md=12;function hd(e,t,s,n,a){let i,o,r=0;do o=t+(s-t)/2,i=tr(o,n,a)-e,i>0?s=o:t=o;while(Math.abs(i)>fd&&++r<md);return o}function cs(e,t,s,n){if(e===t&&s===n)return De;const a=i=>hd(i,0,1,e,s);return i=>i===0||i===1?i:tr(a(i),t,n)}const sr=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,nr=e=>t=>1-e(1-t),ar=cs(.33,1.53,.69,.99),da=nr(ar),ir=sr(da),or=e=>(e*=2)<1?.5*da(e):.5*(2-Math.pow(2,-10*(e-1))),pa=e=>1-Math.sin(Math.acos(e)),rr=nr(pa),lr=sr(pa),gd=cs(.42,0,1,1),yd=cs(0,0,.58,1),ur=cs(.42,0,.58,1),vd=e=>Array.isArray(e)&&typeof e[0]!="number",cr=e=>Array.isArray(e)&&typeof e[0]=="number",bd={linear:De,easeIn:gd,easeInOut:ur,easeOut:yd,circIn:pa,circInOut:lr,circOut:rr,backIn:da,backInOut:ir,backOut:ar,anticipate:or},xd=e=>typeof e=="string",Ua=e=>{if(cr(e)){ua(e.length===4);const[t,s,n,a]=e;return cs(t,s,n,a)}else if(xd(e))return bd[e];return e},bs=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function _d(e,t){let s=new Set,n=new Set,a=!1,i=!1;const o=new WeakSet;let r={delta:0,timestamp:0,isProcessing:!1};function u(c){o.has(c)&&(l.schedule(c),e()),c(r)}const l={schedule:(c,d=!1,p=!1)=>{const y=p&&a?s:n;return d&&o.add(c),y.has(c)||y.add(c),c},cancel:c=>{n.delete(c),o.delete(c)},process:c=>{if(r=c,a){i=!0;return}a=!0,[s,n]=[n,s],s.forEach(u),s.clear(),a=!1,i&&(i=!1,l.process(c))}};return l}const wd=40;function dr(e,t){let s=!1,n=!0;const a={delta:0,timestamp:0,isProcessing:!1},i=()=>s=!0,o=bs.reduce((m,D)=>(m[D]=_d(i),m),{}),{setup:r,read:u,resolveKeyframes:l,preUpdate:c,update:d,preRender:p,render:f,postRender:y}=o,_=()=>{const m=Ze.useManualTiming?a.timestamp:performance.now();s=!1,Ze.useManualTiming||(a.delta=n?1e3/60:Math.max(Math.min(m-a.timestamp,wd),1)),a.timestamp=m,a.isProcessing=!0,r.process(a),u.process(a),l.process(a),c.process(a),d.process(a),p.process(a),f.process(a),y.process(a),a.isProcessing=!1,s&&t&&(n=!1,e(_))},v=()=>{s=!0,n=!0,a.isProcessing||e(_)};return{schedule:bs.reduce((m,D)=>{const R=o[D];return m[D]=(M,S=!1,k=!1)=>(s||v(),R.schedule(M,S,k)),m},{}),cancel:m=>{for(let D=0;D<bs.length;D++)o[bs[D]].cancel(m)},state:a,steps:o}}const{schedule:Q,cancel:st,state:me,steps:Ws}=dr(typeof requestAnimationFrame<"u"?requestAnimationFrame:De,!0);let Ss;function Sd(){Ss=void 0}const _e={now:()=>(Ss===void 0&&_e.set(me.isProcessing||Ze.useManualTiming?me.timestamp:performance.now()),Ss),set:e=>{Ss=e,queueMicrotask(Sd)}},pr=e=>t=>typeof t=="string"&&t.startsWith(e),fa=pr("--"),Td=pr("var(--"),ma=e=>Td(e)?kd.test(e.split("/*")[0].trim()):!1,kd=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function Ha(e){return typeof e!="string"?!1:e.split("/*")[0].includes("var(--")}const Ot={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},Qt={...Ot,transform:e=>Ue(0,1,e)},xs={...Ot,default:1},Gt=e=>Math.round(e*1e5)/1e5,ha=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function Ad(e){return e==null}const Cd=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,ga=(e,t)=>s=>!!(typeof s=="string"&&Cd.test(s)&&s.startsWith(e)||t&&!Ad(s)&&Object.prototype.hasOwnProperty.call(s,t)),fr=(e,t,s)=>n=>{if(typeof n!="string")return n;const[a,i,o,r]=n.match(ha);return{[e]:parseFloat(a),[t]:parseFloat(i),[s]:parseFloat(o),alpha:r!==void 0?parseFloat(r):1}},Ed=e=>Ue(0,255,e),Ks={...Ot,transform:e=>Math.round(Ed(e))},ut={test:ga("rgb","red"),parse:fr("red","green","blue"),transform:({red:e,green:t,blue:s,alpha:n=1})=>"rgba("+Ks.transform(e)+", "+Ks.transform(t)+", "+Ks.transform(s)+", "+Gt(Qt.transform(n))+")"};function Pd(e){let t="",s="",n="",a="";return e.length>5?(t=e.substring(1,3),s=e.substring(3,5),n=e.substring(5,7),a=e.substring(7,9)):(t=e.substring(1,2),s=e.substring(2,3),n=e.substring(3,4),a=e.substring(4,5),t+=t,s+=s,n+=n,a+=a),{red:parseInt(t,16),green:parseInt(s,16),blue:parseInt(n,16),alpha:a?parseInt(a,16)/255:1}}const hn={test:ga("#"),parse:Pd,transform:ut.transform},ds=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),Je=ds("deg"),qe=ds("%"),L=ds("px"),Id=ds("vh"),Md=ds("vw"),Ga={...qe,parse:e=>qe.parse(e)/100,transform:e=>qe.transform(e*100)},kt={test:ga("hsl","hue"),parse:fr("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:s,alpha:n=1})=>"hsla("+Math.round(e)+", "+qe.transform(Gt(t))+", "+qe.transform(Gt(s))+", "+Gt(Qt.transform(n))+")"},ue={test:e=>ut.test(e)||hn.test(e)||kt.test(e),parse:e=>ut.test(e)?ut.parse(e):kt.test(e)?kt.parse(e):hn.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?ut.transform(e):kt.transform(e),getAnimatableNone:e=>{const t=ue.parse(e);return t.alpha=0,ue.transform(t)}},Rd=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function Dd(e){var t,s;return isNaN(e)&&typeof e=="string"&&(((t=e.match(ha))==null?void 0:t.length)||0)+(((s=e.match(Rd))==null?void 0:s.length)||0)>0}const mr="number",hr="color",$d="var",Vd="var(",Za="${}",Od=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Mt(e){const t=e.toString(),s=[],n={color:[],number:[],var:[]},a=[];let i=0;const r=t.replace(Od,u=>(ue.test(u)?(n.color.push(i),a.push(hr),s.push(ue.parse(u))):u.startsWith(Vd)?(n.var.push(i),a.push($d),s.push(u)):(n.number.push(i),a.push(mr),s.push(parseFloat(u))),++i,Za)).split(Za);return{values:s,split:r,indexes:n,types:a}}function Ld(e){return Mt(e).values}function gr({split:e,types:t}){const s=e.length;return n=>{let a="";for(let i=0;i<s;i++)if(a+=e[i],n[i]!==void 0){const o=t[i];o===mr?a+=Gt(n[i]):o===hr?a+=ue.transform(n[i]):a+=n[i]}return a}}function Bd(e){return gr(Mt(e))}const Nd=e=>typeof e=="number"?0:ue.test(e)?ue.getAnimatableNone(e):e,jd=(e,t)=>typeof e=="number"?t!=null&&t.trim().endsWith("/")?e:0:Nd(e);function Fd(e){const t=Mt(e);return gr(t)(t.values.map((n,a)=>jd(n,t.split[a])))}const Ne={test:Dd,parse:Ld,createTransformer:Bd,getAnimatableNone:Fd};function Ys(e,t,s){return s<0&&(s+=1),s>1&&(s-=1),s<1/6?e+(t-e)*6*s:s<1/2?t:s<2/3?e+(t-e)*(2/3-s)*6:e}function zd({hue:e,saturation:t,lightness:s,alpha:n}){e/=360,t/=100,s/=100;let a=0,i=0,o=0;if(!t)a=i=o=s;else{const r=s<.5?s*(1+t):s+t-s*t,u=2*s-r;a=Ys(u,r,e+1/3),i=Ys(u,r,e),o=Ys(u,r,e-1/3)}return{red:Math.round(a*255),green:Math.round(i*255),blue:Math.round(o*255),alpha:n}}function Es(e,t){return s=>s>0?t:e}const ie=(e,t,s)=>e+(t-e)*s,Xs=(e,t,s)=>{const n=e*e,a=s*(t*t-n)+n;return a<0?0:Math.sqrt(a)},qd=[hn,ut,kt],Ud=e=>qd.find(t=>t.test(e));function Wa(e){const t=Ud(e);if(!t)return!1;let s=t.parse(e);return t===kt&&(s=zd(s)),s}const Ka=(e,t)=>{const s=Wa(e),n=Wa(t);if(!s||!n)return Es(e,t);const a={...s};return i=>(a.red=Xs(s.red,n.red,i),a.green=Xs(s.green,n.green,i),a.blue=Xs(s.blue,n.blue,i),a.alpha=ie(s.alpha,n.alpha,i),ut.transform(a))},gn=new Set(["none","hidden"]);function Hd(e,t){return gn.has(e)?s=>s<=0?e:t:s=>s>=1?t:e}function Gd(e,t){return s=>ie(e,t,s)}function ya(e){return typeof e=="number"?Gd:typeof e=="string"?ma(e)?Es:ue.test(e)?Ka:Kd:Array.isArray(e)?yr:typeof e=="object"?ue.test(e)?Ka:Zd:Es}function yr(e,t){const s=[...e],n=s.length,a=e.map((i,o)=>ya(i)(i,t[o]));return i=>{for(let o=0;o<n;o++)s[o]=a[o](i);return s}}function Zd(e,t){const s={...e,...t},n={};for(const a in s)e[a]!==void 0&&t[a]!==void 0&&(n[a]=ya(e[a])(e[a],t[a]));return a=>{for(const i in n)s[i]=n[i](a);return s}}function Wd(e,t){const s=[],n={color:0,var:0,number:0};for(let a=0;a<t.values.length;a++){const i=t.types[a],o=e.indexes[i][n[i]],r=e.values[o]??0;s[a]=r,n[i]++}return s}const Kd=(e,t)=>{const s=Ne.createTransformer(t),n=Mt(e),a=Mt(t);return n.indexes.var.length===a.indexes.var.length&&n.indexes.color.length===a.indexes.color.length&&n.indexes.number.length>=a.indexes.number.length?gn.has(e)&&!a.values.length||gn.has(t)&&!n.values.length?Hd(e,t):us(yr(Wd(n,a),a.values),s):Es(e,t)};function vr(e,t,s){return typeof e=="number"&&typeof t=="number"&&typeof s=="number"?ie(e,t,s):ya(e)(e,t)}const Yd=e=>{const t=({timestamp:s})=>e(s);return{start:(s=!0)=>Q.update(t,s),stop:()=>st(t),now:()=>me.isProcessing?me.timestamp:_e.now()}},br=(e,t,s=10)=>{let n="";const a=Math.max(Math.round(t/s),2);for(let i=0;i<a;i++)n+=Math.round(e(i/(a-1))*1e4)/1e4+", ";return`linear(${n.substring(0,n.length-2)})`},Ps=2e4;function va(e){let t=0;const s=50;let n=e.next(t);for(;!n.done&&t<Ps;)t+=s,n=e.next(t);return t>=Ps?1/0:t}function Xd(e,t=100,s){const n=s({...e,keyframes:[0,t]}),a=Math.min(va(n),Ps);return{type:"keyframes",ease:i=>n.next(a*i).value/t,duration:Re(a)}}const oe={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1};function yn(e,t){return e*Math.sqrt(1-t*t)}const Jd=12;function Qd(e,t,s){let n=s;for(let a=1;a<Jd;a++)n=n-e(n)/t(n);return n}const Ya=.001;function ep({duration:e=oe.duration,bounce:t=oe.bounce,velocity:s=oe.velocity,mass:n=oe.mass}){let a,i,o=1-t;o=Ue(oe.minDamping,oe.maxDamping,o),e=Ue(oe.minDuration,oe.maxDuration,Re(e)),o<1?(a=l=>{const c=l*o,d=c*e,p=c-s,f=yn(l,o),y=Math.exp(-d);return Ya-p/f*y},i=l=>{const d=l*o*e,p=d*s+s,f=Math.pow(o,2)*Math.pow(l,2)*e,y=Math.exp(-d),_=yn(Math.pow(l,2),o);return(-a(l)+Ya>0?-1:1)*((p-f)*y)/_}):(a=l=>{const c=Math.exp(-l*e),d=(l-s)*e+1;return-.001+c*d},i=l=>{const c=Math.exp(-l*e),d=(s-l)*(e*e);return c*d});const r=5/e,u=Qd(a,i,r);if(e=$e(e),isNaN(u))return{stiffness:oe.stiffness,damping:oe.damping,duration:e};{const l=Math.pow(u,2)*n;return{stiffness:l,damping:o*2*Math.sqrt(n*l),duration:e}}}const tp=["duration","bounce"],sp=["stiffness","damping","mass"];function Xa(e,t){return t.some(s=>e[s]!==void 0)}function np(e){let t={velocity:oe.velocity,stiffness:oe.stiffness,damping:oe.damping,mass:oe.mass,isResolvedFromDuration:!1,...e};if(!Xa(e,sp)&&Xa(e,tp))if(t.velocity=0,e.visualDuration){const s=e.visualDuration,n=2*Math.PI/(s*1.2),a=n*n,i=2*Ue(.05,1,1-(e.bounce||0))*Math.sqrt(a);t={...t,mass:oe.mass,stiffness:a,damping:i}}else{const s=ep({...e,velocity:0});t={...t,...s,mass:oe.mass},t.isResolvedFromDuration=!0}return t}function Is(e=oe.visualDuration,t=oe.bounce){const s=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:t}:e;let{restSpeed:n,restDelta:a}=s;const i=s.keyframes[0],o=s.keyframes[s.keyframes.length-1],r={done:!1,value:i},{stiffness:u,damping:l,mass:c,duration:d,velocity:p,isResolvedFromDuration:f}=np({...s,velocity:-Re(s.velocity||0)}),y=p||0,_=l/(2*Math.sqrt(u*c)),v=o-i,h=Re(Math.sqrt(u/c)),C=Math.abs(v)<5;n||(n=C?oe.restSpeed.granular:oe.restSpeed.default),a||(a=C?oe.restDelta.granular:oe.restDelta.default);let m,D,R,M,S,k;if(_<1)R=yn(h,_),M=(y+_*h*v)/R,m=N=>{const U=Math.exp(-_*h*N);return o-U*(M*Math.sin(R*N)+v*Math.cos(R*N))},S=_*h*M+v*R,k=_*h*v-M*R,D=N=>Math.exp(-_*h*N)*(S*Math.sin(R*N)+k*Math.cos(R*N));else if(_===1){m=U=>o-Math.exp(-h*U)*(v+(y+h*v)*U);const N=y+h*v;D=U=>Math.exp(-h*U)*(h*N*U-y)}else{const N=h*Math.sqrt(_*_-1);m=E=>{const j=Math.exp(-_*h*E),G=Math.min(N*E,300);return o-j*((y+_*h*v)*Math.sinh(G)+N*v*Math.cosh(G))/N};const U=(y+_*h*v)/N,z=_*h*U-v*N,he=_*h*v-U*N;D=E=>{const j=Math.exp(-_*h*E),G=Math.min(N*E,300);return j*(z*Math.sinh(G)+he*Math.cosh(G))}}const Z={calculatedDuration:f&&d||null,velocity:N=>$e(D(N)),next:N=>{if(!f&&_<1){const z=Math.exp(-_*h*N),he=Math.sin(R*N),E=Math.cos(R*N),j=o-z*(M*he+v*E),G=$e(z*(S*he+k*E));return r.done=Math.abs(G)<=n&&Math.abs(o-j)<=a,r.value=r.done?o:j,r}const U=m(N);if(f)r.done=N>=d;else{const z=$e(D(N));r.done=Math.abs(z)<=n&&Math.abs(o-U)<=a}return r.value=r.done?o:U,r},toString:()=>{const N=Math.min(va(Z),Ps),U=br(z=>Z.next(N*z).value,N,30);return N+"ms "+U},toTransition:()=>{}};return Z}Is.applyToOptions=e=>{const t=Xd(e,100,Is);return e.ease=t.ease,e.duration=$e(t.duration),e.type="keyframes",e};const ap=5;function xr(e,t,s){const n=Math.max(t-ap,0);return er(s-e(n),t-n)}function vn({keyframes:e,velocity:t=0,power:s=.8,timeConstant:n=325,bounceDamping:a=10,bounceStiffness:i=500,modifyTarget:o,min:r,max:u,restDelta:l=.5,restSpeed:c}){const d=e[0],p={done:!1,value:d},f=k=>r!==void 0&&k<r||u!==void 0&&k>u,y=k=>r===void 0?u:u===void 0||Math.abs(r-k)<Math.abs(u-k)?r:u;let _=s*t;const v=d+_,h=o===void 0?v:o(v);h!==v&&(_=h-d);const C=k=>-_*Math.exp(-k/n),m=k=>h+C(k),D=k=>{const Z=C(k),N=m(k);p.done=Math.abs(Z)<=l,p.value=p.done?h:N};let R,M;const S=k=>{f(p.value)&&(R=k,M=Is({keyframes:[p.value,y(p.value)],velocity:xr(m,k,p.value),damping:a,stiffness:i,restDelta:l,restSpeed:c}))};return S(0),{calculatedDuration:null,next:k=>{let Z=!1;return!M&&R===void 0&&(Z=!0,D(k),S(k)),R!==void 0&&k>=R?M.next(k-R):(!Z&&D(k),p)}}}function ip(e,t,s){const n=[],a=s||Ze.mix||vr,i=e.length-1;for(let o=0;o<i;o++){let r=a(e[o],e[o+1]);if(t){const u=Array.isArray(t)?t[o]||De:t;r=us(u,r)}n.push(r)}return n}function op(e,t,{clamp:s=!0,ease:n,mixer:a}={}){const i=e.length;if(ua(i===t.length),i===1)return()=>t[0];if(i===2&&t[0]===t[1])return()=>t[1];const o=e[0]===e[1];e[0]>e[i-1]&&(e=[...e].reverse(),t=[...t].reverse());const r=ip(t,n,a),u=r.length,l=c=>{if(o&&c<e[0])return t[0];let d=0;if(u>1)for(;d<e.length-2&&!(c<e[d+1]);d++);const p=Jt(e[d],e[d+1],c);return r[d](p)};return s?c=>l(Ue(e[0],e[i-1],c)):l}function rp(e,t){const s=e[e.length-1];for(let n=1;n<=t;n++){const a=Jt(0,t,n);e.push(ie(s,1,a))}}function lp(e){const t=[0];return rp(t,e.length-1),t}function up(e,t){return e.map(s=>s*t)}function cp(e,t){return e.map(()=>t||ur).splice(0,e.length-1)}function Zt({duration:e=300,keyframes:t,times:s,ease:n="easeInOut"}){const a=vd(n)?n.map(Ua):Ua(n),i={done:!1,value:t[0]},o=up(s&&s.length===t.length?s:lp(t),e),r=op(o,t,{ease:Array.isArray(a)?a:cp(t,a)});return{calculatedDuration:e,next:u=>(i.value=r(u),i.done=u>=e,i)}}const dp=e=>e!==null;function ba(e,{repeat:t,repeatType:s="loop"},n,a=1){const i=e.filter(dp),r=a<0||t&&s!=="loop"&&t%2===1?0:i.length-1;return!r||n===void 0?i[r]:n}const pp={decay:vn,inertia:vn,tween:Zt,keyframes:Zt,spring:Is};function _r(e){typeof e.type=="string"&&(e.type=pp[e.type])}class xa{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(t=>{this.resolve=t})}notifyFinished(){this.resolve()}then(t,s){return this.finished.then(t,s)}}const fp=e=>e/100;class _a extends xa{constructor(t){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=()=>{var n,a;const{motionValue:s}=this.options;s&&s.updatedAt!==_e.now()&&this.tick(_e.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),(a=(n=this.options).onStop)==null||a.call(n))},this.options=t,this.initAnimation(),this.play(),t.autoplay===!1&&this.pause()}initAnimation(){const{options:t}=this;_r(t);const{type:s=Zt,repeat:n=0,repeatDelay:a=0,repeatType:i,velocity:o=0}=t;let{keyframes:r}=t;const u=s||Zt;u!==Zt&&typeof r[0]!="number"&&(this.mixKeyframes=us(fp,vr(r[0],r[1])),r=[0,100]);const l=u({...t,keyframes:r});i==="mirror"&&(this.mirroredGenerator=u({...t,keyframes:[...r].reverse(),velocity:-o})),l.calculatedDuration===null&&(l.calculatedDuration=va(l));const{calculatedDuration:c}=l;this.calculatedDuration=c,this.resolvedDuration=c+a,this.totalDuration=this.resolvedDuration*(n+1)-a,this.generator=l}updateTime(t){const s=Math.round(t-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=s}tick(t,s=!1){const{generator:n,totalDuration:a,mixKeyframes:i,mirroredGenerator:o,resolvedDuration:r,calculatedDuration:u}=this;if(this.startTime===null)return n.next(0);const{delay:l=0,keyframes:c,repeat:d,repeatType:p,repeatDelay:f,type:y,onUpdate:_,finalKeyframe:v}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-a/this.speed,this.startTime)),s?this.currentTime=t:this.updateTime(t);const h=this.currentTime-l*(this.playbackSpeed>=0?1:-1),C=this.playbackSpeed>=0?h<0:h>a;this.currentTime=Math.max(h,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=a);let m=this.currentTime,D=n;if(d){const k=Math.min(this.currentTime,a)/r;let Z=Math.floor(k),N=k%1;!N&&k>=1&&(N=1),N===1&&Z--,Z=Math.min(Z,d+1),!!(Z%2)&&(p==="reverse"?(N=1-N,f&&(N-=f/r)):p==="mirror"&&(D=o)),m=Ue(0,1,N)*r}const R=C?{done:!1,value:c[0]}:D.next(m);i&&!C&&(R.value=i(R.value));let{done:M}=R;!C&&u!==null&&(M=this.playbackSpeed>=0?this.currentTime>=a:this.currentTime<=0);const S=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&M);return S&&y!==vn&&(R.value=ba(c,this.options,v,this.speed)),_&&_(R.value),S&&this.finish(),R}then(t,s){return this.finished.then(t,s)}get duration(){return Re(this.calculatedDuration)}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+Re(t)}get time(){return Re(this.currentTime)}set time(t){t=$e(t),this.currentTime=t,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.playbackSpeed),this.driver?this.driver.start(!1):(this.startTime=0,this.state="paused",this.holdTime=t,this.tick(t))}getGeneratorVelocity(){const t=this.currentTime;if(t<=0)return this.options.velocity||0;if(this.generator.velocity)return this.generator.velocity(t);const s=this.generator.next(t).value;return xr(n=>this.generator.next(n).value,t,s)}get speed(){return this.playbackSpeed}set speed(t){const s=this.playbackSpeed!==t;s&&this.driver&&this.updateTime(_e.now()),this.playbackSpeed=t,s&&this.driver&&(this.time=Re(this.currentTime))}play(){var a,i;if(this.isStopped)return;const{driver:t=Yd,startTime:s}=this.options;this.driver||(this.driver=t(o=>this.tick(o))),(i=(a=this.options).onPlay)==null||i.call(a);const n=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=n):this.holdTime!==null?this.startTime=n-this.holdTime:this.startTime||(this.startTime=s??n),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(_e.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){var t,s;this.notifyFinished(),this.teardown(),this.state="finished",(s=(t=this.options).onComplete)==null||s.call(t)}cancel(){var t,s;this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),(s=(t=this.options).onCancel)==null||s.call(t)}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}attachTimeline(t){var s;return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),(s=this.driver)==null||s.stop(),t.observe(this)}}function mp(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}const ct=e=>e*180/Math.PI,bn=e=>{const t=ct(Math.atan2(e[1],e[0]));return xn(t)},hp={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:bn,rotateZ:bn,skewX:e=>ct(Math.atan(e[1])),skewY:e=>ct(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},xn=e=>(e=e%360,e<0&&(e+=360),e),Ja=bn,Qa=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),ei=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),gp={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:Qa,scaleY:ei,scale:e=>(Qa(e)+ei(e))/2,rotateX:e=>xn(ct(Math.atan2(e[6],e[5]))),rotateY:e=>xn(ct(Math.atan2(-e[2],e[0]))),rotateZ:Ja,rotate:Ja,skewX:e=>ct(Math.atan(e[4])),skewY:e=>ct(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function _n(e){return e.includes("scale")?1:0}function wn(e,t){if(!e||e==="none")return _n(t);const s=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let n,a;if(s)n=gp,a=s;else{const r=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);n=hp,a=r}if(!a)return _n(t);const i=n[t],o=a[1].split(",").map(vp);return typeof i=="function"?i(o):o[i]}const yp=(e,t)=>{const{transform:s="none"}=getComputedStyle(e);return wn(s,t)};function vp(e){return parseFloat(e.trim())}const Lt=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Bt=new Set(Lt),ti=e=>e===Ot||e===L,bp=new Set(["x","y","z"]),xp=Lt.filter(e=>!bp.has(e));function _p(e){const t=[];return xp.forEach(s=>{const n=e.getValue(s);n!==void 0&&(t.push([s,n.get()]),n.set(s.startsWith("scale")?1:0))}),t}const et={width:({x:e},{paddingLeft:t="0",paddingRight:s="0"})=>e.max-e.min-parseFloat(t)-parseFloat(s),height:({y:e},{paddingTop:t="0",paddingBottom:s="0"})=>e.max-e.min-parseFloat(t)-parseFloat(s),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:(e,{transform:t})=>wn(t,"x"),y:(e,{transform:t})=>wn(t,"y")};et.translateX=et.x;et.translateY=et.y;const xt=new Set;let Sn=!1,Tn=!1,kn=!1;function wr(){if(Tn){const e=Array.from(xt).filter(n=>n.needsMeasurement),t=new Set(e.map(n=>n.element)),s=new Map;t.forEach(n=>{const a=_p(n);a.length&&(s.set(n,a),n.render())}),e.forEach(n=>n.measureInitialState()),t.forEach(n=>{n.render();const a=s.get(n);a&&a.forEach(([i,o])=>{var r;(r=n.getValue(i))==null||r.set(o)})}),e.forEach(n=>n.measureEndState()),e.forEach(n=>{n.suspendedScrollY!==void 0&&window.scrollTo(0,n.suspendedScrollY)})}Tn=!1,Sn=!1,xt.forEach(e=>e.complete(kn)),xt.clear()}function Sr(){xt.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(Tn=!0)})}function wp(){kn=!0,Sr(),wr(),kn=!1}class wa{constructor(t,s,n,a,i,o=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...t],this.onComplete=s,this.name=n,this.motionValue=a,this.element=i,this.isAsync=o}scheduleResolve(){this.state="scheduled",this.isAsync?(xt.add(this),Sn||(Sn=!0,Q.read(Sr),Q.resolveKeyframes(wr))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:s,element:n,motionValue:a}=this;if(t[0]===null){const i=a==null?void 0:a.get(),o=t[t.length-1];if(i!==void 0)t[0]=i;else if(n&&s){const r=n.readValue(s,o);r!=null&&(t[0]=r)}t[0]===void 0&&(t[0]=o),a&&i===void 0&&a.set(t[0])}mp(t)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(t=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,t),xt.delete(this)}cancel(){this.state==="scheduled"&&(xt.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const Sp=e=>e.startsWith("--");function Tr(e,t,s){Sp(t)?e.style.setProperty(t,s):e.style[t]=s}const Tp={};function kr(e,t){const s=Qo(e);return()=>Tp[t]??s()}const kp=kr(()=>window.ScrollTimeline!==void 0,"scrollTimeline"),Ar=kr(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),Ut=([e,t,s,n])=>`cubic-bezier(${e}, ${t}, ${s}, ${n})`,si={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Ut([0,.65,.55,1]),circOut:Ut([.55,0,1,.45]),backIn:Ut([.31,.01,.66,-.59]),backOut:Ut([.33,1.53,.69,.99])};function Cr(e,t){if(e)return typeof e=="function"?Ar()?br(e,t):"ease-out":cr(e)?Ut(e):Array.isArray(e)?e.map(s=>Cr(s,t)||si.easeOut):si[e]}function Ap(e,t,s,{delay:n=0,duration:a=300,repeat:i=0,repeatType:o="loop",ease:r="easeOut",times:u}={},l=void 0){const c={[t]:s};u&&(c.offset=u);const d=Cr(r,a);Array.isArray(d)&&(c.easing=d);const p={delay:n,duration:a,easing:Array.isArray(d)?"linear":d,fill:"both",iterations:i+1,direction:o==="reverse"?"alternate":"normal"};return l&&(p.pseudoElement=l),e.animate(c,p)}function Er(e){return typeof e=="function"&&"applyToOptions"in e}function Cp({type:e,...t}){return Er(e)&&Ar()?e.applyToOptions(t):(t.duration??(t.duration=300),t.ease??(t.ease="easeOut"),t)}class Pr extends xa{constructor(t){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!t)return;const{element:s,name:n,keyframes:a,pseudoElement:i,allowFlatten:o=!1,finalKeyframe:r,onComplete:u}=t;this.isPseudoElement=!!i,this.allowFlatten=o,this.options=t,ua(typeof t.type!="string");const l=Cp(t);this.animation=Ap(s,n,a,l,i),l.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!i){const c=ba(a,this.options,r,this.speed);this.updateMotionValue&&this.updateMotionValue(c),Tr(s,n,c),this.animation.cancel()}u==null||u(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){var t,s;(s=(t=this.animation).finish)==null||s.call(t)}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:t}=this;t==="idle"||t==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){var s,n,a;const t=(s=this.options)==null?void 0:s.element;!this.isPseudoElement&&(t!=null&&t.isConnected)&&((a=(n=this.animation).commitStyles)==null||a.call(n))}get duration(){var s,n;const t=((n=(s=this.animation.effect)==null?void 0:s.getComputedTiming)==null?void 0:n.call(s).duration)||0;return Re(Number(t))}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+Re(t)}get time(){return Re(Number(this.animation.currentTime)||0)}set time(t){const s=this.finishedTime!==null;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=$e(t),s&&this.animation.pause()}get speed(){return this.animation.playbackRate}set speed(t){t<0&&(this.finishedTime=null),this.animation.playbackRate=t}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(t){this.manualStartTime=this.animation.startTime=t}attachTimeline({timeline:t,rangeStart:s,rangeEnd:n,observe:a}){var i;return this.allowFlatten&&((i=this.animation.effect)==null||i.updateTiming({easing:"linear"})),this.animation.onfinish=null,t&&kp()?(this.animation.timeline=t,s&&(this.animation.rangeStart=s),n&&(this.animation.rangeEnd=n),De):a(this)}}const Ir={anticipate:or,backInOut:ir,circInOut:lr};function Ep(e){return e in Ir}function Pp(e){typeof e.ease=="string"&&Ep(e.ease)&&(e.ease=Ir[e.ease])}const Js=10;class Ip extends Pr{constructor(t){Pp(t),_r(t),super(t),t.startTime!==void 0&&t.autoplay!==!1&&(this.startTime=t.startTime),this.options=t}updateMotionValue(t){const{motionValue:s,onUpdate:n,onComplete:a,element:i,...o}=this.options;if(!s)return;if(t!==void 0){s.set(t);return}const r=new _a({...o,autoplay:!1}),u=Math.max(Js,_e.now()-this.startTime),l=Ue(0,Js,u-Js),c=r.sample(u).value,{name:d}=this.options;i&&d&&Tr(i,d,c),s.setWithVelocity(r.sample(Math.max(0,u-l)).value,c,l),r.stop()}}const ni=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(Ne.test(e)||e==="0")&&!e.startsWith("url("));function Mp(e){const t=e[0];if(e.length===1)return!0;for(let s=0;s<e.length;s++)if(e[s]!==t)return!0}function Rp(e,t,s,n){const a=e[0];if(a===null)return!1;if(t==="display"||t==="visibility")return!0;const i=e[e.length-1],o=ni(a,t),r=ni(i,t);return!o||!r?!1:Mp(e)||(s==="spring"||Er(s))&&n}function An(e){e.duration=0,e.type="keyframes"}const Dp=new Set(["opacity","clipPath","filter","transform"]),$p=Qo(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function Vp(e){var c;const{motionValue:t,name:s,repeatDelay:n,repeatType:a,damping:i,type:o}=e;if(!(((c=t==null?void 0:t.owner)==null?void 0:c.current)instanceof HTMLElement))return!1;const{onUpdate:u,transformTemplate:l}=t.owner.getProps();return $p()&&s&&Dp.has(s)&&(s!=="transform"||!l)&&!u&&!n&&a!=="mirror"&&i!==0&&o!=="inertia"}const Op=40;class Lp extends xa{constructor({autoplay:t=!0,delay:s=0,type:n="keyframes",repeat:a=0,repeatDelay:i=0,repeatType:o="loop",keyframes:r,name:u,motionValue:l,element:c,...d}){var y;super(),this.stop=()=>{var _,v;this._animation&&(this._animation.stop(),(_=this.stopTimeline)==null||_.call(this)),(v=this.keyframeResolver)==null||v.cancel()},this.createdAt=_e.now();const p={autoplay:t,delay:s,type:n,repeat:a,repeatDelay:i,repeatType:o,name:u,motionValue:l,element:c,...d},f=(c==null?void 0:c.KeyframeResolver)||wa;this.keyframeResolver=new f(r,(_,v,h)=>this.onKeyframesResolved(_,v,p,!h),u,l,c),(y=this.keyframeResolver)==null||y.scheduleResolve()}onKeyframesResolved(t,s,n,a){var v,h;this.keyframeResolver=void 0;const{name:i,type:o,velocity:r,delay:u,isHandoff:l,onUpdate:c}=n;this.resolvedAt=_e.now(),Rp(t,i,o,r)||((Ze.instantAnimations||!u)&&(c==null||c(ba(t,n,s))),t[0]=t[t.length-1],An(n),n.repeat=0);const p={startTime:a?this.resolvedAt?this.resolvedAt-this.createdAt>Op?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:s,...n,keyframes:t},f=!l&&Vp(p),y=(h=(v=p.motionValue)==null?void 0:v.owner)==null?void 0:h.current,_=f?new Ip({...p,element:y}):new _a(p);_.finished.then(()=>{this.notifyFinished()}).catch(De),this.pendingTimeline&&(this.stopTimeline=_.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=_}get finished(){return this._animation?this.animation.finished:this._finished}then(t,s){return this.finished.finally(t).then(()=>{})}get animation(){var t;return this._animation||((t=this.keyframeResolver)==null||t.resume(),wp()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(t){this.animation.time=t}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(t){this.animation.speed=t}get startTime(){return this.animation.startTime}attachTimeline(t){return this._animation?this.stopTimeline=this.animation.attachTimeline(t):this.pendingTimeline=t,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){var t;this._animation&&this.animation.cancel(),(t=this.keyframeResolver)==null||t.cancel()}}function Mr(e,t,s,n=0,a=1){const i=Array.from(e).sort((l,c)=>l.sortNodePosition(c)).indexOf(t),o=e.size,r=(o-1)*n;return typeof s=="function"?s(i,o):a===1?i*n:r-i*n}const Bp=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function Np(e){const t=Bp.exec(e);if(!t)return[,];const[,s,n,a]=t;return[`--${s??n}`,a]}function Rr(e,t,s=1){const[n,a]=Np(e);if(!n)return;const i=window.getComputedStyle(t).getPropertyValue(n);if(i){const o=i.trim();return Yo(o)?parseFloat(o):o}return ma(a)?Rr(a,t,s+1):a}const jp={type:"spring",stiffness:500,damping:25,restSpeed:10},Fp=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),zp={type:"keyframes",duration:.8},qp={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},Up=(e,{keyframes:t})=>t.length>2?zp:Bt.has(e)?e.startsWith("scale")?Fp(t[1]):jp:qp,Hp=e=>e!==null;function Gp(e,{repeat:t,repeatType:s="loop"},n){const a=e.filter(Hp),i=t&&s!=="loop"&&t%2===1?0:a.length-1;return a[i]}function Dr(e,t){if(e!=null&&e.inherit&&t){const{inherit:s,...n}=e;return{...t,...n}}return e}function Sa(e,t){const s=(e==null?void 0:e[t])??(e==null?void 0:e.default)??e;return s!==e?Dr(s,e):s}function Zp({when:e,delay:t,delayChildren:s,staggerChildren:n,staggerDirection:a,repeat:i,repeatType:o,repeatDelay:r,from:u,elapsed:l,...c}){return!!Object.keys(c).length}const Ta=(e,t,s,n={},a,i)=>o=>{const r=Sa(n,e)||{},u=r.delay||n.delay||0;let{elapsed:l=0}=n;l=l-$e(u);const c={keyframes:Array.isArray(s)?s:[null,s],ease:"easeOut",velocity:t.getVelocity(),...r,delay:-l,onUpdate:p=>{t.set(p),r.onUpdate&&r.onUpdate(p)},onComplete:()=>{o(),r.onComplete&&r.onComplete()},name:e,motionValue:t,element:i?void 0:a};Zp(r)||Object.assign(c,Up(e,c)),c.duration&&(c.duration=$e(c.duration)),c.repeatDelay&&(c.repeatDelay=$e(c.repeatDelay)),c.from!==void 0&&(c.keyframes[0]=c.from);let d=!1;if((c.type===!1||c.duration===0&&!c.repeatDelay)&&(An(c),c.delay===0&&(d=!0)),(Ze.instantAnimations||Ze.skipAnimations||a!=null&&a.shouldSkipAnimations)&&(d=!0,An(c),c.delay=0),c.allowFlatten=!r.type&&!r.ease,d&&!i&&t.get()!==void 0){const p=Gp(c.keyframes,r);if(p!==void 0){Q.update(()=>{c.onUpdate(p),c.onComplete()});return}}return r.isSync?new _a(c):new Lp(c)};function ai(e){const t=[{},{}];return e==null||e.values.forEach((s,n)=>{t[0][n]=s.get(),t[1][n]=s.getVelocity()}),t}function $r(e,t,s,n){if(typeof t=="function"){const[a,i]=ai(n);t=t(s!==void 0?s:e.custom,a,i)}if(typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"){const[a,i]=ai(n);t=t(s!==void 0?s:e.custom,a,i)}return t}function It(e,t,s){const n=e.getProps();return $r(n,t,s!==void 0?s:n.custom,e)}const Vr=new Set(["width","height","top","left","right","bottom",...Lt]),ii=30,Wp=e=>!isNaN(parseFloat(e));class Kp{constructor(t,s={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=n=>{var i;const a=_e.now();if(this.updatedAt!==a&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(n),this.current!==this.prev&&((i=this.events.change)==null||i.notify(this.current),this.dependents))for(const o of this.dependents)o.dirty()},this.hasAnimated=!1,this.setCurrent(t),this.owner=s.owner}setCurrent(t){this.current=t,this.updatedAt=_e.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=Wp(this.current))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,s){this.events[t]||(this.events[t]=new ca);const n=this.events[t].add(s);return t==="change"?()=>{n(),Q.read(()=>{this.events.change.getSize()||this.stop()})}:n}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,s){this.passiveEffect=t,this.stopPassiveEffect=s}set(t){this.passiveEffect?this.passiveEffect(t,this.updateAndNotify):this.updateAndNotify(t)}setWithVelocity(t,s,n){this.set(s),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-n}jump(t,s=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,s&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){var t;(t=this.events.change)==null||t.notify(this.current)}addDependent(t){this.dependents||(this.dependents=new Set),this.dependents.add(t)}removeDependent(t){this.dependents&&this.dependents.delete(t)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const t=_e.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>ii)return 0;const s=Math.min(this.updatedAt-this.prevUpdatedAt,ii);return er(parseFloat(this.current)-parseFloat(this.prevFrameValue),s)}start(t){return this.stop(),new Promise(s=>{this.hasAnimated=!0,this.animation=t(s),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){var t,s;(t=this.dependents)==null||t.clear(),(s=this.events.destroy)==null||s.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Rt(e,t){return new Kp(e,t)}const Yp=e=>Array.isArray(e);function Xp(e,t,s){e.hasValue(t)?e.getValue(t).set(s):e.addValue(t,Rt(s))}function Jp(e){return Yp(e)?e[e.length-1]||0:e}function Qp(e,t){const s=It(e,t);let{transitionEnd:n={},transition:a={},...i}=s||{};i={...i,...n};for(const o in i){const r=Jp(i[o]);Xp(e,o,r)}}const ve=e=>!!(e&&e.getVelocity);function ef(e){return!!(ve(e)&&e.add)}function Cn(e,t){const s=e.getValue("willChange");if(ef(s))return s.add(t);if(!s&&Ze.WillChange){const n=new Ze.WillChange("auto");e.addValue("willChange",n),n.add(t)}}function ka(e){return e.replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`)}const tf="framerAppearId",sf="data-"+ka(tf);function Or(e){return e.props[sf]}function nf({protectedKeys:e,needsAnimating:t},s){const n=e.hasOwnProperty(s)&&t[s]!==!0;return t[s]=!1,n}function Lr(e,t,{delay:s=0,transitionOverride:n,type:a}={}){let{transition:i,transitionEnd:o,...r}=t;const u=e.getDefaultTransition();i=i?Dr(i,u):u;const l=i==null?void 0:i.reduceMotion;n&&(i=n);const c=[],d=a&&e.animationState&&e.animationState.getState()[a];for(const p in r){const f=e.getValue(p,e.latestValues[p]??null),y=r[p];if(y===void 0||d&&nf(d,p))continue;const _={delay:s,...Sa(i||{},p)},v=f.get();if(v!==void 0&&!f.isAnimating&&!Array.isArray(y)&&y===v&&!_.velocity)continue;let h=!1;if(window.MotionHandoffAnimation){const D=Or(e);if(D){const R=window.MotionHandoffAnimation(D,p,Q);R!==null&&(_.startTime=R,h=!0)}}Cn(e,p);const C=l??e.shouldReduceMotion;f.start(Ta(p,f,y,C&&Vr.has(p)?{type:!1}:_,e,h));const m=f.animation;m&&c.push(m)}if(o){const p=()=>Q.update(()=>{o&&Qp(e,o)});c.length?Promise.all(c).then(p):p()}return c}function En(e,t,s={}){var u;const n=It(e,t,s.type==="exit"?(u=e.presenceContext)==null?void 0:u.custom:void 0);let{transition:a=e.getDefaultTransition()||{}}=n||{};s.transitionOverride&&(a=s.transitionOverride);const i=n?()=>Promise.all(Lr(e,n,s)):()=>Promise.resolve(),o=e.variantChildren&&e.variantChildren.size?(l=0)=>{const{delayChildren:c=0,staggerChildren:d,staggerDirection:p}=a;return af(e,t,l,c,d,p,s)}:()=>Promise.resolve(),{when:r}=a;if(r){const[l,c]=r==="beforeChildren"?[i,o]:[o,i];return l().then(()=>c())}else return Promise.all([i(),o(s.delay)])}function af(e,t,s=0,n=0,a=0,i=1,o){const r=[];for(const u of e.variantChildren)u.notify("AnimationStart",t),r.push(En(u,t,{...o,delay:s+(typeof n=="function"?0:n)+Mr(e.variantChildren,u,n,a,i)}).then(()=>u.notify("AnimationComplete",t)));return Promise.all(r)}function of(e,t,s={}){e.notify("AnimationStart",t);let n;if(Array.isArray(t)){const a=t.map(i=>En(e,i,s));n=Promise.all(a)}else if(typeof t=="string")n=En(e,t,s);else{const a=typeof t=="function"?It(e,t,s.custom):t;n=Promise.all(Lr(e,a,s))}return n.then(()=>{e.notify("AnimationComplete",t)})}const rf={test:e=>e==="auto",parse:e=>e},Br=e=>t=>t.test(e),Nr=[Ot,L,qe,Je,Md,Id,rf],oi=e=>Nr.find(Br(e));function lf(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||Jo(e):!0}const uf=new Set(["brightness","contrast","saturate","opacity"]);function cf(e){const[t,s]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[n]=s.match(ha)||[];if(!n)return e;const a=s.replace(n,"");let i=uf.has(t)?1:0;return n!==s&&(i*=100),t+"("+i+a+")"}const df=/\b([a-z-]*)\(.*?\)/gu,Pn={...Ne,getAnimatableNone:e=>{const t=e.match(df);return t?t.map(cf).join(" "):e}},In={...Ne,getAnimatableNone:e=>{const t=Ne.parse(e);return Ne.createTransformer(e)(t.map(n=>typeof n=="number"?0:typeof n=="object"?{...n,alpha:1}:n))}},ri={...Ot,transform:Math.round},pf={rotate:Je,rotateX:Je,rotateY:Je,rotateZ:Je,scale:xs,scaleX:xs,scaleY:xs,scaleZ:xs,skew:Je,skewX:Je,skewY:Je,distance:L,translateX:L,translateY:L,translateZ:L,x:L,y:L,z:L,perspective:L,transformPerspective:L,opacity:Qt,originX:Ga,originY:Ga,originZ:L},Aa={borderWidth:L,borderTopWidth:L,borderRightWidth:L,borderBottomWidth:L,borderLeftWidth:L,borderRadius:L,borderTopLeftRadius:L,borderTopRightRadius:L,borderBottomRightRadius:L,borderBottomLeftRadius:L,width:L,maxWidth:L,height:L,maxHeight:L,top:L,right:L,bottom:L,left:L,inset:L,insetBlock:L,insetBlockStart:L,insetBlockEnd:L,insetInline:L,insetInlineStart:L,insetInlineEnd:L,padding:L,paddingTop:L,paddingRight:L,paddingBottom:L,paddingLeft:L,paddingBlock:L,paddingBlockStart:L,paddingBlockEnd:L,paddingInline:L,paddingInlineStart:L,paddingInlineEnd:L,margin:L,marginTop:L,marginRight:L,marginBottom:L,marginLeft:L,marginBlock:L,marginBlockStart:L,marginBlockEnd:L,marginInline:L,marginInlineStart:L,marginInlineEnd:L,fontSize:L,backgroundPositionX:L,backgroundPositionY:L,...pf,zIndex:ri,fillOpacity:Qt,strokeOpacity:Qt,numOctaves:ri},ff={...Aa,color:ue,backgroundColor:ue,outlineColor:ue,fill:ue,stroke:ue,borderColor:ue,borderTopColor:ue,borderRightColor:ue,borderBottomColor:ue,borderLeftColor:ue,filter:Pn,WebkitFilter:Pn,mask:In,WebkitMask:In},jr=e=>ff[e],mf=new Set([Pn,In]);function Fr(e,t){let s=jr(e);return mf.has(s)||(s=Ne),s.getAnimatableNone?s.getAnimatableNone(t):void 0}const hf=new Set(["auto","none","0"]);function gf(e,t,s){let n=0,a;for(;n<e.length&&!a;){const i=e[n];typeof i=="string"&&!hf.has(i)&&Mt(i).values.length&&(a=e[n]),n++}if(a&&s)for(const i of t)e[i]=Fr(s,a)}class yf extends wa{constructor(t,s,n,a,i){super(t,s,n,a,i,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:s,name:n}=this;if(!s||!s.current)return;super.readKeyframes();for(let c=0;c<t.length;c++){let d=t[c];if(typeof d=="string"&&(d=d.trim(),ma(d))){const p=Rr(d,s.current);p!==void 0&&(t[c]=p),c===t.length-1&&(this.finalKeyframe=d)}}if(this.resolveNoneKeyframes(),!Vr.has(n)||t.length!==2)return;const[a,i]=t,o=oi(a),r=oi(i),u=Ha(a),l=Ha(i);if(u!==l&&et[n]){this.needsMeasurement=!0;return}if(o!==r)if(ti(o)&&ti(r))for(let c=0;c<t.length;c++){const d=t[c];typeof d=="string"&&(t[c]=parseFloat(d))}else et[n]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:s}=this,n=[];for(let a=0;a<t.length;a++)(t[a]===null||lf(t[a]))&&n.push(a);n.length&&gf(t,n,s)}measureInitialState(){const{element:t,unresolvedKeyframes:s,name:n}=this;if(!t||!t.current)return;n==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=et[n](t.measureViewportBox(),window.getComputedStyle(t.current)),s[0]=this.measuredOrigin;const a=s[s.length-1];a!==void 0&&t.getValue(n,a).jump(a,!1)}measureEndState(){var r;const{element:t,name:s,unresolvedKeyframes:n}=this;if(!t||!t.current)return;const a=t.getValue(s);a&&a.jump(this.measuredOrigin,!1);const i=n.length-1,o=n[i];n[i]=et[s](t.measureViewportBox(),window.getComputedStyle(t.current)),o!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=o),(r=this.removedTransforms)!=null&&r.length&&this.removedTransforms.forEach(([u,l])=>{t.getValue(u).set(l)}),this.resolveNoneKeyframes()}}const vf=new Set(["opacity","clipPath","filter","transform"]);function zr(e,t,s){if(e==null)return[];if(e instanceof EventTarget)return[e];if(typeof e=="string"){let n=document;const a=(s==null?void 0:s[e])??n.querySelectorAll(e);return a?Array.from(a):[]}return Array.from(e).filter(n=>n!=null)}const qr=(e,t)=>t&&typeof e=="number"?t.transform(e):e;function bf(e){return Xo(e)&&"offsetHeight"in e}const{schedule:Ur}=dr(queueMicrotask,!1),xf={y:!1};function _f(){return xf.y}function Hr(e,t){const s=zr(e),n=new AbortController,a={passive:!0,...t,signal:n.signal};return[s,a,()=>n.abort()]}function wf(e){return!(e.pointerType==="touch"||_f())}function Sf(e,t,s={}){const[n,a,i]=Hr(e,s);return n.forEach(o=>{let r=!1,u=!1,l;const c=()=>{o.removeEventListener("pointerleave",y)},d=v=>{l&&(l(v),l=void 0),c()},p=v=>{r=!1,window.removeEventListener("pointerup",p),window.removeEventListener("pointercancel",p),u&&(u=!1,d(v))},f=()=>{r=!0,window.addEventListener("pointerup",p,a),window.addEventListener("pointercancel",p,a)},y=v=>{if(v.pointerType!=="touch"){if(r){u=!0;return}d(v)}},_=v=>{if(!wf(v))return;u=!1;const h=t(o,v);typeof h=="function"&&(l=h,o.addEventListener("pointerleave",y,a))};o.addEventListener("pointerenter",_,a),o.addEventListener("pointerdown",f,a)}),i}const Gr=(e,t)=>t?e===t?!0:Gr(e,t.parentElement):!1,Tf=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1,kf=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function Af(e){return kf.has(e.tagName)||e.isContentEditable===!0}const Ts=new WeakSet;function li(e){return t=>{t.key==="Enter"&&e(t)}}function Qs(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const Cf=(e,t)=>{const s=e.currentTarget;if(!s)return;const n=li(()=>{if(Ts.has(s))return;Qs(s,"down");const a=li(()=>{Qs(s,"up")}),i=()=>Qs(s,"cancel");s.addEventListener("keyup",a,t),s.addEventListener("blur",i,t)});s.addEventListener("keydown",n,t),s.addEventListener("blur",()=>s.removeEventListener("keydown",n),t)};function ui(e){return Tf(e)&&!0}const ci=new WeakSet;function Ef(e,t,s={}){const[n,a,i]=Hr(e,s),o=r=>{const u=r.currentTarget;if(!ui(r)||ci.has(r))return;Ts.add(u),s.stopPropagation&&ci.add(r);const l=t(u,r),c=(f,y)=>{window.removeEventListener("pointerup",d),window.removeEventListener("pointercancel",p),Ts.has(u)&&Ts.delete(u),ui(f)&&typeof l=="function"&&l(f,{success:y})},d=f=>{c(f,u===window||u===document||s.useGlobalTarget||Gr(u,f.target))},p=f=>{c(f,!1)};window.addEventListener("pointerup",d,a),window.addEventListener("pointercancel",p,a)};return n.forEach(r=>{(s.useGlobalTarget?window:r).addEventListener("pointerdown",o,a),bf(r)&&(r.addEventListener("focus",l=>Cf(l,a)),!Af(r)&&!r.hasAttribute("tabindex")&&(r.tabIndex=0))}),i}function Zr(e){return Xo(e)&&"ownerSVGElement"in e}function Pf(e){return Zr(e)&&e.tagName==="svg"}const If=[...Nr,ue,Ne],Mf=e=>If.find(Br(e)),di=()=>({translate:0,scale:1,origin:0,originPoint:0}),At=()=>({x:di(),y:di()}),pi=()=>({min:0,max:0}),de=()=>({x:pi(),y:pi()}),Rf=new WeakMap;function Ca(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}function js(e){return typeof e=="string"||Array.isArray(e)}const Df=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],$f=["initial",...Df];function Wr(e){return Ca(e.animate)||$f.some(t=>js(e[t]))}function Vf(e){return!!(Wr(e)||e.variants)}function Of(e,t,s){for(const n in t){const a=t[n],i=s[n];if(ve(a))e.addValue(n,a);else if(ve(i))e.addValue(n,Rt(a,{owner:e}));else if(i!==a)if(e.hasValue(n)){const o=e.getValue(n);o.liveStyle===!0?o.jump(a):o.hasAnimated||o.set(a)}else{const o=e.getStaticValue(n);e.addValue(n,Rt(o!==void 0?o:a,{owner:e}))}}for(const n in s)t[n]===void 0&&e.removeValue(n);return t}const Mn={current:null},Kr={current:!1},Lf=typeof window<"u";function Bf(){if(Kr.current=!0,!!Lf)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>Mn.current=e.matches;e.addEventListener("change",t),t()}else Mn.current=!1}const fi=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];let mi={};class Nf{scrapeMotionValuesFromProps(t,s,n){return{}}constructor({parent:t,props:s,presenceContext:n,reducedMotionConfig:a,skipAnimations:i,blockInitialAnimation:o,visualState:r},u={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=wa,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.hasBeenMounted=!1,this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const f=_e.now();this.renderScheduledAt<f&&(this.renderScheduledAt=f,Q.render(this.render,!1,!0))};const{latestValues:l,renderState:c}=r;this.latestValues=l,this.baseTarget={...l},this.initialValues=s.initial?{...l}:{},this.renderState=c,this.parent=t,this.props=s,this.presenceContext=n,this.depth=t?t.depth+1:0,this.reducedMotionConfig=a,this.skipAnimationsConfig=i,this.options=u,this.blockInitialAnimation=!!o,this.isControllingVariants=Wr(s),this.isVariantNode=Vf(s),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(t&&t.current);const{willChange:d,...p}=this.scrapeMotionValuesFromProps(s,{},this);for(const f in p){const y=p[f];l[f]!==void 0&&ve(y)&&y.set(l[f])}}mount(t){var s,n;if(this.hasBeenMounted)for(const a in this.initialValues)(s=this.values.get(a))==null||s.jump(this.initialValues[a]),this.latestValues[a]=this.initialValues[a];this.current=t,Rf.set(t,this),this.projection&&!this.projection.instance&&this.projection.mount(t),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((a,i)=>this.bindToMotionValue(i,a)),this.reducedMotionConfig==="never"?this.shouldReduceMotion=!1:this.reducedMotionConfig==="always"?this.shouldReduceMotion=!0:(Kr.current||Bf(),this.shouldReduceMotion=Mn.current),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,(n=this.parent)==null||n.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){var t;this.projection&&this.projection.unmount(),st(this.notifyUpdate),st(this.render),this.valueSubscriptions.forEach(s=>s()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),(t=this.parent)==null||t.removeChild(this);for(const s in this.events)this.events[s].clear();for(const s in this.features){const n=this.features[s];n&&(n.unmount(),n.isMounted=!1)}this.current=null}addChild(t){this.children.add(t),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(t)}removeChild(t){this.children.delete(t),this.enteringChildren&&this.enteringChildren.delete(t)}bindToMotionValue(t,s){if(this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)(),s.accelerate&&vf.has(t)&&this.current instanceof HTMLElement){const{factory:o,keyframes:r,times:u,ease:l,duration:c}=s.accelerate,d=new Pr({element:this.current,name:t,keyframes:r,times:u,ease:l,duration:$e(c)}),p=o(d);this.valueSubscriptions.set(t,()=>{p(),d.cancel()});return}const n=Bt.has(t);n&&this.onBindTransform&&this.onBindTransform();const a=s.on("change",o=>{this.latestValues[t]=o,this.props.onUpdate&&Q.preRender(this.notifyUpdate),n&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let i;typeof window<"u"&&window.MotionCheckAppearSync&&(i=window.MotionCheckAppearSync(this,t,s)),this.valueSubscriptions.set(t,()=>{a(),i&&i(),s.owner&&s.stop()})}sortNodePosition(t){return!this.current||!this.sortInstanceNodePosition||this.type!==t.type?0:this.sortInstanceNodePosition(this.current,t.current)}updateFeatures(){let t="animation";for(t in mi){const s=mi[t];if(!s)continue;const{isEnabled:n,Feature:a}=s;if(!this.features[t]&&a&&n(this.props)&&(this.features[t]=new a(this)),this.features[t]){const i=this.features[t];i.isMounted?i.update():(i.mount(),i.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):de()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,s){this.latestValues[t]=s}update(t,s){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=s;for(let n=0;n<fi.length;n++){const a=fi[n];this.propEventSubscriptions[a]&&(this.propEventSubscriptions[a](),delete this.propEventSubscriptions[a]);const i="on"+a,o=t[i];o&&(this.propEventSubscriptions[a]=this.on(a,o))}this.prevMotionValues=Of(this,this.scrapeMotionValuesFromProps(t,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(t){return this.props.variants?this.props.variants[t]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(t){const s=this.getClosestVariantNode();if(s)return s.variantChildren&&s.variantChildren.add(t),()=>s.variantChildren.delete(t)}addValue(t,s){const n=this.values.get(t);s!==n&&(n&&this.removeValue(t),this.bindToMotionValue(t,s),this.values.set(t,s),this.latestValues[t]=s.get())}removeValue(t){this.values.delete(t);const s=this.valueSubscriptions.get(t);s&&(s(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,s){if(this.props.values&&this.props.values[t])return this.props.values[t];let n=this.values.get(t);return n===void 0&&s!==void 0&&(n=Rt(s===null?void 0:s,{owner:this}),this.addValue(t,n)),n}readValue(t,s){let n=this.latestValues[t]!==void 0||!this.current?this.latestValues[t]:this.getBaseTargetFromProps(this.props,t)??this.readValueFromInstance(this.current,t,this.options);return n!=null&&(typeof n=="string"&&(Yo(n)||Jo(n))?n=parseFloat(n):!Mf(n)&&Ne.test(s)&&(n=Fr(t,s)),this.setBaseTarget(t,ve(n)?n.get():n)),ve(n)?n.get():n}setBaseTarget(t,s){this.baseTarget[t]=s}getBaseTarget(t){var i;const{initial:s}=this.props;let n;if(typeof s=="string"||typeof s=="object"){const o=$r(this.props,s,(i=this.presenceContext)==null?void 0:i.custom);o&&(n=o[t])}if(s&&n!==void 0)return n;const a=this.getBaseTargetFromProps(this.props,t);return a!==void 0&&!ve(a)?a:this.initialValues[t]!==void 0&&n===void 0?void 0:this.baseTarget[t]}on(t,s){return this.events[t]||(this.events[t]=new ca),this.events[t].add(s)}notify(t,...s){this.events[t]&&this.events[t].notify(...s)}scheduleRenderMicrotask(){Ur.render(this.render)}}class Yr extends Nf{constructor(){super(...arguments),this.KeyframeResolver=yf}sortInstanceNodePosition(t,s){return t.compareDocumentPosition(s)&2?1:-1}getBaseTargetFromProps(t,s){const n=t.style;return n?n[s]:void 0}removeValueFromRenderState(t,{vars:s,style:n}){delete s[t],delete n[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;ve(t)&&(this.childSubscription=t.on("change",s=>{this.current&&(this.current.textContent=`${s}`)}))}}function Xr({top:e,left:t,right:s,bottom:n}){return{x:{min:t,max:s},y:{min:e,max:n}}}function jf({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function Ff(e,t){if(!t)return e;const s=t({x:e.left,y:e.top}),n=t({x:e.right,y:e.bottom});return{top:s.y,left:s.x,bottom:n.y,right:n.x}}function en(e){return e===void 0||e===1}function Rn({scale:e,scaleX:t,scaleY:s}){return!en(e)||!en(t)||!en(s)}function rt(e){return Rn(e)||Jr(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function Jr(e){return hi(e.x)||hi(e.y)}function hi(e){return e&&e!=="0%"}function Ms(e,t,s){const n=e-s,a=t*n;return s+a}function gi(e,t,s,n,a){return a!==void 0&&(e=Ms(e,a,n)),Ms(e,s,n)+t}function Dn(e,t=0,s=1,n,a){e.min=gi(e.min,t,s,n,a),e.max=gi(e.max,t,s,n,a)}function Qr(e,{x:t,y:s}){Dn(e.x,t.translate,t.scale,t.originPoint),Dn(e.y,s.translate,s.scale,s.originPoint)}const yi=.999999999999,vi=1.0000000000001;function zf(e,t,s,n=!1){var r;const a=s.length;if(!a)return;t.x=t.y=1;let i,o;for(let u=0;u<a;u++){i=s[u],o=i.projectionDelta;const{visualElement:l}=i.options;l&&l.props.style&&l.props.style.display==="contents"||(n&&i.options.layoutScroll&&i.scroll&&i!==i.root&&Et(e,{x:-i.scroll.offset.x,y:-i.scroll.offset.y}),o&&(t.x*=o.x.scale,t.y*=o.y.scale,Qr(e,o)),n&&rt(i.latestValues)&&Et(e,i.latestValues,(r=i.layout)==null?void 0:r.layoutBox))}t.x<vi&&t.x>yi&&(t.x=1),t.y<vi&&t.y>yi&&(t.y=1)}function Ct(e,t){e.min=e.min+t,e.max=e.max+t}function bi(e,t,s,n,a=.5){const i=ie(e.min,e.max,a);Dn(e,t,s,i,n)}function xi(e,t){return typeof e=="string"?parseFloat(e)/100*(t.max-t.min):e}function Et(e,t,s){const n=s??e;bi(e.x,xi(t.x,n.x),t.scaleX,t.scale,t.originX),bi(e.y,xi(t.y,n.y),t.scaleY,t.scale,t.originY)}function el(e,t){return Xr(Ff(e.getBoundingClientRect(),t))}function qf(e,t,s){const n=el(e,s),{scroll:a}=t;return a&&(Ct(n.x,a.offset.x),Ct(n.y,a.offset.y)),n}const Uf={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},Hf=Lt.length;function Gf(e,t,s){let n="",a=!0;for(let i=0;i<Hf;i++){const o=Lt[i],r=e[o];if(r===void 0)continue;let u=!0;if(typeof r=="number")u=r===(o.startsWith("scale")?1:0);else{const l=parseFloat(r);u=o.startsWith("scale")?l===1:l===0}if(!u||s){const l=qr(r,Aa[o]);if(!u){a=!1;const c=Uf[o]||o;n+=`${c}(${l}) `}s&&(t[o]=l)}}return n=n.trim(),s?n=s(t,a?"":n):a&&(n="none"),n}function Ea(e,t,s){const{style:n,vars:a,transformOrigin:i}=e;let o=!1,r=!1;for(const u in t){const l=t[u];if(Bt.has(u)){o=!0;continue}else if(fa(u)){a[u]=l;continue}else{const c=qr(l,Aa[u]);u.startsWith("origin")?(r=!0,i[u]=c):n[u]=c}}if(t.transform||(o||s?n.transform=Gf(t,e.transform,s):n.transform&&(n.transform="none")),r){const{originX:u="50%",originY:l="50%",originZ:c=0}=i;n.transformOrigin=`${u} ${l} ${c}`}}function tl(e,{style:t,vars:s},n,a){const i=e.style;let o;for(o in t)i[o]=t[o];a==null||a.applyProjectionStyles(i,n);for(o in s)i.setProperty(o,s[o])}function _i(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const ze={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(L.test(e))e=parseFloat(e);else return e;const s=_i(e,t.target.x),n=_i(e,t.target.y);return`${s}% ${n}%`}},sl={correct:(e,{treeScale:t,projectionDelta:s})=>{const n=e,a=Ne.parse(e);if(a.length>5)return n;const i=Ne.createTransformer(e),o=typeof a[0]!="number"?1:0,r=s.x.scale*t.x,u=s.y.scale*t.y;a[0+o]/=r,a[1+o]/=u;const l=ie(r,u,.5);return typeof a[2+o]=="number"&&(a[2+o]/=l),typeof a[3+o]=="number"&&(a[3+o]/=l),i(a)}},es={borderRadius:{...ze,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:ze,borderTopRightRadius:ze,borderBottomLeftRadius:ze,borderBottomRightRadius:ze,boxShadow:sl};function nl(e){for(const t in e)es[t]=e[t],fa(t)&&(es[t].isCSSVariable=!0)}function Zf(e,{layout:t,layoutId:s}){return Bt.has(e)||e.startsWith("origin")||(t||s!==void 0)&&(!!es[e]||e==="opacity")}function al(e,t,s){var o;const n=e.style,a=t==null?void 0:t.style,i={};if(!n)return i;for(const r in n)(ve(n[r])||a&&ve(a[r])||Zf(r,e)||((o=s==null?void 0:s.getValue(r))==null?void 0:o.liveStyle)!==void 0)&&(i[r]=n[r]);return i}function Wf(e){return window.getComputedStyle(e)}class Kf extends Yr{constructor(){super(...arguments),this.type="html",this.renderInstance=tl}readValueFromInstance(t,s){var n;if(Bt.has(s))return(n=this.projection)!=null&&n.isProjecting?_n(s):yp(t,s);{const a=Wf(t),i=(fa(s)?a.getPropertyValue(s):a[s])||0;return typeof i=="string"?i.trim():i}}measureInstanceViewportBox(t,{transformPagePoint:s}){return el(t,s)}build(t,s,n){Ea(t,s,n.transformTemplate)}scrapeMotionValuesFromProps(t,s,n){return al(t,s,n)}}const Yf={offset:"stroke-dashoffset",array:"stroke-dasharray"},Xf={offset:"strokeDashoffset",array:"strokeDasharray"};function Jf(e,t,s=1,n=0,a=!0){e.pathLength=1;const i=a?Yf:Xf;e[i.offset]=`${-n}`,e[i.array]=`${t} ${s}`}const Qf=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function il(e,{attrX:t,attrY:s,attrScale:n,pathLength:a,pathSpacing:i=1,pathOffset:o=0,...r},u,l,c){if(Ea(e,r,l),u){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};const{attrs:d,style:p}=e;d.transform&&(p.transform=d.transform,delete d.transform),(p.transform||d.transformOrigin)&&(p.transformOrigin=d.transformOrigin??"50% 50%",delete d.transformOrigin),p.transform&&(p.transformBox=(c==null?void 0:c.transformBox)??"fill-box",delete d.transformBox);for(const f of Qf)d[f]!==void 0&&(p[f]=d[f],delete d[f]);t!==void 0&&(d.x=t),s!==void 0&&(d.y=s),n!==void 0&&(d.scale=n),a!==void 0&&Jf(d,a,i,o,!1)}const Pa=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]),ol=e=>typeof e=="string"&&e.toLowerCase()==="svg";function em(e,t,s,n){tl(e,t,void 0,n);for(const a in t.attrs)e.setAttribute(Pa.has(a)?a:ka(a),t.attrs[a])}function tm(e,t,s){const n=al(e,t,s);for(const a in e)if(ve(e[a])||ve(t[a])){const i=Lt.indexOf(a)!==-1?"attr"+a.charAt(0).toUpperCase()+a.substring(1):a;n[i]=e[a]}return n}class sm extends Yr{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=de}getBaseTargetFromProps(t,s){return t[s]}readValueFromInstance(t,s){if(Bt.has(s)){const n=jr(s);return n&&n.default||0}return s=Pa.has(s)?s:ka(s),t.getAttribute(s)}scrapeMotionValuesFromProps(t,s,n){return tm(t,s,n)}build(t,s,n){il(t,s,this.isSVGTag,n.transformTemplate,n.style)}renderInstance(t,s,n,a){em(t,s,n,a)}mount(t){this.isSVGTag=ol(t.tagName),super.mount(t)}}function wi(e,t){e.min=t.min,e.max=t.max}function Oe(e,t){wi(e.x,t.x),wi(e.y,t.y)}function Si(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}const rl=1e-4,nm=1-rl,am=1+rl,ll=.01,im=0-ll,om=0+ll;function we(e){return e.max-e.min}function rm(e,t,s){return Math.abs(e-t)<=s}function Ti(e,t,s,n=.5){e.origin=n,e.originPoint=ie(t.min,t.max,e.origin),e.scale=we(s)/we(t),e.translate=ie(s.min,s.max,e.origin)-e.originPoint,(e.scale>=nm&&e.scale<=am||isNaN(e.scale))&&(e.scale=1),(e.translate>=im&&e.translate<=om||isNaN(e.translate))&&(e.translate=0)}function Wt(e,t,s,n){Ti(e.x,t.x,s.x,n?n.originX:void 0),Ti(e.y,t.y,s.y,n?n.originY:void 0)}function ki(e,t,s){e.min=s.min+t.min,e.max=e.min+we(t)}function lm(e,t,s){ki(e.x,t.x,s.x),ki(e.y,t.y,s.y)}function Ai(e,t,s){e.min=t.min-s.min,e.max=e.min+we(t)}function Rs(e,t,s){Ai(e.x,t.x,s.x),Ai(e.y,t.y,s.y)}function Ci(e,t,s,n,a){return e-=t,e=Ms(e,1/s,n),a!==void 0&&(e=Ms(e,1/a,n)),e}function um(e,t=0,s=1,n=.5,a,i=e,o=e){if(qe.test(t)&&(t=parseFloat(t),t=ie(o.min,o.max,t/100)-o.min),typeof t!="number")return;let r=ie(i.min,i.max,n);e===i&&(r-=t),e.min=Ci(e.min,t,s,r,a),e.max=Ci(e.max,t,s,r,a)}function Ei(e,t,[s,n,a],i,o){um(e,t[s],t[n],t[a],t.scale,i,o)}const cm=["x","scaleX","originX"],dm=["y","scaleY","originY"];function Pi(e,t,s,n){Ei(e.x,t,cm,s?s.x:void 0,n?n.x:void 0),Ei(e.y,t,dm,s?s.y:void 0,n?n.y:void 0)}function Ii(e){return e.translate===0&&e.scale===1}function ul(e){return Ii(e.x)&&Ii(e.y)}function Mi(e,t){return e.min===t.min&&e.max===t.max}function pm(e,t){return Mi(e.x,t.x)&&Mi(e.y,t.y)}function Ri(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function cl(e,t){return Ri(e.x,t.x)&&Ri(e.y,t.y)}function Di(e){return we(e.x)/we(e.y)}function $i(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}function Me(e){return[e("x"),e("y")]}function fm(e,t,s){let n="";const a=e.x.translate/t.x,i=e.y.translate/t.y,o=(s==null?void 0:s.z)||0;if((a||i||o)&&(n=`translate3d(${a}px, ${i}px, ${o}px) `),(t.x!==1||t.y!==1)&&(n+=`scale(${1/t.x}, ${1/t.y}) `),s){const{transformPerspective:l,rotate:c,rotateX:d,rotateY:p,skewX:f,skewY:y}=s;l&&(n=`perspective(${l}px) ${n}`),c&&(n+=`rotate(${c}deg) `),d&&(n+=`rotateX(${d}deg) `),p&&(n+=`rotateY(${p}deg) `),f&&(n+=`skewX(${f}deg) `),y&&(n+=`skewY(${y}deg) `)}const r=e.x.scale*t.x,u=e.y.scale*t.y;return(r!==1||u!==1)&&(n+=`scale(${r}, ${u})`),n||"none"}const dl=["TopLeft","TopRight","BottomLeft","BottomRight"],mm=dl.length,Vi=e=>typeof e=="string"?parseFloat(e):e,Oi=e=>typeof e=="number"||L.test(e);function hm(e,t,s,n,a,i){a?(e.opacity=ie(0,s.opacity??1,gm(n)),e.opacityExit=ie(t.opacity??1,0,ym(n))):i&&(e.opacity=ie(t.opacity??1,s.opacity??1,n));for(let o=0;o<mm;o++){const r=`border${dl[o]}Radius`;let u=Li(t,r),l=Li(s,r);if(u===void 0&&l===void 0)continue;u||(u=0),l||(l=0),u===0||l===0||Oi(u)===Oi(l)?(e[r]=Math.max(ie(Vi(u),Vi(l),n),0),(qe.test(l)||qe.test(u))&&(e[r]+="%")):e[r]=l}(t.rotate||s.rotate)&&(e.rotate=ie(t.rotate||0,s.rotate||0,n))}function Li(e,t){return e[t]!==void 0?e[t]:e.borderRadius}const gm=pl(0,.5,rr),ym=pl(.5,.95,De);function pl(e,t,s){return n=>n<e?0:n>t?1:s(Jt(e,t,n))}function vm(e,t,s){const n=ve(e)?e:Rt(e);return n.start(Ta("",n,t,s)),n.animation}function bm(e,t,s,n={passive:!0}){return e.addEventListener(t,s,n),()=>e.removeEventListener(t,s)}const xm=(e,t)=>e.depth-t.depth;class _m{constructor(){this.children=[],this.isDirty=!1}add(t){la(this.children,t),this.isDirty=!0}remove(t){Cs(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(xm),this.isDirty=!1,this.children.forEach(t)}}function wm(e,t){const s=_e.now(),n=({timestamp:a})=>{const i=a-s;i>=t&&(st(n),e(i-t))};return Q.setup(n,!0),()=>st(n)}function tn(e){return ve(e)?e.get():e}class Sm{constructor(){this.members=[]}add(t){la(this.members,t);for(let s=this.members.length-1;s>=0;s--){const n=this.members[s];if(n===t||n===this.lead||n===this.prevLead)continue;const a=n.instance;(!a||a.isConnected===!1)&&!n.snapshot&&(Cs(this.members,n),n.unmount())}t.scheduleRender()}remove(t){if(Cs(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const s=this.members[this.members.length-1];s&&this.promote(s)}}relegate(t){var s;for(let n=this.members.indexOf(t)-1;n>=0;n--){const a=this.members[n];if(a.isPresent!==!1&&((s=a.instance)==null?void 0:s.isConnected)!==!1)return this.promote(a),!0}return!1}promote(t,s){var a;const n=this.lead;if(t!==n&&(this.prevLead=n,this.lead=t,t.show(),n)){n.updateSnapshot(),t.scheduleRender();const{layoutDependency:i}=n.options,{layoutDependency:o}=t.options;(i===void 0||i!==o)&&(t.resumeFrom=n,s&&(n.preserveOpacity=!0),n.snapshot&&(t.snapshot=n.snapshot,t.snapshot.latestValues=n.animationValues||n.latestValues),(a=t.root)!=null&&a.isUpdating&&(t.isLayoutDirty=!0)),t.options.crossfade===!1&&n.hide()}}exitAnimationComplete(){this.members.forEach(t=>{var s,n,a,i,o;(n=(s=t.options).onExitComplete)==null||n.call(s),(o=(a=t.resumingFrom)==null?void 0:(i=a.options).onExitComplete)==null||o.call(i)})}scheduleRender(){this.members.forEach(t=>t.instance&&t.scheduleRender(!1))}removeLeadSnapshot(){var t;(t=this.lead)!=null&&t.snapshot&&(this.lead.snapshot=void 0)}}const ks={hasAnimatedSinceResize:!0,hasEverUpdated:!1},sn=["","X","Y","Z"],Tm=1e3;let km=0;function nn(e,t,s,n){const{latestValues:a}=t;a[e]&&(s[e]=a[e],t.setStaticValue(e,0),n&&(n[e]=0))}function fl(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const s=Or(t);if(window.MotionHasOptimisedAnimation(s,"transform")){const{layout:a,layoutId:i}=e.options;window.MotionCancelOptimisedAnimation(s,"transform",Q,!(a||i))}const{parent:n}=e;n&&!n.hasCheckedOptimisedAppear&&fl(n)}function ml({attachResizeListener:e,defaultParent:t,measureScroll:s,checkIsScrollRoot:n,resetTransform:a}){return class{constructor(o={},r=t==null?void 0:t()){this.id=km++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(Em),this.nodes.forEach(Rm),this.nodes.forEach(Dm),this.nodes.forEach(Pm)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=o,this.root=r?r.root||r:this,this.path=r?[...r.path,r]:[],this.parent=r,this.depth=r?r.depth+1:0;for(let u=0;u<this.path.length;u++)this.path[u].shouldResetTransform=!0;this.root===this&&(this.nodes=new _m)}addEventListener(o,r){return this.eventHandlers.has(o)||this.eventHandlers.set(o,new ca),this.eventHandlers.get(o).add(r)}notifyListeners(o,...r){const u=this.eventHandlers.get(o);u&&u.notify(...r)}hasListeners(o){return this.eventHandlers.has(o)}mount(o){if(this.instance)return;this.isSVG=Zr(o)&&!Pf(o),this.instance=o;const{layoutId:r,layout:u,visualElement:l}=this.options;if(l&&!l.current&&l.mount(o),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(u||r)&&(this.isLayoutDirty=!0),e){let c,d=0;const p=()=>this.root.updateBlockedByResize=!1;Q.read(()=>{d=window.innerWidth}),e(o,()=>{const f=window.innerWidth;f!==d&&(d=f,this.root.updateBlockedByResize=!0,c&&c(),c=wm(p,250),ks.hasAnimatedSinceResize&&(ks.hasAnimatedSinceResize=!1,this.nodes.forEach(ji)))})}r&&this.root.registerSharedNode(r,this),this.options.animate!==!1&&l&&(r||u)&&this.addEventListener("didUpdate",({delta:c,hasLayoutChanged:d,hasRelativeLayoutChanged:p,layout:f})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const y=this.options.transition||l.getDefaultTransition()||Bm,{onLayoutAnimationStart:_,onLayoutAnimationComplete:v}=l.getProps(),h=!this.targetLayout||!cl(this.targetLayout,f),C=!d&&p;if(this.options.layoutRoot||this.resumeFrom||C||d&&(h||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const m={...Sa(y,"layout"),onPlay:_,onComplete:v};(l.shouldReduceMotion||this.options.layoutRoot)&&(m.delay=0,m.type=!1),this.startAnimation(m),this.setAnimationOrigin(c,C)}else d||ji(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=f})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const o=this.getStack();o&&o.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),st(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach($m),this.animationId++)}getTransformTemplate(){const{visualElement:o}=this.options;return o&&o.getProps().transformTemplate}willUpdate(o=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&fl(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let c=0;c<this.path.length;c++){const d=this.path[c];d.shouldResetTransform=!0,(typeof d.latestValues.x=="string"||typeof d.latestValues.y=="string")&&(d.isLayoutDirty=!0),d.updateScroll("snapshot"),d.options.layoutRoot&&d.willUpdate(!1)}const{layoutId:r,layout:u}=this.options;if(r===void 0&&!u)return;const l=this.getTransformTemplate();this.prevTransformTemplateValue=l?l(this.latestValues,""):void 0,this.updateSnapshot(),o&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(Bi);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(Ni);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(Mm),this.nodes.forEach(Am),this.nodes.forEach(Cm)):this.nodes.forEach(Ni),this.clearAllSnapshots();const r=_e.now();me.delta=Ue(0,1e3/60,r-me.timestamp),me.timestamp=r,me.isProcessing=!0,Ws.update.process(me),Ws.preRender.process(me),Ws.render.process(me),me.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,Ur.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(Im),this.sharedNodes.forEach(Vm)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,Q.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){Q.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!we(this.snapshot.measuredBox.x)&&!we(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let u=0;u<this.path.length;u++)this.path[u].updateScroll();const o=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected=de(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:r}=this.options;r&&r.notify("LayoutMeasure",this.layout.layoutBox,o?o.layoutBox:void 0)}updateScroll(o="measure"){let r=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===o&&(r=!1),r&&this.instance){const u=n(this.instance);this.scroll={animationId:this.root.animationId,phase:o,isRoot:u,offset:s(this.instance),wasRoot:this.scroll?this.scroll.isRoot:u}}}resetTransform(){if(!a)return;const o=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,r=this.projectionDelta&&!ul(this.projectionDelta),u=this.getTransformTemplate(),l=u?u(this.latestValues,""):void 0,c=l!==this.prevTransformTemplateValue;o&&this.instance&&(r||rt(this.latestValues)||c)&&(a(this.instance,l),this.shouldResetTransform=!1,this.scheduleRender())}measure(o=!0){const r=this.measurePageBox();let u=this.removeElementScroll(r);return o&&(u=this.removeTransform(u)),Nm(u),{animationId:this.root.animationId,measuredBox:r,layoutBox:u,latestValues:{},source:this.id}}measurePageBox(){var l;const{visualElement:o}=this.options;if(!o)return de();const r=o.measureViewportBox();if(!(((l=this.scroll)==null?void 0:l.wasRoot)||this.path.some(jm))){const{scroll:c}=this.root;c&&(Ct(r.x,c.offset.x),Ct(r.y,c.offset.y))}return r}removeElementScroll(o){var u;const r=de();if(Oe(r,o),(u=this.scroll)!=null&&u.wasRoot)return r;for(let l=0;l<this.path.length;l++){const c=this.path[l],{scroll:d,options:p}=c;c!==this.root&&d&&p.layoutScroll&&(d.wasRoot&&Oe(r,o),Ct(r.x,d.offset.x),Ct(r.y,d.offset.y))}return r}applyTransform(o,r=!1){var l,c;const u=de();Oe(u,o);for(let d=0;d<this.path.length;d++){const p=this.path[d];!r&&p.options.layoutScroll&&p.scroll&&p!==p.root&&Et(u,{x:-p.scroll.offset.x,y:-p.scroll.offset.y}),rt(p.latestValues)&&Et(u,p.latestValues,(l=p.layout)==null?void 0:l.layoutBox)}return rt(this.latestValues)&&Et(u,this.latestValues,(c=this.layout)==null?void 0:c.layoutBox),u}removeTransform(o){var u;const r=de();Oe(r,o);for(let l=0;l<this.path.length;l++){const c=this.path[l];if(!rt(c.latestValues))continue;let d;c.instance&&(Rn(c.latestValues)&&c.updateSnapshot(),d=de(),Oe(d,c.measurePageBox())),Pi(r,c.latestValues,(u=c.snapshot)==null?void 0:u.layoutBox,d)}return rt(this.latestValues)&&Pi(r,this.latestValues),r}setTargetDelta(o){this.targetDelta=o,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(o){this.options={...this.options,...o,crossfade:o.crossfade!==void 0?o.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==me.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(o=!1){var f;const r=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=r.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=r.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=r.isSharedProjectionDirty);const u=!!this.resumingFrom||this!==r;if(!(o||u&&this.isSharedProjectionDirty||this.isProjectionDirty||(f=this.parent)!=null&&f.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:c,layoutId:d}=this.options;if(!this.layout||!(c||d))return;this.resolvedRelativeTargetAt=me.timestamp;const p=this.getClosestProjectingParent();p&&this.linkedParentVersion!==p.layoutVersion&&!p.options.layoutRoot&&this.removeRelativeTarget(),!this.targetDelta&&!this.relativeTarget&&(p&&p.layout?this.createRelativeTarget(p,this.layout.layoutBox,p.layout.layoutBox):this.removeRelativeTarget()),!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=de(),this.targetWithTransforms=de()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),lm(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):Oe(this.target,this.layout.layoutBox),Qr(this.target,this.targetDelta)):Oe(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,p&&!!p.resumingFrom==!!this.resumingFrom&&!p.options.layoutScroll&&p.target&&this.animationProgress!==1?this.createRelativeTarget(p,this.target,p.target):this.relativeParent=this.relativeTarget=void 0))}getClosestProjectingParent(){if(!(!this.parent||Rn(this.parent.latestValues)||Jr(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(o,r,u){this.relativeParent=o,this.linkedParentVersion=o.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=de(),this.relativeTargetOrigin=de(),Rs(this.relativeTargetOrigin,r,u),Oe(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){var y;const o=this.getLead(),r=!!this.resumingFrom||this!==o;let u=!0;if((this.isProjectionDirty||(y=this.parent)!=null&&y.isProjectionDirty)&&(u=!1),r&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(u=!1),this.resolvedRelativeTargetAt===me.timestamp&&(u=!1),u)return;const{layout:l,layoutId:c}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(l||c))return;Oe(this.layoutCorrected,this.layout.layoutBox);const d=this.treeScale.x,p=this.treeScale.y;zf(this.layoutCorrected,this.treeScale,this.path,r),o.layout&&!o.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(o.target=o.layout.layoutBox,o.targetWithTransforms=de());const{target:f}=o;if(!f){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(Si(this.prevProjectionDelta.x,this.projectionDelta.x),Si(this.prevProjectionDelta.y,this.projectionDelta.y)),Wt(this.projectionDelta,this.layoutCorrected,f,this.latestValues),(this.treeScale.x!==d||this.treeScale.y!==p||!$i(this.projectionDelta.x,this.prevProjectionDelta.x)||!$i(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",f))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(o=!0){var r;if((r=this.options.visualElement)==null||r.scheduleRender(),o){const u=this.getStack();u&&u.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=At(),this.projectionDelta=At(),this.projectionDeltaWithTransform=At()}setAnimationOrigin(o,r=!1){const u=this.snapshot,l=u?u.latestValues:{},c={...this.latestValues},d=At();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!r;const p=de(),f=u?u.source:void 0,y=this.layout?this.layout.source:void 0,_=f!==y,v=this.getStack(),h=!v||v.members.length<=1,C=!!(_&&!h&&this.options.crossfade===!0&&!this.path.some(Lm));this.animationProgress=0;let m;this.mixTargetDelta=D=>{const R=D/1e3;Fi(d.x,o.x,R),Fi(d.y,o.y,R),this.setTargetDelta(d),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Rs(p,this.layout.layoutBox,this.relativeParent.layout.layoutBox),Om(this.relativeTarget,this.relativeTargetOrigin,p,R),m&&pm(this.relativeTarget,m)&&(this.isProjectionDirty=!1),m||(m=de()),Oe(m,this.relativeTarget)),_&&(this.animationValues=c,hm(c,l,this.latestValues,R,C,h)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=R},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(o){var r,u,l;this.notifyListeners("animationStart"),(r=this.currentAnimation)==null||r.stop(),(l=(u=this.resumingFrom)==null?void 0:u.currentAnimation)==null||l.stop(),this.pendingAnimation&&(st(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Q.update(()=>{ks.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=Rt(0)),this.motionValue.jump(0,!1),this.currentAnimation=vm(this.motionValue,[0,1e3],{...o,velocity:0,isSync:!0,onUpdate:c=>{this.mixTargetDelta(c),o.onUpdate&&o.onUpdate(c)},onStop:()=>{},onComplete:()=>{o.onComplete&&o.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const o=this.getStack();o&&o.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(Tm),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const o=this.getLead();let{targetWithTransforms:r,target:u,layout:l,latestValues:c}=o;if(!(!r||!u||!l)){if(this!==o&&this.layout&&l&&hl(this.options.animationType,this.layout.layoutBox,l.layoutBox)){u=this.target||de();const d=we(this.layout.layoutBox.x);u.x.min=o.target.x.min,u.x.max=u.x.min+d;const p=we(this.layout.layoutBox.y);u.y.min=o.target.y.min,u.y.max=u.y.min+p}Oe(r,u),Et(r,c),Wt(this.projectionDeltaWithTransform,this.layoutCorrected,r,c)}}registerSharedNode(o,r){this.sharedNodes.has(o)||this.sharedNodes.set(o,new Sm),this.sharedNodes.get(o).add(r);const l=r.options.initialPromotionConfig;r.promote({transition:l?l.transition:void 0,preserveFollowOpacity:l&&l.shouldPreserveFollowOpacity?l.shouldPreserveFollowOpacity(r):void 0})}isLead(){const o=this.getStack();return o?o.lead===this:!0}getLead(){var r;const{layoutId:o}=this.options;return o?((r=this.getStack())==null?void 0:r.lead)||this:this}getPrevLead(){var r;const{layoutId:o}=this.options;return o?(r=this.getStack())==null?void 0:r.prevLead:void 0}getStack(){const{layoutId:o}=this.options;if(o)return this.root.sharedNodes.get(o)}promote({needsReset:o,transition:r,preserveFollowOpacity:u}={}){const l=this.getStack();l&&l.promote(this,u),o&&(this.projectionDelta=void 0,this.needsReset=!0),r&&this.setOptions({transition:r})}relegate(){const o=this.getStack();return o?o.relegate(this):!1}resetSkewAndRotation(){const{visualElement:o}=this.options;if(!o)return;let r=!1;const{latestValues:u}=o;if((u.z||u.rotate||u.rotateX||u.rotateY||u.rotateZ||u.skewX||u.skewY)&&(r=!0),!r)return;const l={};u.z&&nn("z",o,l,this.animationValues);for(let c=0;c<sn.length;c++)nn(`rotate${sn[c]}`,o,l,this.animationValues),nn(`skew${sn[c]}`,o,l,this.animationValues);o.render();for(const c in l)o.setStaticValue(c,l[c]),this.animationValues&&(this.animationValues[c]=l[c]);o.scheduleRender()}applyProjectionStyles(o,r){if(!this.instance||this.isSVG)return;if(!this.isVisible){o.visibility="hidden";return}const u=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,o.visibility="",o.opacity="",o.pointerEvents=tn(r==null?void 0:r.pointerEvents)||"",o.transform=u?u(this.latestValues,""):"none";return}const l=this.getLead();if(!this.projectionDelta||!this.layout||!l.target){this.options.layoutId&&(o.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,o.pointerEvents=tn(r==null?void 0:r.pointerEvents)||""),this.hasProjected&&!rt(this.latestValues)&&(o.transform=u?u({},""):"none",this.hasProjected=!1);return}o.visibility="";const c=l.animationValues||l.latestValues;this.applyTransformsToTarget();let d=fm(this.projectionDeltaWithTransform,this.treeScale,c);u&&(d=u(c,d)),o.transform=d;const{x:p,y:f}=this.projectionDelta;o.transformOrigin=`${p.origin*100}% ${f.origin*100}% 0`,l.animationValues?o.opacity=l===this?c.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:c.opacityExit:o.opacity=l===this?c.opacity!==void 0?c.opacity:"":c.opacityExit!==void 0?c.opacityExit:0;for(const y in es){if(c[y]===void 0)continue;const{correct:_,applyTo:v,isCSSVariable:h}=es[y],C=d==="none"?c[y]:_(c[y],l);if(v){const m=v.length;for(let D=0;D<m;D++)o[v[D]]=C}else h?this.options.visualElement.renderState.vars[y]=C:o[y]=C}this.options.layoutId&&(o.pointerEvents=l===this?tn(r==null?void 0:r.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(o=>{var r;return(r=o.currentAnimation)==null?void 0:r.stop()}),this.root.nodes.forEach(Bi),this.root.sharedNodes.clear()}}}function Am(e){e.updateLayout()}function Cm(e){var s;const t=((s=e.resumeFrom)==null?void 0:s.snapshot)||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners("didUpdate")){const{layoutBox:n,measuredBox:a}=e.layout,{animationType:i}=e.options,o=t.source!==e.layout.source;i==="size"?Me(d=>{const p=o?t.measuredBox[d]:t.layoutBox[d],f=we(p);p.min=n[d].min,p.max=p.min+f}):hl(i,t.layoutBox,n)&&Me(d=>{const p=o?t.measuredBox[d]:t.layoutBox[d],f=we(n[d]);p.max=p.min+f,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[d].max=e.relativeTarget[d].min+f)});const r=At();Wt(r,n,t.layoutBox);const u=At();o?Wt(u,e.applyTransform(a,!0),t.measuredBox):Wt(u,n,t.layoutBox);const l=!ul(r);let c=!1;if(!e.resumeFrom){const d=e.getClosestProjectingParent();if(d&&!d.resumeFrom){const{snapshot:p,layout:f}=d;if(p&&f){const y=de();Rs(y,t.layoutBox,p.layoutBox);const _=de();Rs(_,n,f.layoutBox),cl(y,_)||(c=!0),d.options.layoutRoot&&(e.relativeTarget=_,e.relativeTargetOrigin=y,e.relativeParent=d)}}}e.notifyListeners("didUpdate",{layout:n,snapshot:t,delta:u,layoutDelta:r,hasLayoutChanged:l,hasRelativeLayoutChanged:c})}else if(e.isLead()){const{onExitComplete:n}=e.options;n&&n()}e.options.transition=void 0}function Em(e){e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function Pm(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function Im(e){e.clearSnapshot()}function Bi(e){e.clearMeasurements()}function Ni(e){e.isLayoutDirty=!1}function Mm(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function ji(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function Rm(e){e.resolveTargetDelta()}function Dm(e){e.calcProjection()}function $m(e){e.resetSkewAndRotation()}function Vm(e){e.removeLeadSnapshot()}function Fi(e,t,s){e.translate=ie(t.translate,0,s),e.scale=ie(t.scale,1,s),e.origin=t.origin,e.originPoint=t.originPoint}function zi(e,t,s,n){e.min=ie(t.min,s.min,n),e.max=ie(t.max,s.max,n)}function Om(e,t,s,n){zi(e.x,t.x,s.x,n),zi(e.y,t.y,s.y,n)}function Lm(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const Bm={duration:.45,ease:[.4,0,.1,1]},qi=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),Ui=qi("applewebkit/")&&!qi("chrome/")?Math.round:De;function Hi(e){e.min=Ui(e.min),e.max=Ui(e.max)}function Nm(e){Hi(e.x),Hi(e.y)}function hl(e,t,s){return e==="position"||e==="preserve-aspect"&&!rm(Di(t),Di(s),.2)}function jm(e){var t;return e!==e.root&&((t=e.scroll)==null?void 0:t.wasRoot)}const Fm=ml({attachResizeListener:(e,t)=>bm(e,"resize",t),measureScroll:()=>{var e,t;return{x:document.documentElement.scrollLeft||((e=document.body)==null?void 0:e.scrollLeft)||0,y:document.documentElement.scrollTop||((t=document.body)==null?void 0:t.scrollTop)||0}},checkIsScrollRoot:()=>!0}),an={current:void 0},zm=ml({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!an.current){const e=new Fm({});e.mount(window),e.setOptions({layoutScroll:!0}),an.current=e}return an.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),qm={some:0,all:1};function Um(e,t,{root:s,margin:n,amount:a="some"}={}){const i=zr(e),o=new WeakMap,r=l=>{l.forEach(c=>{const d=o.get(c.target);if(c.isIntersecting!==!!d)if(c.isIntersecting){const p=t(c.target,c);typeof p=="function"?o.set(c.target,p):u.unobserve(c.target)}else typeof d=="function"&&(d(c),o.delete(c.target))})},u=new IntersectionObserver(r,{root:s,rootMargin:n,threshold:typeof a=="number"?a:qm[a]});return i.forEach(l=>u.observe(l)),()=>u.disconnect()}const Gi=(e,t)=>Math.abs(e-t);function Hm(e,t){const s=Gi(e.x,t.x),n=Gi(e.y,t.y);return Math.sqrt(s**2+n**2)}function gl({current:e}){return e?e.ownerDocument.defaultView:null}function $n(e){if(e)return e.nodeType===3||e.nodeType===8?$n(e.nextSibling):e}const[Gm,Zm,B_]=ls("Motion"),[Wm,N_,j_]=ls("LayoutGroup"),Km={reducedMotion:"never",transition:void 0,nonce:void 0},[Ym,F_,z_]=ls("MotionConfig");function Xm(){return Ym(P(()=>Km))}const Jm={motionAttribute:"data-ap"},Vn=[];function yl(e){for(const t of e)t&&!Vn.includes(t)&&Vn.push(t)}function vl(e,t,s){if(Array.isArray(e))return e.reduce((n,a)=>{const i=vl(a,t,s);return i?{...n,...i}:n},{});if(typeof e=="object")return e;if(e&&t){const n=t[e];return typeof n=="function"?n(s):n}}function Qm(e,t,s){const n=vl(e,t,s);if(!n)return;const{transition:a,transitionEnd:i,...o}=n;return{...o,...i}}function eh(e,t){var a;const s=(e.initial===void 0&&e.variants?t==null?void 0:t.initial:e.initial)===!1?["initial","animate"]:["initial"],n=e.custom??((a=e.presenceContext)==null?void 0:a.custom);return s.reduce((i,o)=>({...i,...Qm(e[o]||(t==null?void 0:t[o]),e.variants,n)}),{})}function bl(e,t){const s=t==null?void 0:t.length;if(s!==e.length)return!1;for(let n=0;n<s;n++)if(t[n]!==e[n])return!1;return!0}var th=new Set(["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","svg","switch","symbol","text","tspan","use","view","clipPath","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","foreignObject","linearGradient","radialGradient","textPath"]);function xl(e){return th.has(e)}const Zi=new WeakMap;var sh=class{constructor(e,t){var s;this.element=null,this.isExiting=!1,this.presenceContainer=null,this.children=new Set,this.features=new Map,this._context=null,this.options=e,this.parent=t,(s=t==null?void 0:t.children)==null||s.add(this),this.latestValues=eh(e,this.context),this.type=xl(this.options.as)?"svg":"html"}get context(){return this._context||(this._context=new Proxy({},{get:(e,t)=>{var n;const s=this.options[t];return js(s)||t==="initial"&&s===!1?s:(n=this.parent)==null?void 0:n.context[t]}})),this._context}updateFeatures(){if(this.visualElement)for(const e of Vn){this.features.has(e.key)||this.features.set(e.key,new e(this));const t=this.features.get(e.key);this.isMounted()&&(t.isMount?t.update():(t.mount(),t.isMount=!0))}}updateOptions(e){var t;this.options=e,(t=this.visualElement)==null||t.update({...this.options,whileTap:this.options.whilePress},null)}mount(e){var t,s;Zi.set(e,this),this.element=e,e.setAttribute(Jm.motionAttribute,((t=this.options.presenceContext)==null?void 0:t.presenceId)??""),(s=this.visualElement)==null||s.mount(e),this.updateFeatures()}beforeUnmount(){this.getSnapshot(this.options,!1)}unmount(){var e,t,s;(t=(e=this.parent)==null?void 0:e.children)==null||t.delete(this),Zi.delete(this.element),this.features.forEach(n=>{var a;return(a=n.unmount)==null?void 0:a.call(n)}),(s=this.visualElement)==null||s.unmount()}beforeUpdate(){this.getSnapshot(this.options,void 0)}update(){this.updateFeatures(),this.didUpdate()}tryExitComplete(){var e,t,s,n,a;this.isExiting||(e=this.options)!=null&&e.layoutId&&((s=(t=this.visualElement.projection)==null?void 0:t.currentAnimation)==null?void 0:s.state)==="running"||(a=(n=this.options.presenceContext)==null?void 0:n.onMotionExitComplete)==null||a.call(n,this.presenceContainer,this)}setActive(e,t){var s,n;e==="exit"&&t&&(this.isExiting=!0),(n=(s=this.visualElement)==null?void 0:s.animationState)==null||n.setActive(e,t).then(()=>{var a;e==="exit"&&t&&(this.isExiting=!1,(a=this.options)!=null&&a.layoutId?Q.postRender(()=>this.tryExitComplete()):this.tryExitComplete())})}isMounted(){return!!this.element}initVisualElement(e){var t,s,n;this.visualElement||(this.visualElement=e(this.options.as,{presenceContext:null,parent:(t=this.parent)==null?void 0:t.visualElement,props:{...this.options,whileTap:this.options.whilePress},visualState:{renderState:{transform:{},transformOrigin:{},style:{},vars:{},attrs:{}},latestValues:{...this.latestValues}},reducedMotionConfig:(s=this.options.motionConfig)==null?void 0:s.reducedMotion}),(n=this.visualElement.parent)==null||n.addChild(this.visualElement),this.isMounted()&&this.visualElement.mount(this.element))}getSnapshot(e,t){}didUpdate(){}},We=class{constructor(e){this.state=e}mount(){}unmount(){}update(){}};const _l=["initial","animate","exit","whileHover","whileDrag","whileFocus","whilePress"];var nh=_l.length;function wl(e){if(!e)return;if(!e.isControllingVariants){const s=e.parent?wl(e.parent)||{}:{};return e.props.initial!==void 0&&(s.initial=e.props.initial),s}const t={};for(let s=0;s<nh;s++){const n=_l[s],a=e.props[n];(js(a)||a===!1)&&(t[n]=a)}return t}var Sl=["animate","whileInView","whileFocus","whileHover","whilePress","whileDrag","exit"],ah=[...Sl].reverse(),ih=Sl.length;function it(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function Wi(){return{animate:it(!0),whileInView:it(),whileHover:it(),whilePress:it(),whileDrag:it(),whileFocus:it(),exit:it()}}function oh(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!bl(t,e):!1}function Ki(e){return Array.isArray(e)}function rh(e){return t=>Promise.all(t.map(({animation:s,options:n})=>of(e,s,n)))}function lh(e){let t=rh(e),s=Wi(),n=!0;const a=u=>(l,c)=>{var p;const d=It(e,c,u==="exit"?(p=e.presenceContext)==null?void 0:p.custom:void 0);if(d){const{transition:f,transitionEnd:y,..._}=d;l={...l,..._,...y}}return l};function i(u){t=u(e)}function o(u){const{props:l}=e,c=wl(e.parent)||{},d=[],p=new Set;let f={},y=1/0;for(let v=0;v<ih;v++){const h=ah[v],C=s[h],m=l[h]!==void 0?l[h]:c[h],D=js(m),R=h===u?C.isActive:null;R===!1&&(y=v);let M=m===c[h]&&m!==l[h]&&D;if(M&&n&&e.manuallyAnimateOnMount&&(M=!1),C.protectedKeys={...f},!C.isActive&&R===null||!m&&!C.prevProp||Ca(m)||typeof m=="boolean")continue;const S=oh(C.prevProp,m);let k=S||h===u&&C.isActive&&!M&&D||v>y&&D,Z=!1;const N=Array.isArray(m)?m:[m];let U=N.reduce(a(h),{});R===!1&&(U={});const{prevResolvedValues:z={}}=C,he={...z,...U},E=G=>{k=!0,p.has(G)&&(Z=!0,p.delete(G)),C.needsAnimating[G]=!0;const ae=e.getValue(G);ae&&(ae.liveStyle=!1)};for(const G in he){const ae=U[G],ce=z[G];if(Object.hasOwnProperty.call(f,G))continue;let J=!1;Ki(ae)&&Ki(ce)?J=!bl(ae,ce):J=ae!==ce,J?ae!=null?E(G):p.add(G):ae!==void 0&&p.has(G)?E(G):C.protectedKeys[G]=!0}C.prevProp=m,C.prevResolvedValues=U,C.isActive&&(f={...f,...U}),n&&e.blockInitialAnimation&&(k=!1);const j=M&&S;k&&(!j||Z)&&d.push(...N.map(G=>{const ae={type:h};if(typeof G=="string"&&n&&!j&&e.manuallyAnimateOnMount&&e.parent){const{parent:ce}=e,J=It(ce,G);if(ce.enteringChildren&&J){const{delayChildren:Te}=J.transition||{};ae.delay=Mr(ce.enteringChildren,e,Te)}}return{animation:G,options:ae}}))}if(p.size){const v={};if(typeof l.initial!="boolean"){const h=It(e,Array.isArray(l.initial)?l.initial[0]:l.initial);h&&h.transition&&(v.transition=h.transition)}p.forEach(h=>{const C=e.getBaseTarget(h),m=e.getValue(h);m&&(m.liveStyle=!0),v[h]=C??null}),d.push({animation:v})}let _=!!d.length;return n&&(l.initial===!1||l.initial===l.animate)&&!e.manuallyAnimateOnMount&&(_=!1),n=!1,_?t(d):Promise.resolve()}function r(u,l){var d;if(s[u].isActive===l)return Promise.resolve();(d=e.variantChildren)==null||d.forEach(p=>{var f;(f=p.animationState)==null||f.setActive(u,l)}),s[u].isActive=l;const c=o(u);for(const p in s)s[p].protectedKeys={};return c}return{animateChanges:o,setActive:r,setAnimateFunction:i,getState:()=>s,reset:()=>{s=Wi(),n=!0}}}function Tl(e){return e.style.display==="none"||e.offsetParent===null&&window.getComputedStyle(e).position!=="fixed"}var dt,qn,uh=(dt=class extends We{constructor(t){super(t);const s=t.visualElement;s.animationState||(s.animationState=lh(s))}updateAnimationControlsSubscription(){const{animate:t}=this.state.options;Ca(t)&&(this.unmountControls=t.subscribe(this.state.visualElement))}mount(){var t;Tl(this.state.element)?this.state.setActive("exit",!0):(t=this.state.visualElement.animationState)==null||t.animateChanges(),this.updateAnimationControlsSubscription()}update(){var n;(n=this.state.visualElement.animationState)==null||n.animateChanges();const{animate:t}=this.state.visualElement.getProps(),{animate:s}=this.state.visualElement.prevProps||{};t!==s&&this.updateAnimationControlsSubscription()}unmount(){var t;this.state.visualElement.animationState.reset(),(t=this.unmountControls)==null||t.call(this)}},qn=new WeakMap,je(dt,qn,dt.key="animation"),dt);function ch(e,t){return xl(e)?new sm(t):new Kf(t)}function Yi(e){return{point:{x:e.pageX,y:e.pageY}}}var pt,Un,dh=(pt=class extends We{constructor(t){super(t)}isActive(){const{whilePress:t,onPress:s,onPressCancel:n,onPressStart:a}=this.state.options;return!!(t||s||n||a)}register(){var s;const t=this.state.element;!t||!this.isActive()||((s=this.removePress)==null||s.call(this),this.removePress=Ef(t,(n,a)=>{const i=this.state.options;return this.state.setActive("whilePress",!0),i.onPressStart&&Q.postRender(()=>i.onPressStart(a,Yi(a))),(o,{success:r})=>{this.state.setActive("whilePress",!1);const u=r?"onPress":"onPressCancel",l=this.state.options[u];l&&Q.postRender(()=>l(o,Yi(o)))}},{useGlobalTarget:this.state.options.globalPressTarget}))}mount(){this.register()}update(){const t=this.state.visualElement.prevProps;!(t!=null&&t.whilePress||t!=null&&t.whileTap||t!=null&&t.onPress||t!=null&&t.onPressCancel||t!=null&&t.onPressStart)&&this.isActive()&&this.register()}unmount(){var t;(t=this.removePress)==null||t.call(this),this.removePress=void 0}},Un=new WeakMap,je(pt,Un,pt.key="press"),pt);function kl(e){return e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1}function ts(e,t="page"){return{point:{x:e[`${t}X`],y:e[`${t}Y`]}}}function ph(e){return t=>kl(t)&&e(t,ts(t))}var ft,Hn,fh=(ft=class extends We{constructor(t){super(t)}isActive(){const{whileHover:t,onHoverStart:s,onHoverEnd:n}=this.state.options;return!!(t||s||n)}register(){var s;const t=this.state.element;!t||!this.isActive()||((s=this.removeHover)==null||s.call(this),this.removeHover=Sf(t,(n,a)=>{const i=this.state.options;return this.state.setActive("whileHover",!0),i.onHoverStart&&Q.postRender(()=>i.onHoverStart(a,ts(a))),o=>{this.state.setActive("whileHover",!1);const r=this.state.options.onHoverEnd;r&&Q.postRender(()=>r(o,ts(o)))}}))}mount(){this.register()}update(){const t=this.state.visualElement.prevProps;!(t!=null&&t.whileHover||t!=null&&t.onHoverStart||t!=null&&t.onHoverEnd)&&this.isActive()&&this.register()}unmount(){var t;(t=this.removeHover)==null||t.call(this),this.removeHover=void 0}},Hn=new WeakMap,je(ft,Hn,ft.key="hover"),ft),mt,Gn,mh=(mt=class extends We{constructor(t){super(t)}isActive(){const{whileInView:t,onViewportEnter:s,onViewportLeave:n}=this.state.options;return!!(t||s||n)}startObserver(){var a;const t=this.state.element;if(!t||!this.isActive())return;(a=this.removeObserver)==null||a.call(this);const{once:s,...n}=this.state.options.inViewOptions||{};this.removeObserver=Um(t,(i,o)=>{const r=this.state.options;if(this.state.setActive("whileInView",!0),r.onViewportEnter&&Q.postRender(()=>r.onViewportEnter(o)),!s)return()=>{this.state.setActive("whileInView",!1);const u=this.state.options.onViewportLeave;u&&Q.postRender(()=>u(o))}},n)}mount(){this.startObserver()}update(){const{props:t,prevProps:s}=this.state.visualElement;["amount","margin","root"].some(n=>{var a,i;return((a=t.inViewOptions)==null?void 0:a[n])!==((i=s==null?void 0:s.inViewOptions)==null?void 0:i[n])})&&this.startObserver()}unmount(){var t;(t=this.removeObserver)==null||t.call(this),this.removeObserver=void 0}},Gn=new WeakMap,je(mt,Gn,mt.key="inView"),mt);function Ds(e,t,s,n={passive:!0}){return e.addEventListener(t,s,n),()=>e.removeEventListener(t,s)}var ht,Zn,hh=(ht=class extends We{constructor(t){super(t),this.isFocused=!1}onFocus(){let t=!1;try{t=this.state.element.matches(":focus-visible")}catch{t=!0}t&&(this.state.setActive("whileFocus",!0),this.isFocused=!0)}onBlur(){this.isFocused&&(this.state.setActive("whileFocus",!1),this.isFocused=!1)}mount(){const t=this.state.element;this.removeFocus=us(Ds(t,"focus",()=>this.onFocus()),Ds(t,"blur",()=>this.onBlur()))}unmount(){var t;(t=this.removeFocus)==null||t.call(this),this.removeFocus=void 0}},Zn=new WeakMap,je(ht,Zn,ht.key="focus"),ht);function Al(e){if(e)return e.options.allowProjection!==!1?e.projection:Al(e.parent)}const Cl={borderRadius:{...ze,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:ze,borderTopRightRadius:ze,borderBottomLeftRadius:ze,borderBottomRightRadius:ze,boxShadow:sl};function Ht(e){return typeof e=="object"&&e!==null&&"nodeType"in e}const gh=typeof window>"u";var gt,Wn,yh=(gt=class extends We{constructor(t){super(t),nl(Cl),gh||this.initProjection()}initProjection(){const t=this.state.options;this.state.visualElement.projection=new zm(this.state.visualElement.latestValues,t["data-framer-portal-id"]?void 0:Al(this.state.visualElement.parent)),this.projection=this.state.visualElement.projection,this.projection.isPresent=!0,this.setOptions()}setOptions(){var o;const t=this.state.options,{layoutId:s,layout:n,drag:a=!1,dragConstraints:i=!1}=t;(o=this.projection)==null||o.setOptions({layout:n,layoutId:s,alwaysMeasureLayout:!!s||!!a||i&&Ht(i),visualElement:this.state.visualElement,animationType:typeof t.layout=="string"?t.layout:"both",layoutRoot:t.layoutRoot,layoutScroll:t.layoutScroll,crossfade:t.crossfade,onExitComplete:()=>{var r;!((r=this.projection)!=null&&r.isPresent)&&this.state.options.layoutId&&!this.state.isExiting&&queueMicrotask(()=>{var u,l;(l=(u=this.state.options.presenceContext)==null?void 0:u.onMotionExitComplete)==null||l.call(u,this.state.presenceContainer,this.state)})}})}update(){this.setOptions()}mount(){var t;(t=this.projection)==null||t.mount(this.state.element)}},Wn=new WeakMap,je(gt,Wn,gt.key="projection"),gt);function Kt(e,t,s,n){return Ds(e,t,ph(s),n)}var Xi=new Set(["auto","scroll"]),El=class{constructor(e,t,{transformPagePoint:s,contextWindow:n,dragSnapToOrigin:a=!1,element:i}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.onElementScroll=c=>{this.handleScroll(c.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const c=rn(this.lastMoveEventInfo,this.history),d=this.startEvent!==null,p=Hm(c.offset,{x:0,y:0})>=3;if(!d&&!p)return;const{point:f}=c,{timestamp:y}=me;this.history.push({...f,timestamp:y});const{onStart:_,onMove:v}=this.handlers;d||(_&&_(this.lastMoveEvent,c),this.startEvent=this.lastMoveEvent),v&&v(this.lastMoveEvent,c)},this.handlePointerMove=(c,d)=>{this.lastMoveEvent=c,this.lastMoveEventInfo=on(d,this.transformPagePoint),Q.update(this.updatePoint,!0)},this.handlePointerUp=(c,d)=>{this.end();const{onEnd:p,onSessionEnd:f,resumeAnimation:y}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&y&&y(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const _=rn(c.type==="pointercancel"?this.lastMoveEventInfo:on(d,this.transformPagePoint),this.history);this.startEvent&&p&&p(c,_),f&&f(c,_)},!kl(e))return;this.dragSnapToOrigin=a,this.handlers=t,this.transformPagePoint=s,this.contextWindow=n||window;const o=on(ts(e),this.transformPagePoint),{point:r}=o,{timestamp:u}=me;this.history=[{...r,timestamp:u}];const{onSessionStart:l}=t;l&&l(e,rn(o,this.history)),this.removeListeners=us(Kt(this.contextWindow,"pointermove",this.handlePointerMove),Kt(this.contextWindow,"pointerup",this.handlePointerUp),Kt(this.contextWindow,"pointercancel",this.handlePointerUp)),i&&this.startScrollTracking(i)}isScrollable(e){const t=window.getComputedStyle(e);return t.overflow==="auto"||t.overflow==="scroll"||t.overflowX==="auto"||t.overflowX==="scroll"||t.overflowY==="auto"||t.overflowY==="scroll"}startScrollTracking(e){let t=e.parentElement;for(;t;){const s=getComputedStyle(t);(Xi.has(s.overflowX)||Xi.has(s.overflowY))&&this.scrollPositions.set(t,{x:t.scrollLeft,y:t.scrollTop}),t=t.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener("scroll",this.onElementScroll,{capture:!0,passive:!0}),window.addEventListener("scroll",this.onWindowScroll,{passive:!0}),this.removeScrollListeners=()=>{window.removeEventListener("scroll",this.onElementScroll,{capture:!0}),window.removeEventListener("scroll",this.onWindowScroll)}}handleScroll(e){const t=this.scrollPositions.get(e);if(!t)return;const s=e===window,n=s?{x:window.scrollX,y:window.scrollY}:{x:e.scrollLeft,y:e.scrollTop},a={x:n.x-t.x,y:n.y-t.y};a.x===0&&a.y===0||(s?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=a.x,this.lastMoveEventInfo.point.y+=a.y):this.history.length>0&&(this.history[0].x-=a.x,this.history[0].y-=a.y),this.scrollPositions.set(e,n),Q.update(this.updatePoint,!0))}updateHandlers(e){this.handlers=e}end(){var e;this.removeListeners&&this.removeListeners(),(e=this.removeScrollListeners)==null||e.call(this),this.scrollPositions.clear(),st(this.updatePoint)}};function on(e,t){return t?{point:t(e.point)}:e}function Ji(e,t){return{x:e.x-t.x,y:e.y-t.y}}function rn({point:e},t){return{point:e,delta:Ji(e,Pl(t)),offset:Ji(e,vh(t)),velocity:bh(t,.1)}}function vh(e){return e[0]}function Pl(e){return e[e.length-1]}function bh(e,t){if(e.length<2)return{x:0,y:0};let s=e.length-1,n=null;const a=Pl(e);for(;s>=0&&(n=e[s],!(a.timestamp-n.timestamp>$e(t)));)s--;if(!n)return{x:0,y:0};const i=Re(a.timestamp-n.timestamp);if(i===0)return{x:0,y:0};const o={x:(a.x-n.x)/i,y:(a.y-n.y)/i};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}function Qi(e){return(t,s)=>{e&&Q.postRender(()=>e(t,s))}}var yt,Kn,xh=(yt=class extends We{constructor(...t){super(...t),this.removePointerDownListener=De}onPointerDown(t){this.session=new El(t,this.createPanHandlers(),{transformPagePoint:this.state.visualElement.getTransformPagePoint(),contextWindow:gl(this.state.visualElement)})}createPanHandlers(){return{onSessionStart:Qi((t,s)=>{const{onPanSessionStart:n}=this.state.options;n&&n(t,s)}),onStart:Qi((t,s)=>{const{onPanStart:n}=this.state.options;n&&n(t,s)}),onMove:(t,s)=>{const{onPan:n}=this.state.options;n&&n(t,s)},onEnd:(t,s)=>{const{onPanEnd:n}=this.state.options;delete this.session,n&&Q.postRender(()=>n(t,s))}}}mount(){this.removePointerDownListener=Kt(this.state.element,"pointerdown",this.onPointerDown.bind(this))}update(){}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}},Kn=new WeakMap,je(yt,Kn,yt.key="pan"),yt);function Il(e){let t=null;return()=>{const s=()=>{t=null};return t===null?(t=e,s):!1}}var eo=Il("dragHorizontal"),to=Il("dragVertical");function _h(e){let t=!1;if(e==="y")t=to();else if(e==="x")t=eo();else{const s=eo(),n=to();s&&n?t=()=>{s(),n()}:(s&&s(),n&&n())}return t}function wh(e,{min:t,max:s},n){return t!==void 0&&e<t?e=n?ie(t,e,n.min):Math.max(e,t):s!==void 0&&e>s&&(e=n?ie(s,e,n.max):Math.min(e,s)),e}const On=.35;function Sh(e,{top:t,left:s,bottom:n,right:a}){return{x:so(e.x,s,a),y:so(e.y,t,n)}}function so(e,t,s){return{min:t!==void 0?e.min+t:void 0,max:s!==void 0?e.max+s-(e.max-e.min):void 0}}function Th(e=On){return e===!1?e=0:e===!0&&(e=On),{x:no(e,"left","right"),y:no(e,"top","bottom")}}function no(e,t,s){return{min:ao(e,t),max:ao(e,s)}}function ao(e,t){return typeof e=="number"?e:e[t]||0}function kh(e,t){const s={};return t.min!==void 0&&(s.min=t.min-e.min),t.max!==void 0&&(s.max=t.max-e.min),s}function Ah(e,t){return{x:io(e.x,t.x),y:io(e.y,t.y)}}function io(e,t){let s=t.min-e.min,n=t.max-e.max;return t.max-t.min<e.max-e.min&&([s,n]=[n,s]),{min:s,max:n}}function Ch(e,t){let s=.5;const n=we(e),a=we(t);return a>n?s=Jt(t.min,t.max-n,e.min):n>a&&(s=Jt(e.min,e.max-a,t.min)),Ue(0,1,s)}const Eh=new WeakMap;var Ph=class{constructor(e){this.openGlobalLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=de(),this.state=e}get visualElement(){return this.state.visualElement}start(e,{snapToCursor:t=!1}={}){const s=u=>{t?this.stopAnimation():this.pauseAnimation(),t&&this.snapToCursor(ts(u,"page").point)},n=(u,l)=>{this.stopAnimation();const{drag:c,dragPropagation:d,onDragStart:p}=this.getProps();c&&!d&&(this.openGlobalLock&&this.openGlobalLock(),this.openGlobalLock=_h(c),!this.openGlobalLock)||(this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Me(f=>{let y=this.getAxisMotionValue(f).get()||0;if(qe.test(y)){const{projection:_}=this.visualElement;if(_&&_.layout){const v=_.layout.layoutBox[f];v&&(y=we(v)*(parseFloat(y)/100))}}this.originPoint[f]=y}),p&&Q.postRender(()=>p(u,l)),Cn(this.visualElement,"transform"),this.state.setActive("whileDrag",!0))},a=(u,l)=>{const{dragPropagation:c,dragDirectionLock:d,onDirectionLock:p,onDrag:f}=this.getProps();if(!c&&!this.openGlobalLock)return;const{offset:y}=l;if(d&&this.currentDirection===null){this.currentDirection=Ih(y),this.currentDirection!==null&&p&&p(this.currentDirection);return}this.updateAxis("x",l.point,y),this.updateAxis("y",l.point,y),this.visualElement.render(),f&&f(u,l)},i=(u,l)=>this.stop(u,l),o=()=>Me(u=>{var l;return this.getAnimationState(u)==="paused"&&((l=this.getAxisMotionValue(u).animation)==null?void 0:l.play())}),{dragSnapToOrigin:r}=this.getProps();this.panSession=new El(e,{onSessionStart:s,onStart:n,onMove:a,onSessionEnd:i,resumeAnimation:o},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:r,contextWindow:gl(this.visualElement),element:this.state.element})}stop(e,t){const s=this.isDragging;if(this.cancel(),!s)return;const{velocity:n}=t;this.startAnimation(n);const{onDragEnd:a}=this.getProps();a&&Q.postRender(()=>a(e,t))}cancel(){this.isDragging=!1;const{projection:e}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:t}=this.getProps();!t&&this.openGlobalLock&&(this.openGlobalLock(),this.openGlobalLock=null),this.state.setActive("whileDrag",!1)}updateAxis(e,t,s){const{drag:n}=this.getProps();if(!s||!_s(e,n,this.currentDirection))return;const a=this.getAxisMotionValue(e);let i=this.originPoint[e]+s[e];this.constraints&&this.constraints[e]&&(i=wh(i,this.constraints[e],this.elastic[e])),a.set(i)}resolveConstraints(){var a;const{dragConstraints:e,dragElastic:t}=this.getProps(),s=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(a=this.visualElement.projection)==null?void 0:a.layout,n=this.constraints;e&&Ht(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):e&&s?this.constraints=Sh(s.layoutBox,e):this.constraints=!1,this.elastic=Th(t),n!==this.constraints&&s&&this.constraints&&!this.hasMutatedConstraints&&Me(i=>{this.constraints!==!1&&this.getAxisMotionValue(i)&&(this.constraints[i]=kh(s.layoutBox[i],this.constraints[i]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:t}=this.getProps();if(!e||!Ht(e))return!1;const s=e,{projection:n}=this.visualElement;if(!n||!n.layout)return!1;const a=qf(s,n.root,this.visualElement.getTransformPagePoint());let i=Ah(n.layout.layoutBox,a);if(t){const o=t(jf(i));this.hasMutatedConstraints=!!o,o&&(i=Xr(o))}return i}startAnimation(e){const{drag:t,dragMomentum:s,dragElastic:n,dragTransition:a,dragSnapToOrigin:i,onDragTransitionEnd:o}=this.getProps(),r=this.constraints||{},u=Me(l=>{if(!_s(l,t,this.currentDirection))return;let c=r&&r[l]||{};i&&(c={min:0,max:0});const d=n?200:1e6,p=n?40:1e7,f={type:"inertia",velocity:s?e[l]:0,bounceStiffness:d,bounceDamping:p,timeConstant:750,restDelta:1,restSpeed:10,...a,...c};return this.startAxisValueAnimation(l,f)});return Promise.all(u).then(o)}startAxisValueAnimation(e,t){const s=this.getAxisMotionValue(e);return Cn(this.visualElement,e),s.start(Ta(e,s,0,t,this.visualElement,!1))}stopAnimation(){var e;(e=this.visualElement.projection)!=null&&e.isPresent&&Me(t=>this.getAxisMotionValue(t).stop())}pauseAnimation(){Me(e=>{var t;return(t=this.getAxisMotionValue(e).animation)==null?void 0:t.pause()})}getAnimationState(e){var t;return(t=this.getAxisMotionValue(e).animation)==null?void 0:t.state}getAxisMotionValue(e){const t=`_drag${e.toUpperCase()}`,s=this.visualElement.getProps();return s[t]||this.visualElement.getValue(e,(s.initial?s.initial[e]:void 0)||0)}snapToCursor(e){Me(t=>{const{drag:s}=this.getProps();if(!_s(t,s,this.currentDirection))return;const{projection:n}=this.visualElement,a=this.getAxisMotionValue(t);if(n&&n.layout){const{min:i,max:o}=n.layout.layoutBox[t];a.set(e[t]-ie(i,o,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:t}=this.getProps(),{projection:s}=this.visualElement;if(!Ht(t)||!s||!this.constraints)return;this.stopAnimation();const n={x:0,y:0};Me(i=>{const o=this.getAxisMotionValue(i);if(o&&this.constraints!==!1){const r=o.get();n[i]=Ch({min:r,max:r},this.constraints[i])}});const{transformTemplate:a}=this.visualElement.getProps();this.state.element.style.transform=a?a({},""):"none",s.root&&s.root.updateScroll(),s.updateLayout(),this.resolveConstraints(),Me(i=>{if(!_s(i,e,null))return;const o=this.getAxisMotionValue(i),{min:r,max:u}=this.constraints[i];o.set(ie(r,u,n[i]))})}addListeners(){if(!this.state.element)return;Eh.set(this.visualElement,this);const e=this.state.element,t=Kt(e,"pointerdown",r=>{const{drag:u,dragListener:l=!0}=this.getProps();u&&l&&this.start(r)}),s=()=>{const{dragConstraints:r}=this.getProps();Ht(r)&&(this.constraints=this.resolveRefConstraints())},{projection:n}=this.visualElement,a=n.addEventListener("measure",s);n&&!n.layout&&(n.root&&n.root.updateScroll(),n.updateLayout()),Q.read(s);const i=Ds(window,"resize",()=>this.scalePositionWithinConstraints()),o=n.addEventListener("didUpdate",({delta:r,hasLayoutChanged:u})=>{this.isDragging&&u&&(Me(l=>{const c=this.getAxisMotionValue(l);c&&(this.originPoint[l]+=r[l].translate,c.set(c.get()+r[l].translate))}),this.visualElement.render())});return()=>{i(),t(),a(),o&&o()}}getProps(){const e=this.visualElement.getProps(),{drag:t=!1,dragDirectionLock:s=!1,dragPropagation:n=!1,dragConstraints:a=!1,dragElastic:i=On,dragMomentum:o=!0}=e;return{...e,drag:t,dragDirectionLock:s,dragPropagation:n,dragConstraints:a,dragElastic:i,dragMomentum:o}}};function _s(e,t,s){return(t===!0||t===e)&&(s===null||s===e)}function Ih(e,t=10){let s=null;return Math.abs(e.y)>t?s="y":Math.abs(e.x)>t&&(s="x"),s}var vt,Yn,Mh=(vt=class extends We{constructor(t){super(t),this.removeGroupControls=De,this.removeListeners=De,this.controls=new Ph(t)}mount(){const{dragControls:t}=this.state.options;t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||De}unmount(){this.removeGroupControls(),this.removeListeners()}},Yn=new WeakMap,je(vt,Yn,vt.key="drag"),vt),zt=!1,bt,Xn,Rh=(bt=class extends We{constructor(t){super(t),this.hasMountSettled=!1,nl(Cl),t.getSnapshot=this.getSnapshot.bind(this),t.didUpdate=this.didUpdate.bind(this)}updatePrevLead(t){const s=t.getStack();s!=null&&s.prevLead&&!s.prevLead.snapshot&&(s.prevLead.willUpdate(),zt=!0)}didUpdate(){var t,s;zt&&(this.state.options.layout||this.state.options.layoutId||this.state.options.drag)&&(zt=!1,(s=(t=this.state.visualElement.projection)==null?void 0:t.root)==null||s.didUpdate())}mount(){var n;const t=this.state.options,s=this.state.options.layoutGroup;if(t.layout||t.layoutId){const a=this.state.visualElement.projection;if(t.layoutId){const i=!Tl(this.state.element);a.isPresent=i,i?a.promote():a.relegate(),this.updatePrevLead(a)}(n=s==null?void 0:s.group)==null||n.add(a),ks.hasEverUpdated=!0}this.didUpdate(),Q.postRender(()=>{this.hasMountSettled=!0})}unmount(){const t=this.state.options.layoutGroup,s=this.state.visualElement.projection;s&&(t!=null&&t.group&&(this.state.options.layout||this.state.options.layoutId)&&t.group.remove(s),this.state.options.layoutId&&(zt=!0),this.didUpdate())}getSnapshot(t,s){const n=this.state.visualElement.projection,{drag:a,layoutDependency:i,layout:o,layoutId:r}=t;if(!n||!o&&!r&&!a||!this.hasMountSettled)return;zt=!0;const u=this.state.options;(a||u.layoutDependency!==i||i===void 0||ja(s)&&n.isPresent!==s)&&n.willUpdate(),ja(s)&&s!==n.isPresent&&(n.isPresent=s,s?(n.promote(),this.updatePrevLead(n)):n.relegate())}},Xn=new WeakMap,je(bt,Xn,bt.key="layout"),bt);const Dh={renderer:ch,features:[uh,dh,fh,mh,hh,yh,xh,Mh,Rh]},[$h,q_]=ls("LazyMotionContext"),[Vh,U_,H_]=ls("AnimatePresenceContext");function Oh(e){return e.replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`)}function Ml(){return{transform:{},transformOrigin:{},style:{},vars:{}}}function Lh(){return{...Ml(),attrs:{}}}function Bh(e){const t=Ml();Ea(t,e);const s={...t.style};for(const n in t.vars)s[n]=t.vars[n];return Object.keys(s).length===0?null:s}function Nh(e,t,s){const n=Lh();il(n,e,ol(t),void 0,s);const a={};for(const i in n.attrs){const o=Pa.has(i)?i:Oh(i);a[o]=n.attrs[i]}return{attrs:a,style:{...n.style,...n.vars}}}function jh(e,t){const s=Gm(null),n=Wm({}),a=Xm(),i=Vh({}),o=$h({features:W({}),strict:!1}),r=Mu();function u(){return dd(e,{layoutGroup:n,presenceContext:i,config:a.value})}function l(){return{...r,...u()}}const c=new sh(l(),s);Zm(c),t&&c.initVisualElement(t),ge(o.features,f=>{var y;(y=f.features)!=null&&y.length&&yl(f.features),f.renderer&&c.initVisualElement(f.renderer),c.updateFeatures()},{immediate:!0,flush:"pre"});function d(){var C;const f=c.type==="svg",y={...r};Object.keys(r).forEach(m=>{ve(r[m])&&(y[m]=r[m].get())});const _=((C=c.visualElement)==null?void 0:C.latestValues)||c.latestValues;let v={...e.style,...f?{}:_};for(const m in v)ve(v[m])&&(v[m]=v[m].get());if(f){const{attrs:m,style:D}=Nh({..._,...v},c.options.as,e.style);Object.assign(y,m),v=D}e.drag&&e.dragListener!==!1&&Object.assign(v,{userSelect:"none",WebkitUserSelect:"none",WebkitTouchCallout:"none",touchAction:e.drag===!0?"none":`pan-${e.drag==="x"?"y":"x"}`});const h=Bh(v);return h&&(y.style=h),y}const p=Ru().proxy;return Os(()=>{const f=$n(p.$el);c.mount(f)}),ea(()=>c.beforeUnmount()),Fo(()=>{var f;(f=$n(p.$el))!=null&&f.isConnected||c.unmount()}),Du(()=>{c.beforeUpdate(),c.updateOptions(l())}),$u(()=>{c.update()}),{getProps:u,getAttrs:d,layoutGroup:n,state:c}}const Fh={ignoreStrict:{type:Boolean},forwardMotionProps:{type:Boolean,default:!1},asChild:{type:Boolean,default:!1},whileDrag:{type:[String,Array,Object]},whileHover:{type:[String,Array,Object]},whilePress:{type:[String,Array,Object]},whileInView:{type:[String,Array,Object]},whileFocus:{type:[String,Array,Object]},custom:{type:[String,Number,Object,Array]},initial:{type:[String,Array,Object,Boolean],default:void 0},animate:{type:[String,Array,Object],default:void 0},exit:{type:[String,Array,Object]},variants:{type:Object},inherit:{type:Boolean},style:{type:Object},transformTemplate:{type:Function},transition:{type:Object},onAnimationComplete:{type:Function},onUpdate:{type:Function},layout:{type:[Boolean,String],default:!1},layoutId:{type:String,default:void 0},layoutScroll:{type:Boolean,default:!1},layoutRoot:{type:Boolean,default:!1},"data-framer-portal-id":{type:String},crossfade:{type:Boolean,default:!0},layoutDependency:{type:null,default:void 0},onBeforeLayoutMeasure:{type:Function},onLayoutMeasure:{type:Function},onLayoutAnimationStart:{type:Function},onLayoutAnimationComplete:{type:Function},globalPressTarget:{type:Boolean},onPressStart:{type:Function},onPress:{type:Function},onPressCancel:{type:Function},onHoverStart:{type:Function},onHoverEnd:{type:Function},inViewOptions:{type:Object},onViewportEnter:{type:Function},onViewportLeave:{type:Function},drag:{type:[Boolean,String]},dragSnapToOrigin:{type:Boolean},dragDirectionLock:{type:Boolean},dragPropagation:{type:Boolean},dragConstraints:{type:[Boolean,Object]},dragElastic:{type:[Boolean,Number,Object],default:.5},dragMomentum:{type:Boolean,default:!0},dragTransition:{type:Object},dragListener:{type:Boolean,default:!0},dragControls:{type:Object},onDragStart:{type:Function},onDragEnd:{type:Function},onDrag:{type:Function},onDirectionLock:{type:Function},onDragTransitionEnd:{type:Function},onMeasureDragConstraints:{type:Function},onPanSessionStart:{type:Function},onPanStart:{type:Function},onPan:{type:Function},onPanEnd:{type:Function}};var zh=new Map,qh=new Map;function Uh(e){if(!Array.isArray(e))return[e];const t=[];for(const s of e)Array.isArray(s)?t.push(...s):t.push(s);return t}var Hh=["area","img","input"];function Gh(e,t,s){var n,a;if(typeof e=="string"&&Hh.includes(e))return Pt(e,t);if(e==="template"){if(!s.default)return null;const i=Uh(s.default()),o=i.findIndex(c=>c.type!==Vu);if(o===-1)return i;const r=i[o];(n=r.props)==null||delete n.ref;const u=r.props?wt(t,r.props):t;t.class&&((a=r.props)!=null&&a.class)&&delete r.props.class;const l=Ou(r,u);for(const c in u)c.startsWith("on")&&(l.props||(l.props={}),l.props[c]=u[c]);return i.length===1?l:(i[o]=l,i)}return null}function oo(e,t={}){const s=typeof e=="string",n=s?e:e.name||"",a=t.renderer?zh:qh;if(s&&(a!=null&&a.has(e)))return a.get(e);const i=Y({inheritAttrs:!1,props:{...Fh,as:{type:[String,Object],default:e||"div"}},name:n?`motion.${n}`:"Motion",setup(o,{slots:r}){const{getProps:u,getAttrs:l,state:c}=jh(o,t.renderer);function d(){const p=c.element;if((typeof o.as!="object"||o.asChild)&&p){const{style:f}=l();if(f)for(const[y,_]of Object.entries(f))p.style[y]=_}}return()=>{const p=u(),f=l(),y=o.asChild?"template":o.as,_={...o.forwardMotionProps?p:{},...f,onVnodeUpdated:d},v=Gh(y,_,r);return v!==null?v:Pt(y,{..._},r)}}});return s&&(a==null||a.set(e,i)),i}function Zh(e){const t=e==null?void 0:e.renderer;return yl((e==null?void 0:e.features)||[]),new Proxy({},{get(s,n){return n==="create"?(a,i)=>oo(a,{...i,renderer:t}):oo(n,{renderer:t})}})}const Ln=Zh(Dh);Ln.create("div");const Ia=Y({__name:"Shimmer",props:{as:{default:"p"},class:{},duration:{default:2},spread:{default:2}},setup(e){const t=e,s=Lu(),n=P(()=>{var l;const u=(l=s.default)==null?void 0:l.call(s);return!u||u.length===0?"":u.map(c=>typeof c.children=="string"?c.children:"").join("")}),a=P(()=>{var u;return(((u=n.value)==null?void 0:u.length)??0)*t.spread}),i=P(()=>ta("relative inline-block bg-[length:250%_100%,auto] bg-clip-text text-transparent","[--bg:linear-gradient(90deg,#0000_calc(50%-var(--spread)),var(--color-background),#0000_calc(50%+var(--spread)))] [background-repeat:no-repeat,padding-box]",t.class)),o=P(()=>({"--spread":`${a.value}px`,backgroundImage:"var(--bg), linear-gradient(var(--color-muted-foreground), var(--color-muted-foreground))"})),r=P(()=>Ln[t.as]||Ln.p);return(u,l)=>(x(),F(zo(r.value),{class:re(i.value),style:Vt(o.value),initial:{backgroundPosition:"100% center"},animate:{backgroundPosition:"0% center"},transition:{repeat:Number.POSITIVE_INFINITY,duration:u.duration,ease:"linear"}},{default:T(()=>[$t(u.$slots,"default")]),_:3},8,["class","style","transition"]))}});function Rl(e){const t=P(()=>{const i=[];for(const o of e.value){if(o.role!=="assistant")continue;(o.blocks||[]).forEach((u,l)=>{const c=`${o.id}-attachment-${l}`;if(u.kind==="code")i.push({id:c,messageId:o.id,type:"code",language:u.language,code:u.code});else if(u.kind==="source")i.push({id:c,messageId:o.id,type:"source",url:u.url,title:u.title,filename:u.filename,mediaType:u.mediaType});else if(u.kind==="tool"&&(u.toolName==="export_query_result"||u.toolName==="export_content")){const d=u.result;d!=null&&d.filename&&d.content!==void 0&&i.push({id:c,messageId:o.id,type:"file",filename:d.filename,result:d})}})}return i}),s=P(()=>t.value.filter(i=>i.type==="file")),n=P(()=>t.value.filter(i=>i.type==="code")),a=P(()=>t.value.filter(i=>i.type==="source"));return{attachments:t,files:s,codes:n,sources:a}}function Wh(e){const t=window.atob(e),s=new Uint8Array(t.length);for(let n=0;n<t.length;n+=1)s[n]=t.charCodeAt(n);return s}function Ma(){return{downloadFile:async t=>{if(t.error)return Gs.error(t.error),!1;try{const s=t.encoding==="base64"?new Blob([Wh(t.content)],{type:t.mimeType}):new Blob([t.content],{type:t.mimeType}),n=URL.createObjectURL(s),a=document.createElement("a");return a.href=n,a.download=t.filename,a.style.display="none",document.body.appendChild(a),a.click(),document.body.removeChild(a),URL.revokeObjectURL(n),Gs.success(`Downloaded ${t.filename}`),!0}catch(s){const n=s instanceof Error?s.message:"Failed to download export file.";return Gs.error(n),!1}}}}const Kh={class:"whitespace-pre-wrap leading-normal chat-text"},Yh=Y({__name:"BlockMessageText",props:{content:{},isBlockStreaming:{type:Boolean},isStreaming:{type:Boolean},isUserMessage:{type:Boolean}},setup(e){const t=e,s=P(()=>!!(t.isBlockStreaming&&t.isStreaming)),n=sa(Yt(t,"content"),s);return(a,i)=>(x(),A("p",Kh,I(g(n)),1))}});class Ra{constructor(t){Ye(this,"options");Ye(this,"tokensStable",[]);Ye(this,"tokensUnstable",[]);Ye(this,"lastUnstableCodeChunk","");Ye(this,"lastStableGrammarState");this.options=t}async enqueue(t){const s=(this.lastUnstableCodeChunk+t).split(`
3
+ `),n=[];let a=[];const i=this.tokensUnstable.length;return s.forEach((o,r)=>{const u=r===s.length-1,l=this.options.highlighter.codeToTokens(o,{...this.options,grammarState:this.lastStableGrammarState}),c=l.tokens[0];u||c.push({content:`
4
+ `,offset:0}),u?(a=c,this.lastUnstableCodeChunk=o):(this.lastStableGrammarState=l.grammarState,n.push(...c))}),this.tokensStable.push(...n),this.tokensUnstable=a,{recall:i,stable:n,unstable:a}}close(){const t=this.tokensUnstable;return this.tokensUnstable=[],this.lastUnstableCodeChunk="",this.lastStableGrammarState=void 0,{stable:t}}clear(){this.tokensStable=[],this.tokensUnstable=[],this.lastUnstableCodeChunk="",this.lastStableGrammarState=void 0}clone(){const t=new Ra(this.options);return t.lastUnstableCodeChunk=this.lastUnstableCodeChunk,t.tokensUnstable=this.tokensUnstable,t.tokensStable=this.tokensStable,t.lastStableGrammarState=this.lastStableGrammarState,t}}class Xh extends TransformStream{constructor(s){const n=new Ra(s),{allowRecalls:a=!1}=s;super({async transform(i,o){const{stable:r,unstable:u,recall:l}=await n.enqueue(i);a&&l>0&&o.enqueue({recall:l});for(const c of r)o.enqueue(c);if(a)for(const c of u)o.enqueue(c)},async flush(i){const{stable:o}=n.close();if(!a)for(const r of o)i.enqueue(r)}});Ye(this,"tokenizer");Ye(this,"options");this.tokenizer=n,this.options=s}}function Jh(e){return!e||Object(e)!==e}const Qh="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";function eg(e=16,t=Qh){let s="",n=e;const a=t.length;for(;n--;)s+=t[Math.random()*a|0];return s}const ln=new WeakMap;function tg(e){return Jh(e)?e:(ln.has(e)||ln.set(e,eg()),ln.get(e))}const sg=Y({name:"ShikiStreamRenderer",props:{stream:{type:Object,required:!0}},emits:["stream-start","stream-end"],setup(e,{emit:t}){const s=Nu([]);let n=null;return ge(()=>e.stream,a=>{s.length=0,n&&n.abort(),n=new AbortController;const i=n.signal;let o=!1;a.pipeTo(new WritableStream({write(r){i.aborted||(o||(o=!0,t("stream-start")),"recall"in r?s.length-=r.recall:s.push(r))},close:()=>{i.aborted||t("stream-end")},abort:()=>{i.aborted||t("stream-end")}}),{signal:i}).catch(r=>{r.name!=="AbortError"&&console.error("Stream error:",r)})},{immediate:!0}),()=>Pt("pre",{class:"shiki shiki-stream"},Pt("code",Se(s,a=>Pt("span",{key:tg(a),style:a.htmlStyle||Ac(a)},a.content))))}}),ng=Y({name:"ShikiCachedRenderer",props:{code:{type:String,required:!0},lang:{type:String,required:!0},theme:{type:String,required:!0},highlighter:{type:Object,required:!0}},emits:["stream-start","stream-end"],setup(e,{emit:t}){const s=W(0);let n=null;const a=new ReadableStream({start(o){n=o}});Bu(()=>{e.code.length>s.value&&(n==null||n.enqueue(e.code.slice(s.value)),s.value=e.code.length)});const i=a.pipeThrough(new Xh({highlighter:e.highlighter,lang:e.lang,theme:e.theme,allowRecalls:!0}));return()=>Pt(sg,{stream:i,onStreamStart:()=>t("stream-start"),onStreamEnd:()=>t("stream-end")})}});let qt=null,un=null;const ag=new Set,ig=[Pe(()=>import("./B9xm8XSJ.js"),[],import.meta.url),Pe(()=>import("./BuTCm7Bo.js").then(e=>e.f),__vite__mapDeps([0,1,2]),import.meta.url),Pe(()=>import("./BuTCm7Bo.js").then(e=>e.e),__vite__mapDeps([0,1,2]),import.meta.url),Pe(()=>import("./BzqjH2-H.js").then(e=>e.b),__vite__mapDeps([3,1,2,0]),import.meta.url),Pe(()=>import("./BuTCm7Bo.js").then(e=>e.m),__vite__mapDeps([0,1,2]),import.meta.url),Pe(()=>import("./fuZLfV_i.js"),[],import.meta.url),Pe(()=>import("./BuTCm7Bo.js").then(e=>e.x),__vite__mapDeps([0,1,2]),import.meta.url),Pe(()=>import("./BuTCm7Bo.js").then(e=>e.y),__vite__mapDeps([0,1,2]),import.meta.url),Pe(()=>import("./BuTCm7Bo.js").then(e=>e.h),__vite__mapDeps([0,1,2]),import.meta.url),Pe(()=>import("./BuTCm7Bo.js").then(e=>e.j),__vite__mapDeps([0,1,2]),import.meta.url),Pe(()=>import("./DlfHMoPT.js"),[],import.meta.url)],og=async e=>{if(un||(un=Cc({langs:ig,themes:[Pc,Ic],engine:Ec()})),qt||(qt=await un),e!=null&&e.length){const t=qt.getLoadedLanguages();await Promise.all(e.filter(s=>!t.includes(s)).map(s=>qt.loadLanguage(s).catch(()=>{ag.add(s),console.warn(`[useHighlighter] Unknown language: "${s}" — will render as plain text`)})))}return qt},rg={class:"rounded-xl border overflow-hidden shadow-sm"},lg={class:"flex items-center justify-between px-3 py-1 border-b border-border/40 bg-muted/50"},ug={class:"text-xxs font-semibold capitalize text-muted-foreground select-none"},cg={class:"flex items-center gap-1 justify-center"},dg={class:"overflow-x-auto px-3 py-2 chat-code-text"},pg={key:1,class:"m-0"},Fs=Y({__name:"BlockMessageCode",props:{id:{},code:{},language:{},class:{},meta:{},isBlockStreaming:{type:Boolean},isStreaming:{type:Boolean}},setup(e){const t=qo(),s=W(null),n=e;ge(()=>n.language,async y=>{s.value=await og([y])},{immediate:!0});const{handleCopyWithKey:a,isCopied:i,getCopyIcon:o,getCopyIconClass:r,getCopyTooltip:u}=na(),l=P(()=>!!(n.isBlockStreaming&&n.isStreaming)),c=sa(Yt(n,"code"),l),d=P(()=>{switch(n.language){case"markdown":return"markdown";case"csv":return"csv";case"json":return"json";case"javascript":return"js";case"typescript":return"ts";case"postgresql":case"mysql":case"oracle":case"sql":case"plsql":case"sqlpl":case"sqlserver":return"sql";default:return"text"}}),p=P(()=>c.value.trim().replace(/`+$/,"")),f=P(()=>`${d.value}-${t.value}`);return(y,_)=>{const v=pe,h=ye;return x(),A("div",rg,[w("div",lg,[w("span",ug,I(n.language),1),b(g(Ls),null,{default:T(()=>[b(g(Bs),{"as-child":""},{default:T(()=>[b(h,{variant:"ghost",size:"xxs",class:"h-6!",onClick:_[0]||(_[0]=C=>g(a)(y.id,y.code))},{default:T(()=>[w("span",cg,[(x(),F(v,{key:g(i)(y.id)?"tick":"copy",name:g(o)(g(i)(y.id)),class:re(["size-3.5",g(r)(g(i)(y.id))])},null,8,["name","class"])),g(i)(y.id)?(x(),A("span",{key:0,class:re(["text-xxs font-medium leading-none",g(r)(g(i)(y.id))])}," Copied ",2)):q("",!0)])]),_:1})]),_:1}),b(g(Ns),null,{default:T(()=>[w("p",null,I(g(u)(g(i)(y.id))),1)]),_:1})]),_:1})]),w("div",dg,[s.value?(x(),F(g(ng),{key:f.value,highlighter:s.value,code:p.value,lang:d.value,theme:g(t).value==="dark"?"catppuccin-mocha":"catppuccin-latte"},null,8,["highlighter","code","lang","theme"])):(x(),A("pre",pg,[w("code",null,I(p.value),1)]))])])}}}),fg={class:"rounded-xl border overflow-hidden shadow-sm"},mg={class:"flex items-center justify-between px-3 py-1 border-b border-border/40 bg-muted/50"},hg={class:"flex items-center gap-0.5"},gg={class:"flex items-center gap-1 justify-center"},yg={key:0,class:"text-xxs font-medium leading-none"},vg={key:0,class:"overflow-auto bg-background max-h-[400px] p-4"},bg={key:0,class:"text-destructive text-sm p-2 bg-destructive/10 rounded"},xg=["innerHTML"],_g={key:1,class:"overflow-x-auto px-3 py-2 chat-code-text"},wg={class:"m-0"},Sg={key:0,class:"fixed inset-0 z-50 bg-background flex flex-col"},Tg={class:"flex items-center justify-between px-4 py-2 border-b border-border"},kg={class:"flex items-center gap-2"},Ag={class:"flex items-center gap-1"},Cg={key:0,class:"flex-1 overflow-auto p-6"},Eg={key:0,class:"text-destructive text-sm p-2 bg-destructive/10 rounded"},Pg=["innerHTML"],Ig={key:1,class:"flex-1 overflow-auto px-4 py-3 chat-code-text"},Mg={class:"m-0"},Rg=Y({__name:"BlockMessageMermaid",props:{id:{},code:{}},setup(e){const t=e,s=W(null),n=W(null),a=W(null),i=W(null),{handleCopyWithKey:o,isCopied:r,getCopyIcon:u,getCopyIconClass:l,getCopyTooltip:c}=na();let d=0;const p=async()=>{if(t.code.trim())try{a.value=null;const{default:v}=await Pe(async()=>{const{default:m}=await import("./BJvJ0Hlu.js").then(D=>D.bf);return{default:m}},__vite__mapDeps([4,1,2]),import.meta.url);v.initialize({startOnLoad:!1,theme:qo().value==="dark"?"dark":"default",securityLevel:"strict",fontFamily:"inherit"}),d+=1;const h=`mermaid-${t.id}-${d}`,{svg:C}=await v.render(h,t.code.trim());i.value=C}catch(v){a.value=v instanceof Error?v.message:"Failed to render diagram",i.value=null}};Os(p),ge(()=>t.code,p);const f=W(!1),y=W(!1),_=()=>{f.value=!f.value};return(v,h)=>{const C=pe,m=ye,D=Bs,R=Ns,M=Ls;return x(),A(le,null,[w("div",fg,[w("div",mg,[h[4]||(h[4]=w("span",{class:"text-xxs font-semibold capitalize text-muted-foreground select-none"}," Mermaid ",-1)),w("div",hg,[b(M,null,{default:T(()=>[b(D,{"as-child":""},{default:T(()=>[b(m,{variant:"ghost",size:"iconSm",onClick:h[0]||(h[0]=S=>y.value=!y.value)},{default:T(()=>[b(C,{name:y.value?"hugeicons:eye":"hugeicons:source-code",class:"size-4"},null,8,["name"])]),_:1})]),_:1}),b(R,null,{default:T(()=>[B(I(y.value?"Show diagram":"Show source"),1)]),_:1})]),_:1}),b(M,null,{default:T(()=>[b(D,{"as-child":""},{default:T(()=>[b(m,{variant:"ghost",size:"iconSm",class:"w-[unset]",onClick:h[1]||(h[1]=S=>g(o)(v.id,v.code))},{default:T(()=>[w("span",gg,[(x(),F(C,{key:g(r)(v.id)?"tick":"copy",name:g(u)(g(r)(v.id)),class:re(["size-4",g(l)(g(r)(v.id))])},null,8,["name","class"])),g(r)(v.id)?(x(),A("span",yg," Copied ")):q("",!0)])]),_:1})]),_:1}),b(R,null,{default:T(()=>[B(I(g(c)(g(r)(v.id))),1)]),_:1})]),_:1}),b(M,null,{default:T(()=>[b(D,{"as-child":""},{default:T(()=>[b(m,{variant:"ghost",size:"iconSm",onClick:_},{default:T(()=>[b(C,{name:f.value?"hugeicons:arrow-shrink-02":"hugeicons:arrow-expand-02",class:"size-4"},null,8,["name"])]),_:1})]),_:1}),b(R,null,{default:T(()=>[B(I(f.value?"Exit full view":"Full view"),1)]),_:1})]),_:1})])]),y.value?(x(),A("div",_g,[w("pre",wg,[w("code",null,I(v.code),1)])])):(x(),A("div",vg,[a.value?(x(),A("div",bg,I(a.value),1)):i.value?(x(),A("div",{key:1,ref_key:"containerRef",ref:s,class:"flex items-center justify-center [&>svg]:max-w-full",innerHTML:i.value},null,8,xg)):q("",!0)]))]),(x(),F(Uo,{to:"body"},[f.value?(x(),A("div",Sg,[w("div",Tg,[w("div",kg,[b(C,{name:"hugeicons:chart-relationship",class:"size-4 text-primary"}),h[5]||(h[5]=w("span",{class:"text-sm font-medium"},"Mermaid Diagram",-1))]),w("div",Ag,[b(M,null,{default:T(()=>[b(D,{"as-child":""},{default:T(()=>[b(m,{variant:"ghost",size:"xxs",class:"h-7!",onClick:h[2]||(h[2]=S=>y.value=!y.value)},{default:T(()=>[b(C,{name:y.value?"hugeicons:eye":"hugeicons:source-code",class:"size-4"},null,8,["name"])]),_:1})]),_:1}),b(R,null,{default:T(()=>[B(I(y.value?"Show diagram":"Show source"),1)]),_:1})]),_:1}),b(M,null,{default:T(()=>[b(D,{"as-child":""},{default:T(()=>[b(m,{variant:"ghost",size:"iconSm",onClick:h[3]||(h[3]=S=>g(o)(v.id,v.code))},{default:T(()=>[b(C,{name:g(u)(g(r)(v.id)),class:re(["size-4",g(l)(g(r)(v.id))])},null,8,["name","class"])]),_:1})]),_:1}),b(R,null,{default:T(()=>[B(I(g(c)(g(r)(v.id))),1)]),_:1})]),_:1}),b(m,{variant:"ghost",size:"iconSm",onClick:_},{default:T(()=>[b(C,{name:"hugeicons:arrow-shrink-02",class:"size-4"})]),_:1})])]),y.value?(x(),A("div",Ig,[w("pre",Mg,[w("code",null,I(v.code),1)])])):(x(),A("div",Cg,[a.value?(x(),A("div",Eg,I(a.value),1)):i.value?(x(),A("div",{key:1,ref_key:"fullscreenContainerRef",ref:n,class:"flex items-center justify-center [&>svg]:max-w-full [&>svg]:max-h-full",innerHTML:i.value},null,8,Pg)):q("",!0)]))])):q("",!0)]))],64)}}}),Dg={class:"flex items-center gap-2 text-muted-foreground chat-text"},$g=Y({__name:"BlockMessageLoading",props:{label:{}},setup(e){return(t,s)=>{const n=pe;return x(),A("div",Dg,[b(n,{name:"hugeicons:loading-03",class:"size-4 animate-spin"}),b(Ia,null,{default:T(()=>[B(I(t.label||"Generating summary..."),1)]),_:1})])}}}),Vg={class:"rounded-xl py-2 text-destructive"},Og=Y({__name:"BlockMessageError",props:{message:{}},setup(e){return(t,s)=>(x(),A("div",Vg,I(t.message),1))}}),Lg={key:1,class:"rounded-2xl border bg-muted/40"},Bg={class:"overflow-x-auto px-3 py-3 leading-6 chat-code-text"},Ng=Y({__name:"BlockMessageTool",props:{toolName:{},result:{},getToolComponent:{type:Function}},setup(e){const t=e,s=P(()=>t.getToolComponent(t.toolName)),n=a=>JSON.stringify(a,null,2);return(a,i)=>g(s)?(x(),F(zo(g(s)),{key:0,data:a.result},null,8,["data"])):(x(),A("div",Lg,[w("pre",Bg,I(n(a.result)),1)]))}}),jg={class:"inline-flex items-center gap-2 rounded-lg border bg-muted/50 px-3 py-2 text-xs"},Fg={class:"min-w-0 flex-1"},zg=["href"],qg={key:1,class:"truncate font-medium text-foreground"},Ug={key:2,class:"ml-2 text-xxs text-muted-foreground"},Hg=Y({__name:"BlockMessageSource",props:{sourceId:{},url:{},title:{},mediaType:{},filename:{}},setup(e){return(t,s)=>{const n=pe;return x(),A("div",jg,[b(n,{name:t.url?"hugeicons:link-02":"hugeicons:file-02",class:"size-3.5 shrink-0 text-muted-foreground"},null,8,["name"]),w("div",Fg,[t.url?(x(),A("a",{key:0,href:t.url,target:"_blank",rel:"noopener noreferrer",class:"truncate font-medium text-primary hover:underline"},I(t.title||t.url),9,zg)):(x(),A("span",qg,I(t.title||t.filename||"Source document"),1)),t.mediaType?(x(),A("span",Ug,I(t.mediaType),1)):q("",!0)])])}}}),ro=Y({__name:"RadioGroup",props:{modelValue:{},defaultValue:{},disabled:{type:Boolean},orientation:{},dir:{},loop:{type:Boolean},asChild:{type:Boolean},as:{},name:{},required:{type:Boolean},class:{}},emits:["update:modelValue"],setup(e,{emit:t}){const s=e,n=t,a=P(()=>{const{class:o,...r}=s;return r}),i=ju(a,n);return(o,r)=>(x(),F(g(ad),wt({"data-slot":"radio-group",class:g(ta)("grid gap-3",s.class)},g(i)),{default:T(()=>[$t(o.$slots,"default")]),_:3},16,["class"]))}}),lo=Y({__name:"RadioGroupItem",props:{id:{},value:{},disabled:{type:Boolean},asChild:{type:Boolean},as:{},name:{},required:{type:Boolean},class:{}},setup(e){const t=e,s=P(()=>{const{class:a,...i}=t;return i}),n=Fu(s);return(a,i)=>(x(),F(g(ld),wt({"data-slot":"radio-group-item"},g(n),{class:g(ta)("border-input text-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 aspect-square size-4 shrink-0 rounded-full border shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",t.class)}),{default:T(()=>[b(g(cd),{"data-slot":"radio-group-indicator",class:"relative flex items-center justify-center"},{default:T(()=>[b(g($c),{class:"fill-primary absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2"})]),_:1})]),_:1},16,["class"]))}}),Gg={key:0,class:"flex items-center gap-2 rounded-xl border border-border/60 bg-muted/30 px-3 py-2"},Zg={class:"text-xs text-muted-foreground truncate"},Wg={key:1,class:"rounded-2xl border border-border/70 bg-background/80 overflow-hidden"},Kg={class:"px-4 pt-4"},Yg={class:"flex items-center justify-between gap-2 mb-2"},Xg={class:"flex items-center gap-2 min-w-0"},Jg=["title"],Qg={class:"shrink-0 text-[11px] text-muted-foreground"},ey={class:"h-0.5 rounded-full bg-muted overflow-hidden"},ty={class:"px-4 py-3"},sy={class:"text-sm leading-relaxed"},ny={key:0,class:"text-destructive ml-0.5","aria-label":"required"},ay={key:1,class:"flex flex-col gap-3 py-1"},iy=["value","placeholder"],oy={class:"px-4 pb-4 flex items-center justify-between gap-2"},ry={key:1},ly={class:"flex items-center gap-1.5"},uy=Y({__name:"BlockMessageQuiz",props:{toolCallId:{},context:{},questions:{}},emits:["submit"],setup(e,{emit:t}){const s=e,n=t,a=W({}),i=W(0),o=W(!1),r=P(()=>s.questions[i.value]),u=P(()=>i.value===s.questions.length-1),l=P(()=>s.questions.every(M=>!M.required||p(M.id))),c=W("");function d(){if(!r.value)return;const M=a.value[r.value.id];c.value=typeof M=="string"?M:""}function p(M){const S=a.value[M];return Array.isArray(S)?S.length>0:!!(S!=null&&S.trim())}function f(M){const S=r.value;if(!S)return!1;const k=a.value[S.id];return S.type==="multiple"?Array.isArray(k)&&k.includes(M):k===M}function y(M){const S=r.value;if(S){if(S.type==="single")a.value={...a.value,[S.id]:M},c.value="";else if(S.type==="multiple"){const k=a.value[S.id]??[],Z=k.includes(M)?k.filter(N=>N!==M):[...k,M];a.value={...a.value,[S.id]:Z}}}}function _(M){const S=r.value;if(!S)return;const k=M.target.value;c.value=k,a.value={...a.value,[S.id]:k}}function v(){i.value>0&&(i.value--,d())}function h(){u.value?D():(i.value++,d())}function C(){u.value?D():(i.value++,d())}function m(){return`[Quiz answers] ${s.questions.filter(S=>p(S.id)).map(S=>{const k=a.value[S.id],Z=Array.isArray(k)?k.join(", "):k;return`${S.id}: ${Z}`}).join(" | ")}`}function D(){l.value&&(o.value=!0,n("submit",m()))}const R=P(()=>s.questions.filter(M=>p(M.id)).map(M=>{const S=a.value[M.id];return Array.isArray(S)?S.join(", "):S}).join(" · "));return(M,S)=>{var N;const k=pe,Z=ye;return o.value?(x(),A("div",Gg,[b(k,{name:"lucide:check-circle-2",class:"size-3.5 shrink-0 text-primary"}),w("span",Zg,[S[2]||(S[2]=w("span",{class:"font-medium text-foreground"},"Answered",-1)),R.value?(x(),A(le,{key:0},[B(" · "+I(R.value),1)],64)):q("",!0)])])):M.questions.length>0?(x(),A("div",Wg,[w("div",Kg,[w("div",Yg,[w("div",Xg,[b(g(Ce),{variant:"outline",class:"text-xs px-1"},{default:T(()=>[b(k,{name:"lucide:help-circle",class:"size-3 text-primary"}),S[3]||(S[3]=B(" Clarification "))]),_:1}),M.context?(x(),A("span",{key:0,class:"text-xs text-muted-foreground truncate",title:M.context},I(M.context),9,Jg)):q("",!0)]),w("span",Qg,I(i.value+1)+" / "+I(M.questions.length),1)]),w("div",ey,[w("div",{class:"h-full rounded-full bg-primary transition-all duration-300",style:Vt({width:`${(i.value+1)/M.questions.length*100}%`})},null,4)])]),w("div",ty,[b(os,{name:"quiz-slide",mode:"out-in"},{default:T(()=>{var U;return[r.value?(x(),A("div",{key:r.value.id,class:"space-y-3"},[w("p",sy,[B(I(r.value.question)+" ",1),r.value.required?(x(),A("span",ny,"*")):q("",!0)]),(U=r.value.suggestions)!=null&&U.length?(x(),A(le,{key:0},[r.value.type==="single"?(x(),F(g(ro),{key:0,"model-value":a.value[r.value.id],"onUpdate:modelValue":S[0]||(S[0]=z=>y(String(z))),class:"flex flex-col gap-3 py-1"},{default:T(()=>[(x(!0),A(le,null,Se(r.value.suggestions,z=>(x(),A("div",{key:z,class:"flex items-center space-x-2"},[b(g(lo),{id:z,value:z},null,8,["id","value"]),b(g(Zs),{for:z,class:"cursor-pointer text-sm font-normal leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"},{default:T(()=>[B(I(z),1)]),_:2},1032,["for"])]))),128))]),_:1},8,["model-value"])):r.value.type==="multiple"?(x(),A("div",ay,[(x(!0),A(le,null,Se(r.value.suggestions,z=>(x(),A("div",{key:z,class:"flex items-center space-x-2"},[b(g(Dc),{id:z,checked:f(z),"onUpdate:checked":he=>y(z)},null,8,["id","checked","onUpdate:checked"]),b(g(Zs),{for:z,class:"cursor-pointer text-sm font-normal leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"},{default:T(()=>[B(I(z),1)]),_:2},1032,["for"])]))),128))])):(x(),F(g(ro),{key:2,"model-value":a.value[r.value.id],"onUpdate:modelValue":S[1]||(S[1]=z=>y(String(z))),class:"flex flex-col gap-3 py-1"},{default:T(()=>[(x(!0),A(le,null,Se(r.value.suggestions,z=>(x(),A("div",{key:z,class:"flex items-center space-x-2"},[b(g(lo),{id:z,value:z},null,8,["id","value"]),b(g(Zs),{for:z,class:"cursor-pointer text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"},{default:T(()=>[B(I(z),1)]),_:2},1032,["for"])]))),128))]),_:1},8,["model-value"]))],64)):q("",!0),w("input",{value:c.value,type:"text",class:"w-full rounded-lg border border-border bg-muted/30 px-3 py-1.5 text-sm placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-primary/40 focus:border-primary/50 transition-all",placeholder:r.value.type==="open"?"Type your answer…":"Or type a custom answer…",onInput:_},null,40,iy)])):q("",!0)]}),_:1})]),w("div",oy,[i.value>0?(x(),F(Z,{key:0,variant:"ghost",size:"sm",class:"text-xs h-7",onClick:v},{default:T(()=>[b(k,{name:"lucide:arrow-left",class:"size-3 mr-1"}),S[4]||(S[4]=B(" Back "))]),_:1})):(x(),A("div",ry)),w("div",ly,[!((N=r.value)!=null&&N.required)&&!u.value?(x(),F(Z,{key:0,variant:"ghost",size:"xs",onClick:C},{default:T(()=>S[5]||(S[5]=[B(" Skip ")])),_:1})):q("",!0),b(Z,{size:"xs",disabled:u.value&&!l.value,onClick:h},{default:T(()=>[B(I(u.value?"Submit":"Next")+" ",1),u.value?(x(),F(k,{key:1,name:"lucide:send",class:"size-3 ml-1"})):(x(),F(k,{key:0,name:"lucide:arrow-right",class:"size-3 ml-1"}))]),_:1},8,["disabled"])])])])):q("",!0)}}}),cy=Ho(uy,[["__scopeId","data-v-2b68c703"]]),dy={class:"flex h-full flex-col bg-sidebar/50 z-50 p-2 gap-2"},py={class:"flex shrink-0 items-center justify-between gap-2"},fy={class:"flex items-center min-w-0 gap-1 flex-1"},my={class:"text-xs"},hy={class:"flex-1 overflow-hidden flex flex-col min-h-0 relative mt-2"},gy={class:"flex-1 min-h-0 overflow-y-auto w-full relative"},yy={key:0,class:"absolute inset-0 flex items-center justify-center p-6 z-10"},vy={class:"space-y-2"},by=["onClick"],xy={class:"min-w-0 flex-1"},_y={class:"text-xs font-medium truncate"},wy={class:"flex items-center gap-2"},Sy={class:"min-w-0 flex-1"},Ty={class:"flex flex-wrap gap-1.5 text-xs"},ky={class:"flex-1 overflow-y-auto px-4 space-y-4"},Ay={key:0,class:"space-y-2"},Cy={key:0,class:"bg-muted/50 p-3 rounded-md overflow-x-auto whitespace-pre-wrap font-mono border chat-code-text"},Ey={key:1,class:"flex flex-col items-center justify-center p-5 bg-muted/20 rounded-md border border-dashed min-h-[140px]"},Py={key:1,class:"text-sm"},Iy={key:2,class:"flex flex-col gap-3 p-3 bg-muted/30 rounded-md border"},My={class:"text-xs font-medium"},Ry={key:0,class:"text-xs text-primary break-all flex items-center gap-1"},Dy=["href"],$y={key:1,class:"text-xs text-muted-foreground"},Vy={class:"flex gap-2"},Oy=Y({__name:"AgentAttachmentPanel",props:{messages:{}},emits:["close"],setup(e,{emit:t}){const s=e,n=t,a=P(()=>s.messages),{attachments:i,files:o,codes:r,sources:u}=Rl(a),{downloadFile:l}=Ma(),c=W("all"),d=S=>({type:"file",id:S.id,name:S.filename,description:"Exported File",icon:"hugeicons:file-02",data:S.result}),p=S=>({type:"source",id:S.id,name:S.title||S.filename||S.url,description:S.url||"Link & Resources",icon:"hugeicons:link-square-02",data:S}),f=S=>({type:"code",id:S.id,name:S.language?`Snippet (${S.language})`:"Snippet",description:"Code Snippet",icon:"hugeicons:code-circle",data:S}),y=P(()=>({all:[...o.value.map(d),...u.value.map(p),...r.value.map(f)],files:o.value.map(d),code:r.value.map(f),links:u.value.map(p)})),_=P(()=>y.value[c.value]||[]),v=W(!1),h=W(null),C=S=>{if(S==null)return"—";if(S<1024)return`${S} B`;const k=["KB","MB","GB","TB"];let Z=S/1024,N=0;for(;Z>=1024&&N<k.length-1;)Z/=1024,N+=1;return`${Z.toFixed(Z>=10?0:1)} ${k[N]}`},m=P(()=>h.value?h.value.type==="file"?"File":h.value.type==="code"?"Code":"Link":""),D=P(()=>{var S,k;return((S=h.value)==null?void 0:S.type)==="source"&&!!((k=h.value.data)!=null&&k.url)}),R=S=>{h.value=S,v.value=!0},M=async S=>{var k;if(S)if(S.type==="file")await l(S.data);else if(S.type==="code"){const Z=S.data.code,N=new Blob([Z],{type:"text/plain"}),U=URL.createObjectURL(N),z=document.createElement("a");z.href=U,z.download=`snippet-${S.id.substring(0,6)}.${S.data.language||"txt"}`,z.click(),URL.revokeObjectURL(U)}else S.type==="source"&&(k=S.data)!=null&&k.url&&window.open(S.data.url,"_blank","noopener,noreferrer")};return(S,k)=>{const Z=pe,N=Uu;return x(),A("div",dy,[w("div",py,[w("div",fy,[b(Z,{name:"hugeicons:attachment",class:"size-4"}),k[6]||(k[6]=w("h3",{class:"text-sm font-semibold text-foreground"},"Attachments",-1)),w("p",my,I(g(i).length),1)]),b(g(ye),{size:"iconMd",variant:"ghost",onClick:k[0]||(k[0]=U=>n("close"))},{default:T(()=>[b(Z,{name:"lucide:x",class:"size-4"})]),_:1})]),w("div",hy,[b(g(zu),{modelValue:c.value,"onUpdate:modelValue":k[1]||(k[1]=U=>c.value=U),class:"flex-1 min-h-0"},{default:T(()=>[b(g(qu),{size:"sm"},{default:T(()=>[b(g(ys),{size:"xs",value:"all",class:"cursor-pointer"},{default:T(()=>k[7]||(k[7]=[B("All")])),_:1}),b(g(ys),{size:"xs",value:"files",class:"cursor-pointer"},{default:T(()=>k[8]||(k[8]=[B("Files")])),_:1}),b(g(ys),{size:"xs",value:"code",class:"cursor-pointer"},{default:T(()=>k[9]||(k[9]=[B("Code")])),_:1}),b(g(ys),{size:"xs",value:"links",class:"cursor-pointer"},{default:T(()=>k[10]||(k[10]=[B("Links")])),_:1})]),_:1}),w("div",gy,[_.value.length===0?(x(),A("div",yy,[b(N,{title:"No items found",desc:"Add an attachment to see it here."})])):q("",!0),(x(),A(le,null,Se(["all","files","code","links"],U=>b(g(Hu),{key:U,value:U,class:"h-full mt-0 focus-visible:ring-0"},{default:T(()=>[w("div",vy,[(x(!0),A(le,null,Se(y.value[U],z=>(x(),A("div",{key:z.id,class:"p-2 px-3 border rounded-lg bg-card hover:bg-accent/50 transition-colors flex items-center gap-2 cursor-pointer group",onClick:he=>R(z)},[b(Z,{name:z.icon,class:"size-5!"},null,8,["name"]),w("div",xy,[w("p",_y,I(z.name),1),w("p",{class:re(["text-xxs text-muted-foreground truncate",z.type==="source"?"text-primary/70":""])},I(z.description),3)]),b(Z,{name:"hugeicons:view",class:"opacity-0 group-hover:opacity-100 transition-opacity text-muted-foreground"})],8,by))),128))])]),_:2},1032,["value"])),64))])]),_:1},8,["modelValue"])]),b(g(Gu),{open:v.value,"onUpdate:open":k[5]||(k[5]=U=>v.value=U)},{default:T(()=>[b(g(Zu),{class:"max-w-[50vw]! w-full max-h-[70vh] p-0 flex flex-col overflow-hidden"},{default:T(()=>{var U,z,he;return[b(g(Wu),{class:"p-4 pb-2 text-left"},{default:T(()=>{var E;return[w("div",wy,[b(Z,{name:((E=h.value)==null?void 0:E.icon)||"hugeicons:file-02",class:"size-5!"},null,8,["name"]),w("div",Sy,[b(g(Ku),{class:"truncate flex items-center gap-2"},{default:T(()=>{var j,G,ae,ce,J,Te;return[B(I(((j=h.value)==null?void 0:j.name)||"Attachment Preview")+" ",1),w("div",Ty,[b(g(Ce),{variant:"secondary",class:"h-5 px-1.5"},{default:T(()=>[B(I(m.value),1)]),_:1}),((G=h.value)==null?void 0:G.type)==="file"?(x(),F(g(Ce),{key:0,variant:"outline",class:"h-5 px-1.5"},{default:T(()=>[B(I(h.value.data.format||"file"),1)]),_:1})):q("",!0),((ae=h.value)==null?void 0:ae.type)==="file"?(x(),F(g(Ce),{key:1,variant:"outline",class:"h-5 px-1.5"},{default:T(()=>[B(I(C(h.value.data.fileSize)),1)]),_:1})):q("",!0),((ce=h.value)==null?void 0:ce.type)==="code"?(x(),F(g(Ce),{key:2,variant:"outline",class:"h-5 px-1.5"},{default:T(()=>[B(I(h.value.data.language||"text"),1)]),_:1})):q("",!0),((J=h.value)==null?void 0:J.type)==="source"&&((Te=h.value.data)!=null&&Te.mediaType)?(x(),F(g(Ce),{key:3,variant:"outline",class:"h-5 px-1.5"},{default:T(()=>[B(I(h.value.data.mediaType),1)]),_:1})):q("",!0)])]}),_:1}),b(g(Yu),{class:"text-sm"},{default:T(()=>k[11]||(k[11]=[B(" Preview attachment details and content. ")])),_:1})])])]}),_:1}),w("div",ky,[((U=h.value)==null?void 0:U.type)==="file"?(x(),A("div",Ay,[h.value.data.encoding==="utf8"?(x(),A("div",Cy,I(h.value.data.content),1)):(x(),A("div",Ey,[b(Z,{name:"hugeicons:file-unknown",class:"size-12 text-muted-foreground/50 mb-3"}),k[12]||(k[12]=w("p",{class:"text-foreground text-sm font-medium"}," Binary file format ",-1)),k[13]||(k[13]=w("p",{class:"text-xs text-muted-foreground text-center mt-1"}," Preview is not available for this file type. Download to view. ",-1))]))])):((z=h.value)==null?void 0:z.type)==="code"?(x(),A("div",Py,[b(g(Fs),{id:h.value.data.id,code:h.value.data.code,language:h.value.data.language,"is-streaming":!1,"is-block-streaming":!1},null,8,["id","code","language"])])):((he=h.value)==null?void 0:he.type)==="source"?(x(),A("div",Iy,[w("div",null,[k[14]||(k[14]=w("h4",{class:"text-[11px] font-semibold text-muted-foreground uppercase mb-1"}," Title ",-1)),w("p",My,I(h.value.data.title||h.value.data.filename||"Untitled Resource"),1)]),w("div",null,[k[15]||(k[15]=w("h4",{class:"text-[11px] font-semibold text-muted-foreground uppercase mb-1"}," URL ",-1)),h.value.data.url?(x(),A("p",Ry,[w("a",{href:h.value.data.url,target:"_blank",class:"hover:underline"},I(h.value.data.url),9,Dy),b(Z,{name:"hugeicons:link-square-02",class:"size-3 shrink-0"})])):(x(),A("p",$y," No URL provided. "))])])):q("",!0)]),b(g(Xu),{class:"p-4 flex justify-end pt-0"},{default:T(()=>{var E;return[b(g(ye),{variant:"outline",size:"sm",onClick:k[2]||(k[2]=j=>v.value=!1)},{default:T(()=>k[16]||(k[16]=[B(" Close ")])),_:1}),w("div",Vy,[((E=h.value)==null?void 0:E.type)==="source"?(x(),F(g(ye),{key:0,size:"sm",disabled:!D.value,onClick:k[3]||(k[3]=j=>M(h.value))},{default:T(()=>[k[17]||(k[17]=B(" Open Link ")),b(Z,{name:"hugeicons:link-square-02",class:"size-3 ml-2"})]),_:1},8,["disabled"])):(x(),F(g(ye),{key:1,size:"sm",onClick:k[4]||(k[4]=j=>M(h.value))},{default:T(()=>[k[18]||(k[18]=B(" Download ")),b(Z,{name:"hugeicons:download-04",class:"size-3"})]),_:1}))])]}),_:1})]}),_:1})]),_:1},8,["open"])])}}}),Bn=[{id:"generate-query",label:"Generate Query",toolName:"generate_query",category:"SQL",description:"Turn a natural language request into SQL for the active schema.",insertText:"Generate SQL for ",icon:"hugeicons:ai-brain-03",promptHint:"The user wants help drafting SQL from natural language. Prefer generate_query first and keep the response focused on producing or refining SQL."},{id:"render-table",label:"Render Table",toolName:"render_table",category:"Execution",description:"Run a read-only SQL query and show the result rows as a table.",insertText:"Run this query and show the table result for ",icon:"hugeicons:table-01",promptHint:"The user expects concrete table output. After generating or receiving read-only SQL, prefer render_table and summarize the returned rows briefly."},{id:"visualize-table",label:"Visualize Table",toolName:"visualize_table",category:"Charts",description:"Build a bar, line, pie, or scatter chart from a read-only query.",insertText:"Visualize this data as a bar, line, pie, or scatter chart for ",icon:"hugeicons:chart-line-data-01",promptHint:"The user wants a chart-oriented answer. Prefer visualize_table for read-only SQL, and ask for the chart type only if it is still missing."},{id:"describe-table",label:"Describe Table",toolName:"describe_table",category:"Schema",description:"Inspect columns, keys, relationships, and table structure.",insertText:"Describe the structure of table ",icon:"hugeicons:database",promptHint:"The user is asking about schema shape, keys, or relationships. Prefer describe_table when a specific table is involved."},{id:"explain-query",label:"Explain Query",toolName:"explain_query",category:"Performance",description:"Analyze a query plan and explain possible performance issues.",insertText:"Explain why this query is slow: ",icon:"hugeicons:activity-02",promptHint:"The user is focused on query performance. Prefer explain_query once a concrete SQL statement is available."},{id:"detect-anomaly",label:"Detect Anomaly",toolName:"detect_anomaly",category:"Quality",description:"Scan for nulls, duplicates, orphaned keys, and outlier values.",insertText:"Detect anomalies in table ",icon:"hugeicons:search-list-01",promptHint:"The user wants data quality checks. Prefer detect_anomaly for table-level validation and summarize the findings with severity."}],Dl=e=>{const t=new Set(e);return Bn.filter(s=>t.has(s.id))},Ly={class:"w-full relative"},By={key:0,class:"absolute bottom-[calc(100%+8px)] left-4 right-4 z-50 overflow-hidden rounded-2xl border border-border/80 bg-background shadow-lg"},Ny=["id","aria-selected","onMouseenter","onClick"],jy={class:"min-w-0 flex-1"},Fy={class:"flex items-center gap-2"},zy={class:"text-xs font-medium text-foreground"},qy={class:"mt-1 block text-xs text-muted-foreground"},Uy={key:0,class:"rounded-xl px-3 py-5 text-center text-[11px] text-muted-foreground"},Hy={class:"dark:bg-sidebar rounded-3xl border shadow-xs p-3 px-2 pb-2 flex flex-col gap-1 relative z-40"},Gy={key:0,class:"flex flex-wrap gap-2 pb-1"},Zy=["aria-label","onClick"],Wy={class:"flex items-center justify-between px-1"},Ky={class:"flex items-center gap-1"},Yy={class:"relative w-fit"},Xy={class:"flex items-center gap-3"},ws="agent-command-listbox",uo="agent-command-status",Jy=Y({__name:"AgentChatInput",props:{modelValue:{},isLoading:{type:Boolean},hasApiKey:{type:Boolean},provider:{},model:{},selectedCommandOptions:{}},emits:["update:modelValue","update:provider","update:model","update:selectedCommandOptions","submit","stop","keydown"],setup(e,{expose:t,emit:s}){const n=e,a=s,i=W(n.modelValue),o=W(0),r=W("");ge(()=>n.modelValue,E=>{i.value=E});const u=W(null),l=P({get:()=>n.selectedCommandOptions,set:E=>a("update:selectedCommandOptions",E)}),c=P(()=>Dl(l.value)),d=()=>{const E=u.value;if(!E)return null;if(E instanceof HTMLTextAreaElement)return E;if(typeof E=="object"&&"$el"in E&&E.$el instanceof HTMLElement){const j=E.$el;return j instanceof HTMLTextAreaElement?j:j.querySelector("textarea")}return E instanceof HTMLElement?E.querySelector("textarea"):null},p=()=>{const E=d();E==null||E.focus()};t({focusInput:p});const f=P(()=>{const E=d(),j=(E==null?void 0:E.selectionStart)??i.value.length;return i.value.slice(0,j).match(/(?:^|\s)\/([a-z0-9_-]*)$/i)}),y=P(()=>{var E,j;return((j=(E=f.value)==null?void 0:E[1])==null?void 0:j.toLowerCase())||""}),_=P(()=>f.value?f.value[0]:""),v=P(()=>{const E=y.value.trim();return f.value?E?Bn.filter(j=>[j.label,j.toolName,j.description,j.category].join(" ").toLowerCase().includes(E)):Bn:[]}),h=P(()=>!!f.value&&_.value!==r.value),C=P(()=>v.value[o.value]||null),m=P(()=>h.value?v.value.length===0?"No matching agent tools. Keep typing to filter or press Escape to close.":`${v.value.length} agent tools available. Use arrow keys to move, Enter or Tab to insert, and Escape to close.`:"");ge(v,E=>{if(E.length===0){o.value=0;return}o.value>=E.length&&(o.value=0)}),ge(_,E=>{E||(r.value="")});const D=E=>{const j=E.target.value;i.value=j,r.value&&r.value!==_.value&&(r.value=""),a("update:modelValue",j)},R=async()=>{r.value=_.value,o.value=0,await Fe(),p()},M=E=>{l.value.includes(E.id)||(l.value=[...l.value,E.id])},S=E=>{l.value=l.value.filter(j=>j!==E)},k=async E=>{const j=d(),G=(j==null?void 0:j.selectionStart)??i.value.length,ae=i.value.slice(0,G),ce=i.value.slice(G);if(!ae.match(/(?:^|\s)\/([a-z0-9_-]*)$/i))return;const Te=ae.lastIndexOf("/"),Ve=i.value.slice(0,Te);let Ge=`${Ve}${ce}`;Ve.trim()||(Ge=Ge.trimStart());const Ke=Math.min(Ve.length,Ge.length);i.value=Ge,a("update:modelValue",Ge),M(E),o.value=0,r.value="",await Fe();const Ae=d();Ae==null||Ae.focus(),Ae==null||Ae.setSelectionRange(Ke,Ke)},Z=E=>{if(h.value){if(E.key==="Escape"){E.preventDefault(),R();return}if(v.value.length>0){if(E.key==="ArrowDown"){E.preventDefault(),o.value=(o.value+1)%v.value.length;return}if(E.key==="ArrowUp"){E.preventDefault(),o.value=(o.value-1+v.value.length)%v.value.length;return}if(E.key==="Home"){E.preventDefault(),o.value=0;return}if(E.key==="End"){E.preventDefault(),o.value=v.value.length-1;return}if(E.key==="Enter"||E.key==="Tab"){E.preventDefault();const j=C.value;j&&k(j);return}}}a("keydown",E)},N=E=>{E==null||E.preventDefault(),a("submit",typeof E=="object"&&E!==null?E:void 0)},U=E=>{if(n.isLoading){E==null||E.preventDefault(),a("stop");return}N(E)},z=P({get:()=>n.provider,set:E=>a("update:provider",E)}),he=P({get:()=>n.model,set:E=>a("update:model",E)});return(E,j)=>{const G=pe,ae=Rc,ce=ye;return x(),A("div",Ly,[h.value?(x(),A("div",By,[j[4]||(j[4]=w("div",{class:"border-b border-border/50 px-3 py-2"},[w("p",{class:"text-xs font-medium"},"Agent tools"),w("p",{class:"mt-1 text-xs text-muted-foreground"},[B(" Type after "),w("span",{class:"font-medium text-foreground"},"/"),B(" to filter. ")])],-1)),w("div",{id:ws,role:"listbox","aria-label":"Agent tools",class:"max-h-[260px] overflow-y-auto px-2 py-2"},[(x(!0),A(le,null,Se(v.value,(J,Te)=>(x(),A("button",{id:`${ws}-${J.id}`,key:J.id,type:"button",role:"option","aria-selected":Te===o.value,class:re(["mt-0.5 flex w-full items-start gap-2 rounded-xl px-3 py-2 text-left transition-colors first:mt-0 cursor-pointer",Te===o.value?"bg-muted text-foreground":"text-muted-foreground hover:bg-muted/70 hover:text-foreground"]),onMouseenter:Ve=>o.value=Te,onClick:Ve=>k(J)},[b(G,{name:J.icon,class:"mt-0.5 size-[18px] shrink-0"},null,8,["name"]),w("span",jy,[w("span",Fy,[w("span",zy,I(J.label),1)]),w("span",qy,I(J.description),1)]),w("div",null,[c.value.find(Ve=>Ve.id===J.id)?(x(),F(G,{key:0,name:"hugeicons:checkmark-circle-01",class:"size-4 mt-0.5 text-muted-foreground cursor-pointer"})):q("",!0)])],42,Ny))),128)),v.value.length===0?(x(),A("div",Uy,j[3]||(j[3]=[B(" No matching tools. Try "),w("span",{class:"font-medium text-foreground"},"/render",-1),B(" or "),w("span",{class:"font-medium text-foreground"},"/describe",-1),B(". ")]))):q("",!0)])])):q("",!0),w("div",Hy,[c.value.length>0?(x(),A("div",Gy,[(x(!0),A(le,null,Se(c.value,J=>(x(),A("div",{key:J.id,class:"inline-flex items-center gap-1 rounded-full border border-border/70 bg-muted/40 px-1.5 py-0.5 text-xs text-foreground"},[b(G,{name:J.icon,class:"size-3.5 text-muted-foreground"},null,8,["name"]),w("span",null,I(J.label),1),w("button",{type:"button",class:"inline-flex size-4 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-background hover:text-foreground","aria-label":`Remove ${J.label}`,onClick:Te=>S(J.id)},[b(G,{name:"lucide:x",class:"size-3"})],8,Zy)]))),128))])):q("",!0),b(ae,{ref_key:"textareaRef",ref:u,modelValue:i.value,"onUpdate:modelValue":j[0]||(j[0]=J=>i.value=J),disabled:!E.hasApiKey||E.isLoading,placeholder:"Ask Orca anythink, / for agent tools",class:"w-full bg-transparent! outline-none border-0 shadow-none focus-visible:ring-0 placeholder:text-muted-foreground resize-none px-2 pt-0 min-h-12 max-h-36 text-sm","aria-autocomplete":"list","aria-controls":h.value?ws:void 0,"aria-describedby":uo,"aria-activedescendant":C.value?`${ws}-${C.value.id}`:void 0,"aria-expanded":h.value,onInput:D,onKeydown:Z},null,8,["modelValue","disabled","aria-controls","aria-activedescendant","aria-expanded"]),w("p",{id:uo,class:"sr-only","aria-live":"polite"},I(m.value),1),w("div",Wy,[w("div",Ky,[w("div",Yy,[b(Ju,{provider:z.value,"onUpdate:provider":j[1]||(j[1]=J=>z.value=J),model:he.value,"onUpdate:model":j[2]||(j[2]=J=>he.value=J),class:"h-7! border-0 bg-transparent hover:bg-muted rounded-lg shadow-none px-2! text-xs text-muted-foreground hover:text-foreground cursor-pointer"},null,8,["provider","model"])])]),w("div",Xy,[b(ce,{size:"iconMd",type:"button",class:"rounded-full shadow bg-foreground text-background hover:bg-foreground disabled disabled:bg-muted disabled:text-muted-foreground",disabled:!i.value.trim()&&!E.isLoading||!E.hasApiKey,onClick:U},{default:T(()=>[b(G,{name:E.isLoading?"lucide:square":"lucide:arrow-up",class:re(["size-4 stroke-[2]",E.isLoading?"fill-current":""])},null,8,["name","class"])]),_:1},8,["disabled"])])])])])}}}),Qy={class:"flex items-center justify-between px-4 mt-2 text-[12px] text-muted-foreground relative z-30"},ev={class:"flex items-center gap-4"},tv={class:"flex items-center gap-1"},sv={class:"flex items-center gap-1.5"},nv={class:"flex items-center gap-1.5"},av=Y({__name:"AgentChatStatusBar",props:{modelLabel:{},isLoading:{type:Boolean},showReasoning:{type:Boolean}},emits:["update:showReasoning"],setup(e,{emit:t}){const s=t;return(n,a)=>{const i=pe,o=Qu;return x(),A("div",Qy,[w("div",ev,[w("div",tv,[b(i,{name:"hugeicons:ai-brain-05",class:"size-3.5 stroke-[1.5]"}),a[1]||(a[1]=w("span",null,"Reasoning",-1)),b(o,{"model-value":n.showReasoning,"aria-label":"Toggle reasoning",class:"cursor-pointer","onUpdate:modelValue":a[0]||(a[0]=r=>s("update:showReasoning",!!r))},null,8,["model-value"])]),w("div",sv,[b(i,{name:"hugeicons:robotic",class:"size-3.5 stroke-[1.5]"}),w("span",null,I(n.modelLabel),1)])]),w("div",nv,[b(i,{name:n.isLoading?"hugeicons:loading-03":"hugeicons:checkmark-circle-01",class:re(["size-3.5 stroke-[1.5]",n.isLoading?"animate-spin":""])},null,8,["name","class"]),w("span",null,I(n.isLoading?"Streaming":"Ready"),1)])])}}}),iv={class:"w-full py-2"},ov={class:"relative w-full max-w-3xl mx-auto flex flex-col px-4"},rv={key:0,class:"absolute -top-12 left-1/2 transform -translate-x-1/2 z-20"},lv=Y({__name:"AgentChatFooter",props:{modelValue:{},isLoading:{type:Boolean},hasApiKey:{type:Boolean},provider:{},model:{},selectedCommandOptions:{},showReasoning:{type:Boolean},showScrollButton:{type:Boolean}},emits:["update:modelValue","update:provider","update:model","update:selectedCommandOptions","update:showReasoning","submit","stop","keydown","scrollToBottom"],setup(e,{expose:t,emit:s}){const n=e,a=s,i=P({get:()=>n.modelValue,set:p=>a("update:modelValue",p)}),o=P({get:()=>n.provider,set:p=>a("update:provider",p)}),r=P({get:()=>n.model,set:p=>a("update:model",p)}),u=P({get:()=>n.selectedCommandOptions,set:p=>a("update:selectedCommandOptions",p)}),l=P(()=>`${n.provider} / ${n.model}`),c=W(null);return t({focusInput:()=>{var p;(p=c.value)==null||p.focusInput()}}),(p,f)=>(x(),A("footer",iv,[w("div",ov,[b(os,{"enter-active-class":"transition-all duration-200 ease-out","enter-from-class":"opacity-0 translate-y-4","enter-to-class":"opacity-100 translate-y-0","leave-active-class":"transition-all duration-200 ease-in","leave-from-class":"opacity-100 translate-y-0","leave-to-class":"opacity-0 translate-y-4"},{default:T(()=>[p.showScrollButton?(x(),A("div",rv,[w("button",{class:"flex items-center justify-center size-8 bg-background border border-border rounded-full shadow-sm text-muted-foreground hover:bg-muted/50 cursor-pointer outline-none transition-colors",onClick:f[0]||(f[0]=y=>a("scrollToBottom"))},[b(g(pe),{name:"lucide:arrow-down",class:"size-4 shrink-0"})])])):q("",!0)]),_:1}),b(Jy,{ref_key:"inputRef",ref:c,modelValue:i.value,"onUpdate:modelValue":f[1]||(f[1]=y=>i.value=y),provider:o.value,"onUpdate:provider":f[2]||(f[2]=y=>o.value=y),model:r.value,"onUpdate:model":f[3]||(f[3]=y=>r.value=y),"selected-command-options":u.value,"onUpdate:selectedCommandOptions":f[4]||(f[4]=y=>u.value=y),"is-loading":p.isLoading,"has-api-key":p.hasApiKey,onSubmit:f[5]||(f[5]=y=>a("submit",y)),onStop:f[6]||(f[6]=y=>a("stop")),onKeydown:f[7]||(f[7]=y=>a("keydown",y))},null,8,["modelValue","provider","model","selected-command-options","is-loading","has-api-key"]),b(av,{"model-label":l.value,"is-loading":p.isLoading,"show-reasoning":p.showReasoning,"onUpdate:showReasoning":f[8]||(f[8]=y=>a("update:showReasoning",y))},null,8,["model-label","is-loading","show-reasoning"])])]))}}),uv={class:"space-y-4 rounded-xl border border-border/70 bg-muted/20 p-4"},cv={class:"flex flex-wrap items-center gap-2"},dv={key:0,class:"rounded-2xl border bg-background/80 px-3 py-3 text-sm"},pv={key:1,class:"space-y-3"},fv={class:"flex flex-wrap items-center gap-2"},mv={key:0,class:"text-xs text-muted-foreground"},hv={class:"mt-3 text-sm leading-6"},gv={key:0,class:"mt-3 rounded-xl border bg-muted/30"},yv={class:"overflow-x-auto border-t px-3 py-3 leading-6 chat-code-text"},vv=Y({__name:"AgentAnomalyBlock",props:{data:{}},setup(e){const t={high:"destructive",medium:"secondary",low:"outline"},s=n=>t[n];return(n,a)=>{const i=Ce;return x(),A("div",uv,[w("div",cv,[b(i,{variant:"secondary",class:"text-xxs tracking-[0.16em]"},{default:T(()=>[B(" Clean Score "+I(n.data.cleanScore)+"/100 ",1)]),_:1}),b(i,{variant:"outline",class:"text-xxs tracking-[0.16em]"},{default:T(()=>[B(I(n.data.scannedRows)+" rows scanned ",1)]),_:1})]),n.data.issues.length===0?(x(),A("div",dv," No anomalies were detected in the requested checks. ")):(x(),A("div",pv,[(x(!0),A(le,null,Se(n.data.issues,(o,r)=>(x(),A("div",{key:`${o.type}-${o.column||r}`,class:"rounded-2xl border bg-background/90 p-3"},[w("div",fv,[b(i,{variant:s(o.severity),class:"text-xxs tracking-[0.16em]"},{default:T(()=>[B(I(o.severity.toUpperCase()),1)]),_:2},1032,["variant"]),b(i,{variant:"outline",class:"text-xxs tracking-[0.16em]"},{default:T(()=>[B(I(o.type),1)]),_:2},1024),o.column?(x(),A("span",mv,I(o.column),1)):q("",!0)]),w("p",hv,I(o.description),1),o.fixSql?(x(),A("details",gv,[a[0]||(a[0]=w("summary",{class:"cursor-pointer px-3 py-2 text-xs font-medium uppercase tracking-[0.16em] text-muted-foreground"}," Fix suggestion ",-1)),w("pre",yv,I(o.fixSql),1)])):q("",!0)]))),128))]))])}}}),bv={class:"space-y-2"},xv={class:"flex flex-wrap justify-start gap-2"},_v=Y({__name:"AgentApprovalBlock",props:{toolName:{},input:{},approvalId:{}},emits:["approve","deny"],setup(e,{emit:t}){const s=e,n=t,a=P(()=>"sql"in s.input&&typeof s.input.sql=="string"?s.input.sql:JSON.stringify(s.input,null,2));return(i,o)=>{const r=Fs,u=ye;return x(),A("div",bv,[o[4]||(o[4]=w("div",{class:""},[w("div",{class:"text-xs font-medium"},"Approval Required"),w("p",{class:"text-xs text-muted-foreground"}," *This action needs confirmation before execution. ")],-1)),b(r,{id:s.approvalId,code:g(a)||"",language:"sql"},null,8,["id","code"]),w("div",xv,[b(u,{variant:"outline",size:"xs",class:"rounded-xl font-normal",onClick:o[0]||(o[0]=l=>n("deny",i.approvalId))},{default:T(()=>o[2]||(o[2]=[B(" Cancel ")])),_:1}),b(u,{size:"xs",class:"rounded-xl font-normal",onClick:o[1]||(o[1]=l=>n("approve",i.approvalId))},{default:T(()=>o[3]||(o[3]=[B(" Confirm ")])),_:1})])])}}}),wv={class:"flex items-start justify-between gap-3"},Sv={class:"space-y-2 min-w-0"},Tv={class:"flex items-center gap-2"},kv={class:"text-sm font-medium"},Av={class:"text-sm leading-6"},Cv={key:0,class:"space-y-2"},Ev={class:"flex flex-wrap gap-1"},cn=Y({__name:"AgentDescribeBlock",props:{data:{}},setup(e){const t=e,s=P(()=>[["name","Name"],["type","Type"],["nullable","Nullable"],["pk","PK"],["fk","FK"],["references","References"],["description","Description"]].map(([r,u])=>({originalName:r,queryFieldName:r,aliasFieldName:u,isPrimaryKey:!1,isForeignKey:!1,canMutate:!1,type:"text",tableName:""}))),n=P(()=>t.data.columns.map(r=>({name:r.name,type:r.type,nullable:r.isNullable?"Yes":"No",pk:r.isPrimaryKey?"Yes":"No",fk:r.isForeignKey?"Yes":"No",references:r.referencesTable||"—",description:r.description||"—"}))),a=P(()=>aa({columns:s.value,rows:n.value,columnKeyBy:"field",hasHashIndex:!1})),i=P(()=>ia(n.value,!1)),o=P(()=>{const d=48+n.value.length*32;return Math.max(120,Math.min(d,360))});return(r,u)=>{const l=pe,c=Ce,d=ra;return x(),A(le,null,[w("div",wv,[w("div",Sv,[w("div",Tv,[b(l,{name:"hugeicons:grid-table",class:"size-4 text-primary"}),w("div",kv,I(r.data.tableName),1)]),w("p",Av,I(r.data.summary),1)]),b(c,{variant:"outline",class:"shrink-0"},{default:T(()=>[B(I(r.data.columns.length)+" columns ",1)]),_:1})]),w("div",{class:"overflow-hidden rounded-lg border",style:Vt({height:`${g(o)}px`})},[b(d,{"column-defs":g(a),"row-data":g(i),"column-types":g(oa),class:"h-full w-full"},null,8,["column-defs","row-data","column-types"])],4),r.data.relatedTables.length>0?(x(),A("div",Cv,[u[0]||(u[0]=w("div",{class:"text-[11px] font-medium text-muted-foreground"}," Related Tables ",-1)),w("div",Ev,[(x(!0),A(le,null,Se(r.data.relatedTables,p=>(x(),F(c,{key:p,variant:"outline",class:"text-xxs"},{default:T(()=>[B(I(p),1)]),_:2},1024))),128))])])):q("",!0)],64)}}});function Pv(e){return e.nodes.map(t=>({id:t.id,schema:t.schemaName,table:t.tableName,rows:0,type:"table",comment:null,columns:t.columns.map((s,n)=>({name:s.name,ordinal_position:n+1,short_type_name:s.type,type:s.type,character_maximum_length:null,precision:null,nullable:!s.isPrimaryKey,default:null,collation:null,comment:null})),foreign_keys:e.edges.filter(s=>s.source===t.id).map(s=>{const[n,a]=s.target.split(".");return{foreign_key_name:s.id,column:s.sourceColumn,reference_schema:n,reference_table:a,reference_column:s.targetColumn,fk_def:""}}),primary_keys:t.columns.filter(s=>s.isPrimaryKey).map(s=>({column:s.name,pk_def:""})),indexes:[]}))}const Iv={class:"space-y-2"},Mv={class:"flex items-center justify-between"},Rv={class:"flex items-center gap-2"},Dv={key:0,class:"fixed inset-0 z-50 bg-background flex flex-col"},$v={class:"flex items-center justify-between px-4 py-2 border-b border-border"},Vv={class:"flex items-center gap-2"},Ov={class:"flex-1 relative"},Lv=Y({__name:"AgentErdBlock",props:{data:{}},setup(e){const t=e,s=P(()=>Pv(t.data)),n=P(()=>Vc(s.value)),a=P(()=>{const l={};for(const c of n.value.nodes)l[c.id]=c.position;return l}),i=P(()=>{const c=Math.max(...t.data.nodes.map(d=>d.columns.length),3)*ec+tc+120;return Math.max(300,Math.min(c,500))}),o=W(!1),r=W(!1),u=()=>{o.value=!o.value,o.value||(r.value=!1)};return(l,c)=>{const d=pe,p=Ce,f=ye;return x(),A("div",Iv,[w("div",Mv,[w("div",Rv,[b(d,{name:"hugeicons:hierarchy-square-01",class:"size-4 text-primary"}),c[1]||(c[1]=w("span",{class:"text-sm font-medium"}," Entity Relationship Diagram ",-1)),b(p,{variant:"outline",class:"text-xs"},{default:T(()=>[B(I(l.data.nodes.length)+" tables ",1)]),_:1})]),b(f,{variant:"ghost",size:"iconSm",onClick:u},{default:T(()=>[b(d,{name:o.value?"hugeicons:arrow-shrink-02":"hugeicons:arrow-expand-02"},null,8,["name"])]),_:1})]),o.value?q("",!0):(x(),A("div",{key:0,class:"overflow-hidden rounded-lg border border-border/70",style:Vt({height:`${i.value}px`})},[b(g(Nc),{class:"erd-flow w-full h-full","pan-on-scroll":!0,"pan-on-scroll-speed":1.2,nodes:n.value.nodes,edges:n.value.edges,"default-viewport":{zoom:g(ac),x:40,y:40},"min-zoom":g(nc),"max-zoom":g(sc),"fit-view-on-init":""},{"edge-custom":T(y=>[b(Bc,Fa(za(y)),null,16)]),"node-value":T(y=>[b(Lc,Fa(za(y)),null,16)]),default:T(()=>[b(g(Oc),{size:2,gap:30})]),_:1},8,["nodes","edges","default-viewport","min-zoom","max-zoom"])],4)),(x(),F(Uo,{to:"body"},[o.value?(x(),A("div",Dv,[w("div",$v,[w("div",Vv,[b(d,{name:"hugeicons:hierarchy-square-01",class:"size-4 text-primary"}),c[2]||(c[2]=w("span",{class:"text-sm font-medium"}," Entity Relationship Diagram ",-1)),b(p,{variant:"outline",class:"text-xs"},{default:T(()=>[B(I(l.data.nodes.length)+" tables ",1)]),_:1})]),b(f,{variant:"ghost",size:"iconSm",onClick:u},{default:T(()=>[b(d,{name:"hugeicons:arrow-shrink-02"})]),_:1})]),w("div",Ov,[b(jc,{nodes:n.value.nodes,edges:n.value.edges,matrixTablePosition:a.value,tables:s.value,isShowFilter:r.value,"onUpdate:isShowFilter":c[0]||(c[0]=y=>r.value=y)},null,8,["nodes","edges","matrixTablePosition","tables","isShowFilter"])])])):q("",!0)]))])}}}),Bv={class:"space-y-4 rounded-xl border border-border/70 bg-muted/20 p-4"},Nv={class:"flex flex-wrap items-center gap-2"},jv={class:"text-sm leading-6 text-foreground/90"},Fv={key:0,class:"space-y-2"},zv={class:"space-y-2 text-sm leading-6"},qv={class:"rounded-2xl border bg-background/90"},Uv={class:"overflow-x-auto border-t px-3 py-3 leading-6 chat-code-text"},Hv=Y({__name:"AgentExplainBlock",props:{data:{}},setup(e){return(t,s)=>{const n=Ce;return x(),A("div",Bv,[w("div",Nv,[b(n,{variant:"secondary",class:"text-xxs tracking-[0.16em]"},{default:T(()=>[B(I(t.data.slowestNode),1)]),_:1}),b(n,{variant:"outline",class:"text-xxs tracking-[0.16em]"},{default:T(()=>[B(" Cost "+I(t.data.estimatedCost.toFixed(2)),1)]),_:1})]),w("p",jv,I(t.data.summary),1),t.data.suggestions.length>0?(x(),A("div",Fv,[s[0]||(s[0]=w("div",{class:"text-[11px] font-medium uppercase tracking-[0.18em] text-muted-foreground"}," Suggestions ",-1)),w("ul",zv,[(x(!0),A(le,null,Se(t.data.suggestions,a=>(x(),A("li",{key:a,class:"rounded-2xl border bg-background/80 px-3 py-2"},I(a),1))),128))])])):q("",!0),w("details",qv,[s[1]||(s[1]=w("summary",{class:"cursor-pointer px-3 py-2 text-sm font-medium"}," Raw EXPLAIN output ",-1)),w("pre",Uv,I(t.data.rawPlan),1)])])}}}),Gv=["disabled"],Zv={class:"flex items-center min-w-0 gap-2 flex-1"},Wv={class:"flex flex-col"},Kv={class:"truncate text-sm leading-4 font-normal text-foreground"},Yv={key:0,class:"text-xxs text-muted-foreground truncate shrink-0"},Xv={key:1,class:"text-xxs text-muted-foreground truncate shrink-0"},co=Y({__name:"AgentExportFileBlock",props:{data:{}},setup(e){const t=e,s=No("activeExportPreview"),{downloadFile:n}=Ma(),a=()=>{s&&(s.value=t.data)};P(()=>{switch(t.data.format){case"json":return"lucide:braces";case"sql":return"lucide:database";case"markdown":return"lucide:file-text";case"xml":return"lucide:code-xml";case"yaml":return"lucide:settings-2";case"html":return"lucide:globe";case"tsv":case"csv":return"lucide:table-2";case"txt":return"lucide:file";default:return"lucide:file-text"}});const i=P(()=>{const r=t.data.fileSize;return Go(r)});P(()=>t.data.error?t.data.error:"Preview available before download");const o=async()=>{await n(t.data)};return(r,u)=>{const l=pe,c=ye;return x(),A("button",{type:"button",class:re(["flex w-full items-center gap-2 rounded-xl border border-border/70 bg-muted/20 p-4 text-left transition-colors hover:bg-muted/35",t.data.error?"cursor-not-allowed opacity-80":"cursor-pointer"]),disabled:!!t.data.error,onClick:a},[w("div",Zv,[b(l,{name:"hugeicons:document-attachment",class:"size-5! shrink-0 text-foreground"}),w("div",Wv,[w("h3",Kv,I(t.data.filename),1),t.data.preview.truncated?(x(),A("p",Yv," First "+I(t.data.preview.rows.length)+" rows ",1)):(x(),A("p",Xv," size: "+I(i.value)+" • type: "+I(t.data.format),1))])]),b(c,{disabled:!!t.data.error,size:"xs",variant:"outline"},{default:T(()=>[u[0]||(u[0]=B(" view ")),b(l,{name:"lucide:eye",class:"size-3"})]),_:1},8,["disabled"]),b(c,{onClick:Jn(o,["stop"]),disabled:!!t.data.error,size:"xs",variant:"outline"},{default:T(()=>[u[1]||(u[1]=B(" Download ")),b(l,{name:"lucide:download",class:"size-3"})]),_:1},8,["disabled"])],10,Gv)}}}),Jv={class:"overflow-hidden mb-1"},Qv={key:0,class:"overflow-hidden transition-[height,opacity] duration-300 ease-in-out"},e0={class:"my-1"},Da=Y({__name:"AgentToolSqlPreview",props:{id:{},sql:{},label:{default:"View SQL"},defaultOpen:{type:Boolean,default:!1}},setup(e){const t=e,s=W(!1);function n(o){const r=o;r.style.height="0",r.style.opacity="0",requestAnimationFrame(()=>{r.style.height=r.scrollHeight+"px",r.style.opacity="1"})}function a(o){o.style.height="auto"}function i(o){const r=o;r.style.height=r.scrollHeight+"px",r.style.opacity="1",requestAnimationFrame(()=>{r.style.height="0",r.style.opacity="0"})}return(o,r)=>{const u=pe,l=Fs;return x(),A("div",Jv,[w("button",{type:"button",class:"flex cursor-pointer items-center justify-start gap-2 text-xs font-medium text-muted-foreground hover:text-foreground transition-colors",onClick:r[0]||(r[0]=c=>s.value=!g(s))},[B(I(t.label)+" ",1),b(u,{name:"lucide:chevron-down",class:re(["ml-auto size-4 transition-transform duration-300",{"rotate-180":g(s)}])},null,8,["class"])]),b(os,{onEnter:n,onAfterEnter:a,onLeave:i},{default:T(()=>[g(s)?(x(),A("div",Qv,[w("div",e0,[b(l,{id:t.id,code:t.sql,language:"sql"},null,8,["id","code"])])])):q("",!0)]),_:1})])}}}),t0={class:"space-y-3 rounded-xl border border-border/70 bg-muted/20 p-4"},s0={class:"flex items-start justify-between gap-3"},n0={class:"text-sm leading-6 text-foreground/90"},a0=Y({__name:"AgentQueryBlock",props:{data:{}},setup(e){const t=e,s=P(()=>`agent-query-${t.data.sql}`);return(n,a)=>{const i=Ce;return x(),A("div",t0,[w("div",s0,[w("p",n0,I(n.data.explanation),1),b(i,{variant:n.data.isMutation?"destructive":"secondary",class:"shrink-0 text-xxs"},{default:T(()=>[B(I(n.data.isMutation?"MUTATION":"READ ONLY"),1)]),_:1},8,["variant"])]),b(Da,{id:g(s),sql:n.data.sql,label:n.data.isMutation?"Review SQL before approval":"View SQL","default-open":n.data.isMutation},null,8,["id","sql","label","default-open"])])}}}),i0={class:"overflow-hidden"},o0={key:1,class:""},r0={key:0,class:"overflow-hidden transition-[height,opacity] duration-300 ease-in-out"},l0={class:"mt-2 border-l-2 border-border pl-3 py-1 text-foreground/80 opacity-70 chat-text"},u0=Y({__name:"AgentReasoningBlock",props:{content:{},isStreaming:{type:Boolean}},setup(e){const t=e,s=Yt(t,"isStreaming"),n=sa(Yt(t,"content"),s),a=W(!1);ge(()=>t.isStreaming,u=>{u?a.value=!0:a.value=!1},{immediate:!0});function i(u){const l=u;l.style.height="0",l.style.opacity="0",requestAnimationFrame(()=>{l.style.height=l.scrollHeight+"px",l.style.opacity="1"})}function o(u){u.style.height="auto"}function r(u){const l=u;l.style.height=l.scrollHeight+"px",l.style.opacity="1",requestAnimationFrame(()=>{l.style.height="0",l.style.opacity="0"})}return(u,l)=>{const c=pe;return x(),A("div",i0,[w("button",{type:"button",class:"flex cursor-pointer items-center justify-start gap-1 text-xs font-medium text-muted-foreground hover:text-foreground transition-colors",onClick:l[0]||(l[0]=d=>a.value=!g(a))},[b(c,{name:"hugeicons:ai-brain-05",class:re(["size-3.5! shrink-0",{"animate-pulse text-primary":u.isStreaming}])},null,8,["class"]),u.isStreaming?(x(),F(Ia,{key:0,duration:1},{default:T(()=>l[1]||(l[1]=[B("Reasoning")])),_:1})):(x(),A("span",o0," Reasoning ")),b(c,{name:"lucide:chevron-down",class:re(["ml-auto size-4 transition-transform duration-300",{"rotate-180":g(a)}])},null,8,["class"])]),b(os,{onEnter:i,onAfterEnter:o,onLeave:r},{default:T(()=>[g(a)?(x(),A("div",r0,[w("div",l0,[b(Zo,{content:g(n),"is-streaming":u.isStreaming,"is-block-streaming":u.isStreaming,"is-user-message":!1},null,8,["content","is-streaming","is-block-streaming"])])])):q("",!0)]),_:1})])}}}),c0={key:1,class:"text-xs text-muted-foreground border-l-2 pl-2 mb-1"},d0={class:"text-xs text-muted-foreground mt-1"},p0=Y({__name:"AgentTableBlock",props:{data:{}},setup(e){const t=e,s=P(()=>(t.data.columns??[]).map(u=>({originalName:u.name,queryFieldName:u.name,aliasFieldName:u.name,isPrimaryKey:!1,isForeignKey:!1,canMutate:!1,type:u.type,tableName:""}))),n=P(()=>t.data.rows??[]),a=P(()=>aa({columns:s.value,rows:n.value,columnKeyBy:"field",hasHashIndex:!1})),i=P(()=>ia(n.value,!1)),o=P(()=>`agent-render-table-${t.data.sql||""}`),r=P(()=>{const p=48+n.value.length*32;return Math.max(120,Math.min(p,420))});return(u,l)=>{const c=ra;return x(),A(le,null,[u.data.sql?(x(),F(Da,{key:0,id:g(o),sql:u.data.sql,label:"View SQL"},null,8,["id","sql"])):q("",!0),u.data.truncated?(x(),A("div",c0," Showing only the first "+I(u.data.rowCount)+" rows. ",1)):q("",!0),w("div",{class:"overflow-hidden rounded-lg border max-h-96",style:Vt({height:`${g(r)}px`})},[b(c,{"column-defs":g(a),"row-data":g(i),"column-types":g(oa),class:"h-full w-full"},null,8,["column-defs","row-data","column-types"])],4),w("div",d0," Showing "+I(g(n).length)+" row"+I(g(n).length===1?"":"s"),1)],64)}}}),f0={class:"flex flex-wrap items-center justify-between gap-2"},m0={class:"flex flex-wrap items-center gap-2 text-xs text-muted-foreground"},h0={class:"text-xs text-muted-foreground"},g0={key:0,class:"text-xs text-muted-foreground border-l-2 pl-2 mb-1"},y0={class:"overflow-hidden rounded-xl border bg-background/90 p-2 pt-8"},v0={class:"agent-chart-container"},b0=Y({__name:"AgentVisualizeTableBlock",props:{data:{}},setup(e){Fc([zc,qc,Uc,Kc,Yc,Hc,Gc,Zc]);const t=e,s=P(()=>`agent-visualize-table-${t.data.chartType}-${t.data.sql}`),n=P(()=>t.data.chartType.replace("_"," ")),a=P(()=>t.data.chartType==="pie"?{tooltip:{trigger:"item"},legend:{bottom:0},series:[{type:"pie",radius:["35%","68%"],data:t.data.points.map(i=>({name:i.label,value:i.y}))}]}:t.data.chartType==="scatter"?{tooltip:{trigger:"item"},grid:{left:16,right:16,top:24,bottom:24,containLabel:!0},xAxis:{type:"value",name:t.data.xField},yAxis:{type:"value",name:t.data.yField},series:[{type:"scatter",symbolSize:10,data:t.data.points.map(i=>[i.x,i.y])}]}:{tooltip:{trigger:"axis"},grid:{left:16,right:16,top:24,bottom:24,containLabel:!0},xAxis:{type:"category",name:t.data.xField,data:t.data.points.map(i=>i.label),axisLabel:{hideOverlap:!0}},yAxis:{type:"value",name:t.data.yField},series:[{type:t.data.chartType,smooth:t.data.chartType==="line",data:t.data.points.map(i=>i.y)}]});return(i,o)=>{const r=Ce;return x(),A(le,null,[w("div",f0,[w("div",m0,[b(r,{variant:"secondary",class:"uppercase tracking-[0.16em]"},{default:T(()=>[B(I(g(n)),1)]),_:1}),i.data.xField?(x(),F(r,{key:0,variant:"outline"},{default:T(()=>[B(" X: "+I(i.data.xField),1)]),_:1})):q("",!0),i.data.yField?(x(),F(r,{key:1,variant:"outline"},{default:T(()=>[B(" Y: "+I(i.data.yField),1)]),_:1})):q("",!0)]),w("div",h0,I(i.data.rowCount)+" point"+I(i.data.rowCount===1?"":"s"),1)]),b(Da,{id:g(s),sql:i.data.sql,label:"View SQL"},null,8,["id","sql"]),i.data.truncated?(x(),A("div",g0," Showing only the first "+I(i.data.rowCount)+" points. ",1)):q("",!0),w("div",y0,[w("div",v0,[b(g(Wc),{option:g(a),autoresize:"",class:"agent-chart"},null,8,["option"])])])],64)}}}),x0=Ho(b0,[["__scopeId","data-v-8ea150a2"]]),_0={class:"min-w-0 flex-1 overflow-hidden"},w0={class:"flex items-center gap-1 justify-center"},S0=Y({__name:"AgentMessageBubble",props:{message:{},getToolComponent:{type:Function},showReasoning:{type:Boolean},isStreaming:{type:Boolean},highlightedResponseId:{},registerMessageElement:{type:Function}},emits:["approval","edit","quiz-submit"],setup(e,{emit:t}){const s=e,n=t,{handleCopyWithKey:a,isCopied:i,getCopyIcon:o,getCopyIconClass:r,getCopyTooltip:u}=na(),l=P(()=>s.message.role==="user"),c=p=>{l.value||!s.registerMessageElement||s.registerMessageElement(s.message.id,p)},d=P(()=>(s.message.blocks??[]).map(p=>p.kind==="text"||p.kind==="markdown"?p.content:p.kind==="code"||p.kind==="mermaid"?p.code:"").filter(Boolean).join(`
5
+
6
+ `));return(p,f)=>{const y=pe,_=ye,v=Bs,h=Ns,C=Ls;return x(),A("div",{class:re(["w-full",l.value?"flex justify-end":"flex justify-start"]),ref:m=>c(m)},[w("div",{class:re(["flex w-full max-w-3xl gap-3",l.value?"justify-end":"items-start"])},[w("div",_0,[(x(!0),A(le,null,Se(p.message.blocks,(m,D)=>(x(),A("div",{key:`${p.message.id}-${m.kind}-${D}`,class:re(["overflow-hidden chat-text",!l.value&&s.highlightedResponseId===p.message.id?"ring-1 ring-primary/25 bg-primary/6":"",l.value?"rounded-xl bg-muted text-foreground p-2 px-3 shadow-none whitespace-pre-wrap ml-auto":"rounded-xl border-none bg-transparent py-2 shadow-none flex flex-col gap-1.5"])},[m.kind==="text"?(x(),F(g(Yh),{key:0,content:m.content,"is-block-streaming":m.isStreaming,"is-streaming":p.isStreaming,"is-user-message":l.value},null,8,["content","is-block-streaming","is-streaming","is-user-message"])):m.kind==="reasoning"&&p.showReasoning?(x(),F(g(u0),{key:1,content:m.content,"is-streaming":m.isStreaming},null,8,["content","is-streaming"])):m.kind==="markdown"?(x(),F(g(Zo),{key:2,content:m.content,"is-block-streaming":m.isStreaming,"is-streaming":p.isStreaming,"is-user-message":l.value},null,8,["content","is-block-streaming","is-streaming","is-user-message"])):m.kind==="code"?(x(),F(g(Fs),{key:3,id:`${p.message.id}-${D}`,code:m.code,language:m.language||"text","is-block-streaming":m.isStreaming,"is-streaming":p.isStreaming},null,8,["id","code","language","is-block-streaming","is-streaming"])):m.kind==="mermaid"?(x(),F(g(Rg),{key:4,id:`${p.message.id}-${D}`,code:m.code},null,8,["id","code"])):m.kind==="loading"?(x(),F(g($g),{key:5,label:m.label},null,8,["label"])):m.kind==="error"?(x(),F(g(Og),{key:6,message:m.message},null,8,["message"])):m.kind==="tool"?(x(),F(g(Ng),{key:7,"tool-name":m.toolName,result:m.result,"get-tool-component":p.getToolComponent},null,8,["tool-name","result","get-tool-component"])):m.kind==="approval"?(x(),F(g(_v),{key:8,"tool-name":m.toolName,input:m.input,"approval-id":m.approvalId,onApprove:f[0]||(f[0]=R=>n("approval",R,!0)),onDeny:f[1]||(f[1]=R=>n("approval",R,!1))},null,8,["tool-name","input","approval-id"])):m.kind==="source"?(x(),F(g(Hg),{key:9,"source-id":m.sourceId,url:m.url,title:m.title,"media-type":m.mediaType,filename:m.filename},null,8,["source-id","url","title","media-type","filename"])):m.kind==="quiz"?(x(),F(g(cy),{key:10,"tool-call-id":m.toolCallId,context:m.context,questions:m.questions,onSubmit:f[2]||(f[2]=R=>n("quiz-submit",R))},null,8,["tool-call-id","context","questions"])):q("",!0)],2))),128)),p.isStreaming?q("",!0):(x(),A("div",{key:0,class:re(["mt-1 flex items-center gap-1",l.value?"justify-end":"justify-start"])},[b(C,null,{default:T(()=>[b(v,{"as-child":""},{default:T(()=>[b(_,{size:"xxs",variant:"ghost",class:"h-4!",onClick:f[3]||(f[3]=m=>g(a)(p.message.id,d.value))},{default:T(()=>[w("span",w0,[b(y,{name:g(o)(g(i)(p.message.id)),class:re(["size-3.5!",g(r)(g(i)(p.message.id))])},null,8,["name","class"]),g(i)(p.message.id)?(x(),A("span",{key:0,class:re(["text-xxs font-medium leading-none",g(r)(g(i)(p.message.id))])},"Copied",2)):q("",!0)])]),_:1})]),_:1}),b(h,null,{default:T(()=>[w("p",null,I(g(u)(g(i)(p.message.id))),1)]),_:1})]),_:1}),l.value?(x(),F(C,{key:0},{default:T(()=>[b(v,{"as-child":""},{default:T(()=>[b(_,{size:"iconSm",variant:"ghost",class:"size-4!",onClick:f[4]||(f[4]=m=>n("edit",d.value))},{default:T(()=>[b(y,{name:"lucide:pencil",class:"size-3!"})]),_:1})]),_:1}),b(h,null,{default:T(()=>f[5]||(f[5]=[w("p",null,"Edit",-1)])),_:1})]),_:1})):q("",!0)],2))])],2)],2)}}}),T0={class:"mx-auto flex max-w-xl flex-col items-center rounded-2xl border bg-background/90 px-8 py-10 text-center shadow-sm"},k0={class:"text-xl font-medium tracking-tight"},A0=Y({__name:"AgentSetupCard",props:{currentProvider:{}},setup(e){const{openSettings:t}=ic();return(s,n)=>{const a=pe,i=ye;return x(),A("div",T0,[w("h2",k0,[b(a,{name:"lucide:key-round",class:"size-4! text-muted-foreground"}),B(" Connect "+I(s.currentProvider.name),1)]),n[2]||(n[2]=w("p",{class:"mt-2 text-sm leading-6 text-muted-foreground"}," Add an API key in Settings so the agent can answer questions, inspect schema context, and keep chat history in this workspace. ",-1)),b(i,{variant:"outline",size:"sm",class:"mt-6 rounded-2xl",onClick:n[0]||(n[0]=o=>g(t)("Agent"))},{default:T(()=>[b(a,{name:"lucide:settings-2",class:"size-4"}),n[1]||(n[1]=B(" Open Agent Settings "))]),_:1})])}}}),C0={class:"mx-auto my-auto w-full max-w-3xl py-8"},E0={class:"rounded-3xl p-5"},P0={class:"flex items-start"},I0={class:"min-w-0 flex-1"},M0={class:"flex flex-wrap items-center gap-2 text-[11px] text-muted-foreground"},R0=Y({__name:"AgentWelcomePanel",props:{promptCards:{},threadCount:{}},emits:["prompt"],setup(e,{emit:t}){const s=e;return(n,a)=>(x(),A("div",C0,[w("div",E0,[w("div",P0,[w("div",I0,[w("div",M0,[a[0]||(a[0]=w("span",{class:"rounded-full bg-muted px-2.5 py-1 font-medium text-foreground"}," Orca Agent ",-1)),w("span",null,I(s.threadCount)+" saved threads ready to resume",1)]),a[1]||(a[1]=w("h2",{class:"mt-3 text-xl font-medium text-foreground"}," Ask for schema help, query ideas, or result checks. ",-1)),a[2]||(a[2]=w("p",{class:"mt-2 max-w-2xl text-sm text-muted-foreground"}," Keep it short. The agent already sees the connected schema and can keep working from past conversations. ",-1))])])])]))}}),D0={class:"flex flex-col items-center gap-1"},$0=["onClick"],V0=["aria-label"],O0={class:"line-clamp-3 leading-relaxed"},L0=Y({__name:"ResponseNavigatorDotIndicator",props:{currentIndex:{},responses:{},position:{}},emits:["select"],setup(e,{emit:t}){const s=t;return(n,a)=>(x(),A("div",D0,[(x(!0),A(le,null,Se(n.responses,(i,o)=>(x(),A("div",{key:i.id,class:"group relative flex items-center justify-center px-3 cursor-pointer",onClick:r=>s("select",o)},[w("button",{type:"button",class:re(["rounded-full transition-all duration-200 ease-out focus:outline-none focus:ring-2 focus:ring-primary/60 pointer-events-none",n.currentIndex===o?"h-1 w-5 bg-foreground":"h-[3px] w-3 bg-foreground/30 group-hover:bg-foreground/50 group-hover:w-4"]),"aria-label":`Go to response ${o+1}`},null,10,V0),i.preview?(x(),A("div",{key:0,class:re(["absolute top-1/2 -translate-y-1/2 pointer-events-none opacity-0 transition-opacity duration-200 group-hover:opacity-100 z-50 w-56 p-2.5 text-xs bg-popover text-popover-foreground rounded-lg shadow-md border border-border",n.position==="left"?"left-full ml-2":"right-full mr-2"])},[w("div",O0,I(i.preview),1)],2)):q("",!0)],8,$0))),128))]))}}),B0=Y({__name:"ResponseNavigatorToast",props:{message:{},position:{}},setup(e){return(t,s)=>(x(),F(os,{"enter-active-class":"transition-all duration-200 ease-out","enter-from-class":"translate-x-2 opacity-0","enter-to-class":"translate-x-0 opacity-100","leave-active-class":"transition-all duration-150 ease-in","leave-from-class":"translate-x-0 opacity-100","leave-to-class":"translate-x-2 opacity-0"},{default:T(()=>[t.message?(x(),A("div",{key:0,class:re(["absolute top-1/2 -translate-y-1/2 whitespace-nowrap rounded-full bg-foreground/90 px-3.5 py-2 text-xs text-background shadow-lg",t.position==="right"?"right-full mr-3":"left-full ml-3"]),role:"status","aria-live":"polite"},I(t.message),3)):q("",!0)]),_:1}))}});function N0({currentIndex:e,total:t,onNavigate:s}){const n=W("");let a=null;const i=P(()=>e.value>0),o=P(()=>e.value<t.value-1),r=p=>{n.value=p,a&&clearTimeout(a),a=setTimeout(()=>{n.value=""},1500)},u=p=>{p<0||p>=t.value||s(p)},l=()=>{if(!i.value){r("Already at first response");return}const p=e.value-1;u(p),r("Previous response")},c=()=>{if(!o.value){r("Already at last response");return}const p=e.value+1;u(p),r("Next response")},d=p=>{p.key==="ArrowUp"&&(p.preventDefault(),l()),p.key==="ArrowDown"&&(p.preventDefault(),c())};return ea(()=>{a&&clearTimeout(a)}),{canGoNext:o,canGoPrevious:i,goNext:c,goPrevious:l,handleKeydown:d,toastMessage:n}}const j0=Y({__name:"ResponseNavigator",props:{responses:{},currentIndex:{},position:{default:"right"},offset:{default:()=>({})}},emits:["navigate"],setup(e,{emit:t}){const s=e,n=t,a=P(()=>s.responses.length),i=P(()=>({top:`calc(50% + ${s.offset.y??0}px)`,right:s.position==="right"?`${0+(s.offset.x??0)}px`:"auto",left:s.position==="left"?`${0+(s.offset.x??0)}px`:"auto",transform:"translateY(-50%)"})),{canGoNext:o,canGoPrevious:r,goNext:u,goPrevious:l,handleKeydown:c,toastMessage:d}=N0({currentIndex:Yt(s,"currentIndex"),total:a,onNavigate:p=>n("navigate",p)});return(p,f)=>{const y=pe,_=ye,v=Bs,h=Ns,C=Ls;return p.responses.length>0?(x(),A("div",{key:0,class:"absolute z-30 flex flex-col items-center gap-0.5",style:Vt(i.value),tabindex:"0",onKeydown:f[1]||(f[1]=(...m)=>g(c)&&g(c)(...m))},[b(B0,{message:g(d),position:p.position},null,8,["message","position"]),b(C,{"delay-duration":150},{default:T(()=>[b(v,{"as-child":""},{default:T(()=>[b(_,{size:"iconSm",variant:"ghost","aria-label":"Go to previous response","aria-disabled":!g(r),disabled:!g(r),onClick:g(l)},{default:T(()=>[b(y,{name:"lucide:chevron-up"})]),_:1},8,["aria-disabled","disabled","onClick"])]),_:1}),b(h,{side:p.position==="left"?"right":"left"},{default:T(()=>f[2]||(f[2]=[w("p",null,"Previous response",-1)])),_:1},8,["side"])]),_:1}),b(L0,{"current-index":p.currentIndex,responses:p.responses,position:p.position,onSelect:f[0]||(f[0]=m=>n("navigate",m))},null,8,["current-index","responses","position"]),b(C,{"delay-duration":150},{default:T(()=>[b(v,{"as-child":""},{default:T(()=>[b(_,{size:"iconSm",variant:"ghost","aria-label":"Go to next response","aria-disabled":!g(o),disabled:!g(o),onClick:g(u)},{default:T(()=>[b(y,{name:"lucide:chevron-down"})]),_:1},8,["aria-disabled","disabled","onClick"])]),_:1}),b(h,{side:p.position==="left"?"right":"left"},{default:T(()=>f[3]||(f[3]=[w("p",null,"Next response",-1)])),_:1},8,["side"])]),_:1})],36)):q("",!0)}}}),F0={class:"flex h-full flex-col bg-sidebar z-50 p-2 gap-2"},z0={class:"flex shrink-0 items-center justify-between gap-2"},q0={class:"flex items-center min-w-0 gap-1 flex-1"},U0={class:"flex flex-col"},H0={class:"truncate text-sm leading-4 font-medium text-foreground"},G0={key:0,class:"text-xxs text-muted-foreground truncate shrink-0"},Z0={key:1,class:"text-xxs text-muted-foreground truncate shrink-0"},W0={class:"flex shrink-0 items-center justify-end gap-1"},K0={class:"flex-1 overflow-hidden min-h-0 flex flex-col"},Y0={key:0,class:"rounded-xl border border-destructive/20 bg-destructive/5 p-4 text-sm text-destructive mx-2"},X0={key:1,class:"flex-1 w-full overflow-hidden rounded-xl border border-border/70 flex flex-col min-h-0 relative h-full"},J0=Y({__name:"ExportPreviewPanel",props:{result:{}},emits:["close"],setup(e,{emit:t}){const s=e,n=t,{downloadFile:a}=Ma(),i=new Set(["csv","tsv"]),o=P(()=>i.has(s.result.format)),r={json:"json",sql:"sql",markdown:"markdown",xml:"xml",yaml:"yaml",html:"html"},u=P(()=>r[s.result.format]),l=P(()=>s.result.preview.columns??[]),c=P(()=>s.result.preview.rows??[]),d=P(()=>s.result.encoding==="base64"?`${s.result.filename} is a binary spreadsheet file. Use Download to open it locally.`:s.result.content),p=P(()=>l.value.map(h=>({originalName:h,aliasFieldName:h,queryFieldName:h,tableName:"",type:"string",isPrimaryKey:!1,isForeignKey:!1,canMutate:!1}))),f=P(()=>aa({columns:p.value,rows:c.value,columnKeyBy:"field"})),y=P(()=>ia(c.value)),_=async()=>{await a(s.result)},v=P(()=>{const h=s.result.fileSize;return Go(h)});return(h,C)=>{const m=pe,D=ye,R=ra,M=Mc;return x(),A("div",F0,[w("div",z0,[w("div",q0,[b(m,{name:"hugeicons:document-attachment",class:"size-5! shrink-0 text-foreground"}),w("div",U0,[w("h3",H0,I(h.result.filename),1),h.result.preview.truncated?(x(),A("p",G0," First "+I(c.value.length)+" rows ",1)):(x(),A("p",Z0," size: "+I(v.value)+" • type: "+I(h.result.format),1))])]),w("div",W0,[b(D,{size:"xs",variant:"outline",disabled:!!h.result.error,onClick:_},{default:T(()=>[C[1]||(C[1]=B(" Download ")),b(m,{name:"lucide:download",class:"size-3"})]),_:1},8,["disabled"]),b(D,{size:"iconMd",variant:"ghost",onClick:C[0]||(C[0]=S=>n("close"))},{default:T(()=>[b(m,{name:"lucide:x",class:"size-4"})]),_:1})])]),w("div",K0,[h.result.error?(x(),A("div",Y0,I(h.result.error),1)):o.value?(x(),A("div",X0,[b(R,{"column-defs":f.value,"row-data":y.value,"column-types":g(oa),class:"h-full"},null,8,["column-defs","row-data","column-types"])])):(x(),F(M,{key:2,code:d.value,language:u.value,"max-height":"100%",class:"h-full rounded-xl overflow-auto border border-border/70"},null,8,["code","language"]))])])}}});var ss;(function(e){e.assertEqual=a=>{};function t(a){}e.assertIs=t;function s(a){throw new Error}e.assertNever=s,e.arrayToEnum=a=>{const i={};for(const o of a)i[o]=o;return i},e.getValidEnumValues=a=>{const i=e.objectKeys(a).filter(r=>typeof a[a[r]]!="number"),o={};for(const r of i)o[r]=a[r];return e.objectValues(o)},e.objectValues=a=>e.objectKeys(a).map(function(i){return a[i]}),e.objectKeys=typeof Object.keys=="function"?a=>Object.keys(a):a=>{const i=[];for(const o in a)Object.prototype.hasOwnProperty.call(a,o)&&i.push(o);return i},e.find=(a,i)=>{for(const o of a)if(i(o))return o},e.isInteger=typeof Number.isInteger=="function"?a=>Number.isInteger(a):a=>typeof a=="number"&&Number.isFinite(a)&&Math.floor(a)===a;function n(a,i=" | "){return a.map(o=>typeof o=="string"?`'${o}'`:o).join(i)}e.joinValues=n,e.jsonStringifyReplacer=(a,i)=>typeof i=="bigint"?i.toString():i})(ss||(ss={}));var po;(function(e){e.mergeShapes=(t,s)=>({...t,...s})})(po||(po={}));ss.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);ss.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class $s extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};const s=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,s):this.__proto__=s,this.name="ZodError",this.issues=t}format(t){const s=t||function(i){return i.message},n={_errors:[]},a=i=>{for(const o of i.issues)if(o.code==="invalid_union")o.unionErrors.map(a);else if(o.code==="invalid_return_type")a(o.returnTypeError);else if(o.code==="invalid_arguments")a(o.argumentsError);else if(o.path.length===0)n._errors.push(s(o));else{let r=n,u=0;for(;u<o.path.length;){const l=o.path[u];u===o.path.length-1?(r[l]=r[l]||{_errors:[]},r[l]._errors.push(s(o))):r[l]=r[l]||{_errors:[]},r=r[l],u++}}};return a(this),n}static assert(t){if(!(t instanceof $s))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,ss.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=s=>s.message){const s=Object.create(null),n=[];for(const a of this.issues)if(a.path.length>0){const i=a.path[0];s[i]=s[i]||[],s[i].push(t(a))}else n.push(t(a));return{formErrors:n,fieldErrors:s}}get formErrors(){return this.flatten()}}$s.create=e=>new $s(e);var fo;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(fo||(fo={}));var K;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(K||(K={}));class mo extends Error{constructor(t,s){super(t),this.name="ParseError",this.type=s.type,this.field=s.field,this.value=s.value,this.line=s.line}}function dn(e){}function Q0(e){if(typeof e=="function")throw new TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");const{onEvent:t=dn,onError:s=dn,onRetry:n=dn,onComment:a}=e;let i="",o=!0,r,u="",l="";function c(_){const v=o?_.replace(/^\xEF\xBB\xBF/,""):_,[h,C]=eb(`${i}${v}`);for(const m of h)d(m);i=C,o=!1}function d(_){if(_===""){f();return}if(_.startsWith(":")){a&&a(_.slice(_.startsWith(": ")?2:1));return}const v=_.indexOf(":");if(v!==-1){const h=_.slice(0,v),C=_[v+1]===" "?2:1,m=_.slice(v+C);p(h,m,_);return}p(_,"",_)}function p(_,v,h){switch(_){case"event":l=v;break;case"data":u=`${u}${v}
7
+ `;break;case"id":r=v.includes("\0")?void 0:v;break;case"retry":/^\d+$/.test(v)?n(parseInt(v,10)):s(new mo(`Invalid \`retry\` value: "${v}"`,{type:"invalid-retry",value:v,line:h}));break;default:s(new mo(`Unknown field "${_.length>20?`${_.slice(0,20)}…`:_}"`,{type:"unknown-field",field:_,value:v,line:h}));break}}function f(){u.length>0&&t({id:r,event:l||void 0,data:u.endsWith(`
8
+ `)?u.slice(0,-1):u}),r=void 0,u="",l=""}function y(_={}){i&&_.consume&&d(i),o=!0,r=void 0,u="",l="",i=""}return{feed:c,reset:y}}function eb(e){const t=[];let s="",n=0;for(;n<e.length;){const a=e.indexOf("\r",n),i=e.indexOf(`
9
+ `,n);let o=-1;if(a!==-1&&i!==-1?o=Math.min(a,i):a!==-1?a===e.length-1?o=-1:o=a:i!==-1&&(o=i),o===-1){s=e.slice(n);break}else{const r=e.slice(n,o);t.push(r),n=o+1,e[n-1]==="\r"&&e[n]===`
10
+ `&&n++}}return[t,s]}class tb extends TransformStream{constructor({onError:t,onRetry:s,onComment:n}={}){let a;super({start(i){a=Q0({onEvent:o=>{i.enqueue(o)},onError(o){t==="terminate"?i.error(o):typeof t=="function"&&t(o)},onRetry:s,onComment:n})},transform(i){a.feed(i)}})}}var $l="vercel.ai.error",sb=Symbol.for($l),ho,go,He=class Vl extends(go=Error,ho=sb,go){constructor({name:t,message:s,cause:n}){super(s),this[ho]=!0,this.name=t,this.cause=n}static isInstance(t){return Vl.hasMarker(t,$l)}static hasMarker(t,s){const n=Symbol.for(s);return t!=null&&typeof t=="object"&&n in t&&typeof t[n]=="boolean"&&t[n]===!0}};function Ol(e){return e==null?"unknown error":typeof e=="string"?e:e instanceof Error?e.message:JSON.stringify(e)}var Ll="AI_InvalidArgumentError",Bl=`vercel.ai.error.${Ll}`,nb=Symbol.for(Bl),yo,vo,ab=class extends(vo=He,yo=nb,vo){constructor({message:e,cause:t,argument:s}){super({name:Ll,message:e,cause:t}),this[yo]=!0,this.argument=s}static isInstance(e){return He.hasMarker(e,Bl)}},Nl="AI_JSONParseError",jl=`vercel.ai.error.${Nl}`,ib=Symbol.for(jl),bo,xo,_o=class extends(xo=He,bo=ib,xo){constructor({text:e,cause:t}){super({name:Nl,message:`JSON parsing failed: Text: ${e}.
11
+ Error message: ${Ol(t)}`,cause:t}),this[bo]=!0,this.text=e}static isInstance(e){return He.hasMarker(e,jl)}},Fl="AI_TypeValidationError",zl=`vercel.ai.error.${Fl}`,ob=Symbol.for(zl),wo,So,Dt=class Nn extends(So=He,wo=ob,So){constructor({value:t,cause:s,context:n}){let a="Type validation failed";if(n!=null&&n.field&&(a+=` for ${n.field}`),n!=null&&n.entityName||n!=null&&n.entityId){a+=" (";const i=[];n.entityName&&i.push(n.entityName),n.entityId&&i.push(`id: "${n.entityId}"`),a+=i.join(", "),a+=")"}super({name:Fl,message:`${a}: Value: ${JSON.stringify(t)}.
12
+ Error message: ${Ol(s)}`,cause:s}),this[wo]=!0,this.value=t,this.context=n}static isInstance(t){return He.hasMarker(t,zl)}static wrap({value:t,cause:s,context:n}){var a,i,o;return Nn.isInstance(s)&&s.value===t&&((a=s.context)==null?void 0:a.field)===(n==null?void 0:n.field)&&((i=s.context)==null?void 0:i.entityName)===(n==null?void 0:n.entityName)&&((o=s.context)==null?void 0:o.entityId)===(n==null?void 0:n.entityId)?s:new Nn({value:t,cause:s,context:n})}},ps=({prefix:e,size:t=16,alphabet:s="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",separator:n="-"}={})=>{const a=()=>{const i=s.length,o=new Array(t);for(let r=0;r<t;r++)o[r]=s[Math.random()*i|0];return o.join("")};if(e==null)return a;if(s.includes(n))throw new ab({argument:"separator",message:`The separator "${n}" must not be part of the alphabet "${s}".`});return()=>`${e}${n}${a()}`},rb=ps();function To(e=globalThis){var t,s,n;return e.window?"runtime/browser":(t=e.navigator)!=null&&t.userAgent?`runtime/${e.navigator.userAgent.toLowerCase()}`:(n=(s=e.process)==null?void 0:s.versions)!=null&&n.node?`runtime/node.js/${e.process.version.substring(0)}`:e.EdgeRuntime?"runtime/vercel-edge":"runtime/unknown"}function lt(e){if(e==null)return{};const t={};if(e instanceof Headers)e.forEach((s,n)=>{t[n.toLowerCase()]=s});else{Array.isArray(e)||(e=Object.entries(e));for(const[s,n]of e)n!=null&&(t[s.toLowerCase()]=n)}return t}function ko(e,...t){const s=new Headers(lt(e)),n=s.get("user-agent")||"";return s.set("user-agent",[n,...t].filter(Boolean).join(" ")),Object.fromEntries(s.entries())}var lb=/"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/,ub=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/;function Ao(e){const t=JSON.parse(e);return t===null||typeof t!="object"||lb.test(e)===!1&&ub.test(e)===!1?t:cb(t)}function cb(e){let t=[e];for(;t.length;){const s=t;t=[];for(const n of s){if(Object.prototype.hasOwnProperty.call(n,"__proto__"))throw new SyntaxError("Object contains forbidden prototype property");if(Object.prototype.hasOwnProperty.call(n,"constructor")&&n.constructor!==null&&typeof n.constructor=="object"&&Object.prototype.hasOwnProperty.call(n.constructor,"prototype"))throw new SyntaxError("Object contains forbidden prototype property");for(const a in n){const i=n[a];i&&typeof i=="object"&&t.push(i)}}}return e}function db(e){const{stackTraceLimit:t}=Error;try{Error.stackTraceLimit=0}catch{return Ao(e)}try{return Ao(e)}finally{Error.stackTraceLimit=t}}function $a(e){if(e.type==="object"||Array.isArray(e.type)&&e.type.includes("object")){e.additionalProperties=!1;const{properties:s}=e;if(s!=null)for(const n of Object.keys(s))s[n]=ot(s[n])}e.items!=null&&(e.items=Array.isArray(e.items)?e.items.map(ot):ot(e.items)),e.anyOf!=null&&(e.anyOf=e.anyOf.map(ot)),e.allOf!=null&&(e.allOf=e.allOf.map(ot)),e.oneOf!=null&&(e.oneOf=e.oneOf.map(ot));const{definitions:t}=e;if(t!=null)for(const s of Object.keys(t))t[s]=ot(t[s]);return e}function ot(e){return typeof e=="boolean"?e:$a(e)}var pb=Symbol("Let zodToJsonSchema decide on which parser to use"),Co={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",strictUnions:!1,definitions:{},errorMessages:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref"},fb=e=>typeof e=="string"?{...Co,name:e}:{...Co,...e};function Ee(){return{}}function mb(e,t){var s,n,a;const i={type:"array"};return(s=e.type)!=null&&s._def&&((a=(n=e.type)==null?void 0:n._def)==null?void 0:a.typeName)!==K.ZodAny&&(i.items=ee(e.type._def,{...t,currentPath:[...t.currentPath,"items"]})),e.minLength&&(i.minItems=e.minLength.value),e.maxLength&&(i.maxItems=e.maxLength.value),e.exactLength&&(i.minItems=e.exactLength.value,i.maxItems=e.exactLength.value),i}function hb(e){const t={type:"integer",format:"int64"};if(!e.checks)return t;for(const s of e.checks)switch(s.kind){case"min":s.inclusive?t.minimum=s.value:t.exclusiveMinimum=s.value;break;case"max":s.inclusive?t.maximum=s.value:t.exclusiveMaximum=s.value;break;case"multipleOf":t.multipleOf=s.value;break}return t}function gb(){return{type:"boolean"}}function ql(e,t){return ee(e.type._def,t)}var yb=(e,t)=>ee(e.innerType._def,t);function Ul(e,t,s){const n=s??t.dateStrategy;if(Array.isArray(n))return{anyOf:n.map((a,i)=>Ul(e,t,a))};switch(n){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return vb(e)}}var vb=e=>{const t={type:"integer",format:"unix-time"};for(const s of e.checks)switch(s.kind){case"min":t.minimum=s.value;break;case"max":t.maximum=s.value;break}return t};function bb(e,t){return{...ee(e.innerType._def,t),default:e.defaultValue()}}function xb(e,t){return t.effectStrategy==="input"?ee(e.schema._def,t):Ee()}function _b(e){return{type:"string",enum:Array.from(e.values)}}var wb=e=>"type"in e&&e.type==="string"?!1:"allOf"in e;function Sb(e,t){const s=[ee(e.left._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),ee(e.right._def,{...t,currentPath:[...t.currentPath,"allOf","1"]})].filter(a=>!!a),n=[];return s.forEach(a=>{if(wb(a))n.push(...a.allOf);else{let i=a;if("additionalProperties"in a&&a.additionalProperties===!1){const{additionalProperties:o,...r}=a;i=r}n.push(i)}}),n.length?{allOf:n}:void 0}function Tb(e){const t=typeof e.value;return t!=="bigint"&&t!=="number"&&t!=="boolean"&&t!=="string"?{type:Array.isArray(e.value)?"array":"object"}:{type:t==="bigint"?"integer":t,const:e.value}}var pn=void 0,Le={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>(pn===void 0&&(pn=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),pn),uuid:/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,ipv4:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ipv4Cidr:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function Hl(e,t){const s={type:"string"};if(e.checks)for(const n of e.checks)switch(n.kind){case"min":s.minLength=typeof s.minLength=="number"?Math.max(s.minLength,n.value):n.value;break;case"max":s.maxLength=typeof s.maxLength=="number"?Math.min(s.maxLength,n.value):n.value;break;case"email":switch(t.emailStrategy){case"format:email":Be(s,"email",n.message,t);break;case"format:idn-email":Be(s,"idn-email",n.message,t);break;case"pattern:zod":be(s,Le.email,n.message,t);break}break;case"url":Be(s,"uri",n.message,t);break;case"uuid":Be(s,"uuid",n.message,t);break;case"regex":be(s,n.regex,n.message,t);break;case"cuid":be(s,Le.cuid,n.message,t);break;case"cuid2":be(s,Le.cuid2,n.message,t);break;case"startsWith":be(s,RegExp(`^${fn(n.value,t)}`),n.message,t);break;case"endsWith":be(s,RegExp(`${fn(n.value,t)}$`),n.message,t);break;case"datetime":Be(s,"date-time",n.message,t);break;case"date":Be(s,"date",n.message,t);break;case"time":Be(s,"time",n.message,t);break;case"duration":Be(s,"duration",n.message,t);break;case"length":s.minLength=typeof s.minLength=="number"?Math.max(s.minLength,n.value):n.value,s.maxLength=typeof s.maxLength=="number"?Math.min(s.maxLength,n.value):n.value;break;case"includes":{be(s,RegExp(fn(n.value,t)),n.message,t);break}case"ip":{n.version!=="v6"&&Be(s,"ipv4",n.message,t),n.version!=="v4"&&Be(s,"ipv6",n.message,t);break}case"base64url":be(s,Le.base64url,n.message,t);break;case"jwt":be(s,Le.jwt,n.message,t);break;case"cidr":{n.version!=="v6"&&be(s,Le.ipv4Cidr,n.message,t),n.version!=="v4"&&be(s,Le.ipv6Cidr,n.message,t);break}case"emoji":be(s,Le.emoji(),n.message,t);break;case"ulid":{be(s,Le.ulid,n.message,t);break}case"base64":{switch(t.base64Strategy){case"format:binary":{Be(s,"binary",n.message,t);break}case"contentEncoding:base64":{s.contentEncoding="base64";break}case"pattern:zod":{be(s,Le.base64,n.message,t);break}}break}case"nanoid":be(s,Le.nanoid,n.message,t)}return s}function fn(e,t){return t.patternStrategy==="escape"?Ab(e):e}var kb=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function Ab(e){let t="";for(let s=0;s<e.length;s++)kb.has(e[s])||(t+="\\"),t+=e[s];return t}function Be(e,t,s,n){var a;e.format||(a=e.anyOf)!=null&&a.some(i=>i.format)?(e.anyOf||(e.anyOf=[]),e.format&&(e.anyOf.push({format:e.format}),delete e.format),e.anyOf.push({format:t,...s&&n.errorMessages&&{errorMessage:{format:s}}})):e.format=t}function be(e,t,s,n){var a;e.pattern||(a=e.allOf)!=null&&a.some(i=>i.pattern)?(e.allOf||(e.allOf=[]),e.pattern&&(e.allOf.push({pattern:e.pattern}),delete e.pattern),e.allOf.push({pattern:Eo(t,n),...s&&n.errorMessages&&{errorMessage:{pattern:s}}})):e.pattern=Eo(t,n)}function Eo(e,t){var s;if(!t.applyRegexFlags||!e.flags)return e.source;const n={i:e.flags.includes("i"),m:e.flags.includes("m"),s:e.flags.includes("s")},a=n.i?e.source.toLowerCase():e.source;let i="",o=!1,r=!1,u=!1;for(let l=0;l<a.length;l++){if(o){i+=a[l],o=!1;continue}if(n.i){if(r){if(a[l].match(/[a-z]/)){u?(i+=a[l],i+=`${a[l-2]}-${a[l]}`.toUpperCase(),u=!1):a[l+1]==="-"&&((s=a[l+2])!=null&&s.match(/[a-z]/))?(i+=a[l],u=!0):i+=`${a[l]}${a[l].toUpperCase()}`;continue}}else if(a[l].match(/[a-z]/)){i+=`[${a[l]}${a[l].toUpperCase()}]`;continue}}if(n.m){if(a[l]==="^"){i+=`(^|(?<=[\r
13
+ ]))`;continue}else if(a[l]==="$"){i+=`($|(?=[\r
14
+ ]))`;continue}}if(n.s&&a[l]==="."){i+=r?`${a[l]}\r
15
+ `:`[${a[l]}\r
16
+ ]`;continue}i+=a[l],a[l]==="\\"?o=!0:r&&a[l]==="]"?r=!1:!r&&a[l]==="["&&(r=!0)}try{new RegExp(i)}catch{return console.warn(`Could not convert regex pattern at ${t.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),e.source}return i}function Gl(e,t){var s,n,a,i,o,r;const u={type:"object",additionalProperties:(s=ee(e.valueType._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]}))!=null?s:t.allowedAdditionalProperties};if(((n=e.keyType)==null?void 0:n._def.typeName)===K.ZodString&&((a=e.keyType._def.checks)!=null&&a.length)){const{type:l,...c}=Hl(e.keyType._def,t);return{...u,propertyNames:c}}else{if(((i=e.keyType)==null?void 0:i._def.typeName)===K.ZodEnum)return{...u,propertyNames:{enum:e.keyType._def.values}};if(((o=e.keyType)==null?void 0:o._def.typeName)===K.ZodBranded&&e.keyType._def.type._def.typeName===K.ZodString&&((r=e.keyType._def.type._def.checks)!=null&&r.length)){const{type:l,...c}=ql(e.keyType._def,t);return{...u,propertyNames:c}}}return u}function Cb(e,t){if(t.mapStrategy==="record")return Gl(e,t);const s=ee(e.keyType._def,{...t,currentPath:[...t.currentPath,"items","items","0"]})||Ee(),n=ee(e.valueType._def,{...t,currentPath:[...t.currentPath,"items","items","1"]})||Ee();return{type:"array",maxItems:125,items:{type:"array",items:[s,n],minItems:2,maxItems:2}}}function Eb(e){const t=e.values,n=Object.keys(e.values).filter(i=>typeof t[t[i]]!="number").map(i=>t[i]),a=Array.from(new Set(n.map(i=>typeof i)));return{type:a.length===1?a[0]==="string"?"string":"number":["string","number"],enum:n}}function Pb(){return{not:Ee()}}function Ib(){return{type:"null"}}var jn={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function Mb(e,t){const s=e.options instanceof Map?Array.from(e.options.values()):e.options;if(s.every(n=>n._def.typeName in jn&&(!n._def.checks||!n._def.checks.length))){const n=s.reduce((a,i)=>{const o=jn[i._def.typeName];return o&&!a.includes(o)?[...a,o]:a},[]);return{type:n.length>1?n:n[0]}}else if(s.every(n=>n._def.typeName==="ZodLiteral"&&!n.description)){const n=s.reduce((a,i)=>{const o=typeof i._def.value;switch(o){case"string":case"number":case"boolean":return[...a,o];case"bigint":return[...a,"integer"];case"object":if(i._def.value===null)return[...a,"null"];case"symbol":case"undefined":case"function":default:return a}},[]);if(n.length===s.length){const a=n.filter((i,o,r)=>r.indexOf(i)===o);return{type:a.length>1?a:a[0],enum:s.reduce((i,o)=>i.includes(o._def.value)?i:[...i,o._def.value],[])}}}else if(s.every(n=>n._def.typeName==="ZodEnum"))return{type:"string",enum:s.reduce((n,a)=>[...n,...a._def.values.filter(i=>!n.includes(i))],[])};return Rb(e,t)}var Rb=(e,t)=>{const s=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((n,a)=>ee(n._def,{...t,currentPath:[...t.currentPath,"anyOf",`${a}`]})).filter(n=>!!n&&(!t.strictUnions||typeof n=="object"&&Object.keys(n).length>0));return s.length?{anyOf:s}:void 0};function Db(e,t){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length))return{type:[jn[e.innerType._def.typeName],"null"]};const s=ee(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","0"]});return s&&{anyOf:[s,{type:"null"}]}}function $b(e){const t={type:"number"};if(!e.checks)return t;for(const s of e.checks)switch(s.kind){case"int":t.type="integer";break;case"min":s.inclusive?t.minimum=s.value:t.exclusiveMinimum=s.value;break;case"max":s.inclusive?t.maximum=s.value:t.exclusiveMaximum=s.value;break;case"multipleOf":t.multipleOf=s.value;break}return t}function Vb(e,t){const s={type:"object",properties:{}},n=[],a=e.shape();for(const o in a){let r=a[o];if(r===void 0||r._def===void 0)continue;const u=Lb(r),l=ee(r._def,{...t,currentPath:[...t.currentPath,"properties",o],propertyPath:[...t.currentPath,"properties",o]});l!==void 0&&(s.properties[o]=l,u||n.push(o))}n.length&&(s.required=n);const i=Ob(e,t);return i!==void 0&&(s.additionalProperties=i),s}function Ob(e,t){if(e.catchall._def.typeName!=="ZodNever")return ee(e.catchall._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]});switch(e.unknownKeys){case"passthrough":return t.allowedAdditionalProperties;case"strict":return t.rejectedAdditionalProperties;case"strip":return t.removeAdditionalStrategy==="strict"?t.allowedAdditionalProperties:t.rejectedAdditionalProperties}}function Lb(e){try{return e.isOptional()}catch{return!0}}var Bb=(e,t)=>{var s;if(t.currentPath.toString()===((s=t.propertyPath)==null?void 0:s.toString()))return ee(e.innerType._def,t);const n=ee(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","1"]});return n?{anyOf:[{not:Ee()},n]}:Ee()},Nb=(e,t)=>{if(t.pipeStrategy==="input")return ee(e.in._def,t);if(t.pipeStrategy==="output")return ee(e.out._def,t);const s=ee(e.in._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),n=ee(e.out._def,{...t,currentPath:[...t.currentPath,"allOf",s?"1":"0"]});return{allOf:[s,n].filter(a=>a!==void 0)}};function jb(e,t){return ee(e.type._def,t)}function Fb(e,t){const n={type:"array",uniqueItems:!0,items:ee(e.valueType._def,{...t,currentPath:[...t.currentPath,"items"]})};return e.minSize&&(n.minItems=e.minSize.value),e.maxSize&&(n.maxItems=e.maxSize.value),n}function zb(e,t){return e.rest?{type:"array",minItems:e.items.length,items:e.items.map((s,n)=>ee(s._def,{...t,currentPath:[...t.currentPath,"items",`${n}`]})).reduce((s,n)=>n===void 0?s:[...s,n],[]),additionalItems:ee(e.rest._def,{...t,currentPath:[...t.currentPath,"additionalItems"]})}:{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map((s,n)=>ee(s._def,{...t,currentPath:[...t.currentPath,"items",`${n}`]})).reduce((s,n)=>n===void 0?s:[...s,n],[])}}function qb(){return{not:Ee()}}function Ub(){return Ee()}var Hb=(e,t)=>ee(e.innerType._def,t),Gb=(e,t,s)=>{switch(t){case K.ZodString:return Hl(e,s);case K.ZodNumber:return $b(e);case K.ZodObject:return Vb(e,s);case K.ZodBigInt:return hb(e);case K.ZodBoolean:return gb();case K.ZodDate:return Ul(e,s);case K.ZodUndefined:return qb();case K.ZodNull:return Ib();case K.ZodArray:return mb(e,s);case K.ZodUnion:case K.ZodDiscriminatedUnion:return Mb(e,s);case K.ZodIntersection:return Sb(e,s);case K.ZodTuple:return zb(e,s);case K.ZodRecord:return Gl(e,s);case K.ZodLiteral:return Tb(e);case K.ZodEnum:return _b(e);case K.ZodNativeEnum:return Eb(e);case K.ZodNullable:return Db(e,s);case K.ZodOptional:return Bb(e,s);case K.ZodMap:return Cb(e,s);case K.ZodSet:return Fb(e,s);case K.ZodLazy:return()=>e.getter()._def;case K.ZodPromise:return jb(e,s);case K.ZodNaN:case K.ZodNever:return Pb();case K.ZodEffects:return xb(e,s);case K.ZodAny:return Ee();case K.ZodUnknown:return Ub();case K.ZodDefault:return bb(e,s);case K.ZodBranded:return ql(e,s);case K.ZodReadonly:return Hb(e,s);case K.ZodCatch:return yb(e,s);case K.ZodPipeline:return Nb(e,s);case K.ZodFunction:case K.ZodVoid:case K.ZodSymbol:return;default:return(n=>{})()}},Zb=(e,t)=>{let s=0;for(;s<e.length&&s<t.length&&e[s]===t[s];s++);return[(e.length-s).toString(),...t.slice(s)].join("/")};function ee(e,t,s=!1){var n;const a=t.seen.get(e);if(t.override){const u=(n=t.override)==null?void 0:n.call(t,e,t,a,s);if(u!==pb)return u}if(a&&!s){const u=Wb(a,t);if(u!==void 0)return u}const i={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,i);const o=Gb(e,e.typeName,t),r=typeof o=="function"?ee(o(),t):o;if(r&&Kb(e,t,r),t.postProcess){const u=t.postProcess(r,e,t);return i.jsonSchema=r,u}return i.jsonSchema=r,r}var Wb=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:Zb(t.currentPath,e.path)};case"none":case"seen":return e.path.length<t.currentPath.length&&e.path.every((s,n)=>t.currentPath[n]===s)?(console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`),Ee()):t.$refStrategy==="seen"?Ee():void 0}},Kb=(e,t,s)=>(e.description&&(s.description=e.description),s),Yb=e=>{const t=fb(e),s=t.name!==void 0?[...t.basePath,t.definitionPath,t.name]:t.basePath;return{...t,currentPath:s,propertyPath:void 0,seen:new Map(Object.entries(t.definitions).map(([n,a])=>[a._def,{def:a._def,path:[...t.basePath,t.definitionPath,n],jsonSchema:void 0}]))}},Xb=(e,t)=>{var s;const n=Yb(t);let a=typeof t=="object"&&t.definitions?Object.entries(t.definitions).reduce((l,[c,d])=>{var p;return{...l,[c]:(p=ee(d._def,{...n,currentPath:[...n.basePath,n.definitionPath,c]},!0))!=null?p:Ee()}},{}):void 0;const i=typeof t=="string"?t:(t==null?void 0:t.nameStrategy)==="title"||t==null?void 0:t.name,o=(s=ee(e._def,i===void 0?n:{...n,currentPath:[...n.basePath,n.definitionPath,i]},!1))!=null?s:Ee(),r=typeof t=="object"&&t.name!==void 0&&t.nameStrategy==="title"?t.name:void 0;r!==void 0&&(o.title=r);const u=i===void 0?a?{...o,[n.definitionPath]:a}:o:{$ref:[...n.$refStrategy==="relative"?[]:n.basePath,n.definitionPath,i].join("/"),[n.definitionPath]:{...a,[i]:o}};return u.$schema="http://json-schema.org/draft-07/schema#",u},Fn=Symbol.for("vercel.ai.schema");function Jb(e){let t;return()=>(t==null&&(t=e()),t)}function zs(e,{validate:t}={}){return{[Fn]:!0,_type:void 0,get jsonSchema(){return typeof e=="function"&&(e=e()),e},validate:t}}function Qb(e){return typeof e=="object"&&e!==null&&Fn in e&&e[Fn]===!0&&"jsonSchema"in e&&"validate"in e}function Va(e){return e==null?zs({properties:{},additionalProperties:!1}):Qb(e)?e:"~standard"in e?e["~standard"].vendor==="zod"?Zl(e):ex(e):e()}function ex(e){return zs(()=>$a(e["~standard"].jsonSchema.input({target:"draft-07"})),{validate:async t=>{const s=await e["~standard"].validate(t);return"value"in s?{success:!0,value:s.value}:{success:!1,error:new Dt({value:t,cause:s.issues})}}})}function tx(e,t){var s;const n=(s=void 0)!=null?s:!1;return zs(()=>Xb(e,{$refStrategy:n?"root":"none"}),{validate:async a=>{const i=await e.safeParseAsync(a);return i.success?{success:!0,value:i.data}:{success:!1,error:i.error}}})}function sx(e,t){var s;const n=(s=void 0)!=null?s:!1;return zs(()=>$a(rc(e,{target:"draft-7",io:"input",reused:n?"ref":"inline"})),{validate:async a=>{const i=await oc(e,a);return i.success?{success:!0,value:i.data}:{success:!1,error:i.error}}})}function nx(e){return"_zod"in e}function Zl(e,t){return nx(e)?sx(e):tx(e)}async function Po({value:e,schema:t,context:s}){const n=await ns({value:e,schema:t,context:s});if(!n.success)throw Dt.wrap({value:e,cause:n.error,context:s});return n.value}async function ns({value:e,schema:t,context:s}){const n=Va(t);try{if(n.validate==null)return{success:!0,value:e,rawValue:e};const a=await n.validate(e);return a.success?{success:!0,value:a.value,rawValue:e}:{success:!1,error:Dt.wrap({value:e,cause:a.error,context:s}),rawValue:e}}catch(a){return{success:!1,error:Dt.wrap({value:e,cause:a,context:s}),rawValue:e}}}async function _t({text:e,schema:t}){try{const s=db(e);return t==null?{success:!0,value:s,rawValue:s}:await ns({value:s,schema:t})}catch(s){return{success:!1,error:_o.isInstance(s)?s:new _o({text:e,cause:s}),rawValue:void 0}}}function ax({stream:e,schema:t}){return e.pipeThrough(new TextDecoderStream).pipeThrough(new tb).pipeThrough(new TransformStream({async transform({data:s},n){s!=="[DONE]"&&n.enqueue(await _t({text:s,schema:t}))}}))}async function Qe(e){return typeof e=="function"&&(e=e()),Promise.resolve(e)}var ix=Object.defineProperty,ox=(e,t)=>{for(var s in t)ix(e,s,{get:t[s],enumerable:!0})},Wl="AI_NoObjectGeneratedError",Kl=`vercel.ai.error.${Wl}`,rx=Symbol.for(Kl),Yl,tt=class extends He{constructor({message:e="No object generated.",cause:t,text:s,response:n,usage:a,finishReason:i}){super({name:Wl,message:e,cause:t}),this[Yl]=!0,this.text=s,this.response=n,this.usage=a,this.finishReason=i}static isInstance(e){return He.hasMarker(e,Kl)}};Yl=rx;var Xl="AI_UIMessageStreamError",Jl=`vercel.ai.error.${Xl}`,lx=Symbol.for(Jl),Ql,Tt=class extends He{constructor({chunkType:e,chunkId:t,message:s}){super({name:Xl,message:s}),this[Ql]=!0,this.chunkType=e,this.chunkId=t}static isInstance(e){return He.hasMarker(e,Jl)}};Ql=lx;var Io="6.0.116",eu=ke([$(),As(Uint8Array),As(ArrayBuffer),Wo(e=>{var t,s;return(s=(t=globalThis.Buffer)==null?void 0:t.isBuffer(e))!=null?s:!1},{message:"Must be a Buffer"})]),as=lc(()=>ke([cc(),$(),dc(),xe(),Xt($(),as.optional()),rs(as)])),X=Xt($(),Xt($(),as.optional())),tu=te({type:H("text"),text:$(),providerOptions:X.optional()}),ux=te({type:H("image"),image:ke([eu,As(URL)]),mediaType:$().optional(),providerOptions:X.optional()}),su=te({type:H("file"),data:ke([eu,As(URL)]),filename:$().optional(),mediaType:$(),providerOptions:X.optional()}),cx=te({type:H("reasoning"),text:$(),providerOptions:X.optional()}),dx=te({type:H("tool-call"),toolCallId:$(),toolName:$(),input:Xe(),providerOptions:X.optional(),providerExecuted:xe().optional()}),px=uc("type",[te({type:H("text"),value:$(),providerOptions:X.optional()}),te({type:H("json"),value:as,providerOptions:X.optional()}),te({type:H("execution-denied"),reason:$().optional(),providerOptions:X.optional()}),te({type:H("error-text"),value:$(),providerOptions:X.optional()}),te({type:H("error-json"),value:as,providerOptions:X.optional()}),te({type:H("content"),value:rs(ke([te({type:H("text"),text:$(),providerOptions:X.optional()}),te({type:H("media"),data:$(),mediaType:$()}),te({type:H("file-data"),data:$(),mediaType:$(),filename:$().optional(),providerOptions:X.optional()}),te({type:H("file-url"),url:$(),providerOptions:X.optional()}),te({type:H("file-id"),fileId:ke([$(),Xt($(),$())]),providerOptions:X.optional()}),te({type:H("image-data"),data:$(),mediaType:$(),providerOptions:X.optional()}),te({type:H("image-url"),url:$(),providerOptions:X.optional()}),te({type:H("image-file-id"),fileId:ke([$(),Xt($(),$())]),providerOptions:X.optional()}),te({type:H("custom"),providerOptions:X.optional()})]))})]),nu=te({type:H("tool-result"),toolCallId:$(),toolName:$(),output:px,providerOptions:X.optional()}),fx=te({type:H("tool-approval-request"),approvalId:$(),toolCallId:$()}),mx=te({type:H("tool-approval-response"),approvalId:$(),approved:xe(),reason:$().optional()}),hx=te({role:H("system"),content:$(),providerOptions:X.optional()}),gx=te({role:H("user"),content:ke([$(),rs(ke([tu,ux,su]))]),providerOptions:X.optional()}),yx=te({role:H("assistant"),content:ke([$(),rs(ke([tu,su,cx,dx,nu,fx]))]),providerOptions:X.optional()}),vx=te({role:H("tool"),content:rs(ke([nu,mx])),providerOptions:X.optional()});ke([hx,gx,yx,vx]);function au(e,t){if(e===void 0&&t===void 0)return;if(e===void 0)return t;if(t===void 0)return e;const s={...e};for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)){const a=t[n];if(a===void 0)continue;const i=n in e?e[n]:void 0,o=a!==null&&typeof a=="object"&&!Array.isArray(a)&&!(a instanceof Date)&&!(a instanceof RegExp),r=i!=null&&typeof i=="object"&&!Array.isArray(i)&&!(i instanceof Date)&&!(i instanceof RegExp);o&&r?s[n]=au(i,a):s[n]=a}return s}var bx={};ox(bx,{array:()=>Sx,choice:()=>Tx,json:()=>kx,object:()=>wx,text:()=>_x});function xx(e){const t=["ROOT"];let s=-1,n=null;function a(u,l,c){switch(u){case'"':{s=l,t.pop(),t.push(c),t.push("INSIDE_STRING");break}case"f":case"t":case"n":{s=l,n=l,t.pop(),t.push(c),t.push("INSIDE_LITERAL");break}case"-":{t.pop(),t.push(c),t.push("INSIDE_NUMBER");break}case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":{s=l,t.pop(),t.push(c),t.push("INSIDE_NUMBER");break}case"{":{s=l,t.pop(),t.push(c),t.push("INSIDE_OBJECT_START");break}case"[":{s=l,t.pop(),t.push(c),t.push("INSIDE_ARRAY_START");break}}}function i(u,l){switch(u){case",":{t.pop(),t.push("INSIDE_OBJECT_AFTER_COMMA");break}case"}":{s=l,t.pop();break}}}function o(u,l){switch(u){case",":{t.pop(),t.push("INSIDE_ARRAY_AFTER_COMMA");break}case"]":{s=l,t.pop();break}}}for(let u=0;u<e.length;u++){const l=e[u];switch(t[t.length-1]){case"ROOT":a(l,u,"FINISH");break;case"INSIDE_OBJECT_START":{switch(l){case'"':{t.pop(),t.push("INSIDE_OBJECT_KEY");break}case"}":{s=u,t.pop();break}}break}case"INSIDE_OBJECT_AFTER_COMMA":{switch(l){case'"':{t.pop(),t.push("INSIDE_OBJECT_KEY");break}}break}case"INSIDE_OBJECT_KEY":{switch(l){case'"':{t.pop(),t.push("INSIDE_OBJECT_AFTER_KEY");break}}break}case"INSIDE_OBJECT_AFTER_KEY":{switch(l){case":":{t.pop(),t.push("INSIDE_OBJECT_BEFORE_VALUE");break}}break}case"INSIDE_OBJECT_BEFORE_VALUE":{a(l,u,"INSIDE_OBJECT_AFTER_VALUE");break}case"INSIDE_OBJECT_AFTER_VALUE":{i(l,u);break}case"INSIDE_STRING":{switch(l){case'"':{t.pop(),s=u;break}case"\\":{t.push("INSIDE_STRING_ESCAPE");break}default:s=u}break}case"INSIDE_ARRAY_START":{switch(l){case"]":{s=u,t.pop();break}default:{s=u,a(l,u,"INSIDE_ARRAY_AFTER_VALUE");break}}break}case"INSIDE_ARRAY_AFTER_VALUE":{switch(l){case",":{t.pop(),t.push("INSIDE_ARRAY_AFTER_COMMA");break}case"]":{s=u,t.pop();break}default:{s=u;break}}break}case"INSIDE_ARRAY_AFTER_COMMA":{a(l,u,"INSIDE_ARRAY_AFTER_VALUE");break}case"INSIDE_STRING_ESCAPE":{t.pop(),s=u;break}case"INSIDE_NUMBER":{switch(l){case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":{s=u;break}case"e":case"E":case"-":case".":break;case",":{t.pop(),t[t.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&o(l,u),t[t.length-1]==="INSIDE_OBJECT_AFTER_VALUE"&&i(l,u);break}case"}":{t.pop(),t[t.length-1]==="INSIDE_OBJECT_AFTER_VALUE"&&i(l,u);break}case"]":{t.pop(),t[t.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&o(l,u);break}default:{t.pop();break}}break}case"INSIDE_LITERAL":{const d=e.substring(n,u+1);!"false".startsWith(d)&&!"true".startsWith(d)&&!"null".startsWith(d)?(t.pop(),t[t.length-1]==="INSIDE_OBJECT_AFTER_VALUE"?i(l,u):t[t.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&o(l,u)):s=u;break}}}let r=e.slice(0,s+1);for(let u=t.length-1;u>=0;u--)switch(t[u]){case"INSIDE_STRING":{r+='"';break}case"INSIDE_OBJECT_KEY":case"INSIDE_OBJECT_AFTER_KEY":case"INSIDE_OBJECT_AFTER_COMMA":case"INSIDE_OBJECT_START":case"INSIDE_OBJECT_BEFORE_VALUE":case"INSIDE_OBJECT_AFTER_VALUE":{r+="}";break}case"INSIDE_ARRAY_START":case"INSIDE_ARRAY_AFTER_COMMA":case"INSIDE_ARRAY_AFTER_VALUE":{r+="]";break}case"INSIDE_LITERAL":{const c=e.substring(n,e.length);"true".startsWith(c)?r+="true".slice(c.length):"false".startsWith(c)?r+="false".slice(c.length):"null".startsWith(c)&&(r+="null".slice(c.length))}}return r}async function fs(e){if(e===void 0)return{value:void 0,state:"undefined-input"};let t=await _t({text:e});return t.success?{value:t.value,state:"successful-parse"}:(t=await _t({text:xx(e)}),t.success?{value:t.value,state:"repaired-parse"}:{value:void 0,state:"failed-parse"})}var _x=()=>({name:"text",responseFormat:Promise.resolve({type:"text"}),async parseCompleteOutput({text:e}){return e},async parsePartialOutput({text:e}){return{partial:e}},createElementStreamTransform(){}}),wx=({schema:e,name:t,description:s})=>{const n=Va(e);return{name:"object",responseFormat:Qe(n.jsonSchema).then(a=>({type:"json",schema:a,...t!=null&&{name:t},...s!=null&&{description:s}})),async parseCompleteOutput({text:a},i){const o=await _t({text:a});if(!o.success)throw new tt({message:"No object generated: could not parse the response.",cause:o.error,text:a,response:i.response,usage:i.usage,finishReason:i.finishReason});const r=await ns({value:o.value,schema:n});if(!r.success)throw new tt({message:"No object generated: response did not match schema.",cause:r.error,text:a,response:i.response,usage:i.usage,finishReason:i.finishReason});return r.value},async parsePartialOutput({text:a}){const i=await fs(a);switch(i.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":return{partial:i.value}}},createElementStreamTransform(){}}},Sx=({element:e,name:t,description:s})=>{const n=Va(e);return{name:"array",responseFormat:Qe(n.jsonSchema).then(a=>{const{$schema:i,...o}=a;return{type:"json",schema:{$schema:"http://json-schema.org/draft-07/schema#",type:"object",properties:{elements:{type:"array",items:o}},required:["elements"],additionalProperties:!1},...t!=null&&{name:t},...s!=null&&{description:s}}}),async parseCompleteOutput({text:a},i){const o=await _t({text:a});if(!o.success)throw new tt({message:"No object generated: could not parse the response.",cause:o.error,text:a,response:i.response,usage:i.usage,finishReason:i.finishReason});const r=o.value;if(r==null||typeof r!="object"||!("elements"in r)||!Array.isArray(r.elements))throw new tt({message:"No object generated: response did not match schema.",cause:new Dt({value:r,cause:"response must be an object with an elements array"}),text:a,response:i.response,usage:i.usage,finishReason:i.finishReason});for(const u of r.elements){const l=await ns({value:u,schema:n});if(!l.success)throw new tt({message:"No object generated: response did not match schema.",cause:l.error,text:a,response:i.response,usage:i.usage,finishReason:i.finishReason})}return r.elements},async parsePartialOutput({text:a}){const i=await fs(a);switch(i.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":{const o=i.value;if(o==null||typeof o!="object"||!("elements"in o)||!Array.isArray(o.elements))return;const r=i.state==="repaired-parse"&&o.elements.length>0?o.elements.slice(0,-1):o.elements,u=[];for(const l of r){const c=await ns({value:l,schema:n});c.success&&u.push(c.value)}return{partial:u}}}},createElementStreamTransform(){let a=0;return new TransformStream({transform({partialOutput:i},o){if(i!=null)for(;a<i.length;a++)o.enqueue(i[a])}})}}},Tx=({options:e,name:t,description:s})=>({name:"choice",responseFormat:Promise.resolve({type:"json",schema:{$schema:"http://json-schema.org/draft-07/schema#",type:"object",properties:{result:{type:"string",enum:e}},required:["result"],additionalProperties:!1},...t!=null&&{name:t},...s!=null&&{description:s}}),async parseCompleteOutput({text:n},a){const i=await _t({text:n});if(!i.success)throw new tt({message:"No object generated: could not parse the response.",cause:i.error,text:n,response:a.response,usage:a.usage,finishReason:a.finishReason});const o=i.value;if(o==null||typeof o!="object"||!("result"in o)||typeof o.result!="string"||!e.includes(o.result))throw new tt({message:"No object generated: response did not match schema.",cause:new Dt({value:o,cause:"response must be an object that contains a choice value."}),text:n,response:a.response,usage:a.usage,finishReason:a.finishReason});return o.result},async parsePartialOutput({text:n}){const a=await fs(n);switch(a.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":{const i=a.value;if(i==null||typeof i!="object"||!("result"in i)||typeof i.result!="string")return;const o=e.filter(r=>r.startsWith(i.result));return a.state==="successful-parse"?o.includes(i.result)?{partial:i.result}:void 0:o.length===1?{partial:o[0]}:void 0}}},createElementStreamTransform(){}}),kx=({name:e,description:t}={})=>({name:"json",responseFormat:Promise.resolve({type:"json",...e!=null&&{name:e},...t!=null&&{description:t}}),async parseCompleteOutput({text:s},n){const a=await _t({text:s});if(!a.success)throw new tt({message:"No object generated: could not parse the response.",cause:a.error,text:s,response:n.response,usage:n.usage,finishReason:n.finishReason});return a.value},async parsePartialOutput({text:s}){const n=await fs(s);switch(n.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":return n.value===void 0?void 0:{partial:n.value}}},createElementStreamTransform(){}});ps({prefix:"aitxt",size:24});(class extends TransformStream{constructor(){super({transform(e,t){t.enqueue(`data: ${JSON.stringify(e)}
17
+
18
+ `)},flush(e){e.enqueue(`data: [DONE]
19
+
20
+ `)}})}});var Ax=Jb(()=>Zl(ke([ne({type:H("text-start"),id:$(),providerMetadata:X.optional()}),ne({type:H("text-delta"),id:$(),delta:$(),providerMetadata:X.optional()}),ne({type:H("text-end"),id:$(),providerMetadata:X.optional()}),ne({type:H("error"),errorText:$()}),ne({type:H("tool-input-start"),toolCallId:$(),toolName:$(),providerExecuted:xe().optional(),providerMetadata:X.optional(),dynamic:xe().optional(),title:$().optional()}),ne({type:H("tool-input-delta"),toolCallId:$(),inputTextDelta:$()}),ne({type:H("tool-input-available"),toolCallId:$(),toolName:$(),input:Xe(),providerExecuted:xe().optional(),providerMetadata:X.optional(),dynamic:xe().optional(),title:$().optional()}),ne({type:H("tool-input-error"),toolCallId:$(),toolName:$(),input:Xe(),providerExecuted:xe().optional(),providerMetadata:X.optional(),dynamic:xe().optional(),errorText:$(),title:$().optional()}),ne({type:H("tool-approval-request"),approvalId:$(),toolCallId:$()}),ne({type:H("tool-output-available"),toolCallId:$(),output:Xe(),providerExecuted:xe().optional(),dynamic:xe().optional(),preliminary:xe().optional()}),ne({type:H("tool-output-error"),toolCallId:$(),errorText:$(),providerExecuted:xe().optional(),dynamic:xe().optional()}),ne({type:H("tool-output-denied"),toolCallId:$()}),ne({type:H("reasoning-start"),id:$(),providerMetadata:X.optional()}),ne({type:H("reasoning-delta"),id:$(),delta:$(),providerMetadata:X.optional()}),ne({type:H("reasoning-end"),id:$(),providerMetadata:X.optional()}),ne({type:H("source-url"),sourceId:$(),url:$(),title:$().optional(),providerMetadata:X.optional()}),ne({type:H("source-document"),sourceId:$(),mediaType:$(),title:$(),filename:$().optional(),providerMetadata:X.optional()}),ne({type:H("file"),url:$(),mediaType:$(),providerMetadata:X.optional()}),ne({type:Wo(e=>typeof e=="string"&&e.startsWith("data-"),{message:'Type must start with "data-"'}),id:$().optional(),data:Xe(),transient:xe().optional()}),ne({type:H("start-step")}),ne({type:H("finish-step")}),ne({type:H("start"),messageId:$().optional(),messageMetadata:Xe().optional()}),ne({type:H("finish"),finishReason:pc(["stop","length","content-filter","tool-calls","error","other"]).optional(),messageMetadata:Xe().optional()}),ne({type:H("abort"),reason:$().optional()}),ne({type:H("message-metadata"),messageMetadata:Xe()})])));function Cx(e){return e.type.startsWith("data-")}function zn(e){return e.type.startsWith("tool-")}function Ex(e){return e.type==="dynamic-tool"}function is(e){return zn(e)||Ex(e)}function Mo(e){return e.type.split("-").slice(1).join("-")}function Px({lastMessage:e,messageId:t}){return{message:(e==null?void 0:e.role)==="assistant"?e:{id:t,metadata:void 0,role:"assistant",parts:[]},activeTextParts:{},activeReasoningParts:{},partialToolCalls:{}}}function Ix({stream:e,messageMetadataSchema:t,dataPartSchemas:s,runUpdateMessageJob:n,onError:a,onToolCall:i,onData:o}){return e.pipeThrough(new TransformStream({async transform(r,u){await n(async({state:l,write:c})=>{var d,p,f,y;function _(m){const R=l.message.parts.filter(is).find(M=>M.toolCallId===m);if(R==null)throw new Tt({chunkType:"tool-invocation",chunkId:m,message:`No tool invocation found for tool call ID "${m}".`});return R}function v(m){var D;const R=l.message.parts.find(k=>zn(k)&&k.toolCallId===m.toolCallId),M=m,S=R;R!=null?(R.state=m.state,S.input=M.input,S.output=M.output,S.errorText=M.errorText,S.rawInput=M.rawInput,S.preliminary=M.preliminary,m.title!==void 0&&(S.title=m.title),S.providerExecuted=(D=M.providerExecuted)!=null?D:R.providerExecuted,M.providerMetadata!=null&&(R.callProviderMetadata=M.providerMetadata)):l.message.parts.push({type:`tool-${m.toolName}`,toolCallId:m.toolCallId,state:m.state,title:m.title,input:M.input,output:M.output,rawInput:M.rawInput,errorText:M.errorText,providerExecuted:M.providerExecuted,preliminary:M.preliminary,...M.providerMetadata!=null?{callProviderMetadata:M.providerMetadata}:{}})}function h(m){var D,R;const M=l.message.parts.find(Z=>Z.type==="dynamic-tool"&&Z.toolCallId===m.toolCallId),S=m,k=M;M!=null?(M.state=m.state,k.toolName=m.toolName,k.input=S.input,k.output=S.output,k.errorText=S.errorText,k.rawInput=(D=S.rawInput)!=null?D:k.rawInput,k.preliminary=S.preliminary,m.title!==void 0&&(k.title=m.title),k.providerExecuted=(R=S.providerExecuted)!=null?R:M.providerExecuted,S.providerMetadata!=null&&(M.callProviderMetadata=S.providerMetadata)):l.message.parts.push({type:"dynamic-tool",toolName:m.toolName,toolCallId:m.toolCallId,state:m.state,input:S.input,output:S.output,errorText:S.errorText,preliminary:S.preliminary,providerExecuted:S.providerExecuted,title:m.title,...S.providerMetadata!=null?{callProviderMetadata:S.providerMetadata}:{}})}async function C(m){if(m!=null){const D=l.message.metadata!=null?au(l.message.metadata,m):m;t!=null&&await Po({value:D,schema:t,context:{field:"message.metadata",entityId:l.message.id}}),l.message.metadata=D}}switch(r.type){case"text-start":{const m={type:"text",text:"",providerMetadata:r.providerMetadata,state:"streaming"};l.activeTextParts[r.id]=m,l.message.parts.push(m),c();break}case"text-delta":{const m=l.activeTextParts[r.id];if(m==null)throw new Tt({chunkType:"text-delta",chunkId:r.id,message:`Received text-delta for missing text part with ID "${r.id}". Ensure a "text-start" chunk is sent before any "text-delta" chunks.`});m.text+=r.delta,m.providerMetadata=(d=r.providerMetadata)!=null?d:m.providerMetadata,c();break}case"text-end":{const m=l.activeTextParts[r.id];if(m==null)throw new Tt({chunkType:"text-end",chunkId:r.id,message:`Received text-end for missing text part with ID "${r.id}". Ensure a "text-start" chunk is sent before any "text-end" chunks.`});m.state="done",m.providerMetadata=(p=r.providerMetadata)!=null?p:m.providerMetadata,delete l.activeTextParts[r.id],c();break}case"reasoning-start":{const m={type:"reasoning",text:"",providerMetadata:r.providerMetadata,state:"streaming"};l.activeReasoningParts[r.id]=m,l.message.parts.push(m),c();break}case"reasoning-delta":{const m=l.activeReasoningParts[r.id];if(m==null)throw new Tt({chunkType:"reasoning-delta",chunkId:r.id,message:`Received reasoning-delta for missing reasoning part with ID "${r.id}". Ensure a "reasoning-start" chunk is sent before any "reasoning-delta" chunks.`});m.text+=r.delta,m.providerMetadata=(f=r.providerMetadata)!=null?f:m.providerMetadata,c();break}case"reasoning-end":{const m=l.activeReasoningParts[r.id];if(m==null)throw new Tt({chunkType:"reasoning-end",chunkId:r.id,message:`Received reasoning-end for missing reasoning part with ID "${r.id}". Ensure a "reasoning-start" chunk is sent before any "reasoning-end" chunks.`});m.providerMetadata=(y=r.providerMetadata)!=null?y:m.providerMetadata,m.state="done",delete l.activeReasoningParts[r.id],c();break}case"file":{l.message.parts.push({type:"file",mediaType:r.mediaType,url:r.url,...r.providerMetadata!=null?{providerMetadata:r.providerMetadata}:{}}),c();break}case"source-url":{l.message.parts.push({type:"source-url",sourceId:r.sourceId,url:r.url,title:r.title,providerMetadata:r.providerMetadata}),c();break}case"source-document":{l.message.parts.push({type:"source-document",sourceId:r.sourceId,mediaType:r.mediaType,title:r.title,filename:r.filename,providerMetadata:r.providerMetadata}),c();break}case"tool-input-start":{const m=l.message.parts.filter(zn);l.partialToolCalls[r.toolCallId]={text:"",toolName:r.toolName,index:m.length,dynamic:r.dynamic,title:r.title},r.dynamic?h({toolCallId:r.toolCallId,toolName:r.toolName,state:"input-streaming",input:void 0,providerExecuted:r.providerExecuted,title:r.title,providerMetadata:r.providerMetadata}):v({toolCallId:r.toolCallId,toolName:r.toolName,state:"input-streaming",input:void 0,providerExecuted:r.providerExecuted,title:r.title,providerMetadata:r.providerMetadata}),c();break}case"tool-input-delta":{const m=l.partialToolCalls[r.toolCallId];if(m==null)throw new Tt({chunkType:"tool-input-delta",chunkId:r.toolCallId,message:`Received tool-input-delta for missing tool call with ID "${r.toolCallId}". Ensure a "tool-input-start" chunk is sent before any "tool-input-delta" chunks.`});m.text+=r.inputTextDelta;const{value:D}=await fs(m.text);m.dynamic?h({toolCallId:r.toolCallId,toolName:m.toolName,state:"input-streaming",input:D,title:m.title}):v({toolCallId:r.toolCallId,toolName:m.toolName,state:"input-streaming",input:D,title:m.title}),c();break}case"tool-input-available":{r.dynamic?h({toolCallId:r.toolCallId,toolName:r.toolName,state:"input-available",input:r.input,providerExecuted:r.providerExecuted,providerMetadata:r.providerMetadata,title:r.title}):v({toolCallId:r.toolCallId,toolName:r.toolName,state:"input-available",input:r.input,providerExecuted:r.providerExecuted,providerMetadata:r.providerMetadata,title:r.title}),c(),i&&!r.providerExecuted&&await i({toolCall:r});break}case"tool-input-error":{const m=l.message.parts.filter(is).find(R=>R.toolCallId===r.toolCallId);(m!=null?m.type==="dynamic-tool":!!r.dynamic)?h({toolCallId:r.toolCallId,toolName:r.toolName,state:"output-error",input:r.input,errorText:r.errorText,providerExecuted:r.providerExecuted,providerMetadata:r.providerMetadata}):v({toolCallId:r.toolCallId,toolName:r.toolName,state:"output-error",input:void 0,rawInput:r.input,errorText:r.errorText,providerExecuted:r.providerExecuted,providerMetadata:r.providerMetadata}),c();break}case"tool-approval-request":{const m=_(r.toolCallId);m.state="approval-requested",m.approval={id:r.approvalId},c();break}case"tool-output-denied":{const m=_(r.toolCallId);m.state="output-denied",c();break}case"tool-output-available":{const m=_(r.toolCallId);m.type==="dynamic-tool"?h({toolCallId:r.toolCallId,toolName:m.toolName,state:"output-available",input:m.input,output:r.output,preliminary:r.preliminary,providerExecuted:r.providerExecuted,title:m.title}):v({toolCallId:r.toolCallId,toolName:Mo(m),state:"output-available",input:m.input,output:r.output,providerExecuted:r.providerExecuted,preliminary:r.preliminary,title:m.title}),c();break}case"tool-output-error":{const m=_(r.toolCallId);m.type==="dynamic-tool"?h({toolCallId:r.toolCallId,toolName:m.toolName,state:"output-error",input:m.input,errorText:r.errorText,providerExecuted:r.providerExecuted,title:m.title}):v({toolCallId:r.toolCallId,toolName:Mo(m),state:"output-error",input:m.input,rawInput:m.rawInput,errorText:r.errorText,providerExecuted:r.providerExecuted,title:m.title}),c();break}case"start-step":{l.message.parts.push({type:"step-start"});break}case"finish-step":{l.activeTextParts={},l.activeReasoningParts={};break}case"start":{r.messageId!=null&&(l.message.id=r.messageId),await C(r.messageMetadata),(r.messageId!=null||r.messageMetadata!=null)&&c();break}case"finish":{r.finishReason!=null&&(l.finishReason=r.finishReason),await C(r.messageMetadata),r.messageMetadata!=null&&c();break}case"message-metadata":{await C(r.messageMetadata),r.messageMetadata!=null&&c();break}case"error":{a==null||a(new Error(r.errorText));break}default:if(Cx(r)){if((s==null?void 0:s[r.type])!=null){const R=l.message.parts.findIndex(S=>"id"in S&&"data"in S&&S.id===r.id&&S.type===r.type),M=R>=0?R:l.message.parts.length;await Po({value:r.data,schema:s[r.type],context:{field:`message.parts[${M}].data`,entityName:r.type,entityId:r.id}})}const m=r;if(m.transient){o==null||o(m);break}const D=m.id!=null?l.message.parts.find(R=>m.type===R.type&&m.id===R.id):void 0;D!=null?D.data=m.data:l.message.parts.push(m),o==null||o(m),c()}}u.enqueue(r)})}}))}async function Mx({stream:e,onError:t}){const s=e.getReader();try{for(;;){const{done:n}=await s.read();if(n)break}}catch(n){t==null||t(n)}finally{s.releaseLock()}}ps({prefix:"aitxt",size:24});ps({prefix:"aiobj",size:24});var Rx=class{constructor(){this.queue=[],this.isProcessing=!1}async processQueue(){if(!this.isProcessing){for(this.isProcessing=!0;this.queue.length>0;)await this.queue[0](),this.queue.shift();this.isProcessing=!1}}async run(e){return new Promise((t,s)=>{this.queue.push(async()=>{try{await e(),t()}catch(n){s(n)}}),this.processQueue()})}};ps({prefix:"aiobj",size:24});async function Dx(e){if(e==null)return[];if(!globalThis.FileList||!(e instanceof globalThis.FileList))throw new Error("FileList is not supported in the current environment");return Promise.all(Array.from(e).map(async t=>{const{name:s,type:n}=t,a=await new Promise((i,o)=>{const r=new FileReader;r.onload=u=>{var l;i((l=u.target)==null?void 0:l.result)},r.onerror=u=>o(u),r.readAsDataURL(t)});return{type:"file",mediaType:n,filename:s,url:a}}))}var $x=class{constructor({api:e="/api/chat",credentials:t,headers:s,body:n,fetch:a,prepareSendMessagesRequest:i,prepareReconnectToStreamRequest:o}){this.api=e,this.credentials=t,this.headers=s,this.body=n,this.fetch=a,this.prepareSendMessagesRequest=i,this.prepareReconnectToStreamRequest=o}async sendMessages({abortSignal:e,...t}){var s,n,a,i,o;const r=await Qe(this.body),u=await Qe(this.headers),l=await Qe(this.credentials),c={...lt(u),...lt(t.headers)},d=await((s=this.prepareSendMessagesRequest)==null?void 0:s.call(this,{api:this.api,id:t.chatId,messages:t.messages,body:{...r,...t.body},headers:c,credentials:l,requestMetadata:t.metadata,trigger:t.trigger,messageId:t.messageId})),p=(n=d==null?void 0:d.api)!=null?n:this.api,f=(d==null?void 0:d.headers)!==void 0?lt(d.headers):c,y=(d==null?void 0:d.body)!==void 0?d.body:{...r,...t.body,id:t.chatId,messages:t.messages,trigger:t.trigger,messageId:t.messageId},_=(a=d==null?void 0:d.credentials)!=null?a:l,h=await((i=this.fetch)!=null?i:globalThis.fetch)(p,{method:"POST",headers:ko({"Content-Type":"application/json",...f},`ai-sdk/${Io}`,To()),body:JSON.stringify(y),credentials:_,signal:e});if(!h.ok)throw new Error((o=await h.text())!=null?o:"Failed to fetch the chat response.");if(!h.body)throw new Error("The response body is empty.");return this.processResponseStream(h.body)}async reconnectToStream(e){var t,s,n,a,i;const o=await Qe(this.body),r=await Qe(this.headers),u=await Qe(this.credentials),l={...lt(r),...lt(e.headers)},c=await((t=this.prepareReconnectToStreamRequest)==null?void 0:t.call(this,{api:this.api,id:e.chatId,body:{...o,...e.body},headers:l,credentials:u,requestMetadata:e.metadata})),d=(s=c==null?void 0:c.api)!=null?s:`${this.api}/${e.chatId}/stream`,p=(c==null?void 0:c.headers)!==void 0?lt(c.headers):l,f=(n=c==null?void 0:c.credentials)!=null?n:u,_=await((a=this.fetch)!=null?a:globalThis.fetch)(d,{method:"GET",headers:ko(p,`ai-sdk/${Io}`,To()),credentials:f});if(_.status===204)return null;if(!_.ok)throw new Error((i=await _.text())!=null?i:"Failed to fetch the chat response.");if(!_.body)throw new Error("The response body is empty.");return this.processResponseStream(_.body)}},iu=class extends $x{constructor(e={}){super(e)}processResponseStream(e){return ax({stream:e,schema:Ax}).pipeThrough(new TransformStream({async transform(t,s){if(!t.success)throw t.error;s.enqueue(t.value)}}))}},Vx=class{constructor({generateId:e=rb,id:t=e(),transport:s=new iu,messageMetadataSchema:n,dataPartSchemas:a,state:i,onError:o,onToolCall:r,onFinish:u,onData:l,sendAutomaticallyWhen:c}){this.activeResponse=void 0,this.jobExecutor=new Rx,this.sendMessage=async(d,p)=>{var f,y,_,v;if(d==null){await this.makeRequest({trigger:"submit-message",messageId:(f=this.lastMessage)==null?void 0:f.id,...p});return}let h;if("text"in d||"files"in d?h={parts:[...Array.isArray(d.files)?d.files:await Dx(d.files),..."text"in d&&d.text!=null?[{type:"text",text:d.text}]:[]]}:h=d,d.messageId!=null){const C=this.state.messages.findIndex(m=>m.id===d.messageId);if(C===-1)throw new Error(`message with id ${d.messageId} not found`);if(this.state.messages[C].role!=="user")throw new Error(`message with id ${d.messageId} is not a user message`);this.state.messages=this.state.messages.slice(0,C+1),this.state.replaceMessage(C,{...h,id:d.messageId,role:(y=h.role)!=null?y:"user",metadata:d.metadata})}else this.state.pushMessage({...h,id:(_=h.id)!=null?_:this.generateId(),role:(v=h.role)!=null?v:"user",metadata:d.metadata});await this.makeRequest({trigger:"submit-message",messageId:d.messageId,...p})},this.regenerate=async({messageId:d,...p}={})=>{const f=d==null?this.state.messages.length-1:this.state.messages.findIndex(y=>y.id===d);if(f===-1)throw new Error(`message ${d} not found`);this.state.messages=this.state.messages.slice(0,this.messages[f].role==="assistant"?f:f+1),await this.makeRequest({trigger:"regenerate-message",messageId:d,...p})},this.resumeStream=async(d={})=>{await this.makeRequest({trigger:"resume-stream",...d})},this.clearError=()=>{this.status==="error"&&(this.state.error=void 0,this.setStatus({status:"ready"}))},this.addToolApprovalResponse=async({id:d,approved:p,reason:f})=>this.jobExecutor.run(async()=>{const y=this.state.messages,_=y[y.length-1],v=h=>is(h)&&h.state==="approval-requested"&&h.approval.id===d?{...h,state:"approval-responded",approval:{id:d,approved:p,reason:f}}:h;this.state.replaceMessage(y.length-1,{..._,parts:_.parts.map(v)}),this.activeResponse&&(this.activeResponse.state.message.parts=this.activeResponse.state.message.parts.map(v)),this.status!=="streaming"&&this.status!=="submitted"&&this.sendAutomaticallyWhen&&this.shouldSendAutomatically().then(h=>{var C;h&&this.makeRequest({trigger:"submit-message",messageId:(C=this.lastMessage)==null?void 0:C.id})})}),this.addToolOutput=async({state:d="output-available",tool:p,toolCallId:f,output:y,errorText:_})=>this.jobExecutor.run(async()=>{const v=this.state.messages,h=v[v.length-1],C=m=>is(m)&&m.toolCallId===f?{...m,state:d,output:y,errorText:_}:m;this.state.replaceMessage(v.length-1,{...h,parts:h.parts.map(C)}),this.activeResponse&&(this.activeResponse.state.message.parts=this.activeResponse.state.message.parts.map(C)),this.status!=="streaming"&&this.status!=="submitted"&&this.sendAutomaticallyWhen&&this.shouldSendAutomatically().then(m=>{var D;m&&this.makeRequest({trigger:"submit-message",messageId:(D=this.lastMessage)==null?void 0:D.id})})}),this.addToolResult=this.addToolOutput,this.stop=async()=>{var d;this.status!=="streaming"&&this.status!=="submitted"||(d=this.activeResponse)!=null&&d.abortController&&this.activeResponse.abortController.abort()},this.id=t,this.transport=s,this.generateId=e,this.messageMetadataSchema=n,this.dataPartSchemas=a,this.state=i,this.onError=o,this.onToolCall=r,this.onFinish=u,this.onData=l,this.sendAutomaticallyWhen=c}get status(){return this.state.status}setStatus({status:e,error:t}){this.status!==e&&(this.state.status=e,this.state.error=t)}get error(){return this.state.error}get messages(){return this.state.messages}get lastMessage(){return this.state.messages[this.state.messages.length-1]}set messages(e){this.state.messages=e}async shouldSendAutomatically(){if(!this.sendAutomaticallyWhen)return!1;const e=this.sendAutomaticallyWhen({messages:this.state.messages});return e&&typeof e=="object"&&"then"in e?await e:e}async makeRequest({trigger:e,metadata:t,headers:s,body:n,messageId:a}){var i,o,r;let u;if(e==="resume-stream")try{const f=await this.transport.reconnectToStream({chatId:this.id,metadata:t,headers:s,body:n});if(f==null)return;u=f}catch(f){this.onError&&f instanceof Error&&this.onError(f),this.setStatus({status:"error",error:f});return}this.setStatus({status:"submitted",error:void 0});const l=this.lastMessage;let c=!1,d=!1,p=!1;try{const f={state:Px({lastMessage:this.state.snapshot(l),messageId:this.generateId()}),abortController:new AbortController};f.abortController.signal.addEventListener("abort",()=>{c=!0}),this.activeResponse=f;let y;e==="resume-stream"?y=u:y=await this.transport.sendMessages({chatId:this.id,messages:this.state.messages,abortSignal:f.abortController.signal,metadata:t,headers:s,body:n,trigger:e,messageId:a});const _=v=>this.jobExecutor.run(()=>v({state:f.state,write:()=>{var h;this.setStatus({status:"streaming"}),f.state.message.id===((h=this.lastMessage)==null?void 0:h.id)?this.state.replaceMessage(this.state.messages.length-1,f.state.message):this.state.pushMessage(f.state.message)}}));await Mx({stream:Ix({stream:y,onToolCall:this.onToolCall,onData:this.onData,messageMetadataSchema:this.messageMetadataSchema,dataPartSchemas:this.dataPartSchemas,runUpdateMessageJob:_,onError:v=>{throw v}}),onError:v=>{throw v}}),this.setStatus({status:"ready"})}catch(f){if(c||f.name==="AbortError")return c=!0,this.setStatus({status:"ready"}),null;p=!0,f instanceof TypeError&&(f.message.toLowerCase().includes("fetch")||f.message.toLowerCase().includes("network"))&&(d=!0),this.onError&&f instanceof Error&&this.onError(f),this.setStatus({status:"error",error:f})}finally{try{(o=this.onFinish)==null||o.call(this,{message:this.activeResponse.state.message,messages:this.state.messages,isAbort:c,isDisconnect:d,isError:p,finishReason:(i=this.activeResponse)==null?void 0:i.state.finishReason})}catch(f){console.error(f)}this.activeResponse=void 0}!p&&await this.shouldSendAutomatically()&&await this.makeRequest({trigger:"submit-message",messageId:(r=this.lastMessage)==null?void 0:r.id,metadata:t,headers:s,body:n})}};function Ox({messages:e}){const t=e[e.length-1];if(!t||t.role!=="assistant")return!1;const s=t.parts.reduce((a,i,o)=>i.type==="step-start"?o:a,-1),n=t.parts.slice(s+1).filter(is).filter(a=>!a.providerExecuted);return n.filter(a=>a.state==="approval-responded").length>0&&n.every(a=>a.state==="output-available"||a.state==="output-error"||a.state==="approval-responded")}var Lx=class{constructor(e){this.statusRef=W("ready"),this.errorRef=W(void 0),this.pushMessage=t=>{this.messagesRef.value=[...this.messagesRef.value,t]},this.popMessage=()=>{this.messagesRef.value=this.messagesRef.value.slice(0,-1)},this.replaceMessage=(t,s)=>{this.messagesRef.value[t]={...s}},this.snapshot=t=>t,this.messagesRef=W(e??[])}get messages(){return this.messagesRef.value}set messages(e){this.messagesRef.value=e}get status(){return this.statusRef.value}set status(e){this.statusRef.value=e}get error(){return this.errorRef.value}set error(e){this.errorRef.value=e}},Bx=class extends Vx{constructor({messages:e,...t}){super({...t,state:new Lx(e)})}};const Nx=e=>{if(e)return typeof e=="function"?e():e};function jx(e){const t=Ko(),s=e??{},n=W(t.agentSelectedProvider),a=W(t.agentSelectedModel),i=P(()=>vs.find(_=>_.id===n.value)||vs[0]),o=P(()=>i.value.models),r=P(()=>t.agentApiKeyConfigs[n.value]||""),u=P(()=>!!r.value),l=new Bx({transport:new iu({api:s.api??"",body:()=>({...Nx(s.body),provider:n.value,model:a.value,apiKey:r.value})}),sendAutomaticallyWhen:s.sendAutomaticallyWhen}),c=P(()=>l.messages),d=P(()=>l.status!=="ready"&&l.status!=="error"),p=P(()=>{var _;return((_=l.error)==null?void 0:_.message)??null});return ge(n,_=>{var h,C;const v=(h=vs.find(m=>m.id===_))==null?void 0:h.models;v&&!v.some(m=>m.id===a.value)&&(a.value=((C=v[0])==null?void 0:C.id)||"")}),{selectedProvider:n,selectedModel:a,isLoading:d,error:p,messages:c,hasApiKey:u,currentProvider:i,currentApiKey:r,models:o,sendMessage:async _=>{!_.trim()||!u.value||d.value||await l.sendMessage({text:_})},clearChat:()=>{l.messages.splice(0,l.messages.length)},addToolApprovalResponse:l.addToolApprovalResponse,stopStream:l.stop,clearError:l.clearError,providers:vs}}function Fx(e,t){return t.length===0?e:`[Tool hints]
21
+ ${Dl(t).map(a=>`${a.label}: ${a.promptHint}`).join(`
22
+ `)}
23
+
24
+ ${e}`}function zx(e){const t=fc(),s=mc(),n=jx({api:"/api/ai/agent",body:()=>{var o,r;return{dbConnectionString:(o=s.selectedConnection)==null?void 0:o.connectionString,dbType:(r=s.selectedConnection)==null?void 0:r.type,schemaSnapshots:t.activeSchemas||[],sendReasoning:(e==null?void 0:e.value)??!0}},sendAutomaticallyWhen:Ox}),a=()=>{if(!hc(n.messages.value))return;const o=gc(n.messages.value);n.messages.value.splice(0,n.messages.value.length,...o)};return{...n,sendMessage:async(o,r=[])=>{a();const u=Fx(o,r);await n.sendMessage(u)}}}const Ie={GenerateQuery:"generate_query",RenderTable:"render_table",VisualizeTable:"visualize_table",ExplainQuery:"explain_query",DetectAnomaly:"detect_anomaly",DescribeTable:"describe_table",ExportQueryResult:"export_query_result",ExportContent:"export_content",ListSchemas:"list_schemas",GetTableSchema:"get_table_schema",RenderErd:"render_erd",AskClarification:"askClarification"},qx=[Ie.GenerateQuery,Ie.RenderTable,Ie.VisualizeTable,Ie.ExplainQuery,Ie.DetectAnomaly,Ie.DescribeTable,Ie.ExportQueryResult,Ie.ExportContent,Ie.ListSchemas,Ie.GetTableSchema,Ie.RenderErd],Ux=/^#{1,6}\s|(\*\*|__).+(\*\*|__)|^[-*]\s|^\d+\.\s|^\|.+\|/m,Hx=/```([\w-]*)\n?([\s\S]*?)```/g,Gx={generate_query:a0,render_table:p0,visualize_table:x0,explain_query:Hv,detect_anomaly:vv,describe_table:cn,export_query_result:co,export_content:co,list_schemas:cn,get_table_schema:cn,render_erd:Lv},Zx={generate_query:"Generating query...",render_table:"Running query...",visualize_table:"Building chart...",explain_query:"Analyzing query...",detect_anomaly:"Scanning data...",describe_table:"Reading schema...",export_query_result:"Fetching & exporting...",export_content:"Preparing export...",list_schemas:"Listing schemas...",get_table_schema:"Reading table schema...",render_erd:"Building ERD diagram..."},Wx=e=>qx.includes(e),Ro=(e,t)=>{const s=t.trim();s&&e.push({kind:Ux.test(s)?"markdown":"text",content:s})},Kx=(e,t=!1)=>{var a;const s=[];let n=0;for(const i of e.matchAll(Hx)){const o=i.index??0;Ro(s,e.slice(n,o));const r=i[1]||"text",u=((a=i[2])==null?void 0:a.trimEnd())||"";r==="mermaid"?s.push({kind:"mermaid",code:u}):s.push({kind:"code",language:r,code:u}),n=o+i[0].length}if(Ro(s,e.slice(n)),t)for(let i=s.length-1;i>=0;i-=1){const o=s[i];if((o==null?void 0:o.kind)==="text"||(o==null?void 0:o.kind)==="markdown"||(o==null?void 0:o.kind)==="code"){o.isStreaming=!0;break}}return s},ou=e=>e.errorText||e.message||e.error||"Something went wrong.",Yx=e=>{var s,n,a;const t=String(e.type||"").replace(/^tool-/,"");return t===Ie.AskClarification?e.state==="output-available"?[{kind:"quiz",toolCallId:String(e.toolCallId||""),context:String(((s=e.input)==null?void 0:s.context)||""),questions:Array.isArray((n=e.input)==null?void 0:n.questions)?e.input.questions:[]}]:[]:Wx(t)?e.state==="input-streaming"||e.state==="input-available"?[{kind:"loading",toolName:t,toolCallId:e.toolCallId,label:Zx[t]}]:e.state==="approval-requested"?[{kind:"approval",toolName:t,toolCallId:e.toolCallId,input:e.input,approvalId:((a=e.approval)==null?void 0:a.id)||e.toolCallId}]:e.state==="output-available"?[{kind:"tool",toolName:t,toolCallId:e.toolCallId,result:e.output}]:e.state==="output-error"?[{kind:"error",message:ou(e)}]:e.state==="output-denied"?[{kind:"error",message:"Execution was denied. No database changes were made."}]:[]:[]},Xx=e=>{if(e.type==="text")return Kx(typeof e.text=="string"?e.text:"",e.state==="streaming");if(e.type==="reasoning"){const t=typeof e.text=="string"?e.text.trim():"";return t?[{kind:"reasoning",content:t,isStreaming:e.state==="streaming"}]:[]}return e.type==="source-url"?[{kind:"source",sourceId:e.sourceId||"",url:e.url,title:e.title}]:e.type==="source-document"?[{kind:"source",sourceId:e.sourceId||"",title:e.title,mediaType:e.mediaType,filename:e.filename}]:typeof e.type=="string"&&e.type.startsWith("tool-")?Yx(e):e.type==="error"?[{kind:"error",message:ou(e)}]:[]};function Jx(e){const t=P(()=>{const i=e.value??[],o=[];for(let r=0;r<i.length;r++){const u=i[r];if(u.role==="system")continue;const l=u.parts??[],c=[];for(let p=0;p<l.length;p++){const f=Xx(l[p]);f!=null&&f.length&&c.push(...f)}if(c.length===0)continue;const d=[];for(const p of c){const f=d[d.length-1];if(p.kind==="reasoning"&&(f==null?void 0:f.kind)==="reasoning"){const y=[f.content,p.content].filter(Boolean).join(`
25
+
26
+ `);d[d.length-1]={kind:"reasoning",content:y,isStreaming:f.isStreaming||p.isStreaming}}else d.push(p)}o.push({id:u.id,role:u.role,blocks:d})}return o}),s=P(()=>t.value.some(i=>i.blocks.some(o=>o.kind==="approval"))),n=i=>Gx[i]||null,a=P(()=>{const i=t.value[t.value.length-1];if(!i)return null;const o=i.blocks[i.blocks.length-1];return o?o.kind:null});return{renderedMessages:t,hasMutationPending:s,getComponent:n,getLastPartKindMessage:a}}const Qx=["motion-key","initial"],Do="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()_+-=[]{}|;:,.<>?/~アイウエオカキクケコサシスセソタチツテトナニヌネノ░▒▓█▌▐▄▀■□▪▫▲△▼▽◆◇○●◎∞≈≠≤≥±÷×√∑πΩµ",e_=Y({__name:"ScrambleText",props:{texts:{},duration:{default:800},speed:{default:55},loop:{type:Boolean,default:!0},loopDelay:{default:600}},setup(e){const t=e,s=W([]);let n=0,a=0,i=0,o=0,r="scramble",u=0,l=[];function c(){return Do[Math.random()*Do.length|0]}function d(){return Math.random()>.5?1:-1}function p(){l=[...t.texts[o]],s.value=l.map(()=>({char:"",reveal:!1,dir:d(),v:0}))}function f(y){const _=l.length,v=_/2|0;a||(a=y);const h=y-a;if(r==="scramble"){if(y-i>t.speed){for(let C=0;C<_;C++)s.value[C].reveal||(s.value[C].char=c(),s.value[C].v++);i=y}h>t.duration&&(r="reveal",u=y)}if(r==="reveal"){const C=y-u;for(let m=0;m<_;m++){const D=Math.abs(m-v)*40;C>D&&!s.value[m].reveal&&(s.value[m].char=l[m],s.value[m].reveal=!0,s.value[m].v++)}C>v*40+200&&(r="wait",a=y)}r==="wait"&&y-a>t.loopDelay&&(o=(o+1)%t.texts.length,p(),r="scramble",a=y),n=requestAnimationFrame(f)}return Os(()=>{p(),n=requestAnimationFrame(f)}),Fo(()=>{cancelAnimationFrame(n)}),(y,_)=>{const v=vc("motion");return x(),A("span",wt({class:"inline-flex select-none"},y.$attrs),[(x(!0),A(le,null,Se(s.value,(h,C)=>yc((x(),A("span",{key:C,"motion-key":h.v,initial:{opacity:0,y:h.dir*16,scale:.9},animate:{opacity:1,y:0,scale:1},transition:{type:"spring",stiffness:260,damping:20},class:"inline-block will-change-transform transform-gpu"},[B(I(h.char),1)],8,Qx)),[[v]])),128))],16)}}}),t_={class:"relative h-full w-full bg-[radial-gradient(circle_at_top,_hsl(var(--primary)/0.12),transparent_40%),linear-gradient(180deg,hsl(var(--background)),hsl(var(--background)))]"},s_={class:"absolute inset-0 flex flex-col overflow-hidden"},n_={class:"mx-auto shadow-xs flex w-full flex-col gap-4 px-3 py-2 lg:flex-row lg:items-center lg:justify-between bg-background/50 backdrop-blur-sm"},a_={class:"flex flex-1 items-center gap-2 min-w-0 text-sm leading-4 font-medium text-foreground"},i_={key:0,class:"flex-1 max-w-md"},o_={class:"truncate text-foreground"},r_={class:"flex shrink-0 items-center gap-2"},l_={class:"mx-auto flex min-h-full w-full max-w-5xl flex-col px-6 py-8"},u_={key:2,class:"w-full pb-6"},c_={class:"space-y-4"},d_={key:0,class:"flex gap-1 items-center mt-2"},p_={class:"font-medium text-muted-foreground chat-text"},f_={key:1,class:"mt-4 overflow-hidden rounded-2xl border border-destructive/15 bg-destructive/5 backdrop-blur-sm"},m_={class:"flex items-start gap-3 px-4 py-3"},h_={class:"mt-0.5 flex size-6 shrink-0 items-center justify-center rounded-full bg-destructive/10"},g_={class:"min-w-0 flex-1"},y_={class:"mt-0.5 text-sm leading-relaxed text-destructive"},G_=Y({__name:"AgentWorkspace",setup(e){const t=W(null);jo("activeExportPreview",t);const{activeHistory:s,histories:n,showAttachmentPanel:a,showReasoning:i,saveConversation:o,startNewChat:r,renameHistory:u}=bc(),l=W(!1),c=W(""),d=W(null),p=()=>{s.value&&(c.value=s.value.title,l.value=!0,Fe(()=>{var V,O;(V=d.value)==null||V.focus(),(O=d.value)==null||O.select()}))},f=()=>{if(!s.value||!l.value)return;const V=c.value.trim();V&&V!==s.value.title&&u(s.value.id,V),l.value=!1},y=()=>{l.value=!1},_=Ko(),v=P(()=>_.chatUiConfigs.thinkingStyle),{selectedProvider:h,selectedModel:C,isLoading:m,error:D,messages:R,hasApiKey:M,currentProvider:S,sendMessage:k,addToolApprovalResponse:Z,stopStream:N}=zx(i),{renderedMessages:U,getComponent:z,getLastPartKindMessage:he}=Jx(R),E=W(""),j=W([]),G=W(null),ae=W(null),ce=W(!1),J=W(null),Te=V=>JSON.parse(JSON.stringify(V)),Ve=W(!1),Ge=W(null),Ke=W(0),Ae=W({});let Nt=null;ge(a,V=>{V&&(t.value=null)},{immediate:!0}),ge(t,V=>{V&&(a.value=!1)});const St=P(()=>U.value.flatMap(V=>{if(V.role!=="assistant")return[];const O=(V.blocks??[]).map(se=>se.kind==="text"||se.kind==="markdown"||se.kind==="reasoning"?se.content:"").filter(Boolean).join(" ").trim().replace(/\s+/g," ");return[{id:V.id,type:"message",element:Ae.value[V.id]??null,preview:O.length>80?O.slice(0,80)+"...":O||"Thinking..."}]})),ru=(V,O)=>{if(O instanceof HTMLElement){Ae.value[V]=O;return}delete Ae.value[V]},qs=()=>{if(!G.value||St.value.length===0){Ke.value=0;return}const{scrollTop:V,scrollHeight:O,clientHeight:se}=G.value;if(O-V-se<50){Ke.value=St.value.length-1;return}const jt=G.value.getBoundingClientRect().top;let at=0;St.value.forEach((Ft,ms)=>{var hs;(((hs=Ft.element)==null?void 0:hs.getBoundingClientRect().top)??1/0)-jt<=150&&(at=ms)}),Ke.value=at},lu=()=>{if(!G.value)return;const{scrollTop:V,scrollHeight:O,clientHeight:se}=G.value;Ve.value=O-V-se>150,qs()},nt=(V=!1)=>{G.value&&(G.value.scrollTo({top:G.value.scrollHeight,behavior:V===!0?"smooth":"auto"}),Ve.value=!1)};Os(()=>{setTimeout(()=>{nt()},100)});const Us=V=>{R.value.splice(0,R.value.length,...V)},Hs=async V=>{if(V==null||V.preventDefault(),!E.value.trim()||m.value)return;const O=E.value.trim(),se=[...j.value];E.value="",j.value=[],k(O,se),await Fe(),nt()},uu=V=>{V.key==="Enter"&&!V.shiftKey&&(V.preventDefault(),Hs(V))},cu=async V=>{E.value=V,await Fe(),await Hs()},du=()=>{N()},pu=()=>{r(),j.value=[],Us([])},fu=async(V,O)=>{await Z({id:V,approved:O})},mu=async V=>{var O;E.value=V,await Fe(),(O=ae.value)==null||O.focusInput()},hu=V=>{const O=St.value[V];if(!(O!=null&&O.element)||(Ke.value=V,Ge.value=O.id,Nt&&clearTimeout(Nt),Nt=setTimeout(()=>{Ge.value=null},250),!G.value))return;const se=G.value,jt=O.element.getBoundingClientRect().top,at=se.getBoundingClientRect().top,Ft=se.scrollTop;se.scrollTo({top:Ft+(jt-at)-24,behavior:"smooth"})},gu=wc(()=>{ce.value||R.value.length===0||o({messages:Te(R.value),provider:h.value,model:C.value,showReasoning:i.value})},250);ge(()=>{var V;return((V=s.value)==null?void 0:V.id)??null},async V=>{V!==J.value&&(ce.value=!0,J.value=V,V&&s.value?(Us(Te(s.value.messages)),s.value.provider&&(h.value=s.value.provider),s.value.model&&(C.value=s.value.model),typeof s.value.showReasoning=="boolean"&&(i.value=s.value.showReasoning)):R.value.length>0&&Us([]),await Fe(),nt(),ce.value=!1)},{immediate:!0}),ge(()=>R.value.length,async()=>{await Fe(),nt(),qs()}),ge(()=>{const V=R.value.at(-1);return V!=null&&V.parts?V.parts.map(O=>O.type==="text"||O.type==="reasoning"?O.text||"":JSON.stringify(O)).join(""):""},async()=>{await Fe(),nt(),qs()}),ge(()=>U.value.flatMap(V=>V.role!=="assistant"?[]:[V.id]),V=>{const O={};for(const se of V)Ae.value[se]&&(O[se]=Ae.value[se]);Ae.value=O}),ea(()=>{Nt&&clearTimeout(Nt)}),ge(()=>[R.value,C.value,h.value,i.value],()=>{!R.value.length||ce.value||gu()},{deep:!0});const yu=P(()=>{const V=R.value[0];if(!V||!V.parts||!V.parts.length)return"New Chat";const O=V.parts[0];return typeof O=="object"&&"text"in O?O.text:"New Chat"}),vu=async V=>{await k(V),await Fe(),nt()},bu=P(()=>["Summarize the current schema and highlight the tables that matter most.","Suggest safe next steps for debugging a slow database query.","Write a query plan for the report I need before generating SQL."].filter(V=>!!V)),xu=P(()=>U.value),{attachments:_u}=Rl(xu),Oa=P(()=>_u.value.length);return(V,O)=>{const se=pe,jt=xc,at=ye,Ft=Ia,ms=Sc,La=Tc,hs=kc;return x(),A("section",t_,[b(hs,{direction:"horizontal",class:"h-full w-full"},{default:T(()=>[b(ms,{"default-size":t.value||g(a)?60:100,class:"h-full relative"},{default:T(()=>{var gs;return[w("div",s_,[w("div",n_,[w("div",a_,[b(se,{name:"hugeicons:chatting-01",class:"size-4! shrink-0"}),l.value?(x(),A("div",i_,[b(jt,{ref_key:"titleInputRef",ref:d,modelValue:c.value,"onUpdate:modelValue":O[0]||(O[0]=fe=>c.value=fe),class:"h-7 text-xs py-0",onKeydown:[mn(f,["enter"]),mn(y,["escape"])],onBlur:f},null,8,["modelValue"])])):(x(),A("div",{key:1,class:"flex items-center gap-2 truncate group cursor-pointer",onClick:p},[w("span",o_,I(((gs=g(s))==null?void 0:gs.title)||yu.value),1),b(se,{name:"hugeicons:edit-02",class:"size-3 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity"})]))]),w("div",r_,[b(at,{size:"xs",variant:"ghost",onClick:O[1]||(O[1]=fe=>a.value=!g(a)),class:"relative"},{default:T(()=>[O[10]||(O[10]=B(" Attachment ")),b(se,{name:"hugeicons:attachment",class:"size-3"}),Oa.value>0?(x(),F(g(Ce),{key:0,variant:"secondary",class:"absolute -top-1 -right-1 h-4 min-w-4 px-1 text-xxs font-normal"},{default:T(()=>[B(I(Oa.value),1)]),_:1})):q("",!0)]),_:1}),b(at,{size:"xs",variant:"outline",onClick:pu},{default:T(()=>[O[11]||(O[11]=B(" New Thread ")),b(se,{name:"hugeicons:plus-sign",class:"size-3"})]),_:1})])]),w("div",{ref_key:"messagesContainer",ref:G,class:"flex-1 overflow-y-auto min-h-0",onScroll:lu},[w("div",l_,[g(M)?g(U).length===0?(x(),F(R0,{key:1,"prompt-cards":bu.value,"thread-count":g(n).length,onPrompt:cu},null,8,["prompt-cards","thread-count"])):(x(),A("div",u_,[w("div",c_,[(x(!0),A(le,null,Se(g(U),fe=>{var Ba;return x(),A("div",{key:fe.id},[b(S0,{message:fe,"get-tool-component":g(z),"show-reasoning":g(i),"highlighted-response-id":Ge.value,"register-message-element":ru,"is-streaming":g(m)&&fe.role==="assistant"&&fe.id===((Ba=g(U).at(-1))==null?void 0:Ba.id),onApproval:fu,onEdit:mu,onQuizSubmit:vu},null,8,["message","get-tool-component","show-reasoning","highlighted-response-id","is-streaming"])])}),128))]),g(m)?(x(),A("div",d_,[b(se,{class:"size-7! text-primary",name:"icons:logo-8-bits"}),w("div",p_,[v.value===g(_c).Shimmer?(x(),F(Ft,{key:0},{default:T(()=>O[12]||(O[12]=[B(" Thinking... ")])),_:1})):(x(),F(g(e_),{key:1,texts:["Thinking...","Orca_Thinking",g(he)||""]},null,8,["texts"]))])])):q("",!0),g(D)?(x(),A("div",f_,[w("div",m_,[w("div",h_,[b(se,{name:"lucide:alert-triangle",class:"size-3.5 text-destructive/90"})]),w("div",g_,[O[13]||(O[13]=w("p",{class:"text-[11px] font-semibold uppercase tracking-wider text-destructive/70"}," Error ",-1)),w("p",y_,I(g(D)),1)])])])):q("",!0)])):(x(),F(A0,{key:0,class:"my-auto","current-provider":g(S)},null,8,["current-provider"]))])],544),St.value.length>0?(x(),F(j0,{key:0,responses:St.value,"current-index":Ke.value,onNavigate:hu},null,8,["responses","current-index"])):q("",!0),b(lv,{ref_key:"footerRef",ref:ae,modelValue:E.value,"onUpdate:modelValue":O[2]||(O[2]=fe=>E.value=fe),provider:g(h),"onUpdate:provider":O[3]||(O[3]=fe=>qa(h)?h.value=fe:null),model:g(C),"onUpdate:model":O[4]||(O[4]=fe=>qa(C)?C.value=fe:null),"selected-command-options":j.value,"onUpdate:selectedCommandOptions":O[5]||(O[5]=fe=>j.value=fe),"is-loading":g(m),"has-api-key":g(M),"show-reasoning":g(i),"show-scroll-button":Ve.value,onSubmit:Hs,onStop:du,onKeydown:uu,"onUpdate:showReasoning":O[6]||(O[6]=fe=>i.value=fe),onScrollToBottom:O[7]||(O[7]=fe=>nt(!0))},null,8,["modelValue","provider","model","selected-command-options","is-loading","has-api-key","show-reasoning","show-scroll-button"])])]}),_:1},8,["default-size"]),t.value||g(a)?(x(),A(le,{key:0},[b(La,{"with-handle":"",class:"[&[data-state=hover]]:bg-primary/30! [&[data-state=drag]]:bg-primary/20!"}),b(ms,{"min-size":20,"max-size":60,"default-size":30,class:"h-full relative"},{default:T(()=>[t.value?(x(),F(J0,{key:0,result:t.value,onClose:O[8]||(O[8]=gs=>t.value=null)},null,8,["result"])):g(a)?(x(),F(Oy,{key:1,messages:g(U),onClose:O[9]||(O[9]=gs=>a.value=!1)},null,8,["messages"])):q("",!0)]),_:1})],64)):q("",!0)]),_:1})])}}});export{G_ as default};