pulls.review 0.1.0 → 0.2.1

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 (185) hide show
  1. package/README.md +16 -0
  2. package/bin.mjs +2 -0
  3. package/dist/client/assets/ChatWidget-BsnoQ6oS.js +1 -0
  4. package/dist/client/assets/DisplayFileIcon-DzBo3Ez5.js +151 -0
  5. package/dist/client/assets/GithubAvatar-CSsUV5vf.js +1 -0
  6. package/dist/client/assets/LandingHero-BkTBSu71.js +1 -0
  7. package/dist/client/assets/_repo_-Dcgj3PGg.js +22 -0
  8. package/dist/client/assets/analyze-509KQQBC.js +1 -0
  9. package/dist/client/assets/andromeeda-vGVdxbeo.js +1 -0
  10. package/dist/client/assets/anthropic-messages-Cd2DkgOC.js +41 -0
  11. package/dist/client/assets/aurora-x-CDeNXAV0.js +1 -0
  12. package/dist/client/assets/ayu-dark-DluEY0Gj.js +1 -0
  13. package/dist/client/assets/ayu-light-C3h-C4tm.js +1 -0
  14. package/dist/client/assets/ayu-mirage-Bqwy1Gya.js +1 -0
  15. package/dist/client/assets/browser-agent-rpc-BXhoSh1z-DrxWeI3_.js +1 -0
  16. package/dist/client/assets/c-BNQJhXlP.js +1 -0
  17. package/dist/client/assets/catppuccin-frappe-C9Q5zVZY.js +1 -0
  18. package/dist/client/assets/catppuccin-latte-CtsyrtPq.js +1 -0
  19. package/dist/client/assets/catppuccin-macchiato-R8nAf1vR.js +1 -0
  20. package/dist/client/assets/catppuccin-mocha-DjuaAJKi.js +1 -0
  21. package/dist/client/assets/clojure-DqKBuwfJ.js +1 -0
  22. package/dist/client/assets/cpp-7GgD5o7L.js +1 -0
  23. package/dist/client/assets/csharp-oqKa8noW.js +1 -0
  24. package/dist/client/assets/css-DlBQoFxe.js +1 -0
  25. package/dist/client/assets/dark-plus-Cs2F2srj.js +1 -0
  26. package/dist/client/assets/de-Bq9RfdAn.js +1 -0
  27. package/dist/client/assets/diff-BKQFn0my.js +37 -0
  28. package/dist/client/assets/diff-Bx6SazPw.js +1 -0
  29. package/dist/client/assets/diff-woXpYk--.js +1 -0
  30. package/dist/client/assets/diffs-store-ncE62OUU.js +1510 -0
  31. package/dist/client/assets/dist-Dh0a8u-Y.js +1 -0
  32. package/dist/client/assets/docker-IyjqRm3v.js +1 -0
  33. package/dist/client/assets/dracula-BHWKrbxM.js +1 -0
  34. package/dist/client/assets/dracula-soft-5eyTD99u.js +1 -0
  35. package/dist/client/assets/elixir-D3n0XgqJ.js +1 -0
  36. package/dist/client/assets/en-8hQdak1X.js +1 -0
  37. package/dist/client/assets/error-CJ3RHG07.js +1 -0
  38. package/dist/client/assets/es-QcvEBShr.js +1 -0
  39. package/dist/client/assets/everforest-dark-sB-x3p7T.js +1 -0
  40. package/dist/client/assets/everforest-light-Df2xbC6M.js +1 -0
  41. package/dist/client/assets/fr-DAWKVvDP.js +1 -0
  42. package/dist/client/assets/github-dark-C-LZuMrd.js +1 -0
  43. package/dist/client/assets/github-dark-default-DXG-b-1a.js +1 -0
  44. package/dist/client/assets/github-dark-dimmed-Bx1FflLF.js +1 -0
  45. package/dist/client/assets/github-dark-high-contrast-B_tTalzw.js +1 -0
  46. package/dist/client/assets/github-light-EUqPIrTm.js +1 -0
  47. package/dist/client/assets/github-light-default-BXViO-2h.js +1 -0
  48. package/dist/client/assets/github-light-high-contrast-B68TUdTA.js +1 -0
  49. package/dist/client/assets/go-rLFTqkRN.js +1 -0
  50. package/dist/client/assets/graphql-ki1Ij_uk.js +1 -0
  51. package/dist/client/assets/groovy-CacY0gHj.js +1 -0
  52. package/dist/client/assets/gruvbox-dark-hard-C820rvS2.js +1 -0
  53. package/dist/client/assets/gruvbox-dark-medium-BPjhmG05.js +1 -0
  54. package/dist/client/assets/gruvbox-dark-soft-MrdJrrXF.js +1 -0
  55. package/dist/client/assets/gruvbox-light-hard-BC_s9l72.js +1 -0
  56. package/dist/client/assets/gruvbox-light-medium-BAWPOn9u.js +1 -0
  57. package/dist/client/assets/gruvbox-light-soft-BSMLrYjP.js +1 -0
  58. package/dist/client/assets/haskell-D8IpX4py.js +1 -0
  59. package/dist/client/assets/horizon-CE9ld1lL.js +1 -0
  60. package/dist/client/assets/horizon-bright-DSNQnXHK.js +1 -0
  61. package/dist/client/assets/houston-CsvMBhTu.js +1 -0
  62. package/dist/client/assets/html-BC8aFsRK.js +1 -0
  63. package/dist/client/assets/i18n-CGV_MDS8.js +2 -0
  64. package/dist/client/assets/id-NIGs9Xhn.js +1 -0
  65. package/dist/client/assets/index-BCCy9wJJ.js +2 -0
  66. package/dist/client/assets/index-BDPZiDIt.css +1 -0
  67. package/dist/client/assets/ini-B5eOa1yu.js +1 -0
  68. package/dist/client/assets/install-B-q5w2uE.js +4 -0
  69. package/dist/client/assets/it-DjRuurmk.js +1 -0
  70. package/dist/client/assets/ja-BAKkDsQ5.js +1 -0
  71. package/dist/client/assets/java-D7h0NA_A.js +1 -0
  72. package/dist/client/assets/javascript-DcMHgNcu.js +1 -0
  73. package/dist/client/assets/json-qhed-kSA.js +1 -0
  74. package/dist/client/assets/jsonc-CYpm1nAK.js +1 -0
  75. package/dist/client/assets/jsx-BUUYi3qs.js +1 -0
  76. package/dist/client/assets/kanagawa-dragon-Bozd7klA.js +1 -0
  77. package/dist/client/assets/kanagawa-lotus-BmuOG9ZW.js +1 -0
  78. package/dist/client/assets/kanagawa-wave-BML5mF2J.js +1 -0
  79. package/dist/client/assets/ko-DHculY2W.js +1 -0
  80. package/dist/client/assets/kotlin-DhhofPvG.js +1 -0
  81. package/dist/client/assets/laserwave-C_8bwKvT.js +1 -0
  82. package/dist/client/assets/less-DVTAwKKz.js +1 -0
  83. package/dist/client/assets/light-plus-DVQuIRkW.js +1 -0
  84. package/dist/client/assets/llm-DYDmh8Ki.js +2 -0
  85. package/dist/client/assets/llm-store-CVM33nlB.js +2 -0
  86. package/dist/client/assets/locales-SpkpwNqX.js +1 -0
  87. package/dist/client/assets/lua-DCW0Dwo5.js +1 -0
  88. package/dist/client/assets/make-Dixweg8N.js +1 -0
  89. package/dist/client/assets/markdown-BYOwaDjH.js +1 -0
  90. package/dist/client/assets/material-theme-Bm3Qr25_.js +1 -0
  91. package/dist/client/assets/material-theme-darker-2IIEA8gg.js +1 -0
  92. package/dist/client/assets/material-theme-lighter-uhdI0v04.js +1 -0
  93. package/dist/client/assets/material-theme-ocean-CHQ94UKr.js +1 -0
  94. package/dist/client/assets/material-theme-palenight-B5W6OYN7.js +1 -0
  95. package/dist/client/assets/mdx-DQZ5AkYe.js +1 -0
  96. package/dist/client/assets/min-dark-BSWPekZh.js +1 -0
  97. package/dist/client/assets/min-light-DDpmG2fV.js +1 -0
  98. package/dist/client/assets/monokai-B_bV9PQ9.js +1 -0
  99. package/dist/client/assets/nginx-C4fSytnP.js +1 -0
  100. package/dist/client/assets/night-owl-DhmEMT88.js +1 -0
  101. package/dist/client/assets/night-owl-light-eJ-hLW7d.js +1 -0
  102. package/dist/client/assets/node.browser-BX-QLlU2.js +1 -0
  103. package/dist/client/assets/node.browser-DFtqp6Hr.js +1 -0
  104. package/dist/client/assets/nord-Cb4Vim4T.js +1 -0
  105. package/dist/client/assets/objective-c-D1A_Heim.js +1 -0
  106. package/dist/client/assets/objective-cpp-BsSzOQcm.js +1 -0
  107. package/dist/client/assets/one-dark-pro-CLwyXe_n.js +1 -0
  108. package/dist/client/assets/one-light-D7Lr4KcI.js +1 -0
  109. package/dist/client/assets/openai-completions-CSvY9IVo.js +21 -0
  110. package/dist/client/assets/pages-B5mEqsbn.js +1 -0
  111. package/dist/client/assets/pages-local-x_ACBinc.js +1 -0
  112. package/dist/client/assets/pages-web-DitAPN6U.js +21 -0
  113. package/dist/client/assets/patch-parser-k3Vbbmi0.js +5 -0
  114. package/dist/client/assets/perl-C8GHouAq.js +1 -0
  115. package/dist/client/assets/php-BahmaYs0.js +1 -0
  116. package/dist/client/assets/pierre-dark-CpLgRqie.js +1 -0
  117. package/dist/client/assets/pierre-dark-protanopia-deuteranopia-B35FxJx-.js +1 -0
  118. package/dist/client/assets/pierre-dark-soft-kZQmAZld.js +1 -0
  119. package/dist/client/assets/pierre-dark-tritanopia-CpjhbsIL.js +1 -0
  120. package/dist/client/assets/pierre-dark-vibrant-CpQYzh95.js +1 -0
  121. package/dist/client/assets/pierre-light-CoaEpmwp.js +1 -0
  122. package/dist/client/assets/pierre-light-protanopia-deuteranopia-0fSaH845.js +1 -0
  123. package/dist/client/assets/pierre-light-soft-lWLdNTOI.js +1 -0
  124. package/dist/client/assets/pierre-light-tritanopia-CEbqgOJL.js +1 -0
  125. package/dist/client/assets/pierre-light-vibrant-D80Fkn33.js +1 -0
  126. package/dist/client/assets/plastic-DQwYfKfQ.js +1 -0
  127. package/dist/client/assets/poimandres-DRFjx7u4.js +1 -0
  128. package/dist/client/assets/portalTarget-C60SzJiK.js +1 -0
  129. package/dist/client/assets/preload-helper-BaNbYf_w.js +1 -0
  130. package/dist/client/assets/proto-DB4EqR-F.js +1 -0
  131. package/dist/client/assets/pt-BR-LLtJ99P6.js +1 -0
  132. package/dist/client/assets/python-gzcpVVnB.js +1 -0
  133. package/dist/client/assets/r-C5FwQflr.js +1 -0
  134. package/dist/client/assets/red-DX1BQOs8.js +1 -0
  135. package/dist/client/assets/rolldown-runtime-Dd_uD5pT.js +1 -0
  136. package/dist/client/assets/rose-pine-aMsaMD1D.js +1 -0
  137. package/dist/client/assets/rose-pine-dawn-8PwUyIlP.js +1 -0
  138. package/dist/client/assets/rose-pine-moon-DO-qXg-I.js +1 -0
  139. package/dist/client/assets/ru-DvkrOLxc.js +1 -0
  140. package/dist/client/assets/ruby-CfFGiaYl.js +1 -0
  141. package/dist/client/assets/runtime-dom.esm-bundler-CqL7__VR.js +2 -0
  142. package/dist/client/assets/rust-Cfkwpbl8.js +1 -0
  143. package/dist/client/assets/scala-BiFt_7mu.js +1 -0
  144. package/dist/client/assets/scss-C-_0yqZd.js +1 -0
  145. package/dist/client/assets/shellscript-CLZ0U2zV.js +1 -0
  146. package/dist/client/assets/shiki-wasm-noop-Gxv9UHE7.js +1 -0
  147. package/dist/client/assets/slack-dark-DnToyrRv.js +1 -0
  148. package/dist/client/assets/slack-ochin-B2OO5cIa.js +1 -0
  149. package/dist/client/assets/snazzy-light-4G7pJPwS.js +1 -0
  150. package/dist/client/assets/solarized-dark-UdsmMDCL.js +1 -0
  151. package/dist/client/assets/solarized-light-C1IUL_tW.js +1 -0
  152. package/dist/client/assets/source-hSji-yvG.js +2 -0
  153. package/dist/client/assets/sql-BsFa4tDR.js +1 -0
  154. package/dist/client/assets/swift-CyEgAFGc.js +1 -0
  155. package/dist/client/assets/synthwave-84-nFMaYfgc.js +1 -0
  156. package/dist/client/assets/terraform-DswuEJGm.js +1 -0
  157. package/dist/client/assets/time-ago-Bdao9Hh1.js +1 -0
  158. package/dist/client/assets/tokyo-night-oM2G3aXe.js +1 -0
  159. package/dist/client/assets/toml-CcmNWLt0.js +1 -0
  160. package/dist/client/assets/transform-messages-C8U1xonk.js +3 -0
  161. package/dist/client/assets/tsx-DvWhG4dC.js +1 -0
  162. package/dist/client/assets/typescript-BTGs5etX.js +1 -0
  163. package/dist/client/assets/upload-GnI9kmJu.js +1 -0
  164. package/dist/client/assets/uploadSession-BUj4FNau.js +1 -0
  165. package/dist/client/assets/useDocumentTitle-nuqxXiNo.js +185 -0
  166. package/dist/client/assets/vesper-DdrHHSXu.js +1 -0
  167. package/dist/client/assets/vitesse-black-fwtXNY1n.js +1 -0
  168. package/dist/client/assets/vitesse-dark-BZCL-v6S.js +1 -0
  169. package/dist/client/assets/vitesse-light-VbXTXTou.js +1 -0
  170. package/dist/client/assets/vue-BbYmdtmv.js +1 -0
  171. package/dist/client/assets/vue-html-BXjKVtKk.js +1 -0
  172. package/dist/client/assets/vue-i18n-DVI_S4Q5.js +5 -0
  173. package/dist/client/assets/xml-BsprbK0m.js +1 -0
  174. package/dist/client/assets/yaml-rwi0_p6S.js +1 -0
  175. package/dist/client/assets/zh-CN-BIibd6kG.js +1 -0
  176. package/dist/client/assets/zh-TW-3FtUHjoZ.js +1 -0
  177. package/dist/client/favicon.svg +1 -0
  178. package/dist/client/index.html +44 -0
  179. package/dist/client/og-dark.png +0 -0
  180. package/dist/client/og.png +0 -0
  181. package/dist/client/robots.txt +2 -0
  182. package/dist/devframe-CX5butdC.mjs +493 -0
  183. package/dist/devframe.mjs +2 -0
  184. package/dist/index.mjs +59 -118
  185. package/package.json +17 -9
@@ -0,0 +1,185 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./anthropic-messages-Cd2DkgOC.js","./rolldown-runtime-Dd_uD5pT.js","./preload-helper-BaNbYf_w.js","./error-CJ3RHG07.js","./transform-messages-C8U1xonk.js","./openai-completions-CSvY9IVo.js"])))=>i.map(i=>d[i]);
2
+ import{i as e,n as t,t as n}from"./rolldown-runtime-Dd_uD5pT.js";import{$ as r,$n as i,$t as a,A as o,An as s,At as c,B as l,Bn as u,Bt as d,Cn as f,Ct as p,D as m,Dn as h,Dr as g,Dt as _,E as v,En as y,Er as b,Et as x,F as S,Fn as C,Ft as w,G as T,Gn as ee,Gt as E,H as D,Hn as te,Ht as ne,I as re,In as ie,It as ae,J as oe,Jn as se,Jt as ce,K as O,Kn as le,Kt as k,L as ue,Ln as A,Lt as j,M as de,Mn as fe,Mt as pe,N as me,Nn as he,Nt as ge,O as _e,On as ve,Ot as ye,P as M,Pn as be,Pt as xe,Q as N,Qn as Se,Qt as Ce,R as we,Rn as Te,Rt as Ee,Sn as De,Sr as Oe,St as ke,Tn as eee,Tr as Ae,Tt as je,U as Me,Un as Ne,Ut as tee,V as P,Vn as Pe,Vt as Fe,W as Ie,Wn as Le,Wt as Re,X as ze,Xn as Be,Xt as Ve,Y as He,Yn as Ue,Yt as We,Z as Ge,Zn as Ke,Zt as qe,_ as Je,_n as Ye,_t as Xe,an as Ze,at as Qe,bn as $e,bt as et,cn as tt,ct as nt,d as rt,dn as it,dt as at,en as nee,et as F,fn as ot,ft as st,g as ct,gn as lt,gt as ut,hn as dt,ht as ft,i as pt,in as mt,it as ht,j as gt,jn as _t,jt as vt,k as yt,kn as bt,kt as xt,ln as St,lt as Ct,mn as wt,mt as Tt,n as Et,nn as Dt,nr as Ot,nt as kt,o as At,on as jt,ot as Mt,pn as Nt,pt as Pt,q as Ft,qn as It,qt as Lt,r as Rt,rn as zt,rr as Bt,rt as Vt,s as Ht,sn as Ut,st as Wt,tn as Gt,tt as Kt,un as qt,ut as Jt,vn as I,vt as Yt,wn as Xt,wr as Zt,wt as Qt,x as $t,xn as en,xt as ree,yn as iee,yt as tn,z as aee,zn as oee,zt as L}from"./vue-i18n-DVI_S4Q5.js";import{C as nn,S as see,_ as cee,a as lee,b as uee,c as rn,d as an,f as on,g as sn,h as cn,i as ln,l as un,m as dn,n as fn,o as pn,p as mn,r as hn,s as gn,t as _n,u as vn,v as yn,w as bn,x as xn,y as Sn}from"./runtime-dom.esm-bundler-CqL7__VR.js";import{S as Cn,a as wn,b as Tn,c as En,h as Dn,n as On,o as kn,r as An,s as jn,u as Mn,x as Nn,y as Pn}from"./source-hSji-yvG.js";import{n as Fn,r as In}from"./i18n-CGV_MDS8.js";import{a as Ln,t as Rn}from"./locales-SpkpwNqX.js";import{t as R}from"./preload-helper-BaNbYf_w.js";import{n as zn,r as Bn,t as Vn}from"./dist-Dh0a8u-Y.js";var Hn=t({BaseTransition:()=>v,BaseTransitionPropsValidators:()=>m,Comment:()=>_e,DeprecationTypes:()=>null,EffectScope:()=>f,ErrorCodes:()=>yt,ErrorTypeStrings:()=>o,Fragment:()=>gt,KeepAlive:()=>de,ReactiveEffect:()=>Xt,Static:()=>me,Suspense:()=>M,Teleport:()=>S,Text:()=>re,TrackOpTypes:()=>eee,Transition:()=>_n,TransitionGroup:()=>fn,TriggerOpTypes:()=>y,VueElement:()=>hn,assertNumber:()=>ue,callWithAsyncErrorHandling:()=>we,callWithErrorHandling:()=>aee,camelize:()=>Ot,capitalize:()=>Bt,cloneVNode:()=>l,compatUtils:()=>null,compile:()=>Un,computed:()=>P,createApp:()=>ln,createBlock:()=>Me,createCommentVNode:()=>Ie,createElementBlock:()=>T,createElementVNode:()=>D,createHydrationRenderer:()=>O,createPropsRestProxy:()=>Ft,createRenderer:()=>oe,createSSRApp:()=>lee,createSlots:()=>He,createStaticVNode:()=>ze,createTextVNode:()=>Ge,createVNode:()=>N,customRef:()=>h,defineAsyncComponent:()=>r,defineComponent:()=>F,defineCustomElement:()=>pn,defineEmits:()=>Kt,defineExpose:()=>kt,defineModel:()=>Vt,defineOptions:()=>ht,defineProps:()=>Qe,defineSSRCustomElement:()=>gn,defineSlots:()=>Mt,devtools:()=>Wt,effect:()=>ve,effectScope:()=>bt,getCurrentInstance:()=>nt,getCurrentScope:()=>s,getCurrentWatcher:()=>_t,getTransitionRawChildren:()=>Ct,guardReactiveProps:()=>Jt,h:()=>at,handleError:()=>st,hasInjectionContext:()=>Pt,hydrate:()=>rn,hydrateOnIdle:()=>Tt,hydrateOnInteraction:()=>ft,hydrateOnMediaQuery:()=>ut,hydrateOnVisible:()=>Xe,initCustomFormatter:()=>Yt,initDirectivesForSSR:()=>un,inject:()=>tn,isMemoSame:()=>et,isProxy:()=>fe,isReactive:()=>he,isReadonly:()=>be,isRef:()=>C,isRuntimeOnly:()=>ree,isShallow:()=>ie,isVNode:()=>ke,markRaw:()=>A,mergeDefaults:()=>p,mergeModels:()=>Qt,mergeProps:()=>je,nextTick:()=>x,nodeOps:()=>vn,normalizeClass:()=>Oe,normalizeProps:()=>Zt,normalizeStyle:()=>Ae,onActivated:()=>_,onBeforeMount:()=>ye,onBeforeUnmount:()=>xt,onBeforeUpdate:()=>c,onDeactivated:()=>vt,onErrorCaptured:()=>pe,onMounted:()=>ge,onRenderTracked:()=>xe,onRenderTriggered:()=>w,onScopeDispose:()=>Te,onServerPrefetch:()=>ae,onUnmounted:()=>j,onUpdated:()=>Ee,onWatcherCleanup:()=>oee,openBlock:()=>L,patchProp:()=>an,popScopeId:()=>d,provide:()=>Fe,proxyRefs:()=>u,pushScopeId:()=>ne,queuePostFlushCb:()=>tee,reactive:()=>Pe,readonly:()=>te,ref:()=>Ne,registerRuntimeCompiler:()=>Re,render:()=>on,renderList:()=>E,renderSlot:()=>k,resolveComponent:()=>Lt,resolveDirective:()=>ce,resolveDynamicComponent:()=>We,resolveFilter:()=>null,resolveTransitionHooks:()=>Ve,setBlockTracking:()=>qe,setDevtoolsHook:()=>Ce,setTransitionHooks:()=>a,shallowReactive:()=>Le,shallowReadonly:()=>ee,shallowRef:()=>le,ssrContextKey:()=>nee,ssrUtils:()=>Gt,stop:()=>It,toDisplayString:()=>b,toHandlerKey:()=>g,toHandlers:()=>Dt,toRaw:()=>se,toRef:()=>Ue,toRefs:()=>Be,toValue:()=>Ke,transformVNodeArgs:()=>zt,triggerRef:()=>Se,unref:()=>i,useAttrs:()=>mt,useCssModule:()=>mn,useCssVars:()=>dn,useHost:()=>cn,useId:()=>Ze,useModel:()=>jt,useSSRContext:()=>Ut,useShadowRoot:()=>sn,useSlots:()=>tt,useTemplateRef:()=>St,useTransitionState:()=>qt,vModelCheckbox:()=>cee,vModelDynamic:()=>yn,vModelRadio:()=>Sn,vModelSelect:()=>uee,vModelText:()=>xn,vShow:()=>see,version:()=>it,warn:()=>ot,watch:()=>Nt,watchEffect:()=>wt,watchPostEffect:()=>dt,watchSyncEffect:()=>lt,withAsyncContext:()=>Ye,withCtx:()=>I,withDefaults:()=>iee,withDirectives:()=>$e,withKeys:()=>nn,withMemo:()=>en,withModifiers:()=>bn,withScopeId:()=>De}),Un=()=>{},Wn=n(((e,t)=>{var n=`\\\\/`,r=`[^${n}]`,i=0,a=`\\.`,o=`\\+`,s=`\\?`,c=`\\/`,l=`(?=.)`,u=`[^/]`,d=`(?:${c}|$)`,f=`(?:^|${c})`,p=`${a}{1,2}${d}`,m={DOT_LITERAL:a,PLUS_LITERAL:o,QMARK_LITERAL:s,SLASH_LITERAL:c,ONE_CHAR:l,QMARK:u,END_ANCHOR:d,DOTS_SLASH:p,NO_DOT:`(?!${a})`,NO_DOTS:`(?!${f}${p})`,NO_DOT_SLASH:`(?!${a}{0,1}${d})`,NO_DOTS_SLASH:`(?!${p})`,QMARK_NO_DOT:`[^.${c}]`,STAR:`${u}*?`,START_ANCHOR:f,SEP:`/`},h={...m,SLASH_LITERAL:`[${n}]`,QMARK:r,STAR:`${r}*?`,DOTS_SLASH:`${a}{1,2}(?:[${n}]|$)`,NO_DOT:`(?!${a})`,NO_DOTS:`(?!(?:^|[${n}])${a}{1,2}(?:[${n}]|$))`,NO_DOT_SLASH:`(?!${a}{0,1}(?:[${n}]|$))`,NO_DOTS_SLASH:`(?!${a}{1,2}(?:[${n}]|$))`,QMARK_NO_DOT:`[^.${n}]`,START_ANCHOR:`(?:^|[${n}])`,END_ANCHOR:`(?:[${n}]|$)`,SEP:`\\`};t.exports={DEFAULT_MAX_EXTGLOB_RECURSION:i,MAX_LENGTH:65536,POSIX_REGEX_SOURCE:{__proto__:null,alnum:`a-zA-Z0-9`,alpha:`a-zA-Z`,ascii:`\\x00-\\x7F`,blank:` \\t`,cntrl:`\\x00-\\x1F\\x7F`,digit:`0-9`,graph:`\\x21-\\x7E`,lower:`a-z`,print:`\\x20-\\x7E `,punct:`\\-!"#$%&'()\\*+,./:;<=>?@[\\]^_\`{|}~`,space:` \\t\\r\\n\\v\\f`,upper:`A-Z`,word:`A-Za-z0-9_`,xdigit:`A-Fa-f0-9`},REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{__proto__:null,"***":`*`,"**/**":`**`,"**/**/**":`**`},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,extglobChars(e){return{"!":{type:`negate`,open:`(?:(?!(?:`,close:`))${e.STAR})`},"?":{type:`qmark`,open:`(?:`,close:`)?`},"+":{type:`plus`,open:`(?:`,close:`)+`},"*":{type:`star`,open:`(?:`,close:`)*`},"@":{type:`at`,open:`(?:`,close:`)`}}},globChars(e){return e===!0?h:m}}})),Gn=n((e=>{var{REGEX_BACKSLASH:t,REGEX_REMOVE_BACKSLASH:n,REGEX_SPECIAL_CHARS:r,REGEX_SPECIAL_CHARS_GLOBAL:i}=Wn();e.isObject=e=>typeof e==`object`&&!!e&&!Array.isArray(e),e.hasRegexChars=e=>r.test(e),e.isRegexChar=t=>t.length===1&&e.hasRegexChars(t),e.escapeRegex=e=>e.replace(i,`\\$1`),e.toPosixSlashes=e=>e.replace(t,`/`),e.isWindows=()=>{if(typeof navigator<`u`&&navigator.platform){let e=navigator.platform.toLowerCase();return e===`win32`||e===`windows`}return typeof process<`u`&&process.platform?process.platform===`win32`:!1},e.removeBackslashes=e=>e.replace(n,e=>e===`\\`?``:e),e.escapeLast=(t,n,r)=>{let i=t.lastIndexOf(n,r);return i===-1?t:t[i-1]===`\\`?e.escapeLast(t,n,i-1):`${t.slice(0,i)}\\${t.slice(i)}`},e.removePrefix=(e,t={})=>{let n=e;return n.startsWith(`./`)&&(n=n.slice(2),t.prefix=`./`),n},e.wrapOutput=(e,t={},n={})=>{let r=`${n.contains?``:`^`}(?:${e})${n.contains?``:`$`}`;return t.negated===!0&&(r=`(?:^(?!${r}).*$)`),r},e.basename=(e,{windows:t}={})=>{let n=e.split(t?/[\\/]/:`/`),r=n[n.length-1];return r===``?n[n.length-2]:r}})),Kn=n(((e,t)=>{var n=Gn(),{CHAR_ASTERISK:r,CHAR_AT:i,CHAR_BACKWARD_SLASH:a,CHAR_COMMA:o,CHAR_DOT:s,CHAR_EXCLAMATION_MARK:c,CHAR_FORWARD_SLASH:l,CHAR_LEFT_CURLY_BRACE:u,CHAR_LEFT_PARENTHESES:d,CHAR_LEFT_SQUARE_BRACKET:f,CHAR_PLUS:p,CHAR_QUESTION_MARK:m,CHAR_RIGHT_CURLY_BRACE:h,CHAR_RIGHT_PARENTHESES:g,CHAR_RIGHT_SQUARE_BRACKET:_}=Wn(),v=e=>e===l||e===a,y=e=>{e.isPrefix!==!0&&(e.depth=e.isGlobstar?1/0:1)};t.exports=(e,t)=>{let b=t||{},x=e.length-1,S=b.parts===!0||b.tokens===!0||b.scanToEnd===!0,C=[],w=[],T=[],ee=e,E=-1,D=0,te=0,ne=!1,re=!1,ie=!1,ae=!1,oe=!1,se=!1,ce=!1,O=!1,le=!1,k=!1,ue=0,A,j,de={value:``,depth:0,isGlob:!1},fe=()=>E>=x,pe=()=>ee.charCodeAt(E+1),me=()=>(A=j,ee.charCodeAt(++E));for(;E<x;){j=me();let e;if(j===a){ce=de.backslashes=!0,j=me(),j===u&&(se=!0);continue}if(se===!0||j===u){for(ue++;fe()!==!0&&(j=me());){if(j===a){ce=de.backslashes=!0,me();continue}if(j===u){ue++;continue}if(se!==!0&&j===s&&(j=me())===s){if(ne=de.isBrace=!0,ie=de.isGlob=!0,k=!0,S===!0)continue;break}if(se!==!0&&j===o){if(ne=de.isBrace=!0,ie=de.isGlob=!0,k=!0,S===!0)continue;break}if(j===h&&(ue--,ue===0)){se=!1,ne=de.isBrace=!0,k=!0;break}}if(S===!0)continue;break}if(j===l){if(C.push(E),w.push(de),de={value:``,depth:0,isGlob:!1},k===!0)continue;if(A===s&&E===D+1){D+=2;continue}te=E+1;continue}if(b.noext!==!0&&(j===p||j===i||j===r||j===m||j===c)&&pe()===d){if(ie=de.isGlob=!0,ae=de.isExtglob=!0,k=!0,j===c&&E===D&&(le=!0),S===!0){let e=0;for(;fe()!==!0&&(j=me());){if(j===a){ce=de.backslashes=!0,me();continue}if(j===d){e++;continue}if(j===g&&--e===0){k=!0;break}}continue}break}if(j===r){if(A===r&&(oe=de.isGlobstar=!0),ie=de.isGlob=!0,k=!0,S===!0)continue;break}if(j===m){if(ie=de.isGlob=!0,k=!0,S===!0)continue;break}if(j===f){for(;fe()!==!0&&(e=me());){if(e===a){ce=de.backslashes=!0,me();continue}if(e===_){re=de.isBracket=!0,ie=de.isGlob=!0,k=!0;break}}if(S===!0)continue;break}if(b.nonegate!==!0&&j===c&&E===D){O=de.negated=!0,D++;continue}if(b.noparen!==!0&&j===d){if(ie=de.isGlob=!0,S===!0){let e=1;for(;fe()!==!0&&(j=me());){if(j===a){ce=de.backslashes=!0,me();continue}if(j===d){e++;continue}if(j===g&&--e===0){k=!0;break}}continue}break}if(ie===!0){if(k=!0,S===!0)continue;break}}b.noext===!0&&(ae=!1,ie=!1);let he=ee,ge=``,_e=``;D>0&&(ge=ee.slice(0,D),ee=ee.slice(D),te-=D),he&&ie===!0&&te>0?(he=ee.slice(0,te),_e=ee.slice(te)):ie===!0?(he=``,_e=ee):he=ee,he&&he!==``&&he!==`/`&&he!==ee&&v(he.charCodeAt(he.length-1))&&(he=he.slice(0,-1)),b.unescape===!0&&(_e&&=n.removeBackslashes(_e),he&&ce===!0&&(he=n.removeBackslashes(he)));let ve={prefix:ge,input:e,start:D,base:he,glob:_e,isBrace:ne,isBracket:re,isGlob:ie,isExtglob:ae,isGlobstar:oe,negated:O,negatedExtglob:le};if(b.tokens===!0&&(ve.maxDepth=0,v(j)||w.push(de),ve.tokens=w),b.parts===!0||b.tokens===!0){let t;for(let n=0;n<C.length;n++){let r=t===void 0?D:t+1,i=C[n],a=e.slice(r,i);b.tokens&&(n===0&&D!==0?(w[n].isPrefix=!0,w[n].value=ge):w[n].value=a,y(w[n]),ve.maxDepth+=w[n].depth),i>=D&&(T.push(a),t=i)}let n=t===void 0?D:t+1,r=e.slice(n);T.push(r),b.tokens&&t&&t+1<e.length&&(w[w.length-1].value=r,y(w[w.length-1]),ve.maxDepth+=w[w.length-1].depth),ve.slashes=C,ve.parts=T}return ve}})),qn=n(((e,t)=>{var n=Wn(),r=Gn(),{MAX_LENGTH:i,POSIX_REGEX_SOURCE:a,REGEX_NON_SPECIAL_CHARS:o,REGEX_SPECIAL_CHARS_BACKREF:s,REPLACEMENTS:c}=n,l=(e,t)=>{if(typeof t.expandRange==`function`)return t.expandRange(...e,t);e.sort();let n=`[${e.join(`-`)}]`;try{new RegExp(n)}catch{return e.map(e=>r.escapeRegex(e)).join(`..`)}return n},u=(e,t)=>`Missing ${e}: "${t}" - use "\\\\${t}" to match literal characters`,d=e=>{let t=[],n=0,r=0,i=0,a=``,o=!1;for(let s of e){if(o===!0){a+=s,o=!1;continue}if(s===`\\`){a+=s,o=!0;continue}if(s===`"`){i=i===1?0:1,a+=s;continue}if(i===0){if(s===`[`)n++;else if(s===`]`&&n>0)n--;else if(n===0){if(s===`(`)r++;else if(s===`)`&&r>0)r--;else if(s===`|`&&r===0){t.push(a),a=``;continue}}}a+=s}return t.push(a),t},f=e=>{let t=!1;for(let n of e){if(t===!0){t=!1;continue}if(n===`\\`){t=!0;continue}if(/[?*+@!()[\]{}]/.test(n))return!1}return!0},p=e=>{let t=e.trim(),n=!0;for(;n===!0;)n=!1,/^@\([^\\()[\]{}|]+\)$/.test(t)&&(t=t.slice(2,-1),n=!0);if(f(t))return t.replace(/\\(.)/g,`$1`)},m=e=>{let t=e.map(p).filter(Boolean);for(let e=0;e<t.length;e++)for(let n=e+1;n<t.length;n++){let r=t[e],i=t[n],a=r[0];if(a&&r===a.repeat(r.length)&&i===a.repeat(i.length)&&(r===i||r.startsWith(i)||i.startsWith(r)))return!0}return!1},h=(e,t=!0)=>{if(e[0]!==`+`&&e[0]!==`*`||e[1]!==`(`)return;let n=0,r=0,i=0,a=!1;for(let o=1;o<e.length;o++){let s=e[o];if(a===!0){a=!1;continue}if(s===`\\`){a=!0;continue}if(s===`"`){i=i===1?0:1;continue}if(i!==1){if(s===`[`){n++;continue}if(s===`]`&&n>0){n--;continue}if(!(n>0)){if(s===`(`){r++;continue}if(s===`)`&&(r--,r===0))return t===!0&&o!==e.length-1?void 0:{type:e[0],body:e.slice(2,o),end:o}}}}},g=e=>`${e.length===1?r.escapeRegex(e[0]):`[${e.map(e=>r.escapeRegex(e)).join(``)}]`}*`,_=e=>{let t=0,n=[];for(;t<e.length;){let r=h(e.slice(t),!1);if(!r||r.type!==`*`)return;let i=d(r.body).map(e=>e.trim());if(i.length!==1)return;let a=p(i[0]);if(!a||a.length!==1)return;n.push(a),t+=r.end+1}if(!(n.length<1))return n},v=e=>{let t=0,n=e.trim(),r=h(n);for(;r;)t++,n=r.body.trim(),r=h(n);return t},y=(e,t)=>{if(t.maxExtglobRecursion===!1)return{risky:!1};let r=typeof t.maxExtglobRecursion==`number`?t.maxExtglobRecursion:n.DEFAULT_MAX_EXTGLOB_RECURSION,i=d(e).map(e=>e.trim());if(i.length>1&&(i.some(e=>e===``)||i.some(e=>/^[*?]+$/.test(e))||m(i)))return{risky:!0};let a=[],o=!1,s=!0;for(let e of i){let t=_(e);if(t){o=!0,a.push(...t);continue}let n=p(e);if(n&&n.length===1){a.push(n);continue}if(s=!1,v(e)>r)return{risky:!0}}return o?s?{risky:!0,safeOutput:g([...new Set(a)])}:{risky:!0}:{risky:!1}},b=(e,t)=>{if(typeof e!=`string`)throw TypeError(`Expected a string`);e=c[e]||e;let d={...t},f=typeof d.maxLength==`number`?Math.min(i,d.maxLength):i,p=e.length;if(p>f)throw SyntaxError(`Input length: ${p}, exceeds maximum allowed length: ${f}`);let m={type:`bos`,value:``,output:d.prepend||``},h=[m],g=d.capture?``:`?:`,_=n.globChars(d.windows),v=n.extglobChars(_),{DOT_LITERAL:x,PLUS_LITERAL:S,SLASH_LITERAL:C,ONE_CHAR:w,DOTS_SLASH:T,NO_DOT:ee,NO_DOT_SLASH:E,NO_DOTS_SLASH:D,QMARK:te,QMARK_NO_DOT:ne,STAR:re,START_ANCHOR:ie}=_,ae=e=>`(${g}(?:(?!${ie}${e.dot?T:x}).)*?)`,oe=d.dot?``:ee,se=d.dot?te:ne,ce=d.bash===!0?ae(d):re;d.capture&&(ce=`(${ce})`),typeof d.noext==`boolean`&&(d.noextglob=d.noext);let O={input:e,index:-1,start:0,dot:d.dot===!0,consumed:``,output:``,prefix:``,backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:h};e=r.removePrefix(e,O),p=e.length;let le=[],k=[],ue=[],A=m,j,de=()=>O.index===p-1,fe=O.peek=(t=1)=>e[O.index+t],pe=O.advance=()=>e[++O.index]||``,me=()=>e.slice(O.index+1),he=(e=``,t=0)=>{O.consumed+=e,O.index+=t},ge=e=>{O.output+=e.output==null?e.value:e.output,he(e.value)},_e=()=>{let e=1;for(;fe()===`!`&&(fe(2)!==`(`||fe(3)===`?`);)pe(),O.start++,e++;return e%2!=0&&(O.negated=!0,O.start++,!0)},ve=e=>{O[e]++,ue.push(e)},ye=e=>{O[e]--,ue.pop()},M=e=>{if(A.type===`globstar`){let t=O.braces>0&&(e.type===`comma`||e.type===`brace`),n=e.extglob===!0||le.length&&(e.type===`pipe`||e.type===`paren`);e.type!==`slash`&&e.type!==`paren`&&!t&&!n&&(O.output=O.output.slice(0,-A.output.length),A.type=`star`,A.value=`*`,A.output=ce,O.output+=A.output)}if(le.length&&e.type!==`paren`&&(le[le.length-1].inner+=e.value),(e.value||e.output)&&ge(e),A&&A.type===`text`&&e.type===`text`){A.output=(A.output||A.value)+e.value,A.value+=e.value;return}e.prev=A,h.push(e),A=e},be=(e,t)=>{let n={...v[t],conditions:1,inner:``};n.prev=A,n.parens=O.parens,n.output=O.output,n.startIndex=O.index,n.tokensIndex=h.length;let r=(d.capture?`(`:``)+n.open;ve(`parens`),M({type:e,value:t,output:O.output?``:w}),M({type:`paren`,extglob:!0,value:pe(),output:r}),le.push(n)},xe=n=>{let i=e.slice(n.startIndex,O.index+1),a=y(e.slice(n.startIndex+2,O.index),d);if((n.type===`plus`||n.type===`star`)&&a.risky){let e=a.safeOutput?(n.output?``:w)+(d.capture?`(${a.safeOutput})`:a.safeOutput):void 0,t=h[n.tokensIndex];t.type=`text`,t.value=i,t.output=e||r.escapeRegex(i);for(let e=n.tokensIndex+1;e<h.length;e++)h[e].value=``,h[e].output=``,delete h[e].suffix;O.output=n.output+t.output,O.backtrack=!0,M({type:`paren`,extglob:!0,value:j,output:``}),ye(`parens`);return}let o=n.close+(d.capture?`)`:``),s;if(n.type===`negate`){let e=ce;n.inner&&n.inner.length>1&&n.inner.includes(`/`)&&(e=ae(d)),(e!==ce||de()||/^\)+$/.test(me()))&&(o=n.close=`)$))${e}`),n.inner.includes(`*`)&&(s=me())&&/^\.[^\\/.]+$/.test(s)&&(o=n.close=`)${b(s,{...t,fastpaths:!1}).output})${e})`),n.prev.type===`bos`&&(O.negatedExtglob=!0)}M({type:`paren`,extglob:!0,value:j,output:o}),ye(`parens`)};if(d.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(e)){let n=!1,i=e.replace(s,(e,t,r,i,a,o)=>i===`\\`?(n=!0,e):i===`?`?t?t+i+(a?te.repeat(a.length):``):o===0?se+(a?te.repeat(a.length):``):te.repeat(r.length):i===`.`?x.repeat(r.length):i===`*`?t?t+i+(a?ce:``):ce:t?e:`\\${e}`);return n===!0&&(i=d.unescape===!0?i.replace(/\\/g,``):i.replace(/\\+/g,e=>e.length%2==0?`\\\\`:e?`\\`:``)),i===e&&d.contains===!0?(O.output=e,O):(O.output=r.wrapOutput(i,O,t),O)}for(;!de();){if(j=pe(),j===`\0`)continue;if(j===`\\`){let e=fe();if(e===`/`&&d.bash!==!0||e===`.`||e===`;`)continue;if(!e){j+=`\\`,M({type:`text`,value:j});continue}let t=/^\\+/.exec(me()),n=0;if(t&&t[0].length>2&&(n=t[0].length,O.index+=n,n%2!=0&&(j+=`\\`)),d.unescape===!0?j=pe():j+=pe(),O.brackets===0){M({type:`text`,value:j});continue}}if(O.brackets>0&&(j!==`]`||A.value===`[`||A.value===`[^`)){if(d.posix!==!1&&j===`:`){let e=A.value.slice(1);if(e.includes(`[`)&&(A.posix=!0,e.includes(`:`))){let e=A.value.lastIndexOf(`[`),t=A.value.slice(0,e),n=a[A.value.slice(e+2)];if(n){A.value=t+n,O.backtrack=!0,pe(),!m.output&&h.indexOf(A)===1&&(m.output=w);continue}}}(j===`[`&&fe()!==`:`||j===`-`&&fe()===`]`)&&(j=`\\${j}`),j===`]`&&(A.value===`[`||A.value===`[^`)&&(j=`\\${j}`),d.posix===!0&&j===`!`&&A.value===`[`&&(j=`^`),A.value+=j,ge({value:j});continue}if(O.quotes===1&&j!==`"`){j=r.escapeRegex(j),A.value+=j,ge({value:j});continue}if(j===`"`){O.quotes=O.quotes===1?0:1,d.keepQuotes===!0&&M({type:`text`,value:j});continue}if(j===`(`){ve(`parens`),M({type:`paren`,value:j});continue}if(j===`)`){if(O.parens===0&&d.strictBrackets===!0)throw SyntaxError(u(`opening`,`(`));let e=le[le.length-1];if(e&&O.parens===e.parens+1){xe(le.pop());continue}M({type:`paren`,value:j,output:O.parens?`)`:`\\)`}),ye(`parens`);continue}if(j===`[`){if(d.nobracket===!0||!me().includes(`]`)){if(d.nobracket!==!0&&d.strictBrackets===!0)throw SyntaxError(u(`closing`,`]`));j=`\\${j}`}else ve(`brackets`);M({type:`bracket`,value:j});continue}if(j===`]`){if(d.nobracket===!0||A&&A.type===`bracket`&&A.value.length===1){M({type:`text`,value:j,output:`\\${j}`});continue}if(O.brackets===0){if(d.strictBrackets===!0)throw SyntaxError(u(`opening`,`[`));M({type:`text`,value:j,output:`\\${j}`});continue}ye(`brackets`);let e=A.value.slice(1);if(A.posix!==!0&&e[0]===`^`&&!e.includes(`/`)&&(j=`/${j}`),A.value+=j,ge({value:j}),d.literalBrackets===!1||r.hasRegexChars(e))continue;let t=r.escapeRegex(A.value);if(O.output=O.output.slice(0,-A.value.length),d.literalBrackets===!0){O.output+=t,A.value=t;continue}A.value=`(${g}${t}|${A.value})`,O.output+=A.value;continue}if(j===`{`&&d.nobrace!==!0){ve(`braces`);let e={type:`brace`,value:j,output:`(`,outputIndex:O.output.length,tokensIndex:O.tokens.length};k.push(e),M(e);continue}if(j===`}`){let e=k[k.length-1];if(d.nobrace===!0||!e){M({type:`text`,value:j,output:j});continue}let t=`)`;if(e.dots===!0){let e=h.slice(),n=[];for(let t=e.length-1;t>=0&&(h.pop(),e[t].type!==`brace`);t--)e[t].type!==`dots`&&n.unshift(e[t].value);t=l(n,d),O.backtrack=!0}if(e.comma!==!0&&e.dots!==!0){let n=O.output.slice(0,e.outputIndex),r=O.tokens.slice(e.tokensIndex);e.value=e.output=`\\{`,j=t=`\\}`,O.output=n;for(let e of r)O.output+=e.output||e.value}M({type:`brace`,value:j,output:t}),ye(`braces`),k.pop();continue}if(j===`|`){le.length>0&&le[le.length-1].conditions++,M({type:`text`,value:j});continue}if(j===`,`){let e=j,t=k[k.length-1];t&&ue[ue.length-1]===`braces`&&(t.comma=!0,e=`|`),M({type:`comma`,value:j,output:e});continue}if(j===`/`){if(A.type===`dot`&&O.index===O.start+1){O.start=O.index+1,O.consumed=``,O.output=``,h.pop(),A=m;continue}M({type:`slash`,value:j,output:C});continue}if(j===`.`){if(O.braces>0&&A.type===`dot`){A.value===`.`&&(A.output=x);let e=k[k.length-1];A.type=`dots`,A.output+=j,A.value+=j,e.dots=!0;continue}if(O.braces+O.parens===0&&A.type!==`bos`&&A.type!==`slash`){M({type:`text`,value:j,output:x});continue}M({type:`dot`,value:j,output:x});continue}if(j===`?`){if(!(A&&A.value===`(`)&&d.noextglob!==!0&&fe()===`(`&&fe(2)!==`?`){be(`qmark`,j);continue}if(A&&A.type===`paren`){let e=fe(),t=j;(A.value===`(`&&!/[!=<:]/.test(e)||e===`<`&&!/<([!=]|\w+>)/.test(me()))&&(t=`\\${j}`),M({type:`text`,value:j,output:t});continue}if(d.dot!==!0&&(A.type===`slash`||A.type===`bos`)){M({type:`qmark`,value:j,output:ne});continue}M({type:`qmark`,value:j,output:te});continue}if(j===`!`){if(d.noextglob!==!0&&fe()===`(`&&(fe(2)!==`?`||!/[!=<:]/.test(fe(3)))){be(`negate`,j);continue}if(d.nonegate!==!0&&O.index===0){_e();continue}}if(j===`+`){if(d.noextglob!==!0&&fe()===`(`&&fe(2)!==`?`){be(`plus`,j);continue}if(A&&A.value===`(`||d.regex===!1){M({type:`plus`,value:j,output:S});continue}if(A&&(A.type===`bracket`||A.type===`paren`||A.type===`brace`)||O.parens>0){M({type:`plus`,value:j});continue}M({type:`plus`,value:S});continue}if(j===`@`){if(d.noextglob!==!0&&fe()===`(`&&fe(2)!==`?`){M({type:`at`,extglob:!0,value:j,output:``});continue}M({type:`text`,value:j});continue}if(j!==`*`){(j===`$`||j===`^`)&&(j=`\\${j}`);let e=o.exec(me());e&&(j+=e[0],O.index+=e[0].length),M({type:`text`,value:j});continue}if(A&&(A.type===`globstar`||A.star===!0)){A.type=`star`,A.star=!0,A.value+=j,A.output=ce,O.backtrack=!0,O.globstar=!0,he(j);continue}let t=me();if(d.noextglob!==!0&&/^\([^?]/.test(t)){be(`star`,j);continue}if(A.type===`star`){if(d.noglobstar===!0){he(j);continue}let n=A.prev,r=n.prev,i=n.type===`slash`||n.type===`bos`,a=r&&(r.type===`star`||r.type===`globstar`);if(d.bash===!0&&(!i||t[0]&&t[0]!==`/`)){M({type:`star`,value:j,output:``});continue}let o=O.braces>0&&(n.type===`comma`||n.type===`brace`),s=le.length&&(n.type===`pipe`||n.type===`paren`);if(!i&&n.type!==`paren`&&!o&&!s){M({type:`star`,value:j,output:``});continue}for(;t.slice(0,3)===`/**`;){let n=e[O.index+4];if(n&&n!==`/`)break;t=t.slice(3),he(`/**`,3)}let c=de()||O.parens>0&&t===`)`.repeat(O.parens)&&!le.some(e=>e.type===`negate`);if(n.type===`bos`&&de()){A.type=`globstar`,A.value+=j,A.output=ae(d),O.output=A.output,O.globstar=!0,he(j);continue}if(n.type===`slash`&&n.prev.type!==`bos`&&!a&&c){O.output=O.output.slice(0,-(n.output+A.output).length),n.output=`(?:${n.output}`,A.type=`globstar`,A.output=ae(d)+(d.strictSlashes?`)`:`|$)`),A.value+=j,O.globstar=!0,O.output+=n.output+A.output,he(j);continue}if(n.type===`slash`&&n.prev.type!==`bos`&&t[0]===`/`){let e=t[1]===void 0?``:`|$`;O.output=O.output.slice(0,-(n.output+A.output).length),n.output=`(?:${n.output}`,A.type=`globstar`,A.output=`${ae(d)}${C}|${C}${e})`,A.value+=j,O.output+=n.output+A.output,O.globstar=!0,he(j+pe()),M({type:`slash`,value:`/`,output:``});continue}if(n.type===`bos`&&t[0]===`/`){A.type=`globstar`,A.value+=j,A.output=`(?:^|${C}|${ae(d)}${C})`,O.output=A.output,O.globstar=!0,he(j+pe()),M({type:`slash`,value:`/`,output:``});continue}O.output=O.output.slice(0,-A.output.length),A.type=`globstar`,A.output=ae(d),A.value+=j,O.output+=A.output,O.globstar=!0,he(j);continue}let n={type:`star`,value:j,output:ce};if(d.bash===!0){n.output=`.*?`,(A.type===`bos`||A.type===`slash`)&&(n.output=oe+n.output),M(n);continue}if(A&&(A.type===`bracket`||A.type===`paren`)&&d.regex===!0){n.output=j,M(n);continue}(O.index===O.start||A.type===`slash`||A.type===`dot`)&&(A.type===`dot`?(O.output+=E,A.output+=E):d.dot===!0?(O.output+=D,A.output+=D):(O.output+=oe,A.output+=oe),fe()!==`*`&&(O.output+=w,A.output+=w)),M(n)}for(;O.brackets>0;){if(d.strictBrackets===!0)throw SyntaxError(u(`closing`,`]`));O.output=r.escapeLast(O.output,`[`),ye(`brackets`)}for(;O.parens>0;){if(d.strictBrackets===!0)throw SyntaxError(u(`closing`,`)`));O.output=r.escapeLast(O.output,`(`),ye(`parens`)}for(;O.braces>0;){if(d.strictBrackets===!0)throw SyntaxError(u(`closing`,`}`));O.output=r.escapeLast(O.output,`{`),ye(`braces`)}if(d.strictSlashes!==!0&&(A.type===`star`||A.type===`bracket`)&&M({type:`maybe_slash`,value:``,output:`${C}?`}),O.backtrack===!0){O.output=``;for(let e of O.tokens)O.output+=e.output==null?e.value:e.output,e.suffix&&(O.output+=e.suffix)}return O};b.fastpaths=(e,t)=>{let a={...t},o=typeof a.maxLength==`number`?Math.min(i,a.maxLength):i,s=e.length;if(s>o)throw SyntaxError(`Input length: ${s}, exceeds maximum allowed length: ${o}`);e=c[e]||e;let{DOT_LITERAL:l,SLASH_LITERAL:u,ONE_CHAR:d,DOTS_SLASH:f,NO_DOT:p,NO_DOTS:m,NO_DOTS_SLASH:h,STAR:g,START_ANCHOR:_}=n.globChars(a.windows),v=a.dot?m:p,y=a.dot?h:p,b=a.capture?``:`?:`,x={negated:!1,prefix:``},S=a.bash===!0?`.*?`:g;a.capture&&(S=`(${S})`);let C=e=>e.noglobstar===!0?S:`(${b}(?:(?!${_}${e.dot?f:l}).)*?)`,w=e=>{switch(e){case`*`:return`${v}${d}${S}`;case`.*`:return`${l}${d}${S}`;case`*.*`:return`${v}${S}${l}${d}${S}`;case`*/*`:return`${v}${S}${u}${d}${y}${S}`;case`**`:return v+C(a);case`**/*`:return`(?:${v}${C(a)}${u})?${y}${d}${S}`;case`**/*.*`:return`(?:${v}${C(a)}${u})?${y}${S}${l}${d}${S}`;case`**/.*`:return`(?:${v}${C(a)}${u})?${l}${d}${S}`;default:{let t=/^(.*?)\.(\w+)$/.exec(e);if(!t)return;let n=w(t[1]);return n?n+l+t[2]:void 0}}},T=w(r.removePrefix(e,x));return T&&a.strictSlashes!==!0&&(T+=`${u}?`),T},t.exports=b})),Jn=n(((e,t)=>{var n=Kn(),r=qn(),i=Gn(),a=Wn(),o=e=>e&&typeof e==`object`&&!Array.isArray(e),s=(e,t,n=!1)=>{if(Array.isArray(e)){let r=e.map(e=>s(e,t,n));return e=>{for(let t of r){let n=t(e);if(n)return n}return!1}}let r=o(e)&&e.tokens&&e.input;if(e===``||typeof e!=`string`&&!r)throw TypeError(`Expected pattern to be a non-empty string`);let i=t||{},a=i.windows,c=r?s.compileRe(e,t):s.makeRe(e,t,!1,!0),l=c.state;delete c.state;let u=()=>!1;if(i.ignore){let e={...t,ignore:null,onMatch:null,onResult:null};u=s(i.ignore,e,n)}let d=(n,r=!1)=>{let{isMatch:o,match:d,output:f}=s.test(n,c,t,{glob:e,posix:a}),p={glob:e,state:l,regex:c,posix:a,input:n,output:f,match:d,isMatch:o};return typeof i.onResult==`function`&&i.onResult(p),o===!1?(p.isMatch=!1,r?p:!1):u(n)?(typeof i.onIgnore==`function`&&i.onIgnore(p),p.isMatch=!1,r?p:!1):(typeof i.onMatch==`function`&&i.onMatch(p),!r||p)};return n&&(d.state=l),d};s.test=(e,t,n,{glob:r,posix:a}={})=>{if(typeof e!=`string`)throw TypeError(`Expected input to be a string`);if(e===``)return{isMatch:!1,output:``};let o=n||{},c=o.format||(a?i.toPosixSlashes:null),l=e===r,u=l&&c?c(e):e;return l===!1&&(u=c?c(e):e,l=u===r),(l===!1||o.capture===!0)&&(l=o.matchBase===!0||o.basename===!0?s.matchBase(e,t,n,a):t.exec(u)),{isMatch:!!l,match:l,output:u}},s.matchBase=(e,t,n,r=n&&n.windows)=>(t instanceof RegExp?t:s.makeRe(t,n)).test(i.basename(e,{windows:r})),s.isMatch=(e,t,n)=>s(t,n)(e),s.parse=(e,t)=>Array.isArray(e)?e.map(e=>s.parse(e,t)):r(e,{...t,fastpaths:!1}),s.scan=(e,t)=>n(e,t),s.compileRe=(e,t,n=!1,r=!1)=>{if(n===!0)return e.output;let i=t||{},a=i.contains?``:`^`,o=i.contains?``:`$`,c=`${a}(?:${e.output})${o}`;e&&e.negated===!0&&(c=`^(?!${c}).*$`);let l=s.toRegex(c,t);return r===!0&&(l.state=e),l},s.makeRe=(e,t={},n=!1,i=!1)=>{if(!e||typeof e!=`string`)throw TypeError(`Expected a non-empty string`);let a={negated:!1,fastpaths:!0};return t.fastpaths!==!1&&(e[0]===`.`||e[0]===`*`)&&(a.output=r.fastpaths(e,t)),a.output||(a=r(e,t)),s.compileRe(a,t,n,i)},s.toRegex=(e,t)=>{try{let n=t||{};return new RegExp(e,n.flags||(n.nocase?`i`:``))}catch(e){if(t&&t.debug===!0)throw e;return/$^/}},s.constants=a,t.exports=s})),Yn=n(((e,t)=>{var n=Jn(),r=Gn();function i(e,t,i=!1){return t&&(t.windows===null||t.windows===void 0)&&(t={...t,windows:r.isWindows()}),n(e,t,i)}Object.assign(i,n),t.exports=i})),Xn=e(Yn(),1),Zn=[`**/*.generated.*`,`**/pnpm-lock.yaml`,`**/yarn.lock`,`**/package-lock.json`,`**/Cargo.lock`,`**/go.sum`,`**/dist/**`,`**/*.lock`],Qn={key:`code`,category:`core`},$n={key:`other`,category:`other`},er=[{key:`docs`,category:`docs`,patterns:[`**/*.md`,`**/*.mdx`,`**/*.mdc`,`**/docs/**`,`**/README*`]},Qn,{key:`tests`,category:`tests`,patterns:[`**/*.test.*`,`**/*.spec.*`,`**/__tests__/**`,`**/test/**`,`**/tests/**`]},{key:`config`,category:`config`,patterns:[`*.config.*`,`.*rc`,`.*rc.*`,`.github/**`,`.git*`,`**/tsconfig*.json`,`**/Dockerfile`,`**/docker-compose*.y*ml`,`**/.dockerignore`,`**/Makefile`]},{key:`deps`,category:`deps`,patterns:[`**/package.json`,`**/pnpm-workspace.yaml`,`**/Cargo.toml`,`**/go.mod`]},{key:`generated`,category:`other`,patterns:Zn},$n],tr=class{incoming=[];outgoing=[];get length(){return this.incoming.length+this.outgoing.length}enqueue(e){this.incoming.push(e)}dequeue(){if(this.outgoing.length===0)for(;this.incoming.length>0;)this.outgoing.push(this.incoming.pop());return this.outgoing.pop()}},nr=class{queue=new tr;waiting=new tr;done=!1;finalResultPromise;resolveFinalResult;isComplete;extractResult;constructor(e,t){this.isComplete=e,this.extractResult=t,this.finalResultPromise=new Promise(e=>{this.resolveFinalResult=e})}push(e){if(this.done)return;this.isComplete(e)&&(this.done=!0,this.resolveFinalResult(this.extractResult(e)));let t=this.waiting.dequeue();t?t({value:e,done:!1}):this.queue.enqueue(e)}end(e){for(this.done=!0,e!==void 0&&this.resolveFinalResult(e);this.waiting.length>0;)this.waiting.dequeue()({value:void 0,done:!0})}async*[Symbol.asyncIterator](){for(;;)if(this.queue.length>0)yield this.queue.dequeue();else if(this.done)return;else{let e=await new Promise(e=>this.waiting.enqueue(e));if(e.done)return;yield e.value}}result(){return this.finalResultPromise}},rr=class extends nr{constructor(){super(e=>e.type===`done`||e.type===`error`,e=>{if(e.type===`done`)return e.message;if(e.type===`error`)return e.error;throw Error(`Unexpected event type for final result`)})}};function ir(e,t){return{role:`assistant`,content:[],api:e.api,provider:e.provider,model:e.id,usage:{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},stopReason:`error`,errorMessage:t instanceof Error?t.message:String(t),timestamp:Date.now()}}function ar(e){return typeof e.result==`function`}async function or(e,t){for await(let n of t)e.push(n);e.end(ar(t)?await t.result():void 0)}function sr(e,t){let n=new rr;return t().then(e=>or(n,e)).catch(t=>{let r=ir(e,t);n.push({type:`error`,reason:`error`,error:r}),n.end(r)}),n}function cr(e,t){let n={stream:(t,n,r)=>sr(t,async()=>(await e()).stream(t,n,r)),streamSimple:(t,n,r)=>sr(t,async()=>(await e()).streamSimple(t,n,r))};return t?.fetchDeferred&&(n.fetchDeferred=(t,n,r)=>sr(t,async()=>{let i=await e();if(!i.fetchDeferred)throw Error(`API does not support deferred responses`);return i.fetchDeferred(t,n,r)})),t?.cancelDeferred&&(n.cancelDeferred=async(t,n,r)=>{let i=await e();if(!i.cancelDeferred)throw Error(`API cannot cancel deferred responses`);await i.cancelDeferred(t,n,r)}),n}var lr=function(e,t){return typeof e==`string`&&/^\.\.?\//.test(e)?e.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(e,n,r,i,a){return n?t?`.jsx`:`.js`:r&&(!i||!a)?e:r+i+`.`+a.toLowerCase()+`js`}):e},ur=e=>R(()=>import(lr(e)),[],import.meta.url);function dr(){return globalThis.process?.env}function fr(){return{async env(e){let t=dr()?.[e];return typeof t==`string`&&t.trim().length>0?t:void 0},async fileExists(e){try{let t=await ur(`node:fs/promises`),n=e;return n.startsWith(`~`)&&(n=(await ur(`node:os`)).homedir()+n.slice(1)),await t.access(n),!0}catch{return!1}}}}function pr(e){if(e.reason!==void 0)return e.reason;let t=Error(`The operation was aborted`);return t.name=`AbortError`,t}function mr(e){return e??new AbortController().signal}function hr(e,t){return t.aborted?(e.catch(()=>{}),Promise.reject(pr(t))):new Promise((n,r)=>{let i=!1,a=()=>t.removeEventListener(`abort`,o),o=()=>{i||(i=!0,a(),r(pr(t)))};t.addEventListener(`abort`,o,{once:!0}),e.then(e=>{i||(i=!0,a(),n(e))},e=>{i||(i=!0,a(),r(e))}),t.aborted&&o()})}var gr=class{credentials=new Map;chains=new Map;enqueue(e,t,n){let r=mr(n?.signal),i=this.chains.get(e)??Promise.resolve(),a=(async()=>(await i.catch(()=>{}),r.throwIfAborted(),t()))(),o=a.catch(()=>{});return this.chains.set(e,o),o.then(()=>{this.chains.get(e)===o&&this.chains.delete(e)}),hr(a,r)}async read(e,t){return t?.signal?.throwIfAborted(),this.credentials.get(e)}async list(e){return e?.signal?.throwIfAborted(),[...this.credentials].map(([e,t])=>({providerId:e,type:t.type}))}modify(e,t,n){return this.enqueue(e,async()=>{let r=this.credentials.get(e),i=await t(r);return n?.signal?.throwIfAborted(),i!==void 0&&this.credentials.set(e,i),i??r},n)}delete(e,t){return this.enqueue(e,async()=>{this.credentials.delete(e)},t)}};function _r(e){return e instanceof Error?e.message||e.name:typeof e==`string`?e:String(e)}function vr(e,t){e.diagnostics=[...e.diagnostics??[],t]}var yr=class extends Error{code;constructor(e,t,n){super(br(t,n?.cause),n),this.name=`ModelsError`,this.code=e}};function br(e,t){if(t==null)return e;let n=_r(t).trim();return!n||e.includes(n)?e:`${e}: ${n}`}function xr(e,t,n,r){let i=mr(r?.signal);return hr(Sr(e,t,n,r,i),i)}async function Sr(e,t,n,r,i){i.throwIfAborted();let a=r?.env?Cr(n,r.env):n;if(r?.apiKey!==void 0&&e.auth.apiKey)return Dr(a,e.auth.apiKey,e.id,{type:`api_key`,key:r.apiKey,env:r.env},i);let o=await Or(t,e.id,i);if(o){if(o.type===`oauth`&&e.auth.oauth)return Er(t,e.id,e.auth.oauth,o,i,r?.minOAuthValidityMs);if(o.type===`api_key`&&e.auth.apiKey){let t=r?.env?{...o,env:{...o.env,...r.env}}:o;return Dr(a,e.auth.apiKey,e.id,t,i)}return}return e.auth.apiKey?Dr(a,e.auth.apiKey,e.id,void 0,i):void 0}function Cr(e,t){return{env:async n=>t[n]||await e.env(n),fileExists:t=>e.fileExists(t)}}var wr=3e5,Tr=15e3;async function Er(e,t,n,r,i,a){let o=Math.max(wr,a??0),s=e=>Date.now()+o>=e.expires,c=r;if(s(c)){let r;try{r=await e.modify(t,async e=>{if(e?.type===`oauth`&&s(e))try{let t=AbortSignal.any([i,AbortSignal.timeout(Tr)]);return await n.refresh(e,t)}catch(e){throw new yr(`oauth`,`OAuth refresh failed for ${t}`,{cause:e})}},{signal:i})}catch(e){throw e instanceof yr?e:new yr(`auth`,`Credential store modify failed for ${t}`,{cause:e})}if(r?.type!==`oauth`)return;if(c=r,a!==void 0&&s(c))throw new yr(`oauth`,`OAuth refresh returned a token that expires too soon for ${t}`)}try{return{auth:await n.toAuth(c),source:`OAuth`}}catch(e){throw new yr(`oauth`,`OAuth auth derivation failed for ${t}`,{cause:e})}}async function Dr(e,t,n,r,i){try{return await t.resolve({ctx:e,credential:r,signal:i})}catch(e){throw new yr(`auth`,`API key auth failed for provider ${n}`,{cause:e})}}async function Or(e,t,n){try{return await e.read(t,{signal:n})}catch(e){throw new yr(`auth`,`Credential store read failed for ${t}`,{cause:e})}}var kr=class{entries=new Map;async read(e,t){t?.signal?.throwIfAborted();let n=this.entries.get(e);return n?structuredClone(n):void 0}async write(e,t,n){n?.signal?.throwIfAborted(),this.entries.set(e,structuredClone(t))}async delete(e,t){t?.signal?.throwIfAborted(),this.entries.delete(e)}};function Ar(e,t=`
3
+ `){return typeof e==`string`?e:e.filter(e=>e.type===`text`).map(e=>e.text).join(t)}function jr(e){let t=[Ar(e.content)];for(let n of Object.values(e.sections??{}))n!==null&&t.push(n);return t.filter(e=>e.length>0).join(`
4
+
5
+ `)}function Mr(e){let t=[],n=Ar(e.content);n.length>0&&t.push(n);for(let[n,r]of Object.entries(e.sections??{}))t.push(r===null?`Removed system prompt section "${n}".`:`Updated system prompt section "${n}":\n\n${r}`);return t.join(`
6
+
7
+ `)}function Nr(e,t){let n=e!==void 0&&e.length>0,r=t!==void 0&&t.length>0;if(n||r)return{role:`system`,content:e??``,...r?{toolsAdded:t}:{},timestamp:0}}function Pr(e){let t=Nr(e.systemPrompt,e.tools);return{messages:t?[t,...e.messages]:e.messages}}function Fr(e){return e.role===`system`}function Ir(e){let t=e[0];return t&&Fr(t)?t:void 0}function Lr(e){let t=new Map;for(let n of e)if(Fr(n)){for(let e of n.toolsRemoved??[])t.delete(e.name);for(let e of n.toolsAdded??[])t.set(e.name,e)}return[...t.values()]}function Rr(e){let t=[],n=new Map,r;for(let i of e){if(!Fr(i))continue;r??=i.timestamp;let e=Ar(i.content);e.length>0&&t.push(e);for(let[e,t]of Object.entries(i.sections??{}))t===null?n.delete(e):n.set(e,t)}let i=Lr(e);if(r!==void 0||i.length!==0)return{role:`system`,content:t.join(`
8
+
9
+ `),...n.size>0?{sections:Object.fromEntries(n)}:{},...i.length>0?{toolsAdded:i}:{},timestamp:r??0}}function zr(e){let t=Rr(e);return t?jr(t):``}function Br(e){let t=Rr(e.messages),n=e.messages.filter(e=>e.role!==`system`);return{messages:t?[t,...n]:n}}function Vr(e,t){return t?e:Br(e)}function Hr(e){return{name:e.name,description:e.description,parameters:JSON.parse(JSON.stringify(e.parameters)),...e.constrainedSampling===void 0?{}:{constrainedSampling:e.constrainedSampling}}}function Ur(e,t){return JSON.stringify(Hr(e))===JSON.stringify(Hr(t))}function Wr(e,t){let n=new Map(e.map(e=>[e.name,e])),r=new Map(t.map(e=>[e.name,e]));return{toolsAdded:t.filter(e=>{let t=n.get(e.name);return t===void 0||!Ur(t,e)}).map(Hr),toolsRemoved:e.filter(e=>{let t=r.get(e.name);return t===void 0||!Ur(e,t)}).map(e=>({name:e.name}))}}function Gr(e){let t=new Map;for(let n of e)if(Fr(n))for(let e of n.toolsAdded??[])t.set(e.name,e);return[...t.values()]}function Kr(e){let t=new Map;for(let n of e)if(Fr(n))for(let e of n.toolsAdded??[]){let n=t.get(e.name);if(n!==void 0&&!Ur(n,e))return!0;t.set(e.name,e)}return!1}function qr(e){let t=new Set;for(let n of e)if(Fr(n)){if((n.toolsRemoved?.length??0)>0)return!0;for(let e of n.toolsAdded??[]){if(t.has(e.name))return!0;t.add(e.name)}}return!1}function Jr(e,t){let n=t&&!qr(e);return{requestTools:n?Ir(e)?.toolsAdded??[]:Lr(e),anchorsAdditions:n}}function Yr(e,t){if(!e&&!t)return;let n={...e};for(let[e,r]of Object.entries(t??{})){let t=e.toLowerCase();for(let e of Object.keys(n))e.toLowerCase()===t&&delete n[e];n[e]=r}return n}var Xr=class{providers=new Map;credentials;modelsStore;authContext;refreshGenerations=new Map;refreshControllers=new Map;publicationChains=new Map;constructor(e){this.credentials=e?.credentials??new gr,this.modelsStore=e?.modelsStore??new kr,this.authContext=e?.authContext??fr()}setProvider(e){this.supersedeProviderRefresh(e.id),this.providers.set(e.id,e)}deleteProvider(e){this.supersedeProviderRefresh(e),this.providers.delete(e)}clearProviders(){for(let e of new Set([...this.providers.keys(),...this.refreshControllers.keys()]))this.supersedeProviderRefresh(e);this.providers.clear()}getProviders(){return Array.from(this.providers.values())}getProvider(e){return this.providers.get(e)}getModels(e){if(e!==void 0){let t=this.providers.get(e);if(!t)return[];try{return t.getModels()}catch{return[]}}let t=[];for(let e of this.providers.values())try{t.push(...e.getModels())}catch{}return t}getModel(e,t){return this.getModels(e).find(e=>e.id===t)}supersedeProviderRefresh(e){let t=(this.refreshGenerations.get(e)??0)+1;this.refreshGenerations.set(e,t);let n=this.refreshControllers.get(e);return n&&(this.refreshControllers.delete(e),n.abort()),t}beginProviderRefresh(e){let t=this.supersedeProviderRefresh(e),n=new AbortController;return this.refreshControllers.set(e,n),{generation:t,controller:n}}publishProviderModels(e,t,n,r){let i=this.publicationChains.get(e)??Promise.resolve(),a=(async()=>(await i.catch(()=>{}),n.aborted||this.refreshGenerations.get(e)!==t||(r.persist===null?await this.modelsStore.delete(e,{signal:n}):r.persist!==void 0&&await this.modelsStore.write(e,structuredClone(r.persist),{signal:n}),n.aborted||this.refreshGenerations.get(e)!==t)?!1:(r.update?.(),!0)))(),o=a.catch(()=>{});return this.publicationChains.set(e,o),o.then(()=>{this.publicationChains.get(e)===o&&this.publicationChains.delete(e)}),hr(a,n)}async runProviderRefreshPhase(e,t,n,r,i,a){let o=await this.modelsStore.read(e.id,{signal:a});await e.refreshModels({credential:t,stored:o?structuredClone(o):void 0,publish:t=>this.publishProviderModels(e.id,i,a,t),allowNetwork:n,force:n?r:void 0,signal:a})}async refresh(e={}){let t=e.allowNetwork??!0,n=mr(e.signal),r=new Map;if(n.aborted)return{aborted:!0,errors:r};let i=e.providers?new Set(e.providers):void 0,a=Array.from(this.providers.values()).filter(e=>e.refreshModels!==void 0&&(!i||i.has(e.id))),o=Promise.all(a.map(async i=>{let{generation:a,controller:o}=this.beginProviderRefresh(i.id),s=AbortSignal.any([n,o.signal]),c=(async()=>{let n,r;try{n=await this.readCredential(i.id,s)}catch(e){r=e}if(await this.runProviderRefreshPhase(i,n,!1,void 0,a,s),r!==void 0)throw r;if(!t||s.aborted)return;let o=await this.resolveRefreshCredential(i,n,s);o&&await this.runProviderRefreshPhase(i,o,!0,e.force,a,s)})();try{await hr(c,s)}catch(e){s.aborted||r.set(i.id,e instanceof Error?e:new yr(`model_source`,`Model refresh failed for ${i.id}`,{cause:e}))}finally{this.refreshControllers.get(i.id)===o&&this.refreshControllers.delete(i.id)}}));try{await hr(o,n)}catch(e){if(!n.aborted)throw e}return{aborted:n.aborted,errors:new Map(r)}}async resolveRefreshCredential(e,t,n){if(t?.type===`oauth`){let r=e.auth.oauth;if(!r)return;if(Date.now()<t.expires)return t;if(n.aborted)return;let i=await this.credentials.modify(e.id,async e=>{if(!(e?.type!==`oauth`||Date.now()<e.expires))return r.refresh(e,n)},{signal:n});return i?.type===`oauth`?i:void 0}let r=e.auth.apiKey;if(!r)return;let i=t?.type===`api_key`?t:void 0,a=await r.resolve({ctx:this.authContext,credential:i,signal:n});if(a)return{type:`api_key`,key:a.auth.apiKey,env:a.env}}async readCredential(e,t){try{return await this.credentials.read(e,{signal:t})}catch(t){throw new yr(`auth`,`Credential store read failed for ${e}`,{cause:t})}}async checkProviderAuth(e,t,n){if(t?.type===`oauth`)return e.auth.oauth?{source:`OAuth`,type:`oauth`}:void 0;let r=e.auth.apiKey;if(!r)return;if(r.check)try{return await r.check({ctx:this.authContext,credential:t?.type===`api_key`?t:void 0,signal:n})}catch(t){throw new yr(`auth`,`API key auth check failed for provider ${e.id}`,{cause:t})}let i=await xr(e,this.credentials,this.authContext,{signal:n});return i?{source:i.source,type:`api_key`}:void 0}checkAuth(e,t){let n=mr(t?.signal);return hr((async()=>{n.throwIfAborted();let t=this.providers.get(e);if(t)return this.checkProviderAuth(t,await this.readCredential(e,n),n)})(),n)}getAvailable(e,t){let n=mr(t?.signal);return hr((async()=>{n.throwIfAborted();let t=e?[this.providers.get(e)].filter(e=>e!==void 0):this.getProviders();return(await Promise.all(t.map(async e=>{let t=await this.readCredential(e.id,n);return{provider:e,credential:t,auth:await this.checkProviderAuth(e,t,n)}}))).flatMap(({provider:e,credential:t,auth:n})=>{if(!n)return[];let r=e.getModels();return e.filterModels?.(r,t)??r})})(),n)}async getAuth(e,t){let n=mr(t?.signal),r=typeof e==`string`?e:e.provider,i=this.providers.get(r);if(!i)return;let a=await xr(i,this.credentials,this.authContext,{...t,signal:n});return!a||typeof e==`string`||!e.headers?a:{...a,auth:{...a.auth,headers:Yr(a.auth.headers,e.headers)}}}async login(e,t,n){let r=mr(n.signal);r.throwIfAborted();let i=this.providers.get(e);if(!i)throw new yr(`provider`,`Unknown provider: ${e}`);let a=t===`oauth`?i.auth.oauth:i.auth.apiKey;if(!a?.login)throw new yr(`auth`,`${i.name} does not support ${t} login`);let o=await hr(a.login({...n,signal:r}),r),s=!1,c,l=new Promise(e=>{c=e}),u=this.credentials.modify(e,async()=>(s=!0,c?.(),o),{signal:r});u.catch(()=>{});try{await new Promise((e,t)=>{let n=()=>{s||t(r.reason)};r.addEventListener(`abort`,n,{once:!0}),Promise.race([l,u]).then(()=>{r.removeEventListener(`abort`,n),e()},e=>{r.removeEventListener(`abort`,n),t(e)}),r.aborted&&n()}),await u}catch(t){throw r.throwIfAborted(),new yr(`auth`,`Credential store modify failed for ${e}`,{cause:t})}return o}async logout(e,t){let n=mr(t?.signal);n.throwIfAborted();try{await this.credentials.delete(e,{signal:n})}catch(t){throw n.throwIfAborted(),new yr(`auth`,`Credential store delete failed for ${e}`,{cause:t})}}requireProvider(e){let t=this.providers.get(e.provider);if(!t)throw new yr(`provider`,`Unknown provider: ${e.provider}`);return t}async applyAuth(e,t){this.requireProvider(e);let n=await this.getAuth(e,{apiKey:t?.apiKey,env:t?.env,signal:t?.signal});if(!n)throw new yr(`auth`,`Provider is not configured: ${e.provider}`);let r=n.auth,i=t?.apiKey??r.apiKey,a=Yr(r.headers,t?.headers);t?.transformHeaders&&(a=await t.transformHeaders(a??{}));let o=n.env||t?.env?{...n.env??{},...t?.env??{}}:void 0,s=r.baseUrl?{...e,baseUrl:r.baseUrl}:e,{transformHeaders:c,...l}=t??{};return{requestModel:s,requestOptions:{...l,apiKey:i,headers:a,env:o}}}stream(e,t,n){let r=Pr(t);return sr(e,async()=>{let t=this.requireProvider(e),{requestModel:i,requestOptions:a}=await this.applyAuth(e,n);return t.stream(i,r,a)})}async complete(e,t,n){return this.stream(e,t,n).result()}streamSimple(e,t,n){let r=Pr(t);return sr(e,async()=>{let t=this.requireProvider(e),{requestModel:i,requestOptions:a}=await this.applyAuth(e,n);return t.streamSimple(i,r,a)})}async completeSimple(e,t,n){return this.streamSimple(e,t,n).result()}streamDeferred(e,t,n){return sr(e,async()=>{let r=this.requireProvider(e);if(!r.fetchDeferred)throw new yr(`provider`,`Provider ${e.provider} does not support deferred responses`);let{requestModel:i,requestOptions:a}=await this.applyAuth(e,n);return r.fetchDeferred(i,t,a)})}async fetchDeferred(e,t,n){return this.streamDeferred(e,t,n).result()}async cancelDeferred(e,t,n){let r=this.requireProvider(e);if(!r.cancelDeferred)throw new yr(`provider`,`Provider ${e.provider} does not support deferred responses`);let{requestModel:i,requestOptions:a}=await this.applyAuth(e,n);await r.cancelDeferred(i,t,a)}};function Zr(e){return new Xr(e)}function Qr(e){let t=e.models,n=[],r=e.fetchModels,i=()=>{let e=[...t];for(let t of n){let n=e.findIndex(e=>e.id===t.id);n>=0?e[n]=t:e.push(t)}return e},a=typeof e.api.stream==`function`?e.api:void 0,o=a?void 0:e.api,s=e=>a??o?.[e.api],c=(t,n)=>{let r=s(t);return r?n(r):sr(t,async()=>{throw new yr(`stream`,`Provider ${e.id} has no API implementation for "${t.api}"`)})},l={id:e.id,name:e.name??e.id,baseUrl:e.baseUrl,headers:e.headers,auth:e.auth,getModels:i,refreshModels:r?async t=>{if(t.stored){let r=t.stored.models.filter(t=>t.provider===e.id).map(e=>e);if(!await t.publish({update:()=>{n=r}}))return}if(!t.allowNetwork||t.signal.aborted)return;let i=await r(t);t.signal.aborted||await t.publish({persist:{models:i,checkedAt:Date.now()},update:()=>{n=i}})}:void 0,filterModels:e.filterModels,stream:(e,t,n)=>c(e,r=>r.stream(e,t,n)),streamSimple:(e,t,n)=>c(e,r=>r.streamSimple(e,t,n))},u=a?[a]:Object.values(o??{}).filter(e=>e!==void 0);return u.some(e=>e.fetchDeferred!==void 0)&&(l.fetchDeferred=(t,n,r)=>sr(t,async()=>{let i=s(t);if(!i?.fetchDeferred)throw new yr(`provider`,`Provider ${e.id} does not support deferred responses for "${t.api}"`);return i.fetchDeferred(t,n,r)})),u.some(e=>e.cancelDeferred!==void 0)&&(l.cancelDeferred=async(t,n,r)=>{let i=s(t);if(!i?.cancelDeferred)throw new yr(`provider`,`Provider ${e.id} cannot cancel deferred responses for "${t.api}"`);await i.cancelDeferred(t,n,r)}),l}function $r(e,t){let n=t.input+t.cacheRead+t.cacheWrite,r=e.cost,i=-1;for(let t of e.cost.tiers??[])n>t.inputTokensAbove&&t.inputTokensAbove>i&&(r=t,i=t.inputTokensAbove);let a=t.cacheWrite1h??0,o=t.cacheWrite-a;return t.cost.input=r.input/1e6*t.input,t.cost.output=r.output/1e6*t.output,t.cost.cacheRead=r.cacheRead/1e6*t.cacheRead,t.cost.cacheWrite=(r.cacheWrite*o+r.input*2*a)/1e6,t.cost.total=t.cost.input+t.cost.output+t.cost.cacheRead+t.cost.cacheWrite,t.cost}var ei=[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`,`max`];function ti(e){return e.reasoning?ei.filter(t=>{let n=e.thinkingLevelMap?.[t];return n===null?!1:t===`xhigh`||t===`max`?n!==void 0:!0}):[`off`]}function ni(e,t){let n=ti(e);if(n.includes(t))return t;let r=ei.indexOf(t);if(r===-1)return n[0]??`off`;for(let e=r;e<ei.length;e++){let t=ei[e];if(n.includes(t))return t}for(let e=r-1;e>=0;e--){let t=ei[e];if(n.includes(t))return t}return n[0]??`off`}var ri=[`top`,`right`,`bottom`,`left`],ii=[`start`,`end`],ai=ri.reduce((e,t)=>e.concat(t,t+`-`+ii[0],t+`-`+ii[1]),[]),oi=Math.min,si=Math.max,ci=Math.round,li=Math.floor,ui=e=>({x:e,y:e}),dee={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function di(e,t,n){return si(e,oi(t,n))}function fi(e,t){return typeof e==`function`?e(t):e}function pi(e){return e.split(`-`)[0]}function mi(e){return e.split(`-`)[1]}function hi(e){return e===`x`?`y`:`x`}function gi(e){return e===`y`?`height`:`width`}function _i(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function vi(e){return hi(_i(e))}function yi(e,t,n){n===void 0&&(n=!1);let r=mi(e),i=vi(e),a=gi(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=Di(o)),[o,Di(o)]}function fee(e){let t=Di(e);return[bi(e),t,bi(t)]}function bi(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var xi=[`left`,`right`],Si=[`right`,`left`],Ci=[`top`,`bottom`],wi=[`bottom`,`top`];function Ti(e,t,n){switch(e){case`top`:case`bottom`:return n?t?Si:xi:t?xi:Si;case`left`:case`right`:return t?Ci:wi;default:return[]}}function Ei(e,t,n,r){let i=mi(e),a=Ti(pi(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(bi)))),a}function Di(e){let t=pi(e);return dee[t]+e.slice(t.length)}function Oi(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function ki(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:Oi(e)}function Ai(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function ji(e,t,n){let{reference:r,floating:i}=e,a=_i(t),o=vi(t),s=gi(o),c=pi(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}let m=mi(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function Mi(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=fi(t,e),p=ki(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=Ai(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=Ai(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var Ni=50,Pi=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:Mi},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=ji(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<Ni&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=ji(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},Fi=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=fi(e,t)||{};if(l==null)return{};let d=ki(u),f={x:n,y:r},p=vi(i),m=gi(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,ee=oi(d[_],T),E=oi(d[v],T),D=C-h[m]-E,te=C/2-h[m]/2+w,ne=di(ee,te,D),re=!c.arrow&&mi(i)!=null&&te!==ne&&a.reference[m]/2-(te<ee?ee:E)-h[m]/2<0,ie=re?te<ee?te-ee:te-D:0;return{[p]:f[p]+ie,data:{[p]:ne,centerOffset:te-ne-ie,...re&&{alignmentOffset:ie}},reset:re}}});function Ii(e,t,n){return(e?[...n.filter(t=>mi(t)===e),...n.filter(t=>mi(t)!==e)]:n.filter(e=>pi(e)===e)).filter(n=>!e||mi(n)===e||(t?bi(n)!==n:!1))}var Li=function(e){return e===void 0&&(e={}),{name:`autoPlacement`,options:e,async fn(t){let{rects:n,middlewareData:r,placement:i,platform:a,elements:o}=t,{crossAxis:s=!1,alignment:c,allowedPlacements:l=ai,autoAlignment:u=!0,...d}=fi(e,t),f=c!==void 0||l===ai?Ii(c||null,u,l):l,p=r.autoPlacement?.index||0,m=f[p];if(m==null)return{};if(i!==m)return{reset:{placement:f[0]}};let h=await a.detectOverflow(t,d),g=yi(m,n,await(a.isRTL==null?void 0:a.isRTL(o.floating))),_=[h[pi(m)],h[g[0]],h[g[1]]],v=[...r.autoPlacement?.overflows||[],{placement:m,overflows:_}],y=f[p+1];if(y)return{data:{index:p+1,overflows:v},reset:{placement:y}};let b=v.map(e=>{let t=mi(e.placement);return[e.placement,t&&s?e.overflows.slice(0,2).reduce((e,t)=>e+t,0):e.overflows[0],e.overflows]}).sort((e,t)=>e[1]-t[1]),x=b.filter(e=>e[2].slice(0,mi(e[0])?2:3).every(e=>e<=0))[0]?.[0]||b[0][0];return x===i?{}:{data:{index:p+1,overflows:v},reset:{placement:x}}}}},Ri=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=fi(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=pi(r),_=_i(o),v=pi(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[Di(o)]:fee(o)),x=p!==`none`;!d&&x&&b.push(...Ei(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=yi(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(u!==`alignment`||_===_i(t)||T.every(e=>_i(e.placement)!==_||e.overflows[0]>0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=_i(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o}if(r!==n)return{reset:{placement:n}}}return{}}}};function zi(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Bi(e){return ri.some(t=>e[t]>=0)}var Vi=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=fi(e,t);switch(i){case`referenceHidden`:{let e=zi(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:Bi(e)}}}case`escaped`:{let e=zi(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:Bi(e)}}}default:return{}}}}},Hi=new Set([`left`,`top`]);async function Ui(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=pi(n),s=mi(n),c=_i(n)===`y`,l=Hi.has(o)?-1:1,u=a&&c?-1:1,d=fi(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var Wi=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await Ui(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},Gi=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=fi(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=_i(i),p=hi(f),m=u[p],h=u[f],g=(e,t)=>di(t+d[e===`y`?`top`:`left`],t,t-d[e===`y`?`bottom`:`right`]);o&&(m=g(p,m)),s&&(h=g(f,h));let _=c.fn({...t,[p]:m,[f]:h});return{..._,data:{x:_.x-n,y:_.y-r,enabled:{[p]:o,[f]:s}}}}}},Ki=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=fi(e,t),u={x:n,y:r},d=_i(i),f=hi(d),p=u[f],m=u[d],h=fi(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:h.mainAxis??0,crossAxis:h.crossAxis??0};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=Hi.has(pi(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},qi=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){let{placement:n,rects:r,platform:i,elements:a}=t,{apply:o=()=>{},...s}=fi(e,t),c=await i.detectOverflow(t,s),l=pi(n),u=mi(n),d=_i(n)===`y`,{width:f,height:p}=r.floating,m,h;l===`top`||l===`bottom`?(m=l,h=u===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?`start`:`end`)?`left`:`right`):(h=l,m=u===`end`?`top`:`bottom`);let g=p-c.top-c.bottom,_=f-c.left-c.right,v=oi(p-c[m],g),y=oi(f-c[h],_),b=t.middlewareData.shift,x=!b,S=v,C=y;b!=null&&b.enabled.x&&(C=_),b!=null&&b.enabled.y&&(S=g),x&&!u&&(d?C=f-2*si(c.left,c.right):S=p-2*si(c.top,c.bottom)),await o({...t,availableWidth:C,availableHeight:S});let w=await i.getDimensions(a.floating);return f!==w.width||p!==w.height?{reset:{rects:!0}}:{}}}};function Ji(){return typeof window<`u`}function Yi(e){return Qi(e)?(e.nodeName||``).toLowerCase():`#document`}function Xi(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Zi(e){return((Qi(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function Qi(e){return Ji()?e instanceof Node||e instanceof Xi(e).Node:!1}function $i(e){return Ji()?e instanceof Element||e instanceof Xi(e).Element:!1}function ea(e){return Ji()?e instanceof HTMLElement||e instanceof Xi(e).HTMLElement:!1}function ta(e){return!Ji()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof Xi(e).ShadowRoot}function na(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=pa(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function ra(e){return/^(table|td|th)$/.test(Yi(e))}function ia(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var aa=/transform|translate|scale|rotate|perspective|filter/,oa=/paint|layout|strict|content/,sa=e=>!!e&&e!==`none`,ca;function la(e){let t=$i(e)?pa(e):e;return sa(t.transform)||sa(t.translate)||sa(t.scale)||sa(t.rotate)||sa(t.perspective)||!da()&&(sa(t.backdropFilter)||sa(t.filter))||aa.test(t.willChange||``)||oa.test(t.contain||``)}function ua(e){let t=ha(e);for(;ea(t)&&!fa(t);){if(la(t))return t;if(ia(t))return null;t=ha(t)}return null}function da(){return ca??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),ca}function fa(e){return/^(html|body|#document)$/.test(Yi(e))}function pa(e){return Xi(e).getComputedStyle(e)}function ma(e){return $i(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function ha(e){if(Yi(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||ta(e)&&e.host||Zi(e);return ta(t)?t.host:t}function ga(e){let t=ha(e);return fa(t)?(e.ownerDocument||e).body:ea(t)&&na(t)?t:ga(t)}function _a(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=ga(e),i=r===e.ownerDocument?.body,a=Xi(r);if(i){let e=va(a);return t.concat(a,a.visualViewport||[],na(r)?r:[],e&&n?_a(e):[])}return t.concat(r,_a(r,[],n))}function va(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function ya(e){let t=pa(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=ea(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=ci(n)!==a||ci(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function ba(e){return $i(e)?e:e.contextElement}function xa(e){let t=ba(e);if(!ea(t))return ui(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=ya(t),o=(a?ci(n.width):n.width)/r,s=(a?ci(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var Sa=ui(0);function Ca(e){let t=Xi(e);return!da()||!t.visualViewport?Sa:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function wa(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===Xi(e)}function Ta(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=ba(e),o=ui(1);t&&(r?$i(r)&&(o=xa(r)):o=xa(e));let s=wa(a,n,r)?Ca(a):ui(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a&&r){let e=Xi(a),t=$i(r)?Xi(r):r,n=e,i=va(n);for(;i&&t!==n;){let e=xa(i),t=i.getBoundingClientRect(),r=pa(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=Xi(i),i=va(n)}}return Ai({width:u,height:d,x:c,y:l})}function Ea(e,t){let n=ma(e).scrollLeft;return t?t.left+n:Ta(Zi(e)).left+n}function Da(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-Ea(e,n),y:n.top+t.scrollTop}}function Oa(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=Zi(r),s=t?ia(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=ui(1),u=ui(0),d=ea(r);if((d||!a)&&((Yi(r)!==`body`||na(o))&&(c=ma(r)),d)){let e=Ta(r);l=xa(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?Da(o,c):ui(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function ka(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function Aa(e){let t=ma(e),n=e.ownerDocument.body,r=si(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=si(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+Ea(e),o=-t.scrollTop;return pa(n).direction===`rtl`&&(a+=si(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var ja=25;function Ma(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=Xi(e),a=Zi(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!da()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(Ea(a)<=0){let e=a.ownerDocument,t=e.body,n=getComputedStyle(t),r=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,i=Math.abs(a.clientWidth-t.clientWidth-r),o=getComputedStyle(a).scrollbarGutter===`stable both-edges`?i/2:i;o<=ja&&(s-=o)}return{width:s,height:c,x:l,y:u}}function Na(e,t){let n=Ta(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=xa(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function Pa(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=Ma(e,n,t);else if(t===`document`)r=Aa(Zi(e));else if($i(t))r=Na(t,n);else{let n=Ca(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return Ai(r)}function Fa(e,t){let n=t.get(e);if(n)return n;let r=_a(e,[],!1).filter(e=>$i(e)&&Yi(e)!==`body`),i=null,a=pa(e).position===`fixed`,o=a?ha(e):e;for(;$i(o)&&!fa(o);){let e=pa(o),t=la(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=ha(o)}return t.set(e,r),r}function Ia(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?ia(t)?[]:Fa(t,this._c):[].concat(n),r],o=Pa(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=Pa(t,a[e],i);s=si(n.top,s),c=oi(n.right,c),l=oi(n.bottom,l),u=si(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function La(e){let{width:t,height:n}=ya(e);return{width:t,height:n}}function Ra(e,t,n){let r=ea(t),i=Zi(t),a=n===`fixed`,o=Ta(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=ui(0);if((r||!a)&&((Yi(t)!==`body`||na(i))&&(s=ma(t)),r)){let e=Ta(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=Ea(i));let l=i&&!r&&!a?Da(i,s):ui(0);return{x:o.left+s.scrollLeft-c.x-l.x,y:o.top+s.scrollTop-c.y-l.y,width:o.width,height:o.height}}function za(e){return pa(e).position===`static`}function Ba(e,t){if(!ea(e)||pa(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return Zi(e)===n&&(n=n.ownerDocument.body),n}function Va(e,t){let n=Xi(e);if(ia(e))return n;if(!ea(e)){let t=ha(e);for(;t&&!fa(t);){if($i(t)&&!za(t))return t;t=ha(t)}return n}let r=Ba(e,t);for(;r&&ra(r)&&za(r);)r=Ba(r,t);return r&&fa(r)&&za(r)&&!la(r)?n:r||ua(e)||n}var Ha=async function(e){let t=this.getOffsetParent||Va,n=this.getDimensions,r=await n(e.floating);return{reference:Ra(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Ua(e){return pa(e).direction===`rtl`}var Wa={convertOffsetParentRelativeRectToViewportRelativeRect:Oa,getDocumentElement:Zi,getClippingRect:Ia,getOffsetParent:Va,getElementRects:Ha,getClientRects:ka,getDimensions:La,getScale:xa,isElement:$i,isRTL:Ua};function Ga(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Ka(e,t,n){let r=null,i,a=Zi(e);function o(){var e;clearTimeout(i),(e=r)==null||e.disconnect(),r=null}function s(n,c){n===void 0&&(n=!1),c===void 0&&(c=1),o();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(n||t(),!f||!p)return;let m=li(d),h=li(a.clientWidth-(u+f)),g=li(a.clientHeight-(d+p)),_=li(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:si(0,oi(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!Ga(l,e.getBoundingClientRect()))return s();if(n!==c){if(!y)return s();n?s(!1,n):i=setTimeout(()=>{s(!1,1e-7)},1e3)}y=!1}try{r=new IntersectionObserver(b,{...v,root:a.ownerDocument})}catch{r=new IntersectionObserver(b,v)}r.observe(e)}let c=Xi(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function qa(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=ba(e),u=i||a?[...l?_a(l):[],...t?_a(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?Ka(l,n,a):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?Ta(e):null;c&&g();function g(){let t=Ta(e);h&&!Ga(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var Ja=Wi,Ya=Li,Xa=Gi,Za=Ri,Qa=qi,$a=Vi,eo=Fi,to=Ki,no=(e,t,n)=>{let r=new Map,i=n??{},a={...Wa,...i.platform,_c:r};return Pi(e,t,{...i,platform:a})},ro=[`auto`,`top`,`bottom`,`left`,`right`].reduce((e,t)=>e.concat([t,`${t}-start`,`${t}-end`]),[]),io={targetNodes:{type:Function,required:!0},referenceNode:{type:Function,default:null},popperNode:{type:Function,required:!0},shown:{type:Boolean,default:!1},ariaId:{default:null},delay:{type:[String,Number,Object],default:0},triggers:{type:Array,default:()=>[]},showTriggers:{type:[Array,Function],default:void 0},hideTriggers:{type:[Array,Function],default:void 0},popperShowTriggers:{type:[Array,Function],default:void 0},popperHideTriggers:{type:[Array,Function],default:void 0},autoHide:{type:[Boolean,Function],default:!1},handleResize:{type:Boolean,default:!1},eagerMount:{type:Boolean,default:!1},popperClass:{type:[String,Array,Object],default:void 0},noAutoFocus:{type:Boolean,default:!1},disabled:{type:Boolean,default:void 0},placement:{type:String,validator:e=>ro.includes(e),default:void 0},distance:{type:[Number,String],default:void 0},skidding:{type:[Number,String],default:void 0},popperTriggers:{type:Array,default:void 0},container:{type:[String,Object,Boolean],default:void 0},boundary:{type:[String,Object],default:void 0},strategy:{type:String,validator:e=>[`absolute`,`fixed`].includes(e),default:void 0},instantMove:{type:Boolean,default:void 0},preventOverflow:{type:Boolean,default:void 0},overflowPadding:{type:[Number,String],default:void 0},arrowPadding:{type:[Number,String],default:void 0},noArrow:{type:Boolean,default:void 0},flip:{type:Boolean,default:void 0},shift:{type:Boolean,default:void 0},shiftCrossAxis:{type:Boolean,default:void 0},disposeTimeout:{type:Number,default:void 0}},ao={show:()=>!0,hide:()=>!0,"update:shown":e=>!0,"apply-show":()=>!0,"apply-hide":()=>!0,"close-directive":()=>!0,"auto-hide":()=>!0,resize:()=>!0},oo=Object.freeze({disabled:!1,placement:`bottom`,distance:5,skidding:0,container:`body`,boundary:void 0,instantMove:!1,disposeTimeout:150,popperTriggers:[],strategy:`absolute`,preventOverflow:!0,flip:!0,shift:!0,shiftCrossAxis:!1,overflowPadding:0,arrowPadding:0,noArrow:!1,autoHideOnMousedown:!1});function so(){return nt()?.appContext.provides.$_vueAfloatGlobalOptions??{}}function co(e){let t={};if(!e)return t;for(let n in e)e[n]!==void 0&&(t[n]=e[n]);return t}function lo(e,t=so()){return Object.assign({},oo,co(t),co(e))}var uo={hover:`mouseenter`,focus:`focus`,click:`click`,touch:`touchstart`,pointer:`pointerdown`},fo={hover:`mouseleave`,focus:`blur`,click:`click`,touch:`touchend`,pointer:`pointerup`};function po(){return new Promise(e=>requestAnimationFrame(()=>{requestAnimationFrame(e)}))}var mo=0,ho=0,go=0,_o=0,vo=0;function yo(e){mo=go,ho=_o,go=e.clientX,_o=e.clientY}function bo(){vo++,vo===1&&window.addEventListener(`mousemove`,yo,{passive:!0})}function xo(){vo--,vo===0&&window.removeEventListener(`mousemove`,yo)}function So(e,t){let n=e.getBoundingClientRect();if(go>=n.left&&go<=n.right&&_o>=n.top&&_o<=n.bottom){let e=t.getBoundingClientRect(),n=go-mo,r=_o-ho,i=e.left+e.width/2-mo+(e.top+e.height/2)-ho+e.width+e.height,a=mo+n*i,o=ho+r*i;return Co(mo,ho,a,o,e.left,e.top,e.left,e.bottom)||Co(mo,ho,a,o,e.left,e.top,e.right,e.top)||Co(mo,ho,a,o,e.right,e.top,e.right,e.bottom)||Co(mo,ho,a,o,e.left,e.bottom,e.right,e.bottom)}return!1}function Co(e,t,n,r,i,a,o,s){let c=((o-i)*(t-a)-(s-a)*(e-i))/((s-a)*(n-e)-(o-i)*(r-t)),l=((n-e)*(t-a)-(r-t)*(e-i))/((s-a)*(n-e)-(o-i)*(r-t));return c>=0&&c<=1&&l>=0&&l<=1}var wo=typeof window<`u`&&typeof navigator<`u`&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,To=null,Eo=0;function Do(){return Eo++,To||=Ao(),To}function Oo(){Eo--,Eo===0&&To&&(To.dispose(),To=null)}function ko(){if(To)for(let e of To.shownPoppers)e.computePosition()}function Ao(){let e=new Set,t=new Map;function n(){for(let t of e)if(t.options.value.autoHideOnMousedown)return!0;return!1}function r(t,r){if(n())a(t,r);else{let n=t.composedPath();for(let t of e)try{t.mouseDownContains=n.includes(t.popperNode())}catch{}}}function i(e,t){n()||a(e,t)}function a(t,n){let r={},i=t.composedPath(),a=[...e].reverse();for(let e of a)try{let o=Array.from(e.shownChildren).some(e=>{let t=a.find(t=>t.randomId===e);return t&&i.includes(t.popperNode())}),s=e.containsGlobalTarget=e.mouseDownContains||i.includes(e.popperNode())||o;e.pendingHide=!1,requestAnimationFrame(()=>{if(e.pendingHide=!1,!r[e.randomId]&&jo(e,s,t)){if(e.handleGlobalClose(t,n),!t.closeAllPopover&&t.closePopover&&s){let t=e.parentPopper;for(;t;)r[t.randomId]=!0,t=t.parentPopper;return}let i=e.parentPopper;for(;i&&jo(i,i.containsGlobalTarget,t);)i.handleGlobalClose(t,n),i=i.parentPopper}})}catch{}}let o=e=>r(e,!1),s=e=>i(e,!1),c=e=>r(e,!0),l=e=>i(e,!0);if(wo){let e={passive:!0,capture:!0};document.addEventListener(`touchstart`,c,e),document.addEventListener(`touchend`,l,e)}else window.addEventListener(`mousedown`,o,!0),window.addEventListener(`click`,s,!0);window.addEventListener(`resize`,ko);function u(e){let t=e.popperNode().getRootNode();return t instanceof ShadowRoot?t.host:document.body}function d(e){e&&![...t.values()].includes(e)&&e.classList.remove(`vue-afloat--some-open`)}let f={shownPoppers:e,hidingPopper:null,markShown(n){e.add(n);let r=t.get(n),i=u(n);t.set(n,i),d(r),i.classList.add(`vue-afloat--some-open`)},markHidden(n){e.delete(n);let r=t.get(n);t.delete(n),d(r),f.hidingPopper===n&&(f.hidingPopper=null)},dispose(){wo?(document.removeEventListener(`touchstart`,c,{capture:!0}),document.removeEventListener(`touchend`,l,{capture:!0})):(window.removeEventListener(`mousedown`,o,!0),window.removeEventListener(`click`,s,!0)),window.removeEventListener(`resize`,ko)}};return f}function jo(e,t,n){return n.closeAllPopover||n.closePopover&&t||Mo(e,n)&&!t}function Mo(e,t){if(typeof e.autoHide==`function`){let n=e.autoHide(t);return e.lastAutoHide=n,n}return e.autoHide}function No(e,t){let n=[],r={strategy:e.strategy,middleware:n},i=e.boundary;(e.distance||e.skidding)&&n.push(Ja({mainAxis:e.distance,crossAxis:e.skidding}));let a=e.placement.startsWith(`auto`);return a?n.push(Ya({alignment:e.placement.split(`-`)[1]??``})):r.placement=e.placement,e.preventOverflow&&(e.shift&&n.push(Xa({padding:e.overflowPadding,boundary:i,crossAxis:e.shiftCrossAxis})),!a&&e.flip&&n.push(Za({padding:e.overflowPadding,boundary:i}))),n.push(eo({element:t,padding:e.arrowPadding})),r}var Po=class{entries=[];add(e,t,n){this.entries.push({targetNodes:e,eventType:t,handler:n});for(let r of e)r.addEventListener(t,n,{passive:!0})}addTriggers(e,t,n,r,i){let a=n;r!=null&&(a=typeof r==`function`?r(a):r);for(let n of a){let r=t[n];r&&this.add(e,r,i)}}remove(e){this.entries=this.entries.filter(t=>{if(!e||e===t.eventType){for(let e of t.targetNodes)e.removeEventListener(t.eventType,t.handler);return!1}return!0})}},Fo=`__floating-vue__popper`;function Io(e,t){let n=nt(),r=so(),i=P(()=>lo(e,r)),a=Ne(!1),o=Ne(!1),s=Ne(!1),c=Pe({showFrom:!1,showTo:!1,hideFrom:!1,hideTo:!0}),l=Pe({x:0,y:0,placement:``,strategy:i.value.strategy,arrow:{x:0,y:0,centerOffset:0}}),u=Ne(!0),d=`popper_${[Math.random(),Date.now()].map(e=>e.toString(36).substring(2,10)).join(`_`)}`,f=new Set,p=!0,m=!1,h=!1,g=!1,v,y,b,x=[],S,C,w=new Po,T=null,ee=!1,E=tn(Fo,null)?.parentPopper??null,D={randomId:d,options:i,get autoHide(){return e.autoHide},parentPopper:E,lockedChild:null,lockedChildTimer:null,shownChildren:f,pendingHide:!1,mouseDownContains:!1,containsGlobalTarget:!1,get lastAutoHide(){return u.value},set lastAutoHide(e){u.value=e},popperNode:()=>e.popperNode(),hide:oe,applyHide:fe,computePosition:()=>{le()},handleGlobalClose:ye};Fe(Fo,{parentPopper:D});let te=P(()=>e.ariaId??d),ne=P(()=>e.eagerMount||o.value),re=P(()=>i.value.popperTriggers.includes(`hover`)||Array.isArray(e.popperShowTriggers)&&e.popperShowTriggers.includes(`hover`)),ie=P(()=>({popperId:te.value,isShown:a.value,shouldMountContent:ne.value,skipTransition:s.value,noArrow:i.value.noArrow,autoHide:typeof e.autoHide==`function`?u.value:e.autoHide,show:ae,hide:oe,handleResize:e.handleResize,onResize:O,classes:{...c,popperClass:e.popperClass},result:l}));function ae({skipDelay:e=!1,force:n=!1}={}){E?.lockedChild&&E.lockedChild!==D||(D.pendingHide=!1,(n||!i.value.disabled)&&(E?.lockedChild===D&&(E.lockedChild=null),k(e),t(`show`),h=!0,requestAnimationFrame(()=>{h=!1})),t(`update:shown`,!0))}function oe({skipDelay:e=!1}={}){if(!g){if(f.size>0){D.pendingHide=!0;return}if(re.value&&So(b,S)){E&&(E.lockedChild=D,E.lockedChildTimer&&clearTimeout(E.lockedChildTimer),E.lockedChildTimer=setTimeout(()=>{E.lockedChild===D&&(E.lockedChild.hide({skipDelay:e}),E.lockedChild=null)},1e3));return}E?.lockedChild===D&&(E.lockedChild=null),D.pendingHide=!1,ue(e),t(`hide`),t(`update:shown`,!1)}}function se(){p&&(p=!1,o.value=!1,m=!1,b=e.referenceNode?.()??n.proxy.$el,x=e.targetNodes().filter(e=>e.nodeType===e.ELEMENT_NODE),S=e.popperNode(),C=S.querySelector(`.vue-afloat__arrow-container`),be(`title`,`data-original-title`),M(),T=Do(),ve(),e.triggers.length&&he(),e.shown&&ae())}function ce(){p||(p=!0,w.remove(),oe({skipDelay:!0}),M(),o.value=!1,a.value=!1,N(!1),be(`data-original-title`,`title`),ve(),T&&=(Oo(),null))}async function O(){a.value&&(await le(),t(`resize`))}async function le(){if(p)return;let e=No(i.value,C),t=await no(b,S,e);Object.assign(l,{x:t.x,y:t.y,placement:t.placement,strategy:t.strategy,arrow:t.middlewareData.arrow})}function k(e=!1){N(!0),g=!1,clearTimeout(v);let t=T?.hidingPopper;if(t&&i.value.instantMove&&t.options.value.instantMove&&t!==E){t.applyHide(!0),j(!0);return}e?j():v=setTimeout(j,A(`show`))}function ue(e=!1){if(f.size>0){D.pendingHide=!0;return}N(!1),g=!0,clearTimeout(v),a.value&&T&&(T.hidingPopper=D),e?fe():v=setTimeout(fe,A(`hide`))}function A(t){let n=e.delay;return parseInt(n&&n[t]||n||0)}async function j(e=!1){clearTimeout(y),clearTimeout(v),s.value=e,!a.value&&(me(),await po(),await le(),await de(),w.add([..._a(b),..._a(S)],`scroll`,()=>{le()}))}async function de(){g||(a.value=!0,xe({"aria-describedby":te.value,"data-popper-shown":``}),T?.markShown(D),t(`apply-show`),c.showFrom=!0,c.showTo=!1,c.hideFrom=!1,c.hideTo=!1,await po(),c.showFrom=!1,c.showTo=!0,e.noAutoFocus||S.focus())}async function fe(e=!1){if(f.size>0){D.pendingHide=!0,g=!1;return}if(clearTimeout(v),!a.value)return;s.value=e,T?.markHidden(D),a.value=!1,xe({"aria-describedby":void 0,"data-popper-shown":void 0}),clearTimeout(y);let n=i.value.disposeTimeout;n!==null&&(y=setTimeout(()=>{S&&(M(),o.value=!1)},n)),w.remove(`scroll`),t(`apply-hide`),c.showFrom=!1,c.showTo=!1,c.hideFrom=!0,c.hideTo=!1,await po(),c.hideFrom=!1,c.hideTo=!0}function pe(){e.shown?ae():oe()}function me(){if(p)return;let e=i.value.container,t;if(typeof e==`string`){let n=b.getRootNode();t=n instanceof ShadowRoot?e===`body`?n:n.querySelector(e):b.ownerDocument.querySelector(e)}else t=e===!1?x[0].parentNode:e;if(!t)throw Error(`No container for popover: ${e}`);t.appendChild(S),o.value=!0}function he(){let t=e=>{(!a.value||g)&&(e.usedByTooltip=!0,!m&&ae({event:e}))};w.addTriggers(x,uo,e.triggers,e.showTriggers,t),w.addTriggers([S],uo,i.value.popperTriggers,e.popperShowTriggers,t);let n=e=>{e.usedByTooltip||oe({event:e})};w.addTriggers(x,fo,e.triggers,e.hideTriggers,n),w.addTriggers([S],fo,i.value.popperTriggers,e.popperHideTriggers,n)}function _e(){p||(w.remove(),he(),ve())}function ve(){let e=!p&&re.value;e!==ee&&(ee=e,e?bo():xo())}function ye(e,n){h||(oe({event:e}),e.closePopover?t(`close-directive`):t(`auto-hide`),n&&(m=!0,setTimeout(()=>{m=!1},300)))}function M(){S.parentNode&&S.parentNode.removeChild(S)}function be(e,t){for(let n of x){let r=n.getAttribute(e);r&&(n.removeAttribute(e),n.setAttribute(t,r))}}function xe(e){for(let t of x)for(let n in e){let r=e[n];r==null?t.removeAttribute(n):t.setAttribute(n,r)}}function N(e){let t=E;for(;t;)e?t.shownChildren.add(d):(t.shownChildren.delete(d),t.pendingHide&&t.hide()),t=t.parentPopper}return Nt(()=>e.shown,pe),Nt(()=>i.value.disabled,e=>{e?ce():se()}),Nt(()=>i.value.container,async()=>{a.value&&(me(),T?.markShown(D),await le())}),Nt(()=>e.triggers,_e,{deep:!0}),Nt(i,()=>le()),ge(()=>{se(),M()}),_(pe),vt(()=>{oe()}),xt(ce),{show:ae,hide:oe,dispose:ce,onResize:O,slotData:ie}}var Lo=F({name:`VPopperRoot`,props:io,emits:ao,setup(e,{emit:t,slots:n,expose:r}){let{show:i,hide:a,dispose:o,onResize:s,slotData:c}=Io(e,t);return r({show:i,hide:a,dispose:o,onResize:s}),()=>at(`div`,{ref:`reference`,class:[`vue-afloat`,{"vue-afloat--shown":c.value.isShown}]},n.default?.(c.value))}}),Ro=F({name:`VPopperContent`,props:{popperId:String,shown:Boolean,mounted:Boolean,skipTransition:Boolean,noArrow:Boolean,autoHide:Boolean,handleResize:Boolean,classes:{type:Object,required:!0},result:{type:Object,required:!0}},emits:[`hide`,`resize`],setup(e,{emit:t,slots:n}){let r=Ne(),i;ge(()=>{e.handleResize&&(i=new ResizeObserver(()=>t(`resize`)),i.observe(r.value))}),xt(()=>{i?.disconnect()});function a(e){return e!=null&&!Number.isNaN(e)?`${e}px`:null}return()=>{let{autoHide:i,classes:o,result:s,shown:c}=e,l=s.placement.split(`-`)[0];return at(`div`,{id:e.popperId,ref:`popover`,"data-allow-mismatch":``,class:[`vue-afloat`,`vue-afloat--${l}`,o.popperClass,{"vue-afloat--shown":c,"vue-afloat--hidden":!c,"vue-afloat--show-from":o.showFrom,"vue-afloat--show-to":o.showTo,"vue-afloat--hide-from":o.hideFrom,"vue-afloat--hide-to":o.hideTo,"vue-afloat--skip-transition":e.skipTransition,"vue-afloat--no-arrow":e.noArrow}],style:{position:s.strategy,transform:`translate3d(${Math.round(s.x)}px,${Math.round(s.y)}px,0)`},"aria-hidden":c||i?`false`:`true`,tabindex:i?0:void 0,"data-popper-placement":s.placement,onKeyup:e=>{e.key===`Escape`&&i&&t(`hide`)}},[at(`div`,{class:`vue-afloat__backdrop`,onClick:()=>i&&t(`hide`)}),at(`div`,{class:`vue-afloat__wrapper`},[at(`div`,{ref:r,class:`vue-afloat__inner`},e.mounted?[at(`div`,n.default?.())]:void 0),at(`div`,{ref:`arrow`,class:`vue-afloat__arrow-container`,style:{left:a(s.arrow.x),top:a(s.arrow.y)}},[at(`div`,{class:`vue-afloat__arrow-outer`}),at(`div`,{class:`vue-afloat__arrow-inner`})])])])}}}),zo=new Set([`targetNodes`,`popperNode`]);function Bo(e){let t={};for(let n in io){if(zo.has(n))continue;let r=io[n];t[n]=n in e?{...r,default:e[n]}:r}return t}function Vo(e,t,n={}){return F({name:e,props:Bo(n),emits:ao,setup(e,{emit:n,slots:r,expose:i}){let a,o;function s(){return Array.from(a.$el.children).filter(e=>e!==o.$el)}return i({show:(...e)=>a.show(...e),hide:(...e)=>a.hide(...e),dispose:()=>a.dispose(),onResize:()=>a.onResize()}),()=>at(Lo,{ref:e=>{a=e},...e,targetNodes:s,popperNode:()=>o.$el,class:t,onShow:()=>n(`show`),onHide:()=>n(`hide`),"onUpdate:shown":e=>n(`update:shown`,e),onApplyShow:()=>n(`apply-show`),onApplyHide:()=>n(`apply-hide`),onCloseDirective:()=>n(`close-directive`),onAutoHide:()=>n(`auto-hide`),onResize:()=>n(`resize`)},{default:({popperId:e,isShown:n,shouldMountContent:i,skipTransition:a,noArrow:s,autoHide:c,show:l,hide:u,handleResize:d,onResize:f,classes:p,result:m})=>[r.default?.({shown:n,show:l,hide:u}),at(Ro,{ref:e=>{o=e},class:t,popperId:e,shown:n,mounted:i,skipTransition:a,noArrow:s,autoHide:c,handleResize:d,classes:p,result:m,onHide:u,onResize:f},{default:()=>r.popper?.({shown:n,hide:u})})]})}})}Vo(`VDropdown`,`vue-afloat-dropdown`,{placement:`bottom`,triggers:()=>[`click`],delay:0,handleResize:!0,autoHide:!0}),Vo(`VMenu`,`vue-afloat-menu`,{placement:`bottom`,triggers:()=>[`hover`,`focus`],popperTriggers:()=>[`hover`],delay:()=>({show:0,hide:400}),handleResize:!0,autoHide:!0,noArrow:!0}),Vo(`VTooltip`,`vue-afloat-tooltip`,{placement:`top`,triggers:()=>[`hover`,`focus`,`touch`],hideTriggers:()=>e=>[...e,`click`],delay:()=>({show:200,hide:0})});function Ho(){return F({name:`VPopper`,props:io,emits:ao,setup(e,{emit:t,slots:n,expose:r}){let{show:i,hide:a,dispose:o,onResize:s,slotData:c}=Io(e,t);return r({show:i,hide:a,dispose:o,onResize:s}),()=>n.default?.(c.value)}})}var Uo=Ho(),Wo=F({name:`VTooltipDirective`,inheritAttrs:!1,props:{html:{type:Boolean,default:!1},content:{type:[String,Number,Function],default:null},loadingContent:{type:String,default:`...`},targetNodes:{type:Function,required:!0}},setup(e,{attrs:t,expose:n}){let r=Ne(null),i=P(()=>typeof e.content==`function`),a=P(()=>i.value&&r.value==null),o=P(()=>i.value?a.value?e.loadingContent:r.value:e.content),s,c,l=!1,u=!1,d=0;function f(t=!1){if(typeof e.content==`function`&&l&&(t||!u&&r.value==null)){r.value=null,u=!0;let t=++d,n=e.content(e);n.then?n.then(e=>p(t,e)):p(t,n)}}function p(e,t){e===d&&(u=!1,r.value=t)}Nt(()=>e.content,()=>f(!0),{immediate:!0}),Nt(o,async()=>{await x(),s.onResize()});function m(){l=!0,f()}function h(){l=!1}return n({show:(...e)=>s.show(...e),hide:(...e)=>s.hide(...e),dispose:()=>s.dispose(),onResize:()=>s.onResize()}),()=>at(Uo,{ref:e=>{s=e},placement:`top`,triggers:[`hover`,`focus`,`touch`],hideTriggers:e=>[...e,`click`],delay:{show:200,hide:0},...t,targetNodes:e.targetNodes,popperNode:()=>c.$el,onApplyShow:m,onApplyHide:h},{default:({popperId:t,isShown:n,shouldMountContent:r,skipTransition:i,noArrow:s,autoHide:l,hide:u,handleResize:d,onResize:f,classes:p,result:m})=>at(Ro,{ref:e=>{c=e},class:[`vue-afloat-tooltip`,{"vue-afloat--tooltip-loading":a.value}],popperId:t,shown:n,mounted:r,skipTransition:i,noArrow:s,autoHide:l,handleResize:d,classes:p,result:m,onHide:u,onResize:f},{default:()=>e.html?at(`div`,{innerHTML:o.value}):at(`div`,{textContent:o.value})})})}}),Go=`vue-afloat--has-tooltip`;function Ko(e,t){let n=e.placement;if(!n&&t)for(let e of ro)t[e]&&(n=e);return n||=`top`,n}function qo(e,t,n){let r,i=typeof t;return r=i===`string`?{content:t}:t&&i===`object`?t:{content:!1},r.placement=Ko(r,n),r.targetNodes=()=>[e],r.referenceNode=()=>e,r}var Jo,Yo,Xo=0;function Zo(){if(Jo)return;Yo=Ne([]),Jo=ln({name:`VTooltipDirectiveApp`,setup(){return{directives:Yo}},render(){return this.directives.map(e=>{let t={...e.options,shown:e.shown||e.options.shown,key:e.id};return at(Wo,t)})},devtools:{hide:!0}});let e=document.createElement(`div`);Jo.mount(e)}function Qo(e,t,n){Zo();let r=Ne(qo(e,t,n)),i=Ne(!1),a={id:Xo++,options:r,shown:i};return Yo.value.push(a),e.classList&&e.classList.add(Go),e.$_vueAfloat={options:r,item:a,show(){i.value=!0},hide(){i.value=!1}}}function $o(e){if(e.$_vueAfloat){let t=Yo.value.indexOf(e.$_vueAfloat.item);t!==-1&&Yo.value.splice(t,1),delete e.$_vueAfloat,delete e.$_vueAfloatOldShown,delete e.$_vueAfloatMountTarget}e.classList&&e.classList.remove(Go)}function es(e,{value:t,modifiers:n}){let r=qo(e,t,n);if(!r.content||oo.disabled)$o(e);else{let i;e.$_vueAfloat?(i=e.$_vueAfloat,i.options.value=r):i=Qo(e,t,n);let a=typeof t==`object`?t.shown:void 0;a!==void 0&&a!==e.$_vueAfloatOldShown&&(e.$_vueAfloatOldShown=a,a?i.show():i.hide())}}var ts={beforeMount:es,updated:es,beforeUnmount(e){$o(e)}},ns=F({__name:`ActionIconButton`,props:{as:{},to:{},href:{},icon:{},tooltip:{},active:{type:Boolean},disabled:{type:Boolean},label:{},compact:{type:Boolean},activeClass:{}},setup(e){let t=e,n=P(()=>t.as?t.as:t.href!=null||t.to!=null?`a`:`button`),r=P(()=>n.value===`a`),a=P(()=>n.value===`button`),o=P(()=>t.compact?`btn-icon-compact`:`btn-icon`),s=P(()=>t.compact?`w-auto! h-auto! p-[0.25em]`:`w-auto! h-auto! p-[0.5em]`),c=P(()=>t.active?t.activeClass||`color-active bg-active op100`:``);return(t,l)=>$e((L(),Me(We(n.value),{type:a.value?`button`:void 0,class:Oe([o.value,s.value,c.value,{"pointer-events-none op-mute":e.disabled&&!a.value}]),href:r.value?e.href??e.to:void 0,to:e.as&&e.to!=null?e.to:void 0,disabled:a.value?e.disabled:void 0,"aria-disabled":e.disabled&&!a.value||void 0,"aria-label":e.label??e.tooltip,"aria-pressed":e.active||void 0},{default:I(()=>[e.icon?(L(),T(`span`,{key:0,class:Oe(e.icon),"aria-hidden":`true`},null,2)):Ie(``,!0),k(t.$slots,`default`),k(t.$slots,`badge`)]),_:3},8,[`type`,`class`,`href`,`to`,`disabled`,`aria-disabled`,`aria-label`,`aria-pressed`])),[[i(ts),e.tooltip??``]])}});function rs(e){return typeof e==`string`?`'${e}'`:new ss().serialize(e)}var is=` _-,;:!?.'"()[]{}@*/\\&#%\`^+<=>|~$0123456789abcdefghijklmnopqrstuvwxyz`,as=(function(){let e=new Uint8Array(128);for(let t=0;t<69;t++)e[is.charCodeAt(t)]=t+1;for(let t=65;t<=90;t++)e[t]=e[t+32];return e})();function os(e,t){if(e===t)return 0;let n=Math.min(e.length,t.length),r=0;for(let i=0;i<n;i++){let n=e.charCodeAt(i),a=t.charCodeAt(i);if(n===a)continue;let o=n<128&&as[n]?as[n]:n+128,s=a<128&&as[a]?as[a]:a+128;if(o!==s)return o<s?-1:1;r===0&&(r=n>a?-1:1)}return e.length===t.length?r:e.length<t.length?-1:1}var ss=(function(){class e{#e=new Map;compare(e,t){let n=typeof e,r=typeof t;return n===`string`&&r===`string`?os(e,t):n===`number`&&r===`number`?e-t:os(this.serialize(e,!0),this.serialize(t,!0))}serialize(e,t){if(e===null)return`null`;switch(typeof e){case`string`:return t?e:`'${e}'`;case`bigint`:return`${e}n`;case`object`:return this.$object(e);case`function`:return this.$function(e)}return String(e)}serializeObject(e){let t=Object.prototype.toString.call(e);if(t!==`[object Object]`)return this.serializeBuiltInType(t.length<10?`unknown:${t}`:t.slice(8,-1),e);let n=e.constructor,r=n===Object||n===void 0?``:n.name;if(r!==``&&globalThis[r]===n)return this.serializeBuiltInType(r,e);if(`toJSON`in e&&typeof e.toJSON==`function`){let t=e.toJSON();return r+(typeof t==`object`&&t?this.$object(t):`(${this.serialize(t)})`)}let i=Object.keys(e).sort(os),a=`${r}{`;for(let t=0;t<i.length;t++){let n=i[t];a+=`${n}:${this.serialize(e[n])}`,t<i.length-1&&(a+=`,`)}return a+`}`}serializeBuiltInType(e,t){let n=this[`$`+e];if(n)return n.call(this,t);if(typeof t.entries==`function`)return this.serializeObjectEntries(e,t.entries());throw Error(`Cannot serialize ${e}`)}serializeObjectEntries(e,t){let n=Array.from(t).sort((e,t)=>this.compare(e[0],t[0])),r=`${e}{`;for(let e=0;e<n.length;e++){let[t,i]=n[e];r+=`${this.serialize(t,!0)}:${this.serialize(i)}`,e<n.length-1&&(r+=`,`)}return r+`}`}$object(e){let t=this.#e.get(e);return t===void 0&&(this.#e.set(e,`#${this.#e.size}`),t=this.serializeObject(e),this.#e.set(e,t)),t}$function(e){let t=Function.prototype.toString.call(e);return t.slice(-15)===`[native code] }`?`${e.name||``}()[native]`:`${e.name}(${e.length})${t.replace(/\s*\n\s*/g,``)}`}$Array(e){let t=`[`;for(let n=0;n<e.length;n++)t+=this.serialize(e[n]),n<e.length-1&&(t+=`,`);return t+`]`}$Date(e){try{return`Date(${e.toISOString()})`}catch{return`Date(null)`}}$ArrayBuffer(e){return`ArrayBuffer[${new Uint8Array(e).join(`,`)}]`}$Set(e){return`Set${this.$Array(Array.from(e).sort((e,t)=>this.compare(e,t)))}`}$Map(e){return this.serializeObjectEntries(`Map`,e.entries())}}for(let t of[`Error`,`RegExp`,`URL`])e.prototype[`$`+t]=function(e){return`${t}(${e})`};for(let t of[`Int8Array`,`Uint8Array`,`Uint8ClampedArray`,`Int16Array`,`Uint16Array`,`Int32Array`,`Uint32Array`,`Float32Array`,`Float64Array`])e.prototype[`$`+t]=function(e){return`${t}[${e.join(`,`)}]`};for(let t of[`BigInt64Array`,`BigUint64Array`])e.prototype[`$`+t]=function(e){return`${t}[${e.join(`n,`)}${e.length>0?`n`:``}]`};return e})();function cs(e,t){return e===t||rs(e)===rs(t)}function ls(e,t){let n=typeof e==`string`&&!t?`${e}Context`:t,r=Symbol(n);return[t=>{let n=tn(r,t);if(n||n===null)return n;throw Error(`Injection \`${r.toString()}\` not found. Component must be used within ${Array.isArray(e)?`one of the following components: ${e.join(`, `)}`:`\`${e}\``}`)},e=>(Fe(r,e),e)]}function us(){let e=document.activeElement;if(e==null)return null;for(;e!=null&&e.shadowRoot!=null&&e.shadowRoot.activeElement!=null;)e=e.shadowRoot.activeElement;return e}function ds(e){return e==null}function fs(e,t){return ds(e)?!1:Array.isArray(e)?e.some(e=>cs(e,t)):cs(e,t)}function ps(e){return e?e.flatMap(e=>e.type===gt?ps(e.children):[e]):[]}var[ms,pee]=ls(`ConfigProvider`);function hs(e){let t=ms({dir:Ne(`ltr`)});return P(()=>e?.value||t.dir?.value||`ltr`)}function gs(e){return P(()=>!Ke(e)||!!At(e)?.closest(`form`))}function _s(){let e=nt(),t=Ne(),n=P(()=>r());Ee(()=>{n.value!==r()&&Se(t)});function r(){return t.value&&`$el`in t.value&&[`#text`,`#comment`].includes(t.value.$el.nodeName)?t.value.$el.nextElementSibling:At(t)}let i=Object.assign({},e.exposed),a={};for(let t in e.props)Object.defineProperty(a,t,{enumerable:!0,configurable:!0,get:()=>e.props[t]});if(Object.keys(i).length>0)for(let e in i)Object.defineProperty(a,e,{enumerable:!0,configurable:!0,get:()=>i[e]});Object.defineProperty(a,"$el",{enumerable:!0,configurable:!0,get:()=>e.vnode.el}),e.exposed=a;function o(n){if(t.value=n,n&&(Object.defineProperty(a,"$el",{enumerable:!0,configurable:!0,get:()=>n instanceof Element?n:n.$el}),!(n instanceof Element)&&!Object.hasOwn(n,`$el`))){let t=n.$.exposed,r=Object.assign({},a);for(let e in t)Object.defineProperty(r,e,{enumerable:!0,configurable:!0,get:()=>t[e]});e.exposed=r}}return{forwardRef:o,currentRef:t,currentElement:n}}function vs(){let e=nt()?.vnode?.scopeId;return e?{[e]:``}:{}}var ys=0;function bs(e,t=`reka`){if(e)return e;let n,r=ms({useId:void 0});return n=r.useId?r.useId():`useId`in Hn?Ze?.():`${++ys}`,t?`${t}-${n}`:n}function xs(e,t){let n=Ne(e);function r(e){return t[n.value][e]??n.value}return{state:n,dispatch:e=>{n.value=r(e)}}}function Ss(e,t){let n=Ne({}),r=Ne(`none`),i=Ne(e),a=e.value?`mounted`:`unmounted`,o,s=t.value?.ownerDocument.defaultView??Rt,{state:c,dispatch:l}=xs(a,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}}),u=e=>{if($t){let n=new CustomEvent(e,{bubbles:!1,cancelable:!1});t.value?.dispatchEvent(n)}};Nt(e,async(e,i)=>{let a=i!==e;if(await x(),a){let a=r.value,o=Cs(t.value);e?(l(`MOUNT`),u(`enter`),o===`none`&&u(`after-enter`)):o===`none`||o===`undefined`||n.value?.display===`none`?(l(`UNMOUNT`),u(`leave`),u(`after-leave`)):i&&a!==o?(l(`ANIMATION_OUT`),u(`leave`)):(l(`UNMOUNT`),u(`after-leave`))}},{immediate:!0});let d=e=>{if(e.target!==t.value)return;let n=Cs(t.value),r=n.includes(CSS.escape(e.animationName)),a=c.value===`mounted`?`enter`:`leave`;if(r&&(u(`after-${a}`),l(`ANIMATION_END`),!i.value)){let e=t.value.style.animationFillMode;t.value.style.animationFillMode=`forwards`,o=s?.setTimeout(()=>{t.value?.style.animationFillMode===`forwards`&&(t.value.style.animationFillMode=e)})}n===`none`&&l(`ANIMATION_END`)},f=e=>{e.target===t.value&&(r.value=Cs(t.value))},p=Nt(t,(e,t)=>{e?(n.value=getComputedStyle(e),e.addEventListener(`animationstart`,f),e.addEventListener(`animationcancel`,d),e.addEventListener(`animationend`,d)):(l(`ANIMATION_END`),o!==void 0&&s?.clearTimeout(o),t?.removeEventListener(`animationstart`,f),t?.removeEventListener(`animationcancel`,d),t?.removeEventListener(`animationend`,d))},{immediate:!0}),m=Nt(c,()=>{let e=Cs(t.value);r.value=c.value===`mounted`?e:`none`});return j(()=>{p(),m(),t.value&&(t.value.removeEventListener(`animationstart`,f),t.value.removeEventListener(`animationcancel`,d),t.value.removeEventListener(`animationend`,d)),o!==void 0&&s?.clearTimeout(o)}),{isPresent:P(()=>[`mounted`,`unmountSuspended`].includes(c.value))}}function Cs(e){return e&&getComputedStyle(e).animationName||`none`}var ws=F({name:`Presence`,props:{present:{type:Boolean,required:!0},forceMount:{type:Boolean}},slots:{},setup(e,{slots:t,expose:n}){let{present:r,forceMount:i}=Be(e),a=Ne(),{isPresent:o}=Ss(r,a);n({present:o});let s=t.default({present:o.value});s=ps(s||[]);let c=nt();if(s&&s?.length>1){let e=c?.parent?.type.name?`<${c.parent.type.name} />`:`component`;throw Error([`Detected an invalid children for \`${e}\` for \`Presence\` component.`,``,"Note: Presence works similarly to `v-if` directly, but it waits for animation/transition to finished before unmounting. So it expect only one direct child of valid VNode type.",`You can apply a few solutions:`,["Provide a single child element so that `presence` directive attach correctly.",`Ensure the first child is an actual element instead of a raw text node or comment node.`].map(e=>` - ${e}`).join(`
10
+ `)].join(`
11
+ `))}return()=>i.value||r.value||o.value?at(t.default({present:o.value})[0],{ref:e=>{let t=At(e);return t?.hasAttribute===void 0||(t?.hasAttribute(`data-reka-popper-content-wrapper`)?a.value=t.firstElementChild:a.value=t),t}}):null}}),Ts=F({name:`PrimitiveSlot`,inheritAttrs:!1,setup(e,{attrs:t,slots:n}){return()=>{if(!n.default)return null;let e=ps(n.default()),r=e.findIndex(e=>e.type!==_e);if(r===-1)return e;let i=e[r];delete i.props?.ref;let a=i.props?je(t,i.props):t,o=l({...i,props:{}},a);return e.length===1?o:(e[r]=o,e)}}}),Es=[`area`,`img`,`input`],Ds=F({name:`Primitive`,inheritAttrs:!1,props:{asChild:{type:Boolean,default:!1},as:{type:[String,Object],default:`div`}},setup(e,{attrs:t,slots:n}){let r=e.asChild?`template`:e.as;return typeof r==`string`&&Es.includes(r)?()=>at(r,t):r===`template`?()=>at(Ts,t,{default:n.default}):()=>at(e.as,t,{default:n.default})}});function Os(){let e=Ne();return{primitiveElement:e,currentElement:P(()=>[`#text`,`#comment`].includes(e.value?.$el.nodeName)?e.value?.$el.nextElementSibling:At(e))}}function ks({type:e,defaultValue:t,modelValue:n}){let r=n||t;return n!==void 0||t!==void 0?Array.isArray(r)?`multiple`:`single`:e??`single`}function As({type:e,defaultValue:t,modelValue:n}){return e||ks({type:e,defaultValue:t,modelValue:n})}function js({type:e,defaultValue:t}){return t===void 0?e===`single`?void 0:[]:t}function Ms(e,t){let n=P(()=>As(e)),r=Je(e,`modelValue`,t,{defaultValue:js(e),passive:e.modelValue===void 0,deep:!0});function i(e){if(n.value===`single`)r.value=cs(e,r.value)?void 0:e;else{let t=Array.isArray(r.value)?[...r.value||[]]:[r.value].filter(Boolean);if(fs(t,e)){let n=t.findIndex(t=>cs(t,e));t.splice(n,1)}else t.push(e);r.value=t}}return{modelValue:r,changeModelValue:i,isSingle:P(()=>n.value===`single`)}}var Ns=`data-reka-collection-item`;function Ps(e={}){let{key:t=``,isProvider:n=!1}=e,r=`${t}CollectionProvider`,i;if(n){let e=Ne(new Map);i={collectionRef:Ne(),itemMap:e},Fe(r,i)}else i=tn(r);let a=(e,t=!1)=>{if(!i.collectionRef.value)return;let n=i.itemMap.value.get(e);return n&&(t||n.ref.dataset.disabled!==``)?n:void 0},o=(e=!1)=>{let t=i.collectionRef.value;if(!t)return[];let n=Array.from(t.querySelectorAll(`[${Ns}]`)),r=new Map(n.map((e,t)=>[e,t])),a=Array.from(i.itemMap.value.values()).sort((e,t)=>(r.get(e.ref)??-1)-(r.get(t.ref)??-1));return e?a:a.filter(e=>e.ref.dataset.disabled!==``)},s=F({name:`CollectionSlot`,inheritAttrs:!1,setup(e,{slots:t,attrs:n}){let{primitiveElement:r,currentElement:a}=Os();return Nt(a,()=>{i.collectionRef.value=a.value}),()=>at(Ts,{ref:r,...n},t)}}),c=F({name:`CollectionItem`,inheritAttrs:!1,props:{value:{validator:()=>!0}},setup(e,{slots:t,attrs:n}){let{primitiveElement:r,currentElement:a}=Os();return wt(t=>{if(a.value){let n=A(a.value);i.itemMap.value.set(n,{ref:a.value,value:e.value}),t(()=>i.itemMap.value.delete(n))}}),()=>at(Ts,{...n,[Ns]:``,ref:r},t)}});return{getItems:o,getItem:a,reactiveItems:P(()=>Array.from(i.itemMap.value.values())),itemMapSize:P(()=>i.itemMap.value.size),CollectionSlot:s,CollectionItem:c}}var Fs=F({__name:`VisuallyHidden`,props:{feature:{type:String,required:!1,default:`focusable`},asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`span`}},setup(e){return(e,t)=>(L(),Me(i(Ds),{as:e.as,"as-child":e.asChild,"aria-hidden":e.feature===`focusable`||e.feature===`fully-hidden`?`true`:void 0,"data-hidden":e.feature===`fully-hidden`?``:void 0,tabindex:e.feature===`fully-hidden`?`-1`:void 0,style:{position:`absolute`,border:0,width:`1px`,height:`1px`,padding:0,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,clipPath:`inset(50%)`,whiteSpace:`nowrap`,wordWrap:`normal`,top:`-1px`,left:`-1px`}},{default:I(()=>[k(e.$slots,`default`)]),_:3},8,[`as`,`as-child`,`aria-hidden`,`data-hidden`,`tabindex`]))}}),Is=F({inheritAttrs:!1,__name:`VisuallyHiddenInputBubble`,props:{name:{type:String,required:!0},value:{type:null,required:!0},checked:{type:Boolean,required:!1,default:void 0},required:{type:Boolean,required:!1},disabled:{type:Boolean,required:!1},feature:{type:String,required:!1,default:`fully-hidden`}},setup(e){let t=e,{primitiveElement:n,currentElement:r}=Os(),i=P(()=>t.checked??t.value);return Nt(i,(e,t)=>{if(!r.value)return;let n=r.value,i=window.HTMLInputElement.prototype,a=Object.getOwnPropertyDescriptor(i,`value`).set;if(a&&e!==t){let t=new Event(`input`,{bubbles:!0}),r=new Event(`change`,{bubbles:!0});a.call(n,e),n.dispatchEvent(t),n.dispatchEvent(r)}}),(e,r)=>(L(),Me(Fs,je({ref_key:`primitiveElement`,ref:n},{...t,...e.$attrs},{as:`input`}),null,16))}}),Ls=F({inheritAttrs:!1,__name:`VisuallyHiddenInput`,props:{name:{type:String,required:!0},value:{type:null,required:!0},checked:{type:Boolean,required:!1,default:void 0},required:{type:Boolean,required:!1},disabled:{type:Boolean,required:!1},feature:{type:String,required:!1,default:`fully-hidden`}},setup(e){let t=e,n=P(()=>typeof t.value==`object`&&Array.isArray(t.value)&&t.value.length===0&&t.required),r=P(()=>typeof t.value==`string`||typeof t.value==`number`||typeof t.value==`boolean`||t.value===null||t.value===void 0?[{name:t.name,value:t.value}]:typeof t.value==`object`&&Array.isArray(t.value)?t.value.flatMap((e,n)=>typeof e==`object`?Object.entries(e).map(([e,r])=>({name:`${t.name}[${n}][${e}]`,value:r})):{name:`${t.name}[${n}]`,value:e}):t.value!==null&&typeof t.value==`object`&&!Array.isArray(t.value)?Object.entries(t.value).map(([e,n])=>({name:`${t.name}[${e}]`,value:n})):[]);return(e,i)=>(L(),T(gt,null,[Ie(` We render single input if it's required `),n.value?(L(),Me(Is,je({key:e.name},{...t,...e.$attrs},{name:e.name,value:e.value}),null,16,[`name`,`value`])):(L(!0),T(gt,{key:1},E(r.value,n=>(L(),Me(Is,je({key:n.name},{ref_for:!0},{...t,...e.$attrs},{name:n.name,value:n.value}),null,16,[`name`,`value`]))),128))],2112))}}),Rs=`rovingFocusGroup.onEntryFocus`,zs={bubbles:!1,cancelable:!0},Bs={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function Vs(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}function Hs(e,t,n){let r=Vs(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return Bs[r]}function Us(e,t=!1){let n=us();for(let r of e)if(r===n||(r.focus({preventScroll:t}),us()!==n))return}function Ws(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var[Gs,Ks]=ls(`RovingFocusGroup`),qs=F({__name:`RovingFocusGroup`,props:{orientation:{type:String,required:!1,default:void 0},dir:{type:String,required:!1},loop:{type:Boolean,required:!1,default:!1},currentTabStopId:{type:[String,null],required:!1},defaultCurrentTabStopId:{type:String,required:!1},preventScrollOnEntryFocus:{type:Boolean,required:!1,default:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:[`entryFocus`,`update:currentTabStopId`],setup(e,{expose:t,emit:n}){let r=e,a=n,{loop:o,orientation:s,dir:c}=Be(r),l=hs(c),u=Je(r,`currentTabStopId`,a,{defaultValue:r.defaultCurrentTabStopId,passive:r.currentTabStopId===void 0}),d=Ne(!1),f=Ne(!1),p=Ne(0),{getItems:m,CollectionSlot:h}=Ps({isProvider:!0});function g(e){let t=!f.value;if(e.currentTarget&&e.target===e.currentTarget&&t&&!d.value){let t=new CustomEvent(Rs,zs);if(e.currentTarget.dispatchEvent(t),a(`entryFocus`,t),!t.defaultPrevented){let e=m().map(e=>e.ref).filter(e=>e.dataset.disabled!==``);Us([e.find(e=>e.getAttribute(`data-active`)===``),e.find(e=>e.getAttribute(`data-highlighted`)===``),e.find(e=>e.id===u.value),...e].filter(Boolean),r.preventScrollOnEntryFocus)}}f.value=!1}function _(){setTimeout(()=>{f.value=!1},1)}return t({getItems:m}),Ks({loop:o,dir:l,orientation:s,currentTabStopId:u,onItemFocus:e=>{u.value=e},onItemShiftTab:()=>{d.value=!0},onFocusableItemAdd:()=>{p.value++},onFocusableItemRemove:()=>{p.value--}}),(e,t)=>(L(),Me(i(h),null,{default:I(()=>[N(i(Ds),{tabindex:d.value||p.value===0?-1:0,"data-orientation":i(s),as:e.as,"as-child":e.asChild,dir:i(l),style:{outline:`none`},onMousedown:t[0]||=e=>f.value=!0,onMouseup:_,onFocus:g,onBlur:t[1]||=e=>d.value=!1},{default:I(()=>[k(e.$slots,`default`)]),_:3},8,[`tabindex`,`data-orientation`,`as`,`as-child`,`dir`])]),_:3}))}}),Js=F({__name:`RovingFocusItem`,props:{tabStopId:{type:String,required:!1},focusable:{type:Boolean,required:!1,default:!0},active:{type:Boolean,required:!1},allowShiftKey:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`span`}},setup(e){let t=e,n=Gs(),r=bs(),a=P(()=>t.tabStopId||r),o=P(()=>n.currentTabStopId.value===a.value),{getItems:s,CollectionItem:c}=Ps();ge(()=>{t.focusable&&n.onFocusableItemAdd()}),j(()=>{t.focusable&&n.onFocusableItemRemove()}),Nt(()=>t.focusable,(e,t)=>{e!==t&&(e?n.onFocusableItemAdd():n.onFocusableItemRemove())});function l(e){if(e.key===`Tab`&&e.shiftKey){n.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let r=Hs(e,n.orientation.value,n.dir.value);if(r!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||!t.allowShiftKey&&e.shiftKey)return;e.preventDefault();let i=[...s().map(e=>e.ref).filter(e=>e.dataset.disabled!==``)];if(r===`last`)i.reverse();else if(r===`prev`||r===`next`){r===`prev`&&i.reverse();let t=i.indexOf(e.currentTarget);i=n.loop.value?Ws(i,t+1):i.slice(t+1)}x(()=>Us(i))}}return(e,t)=>(L(),Me(i(c),null,{default:I(()=>[N(i(Ds),{tabindex:o.value?0:-1,"data-orientation":i(n).orientation.value,"data-active":e.active?``:void 0,"data-disabled":e.focusable?void 0:``,as:e.as,"as-child":e.asChild,onMousedown:t[0]||=t=>{e.focusable?i(n).onItemFocus(a.value):t.preventDefault()},onFocus:t[1]||=e=>i(n).onItemFocus(a.value),onKeydown:l},{default:I(()=>[k(e.$slots,`default`)]),_:3},8,[`tabindex`,`data-orientation`,`data-active`,`data-disabled`,`as`,`as-child`])]),_:3}))}}),[Ys,mee]=ls(`CheckboxGroupRoot`);function Xs(e){return e===`indeterminate`}function Zs(e){return Xs(e)?`indeterminate`:e?`checked`:`unchecked`}var[Qs,$s]=ls(`CheckboxRoot`),ec=F({inheritAttrs:!1,__name:`CheckboxRoot`,props:{defaultValue:{type:null,required:!1},modelValue:{type:null,required:!1,default:void 0},disabled:{type:Boolean,required:!1},value:{type:null,required:!1,default:`on`},id:{type:String,required:!1},trueValue:{type:null,required:!1,default:()=>!0},falseValue:{type:null,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:[`update:modelValue`],setup(e,{emit:t}){let n=e,r=t,{forwardRef:a,currentElement:o}=_s(),s=Ys(null),c=Je(n,`modelValue`,r,{defaultValue:n.defaultValue??n.falseValue,passive:n.modelValue===void 0}),l=P(()=>s?.disabled.value||n.disabled),u=P(()=>cs(c.value,n.trueValue)),d=P(()=>ds(s?.modelValue.value)?c.value===`indeterminate`?`indeterminate`:u.value:fs(s.modelValue.value,n.value));function f(){if(ds(s?.modelValue.value))c.value===`indeterminate`?c.value=n.trueValue:c.value=u.value?n.falseValue:n.trueValue;else{let e=[...s.modelValue.value||[]];if(fs(e,n.value)){let t=e.findIndex(e=>cs(e,n.value));e.splice(t,1)}else e.push(n.value);s.modelValue.value=e}}let p=gs(o),m=vs(),h=mt(),g=P(()=>{if(!h[`aria-label`])return n.id&&o.value?document.querySelector(`[for="${n.id}"]`)?.innerText:void 0});return $s({disabled:l,state:d}),(e,t)=>(L(),T(gt,null,[(L(),Me(We(i(s)?.rovingFocus.value?i(Js):i(Ds)),je({...e.$attrs,...i(m)},{id:e.id,ref:i(a),role:`checkbox`,"as-child":e.asChild,as:e.as,type:e.as===`button`?`button`:void 0,"aria-checked":i(Xs)(d.value)?`mixed`:d.value,"aria-required":e.required,"aria-label":e.$attrs[`aria-label`]||g.value,"data-state":i(Zs)(d.value),"data-disabled":l.value?``:void 0,disabled:l.value,focusable:i(s)?.rovingFocus.value?!l.value:void 0,onKeydown:nn(bn(()=>{},[`prevent`]),[`enter`]),onClick:f}),{default:I(()=>[k(e.$slots,`default`,{modelValue:i(c),state:d.value})]),_:3},16,[`id`,`as-child`,`as`,`type`,`aria-checked`,`aria-required`,`aria-label`,`data-state`,`data-disabled`,`disabled`,`focusable`,`onKeydown`])),i(p)&&e.name&&!i(s)?(L(),Me(i(Ls),je({key:0,type:`checkbox`,checked:!!d.value,name:e.name,value:e.value,disabled:l.value,required:e.required},i(m)),null,16,[`checked`,`name`,`value`,`disabled`,`required`])):Ie(`v-if`,!0)],64))}}),tc=F({__name:`CheckboxIndicator`,props:{forceMount:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`span`}},setup(e){let{forwardRef:t}=_s(),n=Qs();return(e,r)=>(L(),Me(i(ws),{present:e.forceMount||i(Xs)(i(n).state.value)||i(n).state.value===!0},{default:I(()=>[N(i(Ds),je({ref:i(t),"data-state":i(Zs)(i(n).state.value),"data-disabled":i(n).disabled.value?``:void 0,style:{pointerEvents:`none`},"as-child":e.asChild,as:e.as},e.$attrs),{default:I(()=>[k(e.$slots,`default`)]),_:3},16,[`data-state`,`data-disabled`,`as-child`,`as`])]),_:3},8,[`present`]))}}),[nc,rc]=ls(`ToggleGroupRoot`),ic=F({__name:`ToggleGroupRoot`,props:{rovingFocus:{type:Boolean,required:!1,default:!0},disabled:{type:Boolean,required:!1,default:!1},orientation:{type:String,required:!1},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},type:{type:String,required:!1},modelValue:{type:null,required:!1},defaultValue:{type:null,required:!1}},emits:[`update:modelValue`],setup(e,{emit:t}){let n=e,r=t,{loop:a,rovingFocus:o,disabled:s,dir:c}=Be(n),l=hs(c),{forwardRef:u,currentElement:d}=_s(),{modelValue:f,changeModelValue:p,isSingle:m}=Ms(n,r),h=gs(d);return rc({isSingle:m,modelValue:f,changeModelValue:p,dir:l,orientation:n.orientation,loop:a,rovingFocus:o,disabled:s}),(e,t)=>(L(),Me(We(i(o)?i(qs):i(Ds)),{"as-child":``,orientation:i(o)?e.orientation:void 0,dir:i(l),loop:i(o)?i(a):void 0},{default:I(()=>[N(i(Ds),{ref:i(u),role:`group`,"as-child":e.asChild,as:e.as},{default:I(()=>[k(e.$slots,`default`,{modelValue:i(f)}),i(h)&&e.name?(L(),Me(Ls,{key:0,name:e.name,required:e.required,value:i(f)},null,8,[`name`,`required`,`value`])):Ie(`v-if`,!0)]),_:3},8,[`as-child`,`as`])]),_:3},8,[`orientation`,`dir`,`loop`]))}}),ac=F({inheritAttrs:!1,__name:`Toggle`,props:{defaultValue:{type:Boolean,required:!1},modelValue:{type:[Boolean,null],required:!1,default:void 0},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:[`update:modelValue`],setup(e,{emit:t}){let n=e,r=t,{forwardRef:a,currentElement:o}=_s(),s=vs(),c=nc(null),l=Je(n,`modelValue`,r,{defaultValue:n.defaultValue,passive:n.modelValue===void 0});function u(){l.value=!l.value}let d=P(()=>l.value?`on`:`off`),f=gs(o);return(e,t)=>(L(),T(gt,null,[N(i(Ds),je({ref:i(a),type:e.as===`button`?`button`:void 0,"as-child":n.asChild,as:e.as,"aria-pressed":i(l),"data-state":d.value,"data-disabled":e.disabled?``:void 0,disabled:e.disabled},{...i(s),...e.$attrs},{onClick:u}),{default:I(()=>[k(e.$slots,`default`,{modelValue:i(l),disabled:e.disabled,pressed:i(l),state:d.value})]),_:3},16,[`type`,`as-child`,`as`,`aria-pressed`,`data-state`,`data-disabled`,`disabled`]),i(f)&&e.name&&!i(c)?(L(),Me(Ls,je({key:0,type:`checkbox`,name:e.name,value:i(l),required:e.required},i(s)),null,16,[`name`,`value`,`required`])):Ie(`v-if`,!0)],64))}}),oc=F({__name:`ToggleGroupItem`,props:{value:{type:null,required:!0},disabled:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`button`}},setup(e){let t=e,n=nc(),r=P(()=>n.disabled?.value||t.disabled),a=P(()=>fs(n.modelValue.value,t.value)),{forwardRef:o}=_s(),s=vs();return(e,c)=>(L(),Me(We(i(n).rovingFocus.value?i(Js):i(Ds)),je({"as-child":``},i(n).rovingFocus.value?{focusable:!r.value,active:a.value}:{}),{default:I(()=>[N(i(ac),je({...i(s),...t},{ref:i(o),disabled:r.value,"model-value":a.value,"onUpdate:modelValue":c[0]||=t=>i(n).changeModelValue(e.value)}),{default:I(t=>[k(e.$slots,`default`,Zt(Jt(t)))]),_:3},16,[`disabled`,`model-value`])]),_:3},16))}}),sc=`outline-none border border-base rounded bg-raised flex h-4 w-4 transition items-center justify-center data-[state=checked]:border-primary-500 data-[state=checked]:bg-primary-500 focus-visible:ring-2 focus-visible:ring-primary-500/40`,cc=F({inheritAttrs:!1,__name:`FormCheckbox`,props:Qt({label:{},disabled:{type:Boolean}},{modelValue:{type:Boolean,default:!1},modelModifiers:{}}),emits:[`update:modelValue`],setup(e){let t=jt(e,`modelValue`);return(n,r)=>e.label||n.$slots.default?(L(),T(`label`,je({key:0},n.$attrs,{class:[`text-sm inline-flex gap-1.5 cursor-pointer select-none items-center`,{"op-fade saturate-0 pointer-events-none":e.disabled}]}),[N(i(ec),{modelValue:t.value,"onUpdate:modelValue":r[0]||=e=>t.value=e,disabled:e.disabled,class:Oe(sc)},{default:I(()=>[N(i(tc),{class:`text-white`},{default:I(()=>[...r[2]||=[D(`div`,{class:`i-ph:check-bold text-micro text-white mt--1px`,"aria-hidden":`true`},null,-1)]]),_:1})]),_:1},8,[`modelValue`,`disabled`]),D(`span`,null,[k(n.$slots,`default`,{},()=>[Ge(b(e.label),1)])])],16)):(L(),Me(i(ec),je({key:1},n.$attrs,{modelValue:t.value,"onUpdate:modelValue":r[1]||=e=>t.value=e,disabled:e.disabled,class:sc}),{default:I(()=>[N(i(tc),{class:`text-white`},{default:I(()=>[...r[3]||=[D(`div`,{class:`i-ph:check-bold text-micro text-white mt--1px`,"aria-hidden":`true`},null,-1)]]),_:1})]),_:1},16,[`modelValue`,`disabled`]))}}),lc=`diffs-container`,uc=/(?=^diff --git)/gm,dc=/(?<=\n)/,fc=/^(---|\+\+\+)\s+([^\t\r\n]+)/,pc=/^index ([0-9a-f]+)\.\.([0-9a-f]+)(?: (\d+))?$/i,mc=`header-prefix`,hc=`header-filename-suffix`,gc=`header-metadata`,_c=`header-custom`,vc={dark:`pierre-dark`,light:`pierre-light`},yc=`data-theme-css`,bc=`data-unsafe-css`,xc=`data-diffs-scrollbar-measure`,Sc=`--diffs-scrollbar-gutter-measured`,Cc=1e5,wc={hunkLineCount:50,lineHeight:20,diffHeaderHeight:44,spacing:8};({...wc});var Tc=Object.freeze({fromStart:0,fromEnd:0}),Ec={startingLine:0,totalLines:1/0,bufferBefore:0,bufferAfter:0},Dc={startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:0},Oc=class extends Error{constructor(e){super(e),this.name=`ShikiError`}};function hee(e){return kc(e)}function kc(e){return Array.isArray(e)?gee(e):e instanceof RegExp?e:typeof e==`object`?_ee(e):e}function gee(e){let t=[];for(let n=0,r=e.length;n<r;n++)t[n]=kc(e[n]);return t}function _ee(e){let t={};for(let n in e)t[n]=kc(e[n]);return t}function Ac(e,...t){return t.forEach(t=>{for(let n in t)e[n]=t[n]}),e}function jc(e){let t=~e.lastIndexOf(`/`)||~e.lastIndexOf(`\\`);return t===0?e:~t===e.length-1?jc(e.substring(0,e.length-1)):e.substr(~t+1)}var Mc=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,Nc=class{static hasCaptures(e){return e!==null&&(Mc.lastIndex=0,Mc.test(e))}static replaceCaptures(e,t,n){return e.replace(Mc,(e,r,i,a)=>{let o=n[parseInt(r||i,10)];if(o){let e=t.substring(o.start,o.end);for(;e[0]===`.`;)e=e.substring(1);switch(a){case`downcase`:return e.toLowerCase();case`upcase`:return e.toUpperCase();default:return e}}else return e})}};function Pc(e,t){return e<t?-1:+(e>t)}function Fc(e,t){if(e===null&&t===null)return 0;if(!e)return-1;if(!t)return 1;let n=e.length,r=t.length;if(n===r){for(let r=0;r<n;r++){let n=Pc(e[r],t[r]);if(n!==0)return n}return 0}return n-r}function Ic(e){return!!(/^#[0-9a-f]{6}$/i.test(e)||/^#[0-9a-f]{8}$/i.test(e)||/^#[0-9a-f]{3}$/i.test(e)||/^#[0-9a-f]{4}$/i.test(e))}function Lc(e){return e.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,`\\$&`)}var Rc=class{constructor(e){this.fn=e}cache=new Map;get(e){if(this.cache.has(e))return this.cache.get(e);let t=this.fn(e);return this.cache.set(e,t),t}},zc=class{constructor(e,t,n){this._colorMap=e,this._defaults=t,this._root=n}static createFromRawTheme(e,t){return this.createFromParsedTheme(Uc(e),t)}static createFromParsedTheme(e,t){return Kc(e,t)}_cachedMatchRoot=new Rc(e=>this._root.match(e));getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(e){if(e===null)return this._defaults;let t=e.scopeName,n=this._cachedMatchRoot.get(t).find(t=>vee(e.parent,t.parentScopes));return n?new Hc(n.fontStyle,n.foreground,n.background):null}},Bc=class e{constructor(e,t){this.parent=e,this.scopeName=t}static push(t,n){for(let r of n)t=new e(t,r);return t}static from(...t){let n=null;for(let r=0;r<t.length;r++)n=new e(n,t[r]);return n}push(t){return new e(this,t)}getSegments(){let e=this,t=[];for(;e;)t.push(e.scopeName),e=e.parent;return t.reverse(),t}toString(){return this.getSegments().join(` `)}extends(e){return this===e||this.parent!==null&&this.parent.extends(e)}getExtensionIfDefined(e){let t=[],n=this;for(;n&&n!==e;)t.push(n.scopeName),n=n.parent;return n===e?t.reverse():void 0}};function vee(e,t){if(t.length===0)return!0;for(let n=0;n<t.length;n++){let r=t[n],i=!1;if(r===`>`){if(n===t.length-1)return!1;r=t[++n],i=!0}for(;e&&!Vc(e.scopeName,r);){if(i)return!1;e=e.parent}if(!e)return!1;e=e.parent}return!0}function Vc(e,t){return t===e||e.startsWith(t)&&e[t.length]===`.`}var Hc=class{constructor(e,t,n){this.fontStyle=e,this.foregroundId=t,this.backgroundId=n}};function Uc(e){if(!e||!e.settings||!Array.isArray(e.settings))return[];let t=e.settings,n=[],r=0;for(let e=0,i=t.length;e<i;e++){let i=t[e];if(!i.settings)continue;let a;if(typeof i.scope==`string`){let e=i.scope;e=e.replace(/^[,]+/,``),e=e.replace(/[,]+$/,``),a=e.split(`,`)}else a=Array.isArray(i.scope)?i.scope:[``];let o=-1;if(typeof i.settings.fontStyle==`string`){o=0;let e=i.settings.fontStyle.split(` `);for(let t=0,n=e.length;t<n;t++)switch(e[t]){case`italic`:o|=1;break;case`bold`:o|=2;break;case`underline`:o|=4;break;case`strikethrough`:o|=8}}let s=null;typeof i.settings.foreground==`string`&&Ic(i.settings.foreground)&&(s=i.settings.foreground);let c=null;typeof i.settings.background==`string`&&Ic(i.settings.background)&&(c=i.settings.background);for(let t=0,i=a.length;t<i;t++){let i=a[t].trim().split(` `),l=i[i.length-1],u=null;i.length>1&&(u=i.slice(0,i.length-1),u.reverse()),n[r++]=new Wc(l,u,e,o,s,c)}}return n}var Wc=class{constructor(e,t,n,r,i,a){this.scope=e,this.parentScopes=t,this.index=n,this.fontStyle=r,this.foreground=i,this.background=a}},Gc=(e=>(e[e.NotSet=-1]=`NotSet`,e[e.None=0]=`None`,e[e.Italic=1]=`Italic`,e[e.Bold=2]=`Bold`,e[e.Underline=4]=`Underline`,e[e.Strikethrough=8]=`Strikethrough`,e))(Gc||{});function Kc(e,t){e.sort((e,t)=>{let n=Pc(e.scope,t.scope);return n!==0||(n=Fc(e.parentScopes,t.parentScopes),n!==0)?n:e.index-t.index});let n=0,r=`#000000`,i=`#ffffff`;for(;e.length>=1&&e[0].scope===``;){let t=e.shift();t.fontStyle!==-1&&(n=t.fontStyle),t.foreground!==null&&(r=t.foreground),t.background!==null&&(i=t.background)}let a=new qc(t),o=new Hc(n,a.getId(r),a.getId(i)),s=new Xc(new Yc(0,null,-1,0,0),[]);for(let t=0,n=e.length;t<n;t++){let n=e[t];s.insert(0,n.scope,n.parentScopes,n.fontStyle,a.getId(n.foreground),a.getId(n.background))}return new zc(a,o,s)}var qc=class{_isFrozen;_lastColorId;_id2color;_color2id;constructor(e){if(this._lastColorId=0,this._id2color=[],this._color2id=Object.create(null),Array.isArray(e)){this._isFrozen=!0;for(let t=0,n=e.length;t<n;t++)this._color2id[e[t]]=t,this._id2color[t]=e[t]}else this._isFrozen=!1}getId(e){if(e===null)return 0;e=e.toUpperCase();let t=this._color2id[e];if(t)return t;if(this._isFrozen)throw Error(`Missing color in color map - ${e}`);return t=++this._lastColorId,this._color2id[e]=t,this._id2color[t]=e,t}getColorMap(){return this._id2color.slice(0)}},Jc=Object.freeze([]),Yc=class e{scopeDepth;parentScopes;fontStyle;foreground;background;constructor(e,t,n,r,i){this.scopeDepth=e,this.parentScopes=t||Jc,this.fontStyle=n,this.foreground=r,this.background=i}clone(){return new e(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(e){let t=[];for(let n=0,r=e.length;n<r;n++)t[n]=e[n].clone();return t}acceptOverwrite(e,t,n,r){this.scopeDepth>e?console.log(`how did this happen?`):this.scopeDepth=e,t!==-1&&(this.fontStyle=t),n!==0&&(this.foreground=n),r!==0&&(this.background=r)}},Xc=class e{constructor(e,t=[],n={}){this._mainRule=e,this._children=n,this._rulesWithParentScopes=t}_rulesWithParentScopes;static _cmpBySpecificity(e,t){if(e.scopeDepth!==t.scopeDepth)return t.scopeDepth-e.scopeDepth;let n=0,r=0;for(;e.parentScopes[n]===`>`&&n++,t.parentScopes[r]===`>`&&r++,!(n>=e.parentScopes.length||r>=t.parentScopes.length);){let i=t.parentScopes[r].length-e.parentScopes[n].length;if(i!==0)return i;n++,r++}return t.parentScopes.length-e.parentScopes.length}match(t){if(t!==``){let e=t.indexOf(`.`),n,r;if(e===-1?(n=t,r=``):(n=t.substring(0,e),r=t.substring(e+1)),this._children.hasOwnProperty(n))return this._children[n].match(r)}let n=this._rulesWithParentScopes.concat(this._mainRule);return n.sort(e._cmpBySpecificity),n}insert(t,n,r,i,a,o){if(n===``){this._doInsertHere(t,r,i,a,o);return}let s=n.indexOf(`.`),c,l;s===-1?(c=n,l=``):(c=n.substring(0,s),l=n.substring(s+1));let u;this._children.hasOwnProperty(c)?u=this._children[c]:(u=new e(this._mainRule.clone(),Yc.cloneArr(this._rulesWithParentScopes)),this._children[c]=u),u.insert(t+1,l,r,i,a,o)}_doInsertHere(e,t,n,r,i){if(t===null){this._mainRule.acceptOverwrite(e,n,r,i);return}for(let a=0,o=this._rulesWithParentScopes.length;a<o;a++){let o=this._rulesWithParentScopes[a];if(Fc(o.parentScopes,t)===0){o.acceptOverwrite(e,n,r,i);return}}n===-1&&(n=this._mainRule.fontStyle),r===0&&(r=this._mainRule.foreground),i===0&&(i=this._mainRule.background),this._rulesWithParentScopes.push(new Yc(e,t,n,r,i))}},Zc=class e{static toBinaryStr(e){return e.toString(2).padStart(32,`0`)}static print(t){let n=e.getLanguageId(t),r=e.getTokenType(t),i=e.getFontStyle(t),a=e.getForeground(t),o=e.getBackground(t);console.log({languageId:n,tokenType:r,fontStyle:i,foreground:a,background:o})}static getLanguageId(e){return(e&255)>>>0}static getTokenType(e){return(e&768)>>>8}static containsBalancedBrackets(e){return!!(e&1024)}static getFontStyle(e){return(e&30720)>>>11}static getForeground(e){return(e&16744448)>>>15}static getBackground(e){return(e&4278190080)>>>24}static set(t,n,r,i,a,o,s){let c=e.getLanguageId(t),l=e.getTokenType(t),u=+!!e.containsBalancedBrackets(t),d=e.getFontStyle(t),f=e.getForeground(t),p=e.getBackground(t);return n!==0&&(c=n),r!==8&&(l=$c(r)),i!==null&&(u=+!!i),a!==-1&&(d=a),o!==0&&(f=o),s!==0&&(p=s),(c<<0|l<<8|u<<10|d<<11|f<<15|p<<24)>>>0}};function Qc(e){return e}function $c(e){return e}function el(e,t){let n=[],r=nl(e),i=r.next();for(;i!==null;){let e=0;if(i.length===2&&i.charAt(1)===`:`){switch(i.charAt(0)){case`R`:e=1;break;case`L`:e=-1;break;default:console.log(`Unknown priority ${i} in scope selector`)}i=r.next()}let t=o();if(n.push({matcher:t,priority:e}),i!==`,`)break;i=r.next()}return n;function a(){if(i===`-`){i=r.next();let e=a();return t=>!!e&&!e(t)}if(i===`(`){i=r.next();let e=s();return i===`)`&&(i=r.next()),e}if(tl(i)){let e=[];do e.push(i),i=r.next();while(tl(i));return n=>t(e,n)}return null}function o(){let e=[],t=a();for(;t;)e.push(t),t=a();return t=>e.every(e=>e(t))}function s(){let e=[],t=o();for(;t&&(e.push(t),i===`|`||i===`,`);){do i=r.next();while(i===`|`||i===`,`);t=o()}return t=>e.some(e=>e(t))}}function tl(e){return!!e&&!!e.match(/[\w\.:]+/)}function nl(e){let t=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,n=t.exec(e);return{next:()=>{if(!n)return null;let r=n[0];return n=t.exec(e),r}}}function rl(e){typeof e.dispose==`function`&&e.dispose()}var il=class{constructor(e){this.scopeName=e}toKey(){return this.scopeName}},al=class{constructor(e,t){this.scopeName=e,this.ruleName=t}toKey(){return`${this.scopeName}#${this.ruleName}`}},ol=class{_references=[];_seenReferenceKeys=new Set;get references(){return this._references}visitedRule=new Set;add(e){let t=e.toKey();this._seenReferenceKeys.has(t)||(this._seenReferenceKeys.add(t),this._references.push(e))}},sl=class{constructor(e,t){this.repo=e,this.initialScopeName=t,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new il(this.initialScopeName)]}seenFullScopeRequests=new Set;seenPartialScopeRequests=new Set;Q;processQueue(){let e=this.Q;this.Q=[];let t=new ol;for(let n of e)cl(n,this.initialScopeName,this.repo,t);for(let e of t.references)if(e instanceof il){if(this.seenFullScopeRequests.has(e.scopeName))continue;this.seenFullScopeRequests.add(e.scopeName),this.Q.push(e)}else{if(this.seenFullScopeRequests.has(e.scopeName)||this.seenPartialScopeRequests.has(e.toKey()))continue;this.seenPartialScopeRequests.add(e.toKey()),this.Q.push(e)}}};function cl(e,t,n,r){let i=n.lookup(e.scopeName);if(!i){if(e.scopeName===t)throw Error(`No grammar provided for <${t}>`);return}let a=n.lookup(t);e instanceof il?ul({baseGrammar:a,selfGrammar:i},r):ll(e.ruleName,{baseGrammar:a,selfGrammar:i,repository:i.repository},r);let o=n.injections(e.scopeName);if(o)for(let e of o)r.add(new il(e))}function ll(e,t,n){if(t.repository&&t.repository[e]){let r=t.repository[e];dl([r],t,n)}}function ul(e,t){e.selfGrammar.patterns&&Array.isArray(e.selfGrammar.patterns)&&dl(e.selfGrammar.patterns,{...e,repository:e.selfGrammar.repository},t),e.selfGrammar.injections&&dl(Object.values(e.selfGrammar.injections),{...e,repository:e.selfGrammar.repository},t)}function dl(e,t,n){for(let r of e){if(n.visitedRule.has(r))continue;n.visitedRule.add(r);let e=r.repository?Ac({},t.repository,r.repository):t.repository;Array.isArray(r.patterns)&&dl(r.patterns,{...t,repository:e},n);let i=r.include;if(!i)continue;let a=_l(i);switch(a.kind){case 0:ul({...t,selfGrammar:t.baseGrammar},n);break;case 1:ul(t,n);break;case 2:ll(a.ruleName,{...t,repository:e},n);break;case 3:case 4:let r=a.scopeName===t.selfGrammar.scopeName?t.selfGrammar:a.scopeName===t.baseGrammar.scopeName?t.baseGrammar:void 0;if(r){let i={baseGrammar:t.baseGrammar,selfGrammar:r,repository:e};a.kind===4?ll(a.ruleName,i,n):ul(i,n)}else a.kind===4?n.add(new al(a.scopeName,a.ruleName)):n.add(new il(a.scopeName))}}}var fl=class{kind=0},pl=class{kind=1},ml=class{constructor(e){this.ruleName=e}kind=2},hl=class{constructor(e){this.scopeName=e}kind=3},gl=class{constructor(e,t){this.scopeName=e,this.ruleName=t}kind=4};function _l(e){if(e===`$base`)return new fl;if(e===`$self`)return new pl;let t=e.indexOf(`#`);return t===-1?new hl(e):t===0?new ml(e.substring(1)):new gl(e.substring(0,t),e.substring(t+1))}var vl=/\\(\d+)/,yl=/\\(\d+)/g,bl=-1,xl=-2;function Sl(e){return e}function Cl(e){return e}var wl=class{$location;id;_nameIsCapturing;_name;_contentNameIsCapturing;_contentName;constructor(e,t,n,r){this.$location=e,this.id=t,this._name=n||null,this._nameIsCapturing=Nc.hasCaptures(this._name),this._contentName=r||null,this._contentNameIsCapturing=Nc.hasCaptures(this._contentName)}get debugName(){let e=this.$location?`${jc(this.$location.filename)}:${this.$location.line}`:`unknown`;return`${this.constructor.name}#${this.id} @ ${e}`}getName(e,t){return!this._nameIsCapturing||this._name===null||e===null||t===null?this._name:Nc.replaceCaptures(this._name,e,t)}getContentName(e,t){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:Nc.replaceCaptures(this._contentName,e,t)}},Tl=class extends wl{retokenizeCapturedWithRuleId;constructor(e,t,n,r,i){super(e,t,n,r),this.retokenizeCapturedWithRuleId=i}dispose(){}collectPatterns(e,t){throw Error(`Not supported!`)}compile(e,t){throw Error(`Not supported!`)}compileAG(e,t,n,r){throw Error(`Not supported!`)}},El=class extends wl{_match;captures;_cachedCompiledPatterns;constructor(e,t,n,r,i){super(e,t,n,null),this._match=new jl(r,this.id),this.captures=i,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&=(this._cachedCompiledPatterns.dispose(),null)}get debugMatchRegExp(){return`${this._match.source}`}collectPatterns(e,t){t.push(this._match)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new Ml,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},Dl=class extends wl{hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,n,r,i){super(e,t,n,r),this.patterns=i.patterns,this.hasMissingPatterns=i.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&=(this._cachedCompiledPatterns.dispose(),null)}collectPatterns(e,t){for(let n of this.patterns)e.getRule(n).collectPatterns(e,t)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new Ml,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},Ol=class extends wl{_begin;beginCaptures;_end;endHasBackReferences;endCaptures;applyEndPatternLast;hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,n,r,i,a,o,s,c,l){super(e,t,n,r),this._begin=new jl(i,this.id),this.beginCaptures=a,this._end=new jl(o||`￿`,-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=s,this.applyEndPatternLast=c||!1,this.patterns=l.patterns,this.hasMissingPatterns=l.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&=(this._cachedCompiledPatterns.dispose(),null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugEndRegExp(){return`${this._end.source}`}getEndWithResolvedBackReferences(e,t){return this._end.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e,t).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e,t).compileAG(e,n,r)}_getCachedCompiledPatterns(e,t){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new Ml;for(let t of this.patterns)e.getRule(t).collectPatterns(e,this._cachedCompiledPatterns);this.applyEndPatternLast?this._cachedCompiledPatterns.push(this._end.hasBackReferences?this._end.clone():this._end):this._cachedCompiledPatterns.unshift(this._end.hasBackReferences?this._end.clone():this._end)}return this._end.hasBackReferences&&(this.applyEndPatternLast?this._cachedCompiledPatterns.setSource(this._cachedCompiledPatterns.length()-1,t):this._cachedCompiledPatterns.setSource(0,t)),this._cachedCompiledPatterns}},kl=class extends wl{_begin;beginCaptures;whileCaptures;_while;whileHasBackReferences;hasMissingPatterns;patterns;_cachedCompiledPatterns;_cachedCompiledWhilePatterns;constructor(e,t,n,r,i,a,o,s,c){super(e,t,n,r),this._begin=new jl(i,this.id),this.beginCaptures=a,this.whileCaptures=s,this._while=new jl(o,xl),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=c.patterns,this.hasMissingPatterns=c.hasMissingPatterns,this._cachedCompiledPatterns=null,this._cachedCompiledWhilePatterns=null}dispose(){this._cachedCompiledPatterns&&=(this._cachedCompiledPatterns.dispose(),null),this._cachedCompiledWhilePatterns&&=(this._cachedCompiledWhilePatterns.dispose(),null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugWhileRegExp(){return`${this._while.source}`}getWhileWithResolvedBackReferences(e,t){return this._while.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new Ml;for(let t of this.patterns)e.getRule(t).collectPatterns(e,this._cachedCompiledPatterns)}return this._cachedCompiledPatterns}compileWhile(e,t){return this._getCachedCompiledWhilePatterns(e,t).compile(e)}compileWhileAG(e,t,n,r){return this._getCachedCompiledWhilePatterns(e,t).compileAG(e,n,r)}_getCachedCompiledWhilePatterns(e,t){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new Ml,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,t||`￿`),this._cachedCompiledWhilePatterns}},Al=class e{static createCaptureRule(e,t,n,r,i){return e.registerRule(e=>new Tl(t,e,n,r,i))}static getCompiledRuleId(t,n,r){return t.id||n.registerRule(i=>{if(t.id=i,t.match)return new El(t.$vscodeTextmateLocation,t.id,t.name,t.match,e._compileCaptures(t.captures,n,r));if(t.begin===void 0){t.repository&&(r=Ac({},r,t.repository));let i=t.patterns;return i===void 0&&t.include&&(i=[{include:t.include}]),new Dl(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,e._compilePatterns(i,n,r))}return t.while?new kl(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,e._compileCaptures(t.beginCaptures||t.captures,n,r),t.while,e._compileCaptures(t.whileCaptures||t.captures,n,r),e._compilePatterns(t.patterns,n,r)):new Ol(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,e._compileCaptures(t.beginCaptures||t.captures,n,r),t.end,e._compileCaptures(t.endCaptures||t.captures,n,r),t.applyEndPatternLast,e._compilePatterns(t.patterns,n,r))}),t.id}static _compileCaptures(t,n,r){let i=[];if(t){let a=0;for(let e in t){if(e===`$vscodeTextmateLocation`)continue;let t=parseInt(e,10);t>a&&(a=t)}for(let e=0;e<=a;e++)i[e]=null;for(let a in t){if(a===`$vscodeTextmateLocation`)continue;let o=parseInt(a,10),s=0;t[a].patterns&&(s=e.getCompiledRuleId(t[a],n,r)),i[o]=e.createCaptureRule(n,t[a].$vscodeTextmateLocation,t[a].name,t[a].contentName,s)}}return i}static _compilePatterns(t,n,r){let i=[];if(t)for(let a=0,o=t.length;a<o;a++){let o=t[a],s=-1;if(o.include){let t=_l(o.include);switch(t.kind){case 0:case 1:s=e.getCompiledRuleId(r[o.include],n,r);break;case 2:let i=r[t.ruleName];i&&(s=e.getCompiledRuleId(i,n,r));break;case 3:case 4:let a=t.scopeName,c=t.kind===4?t.ruleName:null,l=n.getExternalGrammar(a,r);if(l){if(c){let t=l.repository[c];t&&(s=e.getCompiledRuleId(t,n,l.repository))}else s=e.getCompiledRuleId(l.repository.$self,n,l.repository)}}}else s=e.getCompiledRuleId(o,n,r);if(s!==-1){let e=n.getRule(s),t=!1;if((e instanceof Dl||e instanceof Ol||e instanceof kl)&&e.hasMissingPatterns&&e.patterns.length===0&&(t=!0),t)continue;i.push(s)}}return{patterns:i,hasMissingPatterns:(t?t.length:0)!==i.length}}},jl=class e{source;ruleId;hasAnchor;hasBackReferences;_anchorCache;constructor(e,t){if(e&&typeof e==`string`){let t=e.length,n=0,r=[],i=!1;for(let a=0;a<t;a++)if(e.charAt(a)===`\\`&&a+1<t){let t=e.charAt(a+1);t===`z`?(r.push(e.substring(n,a)),r.push(`$(?!\\n)(?<!\\n)`),n=a+2):(t===`A`||t===`G`)&&(i=!0),a++}this.hasAnchor=i,n===0?this.source=e:(r.push(e.substring(n,t)),this.source=r.join(``))}else this.hasAnchor=!1,this.source=e;this._anchorCache=this.hasAnchor?this._buildAnchorCache():null,this.ruleId=t,this.hasBackReferences=typeof this.source==`string`&&vl.test(this.source)}clone(){return new e(this.source,this.ruleId)}setSource(e){this.source!==e&&(this.source=e,this.hasAnchor&&(this._anchorCache=this._buildAnchorCache()))}resolveBackReferences(e,t){if(typeof this.source!=`string`)throw Error(`This method should only be called if the source is a string`);let n=t.map(t=>e.substring(t.start,t.end));return yl.lastIndex=0,this.source.replace(yl,(e,t)=>Lc(n[parseInt(t,10)]||``))}_buildAnchorCache(){if(typeof this.source!=`string`)throw Error(`This method should only be called if the source is a string`);let e=[],t=[],n=[],r=[],i,a,o,s;for(i=0,a=this.source.length;i<a;i++)o=this.source.charAt(i),e[i]=o,t[i]=o,n[i]=o,r[i]=o,o===`\\`&&i+1<a&&(s=this.source.charAt(i+1),s===`A`?(e[i+1]=`￿`,t[i+1]=`￿`,n[i+1]=`A`,r[i+1]=`A`):s===`G`?(e[i+1]=`￿`,t[i+1]=`G`,n[i+1]=`￿`,r[i+1]=`G`):(e[i+1]=s,t[i+1]=s,n[i+1]=s,r[i+1]=s),i++);return{A0_G0:e.join(``),A0_G1:t.join(``),A1_G0:n.join(``),A1_G1:r.join(``)}}resolveAnchors(e,t){return!this.hasAnchor||!this._anchorCache||typeof this.source!=`string`?this.source:e?t?this._anchorCache.A1_G1:this._anchorCache.A1_G0:t?this._anchorCache.A0_G1:this._anchorCache.A0_G0}},Ml=class{_items;_hasAnchors;_cached;_anchorCache;constructor(){this._items=[],this._hasAnchors=!1,this._cached=null,this._anchorCache={A0_G0:null,A0_G1:null,A1_G0:null,A1_G1:null}}dispose(){this._disposeCaches()}_disposeCaches(){this._cached&&=(this._cached.dispose(),null),this._anchorCache.A0_G0&&(this._anchorCache.A0_G0.dispose(),this._anchorCache.A0_G0=null),this._anchorCache.A0_G1&&(this._anchorCache.A0_G1.dispose(),this._anchorCache.A0_G1=null),this._anchorCache.A1_G0&&(this._anchorCache.A1_G0.dispose(),this._anchorCache.A1_G0=null),this._anchorCache.A1_G1&&(this._anchorCache.A1_G1.dispose(),this._anchorCache.A1_G1=null)}push(e){this._items.push(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}unshift(e){this._items.unshift(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}length(){return this._items.length}setSource(e,t){this._items[e].source!==t&&(this._disposeCaches(),this._items[e].setSource(t))}compile(e){if(!this._cached){let t=this._items.map(e=>e.source);this._cached=new Nl(e,t,this._items.map(e=>e.ruleId))}return this._cached}compileAG(e,t,n){return this._hasAnchors?t?n?(this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G1):(this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G0):n?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G0):this.compile(e)}_resolveAnchors(e,t,n){return new Nl(e,this._items.map(e=>e.resolveAnchors(t,n)),this._items.map(e=>e.ruleId))}},Nl=class{constructor(e,t,n){this.regExps=t,this.rules=n,this.scanner=e.createOnigScanner(t)}scanner;dispose(){typeof this.scanner.dispose==`function`&&this.scanner.dispose()}toString(){let e=[];for(let t=0,n=this.rules.length;t<n;t++)e.push(` - `+this.rules[t]+`: `+this.regExps[t]);return e.join(`
12
+ `)}findNextMatchSync(e,t,n){let r=this.scanner.findNextMatchSync(e,t,n);return r?{ruleId:this.rules[r.index],captureIndices:r.captureIndices}:null}},Pl=class{constructor(e,t){this.languageId=e,this.tokenType=t}},Fl=class e{_defaultAttributes;_embeddedLanguagesMatcher;constructor(e,t){this._defaultAttributes=new Pl(e,8),this._embeddedLanguagesMatcher=new Il(Object.entries(t||{}))}getDefaultAttributes(){return this._defaultAttributes}getBasicScopeAttributes(t){return t===null?e._NULL_SCOPE_METADATA:this._getBasicScopeAttributes.get(t)}static _NULL_SCOPE_METADATA=new Pl(0,0);_getBasicScopeAttributes=new Rc(e=>new Pl(this._scopeToLanguage(e),this._toStandardTokenType(e)));_scopeToLanguage(e){return this._embeddedLanguagesMatcher.match(e)||0}_toStandardTokenType(t){let n=t.match(e.STANDARD_TOKEN_TYPE_REGEXP);if(!n)return 8;switch(n[1]){case`comment`:return 1;case`string`:return 2;case`regex`:return 3;case`meta.embedded`:return 0}throw Error(`Unexpected match for standard token type!`)}static STANDARD_TOKEN_TYPE_REGEXP=/\b(comment|string|regex|meta\.embedded)\b/},Il=class{values;scopesRegExp;constructor(e){if(e.length===0)this.values=null,this.scopesRegExp=null;else{this.values=new Map(e);let t=e.map(([e,t])=>Lc(e));t.sort(),t.reverse(),this.scopesRegExp=RegExp(`^((${t.join(`)|(`)}))($|\\.)`,``)}}match(e){if(!this.scopesRegExp)return;let t=e.match(this.scopesRegExp);if(t)return this.values.get(t[1])}};typeof process<`u`&&{}.VSCODE_TEXTMATE_DEBUG;var Ll=class{constructor(e,t){this.stack=e,this.stoppedEarly=t}};function Rl(e,t,n,r,i,a,o,s){let c=t.content.length,l=!1,u=-1;if(o){let o=zl(e,t,n,r,i,a);i=o.stack,r=o.linePos,n=o.isFirstLine,u=o.anchorPosition}let d=Date.now();for(;!l;){if(s!==0&&Date.now()-d>s)return new Ll(i,!0);f()}return new Ll(i,!1);function f(){let o=Bl(e,t,n,r,i,u);if(!o){a.produce(i,c),l=!0;return}let s=o.captureIndices,d=o.matchedRuleId,f=s&&s.length>0?s[0].end>r:!1;if(d===bl){let o=i.getRule(e);a.produce(i,s[0].start),i=i.withContentNameScopesList(i.nameScopesList),Gl(e,t,n,i,a,o.endCaptures,s),a.produce(i,s[0].end);let d=i;if(i=i.parent,u=d.getAnchorPos(),!f&&d.getEnterPos()===r){i=d,a.produce(i,c),l=!0;return}}else{let o=e.getRule(d);a.produce(i,s[0].start);let p=i,m=o.getName(t.content,s),h=i.contentNameScopesList.pushAttributed(m,e);if(i=i.push(d,r,u,s[0].end===c,null,h,h),o instanceof Ol){let r=o;Gl(e,t,n,i,a,r.beginCaptures,s),a.produce(i,s[0].end),u=s[0].end;let d=r.getContentName(t.content,s),m=h.pushAttributed(d,e);if(i=i.withContentNameScopesList(m),r.endHasBackReferences&&(i=i.withEndRule(r.getEndWithResolvedBackReferences(t.content,s))),!f&&p.hasSameRuleAs(i)){i=i.pop(),a.produce(i,c),l=!0;return}}else if(o instanceof kl){let r=o;Gl(e,t,n,i,a,r.beginCaptures,s),a.produce(i,s[0].end),u=s[0].end;let d=r.getContentName(t.content,s),m=h.pushAttributed(d,e);if(i=i.withContentNameScopesList(m),r.whileHasBackReferences&&(i=i.withEndRule(r.getWhileWithResolvedBackReferences(t.content,s))),!f&&p.hasSameRuleAs(i)){i=i.pop(),a.produce(i,c),l=!0;return}}else if(Gl(e,t,n,i,a,o.captures,s),a.produce(i,s[0].end),i=i.pop(),!f){i=i.safePop(),a.produce(i,c),l=!0;return}}s[0].end>r&&(r=s[0].end,n=!1)}}function zl(e,t,n,r,i,a){let o=i.beginRuleCapturedEOL?0:-1,s=[];for(let t=i;t;t=t.pop()){let n=t.getRule(e);n instanceof kl&&s.push({rule:n,stack:t})}for(let c=s.pop();c;c=s.pop()){let{ruleScanner:s,findOptions:l}=Wl(c.rule,e,c.stack.endRule,n,r===o),u=s.findNextMatchSync(t,r,l);if(u){if(u.ruleId!==xl){i=c.stack.pop();break}u.captureIndices&&u.captureIndices.length&&(a.produce(c.stack,u.captureIndices[0].start),Gl(e,t,n,c.stack,a,c.rule.whileCaptures,u.captureIndices),a.produce(c.stack,u.captureIndices[0].end),o=u.captureIndices[0].end,u.captureIndices[0].end>r&&(r=u.captureIndices[0].end,n=!1))}else{i=c.stack.pop();break}}return{stack:i,linePos:r,anchorPosition:o,isFirstLine:n}}function Bl(e,t,n,r,i,a){let o=Vl(e,t,n,r,i,a),s=e.getInjections();if(s.length===0)return o;let c=Hl(s,e,t,n,r,i,a);if(!c)return o;if(!o)return c;let l=o.captureIndices[0].start,u=c.captureIndices[0].start;return u<l||c.priorityMatch&&u===l?c:o}function Vl(e,t,n,r,i,a){let{ruleScanner:o,findOptions:s}=Ul(i.getRule(e),e,i.endRule,n,r===a),c=o.findNextMatchSync(t,r,s);return c?{captureIndices:c.captureIndices,matchedRuleId:c.ruleId}:null}function Hl(e,t,n,r,i,a,o){let s=Number.MAX_VALUE,c=null,l,u=0,d=a.contentNameScopesList.getScopeNames();for(let a=0,f=e.length;a<f;a++){let f=e[a];if(!f.matcher(d))continue;let{ruleScanner:p,findOptions:m}=Ul(t.getRule(f.ruleId),t,null,r,i===o),h=p.findNextMatchSync(n,i,m);if(!h)continue;let g=h.captureIndices[0].start;if(!(g>=s)&&(s=g,c=h.captureIndices,l=h.ruleId,u=f.priority,s===i))break}return c?{priorityMatch:u===-1,captureIndices:c,matchedRuleId:l}:null}function Ul(e,t,n,r,i){return{ruleScanner:e.compileAG(t,n,r,i),findOptions:0}}function Wl(e,t,n,r,i){return{ruleScanner:e.compileWhileAG(t,n,r,i),findOptions:0}}function Gl(e,t,n,r,i,a,o){if(a.length===0)return;let s=t.content,c=Math.min(a.length,o.length),l=[],u=o[0].end;for(let t=0;t<c;t++){let c=a[t];if(c===null)continue;let d=o[t];if(d.length===0)continue;if(d.start>u)break;for(;l.length>0&&l[l.length-1].endPos<=d.start;)i.produceFromScopes(l[l.length-1].scopes,l[l.length-1].endPos),l.pop();if(l.length>0?i.produceFromScopes(l[l.length-1].scopes,d.start):i.produce(r,d.start),c.retokenizeCapturedWithRuleId){let t=c.getName(s,o),a=r.contentNameScopesList.pushAttributed(t,e),l=c.getContentName(s,o),u=a.pushAttributed(l,e),f=r.push(c.retokenizeCapturedWithRuleId,d.start,-1,!1,null,a,u),p=e.createOnigString(s.substring(0,d.end));Rl(e,p,n&&d.start===0,d.start,f,i,!1,0),rl(p);continue}let f=c.getName(s,o);if(f!==null){let t=(l.length>0?l[l.length-1].scopes:r.contentNameScopesList).pushAttributed(f,e);l.push(new Kl(t,d.end))}}for(;l.length>0;)i.produceFromScopes(l[l.length-1].scopes,l[l.length-1].endPos),l.pop()}var Kl=class{scopes;endPos;constructor(e,t){this.scopes=e,this.endPos=t}};function ql(e,t,n,r,i,a,o,s){return new Zl(e,t,n,r,i,a,o,s)}function Jl(e,t,n,r,i){let a=el(t,Yl),o=Al.getCompiledRuleId(n,r,i.repository);for(let n of a)e.push({debugSelector:t,matcher:n.matcher,ruleId:o,grammar:i,priority:n.priority})}function Yl(e,t){if(t.length<e.length)return!1;let n=0;return e.every(e=>{for(let r=n;r<t.length;r++)if(Xl(t[r],e))return n=r+1,!0;return!1})}function Xl(e,t){if(!e)return!1;if(e===t)return!0;let n=t.length;return e.length>n&&e.substr(0,n)===t&&e[n]===`.`}var Zl=class{constructor(e,t,n,r,i,a,o,s){if(this._rootScopeName=e,this.balancedBracketSelectors=a,this._onigLib=s,this._basicScopeAttributesProvider=new Fl(n,r),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=o,this._grammar=Ql(t,null),this._injections=null,this._tokenTypeMatchers=[],i)for(let e of Object.keys(i)){let t=el(e,Yl);for(let n of t)this._tokenTypeMatchers.push({matcher:n.matcher,type:i[e]})}}_rootId;_lastRuleId;_ruleId2desc;_includedGrammars;_grammarRepository;_grammar;_injections;_basicScopeAttributesProvider;_tokenTypeMatchers;get themeProvider(){return this._grammarRepository}dispose(){for(let e of this._ruleId2desc)e&&e.dispose()}createOnigScanner(e){return this._onigLib.createOnigScanner(e)}createOnigString(e){return this._onigLib.createOnigString(e)}getMetadataForScope(e){return this._basicScopeAttributesProvider.getBasicScopeAttributes(e)}_collectInjections(){let e={lookup:e=>e===this._rootScopeName?this._grammar:this.getExternalGrammar(e),injections:e=>this._grammarRepository.injections(e)},t=[],n=this._rootScopeName,r=e.lookup(n);if(r){let e=r.injections;if(e)for(let n in e)Jl(t,n,e[n],this,r);let i=this._grammarRepository.injections(n);i&&i.forEach(e=>{let n=this.getExternalGrammar(e);if(n){let e=n.injectionSelector;e&&Jl(t,e,n,this,n)}})}return t.sort((e,t)=>e.priority-t.priority),t}getInjections(){return this._injections===null&&(this._injections=this._collectInjections()),this._injections}registerRule(e){let t=++this._lastRuleId,n=e(Sl(t));return this._ruleId2desc[t]=n,n}getRule(e){return this._ruleId2desc[Cl(e)]}getExternalGrammar(e,t){if(this._includedGrammars[e])return this._includedGrammars[e];if(this._grammarRepository){let n=this._grammarRepository.lookup(e);if(n)return this._includedGrammars[e]=Ql(n,t&&t.$base),this._includedGrammars[e]}}tokenizeLine(e,t,n=0){let r=this._tokenize(e,t,!1,n);return{tokens:r.lineTokens.getResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}tokenizeLine2(e,t,n=0){let r=this._tokenize(e,t,!0,n);return{tokens:r.lineTokens.getBinaryResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}_tokenize(e,t,n,r){this._rootId===-1&&(this._rootId=Al.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections());let i;if(!t||t===eu.NULL){i=!0;let e=this._basicScopeAttributesProvider.getDefaultAttributes(),n=this.themeProvider.getDefaults(),r=Zc.set(0,e.languageId,e.tokenType,null,n.fontStyle,n.foregroundId,n.backgroundId),a=this.getRule(this._rootId).getName(null,null),o;o=a?$l.createRootAndLookUpScopeName(a,r,this):$l.createRoot(`unknown`,r),t=new eu(null,this._rootId,-1,-1,!1,null,o,o)}else i=!1,t.reset();e+=`
13
+ `;let a=this.createOnigString(e),o=a.content.length,s=new nu(n,e,this._tokenTypeMatchers,this.balancedBracketSelectors),c=Rl(this,a,i,0,t,s,!0,r);return rl(a),{lineLength:o,lineTokens:s,ruleStack:c.stack,stoppedEarly:c.stoppedEarly}}};function Ql(e,t){return e=hee(e),e.repository=e.repository||{},e.repository.$self={$vscodeTextmateLocation:e.$vscodeTextmateLocation,patterns:e.patterns,name:e.scopeName},e.repository.$base=t||e.repository.$self,e}var $l=class e{constructor(e,t,n){this.parent=e,this.scopePath=t,this.tokenAttributes=n}static fromExtension(t,n){let r=t,i=t?.scopePath??null;for(let t of n)i=Bc.push(i,t.scopeNames),r=new e(r,i,t.encodedTokenAttributes);return r}static createRoot(t,n){return new e(null,new Bc(null,t),n)}static createRootAndLookUpScopeName(t,n,r){let i=r.getMetadataForScope(t),a=new Bc(null,t),o=r.themeProvider.themeMatch(a),s=e.mergeAttributes(n,i,o);return new e(null,a,s)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(` `)}equals(t){return e.equals(this,t)}static equals(e,t){do{if(e===t||!e&&!t)return!0;if(!e||!t||e.scopeName!==t.scopeName||e.tokenAttributes!==t.tokenAttributes)return!1;e=e.parent,t=t.parent}while(1)}static mergeAttributes(e,t,n){let r=-1,i=0,a=0;return n!==null&&(r=n.fontStyle,i=n.foregroundId,a=n.backgroundId),Zc.set(e,t.languageId,t.tokenType,null,r,i,a)}pushAttributed(t,n){if(t===null)return this;if(t.indexOf(` `)===-1)return e._pushAttributed(this,t,n);let r=t.split(/ /g),i=this;for(let t of r)i=e._pushAttributed(i,t,n);return i}static _pushAttributed(t,n,r){let i=r.getMetadataForScope(n),a=t.scopePath.push(n),o=r.themeProvider.themeMatch(a),s=e.mergeAttributes(t.tokenAttributes,i,o);return new e(t,a,s)}getScopeNames(){return this.scopePath.getSegments()}getExtensionIfDefined(e){let t=[],n=this;for(;n&&n!==e;)t.push({encodedTokenAttributes:n.tokenAttributes,scopeNames:n.scopePath.getExtensionIfDefined(n.parent?.scopePath??null)}),n=n.parent;return n===e?t.reverse():void 0}},eu=class e{constructor(e,t,n,r,i,a,o,s){this.parent=e,this.ruleId=t,this.beginRuleCapturedEOL=i,this.endRule=a,this.nameScopesList=o,this.contentNameScopesList=s,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=n,this._anchorPos=r}_stackElementBrand=void 0;static NULL=new e(null,0,0,0,!1,null,null,null);_enterPos;_anchorPos;depth;equals(t){return t!==null&&e._equals(this,t)}static _equals(e,t){return e===t?!0:this._structuralEquals(e,t)?$l.equals(e.contentNameScopesList,t.contentNameScopesList):!1}static _structuralEquals(e,t){do{if(e===t||!e&&!t)return!0;if(!e||!t||e.depth!==t.depth||e.ruleId!==t.ruleId||e.endRule!==t.endRule)return!1;e=e.parent,t=t.parent}while(1)}clone(){return this}static _reset(e){for(;e;)e._enterPos=-1,e._anchorPos=-1,e=e.parent}reset(){e._reset(this)}pop(){return this.parent}safePop(){return this.parent?this.parent:this}push(t,n,r,i,a,o,s){return new e(this,t,n,r,i,a,o,s)}getEnterPos(){return this._enterPos}getAnchorPos(){return this._anchorPos}getRule(e){return e.getRule(this.ruleId)}toString(){let e=[];return this._writeString(e,0),`[`+e.join(`,`)+`]`}_writeString(e,t){return this.parent&&(t=this.parent._writeString(e,t)),e[t++]=`(${this.ruleId}, ${this.nameScopesList?.toString()}, ${this.contentNameScopesList?.toString()})`,t}withContentNameScopesList(e){return this.contentNameScopesList===e?this:this.parent.push(this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,this.endRule,this.nameScopesList,e)}withEndRule(t){return this.endRule===t?this:new e(this.parent,this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,t,this.nameScopesList,this.contentNameScopesList)}hasSameRuleAs(e){let t=this;for(;t&&t._enterPos===e._enterPos;){if(t.ruleId===e.ruleId)return!0;t=t.parent}return!1}toStateStackFrame(){return{ruleId:Cl(this.ruleId),beginRuleCapturedEOL:this.beginRuleCapturedEOL,endRule:this.endRule,nameScopesList:this.nameScopesList?.getExtensionIfDefined(this.parent?.nameScopesList??null)??[],contentNameScopesList:this.contentNameScopesList?.getExtensionIfDefined(this.nameScopesList)??[]}}static pushFrame(t,n){let r=$l.fromExtension(t?.nameScopesList??null,n.nameScopesList);return new e(t,Sl(n.ruleId),n.enterPos??-1,n.anchorPos??-1,n.beginRuleCapturedEOL,n.endRule,r,$l.fromExtension(r,n.contentNameScopesList))}},tu=class{balancedBracketScopes;unbalancedBracketScopes;allowAny=!1;constructor(e,t){this.balancedBracketScopes=e.flatMap(e=>e===`*`?(this.allowAny=!0,[]):el(e,Yl).map(e=>e.matcher)),this.unbalancedBracketScopes=t.flatMap(e=>el(e,Yl).map(e=>e.matcher))}get matchesAlways(){return this.allowAny&&this.unbalancedBracketScopes.length===0}get matchesNever(){return this.balancedBracketScopes.length===0&&!this.allowAny}match(e){for(let t of this.unbalancedBracketScopes)if(t(e))return!1;for(let t of this.balancedBracketScopes)if(t(e))return!0;return this.allowAny}},nu=class{constructor(e,t,n,r){this.balancedBracketSelectors=r,this._emitBinaryTokens=e,this._tokenTypeOverrides=n,this._lineText=null,this._tokens=[],this._binaryTokens=[],this._lastTokenEndIndex=0}_emitBinaryTokens;_lineText;_tokens;_binaryTokens;_lastTokenEndIndex;_tokenTypeOverrides;produce(e,t){this.produceFromScopes(e.contentNameScopesList,t)}produceFromScopes(e,t){if(this._lastTokenEndIndex>=t)return;if(this._emitBinaryTokens){let n=e?.tokenAttributes??0,r=!1;if(this.balancedBracketSelectors?.matchesAlways&&(r=!0),this._tokenTypeOverrides.length>0||this.balancedBracketSelectors&&!this.balancedBracketSelectors.matchesAlways&&!this.balancedBracketSelectors.matchesNever){let t=e?.getScopeNames()??[];for(let e of this._tokenTypeOverrides)e.matcher(t)&&(n=Zc.set(n,0,Qc(e.type),null,-1,0,0));this.balancedBracketSelectors&&(r=this.balancedBracketSelectors.match(t))}if(r&&(n=Zc.set(n,0,8,r,-1,0,0)),this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-1]===n){this._lastTokenEndIndex=t;return}this._binaryTokens.push(this._lastTokenEndIndex),this._binaryTokens.push(n),this._lastTokenEndIndex=t;return}let n=e?.getScopeNames()??[];this._tokens.push({startIndex:this._lastTokenEndIndex,endIndex:t,scopes:n}),this._lastTokenEndIndex=t}getResult(e,t){return this._tokens.length>0&&this._tokens[this._tokens.length-1].startIndex===t-1&&this._tokens.pop(),this._tokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._tokens[this._tokens.length-1].startIndex=0),this._tokens}getBinaryResult(e,t){this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-2]===t-1&&(this._binaryTokens.pop(),this._binaryTokens.pop()),this._binaryTokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._binaryTokens[this._binaryTokens.length-2]=0);let n=new Uint32Array(this._binaryTokens.length);for(let e=0,t=this._binaryTokens.length;e<t;e++)n[e]=this._binaryTokens[e];return n}},ru=class{constructor(e,t){this._onigLib=t,this._theme=e}_grammars=new Map;_rawGrammars=new Map;_injectionGrammars=new Map;_theme;dispose(){for(let e of this._grammars.values())e.dispose()}setTheme(e){this._theme=e}getColorMap(){return this._theme.getColorMap()}addGrammar(e,t){this._rawGrammars.set(e.scopeName,e),t&&this._injectionGrammars.set(e.scopeName,t)}lookup(e){return this._rawGrammars.get(e)}injections(e){return this._injectionGrammars.get(e)}getDefaults(){return this._theme.getDefaults()}themeMatch(e){return this._theme.match(e)}grammarForScopeName(e,t,n,r,i){if(!this._grammars.has(e)){let a=this._rawGrammars.get(e);if(!a)return null;this._grammars.set(e,ql(e,a,t,n,r,i,this,this._onigLib))}return this._grammars.get(e)}},iu=class{_options;_syncRegistry;_ensureGrammarCache;constructor(e){this._options=e,this._syncRegistry=new ru(zc.createFromRawTheme(e.theme,e.colorMap),e.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(e,t){this._syncRegistry.setTheme(zc.createFromRawTheme(e,t))}getColorMap(){return this._syncRegistry.getColorMap()}loadGrammarWithEmbeddedLanguages(e,t,n){return this.loadGrammarWithConfiguration(e,t,{embeddedLanguages:n})}loadGrammarWithConfiguration(e,t,n){return this._loadGrammar(e,t,n.embeddedLanguages,n.tokenTypes,new tu(n.balancedBracketSelectors||[],n.unbalancedBracketSelectors||[]))}loadGrammar(e){return this._loadGrammar(e,0,null,null,null)}_loadGrammar(e,t,n,r,i){let a=new sl(this._syncRegistry,e);for(;a.Q.length>0;)a.Q.map(e=>this._loadSingleGrammar(e.scopeName)),a.processQueue();return this._grammarForScopeName(e,t,n,r,i)}_loadSingleGrammar(e){this._ensureGrammarCache.has(e)||(this._doLoadSingleGrammar(e),this._ensureGrammarCache.set(e,!0))}_doLoadSingleGrammar(e){let t=this._options.loadGrammar(e);if(t){let n=typeof this._options.getInjections==`function`?this._options.getInjections(e):void 0;this._syncRegistry.addGrammar(t,n)}}addGrammar(e,t=[],n=0,r=null){return this._syncRegistry.addGrammar(e,t),this._grammarForScopeName(e.scopeName,n,r)}_grammarForScopeName(e,t=0,n=null,r=null,i=null){return this._syncRegistry.grammarForScopeName(e,t,n,r,i)}},au=eu.NULL;function ou(e,t){let n=typeof e==`string`?{}:{...e.colorReplacements},r=typeof e==`string`?e:e.name;for(let[e,i]of Object.entries(t?.colorReplacements||{}))typeof i==`string`?n[e]=i:e===r&&Object.assign(n,i);return n}function su(e,t){return e&&(t?.[e?.toLowerCase()]||e)}function cu(e){return Array.isArray(e)?e:[e]}async function lu(e){return Promise.resolve(typeof e==`function`?e():e).then(e=>e.default||e)}function uu(e){return!e||[`plaintext`,`txt`,`text`,`plain`].includes(e)}function du(e){return e===`ansi`||uu(e)}function fu(e){return e===`none`}function pu(e){return fu(e)}var mu=/(\r?\n)/g;function hu(e,t=!1){if(e.length===0)return[[``,0]];let n=e.split(mu),r=0,i=[];for(let e=0;e<n.length;e+=2){let a=t?n[e]+(n[e+1]||``):n[e];i.push([a,r]),r+=n[e].length,r+=n[e+1]?.length||0}return i}var gu={light:`#333333`,dark:`#bbbbbb`},_u={light:`#fffffe`,dark:`#1e1e1e`},vu=`__shiki_resolved`;function yu(e){if(e?.[vu])return e;let t={...e};t.tokenColors&&!t.settings&&(t.settings=t.tokenColors,delete t.tokenColors),t.type||=`dark`,t.colorReplacements={...t.colorReplacements},t.settings||=[];let{bg:n,fg:r}=t;if(!n||!r){let e=t.settings?t.settings.find(e=>!e.name&&!e.scope):void 0;e?.settings?.foreground&&(r=e.settings.foreground),e?.settings?.background&&(n=e.settings.background),!r&&t?.colors?.[`editor.foreground`]&&(r=t.colors[`editor.foreground`]),!n&&t?.colors?.[`editor.background`]&&(n=t.colors[`editor.background`]),r||=t.type===`light`?gu.light:gu.dark,n||=t.type===`light`?_u.light:_u.dark,t.fg=r,t.bg=n}t.settings[0]&&t.settings[0].settings&&!t.settings[0].scope||t.settings.unshift({settings:{foreground:t.fg,background:t.bg}});let i=0,a=new Map;function o(e){if(a.has(e))return a.get(e);i+=1;let n=`#${i.toString(16).padStart(8,`0`).toLowerCase()}`;return t.colorReplacements?.[`#${n}`]?o(e):(a.set(e,n),n)}t.settings=t.settings.map(e=>{let n=e.settings?.foreground&&!e.settings.foreground.startsWith(`#`),r=e.settings?.background&&!e.settings.background.startsWith(`#`);if(!n&&!r)return e;let i={...e,settings:{...e.settings}};if(n){let n=o(e.settings.foreground);t.colorReplacements[n]=e.settings.foreground,i.settings.foreground=n}if(r){let n=o(e.settings.background);t.colorReplacements[n]=e.settings.background,i.settings.background=n}return i});for(let e of Object.keys(t.colors||{}))if((e===`editor.foreground`||e===`editor.background`||e.startsWith(`terminal.ansi`))&&!t.colors[e]?.startsWith(`#`)){let n=o(t.colors[e]);t.colorReplacements[n]=t.colors[e],t.colors[e]=n}return Object.defineProperty(t,vu,{enumerable:!1,writable:!1,value:!0}),t}async function bu(e){return[...new Set((await Promise.all(e.filter(e=>!du(e)).map(async e=>await lu(e).then(e=>Array.isArray(e)?e:[e])))).flat())]}async function xu(e){return(await Promise.all(e.map(async e=>pu(e)?null:yu(await lu(e))))).filter(e=>!!e)}function Su(e,t){if(!t)return e;if(t[e]){let n=new Set([e]);for(;t[e];){if(e=t[e],n.has(e))throw new Oc(`Circular alias \`${[...n].join(` -> `)} -> ${e}\``);n.add(e)}}return e}var Cu=class extends iu{_resolver;_themes;_langs;_alias;_resolvedThemes=new Map;_resolvedGrammars=new Map;_langMap=new Map;_langGraph=new Map;_textmateThemeCache=new WeakMap;_loadedThemesCache=null;_loadedLanguagesCache=null;constructor(e,t,n,r={}){super(e),this._resolver=e,this._themes=t,this._langs=n,this._alias=r,this._themes.map(e=>this.loadTheme(e)),this.loadLanguages(this._langs)}getTheme(e){return typeof e==`string`?this._resolvedThemes.get(e):this.loadTheme(e)}loadTheme(e){let t=yu(e);return t.name&&(this._resolvedThemes.set(t.name,t),this._loadedThemesCache=null),t}getLoadedThemes(){return this._loadedThemesCache||=[...this._resolvedThemes.keys()],this._loadedThemesCache}setTheme(e){let t=this._textmateThemeCache.get(e);t||(t=zc.createFromRawTheme(e),this._textmateThemeCache.set(e,t)),this._syncRegistry.setTheme(t)}getGrammar(e){return e=Su(e,this._alias),this._resolvedGrammars.get(e)}loadLanguage(e){if(this.getGrammar(e.name))return;let t=new Set([...this._langMap.values()].filter(t=>t.embeddedLangsLazy?.includes(e.name)));this._resolver.addLanguage(e);let n={balancedBracketSelectors:e.balancedBracketSelectors||[`*`],unbalancedBracketSelectors:e.unbalancedBracketSelectors||[]};this._syncRegistry._rawGrammars.set(e.scopeName,e);let r=this.loadGrammarWithConfiguration(e.scopeName,1,n);if(r.name=e.name,this._resolvedGrammars.set(e.name,r),e.aliases&&e.aliases.forEach(t=>{this._alias[t]=e.name}),this._loadedLanguagesCache=null,t.size)for(let e of t)this._resolvedGrammars.delete(e.name),this._loadedLanguagesCache=null,this._syncRegistry?._injectionGrammars?.delete(e.scopeName),this._syncRegistry?._grammars?.delete(e.scopeName),this.loadLanguage(this._langMap.get(e.name))}dispose(){super.dispose(),this._resolvedThemes.clear(),this._resolvedGrammars.clear(),this._langMap.clear(),this._langGraph.clear(),this._loadedThemesCache=null}loadLanguages(e){for(let t of e)this.resolveEmbeddedLanguages(t);let t=[...this._langGraph.entries()],n=t.filter(([e,t])=>!t);if(n.length){let e=t.filter(([e,t])=>t?(t.embeddedLanguages||t.embeddedLangs)?.some(e=>n.map(([e])=>e).includes(e)):!1).filter(e=>!n.includes(e));throw new Oc(`Missing languages ${n.map(([e])=>`\`${e}\``).join(`, `)}, required by ${e.map(([e])=>`\`${e}\``).join(`, `)}`)}for(let[e,n]of t)this._resolver.addLanguage(n);for(let[e,n]of t)this.loadLanguage(n)}getLoadedLanguages(){return this._loadedLanguagesCache||=[...new Set([...this._resolvedGrammars.keys(),...Object.keys(this._alias)])],this._loadedLanguagesCache}resolveEmbeddedLanguages(e){this._langMap.set(e.name,e),this._langGraph.set(e.name,e);let t=e.embeddedLanguages??e.embeddedLangs;if(t)for(let e of t)this._langGraph.set(e,this._langMap.get(e))}},wu=class{_langs=new Map;_scopeToLang=new Map;_injections=new Map;_onigLib;constructor(e,t){this._onigLib={createOnigScanner:t=>e.createScanner(t),createOnigString:t=>e.createString(t)},t.forEach(e=>this.addLanguage(e))}get onigLib(){return this._onigLib}getLangRegistration(e){return this._langs.get(e)}loadGrammar(e){return this._scopeToLang.get(e)}addLanguage(e){this._langs.set(e.name,e),e.aliases&&e.aliases.forEach(t=>{this._langs.set(t,e)}),this._scopeToLang.set(e.scopeName,e),e.injectTo&&e.injectTo.forEach(t=>{this._injections.get(t)||this._injections.set(t,[]),this._injections.get(t).push(e.scopeName)})}getInjections(e){let t=e.split(`.`),n=[];for(let e=1;e<=t.length;e++){let r=t.slice(0,e).join(`.`);n=[...n,...this._injections.get(r)||[]]}return n}},Tu=0;function Eu(e){Tu+=1,e.warnings!==!1&&Tu>=10&&Tu%10==0&&console.warn(`[Shiki] ${Tu} instances have been created. Shiki is supposed to be used as a singleton, consider refactoring your code to cache your highlighter instance; Or call \`highlighter.dispose()\` to release unused instances.`);let t=!1;if(!e.engine)throw new Oc("`engine` option is required for synchronous mode");let n=(e.langs||[]).flat(1),r=(e.themes||[]).flat(1).map(yu),i=new Cu(new wu(e.engine,n),r,n,e.langAlias),a;function o(t){return Su(t,e.langAlias)}function s(e){g();let t=i.getGrammar(typeof e==`string`?e:e.name);if(!t)throw new Oc(`Language \`${e}\` not found, you may need to load it first`);return t}function c(e){if(e===`none`)return{bg:``,fg:``,name:`none`,settings:[],type:`dark`};g();let t=i.getTheme(e);if(!t)throw new Oc(`Theme \`${e}\` not found, you may need to load it first`);return t}function l(e){g();let t=c(e);return a!==e&&(i.setTheme(t),a=e),{theme:t,colorMap:i.getColorMap()}}function u(){return g(),i.getLoadedThemes()}function d(){return g(),i.getLoadedLanguages()}function f(...e){g(),i.loadLanguages(e.flat(1))}async function p(...e){return f(await bu(e))}function m(...e){g();for(let t of e.flat(1))i.loadTheme(t)}async function h(...e){return g(),m(await xu(e))}function g(){if(t)throw new Oc(`Shiki instance has been disposed`)}function _(){t||(t=!0,i.dispose(),--Tu)}return{setTheme:l,getTheme:c,getLanguage:s,getLoadedThemes:u,getLoadedLanguages:d,resolveLangAlias:o,loadLanguage:p,loadLanguageSync:f,loadTheme:h,loadThemeSync:m,dispose:_,[Symbol.dispose]:_}}async function Du(e){e.engine||console.warn("`engine` option is required. Use `createOnigurumaEngine` or `createJavaScriptRegexEngine` to create an engine.");let[t,n,r]=await Promise.all([xu(e.themes||[]),bu(e.langs||[]),e.engine]);return Eu({...e,themes:t,langs:n,engine:r})}var Ou=new WeakMap;function ku(e,t){Ou.set(e,t)}function Au(e){return Ou.get(e)}var ju=class e{_stacks={};lang;get themes(){return Object.keys(this._stacks)}get theme(){return this.themes[0]}get _stack(){return this._stacks[this.theme]}static initial(t,n){return new e(Object.fromEntries(cu(n).map(e=>[e,au])),t)}constructor(...e){if(e.length===2){let[t,n]=e;this.lang=n,this._stacks=t}else{let[t,n,r]=e;this.lang=n,this._stacks={[r]:t}}}getInternalStack(e=this.theme){return this._stacks[e]}getScopes(e=this.theme){return Mu(this._stacks[e])}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.getScopes()}}};function Mu(e){let t=[],n=new Set;function r(e){if(n.has(e))return;n.add(e);let i=e?.nameScopesList?.scopeName;i&&t.push(i),e.parent&&r(e.parent)}return r(e),t}function Nu(e,t){if(!(e instanceof ju))throw new Oc(`Invalid grammar state`);return e.getInternalStack(t)}var Pu=/,/,Fu=/ /;function Iu(e,t,n={}){let{theme:r=e.getLoadedThemes()[0]}=n;if(uu(e.resolveLangAlias(n.lang||`text`))||fu(r))return hu(t).map(e=>[{content:e[0],offset:e[1]}]);let{theme:i,colorMap:a}=e.setTheme(r),o=e.getLanguage(n.lang||`text`);if(n.grammarState){if(n.grammarState.lang!==o.name)throw new Oc(`Grammar state language "${n.grammarState.lang}" does not match highlight language "${o.name}"`);if(!n.grammarState.themes.includes(i.name))throw new Oc(`Grammar state themes "${n.grammarState.themes}" do not contain highlight theme "${i.name}"`)}return Ru(t,o,i,a,n)}function Lu(...e){if(e.length===2)return Au(e[1]);let[t,n,r={}]=e,{lang:i=`text`,theme:a=t.getLoadedThemes()[0]}=r;if(uu(i)||fu(a))throw new Oc(`Plain language does not have grammar state`);if(i===`ansi`)throw new Oc(`ANSI language does not have grammar state`);let{theme:o,colorMap:s}=t.setTheme(a),c=t.getLanguage(i);return new ju(zu(n,c,o,s,r).stateStack,c.name,o.name)}function Ru(e,t,n,r,i){let a=zu(e,t,n,r,i),o=new ju(a.stateStack,t.name,n.name);return ku(a.tokens,o),a.tokens}function zu(e,t,n,r,i){let a=ou(n,i),{tokenizeMaxLineLength:o=0,tokenizeTimeLimit:s=500,includeExplanation:c=!1}=i,l=hu(e),u=i.grammarState?Nu(i.grammarState,n.name)??au:i.grammarContextCode==null?au:zu(i.grammarContextCode,t,n,r,{...i,grammarState:void 0,grammarContextCode:void 0}).stateStack,d=[],f=[];for(let e=0,i=l.length;e<i;e++){let[i,p]=l[e];if(i===``){d=[],f.push([]);continue}if(o>0&&i.length>=o){d=[],f.push([{content:i,offset:p,color:``,fontStyle:0}]);continue}let m,h,g;c&&c!==`tokenType`&&(m=t.tokenizeLine(i,u,s),h=m.tokens,g=0);let _=t.tokenizeLine2(i,u,s),v=_.tokens.length/2;for(let e=0;e<v;e++){let t=_.tokens[2*e],o=e+1<v?_.tokens[2*e+2]:i.length;if(t===o)continue;let s=_.tokens[2*e+1],l=su(r[Zc.getForeground(s)],a),u=Zc.getFontStyle(s),f={content:i.substring(t,o),offset:p+t,color:l,fontStyle:u};if(c===`tokenType`)f.type=Zc.getTokenType(s);else if(c){let e=[];if(c!==`scopeName`)for(let t of n.settings){let n;switch(typeof t.scope){case`string`:n=t.scope.split(Pu).map(e=>e.trim());break;case`object`:n=t.scope;break;default:continue}e.push({settings:t,selectors:n.map(e=>e.split(Fu))})}f.explanation=[];let r=0;for(;t+r<o;){let t=h[g],n=i.substring(t.startIndex,t.endIndex);r+=n.length,f.explanation.push({content:n,scopes:c===`scopeName`?Bu(t.scopes):Vu(e,t.scopes)}),g+=1}}d.push(f)}f.push(d),d=[],u=_.ruleStack}return{tokens:f,stateStack:u}}function Bu(e){return e.map(e=>({scopeName:e}))}function Vu(e,t){let n=[];for(let r=0,i=t.length;r<i;r++){let i=t[r];n[r]={scopeName:i,themeMatches:Wu(e,i,t.slice(0,r))}}return n}function Hu(e,t){return e===t||t.substring(0,e.length)===e&&t[e.length]===`.`}function Uu(e,t,n){if(!Hu(e.at(-1),t))return!1;let r=e.length-2,i=n.length-1;for(;r>=0&&i>=0;)Hu(e[r],n[i])&&--r,--i;return r===-1}function Wu(e,t,n){let r=[];for(let{selectors:i,settings:a}of e)for(let e of i)if(Uu(e,t,n)){r.push(a);break}return r}function Gu(e,t,n,r=Iu){let i=Object.entries(n.themes).filter(e=>e[1]).map(e=>({color:e[0],theme:e[1]})),a=i.map(i=>{let a=r(e,t,{...n,theme:i.theme});return{tokens:a,state:Au(a),theme:typeof i.theme==`string`?i.theme:i.theme.name}}),o=Ku(...a.map(e=>e.tokens)),s=o[0].map((e,t)=>e.map((e,r)=>{let a={content:e.content,variants:{},offset:e.offset};return`includeExplanation`in n&&n.includeExplanation&&(a.explanation=e.explanation),o.forEach((e,n)=>{let{content:o,explanation:s,offset:c,...l}=e[t][r];a.variants[i[n].color]=l}),a})),c=a[0].state?new ju(Object.fromEntries(a.map(e=>[e.theme,e.state?.getInternalStack(e.theme)])),a[0].state.lang):void 0;return c&&ku(s,c),s}function Ku(...e){let t=e.map(()=>[]),n=e.length;for(let r=0;r<e[0].length;r++){let i=e.map(e=>e[r]),a=t.map(()=>[]);t.forEach((e,t)=>e.push(a[t]));let o=i.map(()=>0),s=i.map(e=>e[0]);for(;s.every(e=>e);){let e=Math.min(...s.map(e=>e.content.length));for(let t=0;t<n;t++){let n=s[t];n.content.length===e?(a[t].push(n),o[t]+=1,s[t]=i[t][o[t]]):(a[t].push({...n,content:n.content.slice(0,e)}),s[t]={...n,content:n.content.slice(e),offset:n.offset+e})}}}return t}function qu(e){let t=[],n=new Set;for(let r of Ju(e.themes)){let e=Zu(r)?r.getThemes():[r];for(let r of e){if(n.has(r.name))throw Error(`Theme collection already contains theme "${r.name}"`);n.add(r.name),t.push(r)}}let r=Object.freeze([...t]),i=Object.freeze(r.filter(e=>e.colorScheme===`light`)),a=Object.freeze(r.filter(e=>e.colorScheme===`dark`)),o=new Map(r.map(e=>[e.name,e])),s=Object.freeze(r.map(e=>e.name)),c=Object.freeze(i.map(e=>e.name)),l=Object.freeze(a.map(e=>e.name));function u(e){if(e==null)return r;let{colorScheme:t,collection:n}=e;return n==null?t===`light`?i:t===`dark`?a:r:r.filter(e=>e.collection===n?t==null||e.colorScheme===t:!1)}return{getTheme(e){return o.get(e)},getThemes(e){return u(e)},getThemeNames(e){return e?.collection==null?e?.colorScheme===`light`?c:e?.colorScheme===`dark`?l:s:u(e).map(e=>e.name)},hasTheme(e){return o.has(e)},orderBy(e){return qu({themes:r.map((e,t)=>({descriptor:e,index:t})).sort((t,n)=>{let r=e(t.descriptor,n.descriptor);return r===0?t.index-n.index:r}).map(e=>e.descriptor)})},pick(e){let t=[],n=new Set;for(let r of e){if(n.has(r))throw Error(`Theme collection pick already includes theme "${r}"`);n.add(r);let e=o.get(r);if(e==null)throw Error(`Theme collection does not contain theme "${r}"`);t.push(e)}return qu({themes:t})},registerInto(e){for(let t of r)e.registerThemeIfAbsent(t.name,t.load)}}}function Ju(e){return Yu(e)?[e]:e}function Yu(e){return Zu(e)||Xu(e)}function Xu(e){return typeof e.name==`string`&&typeof e.load==`function`}function Zu(e){return typeof e.getThemes==`function`}function Qu(e){return typeof e==`object`&&e&&`default`in e?e.default:e}function $u({name:e,load:t,colorScheme:n,collection:r,displayName:i}){return{name:e,colorScheme:n,collection:r,displayName:i,load:ed(t)}}function ed(e){return async()=>yu(Qu(await e()))}var td=`pierre`,nd=[`pierre-dark`,`pierre-dark-soft`,`pierre-dark-vibrant`,`pierre-dark-protanopia-deuteranopia`,`pierre-dark-tritanopia`],rd=[`pierre-light`,`pierre-light-soft`,`pierre-light-vibrant`,`pierre-light-protanopia-deuteranopia`,`pierre-light-tritanopia`],id=[...rd,...nd],ad=new Set(rd);function od(e){return ad.has(e)?`light`:`dark`}var sd={"pierre-dark":`Pierre Dark`,"pierre-dark-soft":`Pierre Dark Soft`,"pierre-dark-vibrant":`Pierre Dark Vibrant`,"pierre-dark-protanopia-deuteranopia":`Pierre Dark Protanopia & Deuteranopia`,"pierre-dark-tritanopia":`Pierre Dark Tritanopia`,"pierre-light":`Pierre Light`,"pierre-light-soft":`Pierre Light Soft`,"pierre-light-vibrant":`Pierre Light Vibrant`,"pierre-light-protanopia-deuteranopia":`Pierre Light Protanopia & Deuteranopia`,"pierre-light-tritanopia":`Pierre Light Tritanopia`},cd={"pierre-dark":()=>R(()=>import(`./pierre-dark-CpLgRqie.js`),[],import.meta.url),"pierre-dark-soft":()=>R(()=>import(`./pierre-dark-soft-kZQmAZld.js`),[],import.meta.url),"pierre-dark-vibrant":()=>R(()=>import(`./pierre-dark-vibrant-CpQYzh95.js`),[],import.meta.url),"pierre-dark-protanopia-deuteranopia":()=>R(()=>import(`./pierre-dark-protanopia-deuteranopia-B35FxJx-.js`),[],import.meta.url),"pierre-dark-tritanopia":()=>R(()=>import(`./pierre-dark-tritanopia-CpjhbsIL.js`),[],import.meta.url),"pierre-light":()=>R(()=>import(`./pierre-light-CoaEpmwp.js`),[],import.meta.url),"pierre-light-soft":()=>R(()=>import(`./pierre-light-soft-lWLdNTOI.js`),[],import.meta.url),"pierre-light-vibrant":()=>R(()=>import(`./pierre-light-vibrant-D80Fkn33.js`),[],import.meta.url),"pierre-light-protanopia-deuteranopia":()=>R(()=>import(`./pierre-light-protanopia-deuteranopia-0fSaH845.js`),[],import.meta.url),"pierre-light-tritanopia":()=>R(()=>import(`./pierre-light-tritanopia-CEbqgOJL.js`),[],import.meta.url)};function ld(e){return $u({name:e,collection:td,colorScheme:od(e),displayName:sd[e],load:cd[e]})}var ud=qu({themes:id.map(e=>ld(e))}),dd=`shiki`,fd=[`ayu-light`,`catppuccin-latte`,`everforest-light`,`github-light`,`github-light-default`,`github-light-high-contrast`,`gruvbox-light-hard`,`gruvbox-light-medium`,`gruvbox-light-soft`,`horizon-bright`,`kanagawa-lotus`,`light-plus`,`material-theme-lighter`,`min-light`,`night-owl-light`,`one-light`,`rose-pine-dawn`,`slack-ochin`,`snazzy-light`,`solarized-light`,`vitesse-light`],pd=`andromeeda.aurora-x.ayu-dark.ayu-mirage.catppuccin-frappe.catppuccin-macchiato.catppuccin-mocha.dark-plus.dracula.dracula-soft.everforest-dark.github-dark.github-dark-default.github-dark-dimmed.github-dark-high-contrast.gruvbox-dark-hard.gruvbox-dark-medium.gruvbox-dark-soft.horizon.houston.kanagawa-dragon.kanagawa-wave.laserwave.material-theme.material-theme-darker.material-theme-ocean.material-theme-palenight.min-dark.monokai.night-owl.nord.one-dark-pro.plastic.poimandres.red.rose-pine.rose-pine-moon.slack-dark.solarized-dark.synthwave-84.tokyo-night.vesper.vitesse-black.vitesse-dark`.split(`.`),md=new Set(fd);function hd(e){return md.has(e)?`light`:`dark`}var gd={andromeeda:()=>R(()=>import(`./andromeeda-vGVdxbeo.js`),[],import.meta.url),"aurora-x":()=>R(()=>import(`./aurora-x-CDeNXAV0.js`),[],import.meta.url),"ayu-dark":()=>R(()=>import(`./ayu-dark-DluEY0Gj.js`),[],import.meta.url),"ayu-light":()=>R(()=>import(`./ayu-light-C3h-C4tm.js`),[],import.meta.url),"ayu-mirage":()=>R(()=>import(`./ayu-mirage-Bqwy1Gya.js`),[],import.meta.url),"catppuccin-frappe":()=>R(()=>import(`./catppuccin-frappe-C9Q5zVZY.js`),[],import.meta.url),"catppuccin-latte":()=>R(()=>import(`./catppuccin-latte-CtsyrtPq.js`),[],import.meta.url),"catppuccin-macchiato":()=>R(()=>import(`./catppuccin-macchiato-R8nAf1vR.js`),[],import.meta.url),"catppuccin-mocha":()=>R(()=>import(`./catppuccin-mocha-DjuaAJKi.js`),[],import.meta.url),"dark-plus":()=>R(()=>import(`./dark-plus-Cs2F2srj.js`),[],import.meta.url),dracula:()=>R(()=>import(`./dracula-BHWKrbxM.js`),[],import.meta.url),"dracula-soft":()=>R(()=>import(`./dracula-soft-5eyTD99u.js`),[],import.meta.url),"everforest-dark":()=>R(()=>import(`./everforest-dark-sB-x3p7T.js`),[],import.meta.url),"everforest-light":()=>R(()=>import(`./everforest-light-Df2xbC6M.js`),[],import.meta.url),"github-dark":()=>R(()=>import(`./github-dark-C-LZuMrd.js`),[],import.meta.url),"github-dark-default":()=>R(()=>import(`./github-dark-default-DXG-b-1a.js`),[],import.meta.url),"github-dark-dimmed":()=>R(()=>import(`./github-dark-dimmed-Bx1FflLF.js`),[],import.meta.url),"github-dark-high-contrast":()=>R(()=>import(`./github-dark-high-contrast-B_tTalzw.js`),[],import.meta.url),"github-light":()=>R(()=>import(`./github-light-EUqPIrTm.js`),[],import.meta.url),"github-light-default":()=>R(()=>import(`./github-light-default-BXViO-2h.js`),[],import.meta.url),"github-light-high-contrast":()=>R(()=>import(`./github-light-high-contrast-B68TUdTA.js`),[],import.meta.url),"gruvbox-dark-hard":()=>R(()=>import(`./gruvbox-dark-hard-C820rvS2.js`),[],import.meta.url),"gruvbox-dark-medium":()=>R(()=>import(`./gruvbox-dark-medium-BPjhmG05.js`),[],import.meta.url),"gruvbox-dark-soft":()=>R(()=>import(`./gruvbox-dark-soft-MrdJrrXF.js`),[],import.meta.url),"gruvbox-light-hard":()=>R(()=>import(`./gruvbox-light-hard-BC_s9l72.js`),[],import.meta.url),"gruvbox-light-medium":()=>R(()=>import(`./gruvbox-light-medium-BAWPOn9u.js`),[],import.meta.url),"gruvbox-light-soft":()=>R(()=>import(`./gruvbox-light-soft-BSMLrYjP.js`),[],import.meta.url),horizon:()=>R(()=>import(`./horizon-CE9ld1lL.js`),[],import.meta.url),"horizon-bright":()=>R(()=>import(`./horizon-bright-DSNQnXHK.js`),[],import.meta.url),houston:()=>R(()=>import(`./houston-CsvMBhTu.js`),[],import.meta.url),"kanagawa-dragon":()=>R(()=>import(`./kanagawa-dragon-Bozd7klA.js`),[],import.meta.url),"kanagawa-lotus":()=>R(()=>import(`./kanagawa-lotus-BmuOG9ZW.js`),[],import.meta.url),"kanagawa-wave":()=>R(()=>import(`./kanagawa-wave-BML5mF2J.js`),[],import.meta.url),laserwave:()=>R(()=>import(`./laserwave-C_8bwKvT.js`),[],import.meta.url),"light-plus":()=>R(()=>import(`./light-plus-DVQuIRkW.js`),[],import.meta.url),"material-theme":()=>R(()=>import(`./material-theme-Bm3Qr25_.js`),[],import.meta.url),"material-theme-darker":()=>R(()=>import(`./material-theme-darker-2IIEA8gg.js`),[],import.meta.url),"material-theme-lighter":()=>R(()=>import(`./material-theme-lighter-uhdI0v04.js`),[],import.meta.url),"material-theme-ocean":()=>R(()=>import(`./material-theme-ocean-CHQ94UKr.js`),[],import.meta.url),"material-theme-palenight":()=>R(()=>import(`./material-theme-palenight-B5W6OYN7.js`),[],import.meta.url),"min-dark":()=>R(()=>import(`./min-dark-BSWPekZh.js`),[],import.meta.url),"min-light":()=>R(()=>import(`./min-light-DDpmG2fV.js`),[],import.meta.url),monokai:()=>R(()=>import(`./monokai-B_bV9PQ9.js`),[],import.meta.url),"night-owl":()=>R(()=>import(`./night-owl-DhmEMT88.js`),[],import.meta.url),"night-owl-light":()=>R(()=>import(`./night-owl-light-eJ-hLW7d.js`),[],import.meta.url),nord:()=>R(()=>import(`./nord-Cb4Vim4T.js`),[],import.meta.url),"one-dark-pro":()=>R(()=>import(`./one-dark-pro-CLwyXe_n.js`),[],import.meta.url),"one-light":()=>R(()=>import(`./one-light-D7Lr4KcI.js`),[],import.meta.url),plastic:()=>R(()=>import(`./plastic-DQwYfKfQ.js`),[],import.meta.url),poimandres:()=>R(()=>import(`./poimandres-DRFjx7u4.js`),[],import.meta.url),red:()=>R(()=>import(`./red-DX1BQOs8.js`),[],import.meta.url),"rose-pine":()=>R(()=>import(`./rose-pine-aMsaMD1D.js`),[],import.meta.url),"rose-pine-dawn":()=>R(()=>import(`./rose-pine-dawn-8PwUyIlP.js`),[],import.meta.url),"rose-pine-moon":()=>R(()=>import(`./rose-pine-moon-DO-qXg-I.js`),[],import.meta.url),"slack-dark":()=>R(()=>import(`./slack-dark-DnToyrRv.js`),[],import.meta.url),"slack-ochin":()=>R(()=>import(`./slack-ochin-B2OO5cIa.js`),[],import.meta.url),"snazzy-light":()=>R(()=>import(`./snazzy-light-4G7pJPwS.js`),[],import.meta.url),"solarized-dark":()=>R(()=>import(`./solarized-dark-UdsmMDCL.js`),[],import.meta.url),"solarized-light":()=>R(()=>import(`./solarized-light-C1IUL_tW.js`),[],import.meta.url),"synthwave-84":()=>R(()=>import(`./synthwave-84-nFMaYfgc.js`),[],import.meta.url),"tokyo-night":()=>R(()=>import(`./tokyo-night-oM2G3aXe.js`),[],import.meta.url),vesper:()=>R(()=>import(`./vesper-DdrHHSXu.js`),[],import.meta.url),"vitesse-black":()=>R(()=>import(`./vitesse-black-fwtXNY1n.js`),[],import.meta.url),"vitesse-dark":()=>R(()=>import(`./vitesse-dark-BZCL-v6S.js`),[],import.meta.url),"vitesse-light":()=>R(()=>import(`./vitesse-light-VbXTXTou.js`),[],import.meta.url)};function _d(e){return $u({name:e,collection:dd,colorScheme:hd(e),load:gd[e]})}var vd=qu({themes:Object.freeze([...fd.map(e=>_d(e)),...pd.map(e=>_d(e))])}),yd=qu({themes:[ud,vd]}),bd=rt(`diffs:auto-refresh`,!1),xd=`https://api.github.com`,Sd=100,Cd=class extends Error{status;constructor(e,t){super(t),this.status=e,this.name=`GithubApiError`}};function wd(e){let t=async()=>e?.githubToken();async function n(e,n={}){let r=await t(),i={Accept:n.accept??`application/vnd.github+json`,"X-GitHub-Api-Version":`2022-11-28`};r&&(i.Authorization=`Bearer ${r}`),n.body!==void 0&&(i[`Content-Type`]=`application/json`);let a=`${xd}${e}`,o=await fetch(a,{method:n.method??`GET`,headers:i,body:n.body===void 0?void 0:JSON.stringify(n.body)});if(!o.ok){let e;try{e=(await o.json()).message}catch{}throw new Cd(o.status,e??`GitHub API request failed (${o.status}): ${a}`)}return o}return{token:t,request:n,async paginate(e){let t=[],r=e.includes(`?`)?`&`:`?`;for(let i=1;;i++){let a=await(await n(`${e}${r}per_page=${Sd}&page=${i}`)).json();if(t.push(...a),a.length<Sd)return t}},async graphql(e,t){let r=await(await n(`/graphql`,{method:`POST`,body:{query:e,variables:t}})).json();if(r.errors?.length)throw new Cd(r.errors.some(e=>e.type===`FORBIDDEN`)?403:500,r.errors.map(e=>e.message).join(`; `));if(!r.data)throw new Cd(500,`GitHub GraphQL response contained no data`);return r.data}}}var Td=zn({codes:{llmNotConfigured:{why:`No LLM provider is configured.`,fix:`Set an API key or gateway token for the selected provider.`},tokenRejected:{why:`GitHub rejected the token.`,fix:`Check that the token is valid and has not expired.`},writeForbidden:{why:e=>e.reason,fix:`Use a token with the "repo" scope (classic token) or "Pull requests: Read and write" permission (fine-grained token).`},commentTooLarge:{why:e=>`The analysis is too large to post as a comment (${e.n} characters).`,data:e=>({n:e.n})}}});function Ed(e){if(!e)return null;let t=Date.parse(e.replace(` UTC`,`Z`).replace(` `,`T`));return Number.isNaN(t)?null:t}async function Dd(e){let t;try{t=await wd(An(e)).request(`/user`)}catch(e){throw e instanceof Cd&&e.status===401?Td.tokenRejected():e}let n=await t.json(),r=t.headers.get(`x-oauth-scopes`)??``;return{login:n.login,avatarUrl:n.avatar_url,name:n.name,scopes:r.split(`,`).map(e=>e.trim()).filter(Boolean),expiresAt:Ed(t.headers.get(`github-authentication-token-expiration`))}}async function Od(e){let t=await crypto.subtle.digest(`SHA-256`,new TextEncoder().encode(e));return Array.from(new Uint8Array(t),e=>e.toString(16).padStart(2,`0`)).join(``)}var kd={llmNotConfigured:`analyze.notConfigured`,tokenRejected:`errors.tokenRejected`,commentTooLarge:`errors.tooLarge`};function Ad(e){return e in kd}function jd(e){return e instanceof Vn&&Ad(e.name)?Error(Fn(kd[e.name],e.data??{})):e instanceof Error?e:Error(String(e))}function Md(e){switch(e.kind){case`thinking`:return Fn(`analyze.thinking`,{step:e.step});case`reading`:{let t=e.paths.length>1?`, …`:``;return Fn(`analyze.reading`,{n:e.paths.length,first:`${e.paths[0]??``}${t}`},e.paths.length)}case`organizing`:return Fn(`analyze.organizing`)}}var Nd=`diffs:github-token-meta`;function Pd(){let e=localStorage.getItem(Nd);if(!e)return null;try{return JSON.parse(e)}catch{return null}}async function Fd(e){try{let t=await Od(e),n=Pd();if(n?.hash===t)return n.meta;let r={...await Dd(e),setAt:Date.now()};return localStorage.setItem(Nd,JSON.stringify({hash:t,meta:r})),r}catch{return}}function Id(){let e=Ne(null),t=Ne(!1),n=Ne(),r=!1;Te(()=>{r=!0});async function i(e,t){let n=await Od(e),r={...await Dd(e),setAt:t};return localStorage.setItem(Nd,JSON.stringify({hash:n,meta:r})),r}Nt(()=>In.value.githubToken,async a=>{if(!a){e.value=null;return}t.value=!0,n.value=void 0;try{let t=await Od(a);if(r)return;let n=Pd();e.value=n?.hash===t?n.meta:await i(a,Date.now())}catch(e){n.value=jd(e).message}finally{t.value=!1}},{immediate:!0});async function a(r){if(n.value=void 0,!r)return localStorage.removeItem(Nd),e.value=null,In.value={...In.value,githubToken:``},!0;t.value=!0;try{return e.value=await i(r,Date.now()),In.value={...In.value,githubToken:r},!0}catch(e){return n.value=jd(e).message,!1}finally{t.value=!1}}return{meta:e,busy:t,error:n,saveToken:a}}var Ld=Symbol(`antfu-design-color-scheme`);function Rd(e){let t=tn(Ld,void 0);return P(()=>e?.()??t?.value??`light`)}function zd(e,t){let n=e.length,r,i,a=!1,o=!1;Array.isArray(e[0])?r=e:(r=[e],n=r.length,a=!0),Array.isArray(t[0])?i=t:(i=t.length>0?t.map(e=>[e]):[[]],o=!0);let s=i[0].length,c=i[0].map((e,t)=>i.map(e=>e[t])),l=r.map(e=>c.map(t=>{let n=0;if(!Array.isArray(e)){for(let r of t)n+=e*r;return n}for(let r=0;r<e.length;r++)n+=e[r]*(t[r]||0);return n}));return n===1&&a&&(l=l[0]),s===1&&o?n===1&&a?l[0]:l.map(e=>e[0]):l}function Bd(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function Vd(e,t,n=[0,0,0]){let r=Bd(e,t[0]),i=Bd(e,t[1]),a=Bd(e,t[2]);return n[0]=r,n[1]=i,n[2]=a,n}var Hd=t({bisectLeft:()=>tf,clamp:()=>Zd,copySign:()=>Qd,diag:()=>rf,interpolate:()=>Jd,interpolateInv:()=>Yd,inv:()=>uf,isInstance:()=>nf,isNone:()=>z,isString:()=>Ud,lu:()=>af,mapRange:()=>Xd,multiplyMatrices:()=>zd,multiply_v3_m3x3:()=>Vd,serializeNumber:()=>Gd,skipNone:()=>Kd,solve:()=>df,spow:()=>$d,toPrecision:()=>qd,type:()=>Wd,zdiv:()=>ef});function Ud(e){return Wd(e)===`string`}function Wd(e){return(Object.prototype.toString.call(e).match(/^\[object\s+(.*?)\]$/)[1]||``).toLowerCase()}function Gd(e,{precision:t=16,unit:n}){return z(e)?`none`:(e=+qd(e,t),e+(n??``))}function z(e){return e===null}function Kd(e){return z(e)?0:e}function qd(e,t){if(e===0)return 0;let n=~~e,r=0;n&&t&&(r=~~Math.log10(Math.abs(n))+1);let i=10**(t-r);return Math.floor(e*i+.5)/i}function Jd(e,t,n){return z(e)||isNaN(e)?t:z(t)||isNaN(t)?e:e+(t-e)*n}function Yd(e,t,n){return(n-e)/(t-e)}function Xd(e,t,n){return!e||!t||e===t||e[0]===t[0]&&e[1]===t[1]||isNaN(n)||n===null?n:Jd(t[0],t[1],Yd(e[0],e[1],n))}function Zd(e,t,n){return Math.max(Math.min(n,t),e)}function Qd(e,t){return Math.sign(e)===Math.sign(t)?e:-e}function $d(e,t){return Qd(Math.abs(e)**t,e)}function ef(e,t){return t===0?0:e/t}function tf(e,t,n=0,r=e.length){for(;n<r;){let i=n+r>>1;e[i]<t?n=i+1:r=i}return n}function nf(e,t){if(e instanceof t)return!0;let n=t.name;for(;e;){let t=Object.getPrototypeOf(e),r=t?.constructor?.name;if(r===n)return!0;if(!r||r===`Object`)return!1;e=t}return!1}function rf(e){let t=e.length,n=[];for(let r=0;r<t;r++){n[r]=[];for(let i=0;i<t;i++)n[r][i]=r===i?e[r]:0}return n}function af(e,{pIndices:t=!1}={}){let n,r,i,a,o=e.length;t?(n=Array.from({length:o},(e,t)=>t),i=rf(Array(o).fill(1))):(r=rf(Array(o).fill(1)),i=structuredClone(r)),a=structuredClone(e);for(let e=0;e<o-1;e++){let s=e,c=Math.abs(a[e][e]);for(let t=e+1;t<o;t++){let n=Math.abs(a[t][e]);n>c&&(s=t,c=n)}if(s!=e){if([a[e],a[s]]=[a[s],a[e]],t?[n[e],n[s]]=[n[s],n[e]]:[r[e],r[s]]=[r[s],r[e]],e)for(let t=0;t<e;t++)[i[e][t],i[s][t]]=[i[s][t],i[e][t]]}else if(!c)continue;for(let t=e+1;t<o;t++){let n=a[t][e]/a[e][e];for(let r=e;r<o;r++)a[t][r]+=-a[e][r]*n,i[t][r]+=i[e][r]*n}}return t?[n,i,a]:[r,i,a]}function of(e,t,n){for(let r=0;r<n;r++){let i=t[r];for(let a=0;a<r;a++)for(let o=0;o<n;o++)i[o]-=e[r][a]*t[a][o];for(let t=0;t<n;t++)i[t]/=e[r][r]}return t}function sf(e,t,n){for(let i=n-1;i>-1;i--){let a=t[i];for(let o=i+1;o<n;o++)for(var r=0;r<n;r++)a[r]-=e[i][o]*t[o][r];for(let r=0;r<n;r++)t[i][r]/=e[i][i]}return t}function cf(e,t,n){for(let r=0;r<n;r++){let n=t[r];for(let i=0;i<r;i++)n-=e[r][i]*t[i];t[r]=n/e[r][r]}return t}function lf(e,t,n){for(let r=n-1;r>-1;r--){let i=t[r];for(let a=r+1;a<n;a++)i-=e[r][a]*t[a];t[r]=i/e[r][r]}return t}function uf(e){let[t,n,r]=af(e),i=n.length;if(n.map((e,t)=>e[t]*r[t][t]).reduce((e,t)=>e*t,1)===0)throw Error(`Matrix is singular`);return sf(r,of(n,t,i),i)}function df(e,t){let[n,r,i]=af(e,{pIndices:!0}),a=r.length;if(r.map((e,t)=>e[t]*i[t][t]).reduce((e,t)=>e*t,1)===0)throw Error(`Matrix is singular`);return lf(i,cf(r,n.map(e=>t[e]),a),a)}var ff=new class{add(e,t,n){if(typeof arguments[0]!=`string`){for(var e in arguments[0])this.add(e,arguments[0][e],arguments[1]);return}(Array.isArray(e)?e:[e]).forEach(function(e){this[e]=this[e]||[],t&&this[e][n?`unshift`:`push`](t)},this)}run(e,t){this[e]=this[e]||[],this[e].forEach(function(e){e.call(t&&t.context?t.context:t,t)})}},pf={gamut_mapping:`css`,precision:5,deltaE:`76`,verbose:!0,warn:function(e){this.verbose&&globalThis?.console?.warn?.(e)}},mf=class{type;coordMeta;coordRange;range;constructor(e,t){if(typeof e==`object`&&(this.coordMeta=e),t&&(this.coordMeta=t,this.coordRange=t.range??t.refRange),typeof e==`string`){let t=e.trim().match(/^(?<type><[a-z]+>)(\[(?<min>-?[.\d]+),\s*(?<max>-?[.\d]+)\])?$/);if(!t)throw TypeError(`Cannot parse ${e} as a type definition.`);this.type=t.groups.type;let{min:n,max:r}=t.groups;(n||r)&&(this.range=[+n,+r])}}get computedRange(){return this.range?this.range:this.type===`<percentage>`?this.percentageRange():this.type===`<angle>`?[0,360]:null}get unit(){return this.type===`<percentage>`?`%`:this.type===`<angle>`?`deg`:``}resolve(e){if(this.type===`<angle>`)return e;let t=this.computedRange,n=this.coordRange;return this.type===`<percentage>`&&(n??=this.percentageRange()),Xd(t,n,e)}serialize(e,t){let n=this.type===`<percentage>`?this.percentageRange(100):this.computedRange,r=this.unit;return e=Xd(this.coordRange,n,e),Gd(e,{unit:r,precision:t})}toString(){let e=this.type;if(this.range){let[t=``,n=``]=this.range;e+=`[${t},${n}]`}return e}percentageRange(e=1){let t;return t=this.coordMeta&&this.coordMeta.range||this.coordRange&&this.coordRange[0]>=0?[0,1]:[-1,1],[t[0]*e,t[1]*e]}static get(e,t){return nf(e,this)?e:new this(e,t)}},hf=Symbol(`instance`),gf=class e{type;name;spaceCoords;coords;id;alpha;constructor(e,t=e.space){e[hf]=this,this.type=`function`,this.name=`color`,Object.assign(this,e),this.space=t,this.type!==`custom`&&(this.spaceCoords=Object.values(t.coords),this.coords||=this.spaceCoords.map(e=>{let t=[`<number>`,`<percentage>`];return e.type===`angle`&&t.push(`<angle>`),t}),this.coords=this.coords.map((e,t)=>{let n=this.spaceCoords[t];return typeof e==`string`&&(e=e.trim().split(/\s*\|\s*/)),e.map(e=>mf.get(e,n))}))}serializeCoords(e,t,n){return n=e.map((e,t)=>mf.get(n?.[t]??this.coords[t][0],this.spaceCoords[t])),e.map((e,r)=>n[r].serialize(e,t))}coerceCoords(e,t){return Object.entries(this.space.coords).map(([n,r],i)=>{let a=e[i];if(z(a)||isNaN(a))return a;let o=t[i],s=this.coords[i].find(e=>e.type==o);if(!s){let e=r.name||n;throw TypeError(`${o??a?.raw??a} not allowed for ${e} in ${this.name}()`)}return a=s.resolve(a),s.range&&(t[i]=s.toString()),a})}canSerialize(){return this.type===`function`||this.serialize}parse(e){return null}static get(t,...n){return!t||nf(t,this)?t:t[hf]?t[hf]:new e(t,...n)}},_f={D50:[.3457/.3585,1,.2958/.3585],D65:[.3127/.329,1,.3583/.329]};function vf(e){return Array.isArray(e)?e:_f[e]}function yf(e,t,n,r={}){if(e=vf(e),t=vf(t),!e||!t)throw TypeError(`Missing white point to convert ${e?``:`from`}${!e&&!t?`/`:``}${t?``:`to`}`);if(e===t)return n;let i={W1:e,W2:t,XYZ:n,options:r};if(ff.run(`chromatic-adaptation-start`,i),i.M||(i.W1===_f.D65&&i.W2===_f.D50?i.M=[[1.0479297925449969,.022946870601609652,-.05019226628920524],[.02962780877005599,.9904344267538799,-.017073799063418826],[-.009243040646204504,.015055191490298152,.7518742814281371]]:i.W1===_f.D50&&i.W2===_f.D65&&(i.M=[[.955473421488075,-.02309845494876471,.06325924320057072],[-.0283697093338637,1.0099953980813041,.021041441191917323],[.012314014864481998,-.020507649298898964,1.330365926242124]])),ff.run(`chromatic-adaptation-end`,i),i.M)return Vd(i.XYZ,i.M);throw TypeError(`Only Bradford CAT with white points D50 and D65 supported for now.`)}function bf(e,t){let n={str:String(e)?.trim(),options:t};if(ff.run(`parse-start`,n),n.color)return n.color;n.parsed=wf(n.str);let r,i=n.options?n.options.parseMeta??n.options.meta:null;if(n.parsed){let t=n.parsed.name,a,o,s=n.parsed.args,c=s.map((e,t)=>n.parsed.argMeta[t]?.type);if(t===`color`){let r=s.shift();c.shift();let i=r.startsWith(`--`)?r.substring(2):`--${r}`,l=[r,i];if(a=V.findFormat({name:t,id:l,type:`function`}),!a){let t,a=r in V.registry?r:i;if(a in V.registry){let n=V.registry[a].formats?.color?.id;n&&(t=`Did you mean ${e.replace(`color(`+r,`color(`+n)}?`)}throw TypeError(`Cannot parse ${n.str}. `+(t??`Missing a plugin?`))}o=a.space,a.id.startsWith(`--`)&&!r.startsWith(`--`)&&pf.warn(`${o.name} is a non-standard space and not currently supported in the CSS spec. Use prefixed color(${a.id}) instead of color(${r}).`),r.startsWith(`--`)&&!a.id.startsWith(`--`)&&pf.warn(`${o.name} is a standard space and supported in the CSS spec. Use color(${a.id}) instead of prefixed color(${r}).`)}else a=V.findFormat({name:t,type:`function`}),o=a.space;i&&Object.assign(i,{format:a,formatId:a.name,types:c,commas:n.parsed.commas});let l=1;n.parsed.lastAlpha&&(l=n.parsed.args.pop(),i&&(i.alphaType=c.pop()));let u=a.coords.length;if(s.length!==u)throw TypeError(`Expected ${u} coordinates for ${o.id} in ${n.str}), got ${s.length}`);s=a.coerceCoords(s,c),r={spaceId:o.id,coords:s,alpha:l}}else spaceloop:for(let e of V.all)for(let t in e.formats){let a=e.formats[t];if(a.type!==`custom`||a.test&&!a.test(n.str))continue;let o=e.getFormat(a),s=o.parse(n.str);if(s){i&&Object.assign(i,{format:o,formatId:t}),r=s;break spaceloop}}if(!r)throw TypeError(`Could not parse ${e} as a color. Missing a plugin?`);return r.alpha=z(r.alpha)?r.alpha:r.alpha===void 0?1:Zd(0,r.alpha,1),r}var xf={"%":.01,deg:1,grad:.9,rad:180/Math.PI,turn:360},Sf={function:/^([a-z]+)\(((?:calc\(NaN\)|.)+?)\)$/i,number:/^([-+]?(?:[0-9]*\.)?[0-9]+(e[-+]?[0-9]+)?)$/i,unitValue:RegExp(`(${Object.keys(xf).join(`|`)})$`),singleArgument:/\/?\s*(none|NaN|calc\(NaN\)|[-+\w.]+(?:%|deg|g?rad|turn)?)/g};function Cf(e){let t={},n=e.match(Sf.unitValue)?.[0],r=t.raw=e;return n?(t.type=n===`%`?`<percentage>`:`<angle>`,t.unit=n,t.unitless=Number(r.slice(0,-n.length)),r=t.unitless*xf[n]):Sf.number.test(r)?(r=Number(r),t.type=`<number>`):r===`none`?r=null:r===`NaN`||r===`calc(NaN)`?(r=NaN,t.type=`<number>`):t.type=`<ident>`,{value:r,meta:t}}function wf(e){if(!e)return;e=e.trim();let t=e.match(Sf.function);if(t){let e=[],n=[],r=!1,i=t[1].toLowerCase(),a=t[2].replace(Sf.singleArgument,(t,a)=>{let{value:o,meta:s}=Cf(a);return(t.startsWith(`/`)||i!==`color`&&e.length===3)&&(r=!0),e.push(o),n.push(s),``});return{name:i,args:e,argMeta:n,lastAlpha:r,commas:a.includes(`,`),rawName:t[1],rawArgs:t[2]}}}function B(e,t){if(Array.isArray(e))return e.map(e=>B(e,t));if(!e)throw TypeError(`Empty color reference`);Ud(e)&&(e=bf(e,t));let n=e.space||e.spaceId;return typeof n==`string`&&(e.space=V.get(n)),e.alpha===void 0&&(e.alpha=1),e}var Tf=75e-6,V=class e{constructor(t){this.id=t.id,this.name=t.name,this.base=t.base?e.get(t.base):null,this.aliases=t.aliases,this.displaySpaces=t.displaySpaces?.map(t=>e.get(t)),this.bases=[];for(let e=this.base;e;e=e.base)this.bases.push(e);t.rgbGamut&&(this.rgbGamut=t.rgbGamut),t.linearGamut&&(this.linearGamut=t.linearGamut),this.base&&(t.fromBase&&(this.fromBase=t.fromBase),t.toBase&&(this.toBase=t.toBase));let n=t.coords??this.base.coords;for(let e in n)`name`in n[e]||(n[e].name=e);this.coords=n;let r=t.white??this.base.white??`D65`;this.white=vf(r),this.formats=t.formats??{};for(let e in this.formats){let t=this.formats[e];t.type||=`function`,t.name||=e}this.formats.color?.id||(this.formats.color={...this.formats.color??{},id:t.cssId||this.id}),this.gamutSpace=t.gamutSpace?t.gamutSpace===`self`?this:e.get(t.gamutSpace):this.isPolar?this.base:this,this.gamutSpace.isUnbounded&&(this.inGamut=(e,t)=>!0),this.M=t.M??{},this.referred=t.referred,Object.defineProperty(this,"path",{value:Ef(this).reverse(),writable:!1,enumerable:!0,configurable:!0}),ff.run(`colorspace-init-end`,this)}inGamut(e,{epsilon:t=Tf}={}){if(!this.equals(this.gamutSpace))return e=this.to(this.gamutSpace,e),this.gamutSpace.inGamut(e,{epsilon:t});let n=Object.values(this.coords);return e.every((e,r)=>{let i=n[r];if(i.type!==`angle`&&i.range){if(z(e))return!0;let[n,r]=i.range;return(n===void 0||e>=n-t)&&(r===void 0||e<=r+t)}return!0})}get isUnbounded(){return Object.values(this.coords).every(e=>!(`range`in e))}get cssId(){return this.formats?.color?.id||this.id}get hueId(){for(let e in this.coords)if(this.coords[e].type===`angle`)return e;return null}get hueIndex(){return Object.keys(this.coords).findIndex(e=>this.coords[e].type===`angle`)}get isPolar(){return this.hueId!==null}getFormat(e){if(!e)return null;e==="default"?e=Object.values(this.formats)[0]:typeof e==`string`&&(e=this.formats[e]);let t=gf.get(e,this);return t!==e&&e.name in this.formats&&(this.formats[e.name]=t),t}equals(e){return e?this===e||this.id===e||this.id===e.id:!1}to(t,n){if(arguments.length===1){let e=B(t);[t,n]=[e.space,e.coords]}if(t=e.get(t),this.equals(t))return n;n=n.map(e=>z(e)?0:e);let r=this.path,i=t.path,a,o;for(let e=0;e<r.length&&r[e].equals(i[e]);e++)a=r[e],o=e;if(!a)throw Error(`Cannot convert between color spaces ${this} and ${t}: no connection space was found`);for(let e=r.length-1;e>o;e--)n=r[e].toBase(n);for(let e=o+1;e<i.length;e++)n=i[e].fromBase(n);return n}from(t,n){if(arguments.length===1){let e=B(t);[t,n]=[e.space,e.coords]}return t=e.get(t),t.to(this,n)}toString(){return`${this.name} (${this.id})`}getMinCoords(){let e=[];for(let t in this.coords){let n=this.coords[t],r=n.range||n.refRange;e.push(r?.min??0)}return e}static registry={};static get all(){return[...new Set(Object.values(e.registry))]}static register(e,t){if(arguments.length===1&&(t=arguments[0],e=t.id),t=this.get(t),this.registry[e]&&this.registry[e]!==t)throw Error(`Duplicate color space registration: '${e}'`);if(this.registry[e]=t,arguments.length===1&&t.aliases)for(let e of t.aliases)this.register(e,t);return t}static get(t,...n){if(!t||nf(t,this))return t;if(Wd(t)===`string`){let n=e.registry[t.toLowerCase()];if(!n)throw TypeError(`No color space found with id = "${t}"`);return n}if(n.length)return e.get(...n);throw TypeError(`${t} is not a valid color space`)}static findFormat(t,n=e.all){if(!t)return null;typeof t==`string`&&(t={name:t});for(let e of n)for(let[n,r]of Object.entries(e.formats)){r.name??=n,r.type??=`function`;let i=(!t.name||r.name===t.name)&&(!t.type||r.type===t.type);if(t.id){let e=r.ids||[r.id],n=Array.isArray(t.id)?t.id:[t.id];i&&=n.some(t=>e.includes(t))}if(i){let t=gf.get(r,e);return t!==r&&(e.formats[r.name]=t),t}}return null}static resolveCoord(t,n){let r=Wd(t),i,a;if(r===`string`?t.includes(`.`)?[i,a]=t.split(`.`):[i,a]=[,t]:Array.isArray(t)?[i,a]=t:(i=t.space,a=t.coordId),i=e.get(i),i||=n,!i)throw TypeError(`Cannot resolve coordinate reference ${t}: No color space specified and relative references are not allowed here`);if(r=Wd(a),r===`number`||r===`string`&&a>=0){let e=Object.entries(i.coords)[a];if(e)return{space:i,id:e[0],index:a,...e[1]}}i=e.get(i);let o=a.toLowerCase(),s=0;for(let e in i.coords){let t=i.coords[e];if(e.toLowerCase()===o||t.name?.toLowerCase()===o)return{space:i,id:e,index:s,...t};s++}throw TypeError(`No "${a}" coordinate found in ${i.name}. Its coordinates are: ${Object.keys(i.coords).join(`, `)}`)}static DEFAULT_FORMAT={type:`functions`,name:`color`}};function Ef(e){let t=[e];for(let n=e;n=n.base;)t.push(n);return t}var Df=new V({id:`xyz-d65`,name:`XYZ D65`,coords:{x:{refRange:[0,1],name:`X`},y:{refRange:[0,1],name:`Y`},z:{refRange:[0,1],name:`Z`}},white:`D65`,formats:{color:{ids:[`xyz-d65`,`xyz`]}},aliases:[`xyz`]}),Of=class extends V{constructor(e){e.coords||={r:{range:[0,1],name:`Red`},g:{range:[0,1],name:`Green`},b:{range:[0,1],name:`Blue`}},e.base||=Df;let t=e.toXYZ_M??e.M?.toXYZ,n=e.fromXYZ_M??e.M?.fromXYZ;e.referred??=`display`,super(e),t&&n&&(this.M.toXYZ=t,this.M.fromXYZ=n)}toBase(e){let t=Vd(e,this.M.toXYZ);return this.white!==this.base.white&&(t=yf(this.white,this.base.white,t)),t}fromBase(e){return e=yf(this.base.white,this.white,e),Vd(e,this.M.fromXYZ)}},kf=new V({id:`xyz-d50`,name:`XYZ D50`,white:`D50`,base:Df,fromBase:e=>yf(Df.white,`D50`,e),toBase:e=>yf(`D50`,Df.white,e)}),Af=216/24389,jf=24/116,Mf=24389/27,Nf=_f.D50,Pf=new V({id:`lab`,name:`Lab`,coords:{l:{refRange:[0,100],name:`Lightness`},a:{refRange:[-125,125]},b:{refRange:[-125,125]}},white:Nf,base:kf,fromBase(e){let t=e.map((e,t)=>e/Nf[t]).map(e=>e>Af?Math.cbrt(e):(Mf*e+16)/116);return[116*t[1]-16,500*(t[0]-t[1]),200*(t[1]-t[2])]},toBase(e){let[t,n,r]=e,i=[];return i[1]=(t+16)/116,i[0]=n/500+i[1],i[2]=i[1]-r/200,[i[0]>jf?i[0]**3:(116*i[0]-16)/Mf,e[0]>8?((e[0]+16)/116)**3:e[0]/Mf,i[2]>jf?i[2]**3:(116*i[2]-16)/Mf].map((e,t)=>e*Nf[t])},formats:{lab:{coords:[`<percentage> | <number>`,`<number> | <percentage>`,`<number> | <percentage>`]}}});function Ff(e){return typeof e==`number`?(e%360+360)%360:e}function If(e,t){let[n,r]=t,i=z(n),a=z(r);if(i&&a)return[n,r];if(i?n=r:a&&(r=n),e===`raw`)return t;n=Ff(n),r=Ff(r);let o=r-n;return e===`increasing`?o<0&&(r+=360):e===`decreasing`?o>0&&(n+=360):e===`longer`?-180<o&&o<180&&(o>0?n+=360:r+=360):e===`shorter`&&(o>180?n+=360:o<-180&&(r+=360)),[n,r]}var Lf=new V({id:`lch`,name:`LCH`,coords:{l:{refRange:[0,100],name:`Lightness`},c:{refRange:[0,150],name:`Chroma`},h:{refRange:[0,360],type:`angle`,name:`Hue`}},base:Pf,fromBase(e){if(this.ε===void 0){let e=Object.values(this.base.coords)[1].refRange,t=e[1]-e[0];this.ε=t/1e5}let[t,n,r]=e,i=Math.abs(n)<this.ε&&Math.abs(r)<this.ε,a=i?null:Ff(Math.atan2(r,n)*180/Math.PI);return[t,i?0:Math.sqrt(n**2+r**2),a]},toBase(e){let[t,n,r]=e,i=null,a=null;return z(r)||(n=n<0?0:n,i=n*Math.cos(r*Math.PI/180),a=n*Math.sin(r*Math.PI/180)),[t,i,a]},formats:{lch:{coords:[`<percentage> | <number>`,`<number> | <percentage>`,`<number> | <angle>`]}}}),Rf=25**7,zf=Math.PI,Bf=180/zf,Vf=zf/180;function Hf(e){let t=e*e;return t*t*t*e}function Uf(e,t,{kL:n=1,kC:r=1,kH:i=1}={}){[e,t]=B([e,t]);let[a,o,s]=Pf.from(e),c=Lf.from(Pf,[a,o,s])[1],[l,u,d]=Pf.from(t),f=Lf.from(Pf,[l,u,d])[1];c<0&&(c=0),f<0&&(f=0);let p=Hf((c+f)/2),m=.5*(1-Math.sqrt(p/(p+Rf))),h=(1+m)*o,g=(1+m)*u,_=Math.sqrt(h**2+s**2),v=Math.sqrt(g**2+d**2),y=h===0&&s===0?0:Math.atan2(s,h),b=g===0&&d===0?0:Math.atan2(d,g);y<0&&(y+=2*zf),b<0&&(b+=2*zf),y*=Bf,b*=Bf;let x=l-a,S=v-_,C=b-y,w=y+b,T=Math.abs(C),ee;_*v===0?ee=0:T<=180?ee=C:C>180?ee=C-360:C<-180?ee=C+360:pf.warn(`the unthinkable has happened`);let E=2*Math.sqrt(v*_)*Math.sin(ee*Vf/2),D=(a+l)/2,te=(_+v)/2,ne=Hf(te),re;re=_*v===0?w:T<=180?w/2:w<360?(w+360)/2:(w-360)/2;let ie=(D-50)**2,ae=1+.015*ie/Math.sqrt(20+ie),oe=1+.045*te,se=1;se-=.17*Math.cos((re-30)*Vf),se+=.24*Math.cos(2*re*Vf),se+=.32*Math.cos((3*re+6)*Vf),se-=.2*Math.cos((4*re-63)*Vf);let ce=1+.015*te*se,O=30*Math.exp(-1*((re-275)/25)**2),le=2*Math.sqrt(ne/(ne+Rf)),k=-1*Math.sin(2*O*Vf)*le,ue=(x/(n*ae))**2;return ue+=(S/(r*oe))**2,ue+=(E/(i*ce))**2,ue+=k*(S/(r*oe))*(E/(i*ce)),Math.sqrt(ue)}var Wf={XYZtoLMS:[[.819022437996703,.3619062600528904,-.1288737815209879],[.0329836539323885,.9292868615863434,.0361446663506424],[.0481771893596242,.2642395317527308,.6335478284694309]],LMStoXYZ:[[1.2268798758459243,-.5578149944602171,.2813910456659647],[-.0405757452148008,1.112286803280317,-.0717110580655164],[-.0763729366746601,-.4214933324022432,1.5869240198367816]],LMStoLab:[[.210454268309314,.7936177747023054,-.0040720430116193],[1.9779985324311684,-2.42859224204858,.450593709617411],[.0259040424655478,.7827717124575296,-.8086757549230774]],LabtoLMS:[[1,.3963377773761749,.2158037573099136],[1,-.1055613458156586,-.0638541728258133],[1,-.0894841775298119,-1.2914855480194092]]},Gf=new V({id:`oklab`,name:`Oklab`,coords:{l:{refRange:[0,1],name:`Lightness`},a:{refRange:[-.4,.4]},b:{refRange:[-.4,.4]}},white:`D65`,base:Df,M:Wf,fromBase(e){let t=Vd(e,Wf.XYZtoLMS);return t[0]=Math.cbrt(t[0]),t[1]=Math.cbrt(t[1]),t[2]=Math.cbrt(t[2]),Vd(t,Wf.LMStoLab,t)},toBase(e){let t=Vd(e,Wf.LabtoLMS);return t[0]**=3,t[1]**=3,t[2]**=3,Vd(t,Wf.LMStoXYZ,t)},formats:{oklab:{coords:[`<percentage> | <number>`,`<number> | <percentage>`,`<number> | <percentage>`]}}});function Kf(e,t){[e,t]=B([e,t]);let[n,r,i]=Gf.from(e),[a,o,s]=Gf.from(t),c=n-a,l=r-o,u=i-s;return Math.sqrt(c**2+l**2+u**2)}var qf=75e-6;function Jf(e,t,{epsilon:n=qf}={}){e=B(e),t||=e.space,t=V.get(t);let r=e.coords;return t!==e.space&&(r=t.from(e)),t.inGamut(r,{epsilon:n})}function Yf(e,t,{inGamut:n}={}){e=B(e),t=V.get(t);let r=t.from(e),i={space:t,coords:r,alpha:e.alpha};return n&&(i=Wh(i,n===!0?void 0:n)),i}Yf.returns=`color`;function Xf(e,t){e=B(e);let n=V.get(t,t?.space),r=t?.precision,i;return i=!n||e.space.equals(n)?e.coords.slice():n.from(e),r===void 0?i:i.map(e=>qd(e,r))}function Zf(e,t){if(e=B(e),t===`alpha`)return e.alpha??1;let{space:n,index:r}=V.resolveCoord(t,e.space);return Xf(e,n)[r]}var Qf=new V({id:`oklch`,name:`OkLCh`,coords:{l:{refRange:[0,1],name:`Lightness`},c:{refRange:[0,.4],name:`Chroma`},h:{refRange:[0,360],type:`angle`,name:`Hue`}},white:`D65`,base:Gf,fromBase:Lf.fromBase,toBase:Lf.toBase,formats:{oklch:{coords:[`<percentage> | <number>`,`<number> | <percentage>`,`<number> | <angle>`]}}});function $f(e,t,n,r){return e=B(e),Array.isArray(t)&&([t,n,r]=[e.space,t,n]),t=V.get(t),e.coords=t===e.space?n.slice():t.to(e.space,n),r!==void 0&&(e.alpha=r),e}$f.returns=`color`;function ep(e,t,n){if(e=B(e),arguments.length===2&&Wd(arguments[1])===`object`){let t=arguments[1];for(let n in t)ep(e,n,t[n])}else if(typeof n==`function`&&(n=n(Zf(e,t))),t===`alpha`)e.alpha=n;else{let{space:r,index:i}=V.resolveCoord(t,e.space),a=Xf(e,r);a[i]=n,$f(e,r,a)}return e}ep.returns=`color`;function tp(e){return{space:e.space,coords:e.coords.slice(),alpha:e.alpha}}function np(e,t,n=`lab`){n=V.get(n);let r=n.from(e),i=n.from(t);return Math.sqrt(r.reduce((e,t,n)=>{let r=i[n];return z(t)||z(r)?e:e+(r-t)**2},0))}function rp(e,t){return np(e,t,`lab`)}var ip=Math.PI/180;function ap(e,t,{l:n=2,c:r=1}={}){[e,t]=B([e,t]);let[i,a,o]=Pf.from(e),[,s,c]=Lf.from(Pf,[i,a,o]),[l,u,d]=Pf.from(t),f=Lf.from(Pf,[l,u,d])[1];s<0&&(s=0),f<0&&(f=0);let p=i-l,m=s-f,h=a-u,g=o-d,_=h**2+g**2-m**2,v=.511;i>=16&&(v=.040975*i/(1+.01765*i));let y=.0638*s/(1+.0131*s)+.638,b;z(c)&&(c=0),b=c>=164&&c<=345?.56+Math.abs(.2*Math.cos((c+168)*ip)):.36+Math.abs(.4*Math.cos((c+35)*ip));let x=s**4,S=Math.sqrt(x/(x+1900)),C=y*(S*b+1-S),w=(p/(n*v))**2;return w+=(m/(r*y))**2,w+=_/C**2,Math.sqrt(w)}var op=203,sp=new V({id:`xyz-abs-d65`,cssId:`--xyz-abs-d65`,name:`Absolute XYZ D65`,coords:{x:{refRange:[0,9504.7],name:`Xa`},y:{refRange:[0,1e4],name:`Ya`},z:{refRange:[0,10888.3],name:`Za`}},base:Df,fromBase(e){return e.map(e=>e*op)},toBase(e){return e.map(e=>e/op)}}),cp=1.15,lp=.66,up=2610/2**14,dp=2**14/2610,fp=3424/4096,pp=2413/128,mp=2392/128,hp=1.7*2523/32,gp=32/(1.7*2523),_p=-.56,vp=16295499532821565e-27,yp={XYZtoCone:[[.41478972,.579999,.014648],[-.20151,1.120649,.0531008],[-.0166008,.2648,.6684799]],ConetoXYZ:[[1.9242264357876067,-1.0047923125953657,.037651404030618],[.35031676209499907,.7264811939316552,-.06538442294808501],[-.09098281098284752,-.3127282905230739,1.5227665613052603]],ConetoIab:[[.5,.5,0],[3.524,-4.066708,.542708],[.199076,1.096799,-1.295875]],IabtoCone:[[1,.13860504327153927,.05804731615611883],[1,-.1386050432715393,-.058047316156118904],[1,-.09601924202631895,-.811891896056039]]},bp=new V({id:`jzazbz`,name:`Jzazbz`,coords:{jz:{refRange:[0,1],name:`Jz`},az:{refRange:[-.21,.21]},bz:{refRange:[-.21,.21]}},base:sp,M:yp,fromBase(e){let[t,n,r]=e,[i,a,o]=Vd(Vd([cp*t-.1499999999999999*r,lp*n- -.33999999999999997*t,r],yp.XYZtoCone).map(function(e){return $d((fp+pp*$d(e/1e4,up))/(1+mp*$d(e/1e4,up)),hp)}),yp.ConetoIab);return[.43999999999999995*i/(1+_p*i)-vp,a,o]},toBase(e){let[t,n,r]=e,[i,a,o]=Vd(Vd([(t+vp)/(.43999999999999995-_p*(t+vp)),n,r],yp.IabtoCone).map(function(e){return 1e4*$d((fp-$d(e,gp))/(mp*$d(e,gp)-pp),dp)}),yp.ConetoXYZ),s=(i+.1499999999999999*o)/cp;return[s,(a+-.33999999999999997*s)/lp,o]},formats:{jzazbz:{coords:[`<percentage> | <number>`,`<number> | <percentage>`,`<number> | <percentage>`]}}}),xp=new V({id:`jzczhz`,name:`JzCzHz`,coords:{jz:{refRange:[0,1],name:`Jz`},cz:{refRange:[0,.26],name:`Chroma`},hz:{refRange:[0,360],type:`angle`,name:`Hue`}},base:bp,fromBase:Lf.fromBase,toBase:Lf.toBase,formats:{jzczhz:{coords:[`<percentage> | <number>`,`<number> | <percentage>`,`<number> | <angle>`]}}});function Sp(e,t){[e,t]=B([e,t]);let[n,r,i]=xp.from(e),[a,o,s]=xp.from(t),c=n-a,l=r-o;z(i)&&z(s)?(i=0,s=0):z(i)?i=s:z(s)&&(s=i);let u=i-s,d=2*Math.sqrt(r*o)*Math.sin(u/2*(Math.PI/180));return Math.sqrt(c**2+l**2+d**2)}var Cp=3424/4096,wp=2413/128,Tp=2392/128,Ep=2610/16384,Dp=2523/32,Op=16384/2610,kp=32/2523,Ap={XYZtoLMS:[[.3592832590121217,.6976051147779502,-.035891593232029],[-.1920808463704993,1.100476797037432,.0753748658519118],[.0070797844607479,.0748396662186362,.8433265453898765]],LMStoIPT:[[2048/4096,2048/4096,0],[6610/4096,-13613/4096,7003/4096],[17933/4096,-17390/4096,-543/4096]],IPTtoLMS:[[.9999999999999998,.0086090370379328,.111029625003026],[.9999999999999998,-.0086090370379328,-.1110296250030259],[.9999999999999998,.5600313357106791,-.3206271749873188]],LMStoXYZ:[[2.0701522183894223,-1.3263473389671563,.2066510476294053],[.3647385209748072,.6805660249472273,-.0453045459220347],[-.0497472075358123,-.0492609666966131,1.1880659249923042]]},jp=new V({id:`ictcp`,name:`ICTCP`,coords:{i:{refRange:[0,1],name:`I`},ct:{refRange:[-.5,.5],name:`CT`},cp:{refRange:[-.5,.5],name:`CP`}},base:sp,M:Ap,fromBase(e){return Mp(Vd(e,Ap.XYZtoLMS))},toBase(e){return Vd(Np(e),Ap.LMStoXYZ)},formats:{ictcp:{coords:[`<percentage> | <number>`,`<number> | <percentage>`,`<number> | <percentage>`]}}});function Mp(e){return Vd(e.map(function(e){return((Cp+wp*(e/1e4)**Ep)/(1+Tp*(e/1e4)**Ep))**Dp}),Ap.LMStoIPT)}function Np(e){return Vd(e,Ap.IPTtoLMS).map(function(e){return 1e4*(Math.max(e**kp-Cp,0)/(wp-Tp*e**kp))**Op})}function Pp(e,t){[e,t]=B([e,t]);let[n,r,i]=jp.from(e),[a,o,s]=jp.from(t);return 720*Math.sqrt((n-a)**2+.25*(r-o)**2+(i-s)**2)}function Fp(e,t){[e,t]=B([e,t]);let[n,r,i]=Gf.from(e),[a,o,s]=Gf.from(t),c=n-a,l=2*(r-o),u=2*(i-s);return Math.sqrt(c**2+l**2+u**2)}var Ip=_f.D65,Lp=.42,Rp=1/Lp,zp=2*Math.PI,Bp={cat16:[[.401288,.650173,-.051461],[-.250268,1.204414,.045854],[-.002079,.048952,.953127]],cat16Inv:[[1.8620678550872327,-1.0112546305316843,.14918677544445175],[.38752654323613717,.6214474419314753,-.008973985167612518],[-.015841498849333856,-.03412293802851557,1.0499644368778496]],m1:[[460,451,288],[460,-891,-261],[460,-220,-6300]]},Vp={dark:[.8,.525,.8],dim:[.9,.59,.9],average:[1,.69,1]},Hp={h:[20.14,90,164.25,237.53,380.14],e:[.8,.7,1,1.2,.8],H:[0,100,200,300,400]},Up=180/Math.PI,Wp=Math.PI/180;function Gp(e,t){return e.map(e=>{let n=$d(t*Math.abs(e)*.01,Lp);return 400*Qd(n,e)/(n+27.13)})}function Kp(e,t){let n=100/t*27.13**Rp;return e.map(e=>{let t=Math.abs(e);return Qd(n*$d(t/(400-t),Rp),e)})}function qp(e){let t=Ff(e);t<=Hp.h[0]&&(t+=360);let n=tf(Hp.h,t)-1,[r,i]=Hp.h.slice(n,n+2),[a,o]=Hp.e.slice(n,n+2),s=Hp.H[n],c=(t-r)/a;return s+100*c/(c+(i-t)/o)}function Jp(e){let t=(e%400+400)%400,n=Math.floor(.01*t);t%=100;let[r,i]=Hp.h.slice(n,n+2),[a,o]=Hp.e.slice(n,n+2);return Ff((t*(o*r-a*i)-100*r*o)/(t*(o-a)-100*o))}function Yp(e,t,n,r,i){let a={};a.discounting=i,a.refWhite=e,a.surround=r;let o=e.map(e=>e*100);a.la=t,a.yb=n;let s=o[1],c=Vd(o,Bp.cat16),l=Vp[a.surround],u=l[0];a.c=l[1],a.nc=l[2];let d=(1/(5*a.la+1))**4;a.fl=d*a.la+.1*(1-d)*(1-d)*Math.cbrt(5*a.la),a.flRoot=a.fl**.25,a.n=a.yb/s,a.z=1.48+Math.sqrt(a.n),a.nbb=.725*a.n**-.2,a.ncb=a.nbb;let f=i?1:Math.max(Math.min(u*(1-1/3.6*Math.exp((-a.la-42)/92)),1),0);a.dRgb=c.map(e=>Jd(1,s/e,f)),a.dRgbInv=a.dRgb.map(e=>1/e);let p=Gp(c.map((e,t)=>e*a.dRgb[t]),a.fl);return a.aW=a.nbb*(2*p[0]+p[1]+.05*p[2]),a}var Xp=Yp(Ip,64/Math.PI*.2,20,`average`,!1);function Zp(e,t){if(!(e.J!==void 0^e.Q!==void 0))throw Error(`Conversion requires one and only one: 'J' or 'Q'`);if(!(e.C!==void 0^e.M!==void 0^e.s!==void 0))throw Error(`Conversion requires one and only one: 'C', 'M' or 's'`);if(!(e.h!==void 0^e.H!==void 0))throw Error(`Conversion requires one and only one: 'h' or 'H'`);if(e.J===0||e.Q===0)return[0,0,0];let n=0;n=e.h===void 0?Jp(e.H)*Wp:Ff(e.h)*Wp;let r=Math.cos(n),i=Math.sin(n),a=0;e.J===void 0?e.Q!==void 0&&(a=.25*t.c*e.Q/((t.aW+4)*t.flRoot)):a=$d(e.J,1/2)*.1;let o=0;e.C===void 0?e.M===void 0?e.s!==void 0&&(o=4e-4*e.s**2*(t.aW+4)/t.c):o=e.M/t.flRoot/a:o=e.C/a;let s=$d(o*(1.64-.29**t.n)**-.73,10/9),c=.25*(Math.cos(n+2)+3.8),l=t.aW*$d(a,2/t.c/t.z),u=5e4/13*t.nc*t.ncb*c,d=l/t.nbb,f=23*(d+.305)*ef(s,23*u+s*(11*r+108*i));return Vd(Kp(Vd([d,f*r,f*i],Bp.m1).map(e=>e*1/1403),t.fl).map((e,n)=>e*t.dRgbInv[n]),Bp.cat16Inv).map(e=>e/100)}function Qp(e,t){let n=Gp(Vd(e.map(e=>e*100),Bp.cat16).map((e,n)=>e*t.dRgb[n]),t.fl),r=n[0]+(-12*n[1]+n[2])/11,i=(n[0]+n[1]-2*n[2])/9,a=(Math.atan2(i,r)%zp+zp)%zp,o=.25*(Math.cos(a+2)+3.8),s=$d(5e4/13*t.nc*t.ncb*ef(o*Math.sqrt(r**2+i**2),n[0]+n[1]+1.05*n[2]+.305),.9)*(1.64-.29**t.n)**.73,c=$d(t.nbb*(2*n[0]+n[1]+.05*n[2])/t.aW,.5*t.c*t.z),l=100*$d(c,2),u=4/t.c*c*(t.aW+4)*t.flRoot,d=s*c,f=d*t.flRoot,p=Ff(a*Up),m=qp(p);return{J:l,C:d,h:p,s:50*$d(t.c*s/(t.aW+4),1/2),Q:u,M:f,H:m}}var $p=new V({id:`cam16-jmh`,cssId:`--cam16-jmh`,name:`CAM16-JMh`,coords:{j:{refRange:[0,100],name:`J`},m:{refRange:[0,105],name:`Colorfulness`},h:{refRange:[0,360],type:`angle`,name:`Hue`}},base:Df,M:Bp,fromBase(e){this.ε===void 0&&(this.ε=Object.values(this.coords)[1].refRange[1]/1e5);let t=Qp(e,Xp),n=Math.abs(t.M)<this.ε;return[t.J,n?0:t.M,n?null:t.h]},toBase(e){return Zp({J:e[0],M:e[1],h:e[2]},Xp)}}),em=_f.D65,tm=216/24389,nm=24389/27;function rm(e){return 116*(e>tm?Math.cbrt(e):(nm*e+16)/116)-16}function im(e){return e>8?((e+16)/116)**3:e/nm}function am(e,t){let[n,r,i]=e,a=[],o=0;if(i===0)return[0,0,0];let s=im(i);o=i>0?.00379058511492914*i**2+.608983189401032*i+.9155088574762233:9514440756550361e-21*i**2+.08693057439788597*i-21.928975842194614;let c=0,l=1/0,u=[0,0,0];for(;c<=15;){a=Zp({J:o,C:r,h:n},t);let e=Math.abs(a[1]-s);if(e<l){if(e<=2e-12)return a;u=a,l=e}o-=(a[1]-s)*o/(2*a[1]),c+=1}return u}function om(e,t){let n=rm(e[1]);if(n===0)return[0,0,0];let r=Qp(e,sm);return[Ff(r.h),r.C,n]}var sm=Yp(em,200/Math.PI*im(50),im(50)*100,`average`,!1),cm=new V({id:`hct`,name:`HCT`,coords:{h:{refRange:[0,360],type:`angle`,name:`Hue`},c:{refRange:[0,145],name:`Colorfulness`},t:{refRange:[0,100],name:`Tone`}},base:Df,fromBase(e){this.ε===void 0&&(this.ε=Object.values(this.coords)[1].refRange[1]/1e5);let t=om(e,sm);return t[1]<this.ε&&(t[1]=0,t[0]=null),t},toBase(e){return am(e,sm)},formats:{color:{id:`--hct`,coords:[`<number> | <angle>`,`<percentage> | <number>`,`<percentage> | <number>`]}}}),lm=Math.PI/180,um=[1,.007,.0228];function dm(e){e[1]<0&&(e=cm.fromBase(cm.toBase(e)));let t=Math.log(Math.max(1+um[2]*e[1]*sm.flRoot,1))/um[2],n=e[0]*lm,r=t*Math.cos(n),i=t*Math.sin(n);return[e[2],r,i]}function fm(e,t){[e,t]=B([e,t]);let[n,r,i]=dm(cm.from(e)),[a,o,s]=dm(cm.from(t));return Math.sqrt((n-a)**2+(r-o)**2+(i-s)**2)}var{cos:pm,sin:mm,sqrt:hm,atan2:gm,exp:_m,abs:vm,pow:ym,PI:bm}=Math,xm=[[1.000042977349746,20718877053183e-18,-4361018085669474e-20],[26946201090235744e-21,.9999906145080147,-14898828405401079e-21],[-7941753620756204e-21,12875204405137254e-21,.9997859822609763]],Sm=[[.9999570254019492,-2071874272730964e-20,4361733292468361e-20],[-2694517763358666e-20,1.000009385946497,1490098223546482e-20],[7943459292954202e-21,-1287824596735154e-20,1.000214063706999]],Cm=[[.7212986433113499,.45344826541531813,-.19288975751942616],[-.788211869495579,1.795241376757236,.0876172451181785],[-.0917700599912156,.45765588659459255,1.2922045513917677]],wm=[[1.065107295808859,-.3150044075301121,.1803492381741039],[.4721107713837796,.4271995765962455,.04150680489380985],[-.09156391926309541,-.1736709363194979,.7719790382558294]],Tm=[.47229813098762524,.5149184096354483,.5113233386366979],Em=[2.1173067060606283,1.9420552485353544,1.9557096741686448],Dm={CAT_TO_HELM:xm,CAT_FROM_HELM:Sm,M1:Cm,M1_INV:wm,M2:[[-.26355622180094096,.4168322883703174,.4926763141656403],[1.8897570508777322,-3.1212232034205774,1.0421666921060384],[.3585108617962056,1.7694028193790368,-1.4120626067695372]],M2_INV:[[.9183897822815021,.5232051237088666,.7065804598090856],[1.0899090574433026,.07005324849041904,.4319776874787044],[1.598895729264209,.22061850068770233,.012506037355220951]]},Om=-.02833024015436984,km=-.21131429516166544,Am=.2189784817615645,jm=-.06871898981942523,Mm=.005506053349515315,Nm=-.0641329861299175,Pm=-.053592461436994296,Fm=-.00954137464208059,Im=.2676231133101982,Lm=.8934892185255707,Rm=.7173169828841472,zm=.6915224124600773,Bm=.48647127559605596,Vm=.9853124591201782,Hm=.5385456675962418,Um=.12508858146241716,Wm=.6768950256217603,Gm=-.4963251525324449,Km=-.09564696283240552,qm=-.029053748937210654,Jm=1.3346761652952872,Ym=-.1698908144723919,Xm=-.195370576218515,Zm=.5330819227283227,Qm=.08863325582067766,$m=.9365540137751136,eh=.13789738139719568,th=.061650260197979936,nh=.0641970862504494,rh=-.027401052793571013,ih=-.09900209889026965,ah=.059635520647228726,oh=-.013586499967803128,sh=.2253393118474472,ch=-1.5239477450767043,lh=-1.751157310240011,uh=-.43576378069144767,dh=1.060094063845983,fh=.47931193034584496,ph=-.2622579649434462,mh=.13610794232685908,hh=.1168702235362288,gh=-.01617739641422492,_h=.038145638815030566,vh=-28.2*bm/180,yh=pm(vh),bh=mm(vh);function xh(e){return Om*pm(e)+km*mm(e)+Am*pm(2*e)+jm*mm(2*e)+Mm*pm(3*e)+Nm*mm(3*e)+Pm*pm(4*e)+Fm*mm(4*e)}function Sh(e){return .02833024015436984*mm(e)+km*pm(e)+-2*Am*mm(2*e)+2*jm*pm(2*e)+-3*Mm*mm(3*e)+3*Nm*pm(3*e)+-4*Pm*mm(4*e)+4*Fm*pm(4*e)}function Ch(e){return _m(Xm*pm(e)+Zm*mm(e)+Qm*pm(2*e)+$m*mm(2*e)+eh*pm(3*e)+th*mm(3*e)+nh*pm(4*e)+rh*mm(4*e))}function wh(e){let t=e-.5;return _m(Zd(-30,ch*t+lh*t*t,30))}function Th(e,t){let n=uh*pm(e)+dh*mm(e)+fh*pm(2*e)+ph*mm(2*e);return _m(Zd(-30,(t-.5)*n,30))}function Eh(e){return _m(mh*pm(e)+hh*mm(e)+gh*pm(2*e)+_h*mm(2*e))}function Dh(e){return 1+ih*pm(e)+ah*mm(e)+oh*pm(2*e)+sh*mm(2*e)}function Oh(e,t){let n=e*(1-e),r=e+Hm*n+Um*n*(.5-e)+Wm*n*n;return r+=n*(Gm*pm(t)+Km*mm(t)),r}function kh(e,t){let n=Gm*pm(t)+Km*mm(t),r=e;for(let t=0;t<15;t++){let t=r*(1-r),i=1-2*r,a=r+(Hm+n)*t+Um*t*(.5-r)+Wm*t*t-e,o=1+(Hm+n)*i+Um*(i*(.5-r)-t)+Wm*2*t*i;vm(o)<1e-10&&(o=1),r-=a/o}return r}function Ah(e,t){let n=qm+Jm*pm(t)+Ym*mm(t),r=e<1?1-e:0;return e*_m(Zd(-30,n*e*r*r,30))}function jh(e,t){let n=qm+Jm*pm(t)+Ym*mm(t),r=e;for(let t=0;t<12;t++){let t=r<1?1-r:0,i=_m(Zd(-30,n*r*t*t,30)),a=r*i-e,o=n*t*(1-3*r),s=i*(1+r*o);vm(s)<1e-10&&(s=1),r-=a/s}return r}var Mh=function(e){let[t,n,r]=Vd(Vd(e,Dm.CAT_TO_HELM),Dm.M1),[i,a,o]=Vd([$d(t,Tm[0]),$d(n,Tm[1]),$d(r,Tm[2])],Dm.M2),s=gm(o,a),c=hm(a*a+o*o),l=xh(s),u=s+l;a=c*pm(u),o=c*mm(u);let d=Im*ym(hm(a*a+o*o),Zd(.01,Lm,10)),f=gm(o,a),p=1+Rm*pm(f)+zm*mm(f)+Bm*pm(2*f)+Vm*mm(2*f);i+=d*p,s=gm(o,a),i=Oh(i,s),s=gm(o,a),i=Ah(i,s),s=gm(o,a);let m=Ch(s);a*=m,o*=m,s=gm(o,a),c=hm(a*a+o*o);let h=Dh(s),g=c>0?ym(c,h):0;a=g*pm(s),o=g*mm(s);let _=wh(i);a*=_,o*=_,s=gm(o,a);let v=Th(s,i);a*=v,o*=v,s=gm(o,a),i*=Eh(s);let y=a*yh-o*bh,b=a*bh+o*yh;return[i,y,b]},Nh=function(e){let[t,n,r]=e,i=n*yh+r*bh,a=-n*bh+r*yh;n=i,r=a;let o=gm(r,n);t/=Eh(o),o=gm(r,n);let s=Th(o,t);n/=s,r/=s;let c=wh(t);n/=c,r/=c,o=gm(r,n);let l=hm(n*n+r*r),u=Dh(o),d=l>0?ym(l,1/u):0;n=d*pm(o),r=d*mm(o),o=gm(r,n);let f=Ch(o);n/=f,r/=f,o=gm(r,n),t=jh(t,o),o=gm(r,n),t=kh(t,o);let p=Im*ym(hm(n*n+r*r),Zd(.01,Lm,10)),m=gm(r,n),h=1+Rm*pm(m)+zm*mm(m)+Bm*pm(2*m)+Vm*mm(2*m);t-=p*h;let g=gm(r,n);l=hm(n*n+r*r);let _=g;for(let e=0;e<8;e++){let e=_+xh(_)-g,t=1+Sh(_);vm(t)<1e-10&&(t=1),_-=e/t}n=l*pm(_),r=l*mm(_);let[v,y,b]=Vd([t,n,r],Dm.M2_INV);return Vd(Vd([$d(v,Em[0]),$d(y,Em[1]),$d(b,Em[2])],Dm.M1_INV),Dm.CAT_FROM_HELM)},Ph=new V({id:`helmlab-metric`,name:`Helmlab MetricSpace`,cssId:`--helmlab-metric`,coords:{l:{refRange:[0,1.6],name:`Lightness`},a:{refRange:[-1.5,1.5]},b:{refRange:[-1.5,1.5]}},white:`D65`,base:Df,M:Dm,fromBase(e){return Mh(e)},toBase(e){return Nh(e)}}),Fh=-.9155125151657894,Ih=2.9268353744941558,Lh=3.966003089807536,Rh=1.9737081170404969,zh=52.473130649294724,Bh=.47897301074925214;function Vh(e,t){[e,t]=B([e,t]);let[n,r,i]=Ph.from(e),[a,o,s]=Ph.from(t),c=n-a,l=r-o,u=i-s,d=1+Fh*((n+a)*.5-.5)**2,f=1+Ih*((Math.sqrt(r**2+i**2)+Math.sqrt(o**2+s**2))*.5),p=(c**2/d**2+Lh*(l**2+u**2)/f**2)**(Rh/2);return(p/(1+zh*p))**Bh}var Hh={deltaE76:rp,deltaECMC:ap,deltaE2000:Uf,deltaEJz:Sp,deltaEITP:Pp,deltaEOK:Kf,deltaEOK2:Fp,deltaEHCT:fm,deltaEHelmlab:Vh};function yee(e){return Math.max(parseFloat(`1e${(e?Math.floor(Math.log10(Math.abs(e))):0)-2}`),1e-6)}var Uh={hct:{method:`hct.c`,jnd:2,deltaEMethod:`hct`,blackWhiteClamp:{}},"hct-tonal":{method:`hct.c`,jnd:0,deltaEMethod:`hct`,blackWhiteClamp:{channel:`hct.t`,min:0,max:100}}};function Wh(e,{method:t=pf.gamut_mapping,space:n=void 0,deltaEMethod:r=``,jnd:i=2,blackWhiteClamp:a=void 0}={}){if(e=B(e),Ud(arguments[1])?n=arguments[1]:n||=e.space,n=V.get(n),Jf(e,n,{epsilon:0}))return e;let o;if(t===`css`)o=bee(e,{space:n});else if(t===`raytrace`)o=See(e,{space:n});else{if(t!==`clip`){Object.prototype.hasOwnProperty.call(Uh,t)&&({method:t,jnd:i,deltaEMethod:r,blackWhiteClamp:a}=Uh[t]);let s=Uf;if(r!==``){for(let e in Hh)if(`deltae`+r.toLowerCase()===e.toLowerCase()){s=Hh[e];break}}i===0&&(i=1e-16);let c=Wh(Yf(e,n),{method:`clip`,space:n});if(s(e,c)>i){if(a&&Object.keys(a).length===3){let t=V.resolveCoord(a.channel),n=Zf(Yf(e,t.space),t.id);if(z(n)&&(n=0),n>=a.max)return Yf({space:`xyz-d65`,coords:_f.D65},e.space);if(n<=a.min)return Yf({space:`xyz-d65`,coords:[0,0,0]},e.space)}let r=V.resolveCoord(t),c=r.space,l=r.id,u=Yf(e,c);u.coords.forEach((e,t)=>{z(e)&&(u.coords[t]=0)});let d=(r.range||r.refRange)[0],f=yee(i),p=d,m=Zf(u,l);for(;m-p>f;){let e=tp(u);e=Wh(e,{space:n,method:`clip`}),s(u,e)-i<f?p=Zf(u,l):m=Zf(u,l),ep(u,l,(p+m)/2)}o=Yf(u,n)}else o=c}else o=Yf(e,n);if(t===`clip`||!Jf(o,n,{epsilon:0})){let e=Object.values(n.coords).map(e=>e.range||[]);o.coords=o.coords.map((t,n)=>{let[r,i]=e[n];return r!==void 0&&(t=Math.max(r,t)),i!==void 0&&(t=Math.min(t,i)),t})}}return n!==e.space&&(o=Yf(o,e.space)),e.coords=o.coords,e}Wh.returns=`color`;var Gh={WHITE:{space:Gf,coords:[1,0,0],alpha:1},BLACK:{space:Gf,coords:[0,0,0],alpha:1}};function bee(e,{space:t}={}){let n=.02,r=1e-4;if(e=B(e),t||=e.space,t=V.get(t),t.isUnbounded)return Yf(e,t);let i=Yf(e,Qf),a=i.coords[0];if(a>=1){let n=Yf(Gh.WHITE,t);return n.alpha=e.alpha,Yf(n,t)}if(a<=0){let n=Yf(Gh.BLACK,t);return n.alpha=e.alpha,Yf(n,t)}if(Jf(i,t,{epsilon:0}))return Yf(i,t);function o(e){let n=Yf(e,t),r=Object.values(t.coords);return n.coords=n.coords.map((e,t)=>{if(`range`in r[t]){let[n,i]=r[t].range;return Zd(n,e,i)}return e}),n}let s=0,c=i.coords[1],l=!0,u=tp(i),d=o(u),f=Kf(d,u);if(f<n)return d;for(;c-s>r;){let e=(s+c)/2;if(u.coords[1]=e,l&&Jf(u,t,{epsilon:0}))s=e;else if(d=o(u),f=Kf(d,u),f<n){if(n-f<r)break;l=!1,s=e}else c=e}return d}function xee(e,t,n=[0,0,0],r=[1,1,1]){let i=1/0,a=-1/0,o=[];for(let s=0;s<3;s++){let c=e[s],l=t[s]-c,u=n[s],d=r[s];if(o.push(l),Math.abs(l)>1e-12){let e=1/l,t=(u-c)*e,n=(d-c)*e;a=Math.max(Math.min(t,n),a),i=Math.min(Math.max(t,n),i)}else if(c<u||c>d)return[]}return a>i||i<0||(a<0&&(a=i),!isFinite(a))?[]:[e[0]+o[0]*a,e[1]+o[1]*a,e[2]+o[2]*a]}function See(e,{space:t}={}){if(e=B(e),t||=e.space,t=V.get(t),t.isUnbounded)return Yf(e,t);let n=Yf(e,Qf),[r,i,a]=n.coords;if(r>=1){let n=Yf(Gh.WHITE,t);return n.alpha=e.alpha,Yf(n,t)}if(r<=0){let n=Yf(Gh.BLACK,t);return n.alpha=e.alpha,Yf(n,t)}let o=t,s=t.rgbGamut;if(s!==void 0&&(t=s),!nf(t,Of))throw Error(`An RGB gamut is required`);let[c,l]=Object.values(t.coords)[0].range,u=[l,l,l],d=t.linearGamut;d!==void 0&&(l=Yf({space:t,coords:u,alpha:e.alpha},d).coords[0],u=[l,l,l],t=d,c=Object.values(t.coords)[0].range[0]);let f=[c,c,c],p=Yf(n,t);if(!p.coords.every(e=>c<=e&&e<=l)){let e=Yf({space:Qf,coords:[r,0,a]},t).coords,n=c+1e-12,i=l-1e-12,o=p.coords;for(let s=0;s<4;s++){if(s){let e=Yf(p,Qf);e.coords[0]=r,e.coords[2]=a,p=Yf(e,t)}let c=xee(e,p.coords,f,u);if(c.length===0){p.coords=[...o];break}s&&p.coords.every(e=>n<e&&e<i)&&(e=[...p.coords]),o=c,p.coords=[...c]}}p=Yf(p,o);let m=Object.values(o.coords);return p.coords=p.coords.map((e,t)=>{if(`range`in m[t]){let[n,r]=m[t].range;return Zd(n,e,r)}return e}),p}var Kh=class extends V{constructor(e){let t=V.get(e.base),n=e.chroma??`c`,r=Object.keys(t.coords),i=r.indexOf(n);if(i===-1)throw TypeError(`GamutRelativeColorSpace needs a "${n}" coordinate, got ${t.id}`);let a=Object.fromEntries(Object.entries(t.coords).map(([e,t])=>[e,{...t}]));a[n].range=[0,1],delete a[n].refRange,e.coords??=a,e.formats??={color:{coords:r.map(e=>{if(t.coords[e].type===`angle`)return`<number> | <angle>`;let[r,i]=t.coords[e].range??t.coords[e].refRange??[];return e===n||r===0&&i===1?`<percentage> | <number>`:`<number> | <percentage>`})}},super(e),this.chromaIndex=i,this.method=`${t.id}.${n}`;let o=[[0,0,1],[0,1,0],[0,1,1],[1,0,0],[1,0,1],[1,1,0]];this.oogChroma=1.01*Math.max(...o.map(e=>t.from(this.gamutSpace,e)[this.chromaIndex]||0))}maxChroma(e){let t=[...e];return t[this.chromaIndex]=this.oogChroma,Wh({space:this.base,coords:t},{space:this.gamutSpace,method:this.method,deltaEMethod:`OK`,jnd:0}).coords[this.chromaIndex]}toBase(e){return e=[...e],e.some((e,t)=>t!==this.chromaIndex&&z(e))?e[this.chromaIndex]!==0&&(e[this.chromaIndex]=null):z(e[this.chromaIndex])||(e[this.chromaIndex]*=this.maxChroma(e)),e}fromBase(e){if(e=[...e],e.some((e,t)=>t!==this.chromaIndex&&z(e)))e[this.chromaIndex]!==0&&(e[this.chromaIndex]=null);else if(!z(e[this.chromaIndex])){let t=this.maxChroma(e);e[this.chromaIndex]=t?e[this.chromaIndex]/t:0}return e}};function qh(e,t={}){if(Array.isArray(e))return e.map(e=>qh(e,t));let{cssProperty:n=`background-color`,element:r,...i}=t,a=null;try{return B(e,i)}catch(e){a=e}let{CSS:o,getComputedStyle:s}=globalThis;if(Ud(e)&&r&&o&&s&&o.supports(n,e)){let t=r.style[n];e!==t&&(r.style[n]=e);let o=s(r).getPropertyValue(n);if(e!==t&&(r.style[n]=t),o!==e)try{return B(o,i)}catch(e){a=e}else a={message:`Color value is a valid CSS color, but it could not be resolved :(`}}return t.errorMeta&&(t.errorMeta.error=a),null}function Jh(e,t={}){let{precision:n=pf.precision,format:r,inGamut:i=!0,coords:a,alpha:o,commas:s}=t,c,l=B(e),u=r,d=l.parseMeta;d&&!r&&(d.format.canSerialize()&&(r=d.format,u=d.formatId),a??=d.types,o??=d.alphaType,s??=d.commas),u&&(r=l.space.getFormat(r)??V.findFormat(u)),r||(r=l.space.getFormat(`default`)??V.DEFAULT_FORMAT,u=r.name),r&&r.space&&r.space!==l.space&&(l=Yf(l,r.space));let f=l.coords.slice();if(i||=r.toGamut,i&&!Jf(l)&&(f=Wh(tp(l),i===!0?void 0:i).coords),r.type===`custom`){if(r.serialize)c=r.serialize(f,l.alpha,t);else throw TypeError(`format ${u} can only be used to parse colors, not for serialization`)}else{let e=r.name||`color`,t=r.serializeCoords(f,n,a);if(e===`color`){let e=r.id||r.ids?.[0]||l.space.cssId||l.space.id;t.unshift(e)}let i=l.alpha;o!==void 0&&typeof o!=`object`&&(o=typeof o==`string`?{type:o}:{include:o});let u=o?.type??`<number>`,d=o?.include===!0||r.alpha===!0||o?.include!==!1&&r.alpha!==!1&&i<1,p=``;if(s??=r.commas,d){if(n!==null){let e;u===`<percentage>`&&(e=`%`,i*=100),i=Gd(i,{precision:n,unit:e})}p=`${s?`,`:` /`} ${i}`}c=`${e}(${t.join(s?`, `:` `)}${p})`}return c}var Yh={toXYZ:[[.6369580483012914,.14461690358620832,.1688809751641721],[.2627002120112671,.6779980715188708,.05930171646986196],[0,.028072693049087428,1.060985057710791]],fromXYZ:[[1.716651187971268,-.355670783776392,-.25336628137366],[-.666684351832489,1.616481236634939,.0157685458139111],[.017639857445311,-.042770613257809,.942103121235474]]},Xh=new Of({id:`rec2020-linear`,cssId:`--rec2020-linear`,name:`Linear REC.2020`,white:`D65`,M:Yh}),Zh=new Of({id:`rec2020`,name:`REC.2020`,base:Xh,linearGamut:Xh,toBase(e){return e.map(function(e){let t=e<0?-1:1;return t*(e*t)**2.4})},fromBase(e){return e.map(function(e){let t=e<0?-1:1;return t*(e*t)**(1/2.4)})}}),Qh=new Of({id:`p3-linear`,cssId:`display-p3-linear`,name:`Linear P3`,white:`D65`,M:{toXYZ:[[.4865709486482162,.26566769316909306,.1982172852343625],[.2289745640697488,.6917385218365064,.079286914093745],[0,.04511338185890264,1.043944368900976]],fromXYZ:[[2.493496911941425,-.9313836179191239,-.40271078445071684],[-.8294889695615747,1.7626640603183463,.023624685841943577],[.03584583024378447,-.07617238926804182,.9568845240076872]]}}),$h={toXYZ:[[.41239079926595934,.357584339383878,.1804807884018343],[.21263900587151027,.715168678767756,.07219231536073371],[.01933081871559182,.11919477979462598,.9505321522496607]],fromXYZ:[[3.2409699419045226,-1.537383177570094,-.4986107602930034],[-.9692436362808796,1.8759675015077202,.04155505740717559],[.05563007969699366,-.20397695888897652,1.0569715142428786]]},eg=new Of({id:`srgb-linear`,name:`Linear sRGB`,white:`D65`,M:$h}),tg={aliceblue:[240/255,248/255,1],antiquewhite:[250/255,235/255,215/255],aqua:[0,1,1],aquamarine:[127/255,1,212/255],azure:[240/255,1,1],beige:[245/255,245/255,220/255],bisque:[1,228/255,196/255],black:[0,0,0],blanchedalmond:[1,235/255,205/255],blue:[0,0,1],blueviolet:[138/255,43/255,226/255],brown:[165/255,42/255,42/255],burlywood:[222/255,184/255,135/255],cadetblue:[95/255,158/255,160/255],chartreuse:[127/255,1,0],chocolate:[210/255,105/255,30/255],coral:[1,127/255,80/255],cornflowerblue:[100/255,149/255,237/255],cornsilk:[1,248/255,220/255],crimson:[220/255,20/255,60/255],cyan:[0,1,1],darkblue:[0,0,139/255],darkcyan:[0,139/255,139/255],darkgoldenrod:[184/255,134/255,11/255],darkgray:[169/255,169/255,169/255],darkgreen:[0,100/255,0],darkgrey:[169/255,169/255,169/255],darkkhaki:[189/255,183/255,107/255],darkmagenta:[139/255,0,139/255],darkolivegreen:[85/255,107/255,47/255],darkorange:[1,140/255,0],darkorchid:[153/255,50/255,204/255],darkred:[139/255,0,0],darksalmon:[233/255,150/255,122/255],darkseagreen:[143/255,188/255,143/255],darkslateblue:[72/255,61/255,139/255],darkslategray:[47/255,79/255,79/255],darkslategrey:[47/255,79/255,79/255],darkturquoise:[0,206/255,209/255],darkviolet:[148/255,0,211/255],deeppink:[1,20/255,147/255],deepskyblue:[0,191/255,1],dimgray:[105/255,105/255,105/255],dimgrey:[105/255,105/255,105/255],dodgerblue:[30/255,144/255,1],firebrick:[178/255,34/255,34/255],floralwhite:[1,250/255,240/255],forestgreen:[34/255,139/255,34/255],fuchsia:[1,0,1],gainsboro:[220/255,220/255,220/255],ghostwhite:[248/255,248/255,1],gold:[1,215/255,0],goldenrod:[218/255,165/255,32/255],gray:[128/255,128/255,128/255],green:[0,128/255,0],greenyellow:[173/255,1,47/255],grey:[128/255,128/255,128/255],honeydew:[240/255,1,240/255],hotpink:[1,105/255,180/255],indianred:[205/255,92/255,92/255],indigo:[75/255,0,130/255],ivory:[1,1,240/255],khaki:[240/255,230/255,140/255],lavender:[230/255,230/255,250/255],lavenderblush:[1,240/255,245/255],lawngreen:[124/255,252/255,0],lemonchiffon:[1,250/255,205/255],lightblue:[173/255,216/255,230/255],lightcoral:[240/255,128/255,128/255],lightcyan:[224/255,1,1],lightgoldenrodyellow:[250/255,250/255,210/255],lightgray:[211/255,211/255,211/255],lightgreen:[144/255,238/255,144/255],lightgrey:[211/255,211/255,211/255],lightpink:[1,182/255,193/255],lightsalmon:[1,160/255,122/255],lightseagreen:[32/255,178/255,170/255],lightskyblue:[135/255,206/255,250/255],lightslategray:[119/255,136/255,153/255],lightslategrey:[119/255,136/255,153/255],lightsteelblue:[176/255,196/255,222/255],lightyellow:[1,1,224/255],lime:[0,1,0],limegreen:[50/255,205/255,50/255],linen:[250/255,240/255,230/255],magenta:[1,0,1],maroon:[128/255,0,0],mediumaquamarine:[102/255,205/255,170/255],mediumblue:[0,0,205/255],mediumorchid:[186/255,85/255,211/255],mediumpurple:[147/255,112/255,219/255],mediumseagreen:[60/255,179/255,113/255],mediumslateblue:[123/255,104/255,238/255],mediumspringgreen:[0,250/255,154/255],mediumturquoise:[72/255,209/255,204/255],mediumvioletred:[199/255,21/255,133/255],midnightblue:[25/255,25/255,112/255],mintcream:[245/255,1,250/255],mistyrose:[1,228/255,225/255],moccasin:[1,228/255,181/255],navajowhite:[1,222/255,173/255],navy:[0,0,128/255],oldlace:[253/255,245/255,230/255],olive:[128/255,128/255,0],olivedrab:[107/255,142/255,35/255],orange:[1,165/255,0],orangered:[1,69/255,0],orchid:[218/255,112/255,214/255],palegoldenrod:[238/255,232/255,170/255],palegreen:[152/255,251/255,152/255],paleturquoise:[175/255,238/255,238/255],palevioletred:[219/255,112/255,147/255],papayawhip:[1,239/255,213/255],peachpuff:[1,218/255,185/255],peru:[205/255,133/255,63/255],pink:[1,192/255,203/255],plum:[221/255,160/255,221/255],powderblue:[176/255,224/255,230/255],purple:[128/255,0,128/255],rebeccapurple:[102/255,51/255,153/255],red:[1,0,0],rosybrown:[188/255,143/255,143/255],royalblue:[65/255,105/255,225/255],saddlebrown:[139/255,69/255,19/255],salmon:[250/255,128/255,114/255],sandybrown:[244/255,164/255,96/255],seagreen:[46/255,139/255,87/255],seashell:[1,245/255,238/255],sienna:[160/255,82/255,45/255],silver:[192/255,192/255,192/255],skyblue:[135/255,206/255,235/255],slateblue:[106/255,90/255,205/255],slategray:[112/255,128/255,144/255],slategrey:[112/255,128/255,144/255],snow:[1,250/255,250/255],springgreen:[0,1,127/255],steelblue:[70/255,130/255,180/255],tan:[210/255,180/255,140/255],teal:[0,128/255,128/255],thistle:[216/255,191/255,216/255],tomato:[1,99/255,71/255],turquoise:[64/255,224/255,208/255],violet:[238/255,130/255,238/255],wheat:[245/255,222/255,179/255],white:[1,1,1],whitesmoke:[245/255,245/255,245/255],yellow:[1,1,0],yellowgreen:[154/255,205/255,50/255]},ng=[,,,].fill(`<percentage> | <number>[0, 255]`),rg=[,,,].fill(`<number>[0, 255]`),ig=new Of({id:`srgb`,name:`sRGB`,base:eg,linearGamut:eg,fromBase:e=>e.map(e=>{let t=e<0?-1:1,n=e*t;return n>.0031308?t*(1.055*n**(1/2.4)-.055):12.92*e}),toBase:e=>e.map(e=>{let t=e<0?-1:1,n=e*t;return n<=.04045?e/12.92:t*((n+.055)/1.055)**2.4}),formats:{rgb:{coords:ng},rgb_number:{name:`rgb`,commas:!0,coords:rg,alpha:!1},color:{},rgba:{coords:ng,commas:!0,alpha:!0},rgba_number:{name:`rgba`,commas:!0,coords:rg},hex:{type:`custom`,toGamut:!0,test:e=>/^#(([a-f0-9]{2}){3,4}|[a-f0-9]{3,4})$/i.test(e),parse(e){e.length<=5&&(e=e.replace(/[a-f0-9]/gi,`$&$&`));let t=[];return e.replace(/[a-f0-9]{2}/gi,e=>{t.push(parseInt(e,16)/255)}),{spaceId:`srgb`,coords:t.slice(0,3),alpha:t.slice(3)[0]}},serialize:(e,t,{collapse:n=!0,alpha:r}={})=>{(r!==!1&&t<1||r===!0)&&e.push(t),e=e.map(e=>Math.round(e*255));let i=n&&e.every(e=>e%17==0);return`#`+e.map(e=>i?(e/17).toString(16):e.toString(16).padStart(2,`0`)).join(``)}},keyword:{type:`custom`,test:e=>/^[a-z]+$/i.test(e),parse(e){e=e.toLowerCase();let t={spaceId:`srgb`,coords:null,alpha:1};if(e===`transparent`?(t.coords=tg.black,t.alpha=0):t.coords=tg[e],t.coords)return t}}}}),ag=new Of({id:`p3`,cssId:`display-p3`,name:`P3`,base:Qh,linearGamut:Qh,fromBase:ig.fromBase,toBase:ig.toBase});pf.display_space=ig;var Cee;if(typeof CSS<`u`&&CSS.supports)for(let e of[Pf,Zh,ag]){let t=Jh({space:e,coords:e.getMinCoords(),alpha:1});if(CSS.supports(`color`,t)){pf.display_space=e;break}}function og(e,{space:t,supports:n=globalThis.CSS?.supports,...r}={}){e=B(e);let i=Jh(e,r);if(!n||n(`color`,i)||!pf.display_space)i=new String(i),i.color=e;else{let a=e;if((e.coords.some(z)||z(e.alpha))&&!(Cee??=n(`color`,`hsl(none 50% 50%)`))&&(a=tp(e),a.coords=a.coords.map(Kd),a.alpha=Kd(a.alpha),i=Jh(a,r),n(`color`,i)))return i=new String(i),i.color=a,i;if(t===void 0){t=a.space;let e=t.displaySpaces??t.bases;!t.displaySpaces&&!t.id.startsWith(`xyz-`)&&(e=e.filter(e=>!e.id.startsWith(`xyz-`)));for(let t of e){let e=Yf(a,t),o=Jh(e,r);if(n(`color`,o))return i=new String(o),i.color=e,i}t=pf.display_space}a=Yf(a,t),i=new String(Jh(a,r)),i.color=a}return i}function sg(e,t,{space:n,hue:r=`shorter`}={}){e=B(e),n||=e.space,n=V.get(n);let i=Object.values(n.coords);[e,t]=[e,t].map(e=>Yf(e,n));let[a,o]=[e,t].map(e=>e.coords),s=a.map((e,t)=>{let n=i[t],a=o[t];return n.type===`angle`&&([e,a]=If(r,[e,a])),cg(e,a)}),c=cg(e.alpha,t.alpha);return{space:n,coords:s,alpha:c}}function cg(e,t){return z(e)||z(t)?e===t?null:0:e-t}function lg(e,t){return e=B(e),t=B(t),e.space===t.space&&e.alpha===t.alpha&&e.coords.every((e,n)=>e===t.coords[n])}var ug=t({getLuminance:()=>dg,register:()=>pg,setLuminance:()=>fg});function dg(e){return Zf(e,[Df,`y`])}function fg(e,t){ep(e,[Df,`y`],t)}function pg(e){Object.defineProperty(e.prototype,"luminance",{get(){return dg(this)},set(e){fg(this,e)}})}function mg(e,t){e=B(e),t=B(t);let n=Math.max(dg(e),0),r=Math.max(dg(t),0);return r>n&&([n,r]=[r,n]),(n+.05)/(r+.05)}var hg=.56,gg=.57,_g=.62,vg=.65,yg=.022,bg=1.414,xg=.1,Sg=5e-4,Cg=1.14,wg=.027,Tg=1.14;function Eg(e){return e>=yg?e:e+(yg-e)**bg}function Dg(e){return(e<0?-1:1)*Math.abs(e)**2.4}function Og(e,t){t=B(t),e=B(e);let n,r,i,a,o,s;t=Yf(t,`srgb`),[a,o,s]=t.coords.map(e=>z(e)?0:e);let c=Dg(a)*.2126729+Dg(o)*.7151522+Dg(s)*.072175;e=Yf(e,`srgb`),[a,o,s]=e.coords.map(e=>z(e)?0:e);let l=Dg(a)*.2126729+Dg(o)*.7151522+Dg(s)*.072175,u=Eg(c),d=Eg(l),f=d>u;return Math.abs(d-u)<Sg?r=0:f?(n=d**hg-u**gg,r=n*Cg):(n=d**vg-u**_g,r=n*Tg),i=Math.abs(r)<xg?0:r>0?r-wg:r+wg,i*100}function kg(e,t){e=B(e),t=B(t);let n=Math.max(dg(e),0),r=Math.max(dg(t),0);r>n&&([n,r]=[r,n]);let i=n+r;return i===0?0:(n-r)/i}var Ag=5e4;function jg(e,t){e=B(e),t=B(t);let n=Math.max(dg(e),0),r=Math.max(dg(t),0);return r>n&&([n,r]=[r,n]),r===0?Ag:(n-r)/r}function Mg(e,t){e=B(e),t=B(t);let n=Zf(e,[Pf,`l`]),r=Zf(t,[Pf,`l`]);return Math.abs(n-r)}var Ng=216/24389,Pg=24/116,Fg=24389/27,Ig=_f.D65,Lg=new V({id:`lab-d65`,name:`Lab D65`,coords:{l:{refRange:[0,100],name:`Lightness`},a:{refRange:[-125,125]},b:{refRange:[-125,125]}},white:Ig,base:Df,fromBase(e){let t=e.map((e,t)=>e/Ig[t]).map(e=>e>Ng?Math.cbrt(e):(Fg*e+16)/116);return[116*t[1]-16,500*(t[0]-t[1]),200*(t[1]-t[2])]},toBase(e){let t=[];return t[1]=(e[0]+16)/116,t[0]=e[1]/500+t[1],t[2]=t[1]-e[2]/200,[t[0]>Pg?t[0]**3:(116*t[0]-16)/Fg,e[0]>8?((e[0]+16)/116)**3:e[0]/Fg,t[2]>Pg?t[2]**3:(116*t[2]-16)/Fg].map((e,t)=>e*Ig[t])},formats:{"lab-d65":{coords:[`<number> | <percentage>`,`<number> | <percentage>`,`<number> | <percentage>`]}}}),Rg=5**.5*.5+.5;function zg(e,t){e=B(e),t=B(t);let n=Zf(e,[Lg,`l`]),r=Zf(t,[Lg,`l`]),i=Math.abs(n**+Rg-r**+Rg)**(1/Rg)*Math.SQRT2-40;return i<7.5?0:i}var Bg=t({contrastAPCA:()=>Og,contrastDeltaPhi:()=>zg,contrastLstar:()=>Mg,contrastMichelson:()=>kg,contrastWCAG21:()=>mg,contrastWeber:()=>jg});function Vg(e,t,n){Ud(n)&&(n={algorithm:n});let{algorithm:r,...i}=n||{};if(!r){let e=Object.keys(Bg).map(e=>e.replace(/^contrast/,``)).join(`, `);throw TypeError(`contrast() function needs a contrast algorithm. Please specify one of: ${e}`)}e=B(e),t=B(t);for(let n in Bg)if(`contrast`+r.toLowerCase()===n.toLowerCase())return Bg[n](e,t,i);throw TypeError(`Unknown contrast algorithm: ${r}`)}var Hg=t({register:()=>Gg,uv:()=>Ug,xy:()=>Wg});function Ug(e){let[t,n,r]=Xf(e,Df),i=t+15*n+3*r;return[4*t/i,9*n/i]}function Wg(e){let[t,n,r]=Xf(e,Df),i=t+n+r;return[t/i,n/i]}function Gg(e){Object.defineProperty(e.prototype,"uv",{get(){return Ug(this)}}),Object.defineProperty(e.prototype,"xy",{get(){return Wg(this)}})}function Kg(e,t,n={}){Ud(n)&&(n={method:n});let{method:r=pf.deltaE,...i}=n;for(let n in Hh)if(`deltae`+r.toLowerCase()===n.toLowerCase())return Hh[n](e,t,i);throw TypeError(`Unknown deltaE method: ${r}`)}var qg=t({darken:()=>Yg,lighten:()=>Jg});function Jg(e,t=.25){return ep(e,[V.get(`oklch`,`lch`),`l`],e=>e*(1+t))}function Yg(e,t=.25){return ep(e,[V.get(`oklch`,`lch`),`l`],e=>e*(1-t))}Jg.returns=`color`,Yg.returns=`color`;var Xg=t({isRange:()=>t_,mix:()=>Zg,range:()=>$g,register:()=>n_,steps:()=>Qg});function Zg(e,t,n,r={}){return[e,t]=[B(e),B(t)],Wd(n)===`object`&&([n,r]=[.5,n]),$g(e,t,r)(n??.5)}function Qg(e,t,n={}){let r;t_(e)&&([r,n]=[e,t],[e,t]=r.rangeArgs.colors);let{maxDeltaE:i,deltaEMethod:a,steps:o=2,maxSteps:s=1e3,...c}=n;r||=([e,t]=[B(e),B(t)],$g(e,t,c));let l=Kg(e,t,a),u=i>0?Math.max(o,Math.ceil(l/i)+1):o,d=[];if(s!==void 0&&(u=Math.min(u,s)),u===1)d=[{p:.5,color:r(.5)}];else{let e=1/(u-1);d=Array.from({length:u},(t,n)=>{let i=n*e;return{p:i,color:r(i)}})}if(i>0){let e=d.reduce((e,t,n)=>{if(n===0)return 0;let r=Kg(t.color,d[n-1].color,a);return Math.max(e,r)},0);for(;e>i;){e=0;for(let t=1;t<d.length&&d.length<s;t++){let n=d[t-1],i=d[t],o=(i.p+n.p)/2,s=r(o);e=Math.max(e,Kg(s,n.color,a),Kg(s,i.color,a)),d.splice(t,0,{p:o,color:r(o)}),t++}}}return d=d.map(e=>e.color),d}function $g(e,t,n={}){if(t_(e)){let[n,r]=[e,t];return $g(...n.rangeArgs.colors,{...n.rangeArgs.options,...r})}let{space:r,outputSpace:i,progression:a,premultiplied:o}=n;e=B(e),t=B(t),e=tp(e),t=tp(t);let s={colors:[e,t],options:n};r=r?V.get(r):V.registry[pf.interpolationSpace]||e.space,i=i?V.get(i):r,e=Yf(e,r),t=Yf(t,r),e=Wh(e),t=Wh(t);let c=r.hueId,l=r.hueIndex;if(c){let i=n.hue=n.hue||`shorter`,a=[r,c],[o,s]=[Zf(e,a),Zf(t,a)];z(o)&&!z(s)?o=s:z(s)&&!z(o)&&(s=o),[o,s]=If(i,[o,s]),ep(e,a,o),ep(t,a,s)}return z(e.alpha)&&!z(t.alpha)?e.alpha=t.alpha:z(t.alpha)&&!z(e.alpha)&&(t.alpha=e.alpha),o&&(e.coords=e_(e.coords,e.alpha,l),t.coords=e_(t.coords,t.alpha,l)),Object.assign(n=>{n=a?a(n):n;let s=e.coords.map((e,r)=>{let i=t.coords[r];return Jd(e,i,n)}),c=Jd(e.alpha,t.alpha,n),u={space:r,coords:s,alpha:c};return o&&(u.coords=e_(u.coords,c,l,!0)),i!==r&&(u=Yf(u,i)),u},{rangeArgs:s})}function e_(e,t,n,r=!1){return z(t)||r&&t===0?e:e.map((e,i)=>i===n||z(e)?e:r?e/t:e*t)}function t_(e){return Wd(e)===`function`&&!!e.rangeArgs}pf.interpolationSpace=`lab`;function n_(e){e.defineFunction(`mix`,Zg,{returns:`color`}),e.defineFunction(`range`,$g,{returns:`function<color>`}),e.defineFunction(`steps`,Qg,{returns:`array<color>`})}var r_=new V({id:`hsl`,name:`HSL`,coords:{h:{refRange:[0,360],type:`angle`,name:`Hue`},s:{range:[0,100],name:`Saturation`},l:{range:[0,100],name:`Lightness`}},base:ig,rgbGamut:ig,fromBase:e=>{let t=Math.max(...e),n=Math.min(...e),[r,i,a]=e,[o,s,c]=[null,0,(n+t)/2],l=t-n;if(l!==0){switch(s=c===0||c===1?0:(t-c)/Math.min(c,1-c),t){case r:o=(i-a)/l+(i<a?6:0);break;case i:o=(a-r)/l+2;break;case a:o=(r-i)/l+4}o*=60}return s<0&&(o+=180,s=Math.abs(s)),o>=360&&(o-=360),[o,s*100,c*100]},toBase:e=>{let[t,n,r]=e;t%=360,t<0&&(t+=360),n/=100,r/=100;function i(e){let i=(e+t/30)%12,a=n*Math.min(r,1-r);return r-a*Math.max(-1,Math.min(i-3,9-i,1))}return[i(0),i(8),i(4)]},formats:{hsl:{coords:[`<number> | <angle>`,`<percentage> | <number>`,`<percentage> | <number>`]},hsla:{coords:[`<number> | <angle>`,`<percentage> | <number>`,`<percentage> | <number>`],commas:!0,alpha:!0}}}),i_=new V({id:`hsl-p3`,cssId:`--hsl-p3`,name:`HSL P3`,coords:{h:{refRange:[0,360],type:`angle`,name:`Hue`},s:{range:[0,100],name:`Saturation`},l:{range:[0,100],name:`Lightness`}},base:ag,rgbGamut:ag,fromBase:r_.fromBase,toBase:r_.toBase}),a_=new V({id:`hsl-rec2020`,cssId:`--hsl-rec2020`,name:`HSL Rec.2020`,coords:{h:{refRange:[0,360],type:`angle`,name:`Hue`},s:{range:[0,100],name:`Saturation`},l:{range:[0,100],name:`Lightness`}},base:Zh,rgbGamut:Zh,fromBase:r_.fromBase,toBase:r_.toBase}),o_=new V({id:`hsv`,name:`HSV`,coords:{h:{refRange:[0,360],type:`angle`,name:`Hue`},s:{range:[0,100],name:`Saturation`},v:{range:[0,100],name:`Value`}},base:ig,rgbGamut:ig,fromBase(e){let t=Math.max(...e),n=Math.min(...e),[r,i,a]=e,[o,s,c]=[null,0,t],l=t-n;if(l!==0){switch(t){case r:o=(i-a)/l+(i<a?6:0);break;case i:o=(a-r)/l+2;break;case a:o=(r-i)/l+4}o*=60}return c&&(s=l/c),o>=360&&(o-=360),[o,s*100,c*100]},toBase(e){let[t,n,r]=e;t%=360,t<0&&(t+=360),n/=100,r/=100;function i(e){let i=(e+t/60)%6;return r-r*n*Math.max(0,Math.min(i,4-i,1))}return[i(5),i(3),i(1)]},formats:{color:{id:`--hsv`,coords:[`<number> | <angle>`,`<percentage> | <number>`,`<percentage> | <number>`]}}}),s_=new V({id:`hwb`,name:`HWB`,coords:{h:{refRange:[0,360],type:`angle`,name:`Hue`},w:{range:[0,100],name:`Whiteness`},b:{range:[0,100],name:`Blackness`}},base:o_,rgbGamut:ig,fromBase(e){let[t,n,r]=e;return[t,r*(100-n)/100,100-r]},toBase(e){let[t,n,r]=e;n/=100,r/=100;let i=n+r;if(i>=1)return[t,0,n/i*100];let a=1-r;return[t,(a===0?0:1-n/a)*100,a*100]},formats:{hwb:{coords:[`<number> | <angle>`,`<percentage> | <number>`,`<percentage> | <number>`]}}}),c_=new Of({id:`a98rgb-linear`,cssId:`--a98-rgb-linear`,name:`Linear Adobe® 98 RGB compatible`,white:`D65`,M:{toXYZ:[[.5766690429101305,.1855582379065463,.1882286462349947],[.29734497525053605,.6273635662554661,.07529145849399788],[.02703136138641234,.07068885253582723,.9913375368376388]],fromXYZ:[[2.0415879038107465,-.5650069742788596,-.34473135077832956],[-.9692436362808795,1.8759675015077202,.04155505740717557],[.013444280632031142,-.11836239223101838,1.0151749943912054]]}}),l_=new Of({id:`a98rgb`,cssId:`a98-rgb`,name:`Adobe® 98 RGB compatible`,base:c_,linearGamut:c_,toBase:e=>e.map(e=>Math.abs(e)**(563/256)*Math.sign(e)),fromBase:e=>e.map(e=>Math.abs(e)**(256/563)*Math.sign(e))}),u_=new Of({id:`prophoto-linear`,cssId:`--prophoto-rgb-linear`,name:`Linear ProPhoto`,white:`D50`,base:kf,M:{toXYZ:[[.7977666449006423,.13518129740053308,.0313477341283922],[.2880748288194013,.711835234241873,8993693872564e-17],[0,0,.8251046025104602]],fromXYZ:[[1.3457868816471583,-.25557208737979464,-.05110186497554526],[-.5446307051249019,1.5082477428451468,.02052744743642139],[0,0,1.2119675456389452]]}}),d_=1/512,f_=16/512,p_=new Of({id:`prophoto`,cssId:`prophoto-rgb`,name:`ProPhoto`,base:u_,linearGamut:u_,toBase(e){return e.map(e=>{let t=e<0?-1:1,n=e*t;return n<f_?e/16:t*n**1.8})},fromBase(e){return e.map(e=>{let t=e<0?-1:1,n=e*t;return n>=d_?t*n**(1/1.8):16*e})}}),m_=1.09929682680944,h_=.018053968510807,g_=new Of({id:`--rec2020-oetf`,name:`REC.2020_Scene_Referred`,base:Xh,linearGamut:Xh,referred:`scene`,toBase(e){return e.map(function(e){let t=e<0?-1:1,n=e*t;return n<h_*4.5?e/4.5:t*((n+m_-1)/m_)**(1/.45)})},fromBase(e){return e.map(function(e){let t=e<0?-1:1,n=e*t;return n>=h_?t*(m_*n**.45-.09929682680944008):4.5*e})}}),__=new Kh({id:`oklch-p3`,cssId:`--oklch-p3`,name:`OKLCh P3`,base:Qf,gamutSpace:ag}),v_=new Kh({id:`oklch-srgb`,cssId:`--oklch-srgb`,name:`OKLCh sRGB`,base:Qf,gamutSpace:ig}),y_=new Kh({id:`oklch-rec2020`,cssId:`--oklch-rec2020`,name:`OKLCh Rec.2020`,base:Qf,gamutSpace:Zh}),b_=new Kh({id:`lch-p3`,cssId:`--lch-p3`,name:`LCH P3`,base:Lf,gamutSpace:ag}),x_=new Kh({id:`lch-srgb`,cssId:`--lch-srgb`,name:`LCH sRGB`,base:Lf,gamutSpace:ig}),S_=new Kh({id:`lch-rec2020`,cssId:`--lch-rec2020`,name:`LCH Rec.2020`,base:Lf,gamutSpace:Zh}),C_=2*Math.PI,w_={...Gf.M,toLMS:[[.4122214694707629,.5363325372617349,.0514459932675022],[.2119034958178251,.6806995506452344,.1073969535369405],[.0883024591900564,.2817188391361215,.6299787016738222]],toSRGBLinear:[[4.076741636075958,-3.307711539258063,.2309699031821043],[-1.2684379732850315,2.609757349287688,-.341319376002657],[-.0041960761386756,-.7034186179359362,1.7076146940746117]]},T_=[[[-1.8817031,-.80936501],[1.19086277,1.76576728,.59662641,.75515197,.56771245]],[[1.8144408,-1.19445267],[.73956515,-.45954404,.08285427,.12541073,-.14503204]],[[.13110758,1.81333971],[1.35733652,-.00915799,-1.1513021,-.50559606,.00692167]]],E_=Number.MAX_VALUE,D_=.206,O_=.03,k_=1.206/1.03;function A_(e,t){let n=e.length;if(n!==t.length)throw Error(`Vectors of size ${n} and ${t.length} are not aligned`);let r=0;return e.forEach((e,n)=>{r+=e*t[n]}),r}function j_(e){return .5*(k_*e-D_+Math.sqrt((k_*e-D_)*(k_*e-D_)+4*O_*k_*e))}function M_(e){return(e**2+D_*e)/(k_*(e+O_))}function N_(e){let[t,n]=e;return[n/t,n/(1-t)]}function P_(e,t){return[.11516993+1/(7.4477897+4.1590124*t+e*(-2.19557347+1.75198401*t+e*(-2.13704948-10.02301043*t+e*(-4.24894561+5.38770819*t+4.69891013*e)))),.11239642+1/(1.6132032-.68124379*t+e*(.40370612+.90148123*t+e*(-.27087943+.6122399*t+e*(.00299215-.45399568*t-.14661872*e))))]}function F_(e,t){let n=Vd(e,w_.LabtoLMS);return n[0]**=3,n[1]**=3,n[2]**=3,Vd(n,t,n)}function I_(e,t,n,r){let i=z_(e,t,n,r),a=F_([1,i*e,i*t],n),o=$d(1/Math.max(...a),1/3);return[o,o*i]}function L_(e,t,n,r,i,a,o,s){let c;if(s===void 0&&(s=I_(e,t,a,o)),(n-i)*s[1]-(s[0]-i)*r<=0)c=s[1]*i/(r*s[0]+s[1]*(i-n));else{c=s[1]*(i-1)/(r*(s[0]-1)+s[1]*(i-n));let o=n-i,l=r,u=A_(w_.LabtoLMS[0].slice(1),[e,t]),d=A_(w_.LabtoLMS[1].slice(1),[e,t]),f=A_(w_.LabtoLMS[2].slice(1),[e,t]),p=o+l*u,m=o+l*d,h=o+l*f,g=i*(1-c)+c*n,_=c*r,v=g+_*u,y=g+_*d,b=g+_*f,x=v**3,S=y**3,C=b**3,w=3*p*v**2,T=3*m*y**2,ee=3*h*b**2,E=6*p**2*v,D=6*m**2*y,te=6*h**2*b,ne=A_(a[0],[x,S,C])-1,re=A_(a[0],[w,T,ee]),ie=A_(a[0],[E,D,te]),ae=re/(re*re-.5*ne*ie),oe=-ne*ae,se=A_(a[1],[x,S,C])-1,ce=A_(a[1],[w,T,ee]),O=A_(a[1],[E,D,te]),le=ce/(ce*ce-.5*se*O),k=-se*le,ue=A_(a[2],[x,S,C])-1,A=A_(a[2],[w,T,ee]),j=A_(a[2],[E,D,te]),de=A/(A*A-.5*ue*j),fe=-ue*de;oe=ae>=0?oe:E_,k=le>=0?k:E_,fe=de>=0?fe:E_,c+=Math.min(oe,Math.min(k,fe))}return c}function R_(e,t,n){let[r,i,a]=e,o=I_(i,a,t,n),s=L_(i,a,r,1,r,t,n,o),c=N_(o),l=s/Math.min(r*c[0],(1-r)*c[1]),u=P_(i,a),d=r*u[0],f=(1-r)*u[1],p=.9*l*Math.sqrt(Math.sqrt(1/(1/d**4+1/f**4)));return d=r*.4,f=(1-r)*.8,[Math.sqrt(1/(1/d**2+1/f**2)),p,s]}function z_(e,t,n,r){let i,a,o,s,c,l,u,d;A_(r[0][0],[e,t])>1?([i,a,o,s,c]=r[0][1],[l,u,d]=n[0]):A_(r[1][0],[e,t])>1?([i,a,o,s,c]=r[1][1],[l,u,d]=n[1]):([i,a,o,s,c]=r[2][1],[l,u,d]=n[2]);let f=i+a*e+o*t+s*e**2+c*e*t,p=A_(w_.LabtoLMS[0].slice(1),[e,t]),m=A_(w_.LabtoLMS[1].slice(1),[e,t]),h=A_(w_.LabtoLMS[2].slice(1),[e,t]),g=1+f*p,_=1+f*m,v=1+f*h,y=g**3,b=_**3,x=v**3,S=3*p*g**2,C=3*m*_**2,w=3*h*v**2,T=6*p**2*g,ee=6*m**2*_,E=6*h**2*v,D=l*y+u*b+d*x,te=l*S+u*C+d*w,ne=l*T+u*ee+d*E;return f-=D*te/(te**2-.5*D*ne),f}function B_(e,t,n){let[r,i,a]=e,o=M_(a),s=null,c=null;if(r=Ff(r)/360,o!==0&&o!==1&&i!==0){let e=Math.cos(C_*r),a=Math.sin(C_*r),[l,u,d]=R_([o,e,a],t,n),f=.8,p,m,h,g;i<f?(p=1.25*i,m=0,h=f*l,g=1-h/u):(p=5*(i-.8),m=u,h=.2*u**2*1.25**2/l,g=1-h/(d-u));let _=m+p*h/(1-g*p);s=_*e,c=_*a}return[o,s,c]}function V_(e,t,n){let r=e[0],i=0,a=j_(r),o=Math.sqrt(e[1]**2+e[2]**2),s=.5+Math.atan2(-e[2],-e[1])/C_;if(a!==0&&a!==1&&o!==0){let[a,s,c]=R_([r,e[1]/o,e[2]/o],t,n),l=.8,u,d,f,p;o<s?(d=l*a,f=1-d/s,p=o/(d+f*o),i=p*l):(u=s,d=.2*s**2*1.25**2/a,f=1-d/(c-s),p=(o-u)/(d+f*(o-u)),i=l+.2*p)}let c=Math.abs(i)<1e-4;return c||a===0||Math.abs(1-a)<1e-7?(s=null,c||(i=0)):s=Ff(s*360),[s,i,a]}var H_=new V({id:`okhsl`,name:`Okhsl`,coords:{h:{refRange:[0,360],type:`angle`,name:`Hue`},s:{range:[0,1],name:`Saturation`},l:{range:[0,1],name:`Lightness`}},base:Gf,gamutSpace:`self`,M:w_,fromBase(e){return V_(e,w_.toSRGBLinear,T_)},toBase(e){return B_(e,w_.toSRGBLinear,T_)},formats:{color:{id:`--okhsl`,coords:[`<number> | <angle>`,`<percentage> | <number>`,`<percentage> | <number>`]}}});H_.rgbGamut=new Of({id:`okhsl-prism`,cssId:`--okhsl-prism`,name:`Okhsl Prism`,base:H_,fromBase(e){return r_.toBase([e[0],e[1]*100,e[2]*100])},toBase(e){let t=r_.fromBase(e);return t[1]/=100,t[2]/=100,t}});var U_=new V({id:`oklrab`,name:`Oklrab`,coords:{l:{refRange:[0,1],name:`Lightness`},a:{refRange:[-.4,.4]},b:{refRange:[-.4,.4]}},white:`D65`,base:Gf,fromBase(e){return[j_(e[0]),e[1],e[2]]},toBase(e){return[M_(e[0]),e[1],e[2]]},formats:{color:{coords:[`<percentage> | <number>`,`<number> | <percentage>[-1,1]`,`<number> | <percentage>[-1,1]`]}}}),W_=new V({id:`oklrch`,name:`Oklrch`,coords:{l:{refRange:[0,1],name:`Lightness`},c:{refRange:[0,.4],name:`Chroma`},h:{refRange:[0,360],type:`angle`,name:`Hue`}},white:`D65`,base:U_,fromBase:Lf.fromBase,toBase:Lf.toBase,formats:{color:{coords:[`<percentage> | <number>`,`<number> | <percentage>[0,1]`,`<number> | <angle>`]}}}),G_={toSRGBLinear:H_.M.toSRGBLinear};function K_(e,t,n){let[r,i,a]=e;r=Ff(r)/360;let o=M_(a),s=null,c=null;if(o!==0&&i!==0){let e=Math.cos(C_*r),l=Math.sin(C_*r),[u,d]=N_(I_(e,l,t,n)),f=.5,p=1-f/u,m=1-i*f/(f+d-d*p*i),h=i*d*f/(f+d-d*p*i);o=a*m;let g=a*h,_=M_(m),v=h*_/m,y=M_(o);g=g*y/o,o=y;let[b,x,S]=F_([_,e*v,l*v],t),C=$d(1/Math.max(Math.max(b,x),Math.max(S,0)),1/3);o*=C,g*=C,s=g*e,c=g*l}return[o,s,c]}function q_(e,t,n){let r=e[0],i=0,a=j_(r),o=Math.sqrt(e[1]**2+e[2]**2),s=.5+Math.atan2(-e[2],-e[1])/C_;if(r!==0&&r!==1&&o!==0){let s=e[1]/o,c=e[2]/o,[l,u]=N_(I_(s,c,t,n)),d=.5,f=1-d/l,p=u/(o+r*u),m=p*r,h=p*o,g=M_(m),_=h*g/m,[v,y,b]=F_([g,s*_,c*_],t),x=$d(1/Math.max(Math.max(v,y),Math.max(b,0)),1/3);r/=x,o/=x,o=o*j_(r)/r,r=j_(r),a=r/m,i=(d+u)*h/(u*d+u*f*h)}return s=Math.abs(i)<1e-4||a===0?null:Ff(s*360),[s,i,a]}var J_=new V({id:`okhsv`,name:`Okhsv`,coords:{h:{refRange:[0,360],type:`angle`,name:`Hue`},s:{range:[0,1],name:`Saturation`},v:{range:[0,1],name:`Value`}},base:Gf,gamutSpace:`self`,M:G_,fromBase(e){return q_(e,G_.toSRGBLinear,T_)},toBase(e){return K_(e,G_.toSRGBLinear,T_)},formats:{color:{id:`--okhsv`,coords:[`<number> | <angle>`,`<percentage> | <number>`,`<percentage> | <number>`]}}});J_.rgbGamut=new Of({id:`okhsv-prism`,cssId:`--okhsv-prism`,name:`Okhsv Prism`,base:J_,fromBase(e){return r_.toBase([e[0],e[1]*100,e[2]*100])},toBase(e){let t=r_.fromBase(e);return t[1]/=100,t[2]/=100,t}});var Y_=_f.D65,X_=216/24389,Z_=24389/27,[Q_,$_]=Ug({space:Df,coords:Y_}),ev=new V({id:`luv`,name:`Luv`,coords:{l:{refRange:[0,100],name:`Lightness`},u:{refRange:[-215,215]},v:{refRange:[-215,215]}},white:Y_,base:Df,fromBase(e){let t=[Kd(e[0]),Kd(e[1]),Kd(e[2])],n=t[1],[r,i]=Ug({space:Df,coords:t});if(!Number.isFinite(r)||!Number.isFinite(i))return[0,0,0];let a=n<=X_?Z_*n:116*Math.cbrt(n)-16;return[a,13*a*(r-Q_),13*a*(i-$_)]},toBase(e){let[t,n,r]=e;if(t===0||z(t))return[0,0,0];n=Kd(n),r=Kd(r);let i=n/(13*t)+Q_,a=r/(13*t)+$_,o=t<=8?t/Z_:((t+16)/116)**3;return[o*(9*i/(4*a)),o,o*((12-3*i-20*a)/(4*a))]},formats:{color:{id:`--luv`,coords:[`<number> | <percentage>`,`<number> | <percentage>`,`<number> | <percentage>`]}}}),tv=new V({id:`lchuv`,name:`LChuv`,coords:{l:{refRange:[0,100],name:`Lightness`},c:{refRange:[0,220],name:`Chroma`},h:{refRange:[0,360],type:`angle`,name:`Hue`}},base:ev,fromBase:Lf.fromBase,toBase:Lf.toBase,formats:{color:{id:`--lchuv`,coords:[`<number> | <percentage>`,`<number> | <percentage>`,`<number> | <angle>`]}}}),nv=216/24389,rv=24389/27,iv=$h.fromXYZ,av=iv[0][0],ov=iv[0][1],sv=iv[0][2],cv=iv[1][0],lv=iv[1][1],uv=iv[1][2],dv=iv[2][0],fv=iv[2][1],pv=iv[2][2];function mv(e,t,n){let r=t/(Math.sin(n)-e*Math.cos(n));return r<0?1/0:r}function hv(e){let t=(e+16)**3/1560896,n=t>nv?t:e/rv,r=n*(284517*av-94839*sv),i=n*(838422*sv+769860*ov+731718*av),a=n*(632260*sv-126452*ov),o=n*(284517*cv-94839*uv),s=n*(838422*uv+769860*lv+731718*cv),c=n*(632260*uv-126452*lv),l=n*(284517*dv-94839*pv),u=n*(838422*pv+769860*fv+731718*dv),d=n*(632260*pv-126452*fv);return{r0s:r/a,r0i:i*e/a,r1s:r/(a+126452),r1i:(i-769860)*e/(a+126452),g0s:o/c,g0i:s*e/c,g1s:o/(c+126452),g1i:(s-769860)*e/(c+126452),b0s:l/d,b0i:u*e/d,b1s:l/(d+126452),b1i:(u-769860)*e/(d+126452)}}function gv(e,t){let n=t/360*Math.PI*2,r=mv(e.r0s,e.r0i,n),i=mv(e.r1s,e.r1i,n),a=mv(e.g0s,e.g0i,n),o=mv(e.g1s,e.g1i,n),s=mv(e.b0s,e.b0i,n),c=mv(e.b1s,e.b1i,n);return Math.min(r,i,a,o,s,c)}var _v=new V({id:`hsluv`,name:`HSLuv`,coords:{h:{refRange:[0,360],type:`angle`,name:`Hue`},s:{range:[0,100],name:`Saturation`},l:{range:[0,100],name:`Lightness`}},base:tv,gamutSpace:ig,rgbGamut:ig,fromBase(e){let[t,n,r]=[Kd(e[0]),Kd(e[1]),Kd(e[2])],i;return t>99.9999999?(i=0,t=100):t<1e-8?(i=0,t=0):i=n/gv(hv(t),r)*100,[r,i,t]},toBase(e){let[t,n,r]=[Kd(e[0]),Kd(e[1]),Kd(e[2])],i;return r>99.9999999?(r=100,i=0):r<1e-8?(r=0,i=0):i=gv(hv(r),t)/100*n,[r,i,t]},formats:{color:{id:`--hsluv`,coords:[`<number> | <angle>`,`<percentage> | <number>`,`<percentage> | <number>`]}}}),vv=$h.fromXYZ;vv[0][0],vv[0][1],vv[0][2],vv[1][0],vv[1][1],vv[1][2],vv[2][0],vv[2][1],vv[2][2];function yv(e,t){return Math.abs(t)/Math.sqrt(e**2+1)}function bv(e){let t=yv(e.r0s,e.r0i),n=yv(e.r1s,e.r1i),r=yv(e.g0s,e.g0i),i=yv(e.g1s,e.g1i),a=yv(e.b0s,e.b0i),o=yv(e.b1s,e.b1i);return Math.min(t,n,r,i,a,o)}var xv=new V({id:`hpluv`,name:`HPLuv`,coords:{h:{refRange:[0,360],type:`angle`,name:`Hue`},s:{range:[0,100],name:`Saturation`},l:{range:[0,100],name:`Lightness`}},base:tv,gamutSpace:`self`,fromBase(e){let[t,n,r]=[Kd(e[0]),Kd(e[1]),Kd(e[2])],i;return t>99.9999999?(i=0,t=100):t<1e-8?(i=0,t=0):i=n/bv(hv(t))*100,[r,i,t]},toBase(e){let[t,n,r]=[Kd(e[0]),Kd(e[1]),Kd(e[2])],i;return r>99.9999999?(r=100,i=0):r<1e-8?(r=0,i=0):i=bv(hv(r))/100*n,[r,i,t]},formats:{color:{id:`--hpluv`,coords:[`<number> | <angle>`,`<percentage> | <number>`,`<percentage> | <number>`]}}});xv.rgbGamut=new Of({id:`hpluv-prism`,cssId:`--hpluv-prism`,name:`HPLuv Prism`,base:xv,fromBase(e){return r_.toBase(e)},toBase(e){return r_.fromBase(e)}});var Sv=.021,Cv=Math.sqrt(Sv/3),wv=Cv*Cv*Cv,Tv=.978,Ev=.058,Dv=264.5*Math.PI/180,Ov=.7,kv=.37,Av={M1:[[.8154832155941288,.36033406153856506,-.12434135574228214],[.03301008352745078,.9292865057066169,.03612192716575443],[.04818827356456861,.2642841575338424,.6334971784195534]],M1_INV:[[1.2325947975032656,-.5557590239287523,.2736201534771583],[-.040801327874216024,1.112228863738653,-.07142753586443781],[-.07673825928337766,-.42172784577108585,1.5875238558143416]],M2:[[.21193779684470104,.7992121834263127,-.00410075161564345],[2.4672018828033475,-2.9877348024830788,.520532919679731],[-.11390787868068575,1.3932982808117473,-1.279390402131062]],M2_INV:[[.9930001151336143,.32599327253052285,.1294508563171392],[.9930001151336139,-.08708353111074627,-.03861361743004929],[.9930001151336136,-.12386097008215022,-.8351991365871061]]},jv=[0,.05,.1,.15,.2,.25,.3,.35,.4,.45,.5,.55,.6,.65,.7,.75,.8,.85,.9,.95,1],Mv=[0,.009494013522189627,.02564569838030986,.055259661658689105,.10574901531227408,.16055853320726027,.21405964892993756,.26786230508811226,.3220435246104499,.3739052098520243,.43020997780918835,.4835465162128873,.5399824670411353,.5956710081330342,.6542161666450478,.7115380216519989,.7702762412711669,.8293313467712837,.889406386197059,.9462829573474728,1],Nv=jv.length;function Pv(e){let t=e/(2*wv),n=2*Cv*Math.sinh(Math.asinh(t)/3),r=n*n*n+Sv*n-e,i=3*n*n+Sv,a=6*n,o=2*i*i-r*a;return Math.abs(o)>1e-30&&(n-=2*r*i/o),n}function Fv(e){return e*e*e+Sv*e}function Iv(e){let t=Math.max(0,Math.min(1,(e-kv)/.63));return Math.sin(Math.PI*t)**2}function Lv(e,t,n){let r=Math.sqrt(t*t+n*n);if(r<1e-12)return[t,n];let i=Iv(e);if(i<1e-12)return[t,n];let a=Math.atan2(n,t),o=a-Dv;o-=Math.round(o/(2*Math.PI))*2*Math.PI;let s=Math.exp(-.5*(o/Ov)**2),c=a+Ev*i*s;return[r*Math.cos(c),r*Math.sin(c)]}function Rv(e,t,n){let r=Math.sqrt(t*t+n*n);if(r<1e-12)return[t,n];let i=Iv(e);if(i<1e-12)return[t,n];let a=Math.atan2(n,t),o=Ov*Ov,s=Ev*i,c=a;for(let e=0;e<8;e++){let e=c-Dv;e-=Math.round(e/(2*Math.PI))*2*Math.PI;let t=Math.exp(-.5*e*e/o),n=c+s*t-a,r=1+s*t*(-e/o),i=s*t*(-1/o+e*e/(o*o)),l=2*r*r-n*i;Math.abs(l)>1e-30&&(c-=2*n*r/l)}return[r*Math.cos(c),r*Math.sin(c)]}function zv(e){if(e<=0||e>=1)return e;let t=0,n=Nv-1;for(;n-t>1;){let r=t+n>>1;jv[r]<=e?t=r:n=r}let r=(e-jv[t])/(jv[n]-jv[t]);return Mv[t]+r*(Mv[n]-Mv[t])}function Bv(e){if(e<=Mv[0]||e>=Mv[Nv-1])return e;let t=0,n=Nv-1;for(;n-t>1;){let r=t+n>>1;Mv[r]<=e?t=r:n=r}let r=(e-Mv[t])/(Mv[n]-Mv[t]);return jv[t]+r*(jv[n]-jv[t])}var Vv=new V({id:`helmgen`,name:`HelmGen`,cssId:`--helmgen`,coords:{l:{refRange:[0,1],name:`Lightness`},a:{refRange:[-.6,.6]},b:{refRange:[-.6,.6]}},white:`D65`,base:Df,M:Av,fromBase(e){let t=Vd(e,Av.M1),n=Pv(Math.max(t[0],0)),r=Pv(Math.max(t[1],0)),i=Pv(Math.max(t[2],0));{let e=(n+r+i)/3,t=(Math.max(n,r,i)-Math.min(n,r,i))/Math.max(Math.abs(e),1e-30),a=Math.exp(-((t/1e-5)**2));n+=a*(e-n),r+=a*(e-r),i+=a*(e-i)}let[a,o,s]=Vd([n,r,i],Av.M2);{let e=Math.sqrt(o*o+s*s);if(e>1e-12){let t=e**+Tv/e;o*=t,s*=t}}return a=zv(a),[o,s]=Lv(a,o,s),[a,o,s]},toBase(e){let[t,n,r]=e;[n,r]=Rv(t,n,r),t=Bv(t);{let e=Math.sqrt(n*n+r*r);if(e>1e-12){let t=e**(1/Tv)/e;n*=t,r*=t}}let[i,a,o]=Vd([t,n,r],Av.M2_INV);{let e=(i+a+o)/3,t=(Math.max(i,a,o)-Math.min(i,a,o))/Math.max(Math.abs(e),1e-30),n=Math.exp(-((t/1e-5)**2));i+=n*(e-i),a+=n*(e-a),o+=n*(e-o)}return Vd([Fv(i),Fv(a),Fv(o)],Av.M1_INV)}}),Hv=new V({id:`helmgenlch`,name:`HelmGenLCh`,cssId:`--helmgenlch`,coords:{l:{refRange:[0,1],name:`Lightness`},c:{refRange:[0,.65],name:`Chroma`},h:{refRange:[0,360],type:`angle`,name:`Hue`}},white:`D65`,base:Vv,fromBase:Lf.fromBase,toBase:Lf.toBase}),Uv=new Of({id:`rec2100-linear`,name:`Linear REC.2100`,white:`D65`,M:Yh}),Wv=203,Gv=2610/2**14,Kv=2**14/2610,qv=2523/32,Jv=32/2523,Yv=3424/4096,Xv=2413/128,Zv=2392/128,Qv=new Of({id:`rec2100pq`,cssId:`rec2100-pq`,name:`REC.2100-PQ`,base:Uv,linearGamut:Uv,toBase(e){return e.map(function(e){return(Math.max(e**Jv-Yv,0)/(Xv-Zv*e**Jv))**Kv*1e4/Wv})},fromBase(e){return e.map(function(e){let t=Math.max(e*Wv/1e4,0);return((Yv+Xv*t**Gv)/(1+Zv*t**Gv))**qv})}}),$v=.17883277,ey=.28466892,ty=.55991073,ny=3.7743,ry=new Of({id:`rec2100hlg`,cssId:`rec2100-hlg`,name:`REC.2100-HLG`,referred:`scene`,base:Uv,linearGamut:Uv,toBase(e){return e.map(function(e){return e<=.5?e**2/3*ny:(Math.exp((e-ty)/$v)+ey)/12*ny})},fromBase(e){return e.map(function(e){return e/=ny,e<=1/12?$d(3*e,.5):$v*Math.log(12*e-ey)+ty})}}),iy={};ff.add(`chromatic-adaptation-start`,e=>{e.options.method&&(e.M=oy(e.W1,e.W2,e.options.method))}),ff.add(`chromatic-adaptation-end`,e=>{e.M||=oy(e.W1,e.W2,e.options.method)});function ay({id:e,toCone_M:t,fromCone_M:n}){iy[e]=arguments[0]}function oy(e,t,n=`Bradford`){let r=iy[n],[i,a,o]=zd(r.toCone_M,e),[s,c,l]=zd(r.toCone_M,t),u=zd([[s/i,0,0],[0,c/a,0],[0,0,l/o]],r.toCone_M);return zd(r.fromCone_M,u)}ay({id:`von Kries`,toCone_M:[[.40024,.7076,-.08081],[-.2263,1.16532,.0457],[0,0,.91822]],fromCone_M:[[1.8599363874558397,-1.1293816185800916,.21989740959619328],[.3611914362417676,.6388124632850422,-6370596838649899e-21],[0,0,1.0890636230968613]]}),ay({id:`Bradford`,toCone_M:[[.8951,.2664,-.1614],[-.7502,1.7135,.0367],[.0389,-.0685,1.0296]],fromCone_M:[[.9869929054667121,-.14705425642099013,.15996265166373122],[.4323052697233945,.5183602715367774,.049291228212855594],[-.00852866457517732,.04004282165408486,.96848669578755]]}),ay({id:`CAT02`,toCone_M:[[.7328,.4296,-.1624],[-.7036,1.6975,.0061],[.003,.0136,.9834]],fromCone_M:[[1.0961238208355142,-.27886900021828726,.18274517938277307],[.4543690419753592,.4735331543074117,.07209780371722911],[-.009627608738429355,-.00569803121611342,1.0153256399545427]]}),ay({id:`CAT16`,toCone_M:[[.401288,.650173,-.051461],[-.250268,1.204414,.045854],[-.002079,.048952,.953127]],fromCone_M:[[1.862067855087233,-1.0112546305316845,.14918677544445172],[.3875265432361372,.6214474419314753,-.008973985167612521],[-.01584149884933386,-.03412293802851557,1.0499644368778496]]}),Object.assign(_f,{A:[1.0985,1,.35585],C:[.98074,1,1.18232],D55:[.95682,1,.92149],D75:[.94972,1,1.22638],E:[1,1,1],F2:[.99186,1,.67393],F7:[.95041,1,1.08747],F11:[1.00962,1,.6435]}),_f.ACES=[.32168/.33767,1,.34065/.33767];var sy=new Of({id:`acescg`,cssId:`--acescg`,name:`ACEScg`,coords:{r:{range:[0,65504],name:`Red`},g:{range:[0,65504],name:`Green`},b:{range:[0,65504],name:`Blue`}},referred:`scene`,white:_f.ACES,M:{toXYZ:[[.6624541811085053,.13400420645643313,.1561876870049078],[.27222871678091454,.6740817658111484,.05368951740793705],[-.005574649490394108,.004060733528982826,1.0103391003129971]],fromXYZ:[[1.6410233796943257,-.32480329418479,-.23642469523761225],[-.6636628587229829,1.6153315916573379,.016756347685530137],[.011721894328375376,-.008284441996237409,.9883948585390215]]}}),cy=2**-16,ly=-.35828683,uy=(Math.log2(65504)+9.72)/17.52,dy=new Of({id:`acescc`,cssId:`--acescc`,name:`ACEScc`,coords:{r:{range:[ly,uy],name:`Red`},g:{range:[ly,uy],name:`Green`},b:{range:[ly,uy],name:`Blue`}},referred:`scene`,base:sy,linearGamut:sy,toBase(e){return e.map(function(e){return e<=-.3013698630136986?(2**(e*17.52-9.72)-cy)*2:e<uy?2**(e*17.52-9.72):65504})},fromBase(e){return e.map(function(e){return e<=0?(Math.log2(cy)+9.72)/17.52:e<cy?(Math.log2(cy+e*.5)+9.72)/17.52:(Math.log2(e)+9.72)/17.52})}}),fy=t({A98RGB:()=>l_,A98RGB_Linear:()=>c_,ACEScc:()=>dy,ACEScg:()=>sy,CAM16_JMh:()=>$p,HCT:()=>cm,HPLuv:()=>xv,HSL:()=>r_,HSL_P3:()=>i_,HSL_REC2020:()=>a_,HSLuv:()=>_v,HSV:()=>o_,HWB:()=>s_,HelmGen:()=>Vv,HelmGenLCh:()=>Hv,Helmlab:()=>Ph,ICTCP:()=>jp,JzCzHz:()=>xp,Jzazbz:()=>bp,LCH:()=>Lf,LCH_P3:()=>b_,LCH_REC_2020:()=>S_,LCH_sRGB:()=>x_,LCHuv:()=>tv,Lab:()=>Pf,Lab_D65:()=>Lg,Luv:()=>ev,OKLCH:()=>Qf,OKLCH_P3:()=>__,OKLCH_REC_2020:()=>y_,OKLCH_sRGB:()=>v_,OKLab:()=>Gf,OKLrCH:()=>W_,OKLrab:()=>U_,Okhsl:()=>H_,Okhsv:()=>J_,P3:()=>ag,P3_Linear:()=>Qh,ProPhoto:()=>p_,ProPhoto_Linear:()=>u_,REC_2020:()=>Zh,REC_2020_Linear:()=>Xh,REC_2020_Scene_Referred:()=>g_,REC_2100_HLG:()=>ry,REC_2100_Linear:()=>Uv,REC_2100_PQ:()=>Qv,XYZ_ABS_D65:()=>sp,XYZ_D50:()=>kf,XYZ_D65:()=>Df,sRGB:()=>ig,sRGB_Linear:()=>eg}),py=class e{constructor(...e){let t;if(e.length===1){let n={};typeof e[0]==`object`&&Object.getPrototypeOf(e[0]).constructor===Object&&(e[0]={...e[0]}),t=B(e[0],{parseMeta:n}),n.format&&(this.parseMeta=n)}let n,r,i;t?(n=t.space||t.spaceId,r=t.coords,i=t.alpha):[n,r,i]=e,Object.defineProperty(this,"space",{value:V.get(n),writable:!1,enumerable:!0,configurable:!0}),this.coords=r?r.slice():[0,0,0],this.alpha=z(i)?i:i===void 0?1:Zd(0,i,1);for(let e in this.space.coords)Object.defineProperty(this,e,{get:()=>this.get(e),set:t=>this.set(e,t)})}get spaceId(){return this.space.id}clone(){return new e(this.space,this.coords,this.alpha)}toJSON(){return{spaceId:this.spaceId,coords:this.coords,alpha:this.alpha}}display(...t){let n=og(this,...t);return n.color=new e(n.color),n}static get(t,...n){return nf(t,this)?t:new e(t,...n)}static try(t,n){if(nf(t,this))return t;let r=qh(t,n);return r?new e(r):null}static defineFunction(t,n,r=n){let{instance:i=!0,returns:a}=r,o=function(...t){let r=n(...t);if(a===`color`)r=e.get(r);else if(a===`function<color>`){let t=r;r=function(...n){let r=t(...n);return e.get(r)},Object.assign(r,t)}else a===`array<color>`&&(r=r.map(t=>e.get(t)));return r};t in e||(e[t]=o),i&&(e.prototype[t]=function(...e){return o(this,...e)})}static defineFunctions(t){for(let n in t)e.defineFunction(n,t[n],t[n])}static extend(t){if(t.register)t.register(e);else for(let n in t)e.defineFunction(n,t[n])}};py.defineFunctions({get:Zf,getAll:Xf,set:ep,setAll:$f,to:Yf,equals:lg,inGamut:Jf,toGamut:Wh,distance:np,deltas:sg,toString:Jh}),Object.assign(py,{util:Hd,hooks:ff,WHITES:_f,Space:V,spaces:V.registry,parse:bf,defaults:pf});for(let e of Object.keys(fy))V.register(fy[e]);for(let e in V.registry)my(e,V.registry[e]);ff.add(`colorspace-init-end`,e=>{my(e.id,e),e.aliases?.forEach(t=>{my(t,e)})});function my(e,t){let n=e.replace(/-/g,`_`);Object.defineProperty(py.prototype,n,{get(){let n=this.getAll(e);if(typeof Proxy>`u`)return n;let r=new Proxy(n,{has:(e,n)=>{try{return V.resolveCoord([t,n]),!0}catch{}return Reflect.has(e,n)},get:(e,n,i)=>{if(n&&typeof n!=`symbol`&&!(n in e)&&n in r){let{index:r}=V.resolveCoord([t,n]);if(r>=0)return e[r]}return Reflect.get(e,n,i)},set:(n,r,i,a)=>{if(r&&typeof r!=`symbol`&&!(r in n)||Number(r)>=0){let{index:a}=V.resolveCoord([t,r]);if(a>=0)return n[a]=i,this.setAll(e,n),!0}return Reflect.set(n,r,i,a)}});return r},set(t){this.setAll(e,t)},configurable:!0,enumerable:!0})}py.extend(Hh),py.extend({deltaE:Kg}),Object.assign(py,{deltaEMethods:Hh}),py.extend(qg),py.extend({contrast:Vg}),py.extend(Hg),py.extend(ug),py.extend(Xg),py.extend(Bg);var hy=py;function gy(e,t=1,n=!1){return`hsla(${e}, ${n?50:65}%, ${n?60:40}%, ${t})`}function _y(e,t=1,n=!1){let r=0;for(let t=0;t<e.length;t++)r=e.charCodeAt(t)+((r<<5)-r);return gy((r%360+360)%360,t,n)}var vy=new Map;function yy(e,t,n){return new hy(`oklch`,[e,t,n]).to(`srgb`).toGamut({space:`srgb`}).toString({format:`hex`,collapse:!1})}function by(e,t=!1){let n=`${e}|${t?`d`:`l`}`,r=vy.get(n);if(r)return r;let[,i,a]=new hy(e).to(`oklch`).coords,o=a==null||!Number.isFinite(a)?0:a,s=Math.min(i==null||!Number.isFinite(i)?0:i,.18),c=t?{color:yy(.8,s,o),background:yy(.22,s*.5,o),borderColor:yy(.38,s*.7,o)}:{color:yy(.42,s,o),background:yy(.94,s*.35,o),borderColor:yy(.82,s*.5,o)};return vy.set(n,c),c}var xy=[`vite-plugin-`,`rollup-plugin-`,`webpack-plugin-`,`unplugin-`,`nuxt-`,`eslint-plugin-`,`postcss-`,`vite:`,`rollup:`,`rolldown:`,`webpack:`,`__`];function Sy(e){let t=e.map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)).join(`|`);return RegExp(`^(?:@[^/]+\\/)?(?:${t})`)}Sy(xy);function Cy(e,t){let[n,r,i]=new hy(e).to(`srgb`).coords.map(e=>Math.round(Math.max(0,Math.min(1,e??0))*255));return`rgba(${n}, ${r}, ${i}, ${t})`}var wy=[`src`,`alt`],Ty=F({__name:`DisplaySafeImage`,props:{src:{},alt:{},fit:{},preload:{type:Boolean}},setup(e){let t=e,n=Ne(!1),r=Ne(!t.preload);return Nt(()=>t.src,e=>{if(n.value=!1,!t.preload||!e){r.value=!t.preload;return}r.value=!1;let i=new Image;i.onload=()=>r.value=!0,i.onerror=()=>n.value=!0,i.src=e},{immediate:!0}),(t,i)=>e.src&&!n.value&&r.value?(L(),T(`img`,{key:0,src:e.src,alt:e.alt,class:Oe([`block`,e.fit&&`object-${e.fit}`]),onError:i[0]||=e=>n.value=!0},null,42,wy)):k(t.$slots,`fallback`,{},void 0,void 0,1)}}),Ey=F({__name:`DisplayAvatar`,props:{src:{},name:{},size:{default:32},square:{type:Boolean},colorScheme:{}},setup(e){let t=e,n=Rd(()=>t.colorScheme),r=P(()=>n.value===`dark`),i=P(()=>(t.name??``).split(/[\s/-]+/).filter(Boolean).slice(0,2).map(e=>e[0].toUpperCase()).join(``)),a=P(()=>({background:_y(t.name??``,.18,r.value),color:_y(t.name??``,1,r.value)}));return(t,n)=>(L(),T(`span`,{class:Oe([`text-xs font-medium inline-flex shrink-0 select-none items-center justify-center overflow-hidden`,e.square?`rounded-md`:`rounded-full`]),style:Ae({width:`${e.size}px`,height:`${e.size}px`})},[N(Ty,{src:e.src,alt:e.name},{fallback:I(()=>[D(`span`,{class:`inline-flex h-full w-full items-center justify-center`,style:Ae(a.value)},b(i.value),5)]),_:1},8,[`src`,`alt`])],6))}}),Dy=F({__name:`DisplayBadge`,props:{text:{},color:{type:[Boolean,Number,String],default:!0},variant:{default:`subtle`},icon:{},as:{},colorScheme:{},rounded:{default:`md`},paddingX:{default:.5},paddingY:{default:.25}},setup(e){let t=e;function n(e){return/^#|^hsl|^rgb|^var\(/.test(e)}let r=Rd(()=>t.colorScheme),i=P(()=>r.value===`dark`),a=P(()=>typeof t.color==`string`&&!n(t.color)),o=P(()=>{let{color:e,text:r}=t;if(typeof e==`number`)return gy(e,1,i.value);if(typeof e==`string`&&n(e))return e;if(e===!0&&r)return _y(r,1,i.value)}),s=P(()=>{let{color:e,text:r}=t;if(typeof e==`number`)return gy(e,t.variant===`solid`?1:.12,i.value);if(typeof e==`string`&&n(e))return t.variant===`solid`?e:Cy(e,.12);if(e===!0&&r)return _y(r,t.variant===`solid`?1:.12,i.value)}),c=P(()=>{let{color:e,text:r}=t;if(typeof e==`number`)return gy(e,.2,i.value);if(typeof e==`string`&&n(e))return t.variant===`solid`?e:Cy(e,.2);if(e===!0&&r)return _y(r,.2,i.value)}),l=P(()=>{let e={padding:`${t.paddingY}em ${t.paddingX}em`,...typeof t.rounded==`number`?{borderRadius:`${t.rounded}em`}:{}};return o.value?t.variant===`solid`?{...e,color:`#fff`,background:s.value,border:`1px solid ${s.value}`}:a.value?{...e,color:o.value,background:s.value}:{...e,color:o.value,background:s.value,border:`1px solid ${c.value}`}:e}),u=P(()=>a.value?`badge-color-${t.color}`:t.color===!1?`bg-#8881 color-muted`:``),d=P(()=>typeof t.rounded==`number`?``:t.rounded===`full`?`rounded-full`:`rounded-md`);return(t,n)=>(L(),Me(We(e.as||`span`),{class:Oe([`leading-none font-medium inline-flex gap-1 items-center`,[d.value,u.value]]),style:Ae(l.value)},{default:I(()=>[e.icon?(L(),T(`span`,{key:0,class:Oe(e.icon),"aria-hidden":`true`},null,2)):Ie(``,!0),k(t.$slots,`default`,{},()=>[Ge(b(e.text),1)])]),_:3},8,[`class`,`style`]))}});function Oy(e,t){return s()?(Te(e,t),!0):!1}var ky=typeof window<`u`&&typeof document<`u`;typeof WorkerGlobalScope<`u`&&globalThis instanceof WorkerGlobalScope;function Ay(e,t=1e3,n={}){let{immediate:r=!0,immediateCallback:i=!1}=n,a=null,o=le(!1);function s(){a&&=(clearInterval(a),null)}function c(){o.value=!1,s()}function l(){let n=Ke(t);n<=0||(o.value=!0,i&&e(),s(),o.value&&(a=setInterval(e,n)))}return r&&ky&&l(),(C(t)||typeof t==`function`)&&Oy(Nt(t,()=>{o.value&&ky&&l()})),Oy(c),{isActive:ee(o),pause:c,resume:l}}var jy={neutral:`color-scale-neutral`,low:`color-scale-low`,medium:`color-scale-medium`,high:`color-scale-high`,critical:`color-scale-critical`};function My(e,t){for(let[n,r]of t)if(e<=n)return r;return t.at(-1)?.[1]??jy.neutral}var Ny=`en-US`;function Py(e,t,n){return new Intl.NumberFormat(n??Ny,t).format(e)}var Fy=1024,Iy=1024*Fy;80*Fy,jy.neutral,500*Fy,jy.low,jy.medium,10*Iy,jy.high,jy.critical,jy.neutral,jy.low,jy.medium,jy.high,jy.critical;var Ly=1e3,Ry=60*Ly,zy=60*Ry,By=24*zy,Vy=30*By,Hy=365*By,Uy=[[Ry,Ly,`s`],[zy,Ry,`min`],[By,zy,`h`],[Vy,By,`d`],[Hy,Vy,`mo`],[1/0,Hy,`y`]];function Wy(e,t=Date.now()){let n=t-(e instanceof Date?e.getTime():e),r=Math.abs(n);if(r<Ly)return`just now`;for(let[e,t,i]of Uy)if(r<e){let e=Math.round(r/t);return n>=0?`${e} ${i} ago`:`in ${e} ${i}`}return``}var Gy=[[180*By,jy.neutral],[365*By,jy.low],[3*Hy,jy.medium],[5*Hy,jy.high],[1/0,jy.critical]];function Ky(e,t=Gy){return My(e,t)}function qy(e,t,n){return new Intl.DateTimeFormat(n??Ny,t??{dateStyle:`medium`,timeStyle:`short`}).format(e)}var Jy=[`datetime`],Yy=F({__name:`DisplayDate`,props:{date:{},colorize:{type:Boolean},scale:{},live:{type:Boolean},interval:{default:3e4}},setup(e){let t=e,n=Ne(Date.now());Ay(()=>{t.live&&(n.value=Date.now())},Ue(t,`interval`)),Nt(()=>t.date,()=>{t.live&&(n.value=Date.now())});let r=P(()=>new Date(t.date).getTime()),a=P(()=>Wy(r.value,t.live?n.value:Date.now())),o=P(()=>qy(r.value)),s=P(()=>t.colorize?Ky(Math.abs(n.value-r.value),t.scale):``);return(e,t)=>$e((L(),T(`time`,{datetime:new Date(r.value).toISOString(),class:Oe(s.value)},[k(e.$slots,`default`,{relative:a.value,exact:o.value},()=>[Ge(b(a.value),1)])],10,Jy)),[[i(ts),o.value]])}}),Xy={class:`flex flex-col gap-1`},Zy=[`for`],Qy={key:0,class:`text-red-500`,"aria-hidden":`true`},$y={key:1,class:`text-sm color-faint`},eb={key:2,role:`alert`,class:`text-sm text-red-600 dark:text-red-400`},tb=F({__name:`FormField`,props:{label:{},description:{},error:{},required:{type:Boolean},id:{}},setup(e){return(t,n)=>(L(),T(`div`,Xy,[e.label||t.$slots.label?(L(),T(`label`,{key:0,for:e.id,class:`text-sm color-base font-medium`},[k(t.$slots,`label`,{},()=>[Ge(b(e.label),1),e.required?(L(),T(`span`,Qy,`\xA0*`)):Ie(``,!0)])],8,Zy)):Ie(``,!0),k(t.$slots,`default`),e.description||t.$slots.description?(L(),T(`p`,$y,[k(t.$slots,`description`,{},()=>[Ge(b(e.description),1)])])):Ie(``,!0),e.error||t.$slots.error?(L(),T(`p`,eb,[k(t.$slots,`error`,{},()=>[Ge(b(e.error),1)])])):Ie(``,!0)]))}}),nb=[`type`,`placeholder`,`disabled`,`aria-invalid`],rb=F({__name:`FormTextInput`,props:Qt({icon:{},clearable:{type:Boolean},placeholder:{},type:{default:`text`},size:{default:`md`},disabled:{type:Boolean},invalid:{type:Boolean}},{modelValue:{default:``},modelModifiers:{}}),emits:[`update:modelValue`],setup(e){let t=jt(e,`modelValue`);return(n,r)=>(L(),T(`label`,{class:Oe([`px-2 border rounded bg-raised inline-flex gap-2 transition items-center focus-within:ring-2`,[e.size===`sm`?`h-7 text-sm`:`h-9`,e.invalid?`border-red-500/60 focus-within:ring-red-500/40`:`border-base focus-within:ring-primary-500/40`,{"op50 pointer-events-none":e.disabled}]])},[e.icon?(L(),T(`span`,{key:0,class:Oe([e.icon,`op-fade shrink-0`]),"aria-hidden":`true`},null,2)):Ie(``,!0),k(n.$slots,`prefix`),$e(D(`input`,{"onUpdate:modelValue":r[0]||=e=>t.value=e,type:e.type,placeholder:e.placeholder,disabled:e.disabled,"aria-invalid":e.invalid||void 0,class:`color-base outline-none bg-transparent flex-1 min-w-0 placeholder:op-mute`},null,8,nb),[[yn,t.value]]),e.clearable&&t.value?(L(),T(`button`,{key:1,type:`button`,class:`op-fade shrink-0 transition hover:op100`,"aria-label":`Clear`,onClick:r[1]||=e=>t.value=``},[...r[2]||=[D(`span`,{class:`i-ph:x`,"aria-hidden":`true`},null,-1)]])):Ie(``,!0),k(n.$slots,`suffix`)],2))}}),ib={class:`flex items-center gap-1 pb1`},ab={class:`flex items-center gap-2`},ob={href:`https://github.com/settings/tokens/new?description=pulls.review&scopes=repo`,target:`_blank`,rel:`noopener`,class:`text-primary hover:underline`},sb={class:`flex items-center gap-1`},cb={class:`flex flex-col gap-2 border border-base rounded bg-raised p-3`},lb={key:0,class:`flex items-start gap-3`},ub={class:`min-w-0 flex flex-1 flex-col gap-1.5`},db={class:`flex items-baseline gap-2`},fb={class:`truncate text-sm color-base font-medium`},pb={key:0,class:`truncate text-xs color-faint`},mb={class:`flex flex-wrap items-center gap-1`},hb={key:0,class:`text-xs color-faint`},gb={class:`flex flex-wrap items-center gap-x-3 gap-y-1 text-xs color-faint`},_b={key:0},vb={key:1},yb={key:1,class:`flex items-center gap-2 text-sm color-faint`},bb={class:`flex-1 text-red-600 dark:text-red-400`},xb=F({__name:`GithubTokenSettings`,props:{tokenSet:{type:Boolean},meta:{},busy:{type:Boolean},error:{}},emits:[`save`],setup(e,{emit:t}){let n=e,r=t,i=Ne(!1),a=Ne(``);Nt(()=>n.busy,(e,t)=>{t&&!e&&!n.error&&(i.value=!1,a.value=``)});function o(){i.value=!1,a.value=``}function s(){r(`save`,``),o()}return(t,n)=>{let c=Lt(`i18n-t`);return!e.tokenSet||i.value?(L(),Me(tb,{key:0,error:e.error},{label:I(()=>[D(`div`,ib,[n[5]||=D(`div`,{class:`i-carbon-logo-github text-lg`},null,-1),Ge(` `+b(t.$t(`settings.token.label`)),1)])]),description:I(()=>[Ge(b(t.$t(`settings.token.optional`)),1),n[8]||=D(`br`,null,null,-1),N(c,{keypath:`settings.token.scopes`,scope:`global`},{repo:I(()=>[...n[6]||=[D(`code`,{class:`rounded bg-sunken px1 font-medium`},`repo`,-1)]]),fineGrained:I(()=>[...n[7]||=[D(`code`,{class:`rounded bg-sunken px1 font-medium`},`Pull requests: Read and write`,-1)]]),_:1}),n[9]||=D(`br`,null,null,-1),Ge(` `+b(t.$t(`settings.token.storedLocally`))+` `,1),n[10]||=D(`br`,null,null,-1),D(`a`,ob,b(t.$t(`settings.token.generate`)),1)]),default:I(()=>[D(`div`,ab,[N(rb,{modelValue:a.value,"onUpdate:modelValue":n[0]||=e=>a.value=e,type:`password`,icon:`i-ph-key-duotone`,placeholder:`ghp_…`,class:`flex-1`,disabled:e.busy,invalid:!!e.error,onKeyup:n[1]||=nn(e=>a.value&&r(`save`,a.value),[`enter`])},null,8,[`modelValue`,`disabled`,`invalid`]),N(Bn,{loading:e.busy,disabled:!a.value,onClick:n[2]||=e=>r(`save`,a.value)},{default:I(()=>[Ge(b(t.$t(`common.save`)),1)]),_:1},8,[`loading`,`disabled`]),i.value?(L(),Me(Bn,{key:0,variant:`text`,disabled:e.busy,onClick:o},{default:I(()=>[Ge(b(t.$t(`common.cancel`)),1)]),_:1},8,[`disabled`])):Ie(``,!0),i.value?(L(),Me(Bn,{key:1,variant:`text`,disabled:e.busy,onClick:s},{default:I(()=>[Ge(b(t.$t(`common.remove`)),1)]),_:1},8,[`disabled`])):Ie(``,!0)])]),_:1},8,[`error`])):(L(),Me(tb,{key:1},{label:I(()=>[D(`div`,sb,[n[11]||=D(`div`,{class:`i-carbon-logo-github text-lg`},null,-1),Ge(` `+b(t.$t(`settings.token.label`)),1)])]),default:I(()=>[D(`div`,cb,[e.meta?(L(),T(`div`,lb,[N(Ey,{src:e.meta.avatarUrl,name:e.meta.login,size:36},null,8,[`src`,`name`]),D(`div`,ub,[D(`div`,db,[D(`span`,fb,b(e.meta.login),1),e.meta.name?(L(),T(`span`,pb,b(e.meta.name),1)):Ie(``,!0)]),D(`div`,mb,[(L(!0),T(gt,null,E(e.meta.scopes,e=>(L(),Me(Dy,{key:e,text:e,class:`text-xs`},null,8,[`text`]))),128)),e.meta.scopes.length?Ie(``,!0):(L(),T(`span`,hb,b(t.$t(`settings.token.fineGrained`)),1))]),D(`div`,gb,[D(`span`,null,[Ge(b(t.$t(`settings.token.updated`))+` `,1),N(Yy,{date:e.meta.setAt},null,8,[`date`])]),e.meta.expiresAt?(L(),T(`span`,_b,[Ge(b(t.$t(`settings.token.expires`))+` `,1),N(Yy,{date:e.meta.expiresAt},null,8,[`date`])])):(L(),T(`span`,vb,b(t.$t(`settings.token.neverExpires`)),1))])]),N(ns,{icon:`i-ph:pencil-simple-duotone`,label:t.$t(`settings.token.change`),tooltip:t.$t(`settings.token.change`),class:`text-sm`,onClick:n[3]||=e=>i.value=!0},null,8,[`label`,`tooltip`])])):(L(),T(`div`,yb,[e.busy?(L(),T(gt,{key:0},[n[12]||=D(`span`,{class:`i-ph:circle-notch animate-spin`,"aria-hidden":`true`},null,-1),Ge(` `+b(t.$t(`settings.token.checking`)),1)],64)):(L(),T(gt,{key:1},[D(`span`,bb,b(e.error??t.$t(`settings.token.couldNotVerify`)),1),N(ns,{icon:`i-ph:pencil-simple-duotone`,label:t.$t(`settings.token.change`),tooltip:t.$t(`settings.token.change`),class:`text-sm`,onClick:n[4]||=e=>i.value=!0},null,8,[`label`,`tooltip`])],64))]))])]),_:1}))}}}),Sb=Ht(),Cb=Symbol(`diffs-is-dark`),wb={github:`GitHub`};function Tb(e){return e.split(`-`).map(e=>wb[e]??e.charAt(0).toUpperCase()+e.slice(1)).join(` `)}function Eb(e){return yd.getThemes({colorScheme:e}).map(e=>({value:e.name,label:e.displayName??Tb(e.name),collection:e.collection??``}))}function Db(e,t){return typeof t==`string`&&yd.getTheme(t)?.colorScheme===e}var Ob=rt(`diffs:syntax-theme`,vc,{mergeDefaults:!0}),kb=P(()=>({light:Db(`light`,Ob.value.light)?Ob.value.light:vc.light,dark:Db(`dark`,Ob.value.dark)?Ob.value.dark:vc.dark}));function Ab(e,t){Ob.value={...kb.value,[e]:t}}var jb={key:1},Mb=F({__name:`ActionToggleGroup`,props:Qt({options:{},multiple:{type:Boolean,default:!1},iconOnly:{type:Boolean}},{modelValue:{},modelModifiers:{}}),emits:[`update:modelValue`],setup(e){let t=jt(e,`modelValue`);return(n,r)=>(L(),Me(i(ic),{modelValue:t.value,"onUpdate:modelValue":r[0]||=e=>t.value=e,type:e.multiple?`multiple`:`single`,class:`p-1 rounded-lg bg-sunken inline-flex gap-1 w-max`},{default:I(()=>[(L(!0),T(gt,null,E(e.options,t=>(L(),Me(i(oc),{key:t.value,value:t.value,disabled:t.disabled,"aria-label":t.label??t.value,class:Oe([`text-sm color-muted outline-none rounded-md flex gap-1.5 transition items-center data-[state=on]:color-base hover:color-base data-[state=on]:bg-raised disabled:op50 focus-visible:ring-2 focus-visible:ring-primary-500/40 data-[state=on]:shadow-sm`,e.iconOnly?`p-1.5`:`px-3 py-1`])},{default:I(()=>[t.icon?(L(),T(`span`,{key:0,class:Oe(t.icon),"aria-hidden":`true`},null,2)):Ie(``,!0),e.iconOnly?Ie(``,!0):(L(),T(`span`,jb,b(t.label??t.value),1))]),_:2},1032,[`value`,`disabled`,`aria-label`,`class`]))),128))]),_:1},8,[`modelValue`,`type`]))}}),Nb=Ne(!1),Pb=F({__name:`DarkToggle`,setup(e){let t=document.head.appendChild(document.createElement(`meta`));t.name=`theme-color`,wt(()=>{t.content=Sb.value?`#222222`:`#ffffff`});function n(){Sb.value=!Sb.value}return(e,t)=>(L(),Me(ns,{icon:`i-ph-sun-duotone dark:i-ph-moon-duotone`,onClick:n}))}}),Fb={key:0,role:`listbox`,class:`absolute right-0 top-full z-dropdown mt-1 min-w-40 flex flex-col overflow-hidden border border-base rounded-lg bg-base p-1 shadow-lg`},Ib=[`aria-selected`,`onClick`],Lb={class:`min-w-0 flex-1 whitespace-nowrap`},Rb={key:0,class:`i-ph:check shrink-0 text-xs`,"aria-hidden":`true`},zb=F({__name:`LanguageMenu`,setup(e){let t=Ne(!1),n=St(`root`);pt(n,()=>t.value=!1);function r(e){In.value={...In.value,locale:e},t.value=!1}return(e,a)=>(L(),T(`div`,{ref_key:`root`,ref:n,class:`relative`},[N(ns,{icon:`i-ph:translate-duotone`,label:e.$t(`settings.language`),tooltip:e.$t(`settings.language`),active:t.value,"aria-expanded":t.value,onClick:a[0]||=e=>t.value=!t.value},null,8,[`label`,`tooltip`,`active`,`aria-expanded`]),t.value?(L(),T(`div`,Fb,[(L(!0),T(gt,null,E(i(Rn),e=>(L(),T(`button`,{key:e.code,type:`button`,role:`option`,"aria-selected":e.code===i(In).locale,class:Oe([`flex items-center gap-2 rounded-md px-2 py-1.5 text-left text-sm outline-none transition focus-visible:bg-hover hover:bg-hover`,e.code===i(In).locale?`color-active`:`color-base`]),onClick:t=>r(e.code)},[D(`span`,Lb,b(e.native),1),e.code===i(In).locale?(L(),T(`span`,Rb)):Ie(``,!0)],10,Ib))),128))])):Ie(``,!0)],512))}}),Bb={assign:0,create:0,clone:0,discard:0,update:0};function Vb(e,t,n){return e>=t&&e<=n}function Hb(e){return e===8205}function Ub(e){return Vb(e,55296,56319)}function Wb(e){return Vb(e,127462,127487)}function Gb(e){return Vb(e,65024,65039)}function Kb(e){return Vb(e,768,879)||Vb(e,6832,6911)||Vb(e,7616,7679)||Vb(e,65056,65071)}function qb(e){return e>65535?2:1}function Jb(e,t){for(;t<e.length;){let n=e.codePointAt(t);if(Kb(n)||Gb(n))t+=qb(n);else break}return t}function Yb(e,t){let n=e.codePointAt(t),r=t+qb(n);for(r=Jb(e,r);r<e.length-1&&Hb(e.codePointAt(r));){let t=e.codePointAt(r+1);r+=1+qb(t),r=Jb(e,r)}return Wb(n)&&r<e.length&&Wb(e.codePointAt(r))&&(r+=qb(e.codePointAt(r))),r}function Xb(e){return e>=768&&(Ub(e)||Kb(e)||Gb(e)||Hb(e))}function Zb(e){let t=0,n=0;for(;n<e.length;)n=Yb(e,n),t++;return t}function Qb(e,t){let n=0,r=0;for(;r<e.length;)if(r=Yb(e,r),++n>=t)return!0;return!1}function $b(e,t){let n=0,r=0;for(;r<e.length;)if(r=Yb(e,r),++n>t)return!1;return!0}function ex(e,t){if(t===0)return!0;if(e.length<t)return!1;let n=0;for(;;){if(Xb(e.charCodeAt(n)))return Qb(e,t);if(++n>=t)return!0}}function tx(e,t){if(e.length<=t)return!0;let n=0;for(;;){if(Xb(e.charCodeAt(n)))return $b(e,t);if(++n>t)return!1}}var nx=t({Counted:()=>Ox,Entries:()=>Mx,EntriesRegExp:()=>jx,Every:()=>wx,EveryAll:()=>Tx,GraphemeCount:()=>xx,HasPropertyKey:()=>G,IsArray:()=>H,IsBigInt:()=>rx,IsBoolean:()=>ix,IsClassInstance:()=>yx,IsConstructor:()=>ax,IsDeepEqual:()=>Lx,IsEqual:()=>W,IsFunction:()=>ox,IsGreaterEqualThan:()=>_x,IsGreaterThan:()=>mx,IsInteger:()=>sx,IsLessEqualThan:()=>gx,IsLessThan:()=>hx,IsMaxLength:()=>Sx,IsMinLength:()=>Cx,IsMultipleOf:()=>vx,IsNull:()=>cx,IsNumber:()=>lx,IsObject:()=>U,IsObjectNotArray:()=>ux,IsString:()=>dx,IsSymbol:()=>fx,IsUndefined:()=>px,IsUnsafePropertyKey:()=>Ax,IsValueLike:()=>bx,Keys:()=>K,ShiftLeft:()=>kx,Some:()=>Ex,SomeAll:()=>Dx,Symbols:()=>Nx,Values:()=>Px});function H(e){return Array.isArray(e)}function rx(e){return W(typeof e,`bigint`)}function ix(e){return W(typeof e,`boolean`)}function ax(e){if(px(e)||!ox(e))return!1;let t=Function.prototype.toString.call(e);return!!(/^class\s/.test(t)||/\[native code\]/.test(t))}function ox(e){return W(typeof e,`function`)}function sx(e){return Number.isInteger(e)}function cx(e){return W(e,null)}function lx(e){return Number.isFinite(e)}function ux(e){return U(e)&&!H(e)}function U(e){return W(typeof e,`object`)&&!cx(e)}function dx(e){return W(typeof e,`string`)}function fx(e){return W(typeof e,`symbol`)}function px(e){return W(e,void 0)}function W(e,t){return e===t}function mx(e,t){return e>t}function hx(e,t){return e<t}function gx(e,t){return e<=t}function _x(e,t){return e>=t}function vx(e,t){if(rx(e)||rx(t))return BigInt(e)%BigInt(t)===0n;if(!lx(e)||sx(e)&&1/t%1==0)return!0;let n=e%t;return Math.min(Math.abs(n),Math.abs(n-t),Math.abs(n+t))<1e-10}function yx(e){if(!U(e))return!1;let t=globalThis.Object.getPrototypeOf(e);return!cx(t)&&W(typeof t.constructor,`function`)&&!(W(t.constructor,globalThis.Object)||W(t.constructor.name,`Object`))}function bx(e){return rx(e)||ix(e)||cx(e)||lx(e)||dx(e)||px(e)}function xx(e){return Zb(e)}function Sx(e,t){return tx(e,t)}function Cx(e,t){return ex(e,t)}function wx(e,t,n){return e.every((e,r)=>r<t||n(e,r))}function Tx(e,t,n){let r=!0;return e.forEach((e,i)=>{i>=t&&!n(e,i)&&(r=!1)}),r}function Ex(e,t){return e.some((e,n)=>t(e,n))}function Dx(e,t){let n=!1;return e.forEach((e,r)=>{t(e,r)&&(n=!0)}),n}function Ox(e,t){return e.reduce((e,n,r)=>t(n,r)?++e:e,0)}function kx(e,t,n){return W(e.length,0)?n():t(e[0],e.slice(1))}function Ax(e){return W(e,`__proto__`)||W(e,`constructor`)||W(e,`prototype`)}function G(e,t){return Ax(t)?Object.prototype.hasOwnProperty.call(e,t):t in e}function jx(e){return K(e).map(t=>[RegExp(`^${t}$`),e[t]])}function Mx(e){return Object.entries(e)}function K(e){return Object.getOwnPropertyNames(e)}function Nx(e){return Object.getOwnPropertySymbols(e)}function Px(e){return Object.values(e)}function Fx(e,t){if(!U(t))return!1;let n=K(e);return W(n.length,K(t).length)&&n.every(n=>Lx(e[n],t[n]))}function Ix(e,t){return H(t)&&W(e.length,t.length)&&e.every((n,r)=>Lx(e[r],t[r]))}function Lx(e,t){return H(e)?Ix(e,t):U(e)?Fx(e,t):W(e,t)}var Rx=/^[\p{ID_Start}_$][\p{ID_Continue}_$\u200C\u200D]*$/u;function zx(e){return Rx.test(e)}function Bx(e,t){return`(${e} && ${t})`}function Vx(e,t){return`(${e} || ${t})`}function Hx(e){return`!(${e})`}function Ux(e){return`Array.isArray(${e})`}function Wx(e){return`typeof ${e} === "bigint"`}function Gx(e){return`typeof ${e} === "boolean"`}function Kx(e){return`Number.isInteger(${e})`}function qx(e){return`${e} === null`}function Jx(e){return`Number.isFinite(${e})`}function Yx(e){return Bx(Xx(e),Hx(Ux(e)))}function Xx(e){return`typeof ${e} === "object" && ${e} !== null`}function Zx(e){return`typeof ${e} === "string"`}function Qx(e){return`typeof ${e} === "symbol"`}function $x(e){return`${e} === undefined`}function eS(e){return`typeof ${e} === "function"`}function tS(e){return`Guard.IsConstructor(${e})`}function nS(e,t){return`${e} === ${t}`}function rS(e,t){return`${e} > ${t}`}function iS(e,t){return`${e} < ${t}`}function aS(e,t){return`${e} <= ${t}`}function oS(e,t){return`${e} >= ${t}`}function sS(e,t){return`Guard.IsMinLength(${e}, ${t})`}function cS(e,t){return`Guard.IsMaxLength(${e}, ${t})`}function lS(e,t,n,r){return W(t,`0`)?`${e}.every((${n[0]}, ${n[1]}) => (${r}))`:`${e}.every((${n[0]}, ${n[1]}) => (${n[1]} < ${t}) || (${r}))`}function uS(e,t,n){return`${e}.some((${t[0]}, ${t[1]}) => ${n})`}function dS(e,t,n){return`((value) => { let result = false; value.forEach((${t[0]}, ${t[1]}) => { if (${n}) result = true }); return result })(${e})`}function fS(e,t,n){return`${e}.reduce((result, ${t[0]}, ${t[1]}) => (${n}) ? ++result : result, 0)`}function pS(e){return`Object.entries(${e})`}function mS(e){return`Object.getOwnPropertyNames(${e})`}function hS(e,t){return W(t,`"__proto__"`)||W(t,`"constructor"`)?`Object.prototype.hasOwnProperty.call(${e}, ${t})`:`${t} in ${e}`}function gS(e,t){return`Guard.IsDeepEqual(${e}, ${t})`}function _S(e){return`[${e.join(`, `)}]`}function vS(e,t){return`((${e.join(`, `)}) => ${t})`}function yS(e,t){return`${e}(${t.join(`, `)})`}function bS(e,t){return`new ${e}(${t.join(`, `)})`}function xS(e,t){return`${e}${zx(t)?`.${t}`:`[${q(t)}]`}`}function q(e){if(!bx(e))throw Error(`Unsupported Constant`);return dx(e)?JSON.stringify(e):`${e}`}function SS(e,t,n){return`(${e} ? ${t} : ${n})`}function CS(e){return`{ ${e.join(`; `)}; }`}function wS(e,t){return`const ${e} = ${t}`}function TS(e,t){return`if(${e}) { ${t} }`}function ES(e){return`return ${e}`}function DS(e){return W(e.length,0)?`true`:e.reduce((e,t)=>Bx(e,t))}function OS(e){return W(e.length,0)?`false`:e.reduce((e,t)=>Vx(e,t))}function kS(e,t){return`Guard.IsMultipleOf(${e}, ${t})`}function AS(e){return e instanceof Boolean}function jS(e){return e instanceof Number}function MS(e){return e instanceof String}function NS(e){return globalThis.ArrayBuffer.isView(e)}function PS(e){return e instanceof globalThis.RegExp}function FS(e){return e instanceof globalThis.Date}function IS(e){return e instanceof globalThis.Set}function LS(e){return e instanceof globalThis.Map}var RS=nx,zS={immutableTypes:!1,maxErrors:8,maxInstantiationCount:128,useAcceleration:!0,exactOptionalPropertyTypes:!1,enumerableKind:!1,correctiveParse:!1,unionPrioritySort:!0};function BS(){return zS}function VS(e){return BS().immutableTypes?Object.freeze(e):e}function HS(e,t){return Bb.assign+=1,VS({...e,...t})}function US(e){return e}function WS(e){return G(e,`~kind`)||G(e,`~unsafe`)}function GS(e){let t={};for(let n of K(e)){if(Ax(n))continue;let r=Object.getOwnPropertyDescriptor(e,n);r.value=$S(r.value),W(r.enumerable,!0)?t[n]=r.value:Object.defineProperty(t,n,r)}return t}function KS(e){let t={};for(let n of K(e))Ax(n)||(t[n]=$S(e[n]));for(let n of Nx(e))t[n]=$S(e[n]);return t}function qS(e){return yx(e)?US(e):WS(e)?GS(e):KS(e)}function JS(e){return e.map(e=>$S(e))}function YS(e){return e.slice()}function XS(e){return new RegExp(e.source,e.flags)}function ZS(e){return new Map($S([...e.entries()]))}function QS(e){return new Set($S([...e.values()]))}function $S(e){return NS(e)?YS(e):PS(e)?XS(e):LS(e)?ZS(e):IS(e)?QS(e):H(e)?JS(e):U(e)?qS(e):e}function eC(e){return Bb.clone+=1,$S(e)}function tC(e,t){for(let n of Object.keys(t))Object.defineProperty(e,n,{configurable:!0,writable:!0,enumerable:!1,value:t[n]});return e}function nC(e,t){return{...e,...t}}function rC(e,t,n={}){Bb.create+=1;let r=nC(t,n);return VS(BS().enumerableKind?nC(r,e):tC(r,e))}function iC(e,t){Bb.discard+=1;let n={};for(let r of K(e)){if(t.includes(r))continue;let i=Object.getOwnPropertyDescriptor(e,r);i.value=eC(i.value),Object.defineProperty(n,r,i)}return VS(n)}function aC(e,t,n){Bb.update+=1;let r=BS(),i=eC(e);for(let e of Object.keys(t))Object.defineProperty(i,e,{configurable:!0,writable:!0,enumerable:r.enumerableKind,value:t[e]});for(let e of Object.keys(n))Object.defineProperty(i,e,{configurable:!0,enumerable:!0,writable:!0,value:n[e]});return VS(i)}function oC(e,t){return U(e)&&G(e,`~kind`)&&W(e[`~kind`],t)}function sC(e){return U(e)}function cC(e,t,n){return rC({"~kind":`Deferred`},{type:`deferred`,action:e,parameters:t,options:n},{})}function lC(e){return oC(e,`Deferred`)}function uC(e){return aC(e,{"~readonly":!0},{})}function dC(e,t){return aC(uC(e),{},t)}function fC(e,t,n,r){return dC(Y(e,t,n),r)}function pC(e){return aC(e,{"~optional":!0},{})}function mC(e,t){return aC(pC(e),{},t)}function hC(e,t,n,r){return mC(Y(e,t,n),r)}function gC(e,t){return rC({"~kind":`Array`},{type:`array`,items:e},t)}function _C(e){return oC(e,`Array`)}function vC(e){return iC(e,[`~kind`,`type`,`items`])}function yC(e,t,n={}){return rC({"~kind":`Constructor`},{type:`constructor`,parameters:e,instanceType:t},n)}function bC(e){return oC(e,`Constructor`)}function xC(e){return iC(e,[`~kind`,`type`,`parameters`,`instanceType`])}function SC(e,t,n={}){return rC({"~kind":`Function`},{type:`function`,parameters:e,returnType:t},n)}function CC(e){return oC(e,`Function`)}function wC(e){return iC(e,[`~kind`,`type`,`parameters`,`returnType`])}function TC(e,t){return rC({"~kind":`Ref`},{$ref:e},t)}function EC(e){return oC(e,`Ref`)}function DC(e,t){return rC({"~kind":`Generic`},{type:`generic`,parameters:e,expression:t})}function OC(e){return oC(e,`Generic`)}function kC(e){return rC({"~kind":`Any`},{},e)}function AC(e){return oC(e,`Any`)}var jC=`(?!)`;function MC(e){return rC({"~kind":`Never`},{not:{}},e)}function NC(e){return oC(e,`Never`)}function PC(e,t={}){return mC(e,t)}function FC(e){return PC(e)}function IC(e){return sC(e)&&G(e,`~optional`)}function LC(e){return K(e).filter(t=>!IC(e[t]))}function RC(e){return K(e)}function zC(e){return Px(e)}function BC(e,t={}){let n=LC(e);return rC({"~kind":`Object`},{type:`object`,...n.length>0?{required:n}:{},properties:e},t)}function VC(e){return oC(e,`Object`)}function HC(e){return iC(e,[`~kind`,`type`,`properties`,`required`])}function UC(e){return rC({"~kind":`Unknown`},{},e)}function WC(e){return oC(e,`Unknown`)}function GC(e,t,n){return rC({"~kind":`Cyclic`},{$defs:K(e).reduce((t,n)=>({...t,[n]:aC(e[n],{},{$id:n})}),{}),$ref:t},n)}function KC(e){return oC(e,`Cyclic`)}function qC(e){return ux(e)&&G(e,`~unsafe`)&&cx(e[`~unsafe`])}function JC(e,t){return t[e.length]?.(...e)??(()=>{throw Error(`Invalid Arguments`)})()}function YC(e){return oC(e,`Infer`)}function XC(e,t,n,r={}){return rC({"~kind":`Dependent`},{if:e,then:t,else:n},r)}function ZC(e){return oC(e,`Dependent`)}function QC(e){return iC(e,[`~kind`,`if`,`then`,`else`])}function $C(e){return oC(e,`Enum`)}function ew(e,t={}){return rC({"~kind":`Intersect`},{allOf:e},t)}function tw(e){return oC(e,`Intersect`)}function nw(e){return iC(e,[`~kind`,`allOf`])}var rw=void 0;function iw(){try{return ow(`null`)(),!0}catch{return!1}}function aw(){return px(rw)&&(rw=iw()),rw&&BS().useAcceleration}function ow(...e){return new globalThis.Function(...e)}function sw(){throw Error(`Unreachable`)}var cw=t({Hash:()=>Lw,HashCode:()=>Iw});function lw(e){let t=new Set,n=e;for(;n&&n!==Object.prototype;){for(let e of Reflect.ownKeys(n))e!==`constructor`&&typeof e!=`symbol`&&t.add(e);n=Object.getPrototypeOf(n)}return[...t]}function uw(e){return typeof e==`number`}var dw;(function(e){e[e.Array=0]=`Array`,e[e.BigInt=1]=`BigInt`,e[e.Boolean=2]=`Boolean`,e[e.Date=3]=`Date`,e[e.Constructor=4]=`Constructor`,e[e.Function=5]=`Function`,e[e.Null=6]=`Null`,e[e.Number=7]=`Number`,e[e.Object=8]=`Object`,e[e.RegExp=9]=`RegExp`,e[e.String=10]=`String`,e[e.Symbol=11]=`Symbol`,e[e.TypeArray=12]=`TypeArray`,e[e.Undefined=13]=`Undefined`})(dw||={});var fw=BigInt(`14695981039346656037`),[pw,mw]=[BigInt(`1099511628211`),BigInt(`18446744073709551616`)],hw=Array.from({length:256}).map((e,t)=>BigInt(t)),gw=new Float64Array(1),_w=new DataView(gw.buffer),vw=new Uint8Array(gw.buffer);function yw(e){fw^=hw[e],fw=fw*pw%mw}function bw(e){yw(dw.Array);for(let t of e)Fw(t)}function xw(e){yw(dw.BigInt),_w.setBigInt64(0,e);for(let e of vw)yw(e)}function Sw(e){yw(dw.Boolean),yw(+!!e)}function Cw(e){yw(dw.Constructor),Fw(e.toString())}function ww(e){yw(dw.Date),Fw(e.getTime())}function Tw(e){yw(dw.Function),Fw(e.toString())}function Ew(e){yw(dw.Null)}function Dw(e){yw(dw.Number),_w.setFloat64(0,e,!0);for(let e of vw)yw(e)}function Ow(e){yw(dw.Object);for(let t of lw(e).sort())Fw(t),Fw(e[t])}function kw(e){yw(dw.RegExp),jw(e.toString())}var Aw=new TextEncoder;function jw(e){yw(dw.String);for(let t of Aw.encode(e))yw(t)}function Mw(e){yw(dw.Symbol),Fw(e.toString())}function Nw(e){yw(dw.TypeArray);let t=new Uint8Array(e.buffer);for(let e=0;e<t.length;e++)yw(t[e])}function Pw(e){return yw(dw.Undefined)}function Fw(e){return NS(e)?Nw(e):FS(e)?ww(e):PS(e)?kw(e):AS(e)?Sw(e.valueOf()):MS(e)?jw(e.valueOf()):jS(e)?Dw(e.valueOf()):uw(e)?Dw(e):H(e)?bw(e):ix(e)?Sw(e):rx(e)?xw(e):ax(e)?Cw(e):cx(e)?Ew(e):U(e)?Ow(e):dx(e)?jw(e):fx(e)?Mw(e):px(e)?Pw(e):ox(e)?Tw(e):sw()}function Iw(e){return fw=BigInt(`14695981039346656037`),Fw(e),fw}function Lw(e){return Iw(e).toString(16).padStart(16,`0`)}function Rw(e){switch(e.keyword){case`additionalProperties`:return`must not have additional properties`;case`anyOf`:return`must match a schema in anyOf`;case`boolean`:return`schema is false`;case`const`:return`must be equal to constant`;case`contains`:return`must contain at least 1 valid item`;case`dependencies`:return`must have properties ${e.params.dependencies.join(`, `)} when property ${e.params.property} is present`;case`dependentRequired`:return`must have properties ${e.params.dependencies.join(`, `)} when property ${e.params.property} is present`;case`enum`:return`must be equal to one of the allowed values`;case`exclusiveMaximum`:return`must be ${e.params.comparison} ${e.params.limit}`;case`exclusiveMinimum`:return`must be ${e.params.comparison} ${e.params.limit}`;case`format`:return`must match format "${e.params.format}"`;case`if`:return`must match "${e.params.failingKeyword}" schema`;case`maxItems`:return`must not have more than ${e.params.limit} items`;case`maxLength`:return`must not have more than ${e.params.limit} characters`;case`maxProperties`:return`must not have more than ${e.params.limit} properties`;case`maximum`:return`must be ${e.params.comparison} ${e.params.limit}`;case`minItems`:return`must not have fewer than ${e.params.limit} items`;case`minLength`:return`must not have fewer than ${e.params.limit} characters`;case`minProperties`:return`must not have fewer than ${e.params.limit} properties`;case`minimum`:return`must be ${e.params.comparison} ${e.params.limit}`;case`multipleOf`:return`must be multiple of ${e.params.multipleOf}`;case`not`:return`must not be valid`;case`oneOf`:return`must match exactly one schema in oneOf`;case`pattern`:return`must match pattern "${e.params.pattern}"`;case`propertyNames`:return`property names ${e.params.propertyNames.join(`, `)} are invalid`;case`required`:return`must have required properties ${e.params.requiredProperties.join(`, `)}`;case`type`:return typeof e.params.type==`string`?`must be ${e.params.type}`:`must be either ${e.params.type.join(` or `)}`;case`unevaluatedItems`:return`must not have unevaluated items`;case`unevaluatedProperties`:return`must not have unevaluated properties`;case`uniqueItems`:return`must not have duplicate items`;case`~refine`:return e.params.message;default:return`an unknown validation error occurred`}}var zw=Rw;function Bw(){return zw}function Vw(e){return sC(e)&&G(e,`~codec`)&&U(e[`~codec`])&&G(e[`~codec`],`encode`)&&G(e[`~codec`],`decode`)}function Hw(e){return sC(e)&&G(e,`~immutable`)}function Uw(e,t={}){return dC(e,t)}function Ww(e){return sC(e)&&G(e,`~readonly`)}var Gw=`-?(?:0|[1-9][0-9]*)n`;function Kw(e){return rC({"~kind":`BigInt`},{type:`bigint`},e)}function qw(e){return oC(e,`BigInt`)}function Jw(e){return oC(e,`Boolean`)}var Yw=`-?(?:0|[1-9][0-9]*)`;function Xw(e){return rC({"~kind":`Integer`},{type:`integer`},e)}function Zw(e){return oC(e,`Integer`)}var Qw=class extends Error{constructor(e){super(`Invalid Literal value`),Object.defineProperty(this,"cause",{value:{value:e},writable:!1,configurable:!1,enumerable:!1})}};function $w(e){return rx(e)?`bigint`:ix(e)?`boolean`:lx(e)?`number`:dx(e)?`string`:(()=>{throw new Qw(e)})()}function eT(e,t){return rC({"~kind":`Literal`},{type:$w(e),const:e},t)}function tT(e){return rx(e)||ix(e)||lx(e)||dx(e)}function nT(e){return oT(e)&&rx(e.const)}function rT(e){return oT(e)&&ix(e.const)}function iT(e){return oT(e)&&lx(e.const)}function aT(e){return oT(e)&&dx(e.const)}function oT(e){return oC(e,`Literal`)}function sT(e){return rC({"~kind":`Null`},{type:`null`},e)}function cT(e){return oC(e,`Null`)}var lT=`-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?`;function uT(e){return rC({"~kind":`Number`},{type:`number`},e)}function dT(e){return oC(e,`Number`)}function fT(e){return rC({"~kind":`Symbol`},{type:`symbol`},e)}function pT(e){return oC(e,`Symbol`)}function mT(e){return rC({"~kind":`String`},{type:`string`},e)}function hT(e){return oC(e,`String`)}function gT(e,t={}){return rC({"~kind":`Union`},{anyOf:e},t)}function _T(e){return oC(e,`Union`)}function vT(e){return iC(e,[`~kind`,`anyOf`])}function yT(e){let t=YD(e);return W(t.length,2)?t[0]:[]}function bT(e){return!0}function xT(e){return kx(e,(e,t)=>CT(e)?xT(t):!1,()=>!0)}function ST(e){return!W(e.length,0)&&xT(e)}function CT(e){return _T(e)?ST(e.anyOf):oT(e)?bT(e.const):!1}function wT(e){return ST(e)}function TT(e){return rC({"~kind":`TemplateLiteral`},{type:`string`,pattern:e},{})}function ET(e,t,n=[]){return kx(e,(e,r)=>ET(r,t,[...n,`${e}${t}`]),()=>n)}function DT(e,t){return W(e.length,0)?[`${t}`]:ET(e,t)}function OT(e,t,n=[]){return kx(t,(t,r)=>OT(e,r,[...n,...kT(e,t)]),()=>n)}function kT(e,t){return _T(t)?OT(e,t.anyOf):oT(t)?DT(e,t.const):sw()}function AT(e,t){return kx(t,(t,n)=>AT(kT(e,t),n),()=>e)}function jT(e){return e.map(e=>eT(e))}function MT(e){return gT(jT(AT([],e)))}function NT(e){return W(e.length,0)?sw():W(e.length,1)&&oT(e[0])?e[0]:MT(e)}function PT(e){let t=yT(e);return W(t.length,0)?mT():wT(t)?NT(t):TT(e)}function FT(e){let t=PT(e);return gO(t)?mT():t}function IT(e,t){return rC({"~kind":`Record`},{type:`object`,patternProperties:{[e]:t}})}function LT(e){return IT(UE,e)}function RT(e){return BC({true:e,false:e})}function zT(e,t={}){let[n,r,i]=[e,e.length,!1];return rC({"~kind":`Tuple`},{type:`array`,additionalItems:i,items:n,minItems:r},t)}function BT(e){return oC(e,`Tuple`)}function VT(e){return iC(e,[`~kind`,`type`,`items`,`minItems`,`additionalItems`])}function HT(e){return iC(e,[`~readonly`])}function UT(e,t){return aC(HT(e),{},t)}function WT(e,t,n,r){return UT(Y(e,t,n),r)}function GT(e,t={}){return UT(e,t)}function KT(e){return iC(e,[`~optional`])}function qT(e,t){return aC(KT(e),{},t)}function JT(e,t,n,r){return qT(Y(e,t,n),r)}function YT(e,t={}){return qT(e,t)}function XT(e){return e.reduceRight((e,t,n)=>({[n]:t,...e}),{})}function ZT(e){return BC(XT(e.items))}function QT(e){return VC(e)||BT(e)}function $T(e,t){return Ww(e)?!!Ww(t):!1}function eE(e,t){return IC(e)?!!IC(t):!1}function tE(e,t){let n=$T(e,t),r=eE(e,t),i=GT(YT(yE([e,t])));return n&&r?Uw(PC(i)):n&&!r?Uw(i):!n&&r?PC(i):i}function nE(e,t,n){return n in e?n in t?tE(e[n],t[n]):e[n]:n in t?t[n]:MC()}function rE(e,t){return[...new Set([...K(e),...K(t)])].reduce((n,r)=>({...n,[r]:nE(e,t,r)}),{})}function iE(e){return VC(e)?e.properties:BT(e)?XT(e.items):{}}function aE(e,t){return BC(rE(iE(e),iE(t)))}function oE(e,t){let n=Ik(e,t);return W(n,2)?e:W(n,3)||W(n,0)?t:MC()}function sE(e,t){let n=QT(e),r=QT(t);return n&&r?aE(e,t):n&&!r?e:!n&&r?t:oE(e,t)}function cE(e,t){return NC(e)||AC(e)?e:WC(e)||NC(t)||AC(t)?t:WC(t)?e:sE(e,t)}function lE(e,t){return _T(e)||_T(t)}function uE(e,t){let n=SE(e),r=SE(t);return lE(n,r)?yE([n,r]):cE(n,r)}function dE(e,t,n=[]){return kx(t,(t,r)=>dE(e,r,[...n,uE(t,e)]),()=>W(n.length,0)?[e]:n)}function fE(e,t,n=[]){return kx(e,(e,r)=>fE(r,t,[...n,...pE([e],t)]),()=>n)}function pE(e,t=[]){return kx(e,(e,n)=>_T(e)?pE(n,fE(e.anyOf,t)):pE(n,dE(e,t)),()=>t)}function mE(e,t){return SO(Fk({},e,t))?[]:[e]}function hE(e,t,n=[]){return kx(e,(e,r)=>hE(r,t,[...n,...mE(e,t)]),()=>n)}function gE(e,t){let n=SE(e);return xE(hE(_T(n)?n.anyOf:[n],t))}function _E(e,t,n){return xE([yE([e,t]),gE(n,e)])}function vE(e,t=[]){return kx(e,(e,n)=>vE(n,[...t,eT(e)]),()=>xE(t))}function yE(e){return xE(Bk(pE(e)))}function bE(e){return SE(FT(e))}function xE(e){return CE(Bk(e))}function SE(e){return ZC(e)?_E(e.if,e.then,e.else):$C(e)?vE(e.enum):tw(e)?yE(e.allOf):gO(e)?bE(e.pattern):_T(e)?xE(e.anyOf):e}function CE(e){return W(e.length,1)?e[0]:W(e.length,0)?MC():gT(e)}function wE(e,t){return RE(vE(e),t)}function TE(e,t){return IT(VE,t)}function EE(e,t){return RE(yE(e),t)}function DE(e,t){return dx(e)||lx(e)?BC({[e]:t}):W(e,!1)?BC({false:t}):W(e,!0)?BC({true:t}):BC({})}function OE(e,t){return IT(HE,t)}function kE(e,t){return G(e,`pattern`)&&(dx(e.pattern)||e.pattern instanceof RegExp)?IT(e.pattern.toString(),t):IT(UE,t)}function AE(e,t){return wT(yT(e))?RE(bE(e),t):IT(e,t)}function jE(e){return _T(e)?ME(e.anyOf):[e]}function ME(e,t=[]){return kx(e,(e,n)=>ME(n,[...t,...jE(e)]),()=>t)}function NE(e){return e.some(e=>hT(e)||dT(e)||Zw(e))}function PE(e,t){return W(NE(e),!0)?IT(UE,t):void 0}function FE(e,t){return e.reduce((e,n)=>oT(n)&&(dx(n.const)||lx(n.const))?{...e,[n.const]:t}:e,{})}function IE(e,t){return BC(FE(e,t))}function LE(e,t){let n=ME(e),r=PE(n,t);return sC(r)?r:IE(n,t)}function RE(e,t){return AC(e)?LT(t):Jw(e)?RT(t):$C(e)?wE(e.enum,t):Zw(e)?TE(e,t):tw(e)?EE(e.allOf,t):oT(e)?DE(e.const,t):dT(e)?OE(e,t):_T(e)?LE(e.anyOf,t):hT(e)?kE(e,t):gO(e)?AE(e.pattern,t):BC({})}function zE(e,t,n){return HN([e])?aC(RE(e,t),{},n):WE(e,t,n)}function BE(e,t,n,r,i){return zE(Y(e,t,n),Y(e,t,r),i)}var VE=`^${Yw}$`,HE=`^${lT}$`,UE=`^.*$`;function WE(e,t,n={}){return cC(`Record`,[e,t],n)}function GE(e,t,n={}){return zE(e,t,n)}function KE(e,t){return IT(e,t)}function qE(e){return W(e,UE)?mT():W(e,VE)?Xw():W(e,HE)?uT():PT(e)}function JE(e){return K(e.patternProperties)[0]}function YE(e){return qE(JE(e))}function XE(e){return e.patternProperties[JE(e)]}function ZE(e){return oC(e,`Record`)}function QE(e){return rC({"~kind":`Rest`},{type:`rest`,items:e},{})}function $E(e){return oC(e,`Rest`)}function eD(e){return oC(e,`This`)}function tD(e){return rC({"~kind":`Undefined`},{type:`undefined`},e)}function nD(e){return oC(e,`Undefined`)}function rD(e){return oC(e,`Void`)}function iD(e){return Kw()}function aD(e){return mT()}function oD(e){return uT()}function sD(e){return Xw()}function cD(e){return MC()}function lD(e){return eT(e)}function uD(e){return e}function dD(e){return gT(e[1])}function fD(e){return e.length===3?[...e[0],...e[2]]:e.length===1?[...e[0]]:[]}function pD(e){return[e[0],...e[1]]}function mD(e){return e}function hD(e){return e[1]}function gD(e){return W(e.length,2)}function _D(e,t,n){return gD(e)?t(e[0],e[1]):n()}function vD(e,t){return W(t.indexOf(e),0)?[e,t.slice(e.length)]:[]}function yD(e,t){for(let n=0;n<e.length;n++){let r=vD(e[n],t);if(gD(r))return r}return[]}function bD(e,t){return Array.from({length:t-e+1},(t,n)=>String.fromCharCode(e+n))}var xD=[...bD(97,122),...bD(65,90)],SD=[`0`,...bD(49,57)],CD=`//`,wD=`/*`,TD=`*/`;function ED(e){let t=e.indexOf(TD);return W(t,-1)?``:e.slice(t+2)}function DD(e){let t=e.indexOf(`
14
+ `);return W(t,-1)?``:e.slice(t)}function OD(e){return e.replace(/^[ \t\r\f\v]+/,``)}function kD(e){let t=OD(e);return t.startsWith(wD)?kD(ED(t.slice(2))):t.startsWith(CD)?kD(DD(t.slice(2))):t}function AD(e){let t=e.trimStart();return t.startsWith(wD)?AD(ED(t.slice(2))):t.startsWith(CD)?AD(DD(t.slice(2))):t}[...SD];function jD(e,t){return yD([e],t)}function MD(e,t){return W(e,``)?[``,t]:e.startsWith(`
15
+ `)?jD(e,kD(t)):e.startsWith(` `)?jD(e,t):jD(e,AD(t))}[...xD,...SD],[...SD];function ND(e){return W(e,``)?[]:[e.slice(0,1),e.slice(1)]}function PD(e,t){return kx(e,(e,n)=>t.startsWith(e)?!0:PD(n,t),()=>!1)}function FD(e,t,n=``){return _D(ND(t),(r,i)=>PD(e,t)?[n,t]:FD(e,i,`${n}${r}`),()=>[])}function ID(e,t){return _D(FD(e,t),(e,t)=>W(e,``)?[]:[e,t],()=>[])}var LD=(e,t,n=()=>[])=>e.length===2?t(e):n(),RD=e=>LD(MD(`-?(?:0|[1-9][0-9]*)n`,e),([e,t])=>[iD(e),t]),zD=e=>LD(MD(`.*`,e),([e,t])=>[aD(e),t]),BD=e=>LD(MD(`-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?`,e),([e,t])=>[oD(e),t]),VD=e=>LD(MD(`-?(?:0|[1-9][0-9]*)`,e),([e,t])=>[sD(e),t]),HD=e=>LD(MD(`(?!)`,e),([e,t])=>[cD(e),t]),UD=e=>LD(ID([`-?(?:0|[1-9][0-9]*)n`,`.*`,`-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?`,`-?(?:0|[1-9][0-9]*)`,`(?!)`,`(`,`)`,`$`,`|`],e),([e,t])=>[lD(e),t]),WD=e=>LD(LD(RD(e),([e,t])=>[e,t],()=>LD(zD(e),([e,t])=>[e,t],()=>LD(BD(e),([e,t])=>[e,t],()=>LD(VD(e),([e,t])=>[e,t],()=>LD(HD(e),([e,t])=>[e,t],()=>LD(GD(e),([e,t])=>[e,t],()=>LD(UD(e),([e,t])=>[e,t],()=>[]))))))),([e,t])=>[uD(e),t]),GD=e=>LD(LD(MD(`(`,e),([e,t])=>LD(JD(t),([t,n])=>LD(MD(`)`,n),([n,r])=>[[e,t,n],r]))),([e,t])=>[dD(e),t]),KD=e=>LD(LD(LD(qD(e),([e,t])=>LD(MD(`|`,t),([t,n])=>LD(KD(n),([n,r])=>[[e,t,n],r]))),([e,t])=>[e,t],()=>LD(LD(qD(e),([e,t])=>[[e],t]),([e,t])=>[e,t],()=>LD([[],e],([e,t])=>[e,t],()=>[]))),([e,t])=>[fD(e),t]),qD=e=>LD(LD(WD(e),([e,t])=>LD(JD(t),([t,n])=>[[e,t],n])),([e,t])=>[pD(e),t]),JD=e=>LD(LD(KD(e),([e,t])=>[e,t],()=>LD(qD(e),([e,t])=>[e,t],()=>[])),([e,t])=>[mD(e),t]),YD=e=>LD(LD(MD(`^`,e),([e,t])=>LD(JD(t),([t,n])=>LD(MD(`$`,n),([n,r])=>[[e,t,n],r]))),([e,t])=>[hD(e),t]);function XD(e){return e.join(`|`)}function ZD(e){return e.slice(1,e.length-1)}function QD(e,t,n){return lO(t,`${n}${e}`)}function $D(e,t){return lO(e,`${t}${Gw}`)}function eO(e,t){return lO(e,`${t}${Yw}`)}function tO(e,t){return lO(e,`${t}${lT}`)}function nO(e,t){return cO(gT([eT(`false`),eT(`true`)]),e,t)}function rO(e,t){return lO(e,`${t}.*`)}function iO(e,t,n){return lO(t,`${n}${ZD(e)}`)}function aO(e,t,n){return cO(fO(e,{}),t,n)}function oO(e,t,n){return cO(vE(e),t,n)}function sO(e,t,n,r=[]){return kx(e,(e,i)=>sO(i,t,n,[...r,cO(e,[],``)]),()=>lO(t,`${n}(${XD(r)})`))}function cO(e,t,n){return $C(e)?oO(e.enum,t,n):Zw(e)?eO(t,n):oT(e)?QD(e.const,t,n):qw(e)?$D(t,n):Jw(e)?nO(t,n):dT(e)?tO(t,n):hT(e)?rO(t,n):gO(e)?iO(e.pattern,t,n):hO(e)?aO(e.parameters[0],t,n):_T(e)?sO(e.anyOf,t,n):jC}function lO(e,t){return kx(e,(e,n)=>cO(e,n,t),()=>t)}function uO(e){return`^${lO(e,``)}$`}function dO(e){return TT(uO(e))}function fO(e,t){return HN(e)?aC(dO(e),{},t):mO(e,t)}function pO(e,t,n,r){return fO(GN(e,t,n),r)}function mO(e,t={}){return cC(`TemplateLiteral`,[e],t)}function hO(e){return sC(e)&&G(e,`action`)&&W(e.action,`TemplateLiteral`)}function gO(e){return oC(e,`TemplateLiteral`)}function _O(e){return rC({"~kind":`ExtendsUnion`},{inferred:e})}function vO(e){return U(e)&&G(e,`~kind`)&&G(e,`inferred`)&&W(e[`~kind`],`ExtendsUnion`)&&U(e.inferred)}function J(e){return rC({"~kind":`ExtendsTrue`},{inferred:e})}function yO(e){return U(e)&&G(e,`~kind`)&&G(e,`inferred`)&&W(e[`~kind`],`ExtendsTrue`)&&U(e.inferred)}function bO(){return rC({"~kind":`ExtendsFalse`},{})}function xO(e){return U(e)&&G(e,`~kind`)&&W(e[`~kind`],`ExtendsFalse`)}function SO(e){return vO(e)||yO(e)}function CO(e,t,n){return SO(e)?t(e.inferred):n()}function wO(e,t,n,r){return CO(yk(e,n,r),r=>J(HS(HS(e,r),{[t]:n})),()=>bO())}function TO(e,t){return J(e)}function EO(e,t,n,r,i){return CO(yk(e,t,n),e=>CO(yk(e,t,r),e=>J(e),()=>bO()),()=>CO(yk(e,t,i),e=>J(e),()=>bO()))}function DO(e,t,n){return yk(e,t,vE(n))}function OO(e,t,n){return kx(n,(n,r)=>CO(yk(e,t,n),e=>OO(e,t,r),()=>bO()),()=>J(e))}function kO(e,t,n){return yk(e,t,bE(n))}function AO(e,t,n){return kx(n,(n,r)=>CO(yk(e,t,n),e=>J(e),()=>AO(e,t,r)),()=>bO())}function jO(e,t,n){return AC(n)?TO(e,t):ZC(n)?EO(e,t,n.if,n.then,n.else):$C(n)?DO(e,t,n.enum):YC(n)?wO(e,n.name,t,n.extends):tw(n)?OO(e,t,n.allOf):gO(n)?kO(e,t,n.pattern):_T(n)?AO(e,t,n.anyOf):WC(n)?J(e):bO()}function MO(e,t,n){return YC(n)?jO(e,t,n):AC(n)||WC(n)?J(e):_O(e)}function NO(e,t){let n=Hw(e),r=Hw(t);return n&&r||!n&&r?!0:!(n&&!r)}function PO(e,t,n,r){return _C(r)?NO(t,r)?yk(e,n,r.items):bO():jO(e,t,r)}function FO(e,t,n){return qw(n)?J(e):jO(e,t,n)}function IO(e,t,n){return Jw(n)?J(e):jO(e,t,n)}function LO(e,t,n,r,i){let a=YC(r)?t:r,o=YC(r)?r:t,s=IC(t),c=IC(r);return!s&&c?bO():CO(yk(e,a,o),e=>BO(e,n,i),()=>bO())}function RO(e,t,n,r){return kx(r,(r,i)=>LO(e,t,n,r,i),()=>IC(t)?J(e):bO())}function zO(e,t,n){return kx(t,(t,r)=>RO(e,t,r,n),()=>J(e))}function BO(e,t,n){return zO(e,t,n)}function VO(e,t,n){return rD(n)?J(e):yk(e,t,n)}function HO(e,t,n,r){return AC(r)||WC(r)?J(e):bC(r)?CO(BO(e,t,r.parameters),e=>VO(e,n,r.instanceType),()=>bO()):bO()}function UO(e,t,n,r,i){return CO(yk(e,t,i),()=>yk(e,n,i),()=>yk(e,r,i))}function WO(e,t,n){return yk(e,vE(t),n)}function GO(e,t,n,r){return AC(r)||WC(r)?J(e):CC(r)?CO(BO(e,t,r.parameters),e=>VO(e,n,r.returnType),()=>bO()):bO()}function KO(e,t,n){return Zw(n)||dT(n)?J(e):jO(e,t,n)}function qO(e,t,n){return yk(e,yE(t),n)}function JO(e,t,n){return t===n?J(e):bO()}function YO(e,t,n){return oT(n)?JO(e,t,n.const):qw(n)?J(e):jO(e,eT(t),n)}function XO(e,t,n){return oT(n)?JO(e,t,n.const):Jw(n)?J(e):jO(e,eT(t),n)}function ZO(e,t,n){return oT(n)?JO(e,t,n.const):dT(n)?J(e):jO(e,eT(t),n)}function QO(e,t,n){return oT(n)?JO(e,t,n.const):hT(n)?J(e):jO(e,eT(t),n)}function $O(e,t,n){return rx(t.const)?YO(e,t.const,n):ix(t.const)?XO(e,t.const,n):lx(t.const)?ZO(e,t.const,n):dx(t.const)?QO(e,t.const,n):sw()}function ek(e,t,n){return YC(n)?jO(e,t,n):J(e)}function tk(e,t,n){return cT(n)?J(e):jO(e,t,n)}function nk(e,t,n){return dT(n)?J(e):jO(e,t,n)}function rk(e,t,n){return IC(t)?IC(n)?J(e):bO():J(e)}function ik(e,t,n){return YC(n)&&NC(n.extends)?bO():CO(yk(e,t,n),e=>rk(e,t,n),()=>bO())}function ak(e,t){return e.reduce((e,n)=>n in t&&SO(t[n])?{...e,...t[n].inferred}:sw(),{})}function ok(e,t,n){let r={};for(let i of K(n))r[i]=i in t?ik({},t[i],n[i]):IC(n[i])?YC(n[i])?J(HS(e,{[n[i].name]:n[i].extends})):J(e):bO();let i=Px(r).every(e=>SO(e)),a=i?ak(K(r),r):{};return i?J(a):bO()}function wee(e,t,n){let r=ok(e,t,n);return SO(r)?J(HS(e,r.inferred)):bO()}function Tee(e,t,n){return wee(e,t,n)}function Eee(e,t){return K(t).reduce((n,r)=>({...n,[r]:G(e,r)?_T(n[r])?gT([...n[r].anyOf,t[r]]):gT([e[r],t[r]]):t[r]}),e)}function sk(e,t,n,r){return kx(t,(t,i)=>CO(yk({},e[t],n),t=>sk(e,i,n,Eee(r,t)),()=>bO()),()=>J(r))}function Dee(e,t,n,r){return sk(t,K(t),r,e)}function Oee(e,t,n){return ZE(n)?Dee(e,t,JE(n),XE(n)):VC(n)?Tee(e,t,n.properties):jO(e,BC(t),n)}function kee(e,t){return W(K(t).length,0)?J(e):bO()}function Aee(e,t,n,r,i){return yk(e,n,i)}function jee(e,t,n,r){return ZE(r)?Aee(e,qE(t),n,qE(JE(r)),XE(r)):VC(r)?kee(e,r.properties):AC(r)||WC(r)?J(e):bO()}function Mee(e,t,n){return hT(n)?J(e):jO(e,t,n)}function Nee(e,t,n){return pT(n)?J(e):jO(e,t,n)}function Pee(e,t,n){return yk(e,bE(t),n)}function ck(e,t){return rC({"~kind":`Inferrable`},{name:e,type:t},{})}function lk(e){return U(e)&&G(e,`~kind`)&&G(e,`name`)&&G(e,`type`)&&W(e[`~kind`],`Inferrable`)&&dx(e.name)&&U(e.type)}function uk(e){return $E(e)?YC(e.items)?_C(e.items.extends)?ck(e.items.name,e.items.extends.items):WC(e.items.extends)?ck(e.items.name,e.items.extends):void 0:sw():void 0}function dk(e){return YC(e)?ck(e.name,e.extends):void 0}function fk(e,t,n=[]){return kx(e,(e,r)=>CO(yk({},e,t),()=>fk(r,t,[...n,e]),()=>void 0),()=>n)}function Fee(e,t,n,r){let i=fk(n,r);return H(i)?J(HS(e,{[t]:zT(i)})):bO()}function pk(e,t,n,r){let i=fk(n,r);return H(i)?J(HS(e,{[t]:gT(i)})):bO()}function Iee(e){return[...e].reverse()}function mk(e,t){return t?Iee(e):e}function Lee(e){let t=e.length>0?e[0]:void 0;return sC(sC(t)?uk(t):void 0)}function Ree(e,t,n,r,i,a){return CO(yk(e,n,i),e=>hk(e,t,r,a),()=>bO())}function zee(e,t,n,r,i){let a=uk(r);return lk(a)?Fee(e,a.name,mk(n,t),a.type):kx(n,(n,a)=>Ree(e,t,n,a,r,i),()=>bO())}function Bee(e,t,n,r){return kx(r,(r,i)=>zee(e,t,n,r,i),()=>W(n.length,0)?J(e):bO())}function hk(e,t,n,r){return Bee(e,t,n,r)}function Vee(e,t,n){let r=WN(e,VN([],[]),n),i=Lee(r);return hk(e,i,mk(t,i),mk(r,i))}function gk(e,t,n){let r=dk(n);return lk(r)?pk(e,r.name,t,r.type):kx(t,(t,r)=>CO(yk(e,t,n),e=>gk(e,r,n),()=>bO()),()=>J(e))}function Hee(e,t,n){let r=WN(e,VN([],[]),t);return BT(n)?Vee(e,r,n.items):_C(n)?gk(e,r,n.items):jO(e,zT(r),n)}function Uee(e,t,n){return rD(n)||nD(n)?J(e):jO(e,t,n)}function _k(e,t,n){return kx(n,(n,r)=>CO(yk(e,t,n),e=>J(e),()=>_k(e,t,r)),()=>bO())}function vk(e,t,n){return kx(t,(t,r)=>CO(_k(e,t,n),e=>vk(e,r,n),()=>bO()),()=>J(e))}function Wee(e,t,n){let r=dk(n);return lk(r)?pk(e,r.name,t,r.type):_T(n)?vk(e,t,n.anyOf):vk(e,t,[n])}function Gee(e,t,n){return YC(n)?jO(e,t,n):AC(n)||WC(n)?J(e):bO()}function Kee(e,t,n){return rD(n)?J(e):jO(e,t,n)}function yk(e,t,n){return AC(t)?MO(e,t,n):_C(t)?PO(e,t,t.items,n):qw(t)?FO(e,t,n):Jw(t)?IO(e,t,n):bC(t)?HO(e,t.parameters,t.instanceType,n):ZC(t)?UO(e,t.if,t.then,t.else,n):$C(t)?WO(e,t.enum,n):CC(t)?GO(e,t.parameters,t.returnType,n):Zw(t)?KO(e,t,n):tw(t)?qO(e,t.allOf,n):oT(t)?$O(e,t,n):NC(t)?ek(e,t,n):cT(t)?tk(e,t,n):dT(t)?nk(e,t,n):VC(t)?Oee(e,t.properties,n):ZE(t)?jee(e,JE(t),XE(t),n):hT(t)?Mee(e,t,n):pT(t)?Nee(e,t,n):gO(t)?Pee(e,t.pattern,n):BT(t)?Hee(e,t.items,n):nD(t)?Uee(e,t,n):_T(t)?Wee(e,t.anyOf,n):WC(t)?Gee(e,t,n):rD(t)?Kee(e,t,n):bO()}function qee(e,t){return yE([...e,BC(t)])}function Jee(e,t,n){return HN(e)?aC(qee(e,t),{},n):Xee(e,t,n)}function Yee(e,t,n,r,i){return Jee(GN(e,t,n),UN(e,t,r),i)}function Xee(e,t,n={}){return cC(`Interface`,[e,t],n)}function bk(e){return sC(e)&&G(e,`action`)&&W(e.action,`Interface`)}function Zee(e,t,n){return e.includes(n)?!0:Ck([...e,n],t,t[n])}function xk(e,t,n){return Sk(e,t,zC(n))}function Sk(e,t,n){return kx(n,(n,r)=>Ck(e,t,n)?!0:Sk(e,t,r),()=>!1)}function Ck(e,t,n){return EC(n)?Zee(e,t,n.$ref):_C(n)?Ck(e,t,n.items):bC(n)?Sk(e,t,[...n.parameters,n.instanceType]):CC(n)?Sk(e,t,[...n.parameters,n.returnType]):bk(n)?xk(e,t,n.parameters[1]):tw(n)?Sk(e,t,n.allOf):VC(n)?xk(e,t,n.properties):_T(n)?Sk(e,t,n.anyOf):BT(n)?Sk(e,t,n.items):ZE(n)?Ck(e,t,XE(n)):!1}function Qee(e,t,n){return Ck(e,t,n)}function $ee(e,t){return t.reduce((t,n)=>Qee([n],e,e[n])?[...t,n]:t,[])}function ete(e){return $ee(e,RC(e))}function tte(e,t,n){return n.includes(t)?n:t in e?Ek(e,e[t],[...n,t]):sw()}function wk(e,t,n){return Tk(e,zC(t),n)}function Tk(e,t,n){return t.reduce((t,n)=>Ek(e,n,t),n)}function Ek(e,t,n){return EC(t)?tte(e,t.$ref,n):_C(t)?Ek(e,t.items,n):bC(t)?Tk(e,[...t.parameters,t.instanceType],n):CC(t)?Tk(e,[...t.parameters,t.returnType],n):bk(t)?wk(e,t.parameters[1],n):tw(t)?Tk(e,t.allOf,n):VC(t)?wk(e,t.properties,n):_T(t)?Tk(e,t.anyOf,n):BT(t)?Tk(e,t.items,n):ZE(t)?Ek(e,XE(t),n):n}function nte(e,t,n){return Ek(e,n,[t])}function rte(e){return kC()}function ite(e){return K(e).reduce((t,n)=>({...t,[n]:Ok(e[n])}),{})}function Dk(e){return e.reduce((e,t)=>[...e,Ok(t)],[])}function Ok(e){return EC(e)?rte(e.$ref):_C(e)?gC(Ok(e.items),vC(e)):bC(e)?yC(Dk(e.parameters),Ok(e.instanceType)):CC(e)?SC(Dk(e.parameters),Ok(e.returnType)):tw(e)?ew(Dk(e.allOf)):VC(e)?BC(ite(e.properties)):ZE(e)?GE(YE(e),Ok(XE(e))):_T(e)?gT(Dk(e.anyOf)):BT(e)?zT(Dk(e.items)):e}function ate(e,t){return t in e?Ok(e[t]):UC()}function ote(e){return ate(e.$defs,e.$ref)}function kk(e,t,n){let r=GN(e,VN([],[]),t),i=UN({},VN([],[]),n);return yE([...r,BC(i)])}function Ak(e,t){return K(e).filter(e=>t.includes(e)).reduce((t,n)=>{let r=e[n],i=bk(r)?kk(e,r.parameters[0],r.parameters[1]):r;return{...t,[n]:i}},{})}function jk(e,t,n){return GC(Ak(e,nte(e,t,n)),t)}function Mk(e,t){return t in e?EC(e[t])?Mk(e,e[t].$ref):e[t]:MC()}function Nk(e,t){return Mk(e,t)}function Pk(e){return KC(e)?ote(e):qC(e)?UC():e}function Fk(e,t,n){return yk(e,Pk(t),Pk(n))}function Ik(e,t){let n=[Fk({},e,t),Fk({},t,e)];return SO(n[0])&&SO(n[1])?0:SO(n[0])&&xO(n[1])?2:xO(n[0])&&SO(n[1])?3:1}function Lk(e,t,n=[],r=t){return kx(t,(t,i)=>{let a=Ik(e,t);return W(a,2)||W(a,0)?r:W(a,1)?Lk(e,i,[...n,t],r):Lk(e,i,n,r)},()=>[...n,e])}function Rk(e,t,n){let r=SE(e);return AC(r)||WC(r)?[r]:NC(r)?zk(t,n):VC(r)?zk(t,[...n,r]):zk(t,Lk(r,n))}function zk(e,t=[]){return kx(e,(e,n)=>Rk(e,n,t),()=>t)}function Bk(e){return ME(zk(e))}function Vk(e,t){return aC(SE(e),{},t)}function Hk(e,t,n,r){return Vk(Y(e,t,n),r)}function Uk(e,t=[]){return lC(e)&&W(e.action,`Conditional`)?EC(e.parameters[0])?Uk(e.parameters[2],Uk(e.parameters[3],[...t,e.parameters[0].$ref])):Uk(e.parameters[2],Uk(e.parameters[3],t)):lC(e)&&W(e.action,`Mapped`)&&lC(e.parameters[1])&&W(e.parameters[1].action,`KeyOf`)&&EC(e.parameters[1].parameters[0])?[...t,e.parameters[1].parameters[0].$ref]:t}function Wk(e,t){return e.reduce((e,n)=>[...e,t.includes(n.name)],[])}function Gk(e,t,n=[]){return kx(e,(e,r)=>kx(t,(t,i)=>Gk(r,i,[...n,[t,e]]),()=>n),()=>n)}function Kk(e){return gO(e)?bE(e.pattern):$C(e)?vE(e.enum):e}function qk(e){let t=Kk(e);return _T(t)?[...t.anyOf]:[t]}function Jk(e,t){return e.reduce((e,n)=>[...e,[...n,t]],[])}function Yk(e,t){return t.reduce((t,n)=>[...t,...Jk(e,n)],[])}function Xk(e){return e.reduce((e,t)=>W(t[0],!0)?Yk(e,qk(t[1])):Yk(e,[t[1]]),[[]])}function Zk(e,t,n){let r=Gk(t,Wk(e,Uk(n)));return lC(n)&&W(n.action,`Conditional`)||lC(n)&&W(n.action,`Mapped`)?Xk(r):[t]}function Qk(){return[`(not-resolvable)`,MC()]}function $k(){return[`(not-generic)`,MC()]}function eA(e,t,n){return[e,DC(t,n)]}function tA(e,t,n){return t in e?nA(e,t,e[t],n):Qk()}function nA(e,t,n,r){return OC(n)?eA(t,n.parameters,n.expression):EC(n)?tA(e,n.$ref,r):$k()}function rA(e,t,n){return nA(e,`(anonymous)`,t,n)}function iA(e,t,n){if(YC(t)||xA(t)||SO(Fk({},t,n)))return;let r={parameter:e,expect:n,actual:t};throw Error(`Argument for parameter ${e} does not satisfy constraint`,{cause:r})}function aA(e,t,n,r,i){let a=Y(e,t,i);return iA(n,a,r),HS(e,{[n]:a})}function oA(e,t,n,r,i){let a=Y(e,t,n.extends),o=Y(e,t,n.equals);return kx(i,(i,o)=>sA(aA(e,t,n.name,a,i),t,r,o),()=>sA(aA(e,t,n.name,a,o),t,r,[]))}function sA(e,t,n,r){return kx(n,(n,i)=>oA(e,t,n,i,r),()=>e)}function cA(e,t,n,r){return sA(e,t,n,r)}var lA=0,uA=0;function dA(){if(!hx(uA,BS().maxInstantiationCount))throw Error(`Type instantiation is excessively deep and possibly infinite`)}function fA(){dA(),uA++,lA++}function pA(){lA--,W(lA,0)&&(uA=0)}function mA(e){return mx(e.callstack.length,0)?e.callstack[e.callstack.length-1]:``}function hA(e,t){return W(mA(e),t)}function gA(e,t,n,r,i,a){fA();try{let o=cA(e,t,r,a),s=Y(o,VN([...t.callstack,n.$ref],t.visited),i);return Y(o,VN([],[]),s)}finally{pA()}}function _A(e,t,n,r,i,a){return a.reduce((a,o)=>{let s=gA(e,t,n,r,i,o);return[...a,s]},[])}function vA(e,t,n,r,i,a){let o=_A(e,t,n,r,i,Zk(r,a,i));return W(o.length,1)?o[0]:xE(o)}function yA(e,t,n,r){let i=GN(e,t,r),a=rA(e,n,r),o=a[0],s=a[1];return OC(s)?hA(t,o)?bA(TC(o),i):vA(e,t,TC(o),s.parameters,s.expression,i):bA(n,i)}function bA(e,t){return rC({"~kind":`Call`},{type:`call`,target:e,arguments:t},{})}function xA(e){return oC(e,`Call`)}function SA(e){return iC(e,[`~immutable`])}function CA(e,t){return aC(SA(e),{},t)}function wA(e,t,n,r){return CA(Y(e,t,n),r)}function TA(e,t){return e(t)}function EA(e,t){return dx(t)?eT(TA(e,t)):eT(t)}function DA(e,t){return kA(e,bE(t))}function OA(e,t){return gT(t.map(t=>kA(e,t)))}function kA(e,t){return oT(t)?EA(e,t.const):gO(t)?DA(e,t.pattern):_T(t)?OA(e,t.anyOf):t}function AA(e,t={}){return cC(`Capitalize`,[e],t)}function jA(e,t={}){return cC(`Lowercase`,[e],t)}function MA(e,t={}){return cC(`Uncapitalize`,[e],t)}function NA(e,t={}){return cC(`Uppercase`,[e],t)}var PA=e=>e[0].toUpperCase()+e.slice(1),FA=e=>e.toLowerCase(),IA=e=>e[0].toLowerCase()+e.slice(1),LA=e=>e.toUpperCase();function RA(e,t){return HN([e])?aC(kA(PA,e),{},t):AA(e,t)}function zA(e,t){return HN([e])?aC(kA(FA,e),{},t):jA(e,t)}function BA(e,t){return HN([e])?aC(kA(IA,e),{},t):MA(e,t)}function VA(e,t){return HN([e])?aC(kA(LA,e),{},t):NA(e,t)}function HA(e,t,n,r){return RA(Y(e,t,n),r)}function UA(e,t,n,r){return zA(Y(e,t,n),r)}function WA(e,t,n,r){return BA(Y(e,t,n),r)}function GA(e,t,n,r){return VA(Y(e,t,n),r)}function KA(e,t,n,r,i={}){return cC(`Conditional`,[e,t,n,r],i)}function qA(e,t,n,r,i,a){let o=Fk(e,n,r);return vO(o)?gT([Y(o.inferred,t,i),Y(e,t,a)]):yO(o)?Y(o.inferred,t,i):Y(e,t,a)}function JA(e,t,n,r,i,a,o){return HN([n,r])?aC(qA(e,t,n,r,i,a),{},o):KA(n,r,i,a,o)}function YA(e,t,n,r,i,a,o){return JA(e,t,Y(e,t,n),Y(e,t,r),i,a,o)}function XA(e,t={}){return cC(`ConstructorParameters`,[e],t)}function ZA(e){let t=bC(e)?e.parameters:[];return zT(WN({},VN([],[]),t))}function QA(e,t){return HN([e])?aC(ZA(e),{},t):XA(e,t)}function $A(e,t,n,r){return QA(Y(e,t,n),r)}function ej(e,t,n={}){return cC(`Exclude`,[e,t],n)}function tj(e,t,n){return HN([e,t])?aC(gE(e,t),{},n):ej(e,t,n)}function nj(e,t,n,r,i){return tj(Y(e,t,n),Y(e,t,r),i)}function rj(e,t,n={}){return cC(`Extract`,[e,t],n)}function ij(e,t){return SO(Fk({},e,t))?[e]:[]}function aj(e,t,n=[]){return kx(e,(e,r)=>aj(r,t,[...n,...ij(e,t)]),()=>n)}function oj(e,t){let n=SE(e);return xE(aj(_T(n)?n.anyOf:[n],t))}function sj(e,t,n){return HN([e,t])?aC(oj(e,t),{},n):rj(e,t,n)}function cj(e,t,n,r,i){return sj(Y(e,t,n),Y(e,t,r),i)}function lj(e,t,n={}){return cC(`Index`,[e,t],n)}function uj(e,t){return yj(Nk(e,t))}function dj(e,t,n){return yj(_E(e,t,n))}function fj(e,t){let n=K(e).filter(e=>!G(t,e)),r=K(t).filter(t=>!G(e,t)),i=K(e).filter(e=>G(t,e)),a=n.reduce((t,n)=>({...t,[n]:e[n]}),{}),o=r.reduce((e,n)=>({...e,[n]:t[n]}),{}),s=i.reduce((n,r)=>({...n,[r]:yE([e[r],t[r]])}),{});return HS(HS(a,o),s)}function pj(e){return e.reduce((e,t)=>fj(e,yj(t)),{})}function mj(e){return e}function hj(e){return yj(ZT(zT(e)))}function gj(e,t){return K(e).filter(e=>e in t).reduce((n,r)=>({...n,[r]:xE([e[r],t[r]])}),{})}function _j(e,t){return kx(e,(e,n)=>_j(n,gj(t,yj(e))),()=>t)}function vj(e){return kx(e,(e,t)=>_j(t,yj(e)),()=>sw())}function yj(e){return KC(e)?uj(e.$defs,e.$ref):ZC(e)?dj(e.if,e.then,e.else):tw(e)?pj(e.allOf):_T(e)?vj(e.anyOf):BT(e)?hj(e.items):VC(e)?mj(e.properties):{}}function bj(e){return BC(yj(e))}var xj=RegExp(`^(?:0|[1-9][0-9]*)$`);function Sj(e){let t=`${e}`;return xj.test(t)?parseInt(t):e}function Cj(e){return eT(Sj(e))}function wj(e){return e.map(e=>Tj(e))}function Tj(e){return tw(e)?ew(wj(e.allOf)):_T(e)?gT(wj(e.anyOf)):oT(e)?Cj(e.const):e}function Ej(e,t){return SO(Fk({},Tj(t),uT()))?e:oT(t)&&W(t.const,`length`)?uT():MC()}function Dj(e,t){return Pj(Nk(e,t))}function Oj(e,t,n){return Pj(_E(e,t,n))}function kj(e){return Pj(vE(e))}function Aj(e){return Pj(yE(e))}function jj(e){return[`${e}`]}function Mj(e){return Pj(bE(e))}function Nj(e){return e.reduce((e,t)=>[...e,...Pj(t)],[])}function Pj(e){return KC(e)?Dj(e.$defs,e.$ref):ZC(e)?Oj(e.if,e.then,e.else):$C(e)?kj(e.enum):tw(e)?Aj(e.allOf):oT(e)?jj(e.const):gO(e)?Mj(e.pattern):_T(e)?Nj(e.anyOf):[]}function Fj(e){return Pj(e)}function Ij(e,t){return t.map(t=>Lj(e,t))}function Lj(e,t){return _C(t)?gC(Lj(e,t.items)):bC(t)?yC(Ij(e,t.parameters),Lj(e,t.instanceType)):CC(t)?SC(Ij(e,t.parameters),Lj(e,t.returnType)):BT(t)?zT(Ij(e,t.items)):_T(t)?gT(Ij(e,t.anyOf)):tw(t)?ew(Ij(e,t.allOf)):eD(t)?BC(e):t}function Rj(e,t){return Lj(e,t)}function zj(e,t){return Rj(e,t in e?e[t]:MC())}function Bj(e,t){return t.reduce((t,n)=>[...t,zj(e,n)],[])}function Vj(e,t){return xE(Bj(e,Fj(t)))}var Hj=new RegExp(VE);function Uj(e){return e.filter(e=>Hj.test(e))}function Wj(e){return xE(Bj(e,Uj(RC(e))))}function Gj(e,t){return dT(t)?Wj(e):Vj(e,t)}function Kj(e){return eT(Sj(e))}function qj(e){return e.map(e=>Jj(e))}function Jj(e){return tw(e)?ew(qj(e.allOf)):_T(e)?gT(qj(e.anyOf)):oT(e)?Kj(e.const):e}function Yj(e,t){return e.reduceRight((e,n,r)=>SO(Fk({},eT(r),t))?[n,...e]:e,[])}function Xj(e,t){return CE(Yj(e,Jj(t)))}function Zj(e){return CE(e)}function Qj(e,t){return oT(t)&&W(t.const,`length`)?eT(e.length):dT(t)||Zw(t)?Zj(e):Xj(e,t)}function $j(e,t){return _C(e)?Ej(e.items,t):VC(e)?Gj(e.properties,t):BT(e)?Qj(e.items,t):MC()}function eM(e){return KC(e)||ZC(e)||tw(e)||_T(e)?bj(e):e}function tM(e,t,n){return HN([e,t])?aC($j(eM(e),t),{},n):lj(e,t,n)}function nM(e,t,n,r,i){return tM(Y(e,t,n),Y(e,t,r),i)}function rM(e,t={}){return cC(`InstanceType`,[e],t)}function iM(e){return bC(e)?e.instanceType:MC()}function aM(e,t){return HN([e])?aC(iM(e),{},t):rM(e,t)}function oM(e,t,n,r={}){return aM(Y(e,t,n),r)}function sM(e,t={}){return cC(`KeyOf`,[e],t)}function cM(){return gT([uT(),mT(),fT()])}function lM(e){return uT()}function uM(e){return e.reduce((e,t)=>tT(t)?[...e,eT(Sj(t))]:sw(),[])}function dM(e){return CE(uM(K(e)))}function fM(e){return YE(e)}function pM(e){return CE(e.map((e,t)=>eT(t)))}function mM(e){return AC(e)?cM():_C(e)?lM(e.items):VC(e)?dM(e.properties):ZE(e)?fM(e):BT(e)?pM(e.items):MC()}function hM(e){return KC(e)||ZC(e)||tw(e)||_T(e)?bj(e):e}function gM(e,t){return HN([e])?aC(mM(hM(e)),{},t):sM(e,t)}function _M(e,t,n,r){return gM(Y(e,t,n),r)}function vM(e,t,n,r,i={}){return cC(`Mapped`,[e,t,n,r],i)}function yM(e){return CM(bE(e))}function bM(e){return e.reduce((e,t)=>[...e,...CM(t)],[])}function xM(e){return CM(vE(e))}function SM(e){return lx(e)?[eT(`${e}`)]:[eT(e)]}function CM(e){return $C(e)?xM(e.enum):oT(e)?SM(e.const):gO(e)?yM(e.pattern):_T(e)?bM(e.anyOf):[e]}function wM(e){return CM(e)}function TM(e){return gO(e)?bE(e.pattern):e}function EM(e,t,n,r,i,a){let o=HS(e,{[n.name]:r}),s=TM(Y(o,t,i)),c=Y(o,t,a);return iT(s)||aT(s)?{[s.const]:c}:{}}function DM(e,t,n,r,i,a){return r.reduce((r,o)=>[...r,EM(e,t,n,o,i,a)],[])}function OM(e){return e.reduce((e,t)=>[...e,BC(t)],[])}function kM(e,t,n,r,i,a){return yE(OM(DM(e,t,n,wM(r),i,a)))}function AM(e,t,n,r,i,a,o){return HN([r])?aC(kM(e,t,n,r,i,a),{},o):vM(n,r,i,a,o)}function jM(e,t,n,r,i,a,o){return AM(e,t,n,Y(e,t,r),i,a,o)}function MM(e,t,n){let r=HS(e,t);return K(t).filter(e=>n.includes(e)).reduce((e,n)=>({...e,[n]:jk(r,n,t[n])}),{})}function NM(e,t,n){let r=HS(e,t);return K(t).filter(e=>!n.includes(e)).reduce((e,n)=>({...e,[n]:Y(r,VN([],[]),t[n])}),{})}function PM(e,t,n){let r=ete(t),i=MM(e,t,r),a=NM(e,t,r);return aC({...i,...a},{},n)}function FM(e,t,n,r){return PM(e,n,r)}function IM(e,t={}){return cC(`NonNullable`,[e],t)}function LM(e){return tj(e,gT([sT(),tD()]),{})}function RM(e,t){return HN([e])?aC(LM(e),{},t):IM(e,t)}function zM(e,t,n,r){return RM(Y(e,t,n),r)}function BM(e,t,n={}){return cC(`Omit`,[e,t],n)}function VM(e){let t=bj(e);return VC(t)?t.properties:sw()}function HM(e,t){return K(e).reduce((n,r)=>t.includes(r)?n:{...n,[r]:e[r]},{})}function UM(e,t){return BC(HM(VM(e),Fj(t)))}function WM(e,t,n){return HN([e,t])?aC(UM(e,t),{},n):BM(e,t,n)}function GM(e,t,n,r,i){return WM(Y(e,t,n),Y(e,t,r),i)}function KM(e,t={}){return cC(`Parameters`,[e],t)}function qM(e){let t=CC(e)?e.parameters:[];return zT(WN({},VN([],[]),t))}function JM(e,t){return HN([e])?aC(qM(e),{},t):KM(e,t)}function YM(e,t,n,r){return JM(Y(e,t,n),r)}function XM(e,t={}){return cC(`Partial`,[e],t)}function ZM(e,t){let n=nN(Nk(e,t));return GC(HS(e,{[t]:n}),t)}function QM(e,t,n){return nN(_E(e,t,n))}function $M(e){return nN(yE(e))}function eN(e){return gT(e.map(e=>nN(e)))}function tN(e){return BC(K(e).reduce((t,n)=>({...t,[n]:PC(e[n])}),{}))}function nN(e){return KC(e)?ZM(e.$defs,e.$ref):ZC(e)?QM(e.if,e.then,e.else):tw(e)?$M(e.allOf):_T(e)?eN(e.anyOf):VC(e)?tN(e.properties):BC({})}function rN(e,t){return HN([e])?aC(nN(e),{},t):XM(e,t)}function iN(e,t,n,r){return rN(Y(e,t,n),r)}function aN(e,t,n={}){return cC(`Pick`,[e,t],n)}function oN(e,t){return K(e).reduce((n,r)=>t.includes(r)?HS(n,{[r]:e[r]}):n,{})}function sN(e,t){return BC(oN(VM(e),Fj(t)))}function cN(e,t,n){return HN([e,t])?aC(sN(e,t),{},n):aN(e,t,n)}function lN(e,t,n,r,i){return cN(Y(e,t,n),Y(e,t,r),i)}function uN(e,t={}){return cC(`ReadonlyObject`,[e],t)}function dN(e){return $N(gC(e))}function fN(e,t){let n=vN(Nk(e,t));return GC(HS(e,{[t]:n}),t)}function pN(e,t,n){return vN(_E(e,t,n))}function mN(e){return vN(yE(e))}function hN(e){return BC(K(e).reduce((t,n)=>({...t,[n]:Uw(e[n])}),{}))}function gN(e){return $N(zT(e))}function _N(e){return gT(e.map(e=>vN(e)))}function vN(e){return _C(e)?dN(e.items):KC(e)?fN(e.$defs,e.$ref):ZC(e)?pN(e.if,e.then,e.else):tw(e)?mN(e.allOf):VC(e)?hN(e.properties):BT(e)?gN(e.items):_T(e)?_N(e.anyOf):e}function yN(e,t){return HN([e])?aC(vN(e),{},t):uN(e)}function bN(e,t,n,r){return yN(Y(e,t,n),r)}function xN(e,t,n,r){return t.visited.includes(r)?n:r in e?Y(e,VN(t.callstack,[...t.visited,r]),e[r]):n}function SN(e,t){let n=DN(Nk(e,t));return GC(HS(e,{[t]:n}),t)}function CN(e,t,n){return DN(_E(e,t,n))}function wN(e){return DN(yE(e))}function TN(e){return gT(e.map(e=>DN(e)))}function EN(e){return BC(K(e).reduce((t,n)=>({...t,[n]:YT(e[n])}),{}))}function DN(e){return KC(e)?SN(e.$defs,e.$ref):ZC(e)?CN(e.if,e.then,e.else):tw(e)?wN(e.allOf):_T(e)?TN(e.anyOf):VC(e)?EN(e.properties):BC({})}function ON(e,t={}){return cC(`Required`,[e],t)}function kN(e,t){return HN([e])?aC(DN(e),{},t):ON(e,t)}function AN(e,t,n,r){return kN(Y(e,t,n),r)}function jN(e,t={}){return cC(`ReturnType`,[e],t)}function MN(e){return CC(e)?e.returnType:MC()}function NN(e,t){return HN([e])?aC(MN(e),{},t):jN(e,t)}function PN(e,t,n,r={}){return NN(Y(e,t,n),r)}function FN(e,t){return cC(`With`,[e,t],{})}function IN(e,t){return LN(e,t)}function LN(e,t){return HN([e])?aC(e,{},t):FN(e,t)}function RN(e,t,n,r){return LN(Y(e,t,n),r)}function zN(e){return $E(e)?BT(e.items)?BN(e.items.items):YC(e.items)||EC(e.items)?[e]:[MC()]:[e]}function BN(e){return e.reduce((e,t)=>[...e,...zN(t)],[])}function VN(e,t){return{callstack:e,visited:t}}function HN(e){return kx(e,(e,t)=>!EC(e)&&HN(t),()=>!0)}function UN(e,t,n){return K(n).reduce((r,i)=>({...r,[i]:Y(e,t,n[i])}),{})}function WN(e,t,n){return BN(GN(e,t,n))}function GN(e,t,n){return n.map(n=>Y(e,t,n))}function KN(e,t){let n=IC(e)?mC(t,{}):t,r=Ww(e)?dC(n,{}):n;return Hw(e)?ZN(r,{}):r}function qN(e,t,n,r,i){return W(n,`AddImmutable`)?QN(e,t,r[0],i):W(n,`RemoveImmutable`)?wA(e,t,r[0],i):W(n,`AddReadonly`)?fC(e,t,r[0],i):W(n,`RemoveReadonly`)?WT(e,t,r[0],i):W(n,`AddOptional`)?hC(e,t,r[0],i):W(n,`RemoveOptional`)?JT(e,t,r[0],i):W(n,`Capitalize`)?HA(e,t,r[0],i):W(n,`Conditional`)?YA(e,t,r[0],r[1],r[2],r[3],i):W(n,`ConstructorParameters`)?$A(e,t,r[0],i):W(n,`Evaluate`)?Hk(e,t,r[0],i):W(n,`Exclude`)?nj(e,t,r[0],r[1],i):W(n,`Extract`)?cj(e,t,r[0],r[1],i):W(n,`Index`)?nM(e,t,r[0],r[1],i):W(n,`InstanceType`)?oM(e,t,r[0],i):W(n,`Interface`)?Yee(e,t,r[0],r[1],i):W(n,`KeyOf`)?_M(e,t,r[0],i):W(n,`Lowercase`)?UA(e,t,r[0],i):W(n,`Mapped`)?jM(e,t,r[0],r[1],r[2],r[3],i):W(n,`Module`)?FM(e,t,r[0],i):W(n,`NonNullable`)?zM(e,t,r[0],i):W(n,`Pick`)?lN(e,t,r[0],r[1],i):W(n,`Parameters`)?YM(e,t,r[0],i):W(n,`Partial`)?iN(e,t,r[0],i):W(n,`Omit`)?GM(e,t,r[0],r[1],i):W(n,`ReadonlyObject`)?bN(e,t,r[0],i):W(n,`Record`)?BE(e,t,r[0],r[1],i):W(n,`Required`)?AN(e,t,r[0],i):W(n,`ReturnType`)?PN(e,t,r[0],i):W(n,`TemplateLiteral`)?pO(e,t,r[0],i):W(n,`Uncapitalize`)?WA(e,t,r[0],i):W(n,`Uppercase`)?GA(e,t,r[0],i):W(n,`With`)?RN(e,t,r[0],r[1]):cC(n,r,i)}function JN(e,t,n){return KN(n,EC(n)?xN(e,t,n,n.$ref):_C(n)?gC(Y(e,t,n.items),vC(n)):xA(n)?yA(e,t,n.target,n.arguments):bC(n)?yC(GN(e,t,n.parameters),Y(e,t,n.instanceType),xC(n)):CC(n)?SC(GN(e,t,n.parameters),Y(e,t,n.returnType),wC(n)):ZC(n)?XC(Y(e,t,n.if),Y(e,t,n.then),Y(e,t,n.else),QC(n)):tw(n)?ew(GN(e,t,n.allOf),nw(n)):VC(n)?BC(UN(e,t,n.properties),HC(n)):ZE(n)?KE(JE(n),Y(e,t,XE(n))):$E(n)?QE(Y(e,t,n.items)):BT(n)?zT(WN(e,t,n.items),VT(n)):_T(n)?gT(GN(e,t,n.anyOf),vT(n)):n)}function Y(e,t,n){return lC(n)?qN(e,t,n.action,n.parameters,n.options):JN(e,t,n)}function YN(e,t){return Y(e,VN([],[]),t)}function XN(e){return aC(e,{"~immutable":!0},{})}function ZN(e,t){return aC(XN(e),{},t)}function QN(e,t,n,r){return ZN(Y(e,t,n),r)}function $N(e,t={}){return ZN(e,t)}function eP(e,t={}){return Vk(e,t)}function tP(e,t){let n=Ik(e,t);return W(n,3)?1:+!!W(n,1)}function nP(e,t,n=[]){return kx(t,(r,i)=>W(tP(e,r),1)?nP(e,i,[...n,r]):[...n,e,...t],()=>[...n,e])}function rP(e,t=[]){return kx(e,(e,n)=>rP(n,nP(e,t)),()=>t)}function iP(e){return rP(e)}function aP(e){return G(e,`~refine`)&&H(e[`~refine`])&&wx(e[`~refine`],0,e=>U(e)&&G(e,`check`)&&G(e,`error`)&&ox(e.check)&&ox(e.error))}function oP(e){return U(e)&&!H(e)}function sP(e){return ix(e)}function cP(e){return oP(e)||sP(e)}function lP(e){return G(e,`additionalItems`)&&cP(e.additionalItems)}function uP(e){return G(e,`additionalProperties`)&&cP(e.additionalProperties)}function dP(e){return G(e,`allOf`)&&H(e.allOf)&&e.allOf.every(e=>cP(e))}function fP(e){return G(e,`$anchor`)&&dx(e.$anchor)}function pP(e){return G(e,`anyOf`)&&H(e.anyOf)&&e.anyOf.every(e=>cP(e))}function mP(e){return G(e,`const`)}function hP(e){return G(e,`contains`)&&cP(e.contains)}function gP(e){return G(e,`default`)}function _P(e){return G(e,`dependencies`)&&U(e.dependencies)&&Object.values(e.dependencies).every(e=>cP(e)||H(e)&&e.every(e=>dx(e)))}function vP(e){return G(e,`dependentRequired`)&&U(e.dependentRequired)&&Object.values(e.dependentRequired).every(e=>H(e)&&e.every(e=>dx(e)))}function yP(e){return G(e,`dependentSchemas`)&&U(e.dependentSchemas)&&Object.values(e.dependentSchemas).every(e=>cP(e))}function bP(e){return G(e,`$dynamicAnchor`)&&dx(e.$dynamicAnchor)}function xP(e){return G(e,`$dynamicRef`)&&dx(e.$dynamicRef)}function SP(e){return G(e,`else`)&&cP(e.else)}function CP(e){return G(e,`enum`)&&H(e.enum)}function wP(e){return G(e,`exclusiveMaximum`)&&(lx(e.exclusiveMaximum)||rx(e.exclusiveMaximum))}function TP(e){return G(e,`exclusiveMinimum`)&&(lx(e.exclusiveMinimum)||rx(e.exclusiveMinimum))}function EP(e){return G(e,`format`)&&dx(e.format)}function DP(e){return G(e,`$id`)&&dx(e.$id)}function OP(e){return G(e,`if`)&&cP(e.if)}function kP(e){return G(e,`items`)&&(cP(e.items)||H(e.items)&&e.items.every(e=>cP(e)))}function AP(e){return kP(e)&&H(e.items)}function jP(e){return G(e,`maximum`)&&(lx(e.maximum)||rx(e.maximum))}function MP(e){return G(e,`maxContains`)&&lx(e.maxContains)}function NP(e){return G(e,`maxItems`)&&lx(e.maxItems)}function PP(e){return G(e,`maxLength`)&&lx(e.maxLength)}function FP(e){return G(e,`maxProperties`)&&lx(e.maxProperties)}function IP(e){return G(e,`minimum`)&&(lx(e.minimum)||rx(e.minimum))}function LP(e){return G(e,`minContains`)&&lx(e.minContains)}function RP(e){return G(e,`minItems`)&&lx(e.minItems)}function zP(e){return G(e,`minLength`)&&lx(e.minLength)}function BP(e){return G(e,`minProperties`)&&lx(e.minProperties)}function VP(e){return G(e,`multipleOf`)&&(lx(e.multipleOf)||rx(e.multipleOf))}function HP(e){return G(e,`not`)&&cP(e.not)}function UP(e){return G(e,`oneOf`)&&H(e.oneOf)&&e.oneOf.every(e=>cP(e))}function WP(e){return G(e,`pattern`)&&(dx(e.pattern)||e.pattern instanceof RegExp)}function GP(e){return G(e,`patternProperties`)&&U(e.patternProperties)&&Object.values(e.patternProperties).every(e=>cP(e))}function KP(e){return G(e,`prefixItems`)&&H(e.prefixItems)&&e.prefixItems.every(e=>cP(e))}function qP(e){return G(e,`properties`)&&U(e.properties)&&Object.values(e.properties).every(e=>cP(e))}function JP(e){return G(e,`propertyNames`)&&(U(e.propertyNames)||cP(e.propertyNames))}function YP(e){return G(e,`$recursiveAnchor`)&&ix(e.$recursiveAnchor)}function XP(e){return YP(e)&&W(e.$recursiveAnchor,!0)}function ZP(e){return G(e,`$recursiveRef`)&&dx(e.$recursiveRef)}function QP(e){return G(e,`$ref`)&&dx(e.$ref)}function $P(e){return G(e,`required`)&&H(e.required)&&e.required.every(e=>dx(e))}function eF(e){return G(e,`then`)&&cP(e.then)}function tF(e){return G(e,`type`)&&(dx(e.type)||H(e.type)&&e.type.every(e=>dx(e)))}function nF(e){return G(e,`uniqueItems`)&&ix(e.uniqueItems)}function rF(e){return G(e,`unevaluatedItems`)&&cP(e.unevaluatedItems)}function iF(e){return G(e,`unevaluatedProperties`)&&cP(e.unevaluatedProperties)}function aF(e){return rF(e)||iF(e)||Ex(K(e),t=>sF(e[t]))}function oF(e){return Ex(e,e=>sF(e))}function sF(e){return H(e)?oF(e):U(e)?aF(e):!1}function cF(e,t){return sF(t)||Ex(K(e),t=>sF(e[t]))}var lF=class{constructor(e){this.hasUnevaluated=e}UseUnevaluated(){return this.hasUnevaluated}Push(){return yS(xS(`context`,`Push`),[])}Pop(){return yS(xS(`context`,`Pop`),[])}AddIndex(e){return yS(xS(`context`,`AddIndex`),[e])}AddKey(e){return yS(xS(`context`,`AddKey`),[e])}Merge(e){return yS(xS(`context`,`Merge`),[e])}},uF=class{constructor(){let e=new Set,t=new Set;this.stack=[{indices:e,keys:t}]}Push(){let e=new Set,t=new Set;return this.stack.push({indices:e,keys:t}),!0}Pop(){return this.stack.pop(),!0}AddIndex(e){return this.GetIndices().add(e),!0}AddKey(e){return this.GetKeys().add(e),!0}GetIndices(){return this.stack[this.stack.length-1].indices}GetKeys(){return this.stack[this.stack.length-1].keys}Merge(e){for(let t of e)t.GetIndices().forEach(e=>this.GetIndices().add(e)),t.GetKeys().forEach(e=>this.GetKeys().add(e));return!0}},dF=class extends uF{constructor(){super(),this.errors=[]}AtCapacity(){return this.errors.length>=BS().maxErrors}AddError(e){return this.AtCapacity()||this.errors.push(e),!1}GetErrors(){return this.errors}},fF={identifier:`External`,variables:[]};function pF(e){let t=`External[${fF.variables.length}]`;return fF.variables.push(e),t}function mF(){fF.variables=[]}function hF(){return{...fF}}function gF(e,t,n,r){return lS(pF(n[`~refine`].map(e=>e)),q(0),[`refinement`,`_`],yS(xS(`refinement`,`check`),[r]))}function _F(e,t,n,r){return wx(n[`~refine`],0,(e,t)=>e.check(r))}function vF(e,t,n,r,i,a){return Tx(i[`~refine`],0,(e,i)=>e.check(a)||t.AddError({keyword:`~refine`,schemaPath:n,instancePath:r,params:{index:i,message:e.error(a)}}))}var yF=0;function bF(){return`var_${yF++}`}function xF(e){return kP(e)&&H(e.items)}function SF(e,t,n,r){let[i,a]=[bF(),bF()],o=HB(e,t,n.additionalItems,i),s=iS(a,q(n.items.length)),c=t.AddIndex(a);return lS(r,q(0),[i,a],Vx(s,Bx(o,c)))}function CF(e,t,n,r){let[i,a]=[bF(),bF()],o=HB(e,t,n.additionalItems,i),s=iS(a,q(n.items.length));return lS(r,q(0),[i,a],Vx(s,o))}function wF(e,t,n,r){return xF(n)?t.UseUnevaluated()?SF(e,t,n,r):CF(e,t,n,r):q(!0)}function TF(e,t,n,r){return!xF(n)||wx(r,0,(r,i)=>hx(i,n.items.length)||WB(e,t,n.additionalItems,r)&&t.AddIndex(i))}function EF(e,t,n,r,i,a){return!xF(i)||wx(a,0,(a,o)=>{let s=`${n}/additionalItems`,c=`${r}/${o}`;return hx(o,i.items.length)||KB(e,t,s,c,i.additionalItems,a)&&t.AddIndex(o)})}function DF(e){return new RegExp(e,`u`)}function OF(e,t){return!e.UseUnevaluated()&&(W(t,!0)||U(t)&&W(K(t).length,0))}function kF(e){return`^${e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}$`}function AF(e){let t=[];return GP(e)&&t.push(...K(e.patternProperties)),qP(e)&&t.push(...K(e.properties).map(kF)),W(t.length,0)?`(?!)`:`(${t.join(`|`)})`}function jF(e,t,n){return $P(t)&&qP(t)&&!GP(t)&&W(t.additionalProperties,!1)&&W(K(t.properties).length,t.required.length)}function MF(e,t,n){return nS(xS(yS(xS(`Object`,`getOwnPropertyNames`),[n]),`length`),q(t.required.length))}function NF(e,t,n,r){let[i,a]=[bF(),bF()],o=pF(DF(AF(n))),s=HB(e,t,n.additionalProperties,`${r}[${i}]`),c=yS(xS(o,`test`),[i]),l=t.AddKey(i),u=t.UseUnevaluated()?Vx(c,Bx(s,l)):Vx(c,s);return lS(mS(r),q(0),[i,a],u)}function PF(e,t,n,r){return OF(t,n.additionalProperties)?q(!0):jF(t,n,r)?MF(t,n,r):NF(e,t,n,r)}function FF(e,t,n,r){let i=DF(AF(n));return wx(K(r),0,(a,o)=>i.test(a)||WB(e,t,n.additionalProperties,r[a])&&t.AddKey(a))}function IF(e,t,n,r,i,a){let o=DF(AF(i)),s=[];return Tx(K(a),0,(c,l)=>{let u=`${n}/additionalProperties`,d=`${r}/${c}`,f=o.test(c)||KB(e,t,u,d,i.additionalProperties,a[c])&&t.AddKey(c);return f||s.push(c),f})||t.AddError({keyword:`additionalProperties`,schemaPath:n,instancePath:r,params:{additionalProperties:s}})}function LF(e,t,n,r,i){let a=wS(`results`,`[]`),o=n.map((e,t)=>wS(`context_${t}`,bS(`CheckContext`,[]))),s=n.map((n,i)=>wS(`condition_${i}`,yS(vS([`context`],UB(e,t,n,r)),[`context_${i}`]))),c=n.map((e,t)=>TS(`condition_${t}`,yS(xS(`results`,`push`),[`context_${t}`]))),l=ES(Bx(i,t.Merge(`results`)));return yS(vS([],CS([a,...o,...s,...c,l])),[])}function RF(e,t,n,r){return LF(e,t,n.allOf,r,nS(xS(`results`,`length`),q(n.allOf.length)))}function zF(e,t,n,r){return DS(n.allOf.map(n=>UB(e,t,n,r)))}function BF(e,t,n,r){return t.UseUnevaluated()?RF(e,t,n,r):zF(e,t,n,r)}function VF(e,t,n,r){let i=n.allOf.reduce((t,n)=>{let i=new uF;return GB(e,i,n,r)?[...t,i]:t},[]);return W(i.length,n.allOf.length)&&t.Merge(i)}function HF(e,t,n,r,i,a){let o=[],s=i.allOf.reduce((t,i,s)=>{let c=`${n}/allOf/${s}`,l=new dF,u=qB(e,l,c,r,i,a);return u||o.push(l),u?[...t,l]:t},[]),c=W(s.length,i.allOf.length)&&t.Merge(s);return c||o.forEach(e=>e.GetErrors().forEach(e=>t.AddError(e))),c}function UF(e,t,n,r){return LF(e,t,n.anyOf,r,rS(xS(`results`,`length`),q(0)))}function WF(e,t,n,r){return OS(n.anyOf.map(n=>UB(e,t,n,r)))}function GF(e,t,n,r){return t.UseUnevaluated()?UF(e,t,n,r):WF(e,t,n,r)}function KF(e,t,n,r){let i=n.anyOf.reduce((t,n)=>{let i=new uF;return GB(e,i,n,r)?[...t,i]:t},[]);return mx(i.length,0)&&t.Merge(i)}function qF(e,t,n,r,i,a){let o=[],s=i.anyOf.reduce((t,i,s)=>{let c=new dF,l=qB(e,c,`${n}/anyOf/${s}`,r,i,a);return l||o.push(c),l?[...t,c]:t},[]),c=mx(s.length,0)&&t.Merge(s);return c||o.forEach(e=>e.GetErrors().forEach(e=>t.AddError(e))),c||t.AddError({keyword:`anyOf`,schemaPath:n,instancePath:r,params:{}})}function JF(e,t,n,r){return q(!!n)}function YF(e,t,n,r){return n}function XF(e,t,n,r,i,a){return YF(e,t,i,a)||t.AddError({keyword:`boolean`,schemaPath:n,instancePath:r,params:{}})}function ZF(e,t,n,r){return bx(n.const)?nS(r,q(n.const)):gS(r,pF(n.const))}function QF(e,t,n,r){return bx(n.const)?W(r,n.const):Lx(r,n.const)}function $F(e,t,n,r,i,a){return QF(e,t,i,a)||t.AddError({keyword:`const`,schemaPath:n,instancePath:r,params:{allowedValue:i.const}})}function eI(e){return!(LP(e)&&W(e.minContains,0))}function tI(e,t,n,r){let[i,a]=[bF(),bF()];return Bx(Hx(nS(xS(r,`length`),q(0))),dS(r,[i,a],Bx(UB(e,t,n.contains,i),t.AddIndex(a))))}function nI(e,t,n,r){let[i]=[bF()];return Bx(Hx(nS(xS(r,`length`),q(0))),uS(r,[i,`_`],UB(e,t,n.contains,i)))}function rI(e,t,n,r){return eI(n)?t.UseUnevaluated()?tI(e,t,n,r):nI(e,t,n,r):q(!0)}function iI(e,t,n,r){return!eI(n)||!W(r.length,0)&&Dx(r,(r,i)=>GB(e,t,n.contains,r)&&t.AddIndex(i))}function aI(e,t,n,r,i,a){return iI(e,t,i,a)||t.AddError({keyword:`contains`,schemaPath:n,instancePath:r,params:{minContains:1}})}function oI(e,t,n,r){return Vx(nS(xS(mS(r),`length`),q(0)),DS(Mx(n.dependencies).map(([n,i])=>{let a=Hx(hS(r,q(n))),o=UB(e,t,i,r);return Vx(a,H(i)?(e=>DS(e.map(e=>hS(r,q(e)))))(i):o)})))}function sI(e,t,n,r){let i=W(K(r).length,0),a=wx(Mx(n.dependencies),0,([n,i])=>!G(r,n)||(H(i)?i.every(e=>G(r,e)):GB(e,t,i,r)));return i||a}function cI(e,t,n,r,i,a){let o=W(K(a).length,0),s=Tx(Mx(i.dependencies),0,([i,o])=>{let s=`${n}/dependencies/${i}`;return!G(a,i)||(H(o)?o.every(e=>G(a,e)||t.AddError({keyword:`dependencies`,schemaPath:n,instancePath:r,params:{property:i,dependencies:o}})):qB(e,t,s,r,o,a))});return o||s}function lI(e,t,n,r){return Vx(nS(xS(mS(r),`length`),q(0)),DS(Mx(n.dependentRequired).map(([e,t])=>Vx(Hx(hS(r,q(e))),DS(t.map(e=>hS(r,q(e))))))))}function uI(e,t,n,r){let i=W(K(r).length,0),a=wx(Mx(n.dependentRequired),0,([e,t])=>!G(r,e)||t.every(e=>G(r,e)));return i||a}function dI(e,t,n,r,i,a){let o=W(K(a).length,0),s=Tx(Mx(i.dependentRequired),0,([e,i])=>!G(a,e)||Tx(i,0,o=>G(a,o)||t.AddError({keyword:`dependentRequired`,schemaPath:n,instancePath:r,params:{property:e,dependencies:i}})));return o||s}function fI(e,t,n,r){return Vx(nS(xS(mS(r),`length`),q(0)),DS(Mx(n.dependentSchemas).map(([n,i])=>Vx(Hx(hS(r,q(n))),UB(e,t,i,r)))))}function pI(e,t,n,r){let i=W(K(r).length,0),a=wx(Mx(n.dependentSchemas),0,([n,i])=>!G(r,n)||GB(e,t,i,r));return i||a}function mI(e,t,n,r,i,a){let o=W(K(a).length,0),s=Tx(Mx(i.dependentSchemas),0,([i,o])=>{let s=`${n}/dependentSchemas/${i}`;return!G(a,i)||qB(e,t,s,r,o,a)});return o||s}function hI(e,t,n,r){return rV(e,t,e.DynamicRef(n)??!1,r)}function gI(e,t,n,r){let i=e.DynamicRef(n)??!1;return cP(i)&&GB(e,t,i,r)}function _I(e,t,n,r,i,a){let o=e.DynamicRef(i)??!1;return cP(o)&&qB(e,t,`#`,r,o,a)}function vI(e,t,n,r){return OS(n.enum.map(e=>bx(e)?nS(r,q(e)):gS(r,pF(e))))}function yI(e,t,n,r){return Ex(n.enum,e=>bx(e)?W(r,e):Lx(r,e))}function bI(e,t,n,r,i,a){return yI(e,t,i,a)||t.AddError({keyword:`enum`,schemaPath:n,instancePath:r,params:{allowedValues:i.enum}})}function xI(e,t,n,r){return iS(r,q(n.exclusiveMaximum))}function SI(e,t,n,r){return hx(r,n.exclusiveMaximum)}function CI(e,t,n,r,i,a){return SI(e,t,i,a)||t.AddError({keyword:`exclusiveMaximum`,schemaPath:n,instancePath:r,params:{comparison:`<`,limit:i.exclusiveMaximum}})}function wI(e,t,n,r){return rS(r,q(n.exclusiveMinimum))}function TI(e,t,n,r){return mx(r,n.exclusiveMinimum)}function EI(e,t,n,r,i,a){return TI(e,t,i,a)||t.AddError({keyword:`exclusiveMinimum`,schemaPath:n,instancePath:r,params:{comparison:`>`,limit:i.exclusiveMinimum}})}var DI=[0,31,28,31,30,31,30,31,31,30,31,30,31],OI=/^(\d\d\d\d)-(\d\d)-(\d\d)$/;function kI(e){return e%4==0&&(e%100!=0||e%400==0)}function AI(e){let t=OI.exec(e);if(!t)return!1;let n=+t[1],r=+t[2],i=+t[3];return r>=1&&r<=12&&i>=1&&i<=(r===2&&kI(n)?29:DI[r])}var jI=/^(\d\d):(\d\d):(\d\d)(?:\.\d+)?(?:([Zz])|([+-])(\d\d):(\d\d))?$/;function MI(e,t=!0){let n=jI.exec(e);if(!n||t&&!n[4]&&!n[5])return!1;let r=+n[1],i=+n[2],a=+n[3];if(r>23||i>59||a>60)return!1;if(n[5]){let e=+n[6],t=+n[7];if(e>23||t>59)return!1}if(a<60)return!0;let o=n[5]===`-`?-1:1,s=+(n[6]||0),c=+(n[7]||0);return((r*60+i-o*(s*60+c))%1440+1440)%1440==1439}function NI(e){let t=e.split(/T/i);return t.length===2&&AI(t[0])&&MI(t[1])}var PI=/^P((\d+Y(\d+M(\d+D)?)?|\d+M(\d+D)?|\d+D)(T(\d+H(\d+M(\d+S)?)?|\d+M(\d+S)?|\d+S))?|T(\d+H(\d+M(\d+S)?)?|\d+M(\d+S)?|\d+S)|\d+W)$/;function FI(e){return PI.test(e)}var II=/^(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[^"\\]|\\[\x20-\x7e])*")@(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*|\[(?:IPv6:[a-f0-9:]+|(?:25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])(?:\.(?:25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])){3})\])$/i;function LI(e){return II.test(e)}var RI=/^(?!-).*(?<!-)$/,zI=/^(?!..--)/,BI=/^[a-zA-Z0-9-]*$/,VI=/[^\p{ASCII}]/u,HI=/[0-9]/,UI=/[\u{0660}-\u{0669}]/u,WI=/[\u{06f0}-\u{06f9}]/u,GI=/[\u{002e}\u{002c}\u{003a}\u{002f}]/u,KI=/[\u{002d}\u{002b}]/u,qI=/\p{Mn}/u,JI=/\p{Mc}/u,YI=/[\p{Mn}\p{Mc}\p{Me}]/u,XI=/\p{L}/u,ZI=/\p{Nd}/u,QI=/\p{Script=Greek}/u,$I=/\p{Script=Hebrew}/u,eL=/[\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Han}]/u,tL=/[\p{Script=Arabic}\p{Script=Syriac}\p{Script=Thaana}\p{Script=Mandaic}]/u,nL=/[\u{094d}\u{09cd}\u{0a4d}\u{0acd}\u{0b4d}\u{0bcd}\u{0c4d}\u{0ccd}\u{0d3b}\u{0d3c}\u{0d4d}\u{0dca}\u{1b44}\u{1baa}\u{1bab}\u{a9c0}\u{11046}\u{1107f}\u{110b9}\u{11133}\u{11134}\u{111c0}\u{11235}\u{1134d}\u{11442}\u{114c2}\u{115bf}\u{1163f}\u{116b6}\u{11c3f}\u{11d44}\u{11d45}]/u,rL=/[\u{0640}\u{07fa}\u{302e}\u{302f}\u{3031}\u{3032}\u{3033}\u{3034}\u{3035}\u{303b}]/u,iL=/[\u{00b7}\u{0375}\u{05f3}\u{05f4}\u{200c}\u{200d}\u{30fb}]/u,aL=/[\u{00df}\u{03c2}\u{06fd}\u{06fe}\u{0f0b}\u{3007}]/u,oL=new RegExp([HI,WI].map(e=>e.source).join(`|`),`u`),sL=new RegExp([XI,KI,GI,ZI,qI,JI,iL,aL].map(e=>e.source).join(`|`),`u`);function cL(e){return RI.test(e)&&zI.test(e)&&BI.test(e)}var lL=36,uL=1,dL=26,fL=38,pL=700,mL=72,hL=128;function gL(){throw null}function _L(e){return e.toLowerCase().startsWith(`xn--`)}function vL(e,t,n){e=n?Math.floor(e/pL):e>>1,e+=Math.floor(e/t);let r=0;for(;e>455;)e=Math.floor(e/35),r+=lL;return r+Math.floor(36*e/(e+fL))}function yL(e){let t=[],n=hL,r=0,i=mL,a=e.lastIndexOf(`-`);if(a>0)for(let n=0;n<a;n++){let r=e.charCodeAt(n);r>=128&&gL(),t.push(r)}let o=a<0?0:a+1;for(;o<e.length;){let a=r,s=1,c=lL;for(;;){o>=e.length&&gL();let t=e.charCodeAt(o++),n;t>=97&&t<=122?n=t-97:t>=48&&t<=57?n=t-48+26:gL(),r+=n*s;let a=c<=i?uL:c>=i+dL?dL:c-i;if(n<a)break;s*=lL-a,c+=lL}let l=t.length+1;i=vL(r-a,l,a===0),n+=Math.floor(r/l),r%=l,t.splice(r,0,n),r++}return String.fromCodePoint(...t)}function bL(e){return e<26?String.fromCharCode(e+97):String.fromCharCode(e-26+48)}var xL=new RegExp(VI.source,`gu`);function SL(e){let t=e.replace(xL,``),n=t.length,r=n>0?[t,`-`]:[],i=Array.from(e,e=>e.codePointAt(0)),a=hL,o=0,s=mL,c=n;for(;c<i.length;){let e=1/0;for(let t of i)t>=a&&t<e&&(e=t);o+=(e-a)*(c+1),a=e;for(let e of i)if(e<a&&o++,e===a){let e=o;for(let t=lL;;t+=lL){let n=t<=s?uL:t>=s+dL?dL:t-s;if(e<n)break;let i=n+(e-n)%(lL-n);r.push(bL(i)),e=Math.floor((e-n)/(lL-n))}r.push(bL(e)),s=vL(o,c+1,c===n),o=0,c++}o++,a++}return r.join(``)}var CL=/^(?:R|AL|AN|EN|ES|CS|ET|ON|BN|NSM)$/,wL=/^(?:L|EN|ES|CS|ET|ON|BN|NSM)$/,TL=/^(?:R|AL|AN)$/;function EL(e){if(_L(e))try{return OL(yL(e.slice(4).toLowerCase()))}catch{return!1}return OL(e)}function DL(e){let t=String.fromCodePoint(e);return oL.test(t)?`EN`:UI.test(t)?`AN`:qI.test(t)?`NSM`:$I.test(t)?`R`:tL.test(t)?`AL`:XI.test(t)?`L`:`ON`}function OL(e){for(let t of e)if(TL.test(DL(t.codePointAt(0))))return!0;return!1}function kL(e){let t=!1,n=wL,r=!1,i=!1,a=!0;for(let o of e){let e=DL(o.codePointAt(0));if(a){if(e!==`L`&&e!==`R`&&e!==`AL`)return!1;t=e===`R`||e===`AL`,n=t?CL:wL,a=!1}if(!n.test(e))return!1;e===`EN`?r=!0:e===`AN`&&(i=!0)}return!(t&&r&&i)}function AL(e){return VI.test(e)&&SL(e).length+4>63}function jL(e){return e[0]===`-`||e[e.length-1]===`-`||e.slice(2).join(``).startsWith(`--`)}function ML(e){if(AL(e)||OL(e)&&!kL(e))return!1;let t=[...e],n=t.map(e=>e.codePointAt(0)),r=n.length;if(jL(t)||YI.test(t[0]))return!1;let i=!1;for(let e=0;e<r;e++){let r=n[e],a=t[e];if(rL.test(a)||!sL.test(a))return!1;eL.test(a)&&(i=!0);let o=n[e-1],s=n[e+1];switch(r){case 183:if(o!==108||s!==108)return!1;break;case 885:if(!s||!QI.test(t[e+1]))return!1;break;case 1523:case 1524:if(!o||!$I.test(t[e-1]))return!1;break;case 8204:if(!o||o<128&&!nL.test(t[e-1]))return!1;break;case 8205:if(!o||!nL.test(t[e-1]))return!1}}return!(e.includes(`・`)&&!i)}function NL(e){if(!_L(e))return!1;try{let t=e.slice(4).toLowerCase();if(t.lastIndexOf(`-`)===0)return!1;let n=yL(t);return VI.test(n)?ML(n):!1}catch{return!1}}function PL(e){return e.length>0&&e.length<=63}function FL(e){return PL(e)&&(NL(e)||cL(e))}function IL(e){return e.length===0||e.length>253||e.charCodeAt(e.length-1)===46?!1:e.split(`.`).every(e=>FL(e))}function LL(e){return e.length>0&&e.length<=63}function RL(e){return LL(e)&&(NL(e)||ML(e))}function zL(e){return e.replace(/[\uff01-\uff5e]/g,e=>String.fromCharCode(e.charCodeAt(0)-65248)).normalize(`NFC`).replace(/[\u00ad\u034f\u180b-\u180d\u200b\ufe00-\ufe0f\u{e0100}-\u{e01ef}]/gu,``).replace(/[\u002E\u3002\uFF0E\uFF61]/g,`.`)}function BL(e){if(e.length===0||e.includes(` `))return!1;let t=zL(e);if(t.length>253)return!1;let n=t.split(`.`),r=n.some(e=>EL(e));return n.every(e=>RL(e)&&(!r||kL(e)))}function VL(e){return IL(e)}var HL=/^(?:[A-Za-z0-9!#$%&'*+\/=?^_`{|}~\u{0080}-\u{10FFFF}-]+(?:\.[A-Za-z0-9!#$%&'*+\/=?^_`{|}~\u{0080}-\u{10FFFF}-]+)*|"(?:[^"\\]|\\.)*")@[\p{L}\p{N}](?:[\p{L}\p{N}-]{0,62})(?<!-)(?:\.[\p{L}\p{N}](?:[\p{L}\p{N}-]{0,62})(?<!-))*$/iu;function UL(e){return HL.test(e.normalize(`NFC`))}function WL(e){return BL(e)}var GL=/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/;function KL(e){return GL.test(e)}var qL=/^(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:)?[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)$/i;function JL(e){return qL.test(e)}var YL=/[\x00-\x20\x7F\\]|%(?![0-9a-fA-F]{2})/,XL=/^[a-zA-Z][a-zA-Z0-9+\-.]*\/\//;function ZL(e){return!YL.test(e)&&!XL.test(e)&&URL.canParse(e,`http://example.com`)}var QL=2048,$L=/\[[vV][0-9a-fA-F]+\.[^\]]+\]/,eR=/[\x00-\x20<>\^`{|}\\]/,tR=/%(?![0-9a-fA-F]{2})/;function nR(e){return e.length<QL?e.replace($L,`[::1]`):e}function rR(e){return eR.test(e)||tR.test(e)?!1:URL.canParse(nR(e))}var iR=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i;function aR(e){return iR.test(e)}var oR=/^(?:\/(?:[^~/]|~0|~1)*)*$/;function sR(e){return oR.test(e)}function cR(e){try{return new RegExp(e,`u`),!0}catch{return!1}}var lR=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;function uR(e){return lR.test(e)}var dR=/^(?:[a-z][a-z0-9+\-.]*:(?:\/\/(?:(?:[-a-z0-9._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:[\da-f]{1,4}:){6}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|::(?:[\da-f]{1,4}:){5}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:[\da-f]{1,4})?::(?:[\da-f]{1,4}:){4}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,1}[\da-f]{1,4})?::(?:[\da-f]{1,4}:){3}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,2}[\da-f]{1,4})?::(?:[\da-f]{1,4}:){2}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,3}[\da-f]{1,4})?::[\da-f]{1,4}:(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,4}[\da-f]{1,4})?::(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,5}[\da-f]{1,4})?::[\da-f]{1,4}|(?:(?:[\da-f]{1,4}:){0,6}[\da-f]{1,4})?::)|v[0-9a-f]+\.[-a-z0-9._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)|(?:[-a-z0-9._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[-a-z0-9._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[-a-z0-9._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[-a-z0-9._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[-a-z0-9._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[-a-z0-9._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:\/\/(?:(?:[-a-z0-9._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:[\da-f]{1,4}:){6}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|::(?:[\da-f]{1,4}:){5}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:[\da-f]{1,4})?::(?:[\da-f]{1,4}:){4}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,1}[\da-f]{1,4})?::(?:[\da-f]{1,4}:){3}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,2}[\da-f]{1,4})?::(?:[\da-f]{1,4}:){2}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,3}[\da-f]{1,4})?::[\da-f]{1,4}:(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,4}[\da-f]{1,4})?::(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,5}[\da-f]{1,4})?::[\da-f]{1,4}|(?:(?:[\da-f]{1,4}:){0,6}[\da-f]{1,4})?::)|v[0-9a-f]+\.[-a-z0-9._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)|(?:[-a-z0-9._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[-a-z0-9._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[-a-z0-9._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[-a-z0-9._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[-a-z0-9._~!$&'()*+,;=@]|%[0-9a-f]{2})+(?:\/(?:[-a-z0-9._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?)(?:\?(?:[-a-z0-9._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[-a-z0-9._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function fR(e){return dR.test(e)}var pR=/^(?:(?:[^\x00-\x20"<>%\\^`{|}\x7f]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?:\.(?:[a-z0-9_]|%[0-9a-f]{2})+)*(?::[1-9]\d{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?:\.(?:[a-z0-9_]|%[0-9a-f]{2})+)*(?::[1-9]\d{0,3}|\*)?)*\})*$/i;function mR(e){return pR.test(e)}var hR=/^[a-z][a-z0-9+\-.]*:(?:\/\/(?:(?:[-a-z0-9._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:[\da-f]{1,4}:){6}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|::(?:[\da-f]{1,4}:){5}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:[\da-f]{1,4})?::(?:[\da-f]{1,4}:){4}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,1}[\da-f]{1,4})?::(?:[\da-f]{1,4}:){3}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,2}[\da-f]{1,4})?::(?:[\da-f]{1,4}:){2}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,3}[\da-f]{1,4})?::[\da-f]{1,4}:(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,4}[\da-f]{1,4})?::(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,5}[\da-f]{1,4})?::[\da-f]{1,4}|(?:(?:[\da-f]{1,4}:){0,6}[\da-f]{1,4})?::)|v[0-9a-f]+\.[-a-z0-9._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)|(?:[-a-z0-9._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[-a-z0-9._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[-a-z0-9._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[-a-z0-9._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[-a-z0-9._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[-a-z0-9._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[-a-z0-9._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[-a-z0-9._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function gR(e){return hR.test(e)}function _R(e){return URL.canParse(e)}var vR=/^[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i;function yR(e){return vR.test(e)}var bR=new Map;function xR(){bR.clear()}function SR(){return[...bR.entries()]}function CR(e,t){bR.set(e,t)}function wR(e){return bR.has(e)}function TR(e){return bR.get(e)}function ER(e,t){return bR.get(e)?.(t)??!0}function DR(){xR(),bR.set(`date-time`,NI),bR.set(`date`,AI),bR.set(`duration`,FI),bR.set(`email`,LI),bR.set(`hostname`,VL),bR.set(`idn-email`,UL),bR.set(`idn-hostname`,WL),bR.set(`ipv4`,KL),bR.set(`ipv6`,JL),bR.set(`iri-reference`,ZL),bR.set(`iri`,rR),bR.set(`json-pointer-uri-fragment`,aR),bR.set(`json-pointer`,sR),bR.set(`regex`,cR),bR.set(`relative-json-pointer`,uR),bR.set(`time`,MI),bR.set(`uri-reference`,fR),bR.set(`uri-template`,mR),bR.set(`uri`,gR),bR.set(`url`,_R),bR.set(`uuid`,yR)}DR();var OR=t({Clear:()=>xR,Entries:()=>SR,Get:()=>TR,Has:()=>wR,IsDate:()=>AI,IsDateTime:()=>NI,IsDuration:()=>FI,IsEmail:()=>LI,IsHostname:()=>VL,IsIPv4:()=>KL,IsIPv6:()=>JL,IsIdnEmail:()=>UL,IsIdnHostname:()=>WL,IsIri:()=>rR,IsIriReference:()=>ZL,IsJsonPointer:()=>sR,IsJsonPointerUriFragment:()=>aR,IsRegex:()=>cR,IsRelativeJsonPointer:()=>uR,IsTime:()=>MI,IsUri:()=>gR,IsUriReference:()=>fR,IsUriTemplate:()=>mR,IsUrl:()=>_R,IsUuid:()=>yR,Reset:()=>DR,Set:()=>CR,Test:()=>ER});function kR(e,t,n,r){return yS(xS(`Format`,`Test`),[q(n.format),r])}function AR(e,t,n,r){return ER(n.format,r)}function jR(e,t,n,r,i,a){return AR(e,t,i,a)||t.AddError({keyword:`format`,schemaPath:n,instancePath:r,params:{format:i.format}})}function MR(e,t,n,r){let i=!eF(n)||n.then,a=!SP(n)||n.else;return SS(UB(e,t,n.if,r),UB(e,t,i,r),UB(e,t,a,r))}function NR(e,t,n,r){let i=!eF(n)||n.then,a=!SP(n)||n.else;return GB(e,t,n.if,r)?GB(e,t,i,r):GB(e,t,a,r)}function PR(e,t,n,r,i,a){let o=!eF(i)||i.then,s=!SP(i)||i.else,c=new dF,l=qB(e,c,`${n}/if`,r,i.if,a)?qB(e,c,`${n}/then`,r,o,a)||t.AddError({keyword:`if`,schemaPath:n,instancePath:r,params:{failingKeyword:`then`}}):qB(e,t,`${n}/else`,r,s,a)||t.AddError({keyword:`if`,schemaPath:n,instancePath:r,params:{failingKeyword:`else`}});return l&&t.Merge([c]),l}function FR(e,t,n,r){return DS(n.items.map((n,i)=>Vx(aS(xS(r,`length`),q(i)),Bx(HB(e,t,n,`${r}[${i}]`),t.AddIndex(q(i))))))}function IR(e,t,n,r){return DS(n.items.map((n,i)=>Vx(aS(xS(r,`length`),q(i)),HB(e,t,n,`${r}[${i}]`))))}function LR(e,t,n,r){return t.UseUnevaluated()?FR(e,t,n,r):IR(e,t,n,r)}function RR(e,t,n,r){return wx(n.items,0,(n,i)=>gx(r.length,i)||WB(e,t,n,r[i])&&t.AddIndex(i))}function zR(e,t,n,r,i,a){return Tx(i.items,0,(i,o)=>{let s=`${n}/items/${o}`,c=`${r}/${o}`;return gx(a.length,o)||KB(e,t,s,c,i,a[o])&&t.AddIndex(o)})}function BR(e,t,n,r){let i=KP(n)?n.prefixItems.length:0,a=HB(e,t,n.items,`element`),o=t.AddIndex(`index`);return lS(r,q(i),[`element`,`index`],Bx(a,o))}function VR(e,t,n,r){let i=KP(n)?n.prefixItems.length:0,a=HB(e,t,n.items,`element`);return lS(r,q(i),[`element`,`index`],a)}function HR(e,t,n,r){return t.UseUnevaluated()?BR(e,t,n,r):VR(e,t,n,r)}function UR(e,t,n,r){return wx(r,KP(n)?n.prefixItems.length:0,(r,i)=>WB(e,t,n.items,r)&&t.AddIndex(i))}function WR(e,t,n,r,i,a){return Tx(a,KP(i)?i.prefixItems.length:0,(a,o)=>KB(e,t,`${n}/items`,`${r}/${o}`,i.items,a)&&t.AddIndex(o))}function GR(e,t,n,r){return AP(n)?LR(e,t,n,r):HR(e,t,n,r)}function KR(e,t,n,r){return AP(n)?RR(e,t,n,r):UR(e,t,n,r)}function qR(e,t,n,r,i,a){return AP(i)?zR(e,t,n,r,i,a):WR(e,t,n,r,i,a)}function JR(e){return hP(e)}function YR(e,t,n,r){if(!JR(n))return q(!0);let[i]=[bF()];return aS(fS(r,[i,`_`],UB(e,t,n.contains,i)),q(n.maxContains))}function XR(e,t,n,r){return!JR(n)||gx(Ox(r,r=>GB(e,t,n.contains,r)),n.maxContains)}function ZR(e,t,n,r,i,a){let o=LP(i)?i.minContains:1;return XR(e,t,i,a)||t.AddError({keyword:`contains`,schemaPath:n,instancePath:r,params:{minContains:o,maxContains:i.maxContains}})}function QR(e,t,n,r){return aS(r,q(n.maximum))}function $R(e,t,n,r){return gx(r,n.maximum)}function ez(e,t,n,r,i,a){return $R(e,t,i,a)||t.AddError({keyword:`maximum`,schemaPath:n,instancePath:r,params:{comparison:`<=`,limit:i.maximum}})}function tz(e,t,n,r){return aS(xS(r,`length`),q(n.maxItems))}function nz(e,t,n,r){return gx(r.length,n.maxItems)}function rz(e,t,n,r,i,a){return nz(e,t,i,a)||t.AddError({keyword:`maxItems`,schemaPath:n,instancePath:r,params:{limit:i.maxItems}})}function iz(e,t,n,r){return cS(r,q(n.maxLength))}function az(e,t,n,r){return Sx(r,n.maxLength)}function oz(e,t,n,r,i,a){return az(e,t,i,a)||t.AddError({keyword:`maxLength`,schemaPath:n,instancePath:r,params:{limit:i.maxLength}})}function sz(e,t,n,r){return aS(xS(mS(r),`length`),q(n.maxProperties))}function cz(e,t,n,r){return gx(K(r).length,n.maxProperties)}function lz(e,t,n,r,i,a){return cz(e,t,i,a)||t.AddError({keyword:`maxProperties`,schemaPath:n,instancePath:r,params:{limit:i.maxProperties}})}function uz(e){return hP(e)}function dz(e,t,n,r){let[i,a]=[bF(),bF()];return oS(fS(r,[i,a],Bx(UB(e,t,n.contains,i),t.AddIndex(a))),q(n.minContains))}function fz(e,t,n,r){let[i]=[bF()];return oS(fS(r,[i,`_`],UB(e,t,n.contains,i)),q(n.minContains))}function pz(e,t,n,r){return uz(n)?t.UseUnevaluated()?dz(e,t,n,r):fz(e,t,n,r):q(!0)}function mz(e,t,n,r){return!uz(n)||_x(Ox(r,(r,i)=>GB(e,t,n.contains,r)&&t.AddIndex(i)),n.minContains)}function hz(e,t,n,r,i,a){return mz(e,t,i,a)||t.AddError({keyword:`contains`,schemaPath:n,instancePath:r,params:{minContains:i.minContains}})}function gz(e,t,n,r){return oS(r,q(n.minimum))}function _z(e,t,n,r){return _x(r,n.minimum)}function vz(e,t,n,r,i,a){return _z(e,t,i,a)||t.AddError({keyword:`minimum`,schemaPath:n,instancePath:r,params:{comparison:`>=`,limit:i.minimum}})}function yz(e,t,n,r){return oS(xS(r,`length`),q(n.minItems))}function bz(e,t,n,r){return _x(r.length,n.minItems)}function xz(e,t,n,r,i,a){return bz(e,t,i,a)||t.AddError({keyword:`minItems`,schemaPath:n,instancePath:r,params:{limit:i.minItems}})}function Sz(e,t,n,r){return sS(r,q(n.minLength))}function Cz(e,t,n,r){return Cx(r,n.minLength)}function wz(e,t,n,r,i,a){return Cz(e,t,i,a)||t.AddError({keyword:`minLength`,schemaPath:n,instancePath:r,params:{limit:i.minLength}})}function Tz(e,t,n,r){return oS(xS(mS(r),`length`),q(n.minProperties))}function Ez(e,t,n,r){return _x(K(r).length,n.minProperties)}function Dz(e,t,n,r,i,a){return Ez(e,t,i,a)||t.AddError({keyword:`minProperties`,schemaPath:n,instancePath:r,params:{limit:i.minProperties}})}function Oz(e,t,n,r){return kS(r,q(n.multipleOf))}function kz(e,t,n,r){return vx(r,n.multipleOf)}function Az(e,t,n,r,i,a){return kz(e,t,i,a)||t.AddError({keyword:`multipleOf`,schemaPath:n,instancePath:r,params:{multipleOf:i.multipleOf}})}function jz(e,t,n,r){return LF(e,t,[n.not],r,Hx(nS(xS(`results`,`length`),q(1))))}function Mz(e,t,n,r){return Hx(UB(e,t,n.not,r))}function Nz(e,t,n,r){return t.UseUnevaluated()?jz(e,t,n,r):Mz(e,t,n,r)}function Pz(e,t,n,r){let i=new uF;return!GB(e,i,n.not,r)&&t.Merge([i])}function Fz(e,t,n,r,i,a){return Pz(e,t,i,a)||t.AddError({keyword:`not`,schemaPath:n,instancePath:r,params:{}})}function Iz(e,t,n,r){return LF(e,t,n.oneOf,r,nS(xS(`results`,`length`),q(1)))}function Lz(e,t,n,r){let[i]=[bF()];return nS(fS(_S(n.oneOf.map(n=>UB(e,t,n,r))),[i,`_`],nS(i,q(!0))),q(1))}function Rz(e,t,n,r){return t.UseUnevaluated()?Iz(e,t,n,r):Lz(e,t,n,r)}function zz(e,t,n,r){let i=n.oneOf.reduce((t,n)=>{let i=new uF;return GB(e,i,n,r)?[...t,i]:t},[]);return W(i.length,1)&&t.Merge(i)}function Bz(e,t,n,r,i,a){let o=[],s=[],c=i.oneOf.reduce((t,i,c)=>{let l=new dF,u=qB(e,l,`${n}/oneOf/${c}`,r,i,a);return u&&s.push(c),u||o.push(l),u?[...t,l]:t},[]),l=W(c.length,1)&&t.Merge(c);return!l&&W(s.length,0)&&o.forEach(e=>e.GetErrors().forEach(e=>t.AddError(e))),l||t.AddError({keyword:`oneOf`,schemaPath:n,instancePath:r,params:{passingSchemas:s}})}function Vz(e,t,n,r){return yS(xS(pF(dx(n.pattern)?DF(n.pattern):n.pattern),`test`),[r])}function Hz(e,t,n,r){return(dx(n.pattern)?DF(n.pattern):n.pattern).test(r)}function Uz(e,t,n,r,i,a){return Hz(e,t,i,a)||t.AddError({keyword:`pattern`,schemaPath:n,instancePath:r,params:{pattern:i.pattern}})}function Wz(e,t,n,r){return DS(Mx(n.patternProperties).map(([n,i])=>{let[a,o]=[bF(),bF()],s=Hx(yS(xS(pF(DF(n)),`test`),[a])),c=HB(e,t,i,o),l=t.AddKey(a),u=t.UseUnevaluated()?Vx(s,Bx(c,l)):Vx(s,c);return lS(pS(r),q(0),[`[${a}, ${o}]`,`_`],u)}))}function Gz(e,t,n,r){return wx(Mx(n.patternProperties),0,([n,i])=>{let a=DF(n);return wx(Mx(r),0,([n,r])=>!a.test(n)||WB(e,t,i,r)&&t.AddKey(n))})}function Kz(e,t,n,r,i,a){return Tx(Mx(i.patternProperties),0,([i,o])=>{let s=`${n}/patternProperties/${i}`,c=DF(i);return Tx(Mx(a),0,([n,i])=>{let a=`${r}/${n}`;return!c.test(n)||KB(e,t,s,a,o,i)&&t.AddKey(n)})})}function qz(e,t,n,r){return DS(n.prefixItems.map((n,i)=>{let a=aS(xS(r,`length`),q(i)),o=HB(e,t,n,`${r}[${i}]`),s=t.AddIndex(q(i));return Vx(a,t.UseUnevaluated()?Bx(o,s):o)}))}function Jz(e,t,n,r){return W(r.length,0)||wx(n.prefixItems,0,(n,i)=>gx(r.length,i)||WB(e,t,n,r[i])&&t.AddIndex(i))}function Yz(e,t,n,r,i,a){return W(a.length,0)||Tx(i.prefixItems,0,(i,o)=>{let s=`${n}/prefixItems/${o}`,c=`${r}/${o}`;return gx(a.length,o)||KB(e,t,s,c,i,a[o])&&t.AddIndex(o)})}function Xz(e,t){return e.includes(t)||BS().exactOptionalPropertyTypes}function Zz(e,t){return $x(xS(e,t))}function Qz(e,t){return px(e[t])}function $z(e,t,n,r){let i=$P(n)?n.required:[];return DS(Mx(n.properties).map(([n,a])=>{let o=Hx(hS(r,q(n))),s=HB(e,t,a,xS(r,n)),c=t.AddKey(q(n)),l=t.UseUnevaluated()?Bx(s,c):s,u=i.includes(n)?l:Vx(o,l);return Xz(i,n)?u:Vx(Zz(r,n),u)}))}function eB(e,t,n,r){let i=$P(n)?n.required:[];return wx(Mx(n.properties),0,([n,a])=>{let o=!G(r,n)||WB(e,t,a,r[n])&&t.AddKey(n);return Xz(i,n)?o:Qz(r,n)||o})}function tB(e,t,n,r,i,a){let o=$P(i)?i.required:[];return Tx(Mx(i.properties),0,([i,s])=>{let c=`${n}/properties/${i}`,l=`${r}/${i}`,u=()=>!G(a,i)||KB(e,t,c,l,s,a[i])&&t.AddKey(i);return Xz(o,i)?u():Qz(a,i)||u()})}function nB(e,t,n,r){let[i,a]=[bF(),bF()];return lS(mS(r),q(0),[i,a],UB(e,t,n.propertyNames,i))}function rB(e,t,n,r){return wx(K(r),0,(r,i)=>GB(e,t,n.propertyNames,r))}function iB(e,t,n,r,i,a){let o=[];return Tx(K(a),0,(a,s)=>{let c=`${r}/${a}`,l=qB(e,t,`${n}/propertyNames`,c,i.propertyNames,a);return l||o.push(a),l})||t.AddError({keyword:`propertyNames`,schemaPath:n,instancePath:r,params:{propertyNames:o}})}function aB(e,t,n,r){return rV(e,t,e.RecursiveRef(n)??!1,r)}function oB(e,t,n,r){let i=e.RecursiveRef(n)??!1;return cP(i)&&GB(e,t,i,r)}function sB(e,t,n,r,i,a){let o=e.RecursiveRef(i)??!1;return cP(o)&&qB(e,t,`#`,r,o,a)}function cB(e,t,n,r){let i=vS([`context`,`value`],rV(e,t,n,`value`));return yS(vS([`context`,`value`],CS([wS(`nextContext`,bS(`CheckContext`,[])),wS(`result`,yS(i,[`nextContext`,`value`])),TS(`result`,t.Merge(`[nextContext]`)),ES(`result`)])),[`context`,r])}function lB(e,t,n,r){return rV(e,t,n,r)}function uB(e,t,n,r){let i=e.Ref(n)??!1;return t.UseUnevaluated()?cB(e,t,i,r):lB(e,t,i,r)}function dB(e,t,n,r){let i=e.Ref(n)??!1,a=new uF,o=cP(i)&&GB(e,a,i,r);return o&&t.Merge([a]),o}function fB(e,t,n,r,i,a){let o=e.Ref(i)??!1,s=new dF,c=cP(o)&&qB(e,s,`#`,r,o,a);return c&&t.Merge([s]),c||s.GetErrors().forEach(e=>t.AddError(e)),c}function pB(e,t,n,r){return DS(n.required.map(e=>hS(r,q(e))))}function mB(e,t,n,r){return wx(n.required,0,e=>G(r,e))}function hB(e,t,n,r,i,a){let o=[];return Tx(i.required,0,e=>{let t=G(a,e);return t||o.push(e),t})||t.AddError({keyword:`required`,schemaPath:n,instancePath:r,params:{requiredProperties:o}})}function gB(e,t,n,r){return W(n,`object`)?Yx(r):W(n,`array`)?Ux(r):W(n,`boolean`)?Gx(r):W(n,`integer`)?Kx(r):W(n,`number`)?Jx(r):W(n,`null`)?qx(r):W(n,`string`)?Zx(r):W(n,`bigint`)?Wx(r):W(n,`constructor`)?tS(r):W(n,`function`)?eS(r):W(n,`symbol`)?Qx(r):W(n,`undefined`)||W(n,`void`)?$x(r):q(!0)}function _B(e,t,n,r,i){return W(n,`object`)?ux(i):W(n,`array`)?H(i):W(n,`boolean`)?ix(i):W(n,`integer`)?sx(i):W(n,`number`)?lx(i):W(n,`null`)?cx(i):W(n,`string`)?dx(i):W(n,`bigint`)?rx(i):W(n,`constructor`)?ax(i):W(n,`function`)?ox(i):W(n,`symbol`)?fx(i):W(n,`undefined`)?px(i):!W(n,`void`)||px(i)}function vB(e,t,n,r){return OS(n.map(n=>gB(e,t,n,r)))}function yB(e,t,n,r,i){return Ex(n,n=>_B(e,t,n,r,i))}function bB(e,t,n,r){return H(n.type)?vB(e,t,n.type,r):gB(e,t,n.type,r)}function xB(e,t,n,r){return H(n.type)?yB(e,t,n.type,n,r):_B(e,t,n.type,n,r)}function SB(e,t,n,r,i,a){return(H(i.type)?yB(e,t,i.type,i,a):_B(e,t,i.type,i,a))||t.AddError({keyword:`type`,schemaPath:n,instancePath:r,params:{type:i.type}})}function CB(e,t,n,r){let[i,a]=[bF(),bF()],o=yS(xS(`context`,`GetIndices`),[]),s=yS(xS(`indices`,`has`),[i]),c=UB(e,t,n.unevaluatedItems,a),l=yS(xS(`context`,`AddIndex`),[i]),u=lS(r,q(0),[a,i],Bx(Vx(s,c),l));return yS(vS([`context`],CS([wS(`indices`,o),ES(u)])),[`context`])}function wB(e,t,n,r){let i=t.GetIndices();return wx(r,0,(r,a)=>(i.has(a)||GB(e,t,n.unevaluatedItems,r))&&t.AddIndex(a))}function TB(e,t,n,r,i,a){let o=t.GetIndices(),s=[];return Tx(a,0,(a,c)=>{let l=new dF,u=(o.has(c)||qB(e,l,n,r,i.unevaluatedItems,a))&&t.AddIndex(c);return u||s.push(c),u})||t.AddError({keyword:`unevaluatedItems`,schemaPath:n,instancePath:r,params:{unevaluatedItems:s}})}function EB(e,t,n,r){let[i,a]=[bF(),bF()],o=yS(xS(`context`,`GetKeys`),[]),s=yS(xS(`keys`,`has`),[i]),c=yS(xS(`context`,`AddKey`),[i]),l=UB(e,t,n.unevaluatedProperties,a),u=lS(pS(r),q(0),[`[${i}, ${a}]`,`_`],Vx(s,Bx(l,c)));return yS(vS([`context`],CS([wS(`keys`,o),ES(u)])),[`context`])}function DB(e,t,n,r){let i=t.GetKeys();return wx(Mx(r),0,([r,a])=>i.has(r)||GB(e,t,n.unevaluatedProperties,a)&&t.AddKey(r))}function OB(e,t,n,r,i,a){let o=t.GetKeys(),s=[];return Tx(Mx(a),0,([a,c])=>{let l=new dF,u=o.has(a)||qB(e,l,n,r,i.unevaluatedProperties,c)&&t.AddKey(a);return u||s.push(a),u})||t.AddError({keyword:`unevaluatedProperties`,schemaPath:n,instancePath:r,params:{unevaluatedProperties:s}})}function kB(e){return!W(e.uniqueItems,!1)}function AB(e,t,n,r){return kB(n)?nS(xS(bS(`Set`,[yS(xS(r,`map`),[xS(`Hashing`,`Hash`)])]),`size`),xS(r,`length`)):q(!0)}function jB(e,t,n,r){if(!kB(n))return!0;let i=new Set(r.map(Lw)).size,a=r.length;return W(i,a)}function MB(e,t,n,r,i,a){if(!kB(i))return!0;let o=new Set,s=a.reduce((e,t,n)=>{let r=Lw(t);return o.has(r)?[...e,n]:(o.add(r),e)},[]);return W(s.length,0)||t.AddError({keyword:`uniqueItems`,schemaPath:n,instancePath:r,params:{duplicateItems:s}})}function NB(e,t){return tF(e)&&(H(e.type)&&mx(e.type.length,0)&&wx(e.type,0,e=>W(e,t))||W(e.type,t))}function PB(e){return NB(e,`object`)}function FB(e){return oP(e)&&(uP(e)||_P(e)||vP(e)||yP(e)||qP(e)||GP(e)||JP(e)||BP(e)||FP(e)||$P(e)||iF(e))}function IB(e){return NB(e,`array`)}function LB(e){return oP(e)&&(lP(e)||kP(e)||hP(e)||MP(e)||NP(e)||LP(e)||RP(e)||KP(e)||rF(e)||nF(e))}function RB(e){return NB(e,`string`)}function zB(e){return oP(e)&&(zP(e)||PP(e)||EP(e)||WP(e))}function BB(e){return NB(e,`number`)||NB(e,`bigint`)}function VB(e){return oP(e)&&(IP(e)||jP(e)||wP(e)||TP(e)||VP(e))}function HB(e,t,n,r){return t.UseUnevaluated()?Bx(Bx(t.Push(),UB(e,t,n,r)),t.Pop()):UB(e,t,n,r)}function UB(e,t,n,r){e.Push(n);let i=[];if(sP(n))return JF(e,t,n,r);if(tF(n)&&i.push(bB(e,t,n,r)),FB(n)){let a=[];$P(n)&&a.push(pB(e,t,n,r)),uP(n)&&a.push(PF(e,t,n,r)),_P(n)&&a.push(oI(e,t,n,r)),vP(n)&&a.push(lI(e,t,n,r)),yP(n)&&a.push(fI(e,t,n,r)),GP(n)&&a.push(Wz(e,t,n,r)),qP(n)&&a.push($z(e,t,n,r)),JP(n)&&a.push(nB(e,t,n,r)),BP(n)&&a.push(Tz(e,t,n,r)),FP(n)&&a.push(sz(e,t,n,r));let o=DS(a),s=Vx(Hx(Yx(r)),o);i.push(PB(n)?o:s)}if(LB(n)){let a=[];lP(n)&&a.push(wF(e,t,n,r)),hP(n)&&a.push(rI(e,t,n,r)),kP(n)&&a.push(GR(e,t,n,r)),MP(n)&&a.push(YR(e,t,n,r)),NP(n)&&a.push(tz(e,t,n,r)),LP(n)&&a.push(pz(e,t,n,r)),RP(n)&&a.push(yz(e,t,n,r)),KP(n)&&a.push(qz(e,t,n,r)),nF(n)&&a.push(AB(e,t,n,r));let o=DS(a),s=Vx(Hx(Ux(r)),o);i.push(IB(n)?o:s)}if(zB(n)){let a=[];PP(n)&&a.push(iz(e,t,n,r)),zP(n)&&a.push(Sz(e,t,n,r)),EP(n)&&a.push(kR(e,t,n,r)),WP(n)&&a.push(Vz(e,t,n,r));let o=DS(a),s=Vx(Hx(Zx(r)),o);i.push(RB(n)?o:s)}if(VB(n)){let a=[];wP(n)&&a.push(xI(e,t,n,r)),TP(n)&&a.push(wI(e,t,n,r)),jP(n)&&a.push(QR(e,t,n,r)),IP(n)&&a.push(gz(e,t,n,r)),VP(n)&&a.push(Oz(e,t,n,r));let o=DS(a),s=Vx(Hx(Vx(Jx(r),Wx(r))),o);i.push(BB(n)?o:s)}QP(n)&&i.push(uB(e,t,n,r)),ZP(n)&&i.push(aB(e,t,n,r)),xP(n)&&i.push(hI(e,t,n,r)),mP(n)&&i.push(ZF(e,t,n,r)),CP(n)&&i.push(vI(e,t,n,r)),OP(n)&&i.push(MR(e,t,n,r)),HP(n)&&i.push(Nz(e,t,n,r)),dP(n)&&i.push(BF(e,t,n,r)),pP(n)&&i.push(GF(e,t,n,r)),UP(n)&&i.push(Rz(e,t,n,r)),rF(n)&&i.push(Vx(Hx(Ux(r)),CB(e,t,n,r))),iF(n)&&i.push(Vx(Hx(Xx(r)),EB(e,t,n,r))),aP(n)&&i.push(gF(e,t,n,r));let a=DS(i);return e.Pop(n),a}function WB(e,t,n,r){return t.Push()&&GB(e,t,n,r)&&t.Pop()}function GB(e,t,n,r){e.Push(n);let i=sP(n)?YF(e,t,n,r):(!tF(n)||xB(e,t,n,r))&&(!(U(r)&&!H(r))||(!$P(n)||mB(e,t,n,r))&&(!uP(n)||FF(e,t,n,r))&&(!_P(n)||sI(e,t,n,r))&&(!vP(n)||uI(e,t,n,r))&&(!yP(n)||pI(e,t,n,r))&&(!GP(n)||Gz(e,t,n,r))&&(!qP(n)||eB(e,t,n,r))&&(!JP(n)||rB(e,t,n,r))&&(!BP(n)||Ez(e,t,n,r))&&(!FP(n)||cz(e,t,n,r)))&&(!H(r)||(!lP(n)||TF(e,t,n,r))&&(!hP(n)||iI(e,t,n,r))&&(!kP(n)||KR(e,t,n,r))&&(!MP(n)||XR(e,t,n,r))&&(!NP(n)||nz(e,t,n,r))&&(!LP(n)||mz(e,t,n,r))&&(!RP(n)||bz(e,t,n,r))&&(!KP(n)||Jz(e,t,n,r))&&(!nF(n)||jB(e,t,n,r)))&&(!dx(r)||(!PP(n)||az(e,t,n,r))&&(!zP(n)||Cz(e,t,n,r))&&(!EP(n)||AR(e,t,n,r))&&(!WP(n)||Hz(e,t,n,r)))&&(!(lx(r)||rx(r))||(!wP(n)||SI(e,t,n,r))&&(!TP(n)||TI(e,t,n,r))&&(!jP(n)||$R(e,t,n,r))&&(!IP(n)||_z(e,t,n,r))&&(!VP(n)||kz(e,t,n,r)))&&(!QP(n)||dB(e,t,n,r))&&(!ZP(n)||oB(e,t,n,r))&&(!xP(n)||gI(e,t,n,r))&&(!mP(n)||QF(e,t,n,r))&&(!CP(n)||yI(e,t,n,r))&&(!OP(n)||NR(e,t,n,r))&&(!HP(n)||Pz(e,t,n,r))&&(!dP(n)||VF(e,t,n,r))&&(!pP(n)||KF(e,t,n,r))&&(!UP(n)||zz(e,t,n,r))&&(!rF(n)||!H(r)||wB(e,t,n,r))&&(!iF(n)||!U(r)||DB(e,t,n,r))&&(!aP(n)||_F(e,t,n,r));return e.Pop(n),i}function KB(e,t,n,r,i,a){return t.Push()&&qB(e,t,n,r,i,a)&&t.Pop()}function qB(e,t,n,r,i,a){if(t.AtCapacity())return!1;e.Push(i);let o=sP(i)?XF(e,t,n,r,i,a):!!(+(!tF(i)||SB(e,t,n,r,i,a))&(!(U(a)&&!H(a))||!!(+(!$P(i)||hB(e,t,n,r,i,a))&(!uP(i)||IF(e,t,n,r,i,a))&(!_P(i)||cI(e,t,n,r,i,a))&(!vP(i)||dI(e,t,n,r,i,a))&(!yP(i)||mI(e,t,n,r,i,a))&(!GP(i)||Kz(e,t,n,r,i,a))&(!qP(i)||tB(e,t,n,r,i,a))&(!JP(i)||iB(e,t,n,r,i,a))&(!BP(i)||Dz(e,t,n,r,i,a))&(!FP(i)||lz(e,t,n,r,i,a))))&(!H(a)||!!(+(!lP(i)||EF(e,t,n,r,i,a))&(!hP(i)||aI(e,t,n,r,i,a))&(!kP(i)||qR(e,t,n,r,i,a))&(!MP(i)||ZR(e,t,n,r,i,a))&(!NP(i)||rz(e,t,n,r,i,a))&(!LP(i)||hz(e,t,n,r,i,a))&(!RP(i)||xz(e,t,n,r,i,a))&(!KP(i)||Yz(e,t,n,r,i,a))&(!nF(i)||MB(e,t,n,r,i,a))))&(!dx(a)||!!(+(!PP(i)||oz(e,t,n,r,i,a))&(!zP(i)||wz(e,t,n,r,i,a))&(!EP(i)||jR(e,t,n,r,i,a))&(!WP(i)||Uz(e,t,n,r,i,a))))&(!(lx(a)||rx(a))||!!(+(!wP(i)||CI(e,t,n,r,i,a))&(!TP(i)||EI(e,t,n,r,i,a))&(!jP(i)||ez(e,t,n,r,i,a))&(!IP(i)||vz(e,t,n,r,i,a))&(!VP(i)||Az(e,t,n,r,i,a))))&(!QP(i)||fB(e,t,n,r,i,a))&(!ZP(i)||sB(e,t,n,r,i,a))&(!xP(i)||_I(e,t,n,r,i,a))&(!mP(i)||$F(e,t,n,r,i,a))&(!CP(i)||bI(e,t,n,r,i,a))&(!OP(i)||PR(e,t,n,r,i,a))&(!HP(i)||Fz(e,t,n,r,i,a))&(!dP(i)||HF(e,t,n,r,i,a))&(!pP(i)||qF(e,t,n,r,i,a))&(!UP(i)||Bz(e,t,n,r,i,a))&(!rF(i)||!H(a)||TB(e,t,n,r,i,a))&(!iF(i)||!U(a)||OB(e,t,n,r,i,a)))&&(!aP(i)||vF(e,t,n,r,i,a));return e.Pop(i),o}var JB=[0],YB=new Map,XB=new Map;function ZB(){return`${JB[0]++}`}function QB(e,t){YB.has(e)||YB.set(e,new Map);let n=YB.get(e);if(n.has(t))return n.get(t);let r=ZB();return n.set(t,r),r}function $B(e,t,n,r){return e.UseUnevaluated()?yS(`check_${n}`,[`context`,r]):yS(`check_${n}`,[r])}function eV(e,t,n,r){let i=UB(e,t,n,`value`);return t.UseUnevaluated()?wS(`check_${r}`,vS([`context`,`value`],i)):wS(`check_${r}`,vS([`value`],i))}function tV(){JB[0]=0,YB.clear(),XB.clear()}function nV(){return[...XB.values()]}function rV(e,t,n,r){let i=QB(n,e.LexicalBaseURL()),a=$B(t,n,i,r);return XB.has(i)?a:(XB.set(i,``),XB.set(i,eV(e,t,n,i)),a)}function iV(e,t){return U(t)&&!Ax(e)?t[e]:void 0}function aV(e,t){return e.reduce((e,t)=>iV(t,e),t)}function oV(e){if(W(e.length,0))return[];let t=e.split(`/`).map(e=>e.replace(/~1/g,`/`).replace(/~0/g,`~`));return t.length>0&&t[0]===``?t.slice(1):t}function sV(e,t){return aV(oV(t),e)}var cV=`https://json-schema.org`;function lV(e,t){if(U(e)&&bP(e)&&W(e.$dynamicAnchor,t))return e;if(U(e))for(let n of K(e)){let r=lV(e[n],t);if(r)return r}}function uV(e,t,n){if(W(e,n))return t.href;let r=oP(e)&&DP(e)?new URL(e.$id,t.href):t;if(H(e))for(let t of e){let e=uV(t,r,n);if(!px(e))return e}else if(U(e))for(let t of K(e)){let i=uV(e[t],r,n);if(!px(i))return i}}function dV(e,t,n){if(W(e.$id,n.hash))return e;let r=new URL(n.href,t.href);if(W(t.pathname,r.pathname))return n.hash.startsWith(`#`)?mV(e,n):e}function fV(e,t,n){let r=new URL(`#${e.$anchor}`,t.href),i=new URL(n.href,t.href);return W(r.href,i.href)?e:void 0}function pV(e,t,n){let r=new URL(`#${e.$dynamicAnchor}`,t.href),i=new URL(n.href,t.href);return W(r.href,i.href)?e:void 0}function mV(e,t){if(t.href.endsWith(`#`))return e;if(!t.hash.startsWith(`#`))return;let n=decodeURIComponent(t.hash.slice(1));if(n.startsWith(`/`))return sV(e,n)}function hV(e,t,n){if(DP(e)){let r=dV(e,t,n);if(!px(r))return r}if(fP(e)){let r=fV(e,t,n);if(!px(r))return r}if(bP(e)){let r=pV(e,t,n);if(!px(r))return r}return mV(e,n)}function gV(e,t,n){return e.reduce((e,r)=>{let i=yV(r,t,n);return px(i)?e:i},void 0)}function _V(e){return W(e,`const`)||W(e,`enum`)}function vV(e,t,n){return K(e).reduce((r,i)=>{if(_V(i))return r;let a=yV(e[i],t,n);return px(a)?r:a},void 0)}function yV(e,t,n){let r=oP(e)&&DP(e)?new URL(e.$id,t.href):t;if(oP(e)){let t=hV(e,r,n);if(!px(t))return t}if(H(e))return gV(e,r,n);if(U(e))return vV(e,r,n)}function bV(e,t,n){return uV(e,new URL(t||`.`,cV),n)}function xV(e,t,n,r){let i=AV(e,t,n,r,!1);return oP(i)&&DP(i)?i:void 0}function SV(e){return e.href.split(`#`)[0]}function CV(e,t){return G(e,t)?e[t]:void 0}function wV(e,t,n){return yV(e,t,n)}function TV(e,t,n){let r=SV(n);if(W(r,SV(t))||!G(e,r))return;let i=e[r],a=oP(i)&&DP(i)?new URL(i.$id,r):new URL(r);return W(n.hash,``)?i:yV(i,a,n)}function EV(e,t,n,r,i){if(!r.$ref.startsWith(`#`)||G(e,`$schema`))return;let a=bV(t,n,i);if(!(px(a)||W(a,n)))return{target:i,base:a,root:t}}function DV(e,t,n){let r=e[t];if(oP(r))return{target:n,base:t,root:r}}function OV(e,t,n,r,i){let a=i?DV(e.context,r,n):void 0;return px(a)?EV(e.root,e.lexicalSchema,e.referenceBase,t,n):a}function kV(e,t,n,r,i,a){if(DP(i))return;let o=xV(e,t,n,r);if(o&&!a.includes(o))return{target:i,resource:o}}function AV(e,t,n,r,i=!0){let a=new URL(n||`.`,cV),o=i&&DP(t)?new URL(t.$id,a):a,s=new URL(r,o.href);return CV(e,r)??wV(t,o,s)??TV(e,o,s)}function jV(e,t,n,r,i,a){let o=new URL(n||`.`,cV),s=AV(e,i.$dynamicRef.startsWith(`#`)?r:t,n,i.$dynamicRef,!1);if(px(s)){let e=new URL(i.$dynamicRef,o).hash;if(!e.startsWith(`#/`)&&e.startsWith(`#`)){let n=decodeURIComponent(e.slice(1));return a.find(e=>W(e.$dynamicAnchor,n))??lV(t,n)}return}return!oP(s)||!bP(s)||new URL(i.$dynamicRef,o).hash.startsWith(`#/`)?s:a.find(e=>W(e.$dynamicAnchor,s.$dynamicAnchor))??s}function MV(e,t){let n=e.inRetrievedFrame?e.lexicalSchema:e.root,r=t.$ref.startsWith(`#`)?e.lexicalSchema:n,i=AV(e.context,r,e.referenceBase,t.$ref,!1);if(!i||!oP(i))return{schema:i};let a=new URL(t.$ref,e.referenceBase).href.split(`#`)[0],o=!W(a,e.resourceBase);return{schema:i,retrievedResource:OV(e,t,i,a,o),resolvedResource:o?kV(e.context,e.root,e.referenceBase,a,i,e.ids):void 0}}function NV(e,t){let n=XP(e.lexicalSchema)?e.recursiveAnchors[0]:e.lexicalSchema;return AV(e.context,n,e.lexicalBase,t.$recursiveRef,!1)}function PV(e,t){return jV(e.context,e.root,e.lexicalBase,e.lexicalSchema,t,e.dynamicAnchors)}var FV=function(e,t,n,r){if(n===`a`&&!r)throw TypeError(`Private accessor was defined without a getter`);if(typeof t==`function`?e!==t||!r:!t.has(e))throw TypeError(`Cannot read private member from an object whose class did not declare it`);return n===`m`?r:n===`a`?r.call(e):r?r.value:t.get(e)},IV,LV,RV,zV,BV,VV,HV,UV,WV,GV,KV,qV,JV,YV,XV,ZV=class{constructor(e,t){IV.add(this),this.context=e,this.schema=t,this.ids=[],this.resourceIds=[],this.anchors=[],this.recursiveAnchors=[],this.dynamicAnchors=[],this.retrievedResources=new Map,this.retrievedFrames=[],this.resolvedResources=new Map,this.pendingResource=!0}LexicalBaseURL(){return FV(this,IV,`m`,zV).call(this,this.ids)}Push(e){if(!oP(e))return;DP(e)&&FV(this,IV,`m`,qV).call(this,e),fP(e)&&this.anchors.push(e),XP(e)&&this.recursiveAnchors.push(e),bP(e)&&this.dynamicAnchors.push(e);let t=this.retrievedResources.get(e);t&&this.retrievedFrames.push({schema:t.root,base:t.base,idDepth:this.ids.length,resourceDepth:this.resourceIds.length})}Pop(e){oP(e)&&(DP(e)&&FV(this,IV,`m`,JV).call(this,e),fP(e)&&this.anchors.pop(),XP(e)&&this.recursiveAnchors.pop(),bP(e)&&this.dynamicAnchors.pop(),this.retrievedResources.has(e)&&this.retrievedFrames.pop(),FV(this,IV,`m`,XV).call(this,e))}Ref(e){let t=MV(FV(this,IV,`m`,LV).call(this),e);return FV(this,IV,`m`,RV).call(this,t),t.schema}RecursiveRef(e){let t=NV(FV(this,IV,`m`,LV).call(this),e);return t&&(this.pendingResource=!0),t}DynamicRef(e){let t=PV(FV(this,IV,`m`,LV).call(this),e);return t&&(this.pendingResource=!0),t}};IV=new WeakSet,LV=function(){return{context:this.context,root:this.schema,ids:this.ids,lexicalSchema:FV(this,IV,`m`,HV).call(this),lexicalBase:this.LexicalBaseURL(),referenceBase:FV(this,IV,`m`,VV).call(this),resourceBase:FV(this,IV,`m`,BV).call(this),recursiveAnchors:this.recursiveAnchors,dynamicAnchors:this.dynamicAnchors,inRetrievedFrame:this.retrievedFrames.length>0}},RV=function(e){px(e.schema)||(this.pendingResource=!0),px(e.resolvedResource)||FV(this,IV,`m`,YV).call(this,e.resolvedResource.target,e.resolvedResource.resource),px(e.retrievedResource)||this.retrievedResources.set(e.retrievedResource.target,{base:e.retrievedResource.base,root:e.retrievedResource.root})},zV=function(e){let t=this.retrievedFrames[this.retrievedFrames.length-1],n=t?new URL(t.base):new URL(cV);return(t?e.slice(t.idDepth):e).reduce((e,t)=>new URL(t.$id,e),n).href},BV=function(){let e=this.retrievedFrames[this.retrievedFrames.length-1];return e?this.resourceIds.slice(e.resourceDepth).reduce((e,t)=>new URL(t.$id,e),new URL(e.base)).href:FV(this,IV,`m`,zV).call(this,this.resourceIds)},VV=function(){if(this.retrievedFrames.length>0)return FV(this,IV,`m`,BV).call(this);let e=this.ids[this.ids.length-1];return e&&!/^[A-Za-z][A-Za-z0-9+.-]*:/.test(e.$id)?this.LexicalBaseURL():FV(this,IV,`m`,BV).call(this)},HV=function(){let e=this.retrievedFrames[this.retrievedFrames.length-1];return e?this.ids.length>e.idDepth?this.ids[this.ids.length-1]:e.schema:this.ids.length>0?this.ids[this.ids.length-1]:this.schema},UV=function(e){e.forEach(e=>FV(this,IV,`m`,GV).call(this,e,!1))},WV=function(e){e.forEach(e=>FV(this,IV,`m`,KV).call(this,e,!1))},GV=function e(t,n=!0){if(sP(t))return;if(H(t))return FV(this,IV,`m`,UV).call(this,t);if(!oP(t))return;let r=t;if(n||!DP(r)){!n&&bP(r)&&this.dynamicAnchors.push(r);for(let t of K(r))FV(this,IV,`m`,e).call(this,r[t],!1)}},KV=function e(t,n=!0){if(sP(t))return;if(H(t))return FV(this,IV,`m`,WV).call(this,t);if(!oP(t))return;let r=t;if(n||!DP(r)){!n&&bP(r)&&this.dynamicAnchors.pop();for(let t of K(r))FV(this,IV,`m`,e).call(this,r[t],!1)}},qV=function(e){this.ids.push(e);let t=this.pendingResource;this.pendingResource=!1,t&&this.resourceIds.push(e),FV(this,IV,`m`,GV).call(this,e,!0)},JV=function(e){this.ids.pop(),this.resourceIds.length>0&&W(this.resourceIds[this.resourceIds.length-1],e)&&this.resourceIds.pop(),FV(this,IV,`m`,KV).call(this,e,!0)},YV=function(e,t){FV(this,IV,`m`,qV).call(this,t),this.resolvedResources.set(e,t)},XV=function(e){if(!this.resolvedResources.has(e))return;let t=this.resolvedResources.get(e);FV(this,IV,`m`,JV).call(this,t),this.resolvedResources.delete(e)};function QV(e){return`${e.Functions().join(`;
16
+ `)}; return (value) => { ${(e.UseUnevaluated()?[`const context = new CheckContext({}, {})`,`return ${e.Entry()}`]:[`return ${e.Entry()}`]).join(`; `)} }`}function $V(e,t){return ow(`CheckContext`,`Guard`,`Format`,`Hashing`,e.External().identifier,t)(uF,nx,OR,cw,e.External().variables)}function eH(e){let t=new ZV(e.Context(),e.Schema()),n=new uF;return r=>GB(t,n,e.Schema(),r)}function tH(e,t){return aw()?$V(e,t):eH(e)}var nH=class{constructor(e,t,n){this.isAccelerated=e,this.code=t,this.check=n}IsAccelerated(){return this.isAccelerated}Code(){return this.code}Check(e){return this.check(e)}},rH=class{constructor(e,t,n,r,i,a){this.context=e,this.schema=t,this.external=n,this.functions=r,this.entry=i,this.useUnevaluated=a}Context(){return this.context}Schema(){return this.schema}UseUnevaluated(){return this.useUnevaluated}External(){return this.external}Functions(){return this.functions}Entry(){return this.entry}Evaluate(){let e=QV(this),t=tH(this,e);return new nH(aw(),e,t)}};function iH(...e){let[t,n]=JC(e,{2:(e,t)=>[e,t],1:e=>[{},e]});mF(),tV();let r=new ZV(t,n),i=new lF(cF(t,n)),a=rV(r,i,n,`value`),o=nV();return new rH(t,n,hF(),o,a,i.UseUnevaluated())}function aH(...e){let[t,n,r]=JC(e,{3:(e,t,n)=>[e,t,n],2:(e,t)=>[{},e,t]}),i=new ZV(t,n),a=new dF,o=qB(i,a,`#`,``,n,r),s=a.GetErrors(),c=Bw();return[o,s.map(e=>({...e,message:c(e)}))]}function oH(...e){let[t,n,r]=JC(e,{3:(e,t,n)=>[e,t,n],2:(e,t)=>[{},e,t]});return GB(new ZV(t,n),new uF,n,r)}function sH(...e){let[t,n,r]=JC(e,{3:(e,t,n)=>[e,t,n],2:(e,t)=>[{},e,t]});return oH(t,n,r)}function cH(...e){let[t,n,r]=JC(e,{3:(e,t,n)=>[e,t,n],2:(e,t)=>[{},e,t]}),[i,a]=aH(t,n,r);return a}var lH=class extends Error{constructor(e,t,n){super(e),Object.defineProperty(this,"cause",{value:{source:e,errors:n,value:t},writable:!1,configurable:!1,enumerable:!1})}};function uH(e,t,n){return H(n)?n.map(n=>xH(e,t.items,n)):n}function dH(e,t,n){return xH({...e,...t.$defs},TC(t.$ref),n)}function fH(e,t){let n=G(t,`unevaluatedProperties`)?{additionalProperties:t.unevaluatedProperties}:{},r=eP(YN(e,t));return VC(r)?IN(r,n):r}function pH(e,t,n){return xH(e,fH(e,t),n)}function mH(e){return G(e,`additionalProperties`)?e.additionalProperties:void 0}function hH(e,t,n){if(!U(n)||H(n))return n;let r=mH(t);for(let i of K(n)){if(G(t.properties,i)){n[i]=xH(e,t.properties[i],n[i]);continue}if(ix(r)&&W(r,!0)||sC(r)&&sH(e,r,n[i])){n[i]=xH(e,r,n[i]);continue}delete n[i]}return n}function gH(e,t,n){if(!U(n))return n;let r=mH(t),[i,a]=[new RegExp(JE(t)),XE(t)];for(let t of K(n)){if(i.test(t)){n[t]=xH(e,a,n[t]);continue}if(ix(r)&&W(r,!0)||sC(r)&&sH(e,r,n[t])){n[t]=xH(e,r,n[t]);continue}delete n[t]}return n}function _H(e,t,n){return G(e,t.$ref)?xH(e,e[t.$ref],n):n}function vH(e,t,n){if(!H(n))return n;let r=Math.min(n.length,t.items.length);for(let i=0;i<r;i++)n[i]=xH(e,t.items[i],n[i]);return mx(n.length,r)?n.slice(0,r):n}function yH(e){return eC(e)}function bH(e,t,n){for(let r of t.anyOf){let t=xH(e,r,yH(n));if(sH(e,r,t))return t}return n}function xH(e,t,n){return _C(t)?uH(e,t,n):KC(t)?dH(e,t,n):tw(t)?pH(e,t,n):VC(t)?hH(e,t,n):ZE(t)?gH(e,t,n):EC(t)?_H(e,t,n):BT(t)?vH(e,t,n):_T(t)?bH(e,t,n):n}function SH(e,t){for(let n of RS.Keys(e))RS.HasPropertyKey(t,n)||(t[n]=e[n]);return t}function CH(e){let t={};for(let n of RS.Keys(e))t[n]=EH(e[n]);return t}function wH(e){return TH(iP(e))}function TH(e){return e.map(e=>EH(e))}function EH(e){return SH(e,_C(e)?gC(EH(e.items),vC(e)):tw(e)?ew(TH(e.allOf)):_T(e)?gT(wH(e.anyOf)):VC(e)?BC(CH(e.properties)):ZE(e)?GE(YE(e),EH(XE(e))):BT(e)?zT(TH(e.items)):e)}function DH(e){return EH(e)}function OH(...e){let[t,n,r]=JC(e,{3:(e,t,n)=>[e,t,n],2:(e,t)=>[{},e,t]});return xH(t,BS().unionPrioritySort?DH(n):n,r)}function kH(e){return U(e)&&G(e,`value`)}function X(e){return{value:e}}function AH(e){return H(e)?X(e):X([e])}function jH(e){return W(e,!0)?X(BigInt(1)):X(BigInt(0))}var MH=/^-?(0|[1-9]\d*)n$/,NH=/^-?(0|[1-9]\d*)\.\d+$/,PH=/^-?(0|[1-9]\d*)$/;function FH(e){return MH.test(e)}function IH(e){return NH.test(e)}function LH(e){return PH.test(e)}function RH(e){let t=e.toLowerCase();return FH(e)?X(BigInt(e.slice(0,e.length-1))):IH(e)?X(BigInt(e.split(`.`)[0])):LH(e)?X(BigInt(e)):W(t,`false`)?X(BigInt(0)):W(t,`true`)?X(BigInt(1)):void 0}function zH(e){return rx(e)?X(e):ix(e)?jH(e):lx(e)?X(BigInt(Math.trunc(e))):cx(e)?X(BigInt(0)):dx(e)?RH(e):px(e)?X(BigInt(0)):void 0}function BH(e){return W(e,BigInt(0))?X(!1):W(e,BigInt(1))?X(!0):void 0}function VH(e){return W(e,0)?X(!1):W(e,1)?X(!0):void 0}function HH(e){return W(e.toLowerCase(),`false`)?X(!1):W(e.toLowerCase(),`true`)?X(!0):W(e,`0`)?X(!1):W(e,`1`)?X(!0):void 0}function UH(e){return rx(e)?BH(e):ix(e)?X(e):lx(e)?VH(e):cx(e)?X(!1):dx(e)?HH(e):px(e)?X(!1):void 0}function WH(e){return W(e,BigInt(0))?X(null):void 0}function GH(e){return W(e,!1)?X(null):void 0}function KH(e){return W(e,0)?X(null):void 0}function qH(e){let t=e.toLowerCase();return W(t,`undefined`)||W(t,`null`)||W(e,``)||W(e,`0`)?X(null):void 0}function JH(e){return rx(e)?WH(e):ix(e)?GH(e):lx(e)?KH(e):cx(e)?X(null):dx(e)?qH(e):px(e)?X(null):void 0}var YH=BigInt(2**53-1),XH=BigInt(-(2**53-1));function ZH(e){return e<=YH&&e>=XH?X(Number(e)):void 0}function QH(e){return X(+!!e)}function $H(e){let t=+e;if(lx(t))return X(t);let n=e.toLowerCase();if(W(n,`false`))return X(0);if(W(n,`true`))return X(1);let r=zH(e);if(kH(r))return r.value<=YH&&r.value>=XH?X(Number(r.value)):void 0}function eU(e){return rx(e)?ZH(e):ix(e)?QH(e):lx(e)?X(e):cx(e)?X(0):dx(e)?$H(e):px(e)?X(0):void 0}function tU(e){return rx(e)||ix(e)||lx(e)?X(e.toString()):cx(e)?X(`null`):dx(e)?X(e):px(e)?X(``):void 0}function nU(e){return W(e,BigInt(0))?X(void 0):void 0}function rU(e){return W(e,!1)?X(void 0):void 0}function iU(e){return W(e,0)?X(void 0):void 0}function aU(e){let t=e.toLowerCase();return W(t,`undefined`)||W(t,`null`)||W(e,``)||W(e,`0`)?X(void 0):void 0}function oU(e){return rx(e)?nU(e):ix(e)?rU(e):lx(e)?iU(e):cx(e)?X(void 0):dx(e)?aU(e):px(e)?X(e):void 0}function sU(e,t,n){return AH(n).value.map(n=>PU(e,t.items,n))}function cU(e,t,n){let r=zH(n);return kH(r)?r.value:n}function lU(e,t,n){let r=UH(n);return kH(r)?r.value:n}function uU(e,t,n){return PU({...e,...t.$defs},TC(t.$ref),n)}function dU(e,t,n){return PU(e,eP(t),n)}function fU(e,t,n){let r=eU(n);return kH(r)?Math.trunc(r.value):n}function pU(e,t,n){return PU(e,eP(YN(e,t)),n)}function mU(e,t,n){let r=zH(n);return kH(r)&&W(t.const,r.value)?r.value:n}function hU(e,t,n){let r=UH(n);return kH(r)&&W(t.const,r.value)?r.value:n}function gU(e,t,n){let r=eU(n);return kH(r)&&W(t.const,r.value)?r.value:n}function _U(e,t,n){let r=tU(n);return kH(r)&&W(t.const,r.value)?r.value:n}function vU(e,t,n){return W(t.const,n)?n:nT(t)?mU(e,t,n):rT(t)?hU(e,t,n):iT(t)?gU(e,t,n):aT(t)?_U(e,t,n):sw()}function yU(e,t,n){let r=JH(n);return kH(r)?r.value:n}function bU(e,t,n){let r=eU(n);return kH(r)?r.value:n}function xU(e,t,n,r){let i=K(r);for(let[a,o]of t)for(let t of i)a.test(t)||(r[t]=PU(e,n,r[t]));return r}function SU(e,t,n){return IC(e)&&px(n[t])}function CU(e,t,n){let r=jx(t.properties),i=K(n);for(let[t,a]of r)for(let r of i)t.test(r)&&!SU(a,r,n)&&(n[r]=PU(e,a,n[r]));return G(t,`additionalProperties`)&&U(t.additionalProperties)?xU(e,r,t.additionalProperties,n):n}function wU(e,t,n){return ux(n)?CU(e,t,n):n}function TU(e,t,n){let r=jx(t.patternProperties),i=K(n);for(let[t,a]of r)for(let r of i)t.test(r)&&(n[r]=PU(e,a,n[r]));return G(t,`additionalProperties`)&&U(t.additionalProperties)?xU(e,r,t.additionalProperties,n):n}function EU(e,t,n){return ux(n)?TU(e,t,n):n}function DU(e,t,n){return G(e,t.$ref)?PU(e,e[t.$ref],n):n}function OU(e,t,n){let r=tU(n);return kH(r)?r.value:n}function kU(e,t,n){return PU(e,eP(t),n)}function AU(e,t,n){if(!H(n))return n;for(let r=0;r<Math.min(t.items.length,n.length);r++)n[r]=PU(e,t.items[r],n[r]);return n}function jU(e,t,n){let r=oU(n);return kH(r)?r.value:n}function MU(e,t,n){if(t.anyOf.some(t=>sH(e,t,n)))return n;let r=t.anyOf.map(t=>PU(e,t,yH(n))).find(n=>sH(e,t,n));return px(r)?n:r}function NU(e,t,n){return kH(oU(n))?void 0:n}function PU(e,t,n){return _C(t)?sU(e,t,n):qw(t)?cU(e,t,n):Jw(t)?lU(e,t,n):KC(t)?uU(e,t,n):$C(t)?dU(e,t,n):Zw(t)?fU(e,t,n):tw(t)?pU(e,t,n):oT(t)?vU(e,t,n):cT(t)?yU(e,t,n):dT(t)?bU(e,t,n):VC(t)?wU(e,t,n):ZE(t)?EU(e,t,n):EC(t)?DU(e,t,n):hT(t)?OU(e,t,n):gO(t)?kU(e,t,n):BT(t)?AU(e,t,n):nD(t)?jU(e,t,n):_T(t)?MU(e,t,n):rD(t)?NU(e,t,n):n}function FU(...e){let[t,n,r]=JC(e,{3:(e,t,n)=>[e,t,n],2:(e,t)=>[{},e,t]});return PU(t,n,r)}function IU(e,t,n){if(!H(n))return n;for(let r=0;r<n.length;r++)n[r]=GU(e,t.items,n[r]);return n}function LU(e,t,n){return GU({...e,...t.$defs},TC(t.$ref),n)}function RU(e,t){return px(t)?ox(e.default)?e.default():yH(e.default):t}function zU(e,t,n){return GU(e,eP(YN(e,t)),n)}function BU(e,t,n){if(!U(n))return n;let r=K(t.properties);for(let i of r){let r=GU(e,t.properties[i],n[i]);(!px(r)||!IC(t.properties[i])&&G(t.properties[i],`default`))&&(n[i]=r)}if(!uP(t)||ix(t.additionalProperties))return n;for(let i of K(n))r.includes(i)||(n[i]=GU(e,t.additionalProperties,n[i]));return n}function VU(e,t,n){if(!U(n))return n;let[r,i]=[new RegExp(JE(t)),XE(t)];for(let t of K(n))r.test(t)&&gP(i)&&(n[t]=GU(e,i,n[t]));if(!uP(t))return n;for(let i of K(n))r.test(i)||(n[i]=GU(e,t.additionalProperties,n[i]));return n}function HU(e,t,n){return G(e,t.$ref)?GU(e,e[t.$ref],n):n}function UU(e,t,n){if(!H(n))return n;let[r,i]=[t.items,Math.max(t.items.length,n.length)];for(let t=0;t<i;t++)t<r.length&&(n[t]=GU(e,r[t],n[t]));return n}function WU(e,t,n){for(let r of t.anyOf){let t=GU(e,r,yH(n));if(sH(e,r,t))return t}return n}function GU(e,t,n){let r=gP(t)?RU(t,n):n;return _C(t)?IU(e,t,r):KC(t)?LU(e,t,r):tw(t)?zU(e,t,r):VC(t)?BU(e,t,r):ZE(t)?VU(e,t,r):EC(t)?HU(e,t,r):BT(t)?UU(e,t,r):_T(t)?WU(e,t,r):r}function KU(...e){let[t,n,r]=JC(e,{3:(e,t,n)=>[e,t,n],2:(e,t)=>[{},e,t]});return GU(t,n,r)}function qU(e){return(...t)=>{let[n,r,i]=JC(t,{3:(e,t,n)=>[e,t,n],2:(e,t)=>[{},e,t]});return e.reduce((e,t)=>t(n,r,e),i)}}function JU(e,t,n){return t[`~codec`].decode(n)}function YU(e,t,n){return t[`~codec`].encode(n)}function XU(e,t,n,r){return Vw(n)?W(e,`Decode`)?JU(t,n,r):YU(t,n,r):r}function ZU(e,t,n,r){if(!H(r))return r;for(let i=0;i<r.length;i++)r[i]=bW(e,t,n.items,r[i]);return XU(e,t,n,r)}function QU(e,t,n,r){let i=XU(e,t,n,r);if(!H(i))return i;for(let r=0;r<i.length;r++)i[r]=bW(e,t,n.items,i[r]);return i}function $U(e,t,n,r){return W(e,`Decode`)?ZU(e,t,n,r):QU(e,t,n,r)}function eW(e,t,n,r){return r=bW(e,{...t,...n.$defs},TC(n.$ref),r),XU(e,t,n,r)}function tW(e){return e.reduce((e,t)=>({...e,...t}),{})}function nW(e,t){for(let n of t)if(!Lx(e,n))return n;return e}function rW(e,t,n,r){if(W(n.allOf.length,0))return XU(e,t,n,r);let i=n.allOf.map(n=>bW(e,t,n,OH(n,yH(r))));return XU(e,t,n,i.every(e=>U(e))?tW(i):nW(r,i))}function iW(e,t,n,r){if(W(n.allOf.length,0))return XU(e,t,n,r);let i=XU(e,t,n,r),a=n.allOf.map(n=>bW(e,t,n,OH(n,yH(i))));return a.every(e=>U(e))?tW(a):nW(i,a)}function aW(e,t,n,r){return W(e,`Decode`)?rW(e,t,n,r):iW(e,t,n,r)}function oW(e,t,n,r){if(!ux(r))return r;for(let i of K(n.properties))G(r,i)&&!SU(n.properties[i],i,r)&&(r[i]=bW(e,t,n.properties[i],r[i]));return XU(e,t,n,r)}function sW(e,t,n,r){let i=XU(e,t,n,r);if(!ux(i))return i;for(let r of K(n.properties))G(i,r)&&!SU(n.properties[r],r,i)&&(i[r]=bW(e,t,n.properties[r],i[r]));return i}function cW(e,t,n,r){return W(e,`Decode`)?oW(e,t,n,r):sW(e,t,n,r)}function lW(e,t,n,r){if(!ux(r))return r;let i=new RegExp(JE(n));for(let a of K(r))i.test(a)&&(r[a]=bW(e,t,XE(n),r[a]));return XU(e,t,n,r)}function uW(e,t,n,r){let i=XU(e,t,n,r);if(!ux(i))return i;let a=new RegExp(JE(n));for(let r of K(i))a.test(r)&&(i[r]=bW(e,t,XE(n),i[r]));return i}function dW(e,t,n,r){return W(e,`Decode`)?lW(e,t,n,r):uW(e,t,n,r)}function fW(e,t,n,r){return G(t,n.$ref)?bW(e,t,t[n.$ref],r):r}function pW(e,t,n,r){return W(e,`Decode`)?XU(e,t,n,fW(e,t,n,r)):fW(e,t,n,XU(e,t,n,r))}function mW(e,t,n,r){if(!H(r))return r;for(let i=0;i<Math.min(n.items.length,r.length);i++)r[i]=bW(e,t,n.items[i],r[i]);return XU(e,t,n,r)}function hW(e,t,n,r){let i=XU(e,t,n,r);if(!H(i))return r;for(let r=0;r<Math.min(n.items.length,i.length);r++)i[r]=bW(e,t,n.items[r],i[r]);return i}function gW(e,t,n,r){return W(e,`Decode`)?mW(e,t,n,r):hW(e,t,n,r)}function _W(e,t,n,r){for(let i of n.anyOf)if(sH(t,i,r))return XU(e,t,n,bW(e,t,i,r));return r}function vW(e,t,n,r){let i=XU(e,t,n,r);for(let r of n.anyOf){let n=bW(e,t,r,yH(i));if(sH(t,r,n))return n}return i}function yW(e,t,n,r){return W(e,`Decode`)?_W(e,t,n,r):vW(e,t,n,r)}function bW(e,t,n,r){return _C(n)?$U(e,t,n,r):KC(n)?eW(e,t,n,r):tw(n)?aW(e,t,n,r):VC(n)?cW(e,t,n,r):ZE(n)?dW(e,t,n,r):EC(n)?pW(e,t,n,r):BT(n)?gW(e,t,n,r):_T(n)?yW(e,t,n,r):XU(e,t,n,r)}var xW=class extends lH{constructor(e,t){super(`Decode`,e,t)}};function SW(e,t,n){if(!sH(e,t,n))throw new xW(n,cH(e,t,n));return n}function CW(e,t,n){return bW(`Decode`,e,BS().unionPrioritySort?DH(t):t,n)}var wW=qU([(e,t,n)=>yH(n),(e,t,n)=>KU(e,t,n),(e,t,n)=>FU(e,t,n),(e,t,n)=>OH(e,t,n),(e,t,n)=>SW(e,t,n),(e,t,n)=>CW(e,t,n)]);function TW(...e){let[t,n,r]=JC(e,{3:(e,t,n)=>[e,t,n],2:(e,t)=>[{},e,t]});return wW(t,n,r)}var EW=class extends lH{constructor(e,t){super(`Encode`,e,t)}};function DW(e,t,n){if(!sH(e,t,n))throw new EW(n,cH(e,t,n));return n}function OW(e,t,n){return bW(`Encode`,e,BS().unionPrioritySort?DH(t):t,n)}var kW=qU([(e,t,n)=>yH(n),(e,t,n)=>OW(e,t,n),(e,t,n)=>KU(e,t,n),(e,t,n)=>FU(e,t,n),(e,t,n)=>OH(e,t,n),(e,t,n)=>DW(e,t,n)]);function AW(...e){let[t,n,r]=JC(e,{3:(e,t,n)=>[e,t,n],2:(e,t)=>[{},e,t]});return kW(t,n,r)}function jW(e,t){return Vw(t)||zW(e,t.items)}function MW(e,t){return Vw(t)||IW({...e,...t.$defs},TC(t.$ref))}function NW(e,t){return Vw(t)||t.allOf.some(t=>zW(e,t))}function PW(e,t){return Vw(t)||K(t.properties).some(n=>zW(e,t.properties[n]))}function FW(e,t){return Vw(t)||zW(e,XE(t))}function IW(e,t){return!BW.has(t.$ref)&&(BW.add(t.$ref),Vw(t)||G(e,t.$ref)&&zW(e,e[t.$ref]))}function LW(e,t){return Vw(t)||t.items.some(t=>zW(e,t))}function RW(e,t){return Vw(t)||t.anyOf.some(t=>zW(e,t))}function zW(e,t){return _C(t)?jW(e,t):KC(t)?MW(e,t):tw(t)?NW(e,t):VC(t)?PW(e,t):ZE(t)?FW(e,t):EC(t)?IW(e,t):BT(t)?LW(e,t):_T(t)?RW(e,t):Vw(t)}var BW=new Set;function VW(...e){let[t,n]=JC(e,{2:(e,t)=>[e,t],1:e=>[{},e]});return BW.clear(),zW(t,n)}var HW=class extends Error{constructor(e,t){super(t),this.type=e}};function UW(e,t){return ox(t.default)?t.default(t):U(t.default)?yH(t.default):t.default}function WW(e,t){if(nF(t)&&!gP(t))throw new HW(t,`Arrays with uniqueItems constraints must specify a default annotation`);let n=RP(t)?t.minItems:0;return Array.from({length:n},()=>dG(e,t.items))}function GW(e,t){return TP(t)?BigInt(t.exclusiveMinimum)+BigInt(1):IP(t)?BigInt(t.minimum):BigInt(0)}function KW(e,t){return!1}function qW(e,t){let n=dG(e,t.instanceType);return class{constructor(){Object.assign(this,n)}}}function JW(e,t){return dG({...e,...t.$defs},TC(t.$ref))}function YW(e,t){return dG(e,eP(t))}function XW(e,t){let n=dG(e,t.returnType);return()=>n}function ZW(e,t){return TP(t)&&lx(t.exclusiveMinimum)?t.exclusiveMinimum+1:IP(t)?t.minimum:0}function QW(e,t){return dG(e,eP(YN(e,t)))}function $W(e,t){return t.const}function eG(e,t){throw new HW(t,`Cannot create TNever types`)}function tG(e,t){return null}function nG(e,t){return TP(t)&&lx(t.exclusiveMinimum)?t.exclusiveMinimum+1:IP(t)?t.minimum:0}function rG(e,t){return(px(t.required)?[]:t.required).reduce((n,r)=>({...n,[r]:dG(e,t.properties[r])}),{})}function iG(e,t){if(BP(t)&&!gP(t))throw new HW(t,`Record with the minProperties constraint must have a default annotation`);return{}}function aG(e,t){return G(e,t.$ref)?dG(e,e[t.$ref]):(()=>{throw new HW(t,`Unable to deref Ref`)})()}function oG(e,t){if((WP(t)||EP(t))&&!gP(t))throw Error(`Strings with format or pattern constraints must specify default`);let n=zP(t)?t.minLength:0;return``.padEnd(n)}function sG(e,t){return Symbol()}function cG(e,t){let n=FT(t.pattern);if(hT(n))throw new HW(t,`Unable to create TemplateLiteral due to infinite type expansion`);return dG(e,n)}function lG(e,t){return Array.from({length:t.minItems},(n,r)=>dG(e,t.items[r]))}function uG(e,t){if(W(t.anyOf.length,0))throw Error(`Unable to create Union with no variants`);return dG(e,t.anyOf[0])}function dG(e,t){return gP(t)?UW(e,t):_C(t)?WW(e,t):qw(t)?GW(e,t):Jw(t)?KW(e,t):bC(t)?qW(e,t):KC(t)?JW(e,t):$C(t)?YW(e,t):CC(t)?XW(e,t):Zw(t)?ZW(e,t):tw(t)?QW(e,t):oT(t)?$W(e,t):NC(t)?eG(e,t):cT(t)?tG(e,t):dT(t)?nG(e,t):VC(t)?rG(e,t):ZE(t)?iG(e,t):EC(t)?aG(e,t):hT(t)?oG(e,t):pT(t)?sG(e,t):gO(t)?cG(e,t):BT(t)?lG(e,t):nD(t)?void 0:_T(t)?uG(e,t):(rD(t),void 0)}function fG(...e){let[t,n]=JC(e,{2:(e,t)=>[e,t],1:e=>[{},e]});return dG(t,n)}var pG=class extends lH{constructor(e,t){super(`Parse`,e,t)}};function mG(e,t,n){if(!sH(e,t,n))throw new pG(n,cH(e,t,n));return n}var hG=qU([(e,t,n)=>yH(n),(e,t,n)=>KU(e,t,n),(e,t,n)=>FU(e,t,n),(e,t,n)=>OH(e,t,n),(e,t,n)=>mG(e,t,n)]);gT([BC({type:eT(`insert`),path:mT(),value:UC()}),Object({type:eT(`update`),path:mT(),value:UC()}),BC({type:eT(`delete`),path:mT()})]);var gG=class{constructor(e,t){this.hasCodec=VW(e,t),this.buildResult=iH(e,t),this.evaluateResult=this.buildResult.Evaluate()}IsAccelerated(){return this.evaluateResult.IsAccelerated()}Context(){return this.buildResult.Context()}Type(){return this.buildResult.Schema()}Code(){return this.evaluateResult.Code()}Check(e){return this.evaluateResult.Check(e)}Parse(e){if(this.Check(e))return e;if(BS().correctiveParse)return hG(this.Context(),this.Type(),e);throw new pG(e,this.Errors(e))}Errors(e){return this.IsAccelerated()&&this.Check(e)?[]:cH(this.Context(),this.Type(),e)}Clean(e){return OH(this.Context(),this.Type(),e)}Convert(e){return FU(this.Context(),this.Type(),e)}Create(){return fG(this.Context(),this.Type())}Default(e){return KU(this.Context(),this.Type(),e)}Decode(e){return this.hasCodec?TW(this.Context(),this.Type(),e):this.Parse(e)}Encode(e){return this.hasCodec?AW(this.Context(),this.Type(),e):this.Parse(e)}};function _G(...e){let[t,n]=JC(e,{2:(e,t)=>[e,t],1:e=>[{},e]});return new gG(t,n)}var vG=new WeakMap,yG=Symbol.for(`TypeBox.Kind`);function bG(e){return typeof e.type==`string`?[e.type]:Array.isArray(e.type)?e.type.filter(e=>typeof e==`string`):[]}function xG(e,t){switch(t){case`number`:return typeof e==`number`;case`integer`:return typeof e==`number`&&Number.isInteger(e);case`boolean`:return typeof e==`boolean`;case`string`:return typeof e==`string`;case`null`:return e===null;case`array`:return Array.isArray(e);case`object`:return typeof e==`object`&&!!e&&!Array.isArray(e);default:return!1}}function SG(e){try{return kG(e)}catch{return}}function CG(e,t){switch(t){case`number`:if(e===null)return 0;if(typeof e==`string`&&e.trim()!==``){let t=Number(e);if(Number.isFinite(t))return t}return typeof e==`boolean`?+!!e:e;case`integer`:if(e===null)return 0;if(typeof e==`string`&&e.trim()!==``){let t=Number(e);if(Number.isInteger(t))return t}return typeof e==`boolean`?+!!e:e;case`boolean`:if(e===null)return!1;if(typeof e==`string`){if(e===`true`)return!0;if(e===`false`)return!1}if(typeof e==`number`){if(e===1)return!0;if(e===0)return!1}return e;case`string`:return e===null?``:typeof e==`number`||typeof e==`boolean`?String(e):e;case`null`:return e===``||e===0||e===!1?null:e;default:return e}}function wG(e,t){let n=t.properties,r=new Set(n?Object.keys(n):[]);if(n)for(let[t,r]of Object.entries(n))t in e&&(e[t]=DG(e[t],r));if(t.additionalProperties&&typeof t.additionalProperties==`object`)for(let[n,i]of Object.entries(e))r.has(n)||(e[n]=DG(i,t.additionalProperties))}function TG(e,t){if(Array.isArray(t.items)){for(let n=0;n<e.length;n++){let r=t.items[n];r&&(e[n]=DG(e[n],r))}return}if(t.items&&typeof t.items==`object`)for(let n=0;n<e.length;n++)e[n]=DG(e[n],t.items)}function EG(e,t){for(let n of t)if(SG(n)?.Check(e))return e;for(let n of t){let t=DG(structuredClone(e),n);if(SG(n)?.Check(t))return t}return e}function DG(e,t){let n=e;if(Array.isArray(t.allOf))for(let e of t.allOf)n=DG(n,e);Array.isArray(t.anyOf)&&(n=EG(n,t.anyOf)),Array.isArray(t.oneOf)&&(n=EG(n,t.oneOf));let r=bG(t),i=r.length>1&&r.some(e=>xG(n,e));if(r.length>0&&!i)for(let e of r){let t=CG(n,e);if(t!==n){n=t;break}}return r.includes(`object`)&&typeof n==`object`&&n&&!Array.isArray(n)&&wG(n,t),r.includes(`array`)&&Array.isArray(n)&&TG(n,t),n}function OG(e,t){if(Array.isArray(e)){if(Array.isArray(t.items))for(let n=0;n<e.length;n++){let r=t.items[n];r&&OG(e[n],r)}else if(t.items)for(let n of e)OG(n,t.items);return}if(typeof e!=`object`||!e||!t.properties)return;let n=e,r=new Set(t.required??[]);for(let[e,i]of Object.entries(t.properties))e in n&&(n[e]===null&&!r.has(e)&&typeof i.$ref!=`string`&&SG(i)?.Check(null)===!1?delete n[e]:OG(n[e],i))}function kG(e){let t=e,n=vG.get(t);if(n)return n;let r=_G(e);return vG.set(t,r),r}function AG(e){if(e.keyword===`required`){let t=e.params.requiredProperties?.[0];if(t){let n=e.instancePath.replace(/^\//,``).replace(/\//g,`.`);return n?`${n}.${t}`:t}}return e.instancePath.replace(/^\//,``).replace(/\//g,`.`)||`root`}function jG(e,t){let n=structuredClone(t.arguments);OG(n,e.parameters),FU(e.parameters,n);let r=kG(e.parameters);if(!Object.getOwnPropertySymbols(e.parameters).includes(yG)){let t=DG(n,e.parameters);if(t!==n){if(typeof n==`object`&&n&&typeof t==`object`&&t){for(let e of Object.keys(n))delete n[e];Object.assign(n,t)}else return r.Check(t)?t:n}}if(r.Check(n))return n;let i=r.Errors(n).map(e=>` - ${AG(e)}: ${e.message}`).join(`
17
+ `)||`Unknown validation error`,a=`Validation failed for tool "${t.name}":\n${i}\n\nReceived arguments:\n${JSON.stringify(t.arguments,null,2)}`;throw Error(a)}function MG(e,t){try{return Promise.resolve(t(NG))}catch(e){return Promise.reject(e)}}var NG={startSpan:MG,addEvent:()=>{},setAttributes:()=>{},setStatus:()=>{}};Object.freeze(NG);function PG(){throw Error(`No default stream function configured. Pass streamFn explicitly or call setDefaultStreamFn().`)}async function FG(e,t,n,r,i,a){let o=RG(t,e),s=[...o],c={...t,messages:[...t.messages,...o]};await r({type:`agent_start`}),await r({type:`turn_start`});for(let e of o)await r({type:`message_start`,message:e}),await r({type:`message_end`,message:e});return await LG(c,s,n,i,r,a??PG()),s}async function IG(e,t,n,r,i){if(e.messages.length===0)throw Error(`Cannot continue: no messages in context`);if(e.messages[e.messages.length-1].role===`assistant`)throw Error(`Cannot continue from message role: assistant`);let a=[],o={...e};return await n({type:`agent_start`}),await n({type:`turn_start`}),await LG(o,a,t,r,n,i??PG()),a}async function LG(e,t,n,r,i,a){let o=e,s=n,c,l=!1,u=await s.getSteeringMessages?.()||[];for(;;){let e=!0;for(;e||u.length>0;){let n=[];if(c){let e=await s.prepareNextTurn?.(c);e&&(o=e.context??o,n=e.messages??[],s={...s,model:e.model??s.model,reasoning:e.thinkingLevel===void 0?s.reasoning:e.thinkingLevel===`off`?void 0:e.thinkingLevel}),u.length===0&&(u=await s.getSteeringMessages?.()||[]),await i({type:`turn_start`})}for(let e of RG(o,[...n,...u]))await i({type:`message_start`,message:e}),await i({type:`message_end`,message:e}),o.messages.push(e),t.push(e);u=[];let d=await s.prepareRequest?.({context:o,model:s.model,thinkingLevel:s.reasoning??`off`},r);d&&(o=d.context??o,s={...s,model:d.model??s.model,reasoning:d.thinkingLevel===void 0?s.reasoning:d.thinkingLevel===`off`?void 0:d.thinkingLevel});let f=await VG(o,s,r,i,a);if(t.push(f),f.stopReason===`error`||f.stopReason===`aborted`){c={message:f,toolResults:[],context:o,newMessages:t},await s.finishTurn?.(c,r),await i({type:`turn_end`,message:f,toolResults:[]}),await i({type:`agent_end`,messages:t});return}let p=f.content.filter(e=>e.type===`toolCall`),m=[];if(e=!1,p.length>0){let n=f.stopReason===`length`?await HG(p,i):await UG(o,f,s,r,i);m.push(...n.messages),e=!n.terminate;for(let e of m)o.messages.push(e),t.push(e)}c={message:f,toolResults:m,context:o,newMessages:t};let h=await s.finishTurn?.(c,r);if(await i({type:`turn_end`,message:f,toolResults:m}),h?.action===`end`){await i({type:`agent_end`,messages:t});return}l=h?.action===`continue`,u=await s.getSteeringMessages?.()||[],(e||u.length>0)&&(l=!1)}let n=await s.getFollowUpMessages?.()||[];if(n.length>0){l=!1,u=n;continue}if(l){l=!1;continue}break}await i({type:`agent_end`,messages:t})}function RG(e,t){let n=-1;for(let e=t.length-1;e>=0;e--)if(t[e].role===`system`){n=e;break}let r=t[n],i=r?t.map((e,t)=>t===n?BG(r,zG):e):t,a=Wr(Lr([...e.messages,...i]),(e.tools??[]).map(Hr)),o=a.toolsAdded.length===0&&a.toolsRemoved.length===0;if(r)return o&&!r.toolsAdded?.length&&!r.toolsRemoved?.length?t:i.map((e,t)=>t===n?BG(r,a):e);if(o)return t;let s=BG({role:`system`,content:``,timestamp:Date.now()},a),c=t.findIndex(e=>e.role!==`system`),l=c===-1?t.length:c;return[...t.slice(0,l),s,...t.slice(l)]}var zG={toolsAdded:[],toolsRemoved:[]};function BG(e,{toolsAdded:t,toolsRemoved:n}){let{toolsAdded:r,toolsRemoved:i,...a}=e;return{...a,...t.length>0?{toolsAdded:t}:{},...n.length>0?{toolsRemoved:n}:{}}}async function VG(e,t,n,r,i){let a=e.messages;t.transformContext&&(a=await t.transformContext(a,n));let o=Pr({messages:await t.convertToLlm(a)}),s=(t.getApiKey?await t.getApiKey(t.model.provider):void 0)||t.apiKey,c=await i(t.model,o,{...t,apiKey:s,signal:n}),l=null,u=!1;for await(let t of c)switch(t.type){case`start`:l=t.partial,e.messages.push(l),u=!0,await r({type:`message_start`,message:{...l}});break;case`text_start`:case`text_delta`:case`text_end`:case`thinking_start`:case`thinking_delta`:case`thinking_end`:case`toolcall_start`:case`toolcall_delta`:case`toolcall_end`:l&&(l=t.partial,e.messages[e.messages.length-1]=l,await r({type:`message_update`,assistantMessageEvent:t,message:{...l}}));break;case`done`:case`error`:{let t=await c.result();return u?e.messages[e.messages.length-1]=t:e.messages.push(t),u||await r({type:`message_start`,message:{...t}}),await r({type:`message_end`,message:t}),t}}let d=await c.result();return u?e.messages[e.messages.length-1]=d:(e.messages.push(d),await r({type:`message_start`,message:{...d}})),await r({type:`message_end`,message:d}),d}async function HG(e,t){let n=[];for(let r of e){await t({type:`tool_execution_start`,toolCallId:r.id,toolName:r.name,args:r.arguments});let e={toolCall:r,result:ZG(`Tool call "${r.name}" was not executed: the response hit the output token limit, so its arguments may be truncated. Re-issue the tool call with complete arguments.`),isError:!0};await QG(e,t);let i=$G(e);await eK(i,t),n.push(i)}return{messages:n,terminate:!1}}async function UG(e,t,n,r,i){let a=t.content.filter(e=>e.type===`toolCall`),o=a.some(t=>e.tools?.find(e=>e.name===t.name)?.executionMode===`sequential`);return n.toolExecution===`sequential`||o?WG(e,t,a,n,r,i):GG(e,t,a,n,r,i)}async function WG(e,t,n,r,i,a){let o=[],s=[];for(let c of n){await a({type:`tool_execution_start`,toolCallId:c.id,toolName:c.name,args:c.arguments});let n=await JG(e,t,c,r,i),l;l=n.kind===`immediate`?{toolCall:c,result:n.result,isError:n.isError}:await XG(e,t,n,await YG(n,i,a),r,i),await QG(l,a);let u=$G(l);if(await eK(u,a),o.push(l),s.push(u),i?.aborted)break}return{messages:s,terminate:KG(o)}}async function GG(e,t,n,r,i,a){let o=[];for(let s of n){await a({type:`tool_execution_start`,toolCallId:s.id,toolName:s.name,args:s.arguments});let n=await JG(e,t,s,r,i);if(n.kind===`immediate`){let e={toolCall:s,result:n.result,isError:n.isError};if(await QG(e,a),o.push(e),i?.aborted)break;continue}if(o.push(async()=>{if(i?.aborted){let e={toolCall:s,result:ZG(`Operation aborted`),isError:!0};return await QG(e,a),e}let o=await YG(n,i,a),c=await XG(e,t,n,o,r,i);return await QG(c,a),c}),i?.aborted)break}let s=await Promise.all(o.map(e=>typeof e==`function`?e():Promise.resolve(e))),c=[];for(let e of s){let t=$G(e);await eK(t,a),c.push(t)}return{messages:c,terminate:KG(s)}}function KG(e){return e.length>0&&e.every(e=>e.result.terminate===!0)}function qG(e,t){if(!e.prepareArguments)return t;let n=e.prepareArguments(t.arguments);return n===t.arguments?t:{...t,arguments:n}}async function JG(e,t,n,r,i){let a=e.tools?.find(e=>e.name===n.name);if(!a)return{kind:`immediate`,result:ZG(`Tool ${n.name} not found`),isError:!0};try{let o=jG(a,qG(a,n));if(r.beforeToolCall){let a=await r.beforeToolCall({assistantMessage:t,toolCall:n,args:o,context:e},i);if(i?.aborted)return{kind:`immediate`,result:ZG(`Operation aborted`),isError:!0};if(a?.block){let e=ZG(a.reason||`Tool execution was blocked`);return a.terminate===!0&&(e.terminate=!0),{kind:`immediate`,result:e,isError:!0}}}return i?.aborted?{kind:`immediate`,result:ZG(`Operation aborted`),isError:!0}:{kind:`prepared`,toolCall:n,tool:a,args:o}}catch(e){return{kind:`immediate`,result:ZG(e instanceof Error?e.message:String(e)),isError:!0}}}async function YG(e,t,n){let r=[],i=!0;try{let a=await e.tool.execute(e.toolCall.id,e.args,t,t=>{i&&r.push(Promise.resolve(n({type:`tool_execution_update`,toolCallId:e.toolCall.id,toolName:e.toolCall.name,args:e.toolCall.arguments,partialResult:t})))});return i=!1,await Promise.all(r),{result:a,isError:!1}}catch(e){return i=!1,await Promise.all(r),{result:ZG(e instanceof Error?e.message:String(e)),isError:!0}}finally{i=!1}}async function XG(e,t,n,r,i,a){let o=r.result,s=r.isError;if(i.afterToolCall)try{let r=await i.afterToolCall({assistantMessage:t,toolCall:n.toolCall,args:n.args,result:o,isError:s,context:e},a);r&&(o={...o,content:r.content??o.content,details:r.details??o.details,usage:r.usage??o.usage,terminate:r.terminate??o.terminate},s=r.isError??s)}catch(e){o=ZG(e instanceof Error?e.message:String(e)),s=!0}return{toolCall:n.toolCall,result:o,isError:s}}function ZG(e){return{content:[{type:`text`,text:e}],details:{}}}async function QG(e,t){await t({type:`tool_execution_end`,toolCallId:e.toolCall.id,toolName:e.toolCall.name,result:e.result,isError:e.isError})}function $G(e){return{role:`toolResult`,toolCallId:e.toolCall.id,toolName:e.toolCall.name,content:e.result.content??[],details:e.result.details,usage:e.result.usage,isError:e.isError,timestamp:Date.now()}}async function eK(e,t){await t({type:`message_start`,message:e}),await t({type:`message_end`,message:e})}function tK(e){return e.filter(e=>e.role===`system`||e.role===`user`||e.role===`assistant`||e.role===`toolResult`)}var nK={input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},rK={id:`unknown`,name:`unknown`,api:`unknown`,provider:`unknown`,baseUrl:``,reasoning:!1,input:[],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:0,maxTokens:0};function iK(e){let t=e?.tools?.slice()??[],n=e?.messages?.slice()??[],r=Nr(e?.systemPrompt,t.map(Hr));return n[0]?.role!==`system`&&r&&n.unshift(r),{get systemPrompt(){return zr(n)},model:e?.model??rK,thinkingLevel:e?.thinkingLevel??`off`,get tools(){return t},set tools(e){t=e.slice()},get messages(){return n},set messages(e){n=e.slice()},isStreaming:!1,streamingMessage:void 0,pendingToolCalls:new Set,errorMessage:void 0}}var aK=class{messages=[];mode;constructor(e){this.mode=e}enqueue(e){this.messages.push(e)}hasItems(){return this.messages.length>0}peek(){if(this.mode===`all`)return this.messages.slice();let e=this.messages[0];return e?[e]:[]}drain(){let e=this.peek();return this.messages=this.messages.slice(e.length),e}clear(){this.messages=[]}},oK=class{_state;listeners=new Set;steeringQueue;followUpQueue;convertToLlm;transformContext;streamFunction;getApiKey;onPayload;onResponse;beforeToolCall;afterToolCall;finishTurn;prepareRequest;prepareNextTurn;prepareNextTurnWithContext;activeRun;sessionId;thinkingBudgets;transport;maxRetryDelayMs;toolExecution;constructor(e){let t=e??{};this._state=iK(t.initialState),this.convertToLlm=t.convertToLlm??tK,this.transformContext=t.transformContext,this.streamFunction=t.streamFn??PG(),this.getApiKey=t.getApiKey,this.onPayload=t.onPayload,this.onResponse=t.onResponse,this.beforeToolCall=t.beforeToolCall,this.afterToolCall=t.afterToolCall,this.finishTurn=t.finishTurn,this.prepareRequest=t.prepareRequest,this.prepareNextTurn=t.prepareNextTurn,this.prepareNextTurnWithContext=t.prepareNextTurnWithContext,this.steeringQueue=new aK(t.steeringMode??`one-at-a-time`),this.followUpQueue=new aK(t.followUpMode??`one-at-a-time`),this.sessionId=t.sessionId,this.thinkingBudgets=t.thinkingBudgets,this.transport=t.transport??`auto`,this.maxRetryDelayMs=t.maxRetryDelayMs,this.toolExecution=t.toolExecution??`parallel`}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}get state(){return this._state}set steeringMode(e){this.steeringQueue.mode=e}get steeringMode(){return this.steeringQueue.mode}set followUpMode(e){this.followUpQueue.mode=e}get followUpMode(){return this.followUpQueue.mode}steer(e){this.steeringQueue.enqueue(e)}followUp(e){this.followUpQueue.enqueue(e)}clearSteeringQueue(){this.steeringQueue.clear()}clearFollowUpQueue(){this.followUpQueue.clear()}clearAllQueues(){this.clearSteeringQueue(),this.clearFollowUpQueue()}hasQueuedMessages(){return this.steeringQueue.hasItems()||this.followUpQueue.hasItems()}peekQueuedMessages(){let e=this.steeringQueue.peek();return e.length>0?e:this.followUpQueue.peek()}get signal(){return this.activeRun?.abortController.signal}abort(){this.activeRun?.abortController.abort()}waitForIdle(){return this.activeRun?.promise??Promise.resolve()}reset(){if(this.activeRun)throw Error(`Agent is already processing. Wait for completion before resetting.`);let e=Rr(this._state.messages);this._state.messages=e?[e]:[],this._state.isStreaming=!1,this._state.streamingMessage=void 0,this._state.pendingToolCalls=new Set,this._state.errorMessage=void 0,this.clearFollowUpQueue(),this.clearSteeringQueue()}async prompt(e,t){if(this.activeRun)throw Error(`Agent is already processing a prompt. Use steer() or followUp() to queue messages, or wait for completion.`);let n=this.normalizePromptInput(e,t);await this.runPromptMessages(n)}async continue(){if(this.activeRun)throw Error(`Agent is already processing. Wait for completion before continuing.`);let e=this._state.messages[this._state.messages.length-1];if(!e||this._state.messages.every(e=>e.role===`system`))throw Error(`No messages to continue from`);if(e.role===`assistant`){let e=this.steeringQueue.drain();if(e.length>0){await this.runPromptMessages(e,{skipInitialSteeringPoll:!0});return}let t=this.followUpQueue.drain();if(t.length>0){await this.runPromptMessages(t);return}throw Error(`Cannot continue from message role: assistant`)}await this.runContinuation()}normalizePromptInput(e,t){if(Array.isArray(e))return e;if(typeof e!=`string`)return[e];let n=[{type:`text`,text:e}];return t&&t.length>0&&n.push(...t),[{role:`user`,content:n,timestamp:Date.now()}]}async runPromptMessages(e,t={}){await this.runWithLifecycle(async n=>{await FG(e,this.createContextSnapshot(),this.createLoopConfig(t),e=>this.processEvents(e),n,this.streamFunction)})}async runContinuation(){await this.runWithLifecycle(async e=>{await IG(this.createContextSnapshot(),this.createLoopConfig(),e=>this.processEvents(e),e,this.streamFunction)})}createContextSnapshot(){return{messages:this._state.messages.slice(),tools:this._state.tools.slice()}}createLoopConfig(e={}){let t=e.skipInitialSteeringPoll===!0;return{model:this._state.model,reasoning:this._state.thinkingLevel===`off`?void 0:this._state.thinkingLevel,sessionId:this.sessionId,onPayload:this.onPayload,onResponse:this.onResponse,transport:this.transport,thinkingBudgets:this.thinkingBudgets,maxRetryDelayMs:this.maxRetryDelayMs,toolExecution:this.toolExecution,beforeToolCall:this.beforeToolCall,afterToolCall:this.afterToolCall,finishTurn:this.finishTurn,prepareRequest:this.prepareRequest,prepareNextTurn:this.prepareNextTurnWithContext||this.prepareNextTurn?async e=>this.prepareNextTurnWithContext?await this.prepareNextTurnWithContext(e,this.signal):await this.prepareNextTurn?.(this.signal):void 0,convertToLlm:this.convertToLlm,transformContext:this.transformContext,getApiKey:this.getApiKey,getSteeringMessages:async()=>t?(t=!1,[]):this.steeringQueue.drain(),getFollowUpMessages:async()=>this.followUpQueue.drain()}}async runWithLifecycle(e){if(this.activeRun)throw Error(`Agent is already processing.`);let t=new AbortController,n=()=>{},r=new Promise(e=>{n=e});this.activeRun={promise:r,resolve:n,abortController:t},this._state.isStreaming=!0,this._state.streamingMessage=void 0,this._state.errorMessage=void 0;try{await e(t.signal)}catch(e){await this.handleRunFailure(e,t.signal.aborted)}finally{this.finishRun()}}async handleRunFailure(e,t){let n={role:`assistant`,content:[{type:`text`,text:``}],api:this._state.model.api,provider:this._state.model.provider,model:this._state.model.id,usage:nK,stopReason:t?`aborted`:`error`,errorMessage:e instanceof Error?e.message:String(e),timestamp:Date.now()};await this.processEvents({type:`message_start`,message:n}),await this.processEvents({type:`message_end`,message:n}),await this.processEvents({type:`turn_end`,message:n,toolResults:[]}),await this.processEvents({type:`agent_end`,messages:[n]})}finishRun(){this._state.isStreaming=!1,this._state.streamingMessage=void 0,this._state.pendingToolCalls=new Set,this.activeRun?.resolve(),this.activeRun=void 0}async processEvents(e){switch(e.type){case`message_start`:this._state.streamingMessage=e.message;break;case`message_update`:this._state.streamingMessage=e.message;break;case`message_end`:this._state.streamingMessage=void 0,this._state.messages.push(e.message);break;case`tool_execution_start`:{let t=new Set(this._state.pendingToolCalls);t.add(e.toolCallId),this._state.pendingToolCalls=t;break}case`tool_execution_end`:{let t=new Set(this._state.pendingToolCalls);t.delete(e.toolCallId),this._state.pendingToolCalls=t;break}case`turn_end`:e.message.role===`assistant`&&e.message.errorMessage&&(this._state.errorMessage=e.message.errorMessage);break;case`agent_end`:this._state.streamingMessage=void 0}let t=this.activeRun?.abortController.signal;if(!t)throw Error(`Agent listener invoked outside active run`);for(let n of this.listeners)await n(e,t)}},sK=Object.freeze({token:Symbol(`chord.abortSignal`)}),cK=class{get abortSignal(){return this.value(sK)}},lK=class extends cK{#e;constructor(e){super(),this.#e=e}value(e){}toString(){return this.#e}};new lK(`[Context BACKGROUND_CONTEXT]`),new lK(`[Context TODO_CONTEXT]`);function uK(e){return Object.freeze({token:Symbol(e)})}uK(`pi.telemetryContext`);var dK={"pi.session.id":{type:`string`,required:!0,cardinality:`high`,description:`Session id`},"pi.lane.name":{type:`string`,required:!0,cardinality:`high`,description:`Lane name`},"pi.operation.id":{type:`string`,required:!0,cardinality:`high`,description:`Durable operation id`},"pi.operation.recovery":{type:`boolean`,required:!0,description:`Whether this invocation resumes durable work`}},fK={"pi.error.code":{type:`string`,cardinality:`low`,description:`Stable operation error code`},"pi.error.type":{type:`string`,cardinality:`low`,description:`Low-cardinality operation error class`}};({...dK}),{...fK},{...dK},{...fK},{...dK},{...fK};function pK(e,t){if(e.length===0)throw TypeError(`Value namespace must not be empty`);if(e.includes(`\0`))throw TypeError(`Value namespace must not contain \\u0000`);if(t.includes(`\0`))throw TypeError(`Value key must not contain \\u0000`)}function mK(e,t=``){return pK(e,t),Object.freeze({namespace:e,key:t,kind:`value`})}mK(`pi.session.name`);var hK=Symbol.for(`yaml.alias`),gK=Symbol.for(`yaml.document`),_K=Symbol.for(`yaml.map`),vK=Symbol.for(`yaml.pair`),yK=Symbol.for(`yaml.scalar`),bK=Symbol.for(`yaml.seq`),xK=Symbol.for(`yaml.node.type`),SK=e=>!!e&&typeof e==`object`&&e[xK]===hK,CK=e=>!!e&&typeof e==`object`&&e[xK]===gK,wK=e=>!!e&&typeof e==`object`&&e[xK]===_K,TK=e=>!!e&&typeof e==`object`&&e[xK]===vK,EK=e=>!!e&&typeof e==`object`&&e[xK]===yK,DK=e=>!!e&&typeof e==`object`&&e[xK]===bK;function OK(e){if(e&&typeof e==`object`)switch(e[xK]){case _K:case bK:return!0}return!1}function kK(e){if(e&&typeof e==`object`)switch(e[xK]){case hK:case _K:case yK:case bK:return!0}return!1}var AK=e=>(EK(e)||OK(e))&&!!e.anchor,jK=Symbol(`break visit`),MK=Symbol(`skip children`),NK=Symbol(`remove node`);function PK(e,t){let n=IK(t);CK(e)?FK(null,e.contents,n,Object.freeze([e]))===NK&&(e.contents=null):FK(null,e,n,Object.freeze([]))}PK.BREAK=jK,PK.SKIP=MK,PK.REMOVE=NK;function FK(e,t,n,r){let i=LK(e,t,n,r);if(kK(i)||TK(i))return RK(e,r,i),FK(e,i,n,r);if(typeof i!=`symbol`){if(OK(t)){r=Object.freeze(r.concat(t));for(let e=0;e<t.items.length;++e){let i=FK(e,t.items[e],n,r);if(typeof i==`number`)e=i-1;else if(i===jK)return jK;else i===NK&&(t.items.splice(e,1),--e)}}else if(TK(t)){r=Object.freeze(r.concat(t));let e=FK(`key`,t.key,n,r);if(e===jK)return jK;e===NK&&(t.key=null);let i=FK(`value`,t.value,n,r);if(i===jK)return jK;i===NK&&(t.value=null)}}return i}function IK(e){return typeof e==`object`&&(e.Collection||e.Node||e.Value)?Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e):e}function LK(e,t,n,r){if(typeof n==`function`)return n(e,t,r);if(wK(t))return n.Map?.(e,t,r);if(DK(t))return n.Seq?.(e,t,r);if(TK(t))return n.Pair?.(e,t,r);if(EK(t))return n.Scalar?.(e,t,r);if(SK(t))return n.Alias?.(e,t,r)}function RK(e,t,n){let r=t[t.length-1];if(OK(r))r.items[e]=n;else if(TK(r))e===`key`?r.key=n:r.value=n;else if(CK(r))r.contents=n;else{let e=SK(r)?`alias`:`scalar`;throw Error(`Cannot replace node with ${e} parent`)}}function zK(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){let t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw Error(t)}return!0}function BK(e,t,n,r){if(r&&typeof r==`object`){if(Array.isArray(r))for(let t=0,n=r.length;t<n;++t){let n=r[t],i=BK(e,r,String(t),n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}else if(r instanceof Map)for(let t of Array.from(r.keys())){let n=r.get(t),i=BK(e,r,t,n);i===void 0?r.delete(t):i!==n&&r.set(t,i)}else if(r instanceof Set)for(let t of Array.from(r)){let n=BK(e,r,t,t);n===void 0?r.delete(t):n!==t&&(r.delete(t),r.add(n))}else for(let[t,n]of Object.entries(r)){let i=BK(e,r,t,n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}}return e.call(t,n,r)}function VK(e,t,n){if(Array.isArray(e))return e.map((e,t)=>VK(e,String(t),n));if(e&&typeof e.toJSON==`function`){if(!n||!AK(e))return e.toJSON(t,n);let r={aliasCount:0,count:1,res:void 0};n.anchors.set(e,r),n.onCreate=e=>{r.res=e,delete n.onCreate};let i=e.toJSON(t,n);return n.onCreate&&n.onCreate(i),i}return typeof e==`bigint`&&!n?.keep?Number(e):e}var HK=class{constructor(e){Object.defineProperty(this,xK,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:t,maxAliasCount:n,onAnchor:r,reviver:i}={}){if(!CK(e))throw TypeError(`A document argument is required`);let a={anchors:new Map,doc:e,keep:!0,mapAsMap:t===!0,mapKeyWarned:!1,maxAliasCount:typeof n==`number`?n:100},o=VK(this,``,a);if(typeof r==`function`)for(let{count:e,res:t}of a.anchors.values())r(t,e);return typeof i==`function`?BK(i,{"":o},``,o):o}},UK=class extends HK{constructor(e){super(hK),this.source=e,Object.defineProperty(this,"tag",{set(){throw Error(`Alias nodes cannot have tags`)}})}resolve(e,t){if(t?.maxAliasCount===0)throw ReferenceError(`Alias resolution is disabled`);let n;t?.aliasResolveCache?n=t.aliasResolveCache:(n=[],PK(e,{Node:(e,t)=>{(SK(t)||AK(t))&&n.push(t)}}),t&&(t.aliasResolveCache=n));let r;for(let e of n){if(e===this)break;e.anchor===this.source&&(r=e)}return r}toJSON(e,t){if(!t)return{source:this.source};let{anchors:n,doc:r,maxAliasCount:i}=t,a=this.resolve(r,t);if(!a){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw ReferenceError(e)}let o=n.get(a);if(o||=(VK(a,null,t),n.get(a)),o?.res===void 0)throw ReferenceError(`This should not happen: Alias anchor was not resolved?`);if(i>=0&&(o.count+=1,o.aliasCount===0&&(o.aliasCount=WK(r,a,n)),o.count*o.aliasCount>i))throw ReferenceError(`Excessive alias count indicates a resource exhaustion attack`);return o.res}toString(e,t,n){let r=`*${this.source}`;if(e){if(zK(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw Error(e)}if(e.implicitKey)return`${r} `}return r}};function WK(e,t,n){if(SK(t)){let r=t.resolve(e),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}if(OK(t)){let r=0;for(let i of t.items){let t=WK(e,i,n);t>r&&(r=t)}return r}if(TK(t)){let r=WK(e,t.key,n),i=WK(e,t.value,n);return Math.max(r,i)}return 1}var GK=e=>!e||typeof e!=`function`&&typeof e!=`object`,KK=class extends HK{constructor(e){super(yK),this.value=e}toJSON(e,t){return t?.keep?this.value:VK(this.value,e,t)}toString(){return String(this.value)}};KK.BLOCK_FOLDED=`BLOCK_FOLDED`,KK.BLOCK_LITERAL=`BLOCK_LITERAL`,KK.PLAIN=`PLAIN`,KK.QUOTE_DOUBLE=`QUOTE_DOUBLE`,KK.QUOTE_SINGLE=`QUOTE_SINGLE`;var qK=`tag:yaml.org,2002:`;function JK(e,t,n){if(t){let e=n.filter(e=>e.tag===t),r=e.find(e=>!e.format)??e[0];if(!r)throw Error(`Tag ${t} not found`);return r}return n.find(t=>t.identify?.(e)&&!t.format)}function YK(e,t,n){if(CK(e)&&(e=e.contents),kK(e))return e;if(TK(e)){let t=n.schema[_K].createNode?.(n.schema,null,n);return t.items.push(e),t}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<`u`&&e instanceof BigInt)&&(e=e.valueOf());let{aliasDuplicateObjects:r,onAnchor:i,onTagObj:a,schema:o,sourceObjects:s}=n,c;if(r&&e&&typeof e==`object`){if(c=s.get(e),c)return c.anchor??(c.anchor=i(e)),new UK(c.anchor);c={anchor:null,node:null},s.set(e,c)}t?.startsWith(`!!`)&&(t=qK+t.slice(2));let l=JK(e,t,o.tags);if(!l){if(e&&typeof e.toJSON==`function`&&(e=e.toJSON()),!e||typeof e!=`object`){let t=new KK(e);return c&&(c.node=t),t}l=e instanceof Map?o[_K]:Symbol.iterator in Object(e)?o[bK]:o[_K]}a&&(a(l),delete n.onTagObj);let u=l?.createNode?l.createNode(n.schema,e,n):typeof l?.nodeClass?.from==`function`?l.nodeClass.from(n.schema,e,n):new KK(e);return t?u.tag=t:l.default||(u.tag=l.tag),c&&(c.node=u),u}function XK(e,t,n){let r=n;for(let e=t.length-1;e>=0;--e){let n=t[e];if(typeof n==`number`&&Number.isInteger(n)&&n>=0){let e=[];e[n]=r,r=e}else r=new Map([[n,r]])}return YK(r,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error(`This should not happen, please report a bug.`)},schema:e,sourceObjects:new Map})}var ZK=e=>e==null||typeof e==`object`&&!!e[Symbol.iterator]().next().done,QK=class extends HK{constructor(e,t){super(e),Object.defineProperty(this,"schema",{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(t.schema=e),t.items=t.items.map(t=>kK(t)||TK(t)?t.clone(e):t),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(ZK(e))this.add(t);else{let[n,...r]=e,i=this.get(n,!0);if(OK(i))i.addIn(r,t);else if(i===void 0&&this.schema)this.set(n,XK(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}deleteIn(e){let[t,...n]=e;if(n.length===0)return this.delete(t);let r=this.get(t,!0);if(OK(r))return r.deleteIn(n);throw Error(`Expected YAML collection at ${t}. Remaining path: ${n}`)}getIn(e,t){let[n,...r]=e,i=this.get(n,!0);return r.length===0?!t&&EK(i)?i.value:i:OK(i)?i.getIn(r,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!TK(t))return!1;let n=t.value;return n==null||e&&EK(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){let[t,...n]=e;if(n.length===0)return this.has(t);let r=this.get(t,!0);return OK(r)?r.hasIn(n):!1}setIn(e,t){let[n,...r]=e;if(r.length===0)this.set(n,t);else{let e=this.get(n,!0);if(OK(e))e.setIn(r,t);else if(e===void 0&&this.schema)this.set(n,XK(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}},$K=e=>e.replace(/^(?!$)(?: $)?/gm,`#`);function eq(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}var tq=(e,t,n)=>e.endsWith(`
18
+ `)?eq(n,t):n.includes(`
19
+ `)?`
20
+ `+eq(n,t):(e.endsWith(` `)?``:` `)+n,nq=`flow`,rq=`block`,iq=`quoted`;function aq(e,t,n=`flow`,{indentAtStart:r,lineWidth:i=80,minContentWidth:a=20,onFold:o,onOverflow:s}={}){if(!i||i<0)return e;i<a&&(a=0);let c=Math.max(1+a,1+i-t.length);if(e.length<=c)return e;let l=[],u={},d=i-t.length;typeof r==`number`&&(r>i-Math.max(2,a)?l.push(0):d=i-r);let f,p,m=!1,h=-1,g=-1,_=-1;n===`block`&&(h=oq(e,h,t.length),h!==-1&&(d=h+c));for(let r;r=e[h+=1];){if(n===`quoted`&&r===`\\`){switch(g=h,e[h+1]){case`x`:h+=3;break;case`u`:h+=5;break;case`U`:h+=9;break;default:h+=1}_=h}if(r===`
21
+ `)n===`block`&&(h=oq(e,h,t.length)),d=h+t.length+c,f=void 0;else{if(r===` `&&p&&p!==` `&&p!==`
22
+ `&&p!==` `){let t=e[h+1];t&&t!==` `&&t!==`
23
+ `&&t!==` `&&(f=h)}if(h>=d){if(f)l.push(f),d=f+c,f=void 0;else if(n===`quoted`){for(;p===` `||p===` `;)p=r,r=e[h+=1],m=!0;let t=h>_+1?h-2:g-1;if(u[t])return e;l.push(t),u[t]=!0,d=t+c,f=void 0}else m=!0}}p=r}if(m&&s&&s(),l.length===0)return e;o&&o();let v=e.slice(0,l[0]);for(let r=0;r<l.length;++r){let i=l[r],a=l[r+1]||e.length;i===0?v=`\n${t}${e.slice(0,a)}`:(n===`quoted`&&u[i]&&(v+=`${e[i]}\\`),v+=`\n${t}${e.slice(i+1,a)}`)}return v}function oq(e,t,n){let r=t,i=t+1,a=e[i];for(;a===` `||a===` `;)if(t<i+n)a=e[++t];else{do a=e[++t];while(a&&a!==`
24
+ `);r=t,i=t+1,a=e[i]}return r}var sq=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),cq=e=>/^(%|---|\.\.\.)/m.test(e);function lq(e,t,n){if(!t||t<0)return!1;let r=t-n,i=e.length;if(i<=r)return!1;for(let t=0,n=0;t<i;++t)if(e[t]===`
25
+ `){if(t-n>r)return!0;if(n=t+1,i-n<=r)return!1}return!0}function uq(e,t){let n=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return n;let{implicitKey:r}=t,i=t.options.doubleQuotedMinMultiLineLength,a=t.indent||(cq(e)?` `:``),o=``,s=0;for(let e=0,t=n[e];t;t=n[++e])if(t===` `&&n[e+1]===`\\`&&n[e+2]===`n`&&(o+=n.slice(s,e)+`\\ `,e+=1,s=e,t=`\\`),t===`\\`)switch(n[e+1]){case`u`:{o+=n.slice(s,e);let t=n.substr(e+2,4);switch(t){case`0000`:o+=`\\0`;break;case`0007`:o+=`\\a`;break;case`000b`:o+=`\\v`;break;case`001b`:o+=`\\e`;break;case`0085`:o+=`\\N`;break;case`00a0`:o+=`\\_`;break;case`2028`:o+=`\\L`;break;case`2029`:o+=`\\P`;break;default:t.substr(0,2)===`00`?o+=`\\x`+t.substr(2):o+=n.substr(e,6)}e+=5,s=e+1}break;case`n`:if(r||n[e+2]===`"`||n.length<i)e+=1;else{for(o+=n.slice(s,e)+`
26
+
27
+ `;n[e+2]===`\\`&&n[e+3]===`n`&&n[e+4]!==`"`;)o+=`
28
+ `,e+=2;o+=a,n[e+2]===` `&&(o+=`\\`),e+=1,s=e+1}break;default:e+=1}return o=s?o+n.slice(s):n,r?o:aq(o,a,iq,sq(t,!1))}function dq(e,t){if(t.options.singleQuote===!1||t.implicitKey&&e.includes(`
29
+ `)||/[ \t]\n|\n[ \t]/.test(e))return uq(e,t);let n=t.indent||(cq(e)?` `:``),r=`'`+e.replace(/'/g,`''`).replace(/\n+/g,`$&\n${n}`)+`'`;return t.implicitKey?r:aq(r,n,nq,sq(t,!1))}function fq(e,t){let{singleQuote:n}=t.options,r;if(n===!1)r=uq;else{let t=e.includes(`"`),i=e.includes(`'`);r=t&&!i?dq:i&&!t?uq:n?dq:uq}return r(e,t)}var pq;try{pq=RegExp(`(^|(?<!
30
+ ))
31
+ +(?!
32
+ |$)`,`g`)}catch{pq=/\n+(?!\n|$)/g}function mq({comment:e,type:t,value:n},r,i,a){let{blockQuote:o,commentString:s,lineWidth:c}=r.options;if(!o||/\n[\t ]+$/.test(n))return fq(n,r);let l=r.indent||(r.forceBlockIndent||cq(n)?` `:``),u=o===`literal`?!0:o===`folded`||t===KK.BLOCK_FOLDED?!1:t===KK.BLOCK_LITERAL||!lq(n,c,l.length);if(!n)return u?`|
33
+ `:`>
34
+ `;let d,f;for(f=n.length;f>0;--f){let e=n[f-1];if(e!==`
35
+ `&&e!==` `&&e!==` `)break}let p=n.substring(f),m=p.indexOf(`
36
+ `);m===-1?d=`-`:n===p||m!==p.length-1?(d=`+`,a&&a()):d=``,p&&=(n=n.slice(0,-p.length),p[p.length-1]===`
37
+ `&&(p=p.slice(0,-1)),p.replace(pq,`$&${l}`));let h=!1,g,_=-1;for(g=0;g<n.length;++g){let e=n[g];if(e===` `)h=!0;else if(e===`
38
+ `)_=g;else break}let v=n.substring(0,_<g?_+1:g);v&&=(n=n.substring(v.length),v.replace(/\n+/g,`$&${l}`));let y=(h?l?`2`:`1`:``)+d;if(e&&(y+=` `+s(e.replace(/ ?[\r\n]+/g,` `)),i&&i()),!u){let e=n.replace(/\n+/g,`
39
+ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\n+/g,`$&${l}`),i=!1,a=sq(r,!0);o!==`folded`&&t!==KK.BLOCK_FOLDED&&(a.onOverflow=()=>{i=!0});let s=aq(`${v}${e}${p}`,l,rq,a);if(!i)return`>${y}\n${l}${s}`}return n=n.replace(/\n+/g,`$&${l}`),`|${y}\n${l}${v}${n}${p}`}function hq(e,t,n,r){let{type:i,value:a}=e,{actualString:o,implicitKey:s,indent:c,indentStep:l,inFlow:u}=t;if(s&&a.includes(`
40
+ `)||u&&/[[\]{},]/.test(a))return fq(a,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(a))return s||u||!a.includes(`
41
+ `)?fq(a,t):mq(e,t,n,r);if(!s&&!u&&i!==KK.PLAIN&&a.includes(`
42
+ `))return mq(e,t,n,r);if(cq(a)){if(c===``)return t.forceBlockIndent=!0,mq(e,t,n,r);if(s&&c===l)return fq(a,t)}let d=a.replace(/\n+/g,`$&\n${c}`);if(o){let e=e=>e.default&&e.tag!==`tag:yaml.org,2002:str`&&e.test?.test(d),{compat:n,tags:r}=t.doc.schema;if(r.some(e)||n?.some(e))return fq(a,t)}return s?d:aq(d,c,nq,sq(t,!1))}function gq(e,t,n,r){let{implicitKey:i,inFlow:a}=t,o=typeof e.value==`string`?e:Object.assign({},e,{value:String(e.value)}),{type:s}=e;s!==KK.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(s=KK.QUOTE_DOUBLE);let c=e=>{switch(e){case KK.BLOCK_FOLDED:case KK.BLOCK_LITERAL:return i||a?fq(o.value,t):mq(o,t,n,r);case KK.QUOTE_DOUBLE:return uq(o.value,t);case KK.QUOTE_SINGLE:return dq(o.value,t);case KK.PLAIN:return hq(o,t,n,r);default:return null}},l=c(s);if(l===null){let{defaultKeyType:e,defaultStringType:n}=t.options,r=i&&e||n;if(l=c(r),l===null)throw Error(`Unsupported default string type ${r}`)}return l}function _q(e,t){let n=Object.assign({blockQuote:!0,commentString:$K,defaultKeyType:null,defaultStringType:`PLAIN`,directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:`false`,flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:`null`,simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:`true`,verifyAliasOrder:!0},e.schema.toStringOptions,t),r;switch(n.collectionStyle){case`block`:r=!1;break;case`flow`:r=!0;break;default:r=null}return{anchors:new Set,doc:e,flowCollectionPadding:n.flowCollectionPadding?` `:``,indent:``,indentStep:typeof n.indent==`number`?` `.repeat(n.indent):` `,inFlow:r,options:n}}function vq(e,t){if(t.tag){let n=e.filter(e=>e.tag===t.tag);if(n.length>0)return n.find(e=>e.format===t.format)??n[0]}let n,r;if(EK(t)){r=t.value;let i=e.filter(e=>e.identify?.(r));if(i.length>1){let e=i.filter(e=>e.test);e.length>0&&(i=e)}n=i.find(e=>e.format===t.format)??i.find(e=>!e.format)}else r=t,n=e.find(e=>e.nodeClass&&r instanceof e.nodeClass);if(!n){let e=r?.constructor?.name??(r===null?`null`:typeof r);throw Error(`Tag not resolved for ${e} value`)}return n}function yq(e,t,{anchors:n,doc:r}){if(!r.directives)return``;let i=[],a=(EK(e)||OK(e))&&e.anchor;a&&zK(a)&&(n.add(a),i.push(`&${a}`));let o=e.tag??(t.default?null:t.tag);return o&&i.push(r.directives.tagString(o)),i.join(` `)}function bq(e,t,n,r){if(TK(e))return e.toString(t,n,r);if(SK(e)){if(t.doc.directives)return e.toString(t);if(t.resolvedAliases?.has(e))throw TypeError(`Cannot stringify circular structure without alias nodes`);t.resolvedAliases?t.resolvedAliases.add(e):t.resolvedAliases=new Set([e]),e=e.resolve(t.doc)}let i,a=kK(e)?e:t.doc.createNode(e,{onTagObj:e=>i=e});i??=vq(t.doc.schema.tags,a);let o=yq(a,i,t);o.length>0&&(t.indentAtStart=(t.indentAtStart??0)+o.length+1);let s=typeof i.stringify==`function`?i.stringify(a,t,n,r):EK(a)?gq(a,t,n,r):a.toString(t,n,r);return o?EK(a)||s[0]===`{`||s[0]===`[`?`${o} ${s}`:`${o}\n${t.indent}${s}`:s}function xq({key:e,value:t},n,r,i){let{allNullValues:a,doc:o,indent:s,indentStep:c,options:{commentString:l,indentSeq:u,simpleKeys:d}}=n,f=kK(e)&&e.comment||null;if(d){if(f)throw Error(`With simple keys, key nodes cannot have comments`);if(OK(e)||!kK(e)&&typeof e==`object`)throw Error(`With simple keys, collection cannot be used as a key value`)}let p=!d&&(!e||f&&t==null&&!n.inFlow||OK(e)||(EK(e)?e.type===KK.BLOCK_FOLDED||e.type===KK.BLOCK_LITERAL:typeof e==`object`));n=Object.assign({},n,{allNullValues:!1,implicitKey:!p&&(d||!a),indent:s+c});let m=!1,h=!1,g=bq(e,n,()=>m=!0,()=>h=!0);if(!p&&!n.inFlow&&g.length>1024){if(d)throw Error(`With simple keys, single line scalar must not span more than 1024 characters`);p=!0}if(n.inFlow){if(a||t==null)return m&&r&&r(),g===``?`?`:p?`? ${g}`:g}else if(a&&!d||t==null&&p)return g=`? ${g}`,f&&!m?g+=tq(g,n.indent,l(f)):h&&i&&i(),g;m&&(f=null),p?(f&&(g+=tq(g,n.indent,l(f))),g=`? ${g}\n${s}:`):(g=`${g}:`,f&&(g+=tq(g,n.indent,l(f))));let _,v,y;kK(t)?(_=!!t.spaceBefore,v=t.commentBefore,y=t.comment):(_=!1,v=null,y=null,t&&typeof t==`object`&&(t=o.createNode(t))),n.implicitKey=!1,!p&&!f&&EK(t)&&(n.indentAtStart=g.length+1),h=!1,!u&&c.length>=2&&!n.inFlow&&!p&&DK(t)&&!t.flow&&!t.tag&&!t.anchor&&(n.indent=n.indent.substring(2));let b=!1,x=bq(t,n,()=>b=!0,()=>h=!0),S=` `;if(f||_||v){if(S=_?`
43
+ `:``,v){let e=l(v);S+=`\n${eq(e,n.indent)}`}x===``&&!n.inFlow?S===`
44
+ `&&y&&(S=`
45
+
46
+ `):S+=`\n${n.indent}`}else if(!p&&OK(t)){let e=x[0],r=x.indexOf(`
47
+ `),i=r!==-1,a=n.inFlow??t.flow??t.items.length===0;if(i||!a){let t=!1;if(i&&(e===`&`||e===`!`)){let n=x.indexOf(` `);e===`&`&&n!==-1&&n<r&&x[n+1]===`!`&&(n=x.indexOf(` `,n+1)),(n===-1||r<n)&&(t=!0)}t||(S=`\n${n.indent}`)}}else(x===``||x[0]===`
48
+ `)&&(S=``);return g+=S+x,n.inFlow?b&&r&&r():y&&!b?g+=tq(g,n.indent,l(y)):h&&i&&i(),g}function Sq(e,t){(e===`debug`||e===`warn`)&&console.warn(t)}var Cq=`<<`,wq={identify:e=>e===Cq||typeof e==`symbol`&&e.description===Cq,default:`key`,tag:`tag:yaml.org,2002:merge`,test:/^<<$/,resolve:()=>Object.assign(new KK(Symbol(Cq)),{addToJSMap:Eq}),stringify:()=>Cq},Tq=(e,t)=>(wq.identify(t)||EK(t)&&(!t.type||t.type===KK.PLAIN)&&wq.identify(t.value))&&e?.doc.schema.tags.some(e=>e.tag===wq.tag&&e.default);function Eq(e,t,n){let r=Oq(e,n);if(DK(r))for(let n of r.items)Dq(e,t,n);else if(Array.isArray(r))for(let n of r)Dq(e,t,n);else Dq(e,t,r)}function Dq(e,t,n){let r=Oq(e,n);if(!wK(r))throw Error(`Merge sources must be maps or map aliases`);let i=r.toJSON(null,e,Map);for(let[e,n]of i)t instanceof Map?t.has(e)||t.set(e,n):t instanceof Set?t.add(e):Object.prototype.hasOwnProperty.call(t,e)||Object.defineProperty(t,e,{value:n,writable:!0,enumerable:!0,configurable:!0});return t}function Oq(e,t){return e&&SK(t)?t.resolve(e.doc,e):t}function kq(e,t,{key:n,value:r}){if(kK(n)&&n.addToJSMap)n.addToJSMap(e,t,r);else if(Tq(e,n))Eq(e,t,r);else{let i=VK(n,``,e);if(t instanceof Map)t.set(i,VK(r,i,e));else if(t instanceof Set)t.add(i);else{let a=Aq(n,i,e),o=VK(r,a,e);a in t?Object.defineProperty(t,a,{value:o,writable:!0,enumerable:!0,configurable:!0}):t[a]=o}}return t}function Aq(e,t,n){if(t===null)return``;if(typeof t!=`object`)return String(t);if(kK(e)&&n?.doc){let t=_q(n.doc,{});t.anchors=new Set;for(let e of n.anchors.keys())t.anchors.add(e.anchor);t.inFlow=!0,t.inStringifyKey=!0;let r=e.toString(t);if(!n.mapKeyWarned){let e=JSON.stringify(r);e.length>40&&(e=e.substring(0,36)+`..."`),Sq(n.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${e}. Set mapAsMap: true to use object keys.`),n.mapKeyWarned=!0}return r}return JSON.stringify(t)}function jq(e,t,n){return new Mq(YK(e,void 0,n),YK(t,void 0,n))}var Mq=class e{constructor(e,t=null){Object.defineProperty(this,xK,{value:vK}),this.key=e,this.value=t}clone(t){let{key:n,value:r}=this;return kK(n)&&(n=n.clone(t)),kK(r)&&(r=r.clone(t)),new e(n,r)}toJSON(e,t){return kq(t,t?.mapAsMap?new Map:{},this)}toString(e,t,n){return e?.doc?xq(this,e,t,n):JSON.stringify(this)}};function Nq(e,t,n){return(t.inFlow??e.flow?Fq:Pq)(e,t,n)}function Pq({comment:e,items:t},n,{blockItemPrefix:r,flowChars:i,itemIndent:a,onChompKeep:o,onComment:s}){let{indent:c,options:{commentString:l}}=n,u=Object.assign({},n,{indent:a,type:null}),d=!1,f=[];for(let e=0;e<t.length;++e){let i=t[e],o=null;if(kK(i))!d&&i.spaceBefore&&f.push(``),Iq(n,f,i.commentBefore,d),i.comment&&(o=i.comment);else if(TK(i)){let e=kK(i.key)?i.key:null;e&&(!d&&e.spaceBefore&&f.push(``),Iq(n,f,e.commentBefore,d))}d=!1;let s=bq(i,u,()=>o=null,()=>d=!0);o&&(s+=tq(s,a,l(o))),d&&o&&(d=!1),f.push(r+s)}let p;if(f.length===0)p=i.start+i.end;else{p=f[0];for(let e=1;e<f.length;++e){let t=f[e];p+=t?`\n${c}${t}`:`
49
+ `}}return e?(p+=`
50
+ `+eq(l(e),c),s&&s()):d&&o&&o(),p}function Fq({items:e},t,{flowChars:n,itemIndent:r}){let{indent:i,indentStep:a,flowCollectionPadding:o,options:{commentString:s}}=t;r+=a;let c=Object.assign({},t,{indent:r,inFlow:!0,type:null}),l=!1,u=0,d=[];for(let n=0;n<e.length;++n){let i=e[n],a=null;if(kK(i))i.spaceBefore&&d.push(``),Iq(t,d,i.commentBefore,!1),i.comment&&(a=i.comment);else if(TK(i)){let e=kK(i.key)?i.key:null;e&&(e.spaceBefore&&d.push(``),Iq(t,d,e.commentBefore,!1),e.comment&&(l=!0));let n=kK(i.value)?i.value:null;n?(n.comment&&(a=n.comment),n.commentBefore&&(l=!0)):i.value==null&&e?.comment&&(a=e.comment)}a&&(l=!0);let o=bq(i,c,()=>a=null);l||=d.length>u||o.includes(`
51
+ `),n<e.length-1?o+=`,`:t.options.trailingComma&&(t.options.lineWidth>0&&(l||=d.reduce((e,t)=>e+t.length+2,2)+(o.length+2)>t.options.lineWidth),l&&(o+=`,`)),a&&(o+=tq(o,r,s(a))),d.push(o),u=d.length}let{start:f,end:p}=n;if(d.length===0)return f+p;if(!l){let e=d.reduce((e,t)=>e+t.length+2,2);l=t.options.lineWidth>0&&e>t.options.lineWidth}if(l){let e=f;for(let t of d)e+=t?`\n${a}${i}${t}`:`
52
+ `;return`${e}\n${i}${p}`}return`${f}${o}${d.join(` `)}${o}${p}`}function Iq({indent:e,options:{commentString:t}},n,r,i){if(r&&i&&(r=r.replace(/^\n+/,``)),r){let i=eq(t(r),e);n.push(i.trimStart())}}function Lq(e,t){let n=EK(t)?t.value:t;for(let r of e)if(TK(r)&&(r.key===t||r.key===n||EK(r.key)&&r.key.value===n))return r}var Rq=class extends QK{static get tagName(){return`tag:yaml.org,2002:map`}constructor(e){super(_K,e),this.items=[]}static from(e,t,n){let{keepUndefined:r,replacer:i}=n,a=new this(e),o=(e,o)=>{if(typeof i==`function`)o=i.call(t,e,o);else if(Array.isArray(i)&&!i.includes(e))return;(o!==void 0||r)&&a.items.push(jq(e,o,n))};if(t instanceof Map)for(let[e,n]of t)o(e,n);else if(t&&typeof t==`object`)for(let e of Object.keys(t))o(e,t[e]);return typeof e.sortMapEntries==`function`&&a.items.sort(e.sortMapEntries),a}add(e,t){let n;n=TK(e)?e:!e||typeof e!=`object`||!(`key`in e)?new Mq(e,e?.value):new Mq(e.key,e.value);let r=Lq(this.items,n.key),i=this.schema?.sortMapEntries;if(r){if(!t)throw Error(`Key ${n.key} already set`);EK(r.value)&&GK(n.value)?r.value.value=n.value:r.value=n.value}else if(i){let e=this.items.findIndex(e=>i(n,e)<0);e===-1?this.items.push(n):this.items.splice(e,0,n)}else this.items.push(n)}delete(e){let t=Lq(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){let n=Lq(this.items,e)?.value;return(!t&&EK(n)?n.value:n)??void 0}has(e){return!!Lq(this.items,e)}set(e,t){this.add(new Mq(e,t),!0)}toJSON(e,t,n){let r=n?new n:t?.mapAsMap?new Map:{};t?.onCreate&&t.onCreate(r);for(let e of this.items)kq(t,r,e);return r}toString(e,t,n){if(!e)return JSON.stringify(this);for(let e of this.items)if(!TK(e))throw Error(`Map items must all be pairs; found ${JSON.stringify(e)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),Nq(this,e,{blockItemPrefix:``,flowChars:{start:`{`,end:`}`},itemIndent:e.indent||``,onChompKeep:n,onComment:t})}},zq={collection:`map`,default:!0,nodeClass:Rq,tag:`tag:yaml.org,2002:map`,resolve(e,t){return wK(e)||t(`Expected a mapping for this tag`),e},createNode:(e,t,n)=>Rq.from(e,t,n)},Bq=class extends QK{static get tagName(){return`tag:yaml.org,2002:seq`}constructor(e){super(bK,e),this.items=[]}add(e){this.items.push(e)}delete(e){let t=Vq(e);return typeof t==`number`&&this.items.splice(t,1).length>0}get(e,t){let n=Vq(e);if(typeof n!=`number`)return;let r=this.items[n];return!t&&EK(r)?r.value:r}has(e){let t=Vq(e);return typeof t==`number`&&t<this.items.length}set(e,t){let n=Vq(e);if(typeof n!=`number`)throw Error(`Expected a valid index, not ${e}.`);let r=this.items[n];EK(r)&&GK(t)?r.value=t:this.items[n]=t}toJSON(e,t){let n=[];t?.onCreate&&t.onCreate(n);let r=0;for(let e of this.items)n.push(VK(e,String(r++),t));return n}toString(e,t,n){return e?Nq(this,e,{blockItemPrefix:`- `,flowChars:{start:`[`,end:`]`},itemIndent:(e.indent||``)+` `,onChompKeep:n,onComment:t}):JSON.stringify(this)}static from(e,t,n){let{replacer:r}=n,i=new this(e);if(t&&Symbol.iterator in Object(t)){let e=0;for(let a of t){if(typeof r==`function`){let n=t instanceof Set?a:String(e++);a=r.call(t,n,a)}i.items.push(YK(a,void 0,n))}}return i}};function Vq(e){let t=EK(e)?e.value:e;return t&&typeof t==`string`&&(t=Number(t)),typeof t==`number`&&Number.isInteger(t)&&t>=0?t:null}var Hq={collection:`seq`,default:!0,nodeClass:Bq,tag:`tag:yaml.org,2002:seq`,resolve(e,t){return DK(e)||t(`Expected a sequence for this tag`),e},createNode:(e,t,n)=>Bq.from(e,t,n)};function Uq(e){return typeof e==`bigint`||Number.isInteger(e)}var Wq=({value:e})=>JSON.stringify(e),Gq=[{identify:e=>typeof e==`string`,default:!0,tag:`tag:yaml.org,2002:str`,resolve:e=>e,stringify:Wq},{identify:e=>e==null,createNode:()=>new KK(null),default:!0,tag:`tag:yaml.org,2002:null`,test:/^null$/,resolve:()=>null,stringify:Wq},{identify:e=>typeof e==`boolean`,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^true$|^false$/,resolve:e=>e===`true`,stringify:Wq},{identify:Uq,default:!0,tag:`tag:yaml.org,2002:int`,test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(e,t,{intAsBigInt:n})=>n?BigInt(e):parseInt(e,10),stringify:({value:e})=>Uq(e)?e.toString():JSON.stringify(e)},{identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:e=>parseFloat(e),stringify:Wq}];[zq,Hq].concat(Gq,{default:!0,tag:``,test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}});function Kq(e,t,n){let{replacer:r}=n,i=new Bq(e);i.tag=`tag:yaml.org,2002:pairs`;let a=0;if(t&&Symbol.iterator in Object(t))for(let e of t){typeof r==`function`&&(e=r.call(t,String(a++),e));let o,s;if(Array.isArray(e)){if(e.length===2)o=e[0],s=e[1];else throw TypeError(`Expected [key, value] tuple: ${e}`)}else if(e&&e instanceof Object){let t=Object.keys(e);if(t.length===1)o=t[0],s=e[o];else throw TypeError(`Expected tuple with one key, not ${t.length} keys`)}else o=e;i.items.push(jq(o,s,n))}return i}var qq=class e extends Bq{constructor(){super(),this.add=Rq.prototype.add.bind(this),this.delete=Rq.prototype.delete.bind(this),this.get=Rq.prototype.get.bind(this),this.has=Rq.prototype.has.bind(this),this.set=Rq.prototype.set.bind(this),this.tag=e.tag}toJSON(e,t){if(!t)return super.toJSON(e);let n=new Map;t?.onCreate&&t.onCreate(n);for(let e of this.items){let r,i;if(TK(e)?(r=VK(e.key,``,t),i=VK(e.value,r,t)):r=VK(e,``,t),n.has(r))throw Error(`Ordered maps must not include duplicate keys`);n.set(r,i)}return n}static from(e,t,n){let r=Kq(e,t,n),i=new this;return i.items=r.items,i}};qq.tag=`tag:yaml.org,2002:omap`;var Jq=class e extends Rq{constructor(t){super(t),this.tag=e.tag}add(e){let t;t=TK(e)?e:e&&typeof e==`object`&&`key`in e&&`value`in e&&e.value===null?new Mq(e.key,null):new Mq(e,null),Lq(this.items,t.key)||this.items.push(t)}get(e,t){let n=Lq(this.items,e);return!t&&TK(n)?EK(n.key)?n.key.value:n.key:n}set(e,t){if(typeof t!=`boolean`)throw Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof t}`);let n=Lq(this.items,e);n&&!t?this.items.splice(this.items.indexOf(n),1):!n&&t&&this.items.push(new Mq(e))}toJSON(e,t){return super.toJSON(e,t,Set)}toString(e,t,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),t,n);throw Error(`Set items must all have null values`)}static from(e,t,n){let{replacer:r}=n,i=new this(e);if(t&&Symbol.iterator in Object(t))for(let e of t)typeof r==`function`&&(e=r.call(t,e,e)),i.items.push(jq(e,null,n));return i}};Jq.tag=`tag:yaml.org,2002:set`;var Yq=Symbol(`break visit`),Xq=Symbol(`skip children`),Zq=Symbol(`remove item`);function Qq(e,t){`type`in e&&e.type===`document`&&(e={start:e.start,value:e.value}),$q(Object.freeze([]),e,t)}Qq.BREAK=Yq,Qq.SKIP=Xq,Qq.REMOVE=Zq,Qq.itemAtPath=(e,t)=>{let n=e;for(let[e,r]of t){let t=n?.[e];if(t&&`items`in t)n=t.items[r];else return}return n},Qq.parentCollection=(e,t)=>{let n=Qq.itemAtPath(e,t.slice(0,-1)),r=t[t.length-1][0],i=n?.[r];if(i&&`items`in i)return i;throw Error(`Parent collection not found`)};function $q(e,t,n){let r=n(t,e);if(typeof r==`symbol`)return r;for(let i of[`key`,`value`]){let a=t[i];if(a&&`items`in a){for(let t=0;t<a.items.length;++t){let r=$q(Object.freeze(e.concat([[i,t]])),a.items[t],n);if(typeof r==`number`)t=r-1;else if(r===Yq)return Yq;else r===Zq&&(a.items.splice(t,1),--t)}typeof r==`function`&&i===`key`&&(r=r(t,e))}}return typeof r==`function`?r(t,e):r}n(((e,t)=>{function n(e){return Array.isArray(e)?e:[e]}var r=/[.*+?()[\]{}^$|\\/]/,i=/^ +$/,a=/(?:[^\\]|^)\\$/,o=/^\\!/,s=/^\\#/,c=/\r?\n/g,l=`/`,u=`node-ignore`;typeof Symbol<`u`&&(u=Symbol.for(`node-ignore`));var d=u,f=(e,t,n)=>(Object.defineProperty(e,t,{value:n}),n),p=()=>!1,m=e=>{let{length:t}=e;return e.slice(0,t-t%2)},h={alnum:`0-9A-Za-z`,alpha:`A-Za-z`,blank:` \\t`,cntrl:`\\x00-\\x1f\\x7f`,digit:`0-9`,graph:`!-.0-~`,lower:`a-z`,print:` -.0-~`,punct:"!-.:-@\\[-`{-~",space:` \\t\\n\\r`,upper:`A-Z`,xdigit:`0-9A-Fa-f`},g=`\\]^-[`,_=e=>g.indexOf(e)<0?e:`\\`+e,v=`(?!\\/)`,y=(e,t)=>{if(e)return`[^\\/${t}]`;let n=`[${t}]`;return new RegExp(n).test(`/`)?v+n:n},b=(e,t)=>{let{length:n}=e,r=t+1,i=``,a=e[r];(a===`!`||a===`^`)&&(i=`^`,r++);let o=``,s=``;for(;;){let t=e[r];if(t===void 0)return null;if(t===`\\`){let t=e[r+1];if(t===void 0)return null;o+=_(t),s=t,r++}else if(t===`-`&&s&&r+1<n&&e[r+1]!==`]`){r++;let t=e[r];t===`\\`&&(t=e[r+=1]),s<=t&&(o+=`-${_(t)}`),s=``}else if(t===`[`&&e[r+1]===`:`){let t=r+2,i=t;for(;i<n&&e[i]!==`]`;)i++;if(i===n)return null;if(i>t&&e[i-1]===`:`){let n=h[e.slice(t,i-1)];if(n===void 0)return null;o+=n,s=``,r=i}else o+=_(`[`),s=`[`,r=t-2}else o+=_(t),s=t;if(r++,e[r]===`]`)return{end:r,source:y(i,o)}}},x=`[]`,S=`\0`,C=RegExp(`${S}(\\d+)${S}`,`g`),w=``,T=e=>{let t=[],n=e=>`${S}${t.push(e)-1}${S}`,{length:i}=e,a=``,o=0;for(;o<i;){let t=e[o];if(t===`\\`){let t=e[o+1];a+=t===`*`||t===`[`||t===` `||t===`\\`?e.slice(o,o+2):n(r.test(t)?`\\`+t:t),o+=2}else if(t===S)a+=n(`[${S}]`),o++;else if(t===`[`){let t=b(e,o);t===null?(a+=n(x),o=i):(a+=n(t.source),o=t.end+1)}else a+=t,o++}return{source:a,sources:t}},ee=null,E=/\/(?!$)/,D=[[/^\uFEFF/,()=>``,``],[/[\r\n]+$/,()=>``],[/((?:\\\\)*?)(\\? +)$/,(e,t,n)=>t+(n.indexOf(`\\`)===0?` `:``)],[/(\\+?) /g,(e,t)=>{let{length:n}=t;return t.slice(0,n-n%2)+` `}],[/[\\$.|*+(){^]/g,e=>`\\${e}`],[/(?!\\)\?/g,()=>`[^/]`,`?`],[/^\//,()=>`^`,l],[/\//g,()=>`\\/`,l],[/^\^*(?:\\\*\\\*\\\/)+/,()=>`^(?:.*\\/)?`,`*`],[ee,(e,t)=>!e||e[0]===`^`?e:(E.test(t)?`^`:`(?:^|\\/)`)+e],[/\\\/\\\*\\\*(?=\\\/|$)/g,(e,t,n)=>t+6<n.length?n.slice(t+6)===`\\/`?`(?:\\/[^\\/]+)+`:`(?:\\/[^\\/]+)*`:`\\/.+`,`*`],[/(^|[^\\]+)(\\\*)+(?=.+)/g,(e,t,n)=>t+n.replace(/\\\*/g,`[^\\/]*`),`*`],[/(^|[^\\])((?:\\\\)*)\\\*$/,(e,t,n)=>n.length/2%2==0?t+n+w:e,`*`],[/\\\\\\(?=[$.|*+(){^])/g,()=>`\\`,`\\\\`],[/\\\\/g,()=>`\\`,`\\\\`],[/\\\[([^\]/]*?)(\\*)($|\])/g,(e,t,n,r)=>`\\[${t}${m(n)}${r}`,`[`],[ee,e=>{let t=e[e.length-1];return!t||t===w?e:t===l?`${e}$`:`${e}(?=$|\\/$)`}]],te=/(^|\\\/)?\uE000$/,ne=`regex`,re=`checkRegex`,ie={[ne](e,t){return`${t?`${t}[^/]+`:`[^/]*`}(?=$|\\/$)`},[re](e,t){return`${t?`${t}[^/]*`:`[^/]*`}(?=$|\\/$)`}},ae=`[^\\/]*`,oe=e=>{if(e.indexOf(ae)<0)return e;let t=[],{length:n}=e,r=0;for(;r<n;){let i=e[r];if(e.startsWith(ae,r))t.push({wildcard:!0}),r+=6;else if(i===`[`){let i=r+1;for(e[i]===`^`&&i++,e[i]===`]`&&i++;i<n&&e[i]!==`]`;)i+=e[i]===`\\`?2:1;i++,t.push({single:e.slice(r,i)}),r=i}else if(i===`\\`)t.push({single:e.slice(r,r+2)}),r+=2;else if(i===`(`){let i=0,a=r;do e[a]===`\\`?a++:e[a]===`(`?i++:e[a]===`)`&&i--,a++;while(a<n&&i>0);`*+?`.indexOf(e[a])>=0&&a++,t.push({boundary:e.slice(r,a)}),r=a}else i===`^`||i===`$`?(t.push({boundary:i}),r++):(t.push({single:i}),r++)}let i=``,a=[],o=()=>{let e;a.forEach((t,n)=>{t.wildcard&&(e=n)}),a.forEach((t,n)=>{if(!t.wildcard){i+=t.single;return}i+=n===e?ae:`(?:(?!${a[n+1].single})[^\\/])*`}),a=[]};return t.forEach(e=>{if(e.boundary===void 0){a.push(e);return}o(),i+=e.boundary}),o(),i},se=e=>{let{source:t,sources:n}=T(e),r=D.reduce((t,[n,r,i])=>n===ee?r(t,e):i!==void 0&&t.indexOf(i)<0?t:n.test(t)?t.replace(n,r.bind(e)):t,t);return n.length?r.replace(C,(e,t)=>n[t]):r},ce=e=>{let t=e.indexOf(l);return t<0||t===e.length-1},O=e=>{let t=e.length-1,n=e.lastIndexOf(l,e[t]===l?t-1:t);return n<0?e:e.slice(n+1)},le=e=>{if(e.charCodeAt(0)===47||e.indexOf(`//`)>=0){let t=e.split(l).filter(Boolean);return t.pop(),t.length?t.join(l)+l:``}let t=e.length-1,n=e.lastIndexOf(l,e.charCodeAt(t)===47?t-1:t);return n<0?``:e.slice(0,n+1)},k=e=>typeof e==`string`,ue=e=>e&&k(e)&&!i.test(e)&&!a.test(e)&&e.indexOf(`#`)!==0,A=e=>e.split(c).filter(Boolean),j=class{constructor(e,t,n,r,i,a){this.pattern=e,this.mark=t,this.negative=i,f(this,`body`,n),f(this,`ignoreCase`,r),f(this,`regexPrefix`,a)}get _basenameOnly(){return f(this,`_basenameOnly`,ce(this.body))}get regex(){let e=`_regex`;return this[e]?this[e]:this._make(ne,e)}get checkRegex(){let e=`_checkRegex`;return this[e]?this[e]:this._make(re,e)}_make(e,t){let n=oe(this.regexPrefix.replace(te,ie[e])),r=this.ignoreCase?new RegExp(n,`i`):new RegExp(n);return f(this,t,r)}},de=({pattern:e,mark:t},n)=>{let r=!1,i=e;i.indexOf(`!`)===0&&(r=!0,i=i.substr(1)),i=i.replace(o,`!`).replace(s,`#`);let a=se(i);return new j(e,t,i,n,r,a)},fe=class{constructor(e){this._ignoreCase=e,this._rules=[],this._basenameCount=0}_add(e){if(e&&e[d]){this._rules=this._rules.concat(e._rules._rules),this._basenameCount+=e._rules._basenameCount,this._added=!0;return}if(k(e)&&(e={pattern:e}),ue(e.pattern)){let t=de(e,this._ignoreCase);this._added=!0,this._rules.push(t),ce(t.body)&&this._basenameCount++}}add(e){return this._added=!1,n(k(e)?A(e):e).forEach(this._add,this),this._added}test(e,t,n){let r=!1,i=!1,a,o=this._rules,{length:s}=o,c=this._basenameCount*2>=s,l=c?O(e):e;for(let u=0;u<s;u++){let s=o[u],{negative:d}=s;!(i===d&&r!==i||d&&!r&&!i&&!t)&&s[n].test(c&&s._basenameOnly?l:e)&&(r=!d,i=d,a=d?void 0:s)}let u={ignored:r,unignored:i};return a&&(u.rule=a),u}},pe=(e,t)=>{throw new t(e)},me=(e,t,n)=>k(e)?e?!me.isNotRelative(e)||n(`path should be a \`path.relative()\`d string, but got "${t}"`,RangeError):n(`path must not be empty`,TypeError):n(`path must be a string, but got \`${t}\``,TypeError),he=e=>{let t=e.charCodeAt(0);if(t===47)return!0;if(t!==46)return!1;if(e.length===1)return!0;let n=e.charCodeAt(1);return n===47?!0:n===46?e.length===2||e.charCodeAt(2)===47:!1};me.isNotRelative=he,me.convert=e=>e;var ge=class{constructor({ignorecase:e=!0,ignoreCase:t=e,allowRelativePaths:n=!1}={}){f(this,d,!0),this._rules=new fe(t),this._strictPathCheck=!n,this._initCache()}_initCache(){this._ignoreCache=Object.create(null),this._testCache=Object.create(null)}add(e){return this._rules.add(e)&&this._initCache(),this}addPattern(e){return this.add(e)}_test(e,t,n){let r=e&&me.convert(e);return me(r,e,this._strictPathCheck?pe:p),this._t(r,t,n)}checkIgnore(e){if(e.charCodeAt(e.length-1)!==47)return this.test(e);let t=le(e);if(t){let e=this._t(t,this._testCache,!0);if(e.ignored)return e}return this._rules.test(e,!1,re)}_t(e,t,n){if(e in t)return t[e];let r=le(e),i=r?this._t(r,t,n):void 0;return t[e]=i&&i.ignored?i:this._rules.test(e,n,ne)}ignores(e){return this._test(e,this._ignoreCache,!1).ignored}createFilter(){return e=>!this.ignores(e)}filter(e){return n(e).filter(this.createFilter())}test(e){return this._test(e,this._testCache,!0)}},_e=e=>new ge(e),ve=e=>me(e&&me.convert(e),e,p),ye=()=>{me.convert=e=>/^\\\\\?\\/.test(e)||/["<>|\u0000-\u001F]+/u.test(e)?e:e.replace(/\\/g,`/`);let e=/^[a-z]:\//i;me.isNotRelative=t=>e.test(t)||he(t)};typeof process<`u`&&process.platform===`win32`&&ye(),t.exports=_e,_e.default=_e,t.exports.isPathValid=ve,f(t.exports,Symbol.for(`setupWindows`),ye)}))(),globalThis.Buffer,new TextEncoder,new TextDecoder,BC({command:mT({description:`Bash command to execute`}),timeout:FC(uT({description:`Timeout in seconds (optional, no default timeout)`}))});var eJ=class{diff(e,t,n={}){let r;typeof n==`function`?(r=n,n={}):`callback`in n&&(r=n.callback);let i=this.castInput(e,n),a=this.castInput(t,n),o=this.removeEmpty(this.tokenize(i,n)),s=this.removeEmpty(this.tokenize(a,n));return this.diffWithOptionsObj(o,s,n,r)}diffWithOptionsObj(e,t,n,r){let i=e=>{if(e=this.postProcess(e,n),r){setTimeout(function(){r(e)},0);return}return e},a=t.length,o=e.length,s=1,c=a+o;n.maxEditLength!=null&&(c=Math.min(c,n.maxEditLength));let l=n.timeout??1/0,u=Date.now()+l,d=[{oldPos:-1,lastComponent:void 0}],f=this.extractCommon(d[0],t,e,0,n);if(d[0].oldPos+1>=o&&f+1>=a)return i(this.buildValues(d[0].lastComponent,t,e));let p=-1/0,m=1/0,h=()=>{for(let r=Math.max(p,-s);r<=Math.min(m,s);r+=2){let s,c=d[r-1],l=d[r+1];c&&(d[r-1]=void 0);let u=!1;if(l){let e=l.oldPos-r;u=l&&0<=e&&e<a}let h=c&&c.oldPos+1<o;if(!u&&!h){d[r]=void 0;continue}if(s=!h||u&&c.oldPos<l.oldPos?this.addToPath(l,!0,!1,0,n):this.addToPath(c,!1,!0,1,n),f=this.extractCommon(s,t,e,r,n),s.oldPos+1>=o&&f+1>=a)return i(this.buildValues(s.lastComponent,t,e))||!0;d[r]=s,s.oldPos+1>=o&&(m=Math.min(m,r-1)),f+1>=a&&(p=Math.max(p,r+1))}s++};if(r)(function e(){setTimeout(function(){if(s>c||Date.now()>u)return r(void 0);h()||e()},0)})();else for(;s<=c&&Date.now()<=u;){let e=h();if(e)return e}}addToPath(e,t,n,r,i){let a=e.lastComponent;return a&&!i.oneChangePerToken&&a.added===t&&a.removed===n?{oldPos:e.oldPos+r,lastComponent:{count:a.count+1,added:t,removed:n,previousComponent:a.previousComponent}}:{oldPos:e.oldPos+r,lastComponent:{count:1,added:t,removed:n,previousComponent:a}}}extractCommon(e,t,n,r,i){let a=t.length,o=n.length,s=e.oldPos,c=s-r,l=0;for(;c+1<a&&s+1<o&&this.equals(n[s+1],t[c+1],i);)c++,s++,l++,i.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return l&&!i.oneChangePerToken&&(e.lastComponent={count:l,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=s,c}equals(e,t,n){return n.comparator?n.comparator(e,t):e===t||!!n.ignoreCase&&e.toLowerCase()===t.toLowerCase()}removeEmpty(e){let t=[];for(let n=0;n<e.length;n++)e[n]&&t.push(e[n]);return t}castInput(e,t){return e}tokenize(e,t){return Array.from(e)}join(e){return e.join(``)}postProcess(e,t){return e}get useLongestToken(){return!1}buildValues(e,t,n){let r=[],i;for(;e;)r.push(e),i=e.previousComponent,delete e.previousComponent,e=i;r.reverse();let a=r.length,o=0,s=0,c=0;for(;o<a;o++){let e=r[o];if(e.removed)e.value=this.join(n.slice(c,c+e.count)),c+=e.count;else{if(!e.added&&this.useLongestToken){let r=t.slice(s,s+e.count);r=r.map(function(e,t){let r=n[c+t];return r.length>e.length?r:e}),e.value=this.join(r)}else e.value=this.join(t.slice(s,s+e.count));s+=e.count,e.added||(c+=e.count)}}return r}};new class extends eJ{};function tJ(e,t){let n=0;for(;n<e.length&&n<t.length;n++)if(e[n]!=t[n])return e.slice(0,n);return e.slice(0,n)}function nJ(e,t){let n;if(!e||!t||e[e.length-1]!=t[t.length-1])return``;for(n=0;n<e.length&&n<t.length;n++)if(e[e.length-(n+1)]!=t[t.length-(n+1)])return e.slice(-n);return e.slice(-n)}function rJ(e,t,n){if(e.slice(0,t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't start with prefix ${JSON.stringify(t)}; this is a bug`);return n+e.slice(t.length)}function iJ(e,t,n){if(!t)return e+n;if(e.slice(-t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't end with suffix ${JSON.stringify(t)}; this is a bug`);return e.slice(0,-t.length)+n}function aJ(e,t){return rJ(e,t,``)}function oJ(e,t){return iJ(e,t,``)}function sJ(e,t){return t.slice(0,cJ(e,t))}function cJ(e,t){let n=0;e.length>t.length&&(n=e.length-t.length);let r=t.length;e.length<t.length&&(r=e.length);let i=Array(r),a=0;i[0]=0;for(let e=1;e<r;e++){for(t[e]==t[a]?i[e]=i[a]:i[e]=a;a>0&&t[e]!=t[a];)a=i[a];t[e]==t[a]&&a++}a=0;for(let r=n;r<e.length;r++){for(;a>0&&e[r]!=t[a];)a=i[a];e[r]==t[a]&&a++}return a}function lJ(e,t){let n=[];for(let r of Array.from(t.segment(e))){let e=r.segment;n.length&&/\s/.test(n[n.length-1])&&/\s/.test(e)?n[n.length-1]+=e:n.push(e)}return n}function uJ(e,t){if(t)return fJ(e,t)[1];let n;for(n=e.length-1;n>=0&&e[n].match(/\s/);n--);return e.substring(n+1)}function dJ(e,t){if(t)return fJ(e,t)[0];let n=e.match(/^\s*/);return n?n[0]:``}function fJ(e,t){if(!t)return[dJ(e),uJ(e)];if(t.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);let n=lJ(e,t),r=n[0],i=n[n.length-1];return[/\s/.test(r)?r:``,/\s/.test(i)?i:``]}var pJ=`a-zA-Z0-9_\\u{AD}\\u{C0}-\\u{D6}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}`,mJ=RegExp(`[${pJ}]+|\\s+|[^${pJ}]`,`ug`);new class extends eJ{equals(e,t,n){return n.ignoreCase&&(e=e.toLowerCase(),t=t.toLowerCase()),e.trim()===t.trim()}tokenize(e,t={}){let n;if(t.intlSegmenter){let r=t.intlSegmenter;if(r.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);n=lJ(e,r)}else n=e.match(mJ)||[];let r=[],i=null;return n.forEach(e=>{/\s/.test(e)?i==null?r.push(e):r.push(r.pop()+e):i!=null&&/\s/.test(i)?r[r.length-1]==i?r.push(r.pop()+e):r.push(i+e):r.push(e),i=e}),r}join(e){return e.map((e,t)=>t==0?e:e.replace(/^\s+/,``)).join(``)}postProcess(e,t){if(!e||t.oneChangePerToken)return e;let n=null,r=null,i=null;return e.forEach(e=>{e.added?r=e:e.removed?i=e:((r||i)&&hJ(n,i,r,e,t.intlSegmenter),n=e,r=null,i=null)}),(r||i)&&hJ(n,i,r,null,t.intlSegmenter),e}};function hJ(e,t,n,r,i){if(t&&n){let[a,o]=fJ(t.value,i),[s,c]=fJ(n.value,i);if(e){let r=tJ(a,s);e.value=iJ(e.value,s,r),t.value=aJ(t.value,r),n.value=aJ(n.value,r)}if(r){let e=nJ(o,c);r.value=rJ(r.value,c,e),t.value=oJ(t.value,e),n.value=oJ(n.value,e)}}else if(n){if(e){let e=dJ(n.value,i);n.value=n.value.substring(e.length)}if(r){let e=dJ(r.value,i);r.value=r.value.substring(e.length)}}else if(e&&r){let n=dJ(r.value,i),[a,o]=fJ(t.value,i),s=tJ(n,a);t.value=aJ(t.value,s);let c=nJ(aJ(n,s),o);t.value=oJ(t.value,c),r.value=rJ(r.value,n,c),e.value=iJ(e.value,n,n.slice(0,n.length-c.length))}else if(r){let e=dJ(r.value,i),n=sJ(uJ(t.value,i),e);t.value=oJ(t.value,n)}else if(e){let n=sJ(uJ(e.value,i),dJ(t.value,i));t.value=aJ(t.value,n)}}new class extends eJ{tokenize(e){let t=RegExp(`(\\r?\\n)|[${pJ}]+|[^\\S\\n\\r]+|[^${pJ}]`,`ug`);return e.match(t)||[]}},new class extends eJ{constructor(){super(...arguments),this.tokenize=gJ}equals(e,t,n){return n.ignoreWhitespace?((!n.newlineIsToken||!e.includes(`
53
+ `))&&(e=e.trim()),(!n.newlineIsToken||!t.includes(`
54
+ `))&&(t=t.trim())):n.ignoreNewlineAtEof&&!n.newlineIsToken&&(e.endsWith(`
55
+ `)&&(e=e.slice(0,-1)),t.endsWith(`
56
+ `)&&(t=t.slice(0,-1))),super.equals(e,t,n)}};function gJ(e,t){t.stripTrailingCr&&(e=e.replace(/\r\n/g,`
57
+ `));let n=[],r=e.split(/(\n|\r\n)/);r[r.length-1]||r.pop();for(let e=0;e<r.length;e++){let i=r[e];e%2&&!t.newlineIsToken?n[n.length-1]+=i:n.push(i)}return n}function _J(e){return e==`.`||e==`!`||e==`?`}new class extends eJ{tokenize(e){let t=[],n=0;for(let r=0;r<e.length;r++){if(r==e.length-1){t.push(e.slice(n));break}if(_J(e[r])&&e[r+1].match(/\s/)){for(t.push(e.slice(n,r+1)),r=n=r+1;e[r+1]?.match(/\s/);)r++;t.push(e.slice(n,r+1)),n=r+1}}return t}},new class extends eJ{tokenize(e){return e.split(/([{}:;,]|\s+)/)}},new class extends eJ{constructor(){super(...arguments),this.tokenize=gJ}get useLongestToken(){return!0}castInput(e,t){let{undefinedReplacement:n,stringifyReplacer:r=(e,t)=>t===void 0?n:t}=t;return typeof e==`string`?e:JSON.stringify(vJ(e,null,null,r),null,` `)}equals(e,t,n){return super.equals(e.replace(/,([\r\n])/g,`$1`),t.replace(/,([\r\n])/g,`$1`),n)}};function vJ(e,t,n,r,i){t||=[],n||=[],r&&(e=r(i===void 0?``:i,e));let a=0;for(;a<t.length;a+=1)if(t[a]===e)return n[a];let o;if(Object.prototype.toString.call(e)===`[object Array]`){for(t.push(e),o=Array(e.length),n.push(o),a=0;a<e.length;a+=1)o[a]=vJ(e[a],t,n,r,String(a));return t.pop(),n.pop(),o}if(e&&e.toJSON&&(e=e.toJSON()),typeof e==`object`&&e){t.push(e),o={},n.push(o);let i=[],s;for(s in e)Object.prototype.hasOwnProperty.call(e,s)&&i.push(s);for(i.sort(),a=0;a<i.length;a+=1)s=i[a],o[s]=vJ(e[s],t,n,r,s);t.pop(),n.pop()}else o=e;return o}new class extends eJ{tokenize(e){return e.slice()}join(e){return e}removeEmpty(e){return e}};var yJ=BC({oldText:mT({description:`Exact text for one targeted replacement. It must be unique in the original file and must not overlap with any other edits[].oldText in the same call.`}),newText:mT({description:`Replacement text for this targeted edit.`})},{});BC({path:mT({description:`Path to the file to edit (relative or absolute)`}),edits:gC(yJ,{description:`One or more targeted replacements. Each edit is matched against the original file, not incrementally. Do not include overlapping or nested edits. If two changes touch the same block or nearby lines, merge them into one edit instead.`})},{}),BC({path:mT({description:`Path to the file to read (relative or absolute)`}),offset:FC(uT({description:`Line number to start reading from (1-indexed)`})),limit:FC(uT({description:`Maximum number of lines to read`}))}),BC({path:mT({description:`Path to the file to write (relative or absolute)`}),content:mT({description:`Content to write to the file`})});var bJ=(0,Xn.default)(Zn);function xJ(e){return e.map(e=>{let t=e.previousPath?` (renamed from ${e.previousPath})`:``,n=`### ${e.path}${t} [${e.status}, +${e.additions}/-${e.deletions}]`;return e.isBinary?`${n}\n(binary file, no diff shown)`:e.truncated?`${n}\n(diff too large, omitted)`:bJ(e.path)?`${n}\n(generated file, diff omitted to save tokens)`:`${n}\n${e.hunks.map(e=>`${e.header}\n${e.patch}`).join(`
58
+ `)}`}).join(`
59
+
60
+ `)}var SJ=2e5,CJ=`<role>
61
+ You organize a GitHub pull request's changed files into review groups, so a reviewer can read the PR feature by feature instead of file by file.
62
+ </role>
63
+
64
+ <grouping_principles>
65
+ - Group by intent, not by directory. One feature touching several modules is ONE group; when it has more than 5 files, split it by module with "children".
66
+ - Use the fewest groups that still separate independent intents. A typical PR has 1-5 top-level groups. A single-file group needs a reason.
67
+ - Tests, stories and fixtures belong to the feature they cover, as a "tests" child when the group has children. Only tests unrelated to any feature form their own group.
68
+ - Order groups by review priority: the core change first, supporting changes next, mechanical changes (lockfiles, generated files, formatting) last.
69
+ - Every path in the manifest goes into exactly one group or child.
70
+ - Commit messages, when listed, hint at the author's intents. Group by the final change, not by commit: fixup and WIP commits often mix concerns.
71
+ </grouping_principles>
72
+
73
+ <workflow>
74
+ 1. Read the manifest and form a grouping hypothesis from paths and hunk headers.
75
+ 2. Call read_diffs only where the hypothesis is uncertain. Batch paths into one call. Never read [generated] or [binary] paths.
76
+ 3. Call submit_grouping once. If it returns an error, fix exactly what it names and call it again.
77
+ </workflow>
78
+
79
+ <output>
80
+ - "summary" and "overallSummary" explain why over what, in 1-3 sentences of Markdown.
81
+ - "key" is short, stable kebab-case. "label" is at most 4 words.
82
+ - Write "label", "summary" and "overallSummary" in the language named at the end of the user message. Keep code, paths and identifiers as they are.
83
+ </output>`,wJ=`<chat>
84
+ The grouping has been submitted and the reviewer is now asking follow-up questions about this pull request.
85
+ - Always reply in the same natural language as the user's latest message, whatever language the diffs, summaries and earlier messages are in. Keep code, paths and identifiers as they are.
86
+ - Answer from the diffs. Call read_diffs when you need a file you have not seen or whose diff was omitted.
87
+ - Call update_grouping only when the user asks to change the grouping. Send the complete new grouping; every manifest path must appear exactly once.
88
+ - Be concise; use Markdown and reference files by path.
89
+ </chat>`,TJ={added:`A`,removed:`D`,modified:`M`,renamed:`R`,copied:`C`};function EJ(e){let t=[];for(let n of e.hunks){let e=n.header.split(`@@`),r=e.length>=3?e[2].trim():``;if(r&&!t.includes(r)&&(t.push(r),t.length===3))break}return t.map(e=>`@@ ${e}`).join(` / `)}function DJ(e){let t=[`${e.path.slice(e.path.lastIndexOf(`/`)+1)}${e.previousPath?` (from ${e.previousPath})`:``}`,TJ[e.status],`+${e.additions}/-${e.deletions}`],n=bJ(e.path)?`[generated]`:e.isBinary?`[binary]`:EJ(e);return n&&t.push(n),t.join(` `)}function OJ(e){let t=new Map;for(let n of[...e].sort((e,t)=>e.path.localeCompare(t.path))){let e=n.path.slice(0,n.path.lastIndexOf(`/`)+1),r=t.get(e)??[];r.push(n),t.set(e,r)}let n=[];for(let e of[...t.keys()].sort()){e&&n.push(e);for(let r of t.get(e))n.push(e?` ${DJ(r)}`:DJ(r))}return n.join(`
90
+ `)}function kJ(e,t){let n=[`PR title: ${e.title}`];e.url&&n.push(`PR link: ${e.url}`),e.description&&n.push(`---DESCRIPTION---\n${e.description}`),e.commits&&e.commits.length>1&&n.push(`---COMMITS--- (${e.commits.length}, oldest first)\n${e.commits.map(e=>`${e.sha.slice(0,7)} ${e.message.split(`
91
+ `,1)[0]}`).join(`
92
+ `)}`);let r=e.files.reduce((e,t)=>e+t.additions,0),i=e.files.reduce((e,t)=>e+t.deletions,0);n.push(`---MANIFEST--- (${e.files.length} files, +${r}/-${i})\n${OJ(e.files)}`);let a=xJ(e.files);return a.length<=2e5&&n.push(`---DIFFS--- (all diffs included; you may submit directly)\n${a}`),n.push(`Respond and categorize in ${Ln(t)}.`),n.join(`
93
+
94
+ `)}var AJ=()=>cr(()=>R(()=>import(`./anthropic-messages-Cd2DkgOC.js`).then(e=>e.t),__vite__mapDeps([0,1,2,3,4]),import.meta.url)),jJ=()=>cr(()=>R(()=>import(`./openai-completions-CSvY9IVo.js`),__vite__mapDeps([5,4,1]),import.meta.url));function MJ(e){let t=e===`vercel-ai-gateway`;return(e,n)=>{let r=new Headers(n?.headers);for(let e of[...r.keys()])(e.startsWith(`x-stainless-`)||t&&e===`anthropic-dangerous-direct-browser-access`)&&r.delete(e);return fetch(e,{...n,headers:r})}}function NJ(e){let t=Zr();t.setProvider(Qr({id:e.model.provider,auth:{apiKey:{name:`API key`,resolve:async()=>({auth:{apiKey:e.apiKey}})}},models:[e.model],api:{"anthropic-messages":AJ(),"openai-completions":jJ()}}));let n=MJ(e.model.provider);return(e,r,i)=>t.streamSimple(e,r,{...i,fetch:n})}function PJ(e,t){return e?(e.push(t),e):[t]}var FJ=/[.*+?^${}()|[\]\\]/g;function IJ(e){return e.replace(FJ,`\\$&`)}function LJ(e,t){switch(t?.errorMode){case`ignore`:break;case`warn`:console.warn(e);break;default:throw Error(e)}}function RJ(e){return typeof e==`boolean`||typeof e==`number`&&Number.isFinite(e)||typeof e==`string`}function zJ(e){return e.every(RJ)}var BJ=class extends Map{constructor(){super(),this.count=0,this.usedIds=new Set}set(e,t){return this.usedIds.add(t),super.set(e,t)}createId(e){for(;this.usedIds.has(`${this.count}`)||`${this.count}`in e;)this.count++;return`${this.count++}`}};function VJ(e,t){return typeof e!=`number`||!Number.isFinite(e)||t>e?t:e}function HJ(e,t){return typeof e!=`number`||!Number.isFinite(e)||t<e?t:e}function UJ(e,t){return e===void 0?t:{anyOf:[e,t]}}function WJ(e,t){let n=e.enum??t;if(e.enum){let e=new Set(t);n=n.filter(t=>e.has(t))}n.length?e.enum=[...new Set(n)]:(delete e.enum,e.not=UJ(e.not,{}))}function GJ(e,t,n){if(n?.ignoreActions?.includes(t.type))return e;let r;switch(t.type){case`base64`:e.contentEncoding=`base64`;break;case`bic`:case`cuid2`:case`decimal`:case`digits`:case`domain`:case`emoji`:case`hash`:case`hexadecimal`:case`hex_color`:case`isrc`:case`iso_time_second`:case`iso_week`:case`ksuid`:case`mac`:case`mac48`:case`mac64`:case`nanoid`:case`octal`:case`slug`:case`ulid`:e.pattern?r=PJ(r,`The "${t.type}" action is not supported in combination with another regex action.`):e.pattern=t.requirement.source;break;case`description`:e.description=t.description;break;case`email`:case`rfc_email`:e.format=`email`;break;case`ends_with`:e.pattern?r=PJ(r,`The "${t.type}" action is not supported in combination with another regex action.`):e.pattern=`${IJ(t.requirement)}$`;break;case`empty`:e.type===`array`?e.maxItems=0:(e.type!==`string`&&(r=PJ(r,`The "${t.type}" action is not supported on type "${e.type}".`)),e.maxLength=0);break;case`entries`:if(!Number.isInteger(t.requirement)||t.requirement<0){r=PJ(r,`The requirement of the "entries" action must be a non-negative integer.`);break}e.minProperties=VJ(e.minProperties,t.requirement),e.maxProperties=HJ(e.maxProperties,t.requirement);break;case`examples`:e.examples=Array.isArray(e.examples)?[...e.examples,...t.examples]:t.examples;break;case`gt_value`:if(e.type!==`number`&&e.type!==`integer`){r=PJ(r,`The "gt_value" action is not supported on type "${e.type}".`);break}if(!Number.isFinite(t.requirement)){r=PJ(r,`The requirement of the "gt_value" action is not JSON compatible.`);break}if(n?.target===`openapi-3.0`){r=PJ(r,`The "gt_value" action is not supported for OpenAPI 3.0.`);break}e.exclusiveMinimum=VJ(e.exclusiveMinimum,t.requirement);break;case`includes`:e.pattern?r=PJ(r,`The "${t.type}" action is not supported in combination with another regex action.`):e.pattern=IJ(t.requirement);break;case`integer`:e.type=`integer`;break;case`ipv4`:e.format=`ipv4`;break;case`ipv6`:e.format=`ipv6`;break;case`iso_date`:e.format=`date`;break;case`iso_date_time`:case`iso_timestamp`:e.format=`date-time`;break;case`iso_time`:e.format=`time`;break;case`jws_compact`:e.pattern?r=PJ(r,`The "${t.type}" action is not supported in combination with another regex action.`):e.pattern=t.requirement.source;break;case`length`:if(!Number.isInteger(t.requirement)||t.requirement<0){r=PJ(r,`The requirement of the "length" action must be a non-negative integer.`);break}e.type===`array`?(e.minItems=VJ(e.minItems,t.requirement),e.maxItems=HJ(e.maxItems,t.requirement)):(e.type!==`string`&&(r=PJ(r,`The "${t.type}" action is not supported on type "${e.type}".`)),e.minLength=VJ(e.minLength,t.requirement),e.maxLength=HJ(e.maxLength,t.requirement));break;case`lt_value`:if(e.type!==`number`&&e.type!==`integer`){r=PJ(r,`The "lt_value" action is not supported on type "${e.type}".`);break}if(!Number.isFinite(t.requirement)){r=PJ(r,`The requirement of the "lt_value" action is not JSON compatible.`);break}if(n?.target===`openapi-3.0`){r=PJ(r,`The "lt_value" action is not supported for OpenAPI 3.0.`);break}e.exclusiveMaximum=HJ(e.exclusiveMaximum,t.requirement);break;case`max_entries`:if(!Number.isInteger(t.requirement)||t.requirement<0){r=PJ(r,`The requirement of the "max_entries" action must be a non-negative integer.`);break}e.maxProperties=HJ(e.maxProperties,t.requirement);break;case`max_length`:if(!Number.isInteger(t.requirement)||t.requirement<0){r=PJ(r,`The requirement of the "max_length" action must be a non-negative integer.`);break}e.type===`array`?e.maxItems=HJ(e.maxItems,t.requirement):(e.type!==`string`&&(r=PJ(r,`The "${t.type}" action is not supported on type "${e.type}".`)),e.maxLength=HJ(e.maxLength,t.requirement));break;case`max_value`:if(e.type!==`number`&&e.type!==`integer`){r=PJ(r,`The "max_value" action is not supported on type "${e.type}".`);break}if(!Number.isFinite(t.requirement)){r=PJ(r,`The requirement of the "max_value" action is not JSON compatible.`);break}e.maximum=HJ(e.maximum,t.requirement);break;case`metadata`:typeof t.metadata.title==`string`&&(e.title=t.metadata.title),typeof t.metadata.description==`string`&&(e.description=t.metadata.description),Array.isArray(t.metadata.examples)&&(e.examples=Array.isArray(e.examples)?[...e.examples,...t.metadata.examples]:t.metadata.examples);for(let n of Object.keys(t.metadata))n!==`title`&&n!==`description`&&n!==`examples`&&n!==`__proto__`&&(e[n]=t.metadata[n]);break;case`min_entries`:if(!Number.isInteger(t.requirement)||t.requirement<0){r=PJ(r,`The requirement of the "min_entries" action must be a non-negative integer.`);break}e.minProperties=VJ(e.minProperties,t.requirement);break;case`min_length`:if(!Number.isInteger(t.requirement)||t.requirement<0){r=PJ(r,`The requirement of the "min_length" action must be a non-negative integer.`);break}e.type===`array`?e.minItems=VJ(e.minItems,t.requirement):(e.type!==`string`&&(r=PJ(r,`The "${t.type}" action is not supported on type "${e.type}".`)),e.minLength=VJ(e.minLength,t.requirement));break;case`min_value`:if(e.type!==`number`&&e.type!==`integer`){r=PJ(r,`The "min_value" action is not supported on type "${e.type}".`);break}if(!Number.isFinite(t.requirement)){r=PJ(r,`The requirement of the "min_value" action is not JSON compatible.`);break}e.minimum=VJ(e.minimum,t.requirement);break;case`multiple_of`:e.multipleOf=t.requirement;break;case`non_empty`:e.type===`array`?e.minItems=VJ(e.minItems,1):(e.type!==`string`&&(r=PJ(r,`The "${t.type}" action is not supported on type "${e.type}".`)),e.minLength=VJ(e.minLength,1));break;case`not_value`:if(!RJ(t.requirement)){r=PJ(r,`The requirement of the "not_value" action is not JSON compatible.`);break}e.not=UJ(e.not,n?.target===`openapi-3.0`?{enum:[t.requirement]}:{const:t.requirement});break;case`not_values`:if(!zJ(t.requirement)){r=PJ(r,`A requirement of the "not_values" action is not JSON compatible.`);break}t.requirement.length&&(e.not=UJ(e.not,{enum:[...new Set(t.requirement)]}));break;case`regex`:t.requirement.flags&&(r=PJ(r,`RegExp flags are not supported by JSON Schema.`)),e.pattern?r=PJ(r,`The "${t.type}" action is not supported in combination with another regex action.`):e.pattern=t.requirement.source;break;case`safe_integer`:e.type=`integer`,e.minimum=VJ(e.minimum,-(2**53-1)),e.maximum=HJ(e.maximum,2**53-1);break;case`starts_with`:e.pattern?r=PJ(r,`The "${t.type}" action is not supported in combination with another regex action.`):e.pattern=`^${IJ(t.requirement)}`;break;case`title`:e.title=t.title;break;case`url`:e.format=`uri`;break;case`uuid`:e.format=`uuid`;break;case`value`:if(!RJ(t.requirement)){r=PJ(r,`The requirement of the "value" action is not JSON compatible.`);break}n?.target===`openapi-3.0`?WJ(e,[t.requirement]):`const`in e&&e.const!==t.requirement?r=PJ(r,`The "${t.type}" action is not supported in combination with a different "const" restriction.`):e.const=t.requirement;break;case`values`:if(!zJ(t.requirement)){r=PJ(r,`A requirement of the "values" action is not JSON compatible.`);break}WJ(e,t.requirement);break;default:r=PJ(r,`The "${t.type}" action cannot be converted to JSON Schema.`)}if(n?.overrideAction){let i=n.overrideAction({valibotAction:t,jsonSchema:e,errors:r});if(i)return{...i}}if(r)for(let e of r)LJ(e,n);return e}function KJ(e){return e.flatMap(e=>`pipe`in e?KJ(e.pipe):e)}function qJ(e){return`#/$defs/${e.replaceAll(`~`,`~0`).replaceAll(`/`,`~1`)}`}function JJ(e,t,n,r,i=!1){if(!i){let i=r.referenceMap.get(t);if(i){if(e.$ref=qJ(i),n?.overrideRef){let a=n.overrideRef({...r,referenceId:i,valibotSchema:t,jsonSchema:e});a&&(e.$ref=a)}return e}}if(`pipe`in t){let i=KJ(t.pipe),a=0,o=i.length-1;if(n?.typeMode===`input`){let e=i.slice(1).findIndex(e=>e.kind===`schema`||e.kind===`transformation`&&(e.type===`find_item`||e.type===`parse_json`||e.type===`raw_transform`||e.type===`reduce_items`||e.type===`stringify_json`||e.type===`to_bigint`||e.type===`to_boolean`||e.type===`to_date`||e.type===`to_number`||e.type===`to_string`||e.type===`transform`));e!==-1&&(o=e)}else if(n?.typeMode===`output`){let e=i.findLastIndex(e=>e.kind===`schema`);e!==-1&&(a=e)}for(let t=a;t<=o;t++){let o=i[t];o.kind===`schema`?(t>a&&LJ(`Set the "typeMode" config to "input" or "output" to convert pipelines with multiple schemas.`,n),e=JJ(e,o,n,r,!0)):e=GJ(e,o,n)}return e}let a;switch(t.type){case`boolean`:e.type=`boolean`;break;case`null`:n?.target===`openapi-3.0`?e.enum=[null]:e.type=`null`;break;case`number`:e.type=`number`;break;case`string`:e.type=`string`;break;case`array`:e.type=`array`,e.items=JJ({},t.item,n,r);break;case`tuple`:case`tuple_with_rest`:case`loose_tuple`:case`strict_tuple`:if(e.type=`array`,n?.target===`openapi-3.0`){e.items={anyOf:[]},e.minItems=t.items.length;for(let i of t.items)e.items.anyOf.push(JJ({},i,n,r));t.type===`tuple_with_rest`?e.items.anyOf.push(JJ({},t.rest,n,r)):(t.type===`strict_tuple`||t.type===`tuple`)&&(e.maxItems=t.items.length)}else if(n?.target===`draft-2020-12`){e.prefixItems=[],e.minItems=t.items.length;for(let i of t.items)e.prefixItems.push(JJ({},i,n,r));t.type===`tuple_with_rest`?e.items=JJ({},t.rest,n,r):t.type===`strict_tuple`&&(e.items=!1)}else{e.items=[],e.minItems=t.items.length;for(let i of t.items)e.items.push(JJ({},i,n,r));t.type===`tuple_with_rest`?e.additionalItems=JJ({},t.rest,n,r):t.type===`strict_tuple`&&(e.additionalItems=!1)}break;case`object`:case`object_with_rest`:case`loose_object`:case`strict_object`:e.type=`object`,e.properties={},e.required=[];for(let i in t.entries){let a=t.entries[i];e.properties[i]=JJ({},a,n,r),a.type!==`exact_optional`&&a.type!==`nullish`&&a.type!==`optional`&&e.required.push(i)}t.type===`object_with_rest`?e.additionalProperties=JJ({},t.rest,n,r):t.type===`strict_object`&&(e.additionalProperties=!1);break;case`record`:n?.target===`openapi-3.0`&&`pipe`in t.key&&(a=PJ(a,`The "record" schema with a schema for the key that contains a "pipe" cannot be converted to JSON Schema.`)),t.key.type!==`string`&&(a=PJ(a,`The "record" schema with the "${t.key.type}" schema for the key cannot be converted to JSON Schema.`)),e.type=`object`,n?.target!==`openapi-3.0`&&(e.propertyNames=JJ({},t.key,n,r)),e.additionalProperties=JJ({},t.value,n,r);break;case`any`:case`unknown`:break;case`never`:e.not={};break;case`nullable`:case`nullish`:if(n?.target===`openapi-3.0`){let i=JJ({},t.wrapped,n,r);Object.assign(e,i),e.nullable=!0}else e.anyOf=[JJ({},t.wrapped,n,r),{type:`null`}];t.default!==void 0&&(e.default=typeof t.default==`function`?t.default():t.default);break;case`exact_optional`:case`optional`:case`undefinedable`:e=JJ(e,t.wrapped,n,r),t.default!==void 0&&(e.default=typeof t.default==`function`?t.default():t.default);break;case`literal`:if(!RJ(t.literal)){a=PJ(a,`The value of the "literal" schema is not JSON compatible.`);break}n?.target===`openapi-3.0`?e.enum=[t.literal]:e.const=t.literal;break;case`enum`:case`picklist`:{let r=t.options;if(!r.every(e=>typeof e==`string`||typeof e==`number`&&Number.isFinite(e))){a=PJ(a,`An option of the "${t.type}" schema is not JSON compatible.`);break}e.enum=r,r.every(e=>typeof e==`string`)?e.type=`string`:r.every(e=>typeof e==`number`)?e.type=`number`:n?.target!==`openapi-3.0`&&(e.type=[`string`,`number`]);break}case`union`:e.anyOf=t.options.map(e=>JJ({},e,n,r));break;case`variant`:e.oneOf=t.options.map(e=>JJ({},e,n,r));break;case`intersect`:e.allOf=t.options.map(e=>JJ({},e,n,r));break;case`lazy`:{let i=r.getterMap.get(t.getter);i||(i=t.getter(void 0),r.getterMap.set(t.getter,i));let a=r.referenceMap.get(i);if(a||(a=r.referenceMap.createId(r.definitions),r.referenceMap.set(i,a),r.definitions[a]=JJ({},i,n,r,!0)),e.$ref=qJ(a),n?.overrideRef){let t=n.overrideRef({...r,referenceId:a,valibotSchema:i,jsonSchema:e});t&&(e.$ref=t)}break}default:a=PJ(a,`The "${t.type}" schema cannot be converted to JSON Schema.`)}if(n?.overrideSchema){let i=n.overrideSchema({...r,referenceId:r.referenceMap.get(t),valibotSchema:t,jsonSchema:e,errors:a});if(i)return{...i}}if(a)for(let e of a)LJ(e,n);return e}function YJ(e,t){let n={definitions:{},referenceMap:new BJ,getterMap:new Map},r=t?.definitions??void 0;if(r){for(let e in r)n.referenceMap.set(r[e],e);for(let e in r)n.definitions[e]=JJ({},r[e],t,n,!0)}let i=JJ({},e,t,n),a=t?.target??`draft-07`;return a===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:a===`draft-07`&&(i.$schema=`http://json-schema.org/draft-07/schema#`),n.referenceMap.size&&(i.$defs=n.definitions),i}var XJ=Dn({overallSummary:Pn(Nn(),Mn(`A short summary of the intention of the PR (why over what) for a reviewer who hasn't read it yet. Rendered as Markdown.`)),groups:En(jn(wn))}),ZJ=4e4;function QJ(){return{turn:0,charsRead:0,readPaths:new Set,submitAttempts:0}}function $J(e,t){let n=new Set(e.files.map(e=>e.path)),r=new Set,i=new Set,a=[],o=e=>{if(!n.has(e)){a.push(e);return}r.has(e)&&i.add(e),r.add(e)};for(let e of t.groups){e.filePaths.forEach(o);for(let t of e.children??[])t.filePaths.forEach(o)}return{missing:e.files.map(e=>e.path).filter(e=>!r.has(e)),duplicated:[...i],unknown:a}}function eY(e,t){let n=[];if(e.missing.length>0&&n.push(`Missing paths: ${e.missing.join(`, `)}`),e.duplicated.length>0&&n.push(`Duplicated paths: ${e.duplicated.join(`, `)}`),e.unknown.length>0&&n.push(`Unknown paths: ${e.unknown.join(`, `)}`),n.length!==0)return n.push(`Fix these and call ${t} again.`),n.join(`
95
+ `)}var tY=Dn({paths:En(Nn())});function nY(e,t){let n=new Map(e.files.map(e=>[e.path,e]));return{name:`read_diffs`,label:`Read diffs`,description:`Returns the diffs of the given manifest paths.`,parameters:YJ(tY),execute:async(e,r)=>{let i=Tn(tY,r);if(!i.success)throw Error(Cn(i.issues));let{paths:a}=i.output,o=a.filter(e=>!n.has(e));if(o.length>0)throw Error(`Unknown paths: ${o.join(`, `)}`);let s=[],c=[],l=0;for(let e=0;e<a.length;e++){let r=a[e];if(t.readPaths.has(r)){let e=`### ${r}\n(already shown above)`;s.push(e),c.push(r),l+=e.length;continue}let i=xJ([n.get(r)]);if(l+i.length>4e4&&c.length>0){s.push(`Not returned (limit reached), request again: ${a.slice(e).join(`, `)}`);break}i.length>4e4&&(i=`${i.slice(0,ZJ)}\n(truncated)`),s.push(i),c.push(r),l+=i.length}for(let e of c)t.readPaths.add(e);return t.charsRead+=l,{content:[{type:`text`,text:s.join(`
96
+
97
+ `)}],details:{paths:c,chars:l}}}}}function rY(e){if(typeof e!=`string`)return e;try{return JSON.parse(e)}catch{return e}}function iY(e){let t=rY(e);if(!t||typeof t!=`object`||Array.isArray(t))return t;let n=t,r={...n,filePaths:rY(n.filePaths)};if(n.children!==void 0){let e=rY(n.children);r.children=Array.isArray(e)?e.map(iY):e}return r}function aY(e){if(!e||typeof e!=`object`)return e;let t=e,n=rY(t.groups);return{...t,groups:Array.isArray(n)?n.map(iY):n}}function oY(e,t){return{name:`submit_grouping`,label:`Submit grouping`,description:`Submit the final grouping and overall summary.`,parameters:YJ(XJ),prepareArguments:aY,execute:async(n,r)=>{t.submitAttempts+=1;let i=Tn(XJ,r);if(!i.success)throw Error(Cn(i.issues));let a=i.output,o=eY($J(e,a),`submit_grouping`);if(o&&t.submitAttempts<2)throw Error(o);return t.result=a,{content:[{type:`text`,text:`Grouping accepted.`}],details:a,terminate:!0}}}}var sY={name:`update_grouping`,description:`Replace the current grouping and overall summary. Call only when the user asks to change the grouping.`,parameters:YJ(XJ)};function cY(e,t){return{...sY,label:`Update grouping`,prepareArguments:aY,execute:async(n,r)=>{let i=Tn(XJ,r);if(!i.success)throw Error(Cn(i.issues));let a=i.output,o=eY($J(e,a),`update_grouping`);if(o)throw Error(o);return await t(a),{content:[{type:`text`,text:`Grouping updated: ${a.groups.length} groups.`}],details:a}}}}var lY=2e5,uY=new Set([`system`,`user`,`assistant`,`toolResult`]);function dY(e){return e.filter(e=>uY.has(e.role))}function fY(e){let t=e?.paths;return Array.isArray(t)?t.filter(e=>typeof e==`string`):[]}async function pY(e,t,n,r){let i=QJ(),a=!1,o=!1,s={messages:[{role:`system`,content:CJ,timestamp:Date.now()}],tools:[nY(e,i),oY(e,i)]},c={role:`user`,content:kJ(e,n),timestamp:Date.now()},l={model:t.model,apiKey:t.apiKey,sessionId:On(e.ref),cacheRetention:`short`,convertToLlm:dY,getSteeringMessages:async()=>a||i.charsRead<=2e5&&i.turn<10?[]:(a=!0,[{role:`user`,content:`Reading budget exhausted. Call submit_grouping now with what you have.`,timestamp:Date.now()}]),getFollowUpMessages:async()=>o||i.result!==void 0?[]:(o=!0,[{role:`user`,content:`Call submit_grouping now.`,timestamp:Date.now()}]),finishTurn:({message:e})=>{if(e.stopReason!==`error`&&e.stopReason!==`aborted`&&(i.result!==void 0||i.turn>=12))return{action:`end`}}},u=[...s.messages],d=await FG([c],s,l,e=>{e.type===`turn_start`?(i.turn+=1,r?.onProgress?.({step:i.turn,kind:`thinking`})):e.type===`tool_execution_start`?e.toolName===`read_diffs`?r?.onProgress?.({step:i.turn,kind:`reading`,paths:fY(e.args)}):e.toolName===`submit_grouping`&&r?.onProgress?.({step:i.turn,kind:`organizing`}):e.type===`message_start`?(u.push(e.message),r?.onTranscript?.([...u])):(e.type===`message_update`||e.type===`message_end`)&&(u[u.length-1]=e.message,r?.onTranscript?.([...u]))},r?.signal,NJ(t)),f=[...s.messages,...d],p=d.findLast(e=>e.role===`assistant`);if(p?.stopReason===`aborted`||r?.signal?.aborted)throw new DOMException(`Aborted`,`AbortError`);if(p?.stopReason===`error`)throw Error(p.errorMessage);if(i.result===void 0)throw Error(`Agent did not submit a grouping`);return{analysis:i.result,transcript:f}}function mY(e,t){let n=new Set(e.files.map(e=>e.path)),r=new Set,i=[];for(let e of t.groups){let t=e.filePaths.filter(e=>n.has(e)&&!r.has(e));t.forEach(e=>r.add(e));let a=e.children?.map(e=>({...e,filePaths:e.filePaths.filter(e=>!n.has(e)||r.has(e)?!1:(r.add(e),!0))})).filter(e=>e.filePaths.length>0);(t.length!==0||a?.length)&&i.push({...e,filePaths:t,children:a?.length?a:void 0})}return i}function hY(e,t,n,r){let i={overallSummary:t.overallSummary,groups:mY(e,t),schemaVersion:1};return{...kn(`llm`,i,`${n.model.provider}/${n.model.id}`),locale:r}}async function gY(e,t,n,r){let{analysis:i,transcript:a}=await pY(e,t,n,r);return{result:hY(e,i,t,n),transcript:a}}var _Y=4e5,vY=`(diff omitted, call read_diffs again if needed)`,yY=`<reminder>Reply in the same language as this message.</reminder>`;function bY(e){return e.some(e=>e.role===`system`&&e.sections?.chat!==void 0)?e:[...e,{role:`system`,content:``,sections:{chat:wJ},toolsAdded:[sY],toolsRemoved:[{name:`submit_grouping`}],timestamp:Date.now()}]}function xY(e,t=_Y){let n=JSON.stringify(e).length;if(n<=t)return e;let r=[{type:`text`,text:vY}],i=JSON.stringify(r).length,a=[...e];for(let e=0;e<a.length&&n>t;e++){let t=a[e];if(t.role!==`toolResult`||t.toolName!==`read_diffs`)continue;let o=JSON.stringify(t.content).length-i;o<=0||(a[e]={...t,content:r},n-=o)}return a}function SY(e){let t=e.findLastIndex(e=>e.role===`user`);if(t===-1)return e;let n=e[t];if(n.role!==`user`)return e;let r={type:`text`,text:yY},i=typeof n.content==`string`?[{type:`text`,text:n.content},r]:[...n.content,r],a=[...e];return a[t]={...n,content:i},a}function CY({diff:e,resolved:t,locale:n,messages:r,onGroupingUpdate:i}){let a=QJ();return new oK({initialState:{model:t.model,tools:[nY(e,a),cY(e,r=>i(hY(e,r,t,n)))],messages:bY(r)},streamFn:NJ(t),getApiKey:()=>t.apiKey,sessionId:On(e.ref),convertToLlm:dY,transformContext:async e=>{let t=xY(e);return t!==e&&a.readPaths.clear(),SY(t)},finishTurn:({message:e,newMessages:t})=>{if(e.stopReason!==`error`&&e.stopReason!==`aborted`&&t.filter(e=>e.role===`assistant`).length>=8)return{action:`end`}}})}var wY=`vercel.ai.error`,TY=Symbol.for(wY),EY=class e extends Error{constructor({name:e,message:t,cause:n}){super(t),this[TY]=!0,this.name=e,this.cause=n}static isInstance(t){return e.hasMarker(t,wY)}static hasMarker(e,t){let n=Symbol.for(t);return typeof e==`object`&&!!e&&n in e&&typeof e[n]==`boolean`&&e[n]===!0}},DY=`AI_APICallError`,OY=`vercel.ai.error.${DY}`,kY=Symbol.for(OY),AY=class extends EY{constructor({message:e,url:t,requestBodyValues:n,statusCode:r,responseHeaders:i,responseBody:a,cause:o,isRetryable:s=r!=null&&(r===408||r===409||r===429||r>=500),data:c}){super({name:DY,message:e,cause:o}),this[kY]=!0,this.url=t,this.requestBodyValues=n,this.statusCode=r,this.responseHeaders=i,this.responseBody=a,this.isRetryable=s,this.data=c}static isInstance(e){return EY.hasMarker(e,OY)}},jY=`AI_EmptyResponseBodyError`,MY=`vercel.ai.error.${jY}`,NY=Symbol.for(MY),PY=class extends EY{constructor({message:e=`Empty response body`}={}){super({name:jY,message:e}),this[NY]=!0}static isInstance(e){return EY.hasMarker(e,MY)}};function FY(e){return e==null?`unknown error`:typeof e==`string`?e:e instanceof Error?e.toString():JSON.stringify(e)}var IY=`AI_InvalidArgumentError`,LY=`vercel.ai.error.${IY}`,RY=Symbol.for(LY),zY=class extends EY{constructor({message:e,cause:t,argument:n}){super({name:IY,message:e,cause:t}),this[RY]=!0,this.argument=n}static isInstance(e){return EY.hasMarker(e,LY)}},BY=`AI_JSONParseError`,VY=`vercel.ai.error.${BY}`,HY=Symbol.for(VY),UY=class extends EY{constructor({text:e,cause:t}){super({name:BY,message:`JSON parsing failed: Text: ${e}.\nError message: ${FY(t)}`,cause:t}),this[HY]=!0,this.text=e}static isInstance(e){return EY.hasMarker(e,VY)}},WY=`AI_TypeValidationError`,GY=`vercel.ai.error.${WY}`,KY=Symbol.for(GY),qY=class e extends EY{constructor({value:e,cause:t,context:n}){let r=`Type validation failed`;if(n?.field&&(r+=` for ${n.field}`),n?.entityName||n?.entityId){r+=` (`;let e=[];n.entityName&&e.push(n.entityName),n.entityId&&e.push(`id: "${n.entityId}"`),r+=e.join(`, `),r+=`)`}super({name:WY,message:`${r}: Value: ${JSON.stringify(e)}.\nError message: ${FY(t)}`,cause:t}),this[KY]=!0,this.value=e,this.context=n}static isInstance(e){return EY.hasMarker(e,GY)}static wrap({value:t,cause:n,context:r}){return e.isInstance(n)&&n.value===t&&n.context?.field===r?.field&&n.context?.entityName===r?.entityName&&n.context?.entityId===r?.entityId?n:new e({value:t,cause:n,context:r})}},JY=`AI_UnsupportedFunctionalityError`,YY=`vercel.ai.error.${JY}`,XY=Symbol.for(YY),ZY=class extends EY{constructor({functionality:e,message:t=`'${e}' functionality not supported.`}){super({name:JY,message:t}),this[XY]=!0,this.functionality=e}static isInstance(e){return EY.hasMarker(e,YY)}};function QY(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function $Y(e,t=`|`){return e.map(e=>EX(e)).join(t)}function eX(e,t){return typeof t==`bigint`?t.toString():t}var tX=class{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;return e!==void 0&&(this._value=e(),this._getter=void 0),this._value}};function nX(e){return new tX(e)}function rX(e){return e==null}function iX(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function aX(e,t){let n=e/t,r=Math.round(n),i=4*2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}var oX=Symbol(`evaluating`);function sX(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==oX)return r===void 0&&(r=oX,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function cX(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function lX(e){let t=Object.getOwnPropertyDescriptor(e,`shape`);return t?.get?t.get.raw:t?.value}function uX(e){return lX(e._zod.def)??e._zod.def.shape}function dX(e,t,n){Object.defineProperty(e,t,{get(){let e=n();return cX(this,t,e),e},enumerable:!0,configurable:!0})}function fX(e,t,n){t in e?cX(e,t,n):e[t]=n}function pX(e,t,n,r){let i=uX(t);for(let a of n){let n=Object.getOwnPropertyDescriptor(i,a);n.enumerable&&(n.get?dX(e,a,()=>{let e=t._zod.def.shape[a];return r?r(e,a):e}):fX(e,a,r?r(n.value,a):n.value))}}function mX(e,t){for(let n of Reflect.ownKeys(t)){let r=Object.getOwnPropertyDescriptor(t,n);r.enumerable&&(r.get?dX(e,n,()=>t[n]):fX(e,n,r.value))}}function hX(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function gX(e){return JSON.stringify(e)}function _X(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var vX=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function yX(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var bX=nX(()=>{if(mZ.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function xX(e){if(yX(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return yX(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function SX(e){return xX(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var CX=new Set([`string`,`number`,`symbol`]);function wX(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function TX(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function Z(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function EX(e){return typeof e==`bigint`?e.toString()+`n`:typeof e==`string`?`"${e}"`:`${e}`}function DX(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout===`optional`)}var OX={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},kX={int64:[BigInt(`-9223372036854775808`),BigInt(`9223372036854775807`)],uint64:[BigInt(0),BigInt(`18446744073709551615`)]};function AX(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);let i={};return pX(i,e,jX(e,t)),TX(e,hX(n,{shape:i,checks:[]}))}function jX(e,t){let n=uX(e),r=[];for(let e of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(n,e)?.enumerable)throw Error(`Unrecognized key: "${String(e)}"`);t[e]&&r.push(e)}return r}function MX(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);let i=new Set(jX(e,t)),a={};return pX(a,e,Reflect.ownKeys(uX(e)).filter(e=>!i.has(e))),TX(e,hX(n,{shape:a,checks:[]}))}function NX(e,t){if(!xX(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=uX(e);for(let e of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return TX(e,hX(e._zod.def,{shape:PX(e,t)}))}function PX(e,t){let n={};return pX(n,e,Reflect.ownKeys(uX(e))),mX(n,t),n}function FX(e,t){if(!xX(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return TX(e,hX(e._zod.def,{shape:PX(e,t)}))}function IX(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);let n={};return pX(n,e,Reflect.ownKeys(uX(e))),pX(n,t,Reflect.ownKeys(uX(t))),TX(e,hX(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function LX(e,t,n,r=`partial`){let i=t._zod.def.checks;if(i&&i.length>0)throw Error(`.${r}() cannot be used on object schemas containing refinements`);let a=n?new Set(jX(t,n)):void 0,o={};return pX(o,t,Reflect.ownKeys(uX(t)),e&&((t,n)=>a&&!a.has(n)?t:new e({type:`optional`,innerType:t}))),TX(t,hX(t._zod.def,{shape:o,checks:[]}))}function RX(e,t,n){let r=n?new Set(jX(t,n)):void 0,i={};return pX(i,t,Reflect.ownKeys(uX(t)),(t,n)=>r&&!r.has(n)?t:new e({type:`nonoptional`,innerType:t})),TX(t,hX(t._zod.def,{shape:i}))}function zX(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function ste(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function BX(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function VX(e){return typeof e==`string`?e:e?.message}function HX(e,t,n){var r;for(let i=t;i<e.length;i++)(r=e[i]).schema??(r.schema=n)}function UX(e,t,n){var r;let i=e.inst?._zod?.traits;i?.has(`$ZodType`)&&(i.has(`$ZodCheck`)?(r=e).schema??(r.schema=e.inst):e.schema=e.inst);let a=e.schema===e.inst?void 0:e.schema?._zod.def?.error,o=e.message?e.message:VX(e.inst?._zod.def?.error?.(e))??VX(a?.(e))??VX(t?.error?.(e))??VX(n.customError?.(e))??VX(n.localeError?.(e))??`Invalid input`,s={};for(let t of Object.keys(e))t!==`inst`&&t!==`schema`&&t!==`continue`&&t!==`input`&&t!==`__proto__`&&(s[t]=e[t]);return s.path??=[],s.message=o,t?.reportInput&&(s.input=e.input),s}var WX=/[\uD800-\uDBFF]/;function GX(e){let t=e.length;if(!WX.test(e))return t;let n=t;for(let r=0;r<t-1;r++)(e.charCodeAt(r)&64512)==55296&&(e.charCodeAt(r+1)&64512)==56320&&(n--,r++);return n}function KX(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function qX(e){let t=typeof e;switch(t){case`number`:return Number.isNaN(e)?`nan`:`number`;case`object`:{if(e===null)return`null`;if(Array.isArray(e))return`array`;let t=e;if(t&&Object.getPrototypeOf(t)!==Object.prototype&&`constructor`in t&&t.constructor)return t.constructor.name}}return t}function JX(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}function YX(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);r.get?Object.defineProperty(e,n,{...r,enumerable:!1}):$X(e,n,r.value)}}function XX(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function ZX(e,t,n){return XX(e,t,n,!1)}function QX(e,t){for(let n in e){let r=e[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get(){return XX(this,n,r(this))},set(e){XX(this,n,e)}})}return t}function $X(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:XX(this,t,n.bind(this))},set(e){XX(this,t,e)}})}function eZ(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}var tZ,nZ=!1,rZ={configurable:!0,get(){nZ=!0}};function iZ(e,t,n){let r=Object.getPrototypeOf(e._zod);if(t in r&&tZ!==e._zod){tZ=void 0;return}tZ=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,rZ);let e=nZ;nZ=!1;try{let r=n(this);return nZ?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:r}),nZ||=e,r}catch(n){throw delete this[t],nZ||=e,n}},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}})}function aZ(e,t,n,r){let i=eZ(e,t);i&&Object.defineProperty(i,t,{configurable:!0,get(){let e={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,t,e),e.value=n(this),Object.defineProperty(this,t,e),e.value},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:r,value:e})}})}var oZ=`~constantCatch`;function sZ(e){let t=()=>e;return t[oZ]=!0,t}var cZ,lZ={value:void 0,enumerable:!1},uZ=`captureStackTrace`in Error?Error:null;function dZ(e){let t=uZ;if(t){let n=t.stackTraceLimit;if(typeof n==`number`){try{t.stackTraceLimit=0}catch{return uZ=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function Q(e,t,n,r){let i={};function a(e){this.def=e,this.constr=d,this.traits=new Set}a.prototype=i;let o=n,s=o&&new WeakSet;function c(n,r){if(!n._zod){lZ.value=new a(r);try{Object.defineProperty(n,"_zod",lZ)}finally{lZ.value=void 0}}else if(n._zod.traits.has(e))return;if(n._zod.traits.add(e),t(n,r),s){let e=Object.getPrototypeOf(n),t=n._zod.constr.prototype,r=e;for(;r&&r!==t;)r=Object.getPrototypeOf(r);let i=r??e;s.has(i)||(s.add(i),YX(i,o))}let i=d.prototype;for(let e in i)Object.prototype.hasOwnProperty.call(i,e)&&(e in n||(n[e]=i[e].bind(n)))}let l=r?.Parent??Object;class u extends l{}Object.defineProperty(u,"name",{value:e});function d(e){let t=r?.Parent?dZ(u):this;c(t,e);let n=t._zod.deferred;if(n){for(let e of n)e();t._zod.deferred=void 0}let i=globalThis.__zod_globalConfig?.postProcessor;return i&&i(t),t}return Object.defineProperty(d,"init",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:t=>r?.Parent&&t instanceof r.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}var fZ=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},pZ=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(cZ=globalThis).__zod_globalConfig??(cZ.__zod_globalConfig={});var mZ=globalThis.__zod_globalConfig;function hZ(e){return e&&Object.assign(mZ,e),mZ}function gZ(){let e=this._zod;return e.message??=JSON.stringify(e.def,eX,2),e.message}function _Z(e){this._zod.message=e}var vZ={get:gZ,set:_Z,enumerable:!0,configurable:!0},yZ={value:void 0,enumerable:!1},bZ=new WeakSet([Object.prototype,Error.prototype]),xZ=(e,t)=>{e.name=`$ZodError`,yZ.value=t,Object.defineProperty(e,"issues",yZ),yZ.value=void 0,Object.defineProperty(e,"message",vZ);let n=Object.getPrototypeOf(e);bZ.has(n)||(bZ.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let e=()=>this.message;return Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0})}}))},SZ=Q(`$ZodError`,xZ);Q(`$ZodError`,xZ,void 0,{Parent:Error});function CZ(e,t,n){return Object.prototype.hasOwnProperty.call(e,t)||(t===`__proto__`?Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0}):e[t]=n()),e[t]}function wZ(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?CZ(n,i.path[0],()=>[]).push(t(i)):r.push(t(i));return{formErrors:r,fieldErrors:n}}function TZ(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i],o=i===e.length-1;if(n===`_errors`){o&&r._errors.push(t(a)),i++;continue}Object.prototype.hasOwnProperty.call(r,n)||Object.defineProperty(r,n,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let s=r[n];o&&s._errors.push(t(a)),r=s,i++}}}};return r(e),n}function EZ(e,t){return{callee:t?.callee??e,Err:t?.Err}}var DZ=e=>{let t=(n,r,i,a)=>{let o=i?{...i,async:!1}:{async:!1},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new fZ;if(s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>UX(e,o,hZ())));throw vX(n,a?.callee??t),n}return s.value};return t},OZ=e=>{let t=async(n,r,i,a)=>{let o=i?{...i,async:!0}:{async:!0},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>UX(e,o,hZ())));throw vX(n,a?.callee??t),n}return s.value};return t},kZ=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new fZ;return a.issues.length?AZ(e,a.issues,i):{success:!0,data:a.value}};function AZ(e,t,n){let r;return{success:!1,get error(){return r||(r=new e(t.map(e=>UX(e,n,hZ()))),t=void 0,n=void 0),r},set error(e){r=e,t=void 0,n=void 0}}}var jZ=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?AZ(e,a.issues,i):{success:!0,data:a.value}},MZ=Symbol.for(`zod.compile.invalid`),NZ=Symbol.for(`zod.compile.fallback`),PZ=((e,t,n)=>{let r=e._zod.bag.validator;if(r!==void 0){if(r(t)!==MZ)return!0;if(r.definite===!0&&n===void 0)return!1}return FZ(e,t,n)});function FZ(e,t,n){let r=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},i=e._zod.bag.fallbackRun,a;if(i?(r[NZ]=!0,a=i({value:t,issues:[]},r)):a=e._zod.run({value:t,issues:[]},r),a instanceof Promise)throw new fZ;return a.issues.length===0}var IZ=async(e,t,n)=>{let r=n?{...n,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},i=e._zod.run({value:t,issues:[]},r);return i instanceof Promise&&(i=await i),i.issues.length===0},LZ=e=>{let t=DZ(e),n=(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return t(e,r,o,EZ(n,a))};return n},RZ=e=>{let t=DZ(e),n=(e,r,i,a)=>t(e,r,i,EZ(n,a));return n},zZ=e=>{let t=OZ(e),n=async(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return await t(e,r,o,EZ(n,a))};return n},BZ=e=>{let t=OZ(e),n=async(e,r,i,a)=>await t(e,r,i,EZ(n,a));return n},VZ=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return kZ(e)(t,n,i)},HZ=e=>(t,n,r)=>kZ(e)(t,n,r),UZ=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return jZ(e)(t,n,i)},WZ=e=>async(t,n,r)=>jZ(e)(t,n,r),GZ=/^[cC][0-9a-z]{6,}$/,KZ=/^[0-9a-z]+$/,qZ=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,JZ=/^[0-9a-vA-V]{20}$/,YZ=/^[A-Za-z0-9]{27}$/,XZ=/^[a-zA-Z0-9_-]{21}$/;function ZZ(e){return RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var QZ=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,$Z=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,eQ=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,tQ=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,nQ=`^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`;function rQ(){return new RegExp(nQ,`u`)}var iQ=/^(?:(?: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])$/,aQ=/^(([0-9a-fA-F]{1,4}:){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}|:))$/,oQ=/^((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])\/([0-9]|[1-2][0-9]|3[0-2])$/,sQ=/^(([0-9a-fA-F]{1,4}:){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}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,cQ=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,lQ=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,uQ=/^https?$/,dQ=/^\+[1-9]\d{6,14}$/,fQ=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`;function pQ(e){return RegExp(`^${e}$`)}var mQ=pQ(fQ);function hQ(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function gQ(e){return RegExp(`^${hQ(e)}$`)}function _Q(e){let t=[`Z`];e.offset&&t.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let n=`${hQ({precision:e.precision,seconds:!0})}(?:${t.join(`|`)})`,r=e.local?`${n}|${hQ({precision:e.precision})}`:n;return RegExp(`^${fQ}T(?:${r})$`)}var vQ=/^[\s\S]{0,}$/,yQ=/^-?\d+$/,bQ=/^-?\d+(?:\.\d+)?$/,xQ=/^(?:true|false)$/i,SQ=/^null$/i,CQ=/^[^A-Z]*$/,wQ=/^[^a-z]*$/,TQ=Q(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),EQ=e=>{let t=e.value;return!rX(t)&&t.length!==void 0},DQ={number:`number`,bigint:`bigint`,object:`date`},OQ=Q(`$ZodCheckLessThan`,(e,t)=>{TQ.init(e,t);let n=DQ[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:DQ[typeof r.value]??n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),kQ=Q(`$ZodCheckGreaterThan`,(e,t)=>{TQ.init(e,t);let n=DQ[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:DQ[typeof r.value]??n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),AQ=Q(`$ZodCheckMultipleOf`,(e,t)=>{TQ.init(e,t),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?t.value!==BigInt(0)&&n.value%t.value===BigInt(0):aX(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),jQ=Q(`$ZodCheckNumberFormat`,(e,t)=>{TQ.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=OX[t.format];e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),MQ=Q(`$ZodCheckMaxLength`,(e,t)=>{var n;TQ.init(e,t),(n=e._zod.def).when??(n.when=EQ),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>t.maximum?GX(r):i)<=t.maximum)return;let a=KX(r);n.issues.push({origin:a,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),NQ=Q(`$ZodCheckMinLength`,(e,t)=>{var n;TQ.init(e,t),(n=e._zod.def).when??(n.when=EQ),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>=t.minimum&&i<t.minimum*2?GX(r):i)>=t.minimum)return;let a=KX(r);n.issues.push({origin:a,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),PQ=Q(`$ZodCheckLengthEquals`,(e,t)=>{var n;TQ.init(e,t),(n=e._zod.def).when??(n.when=EQ),e._zod.check=n=>{let r=n.value,i=r.length,a=typeof r==`string`&&i>=t.length&&i<=t.length*2?GX(r):i;if(a===t.length)return;let o=KX(r),s=a>t.length;n.issues.push({origin:o,...s?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),FQ=Q(`$ZodCheckStringFormat`,(e,t)=>{var n,r;TQ.init(e,t),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),IQ=Q(`$ZodCheckRegex`,(e,t)=>{FQ.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),LQ=Q(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=CQ,FQ.init(e,t)}),RQ=Q(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=wQ,FQ.init(e,t)}),zQ=Q(`$ZodCheckIncludes`,(e,t)=>{TQ.init(e,t);let n=wX(t.includes);t.pattern=new RegExp(typeof t.position==`number`?`^.{${t.position},}${n}`:n),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),BQ=Q(`$ZodCheckStartsWith`,(e,t)=>{TQ.init(e,t);let n=RegExp(`^${wX(t.prefix)}.*`);t.pattern??=n,e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),VQ=Q(`$ZodCheckEndsWith`,(e,t)=>{TQ.init(e,t);let n=RegExp(`.*${wX(t.suffix)}$`);t.pattern??=n,e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),HQ=Q(`$ZodCheckOverwrite`,(e,t)=>{TQ.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),UQ=class{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1;try{e(this)}finally{--this.indent}}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
98
+ `).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.content??[``];return new e(...Object.keys(this.closed),`return function (${this.args.join(`, `)}) {\n${t.join(`
99
+ `)}\n};`)(...Object.values(this.closed))}},WQ={major:4,minor:6,patch:5},GQ=Q(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=WQ;let r=e._zod.def.checks,i=e._zod.traits.has(`$ZodCheck`)?[e,...r??[]]:r?.length?[...r]:[];for(let t of i)for(let n of t._zod.onattach)n(e);if(i.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(t,n,r)=>{if(t.memo)return t;let i=zX(t),a;for(let o of n){if(o._zod.def.when){if(ste(t)||!o._zod.def.when(t))continue}else if(i)continue;let n=t.issues.length,s=o._zod.check(t);if(s instanceof Promise&&r?.async===!1)throw new fZ;if(a||s instanceof Promise)a=(a??Promise.resolve()).then(async()=>{await s,t.issues.length!==n&&(HX(t.issues,n,e),i||=zX(t,n))});else{if(t.issues.length===n)continue;HX(t.issues,n,e),i||=zX(t,n)}}return a?a.then(()=>t):t},n=(n,r,a)=>{if(zX(n))return n.aborted=!0,n;let o=t(r,i,a);if(o instanceof Promise){if(a.async===!1)throw new fZ;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(r,a)=>{if(a.skipChecks)return e._zod.parse(r,a);if(a.direction===`backward`){let t=e._zod.parse({value:r.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,r,a)):n(t,r,a)}let o=e._zod.parse(r,a);if(o instanceof Promise){if(a.async===!1)throw new fZ;return o.then(e=>t(e,i,a))}return t(o,i,a)}}},{get"~standard"(){return ZX(this,`~standard`,JQ(this))},set"~standard"(e){XX(this,`~standard`,e)}}),KQ=(e,t)=>e.issues.length?{issues:e.issues.map(e=>UX(e,t,hZ()))}:{value:e.value};async function qQ(e,t){let n={async:!0};return KQ(await e._zod.run({value:t,issues:[]},n),n)}function JQ(e){return{validate:t=>{let n={async:!1};try{let r=e._zod.run({value:t,issues:[]},n);if(!(r instanceof Promise))return KQ(r,n)}catch{}return qQ(e,t)},vendor:`zod`,version:1}}var YQ=Q(`$ZodString`,(e,t)=>{GQ.init(e,t),e._zod.pattern=t.pattern??vQ,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),XQ=Q(`$ZodStringFormat`,(e,t)=>{FQ.init(e,t),YQ.init(e,t)}),ZQ=Q(`$ZodGUID`,(e,t)=>{t.pattern??=$Z,XQ.init(e,t)}),QQ=Q(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=eQ(e)}else t.pattern??=eQ();XQ.init(e,t)}),$Q=Q(`$ZodEmail`,(e,t)=>{t.pattern??=tQ,XQ.init(e,t)});function e$(e){try{return typeof URL<`u`&&typeof URL.canParse==`function`?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function t$(e,t){return!(`normalize`in t)&&!(`hostname`in t)&&!(`protocol`in t)?e$(e)||2:n$(e,t)}function n$(e,t){if(!t.normalize&&t.protocol?.source===uQ.source&&!/^https?:\/\//i.test(e))return 1;try{if(typeof URL<`u`){let t=URL;if(typeof t.parse==`function`)return t.parse(e)??2}return new URL(e)}catch{return 2}}var r$=/[\t\n\r]/g;function i$(e){return e.replace(r$,``)}function a$(e,t){return t.lastIndex=0,t.test(e.hostname)}function o$(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(`:`)?e.protocol.slice(0,-1):e.protocol)}var s$=Q(`$ZodURL`,(e,t)=>{XQ.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=t$(r,t);if(i===1){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}if(i===2){n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort});return}if(i===!0){n.value=i$(r);return}t.hostname&&!a$(i,t.hostname)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort}),t.protocol&&!o$(i,t.protocol)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort}),n.value=t.normalize?i.href:i$(r);return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),c$=Q(`$ZodEmoji`,(e,t)=>{t.pattern??=rQ(),XQ.init(e,t)}),l$=Q(`$ZodNanoID`,(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw Error(`Invalid nanoid length: ${t.length}`);t.pattern??=t.length===void 0?XZ:ZZ(t.length),XQ.init(e,t)}),u$=Q(`$ZodCUID`,(e,t)=>{t.pattern??=GZ,XQ.init(e,t)}),d$=Q(`$ZodCUID2`,(e,t)=>{t.pattern??=KZ,XQ.init(e,t)}),f$=Q(`$ZodULID`,(e,t)=>{t.pattern??=qZ,XQ.init(e,t)}),p$=Q(`$ZodXID`,(e,t)=>{t.pattern??=JZ,XQ.init(e,t)}),m$=Q(`$ZodKSUID`,(e,t)=>{t.pattern??=YZ,XQ.init(e,t)}),h$=Q(`$ZodISODateTime`,(e,t)=>{t.pattern??=_Q(t),XQ.init(e,t)}),g$=Q(`$ZodISODate`,(e,t)=>{t.pattern??=mQ,XQ.init(e,t)}),_$=Q(`$ZodISOTime`,(e,t)=>{t.pattern??=gQ(t),XQ.init(e,t)}),v$=Q(`$ZodISODuration`,(e,t)=>{t.pattern??=QZ,XQ.init(e,t)}),y$=Q(`$ZodIPv4`,(e,t)=>{t.pattern??=iQ,XQ.init(e,t)}),b$=/^[0-9a-fA-F:.]+$/;function x$(e){return b$.test(e)?e$(`http://[${e}]`):!1}var S$=Q(`$ZodIPv6`,(e,t)=>{t.pattern??=aQ,XQ.init(e,t),e._zod.check=n=>{x$(n.value)||n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}),C$=Q(`$ZodCIDRv4`,(e,t)=>{t.pattern??=oQ,XQ.init(e,t)});function w$(e){let t=e.split(`/`);if(t.length!==2)return!1;let[n,r]=t;if(!r)return!1;let i=Number(r);return`${i}`!==r||i<0||i>128?!1:x$(n)}var T$=Q(`$ZodCIDRv6`,(e,t)=>{t.pattern??=sQ,XQ.init(e,t),e._zod.check=n=>{w$(n.value)||n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}});function E$(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var D$=/^[0-9a-zA-Z+/]*={0,2}$/,O$=Q(`$ZodBase64`,(e,t)=>{t.pattern??=D$,XQ.init(e,t),e._zod.check=n=>{E$(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}}),k$=/^[A-Za-z0-9_-]*$/;function A$(e){if(!k$.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return E$(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var j$=Q(`$ZodBase64URL`,(e,t)=>{t.pattern??=k$,XQ.init(e,t),e._zod.check=n=>{A$(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),M$=Q(`$ZodE164`,(e,t)=>{t.pattern??=dQ,XQ.init(e,t)});function N$(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}var P$=Q(`$ZodJWT`,(e,t)=>{XQ.init(e,t),e._zod.check=n=>{N$(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),F$=Q(`$ZodNumber`,(e,t)=>{GQ.init(e,t),e._zod.pattern=bQ,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:String(i):void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),I$=Q(`$ZodNumberFormat`,(e,t)=>{jQ.init(e,t),F$.init(e,t)}),L$=Q(`$ZodBoolean`,(e,t)=>{GQ.init(e,t),e._zod.pattern=xQ,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),R$=Q(`$ZodNull`,(e,t)=>{GQ.init(e,t),e._zod.pattern=SQ,e._zod.values=new Set([null]),e._zod.parse=(t,n)=>{let r=t.value;return r===null||t.issues.push({expected:`null`,code:`invalid_type`,input:r,inst:e}),t}}),z$=Q(`$ZodAny`,(e,t)=>{GQ.init(e,t),e._zod.parse=e=>e}),B$=Q(`$ZodUnknown`,(e,t)=>{GQ.init(e,t),e._zod.parse=e=>e}),V$=Q(`$ZodNever`,(e,t)=>{GQ.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function H$(e,t,n){e.issues.length&&t.issues.push(...BX(n,e.issues)),t.value[n]=e.value}var U$=Q(`$ZodArray`,(e,t)=>{GQ.init(e,t);let n=mZ.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!Array.isArray(a))return r.issues.push({expected:`array`,code:`invalid_type`,input:a,inst:e}),r;r.value=n?n.alloc(e,r,Array(a.length),i):Array(a.length);let o=[],s=i?.abortEarly;for(let e=0;e<a.length;e++){let n=a[e],c=t.element._zod.run({value:n,issues:[]},i);if(c instanceof Promise)o.push(c.then(t=>H$(t,r,e)));else if(H$(c,r,e),s&&c.issues.length!==0&&zX(c))break}return o.length?Promise.all(o).then(()=>r):r}});function W$(e,t,n,r,i,a){let o=n in r,s=a===`optional`;if(o||!s||i!==`optional`){if(e.issues.length){if(i!==void 0&&s&&!o)return;t.issues.push(...BX(n,e.issues))}if(!o&&i===void 0){e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]});return}e.value===void 0?(o||i===`defaulted`&&!s)&&(t.value[n]=void 0):t.value[n]=e.value}}var G$=[];function K$(e){let t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:G$,i=r.length?[...t,...r]:t;for(let t of i)if(!e.shape?.[t]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${String(t)}": expected a Zod schema`);let a=DX(e.shape);return{...e,allKeys:i,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(a)}}function q$(e,t,n,r,i,a,o){let s=[],c=i.keySet,l=i.catchall._zod,u=l.def.type,d=l.optin,f=l.optout,p=0;for(let i in t){if(o&&n.issues.length!==p){if(zX(n,p))break;p=n.issues.length}if(c.has(i))continue;if(i===`__proto__`){u===`never`&&s.push(i);continue}if(u===`never`){s.push(i);continue}let a=l.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>W$(e,n,i,t,d,f))):W$(a,n,i,t,d,f)}return s.length&&n.issues.push({code:`unrecognized_keys`,keys:s,input:t,inst:a,continue:!0}),e.length?Promise.all(e).then(()=>n):n}var J$=Q(`$ZodObject`,(e,t)=>{GQ.init(e,t);let n=Object.getOwnPropertyDescriptor(t,`shape`),r=n?.get?n.get.raw:t.shape??{};if(r){let e=()=>{let n={...r};return Object.defineProperty(t,"shape",{value:n}),e.raw=n,n};e.raw=r,Object.defineProperty(t,"shape",{get:e})}let i=nX(()=>K$(t));iZ(e,`propValues`,e=>{let t=e.def.shape,n={};for(let e in t){let r=t[e]._zod;if(r.values){Object.prototype.hasOwnProperty.call(n,e)||cX(n,e,new Set);for(let t of r.values)n[e].add(t);r.optin!==void 0&&n[e].add(void 0)}}return n});let a=yX,o=t.catchall,s,c=mZ.memoizer;c?.attach(e),e._zod.parse=(t,n)=>{s??=i.value;let r=t.value;if(!a(r))return t.issues.push({expected:`object`,code:`invalid_type`,input:r,inst:e}),t;t.value=c?c.alloc(e,t,{},n):{};let l=[],u=s.shape,d=n?.abortEarly,f=t.issues.length;for(let e of s.allKeys){if(d&&t.issues.length!==f){if(zX(t,f))break;f=t.issues.length}if(e===`__proto__`)continue;let i=u[e],a=i._zod.optin,o=i._zod.optout,s=i._zod.run({value:r[e],issues:[]},n);s instanceof Promise?l.push(s.then(n=>W$(n,t,e,r,a,o))):W$(s,t,e,r,a,o)}return o?q$(l,r,t,n,i.value,e,d===!0):l.length?Promise.all(l).then(()=>t):t}}),Y$=Q(`$ZodObjectJIT`,(e,t)=>{J$.init(e,t);let n=e._zod.parse,r=nX(()=>K$(t)),i=mZ.memoizer,a=t=>{let n=r.value,a=n.symbolKeys,o=new UQ([`payload`,`ctx`],{shape:t,inst:e,memo:i,syms:a}),s=e=>`shape[${e}]._zod.run({ value: input[${e}], issues: [] }, ctx)`,c=(e,t)=>`
100
+ let ${e}_ab = false;
101
+ for (let i = 0; i < ${e}.issues.length; i++) {
102
+ const iss = ${e}.issues[i];
103
+ iss.path = iss.path ? [${t}, ...iss.path] : [${t}];
104
+ payload.issues.push(iss);
105
+ if (iss.continue !== true) ${e}_ab = true;
106
+ }
107
+ if (${e}_ab && ctx && ctx.abortEarly) {
108
+ payload.value = newResult;
109
+ return payload;
110
+ }`;o.write(`const input = payload.value;`);let l=Object.create(null),u=0;for(let e of n.allKeys)l[e]=`key_${u++}`;o.write(i?`const newResult = memo.alloc(inst, payload, {}, ctx);`:`const newResult = {};`);for(let e of n.allKeys){if(e===`__proto__`)continue;let n=l[e],r=typeof e==`symbol`?`syms[${a.indexOf(e)}]`:gX(e),i=`${r} in input`,u=t[e],d=u?._zod?.optin,f=d!==void 0,p=u?._zod?.optout===`optional`;if(o.write(`const ${n} = ${s(r)};`),f&&p){let e=d===`optional`?`${n}_present`:`${n}.value !== undefined || ${n}_present`;o.write(`
111
+ const ${n}_present = ${i};
112
+ if (!${n}.issues.length || ${n}_present) {
113
+ if (${n}.issues.length) {${c(n,r)}
114
+ }
115
+
116
+ if (${e}) {
117
+ newResult[${r}] = ${n}.value;
118
+ }
119
+ }
120
+
121
+ `)}else f?(o.write(`
122
+ if (${n}.issues.length) {${c(n,r)}
123
+ }
124
+ `),d===`defaulted`?o.write(`newResult[${r}] = ${n}.value;`):o.write(`
125
+ if (${n}.value !== undefined || ${i}) {
126
+ newResult[${r}] = ${n}.value;
127
+ }
128
+ `)):o.write(`
129
+ const ${n}_present = ${i};
130
+ if (${n}.issues.length) {${c(n,r)}
131
+ }
132
+ if (!${n}_present && !${n}.issues.length) {
133
+ payload.issues.push({
134
+ code: "invalid_type",
135
+ expected: "nonoptional",
136
+ input: undefined,
137
+ path: [${r}]
138
+ });
139
+ if (ctx && ctx.abortEarly) {
140
+ payload.value = newResult;
141
+ return payload;
142
+ }
143
+ }
144
+
145
+ if (${n}_present) {
146
+ newResult[${r}] = ${n}.value;
147
+ }
148
+
149
+ `)}return o.write(`payload.value = newResult;`),o.write(`return payload;`),o.compile()},o,s=yX,c=!mZ.jitless,l=c&&bX.value,u=t.catchall,d;e._zod.parse=(i,f)=>{d??=r.value;let p=i.value;return s(p)?c&&l&&f?.async===!1&&f.jitless!==!0?(o||=a(t.shape),i=o(i,f),u?q$([],p,i,f,d,e,f?.abortEarly===!0):i):n(i,f):(i.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),i)}});function X$(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!zX(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>UX(e,r,hZ())))}),t)}var Z$=Q(`$ZodUnion`,(e,t)=>{GQ.init(e,t),iZ(e,`optin`,e=>e.def.options.some(e=>e._zod.optin===`defaulted`)?`defaulted`:e.def.options.some(e=>e._zod.optin!==void 0)?`optional`:void 0),iZ(e,`optout`,e=>e.def.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),iZ(e,`values`,e=>{if(e.def.options.every(e=>e._zod.values))return new Set(e.def.options.flatMap(e=>Array.from(e._zod.values)))}),iZ(e,`pattern`,e=>{if(e.def.options.every(e=>e._zod.pattern)){let t=e.def.options.map(e=>e._zod.pattern);return RegExp(`^(${t.map(e=>iX(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>X$(t,r,e,i)):X$(o,r,e,i)}});function Q$(e){let t=new Map;for(let n of e.options){let r=n._zod.propValues?.[e.discriminator];if(!r||r.size===0)throw Error(`Invalid discriminated union option at index "${e.options.indexOf(n)}"`);for(let e of r)if(t.has(e)){if(e!==void 0)throw Error(`Duplicate discriminator value "${String(e)}"`);t.set(e,null)}else t.set(e,n)}return t}var $$=Q(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,Z$.init(e,t);let n=e._zod.parse;iZ(e,`propValues`,e=>{let t={},n=0;for(let r of e.def.options){let i=r._zod.propValues;if(!i||Object.keys(i).length===0)throw Error(`Invalid discriminated union option at index "${e.def.options.indexOf(r)}"`);i[e.def.discriminator]?.has(void 0)&&n++;for(let[e,n]of Object.entries(i)){Object.prototype.hasOwnProperty.call(t,e)||cX(t,e,new Set);for(let r of n)t[e].add(r)}}return!e.def.unionFallback&&n>1&&t[e.def.discriminator]?.delete(void 0),t}),t.options.forEach((e,n)=>{let r=lX(e._zod.def);if(r&&!Object.prototype.hasOwnProperty.call(r,t.discriminator))throw Error(`Invalid discriminated union option at index "${n}"`)});let r=nX(()=>Q$(t));e._zod.parse=(i,a)=>{let o=i.value;if(!yX(o))return i.issues.push({code:`invalid_type`,expected:`object`,input:o,inst:e}),i;let s=o?.[t.discriminator],c=r.value.get(s);return c&&(s!==void 0||a.direction!==`backward`)?c._zod.run(i,a):t.unionFallback||a.direction===`backward`?n(i,a):(i.issues.push({code:`invalid_union`,errors:[],note:`No matching discriminator`,discriminator:t.discriminator,options:Array.from(r.value.keys()).filter(e=>r.value.get(e)!==null),input:o,path:[t.discriminator],inst:e}),i)}}),e1=Q(`$ZodIntersection`,(e,t)=>{GQ.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>n1(e,t,n)):n1(e,i,a)}});function t1(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(xX(e)&&xX(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};Object.prototype.hasOwnProperty.call(i,`__proto__`)&&delete i.__proto__;for(let n of r){if(n===`__proto__`)continue;let r=t1(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=t1(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function n1(e,t,n){let r=new Map,i,a=new Map,o=(e,t)=>{let n;if(e.code===`unrecognized_keys`&&!e.path?.length)i??=e,n=e.keys;else if(e.code===`invalid_key`&&e.origin===`record`&&e.path?.length===1){let t=String(e.path[0]);a.has(t)||a.set(t,e),n=[t]}else return!1;for(let e of n)r.has(e)||r.set(e,{}),r.get(e)[t]=!0;return!0};for(let n of t.issues)o(n,`l`)||e.issues.push(n);for(let t of n.issues)o(t,`r`)||e.issues.push(t);let s=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(s.length){let t=i?s.filter(e=>i.keys.includes(e)):[];t.length&&e.issues.push({...i,keys:t});for(let n of s)!t.includes(n)&&a.has(n)&&e.issues.push(a.get(n))}let c=t1(t.value,n.value);if(!c.valid){if(zX(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}var r1=Q(`$ZodRecord`,(e,t)=>{GQ.init(e,t);let n=mZ.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!xX(a))return r.issues.push({expected:`record`,code:`invalid_type`,input:a,inst:e}),r;let o=[],s=t.keyType._zod.values;if(s&&!t.partial){r.value=n?n.alloc(e,r,{},i):{};let c=new Set;for(let n of s)if(typeof n==`string`||typeof n==`number`||typeof n==`symbol`){if(c.add(typeof n==`number`?n.toString():n),n===`__proto__`)continue;let s=t.keyType._zod.run({value:n,issues:[]},i);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(s.issues.length){r.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>UX(e,i,hZ())),input:n,path:[n],inst:e});continue}let l=s.value;if(l===`__proto__`)continue;let u=t.valueType._zod.run({value:a[n],issues:[]},i);u instanceof Promise?o.push(u.then(e=>{e.issues.length&&r.issues.push(...BX(n,e.issues)),r.value[l]=e.value})):(u.issues.length&&r.issues.push(...BX(n,u.issues)),r.value[l]=u.value)}let l;for(let e in a)if(!c.has(e)){if(t.mode===`loose`){if(e===`__proto__`)continue;r.value[e]=a[e]}else l??=[],l.push(e)}l&&l.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:l,continue:!0})}else{r.value=n?n.alloc(e,r,{},i):{};let c;for(let n of Reflect.ownKeys(a)){if(n===`__proto__`||!Object.prototype.propertyIsEnumerable.call(a,n))continue;let l=t.keyType._zod.run({value:n,issues:[]},i);if(l instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof n==`string`&&bQ.test(n)&&l.issues.length){let e=t.keyType._zod.run({value:Number(n),issues:[]},i);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(l=e)}if(l.issues.length){t.mode===`loose`?r.value[n]=a[n]:s?(c??=[],c.push(n)):r.issues.push({code:`invalid_key`,origin:`record`,issues:l.issues.map(e=>UX(e,i,hZ())),input:n,path:[n],inst:e});continue}let u=l.value;if(u===`__proto__`)continue;let d=t.valueType._zod.run({value:a[n],issues:[]},i);d instanceof Promise?o.push(d.then(e=>{e.issues.length&&r.issues.push(...BX(n,e.issues)),r.value[u]=e.value})):(d.issues.length&&r.issues.push(...BX(n,d.issues)),r.value[u]=d.value)}c&&c.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:c,continue:!0})}return o.length?Promise.all(o).then(()=>r):r}}),i1=Q(`$ZodEnum`,(e,t)=>{GQ.init(e,t);let n=QY(t.entries),r=new Set(n);e._zod.values=r,iZ(e,`pattern`,e=>{let t=QY(e.def.entries).filter(e=>CX.has(typeof e));return RegExp(t.length?`^(${t.map(e=>wX(e.toString())).join(`|`)})$`:`^[^\\s\\S]$`)}),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),a1=Q(`$ZodLiteral`,(e,t)=>{GQ.init(e,t);let n=new Set(t.values);e._zod.values=n,iZ(e,`pattern`,e=>{let t=e.def.values;return RegExp(t.length?`^(${t.map(e=>typeof e==`string`?wX(e):e?wX(e.toString()):String(e)).join(`|`)})$`:`^[^\\s\\S]$`)}),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),o1=Q(`$ZodTransform`,(e,t)=>{GQ.init(e,t),e._zod.optin=`optional`,mZ.memoizer?.guard(e),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new pZ(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n));if(i instanceof Promise)throw new fZ;return n.value=i,n}});function s1(e,t){return e.value=t.issues.length?void 0:t.value,e}var c1=Q(`$ZodOptional`,(e,t)=>{GQ.init(e,t),iZ(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),e._zod.optout=`optional`,iZ(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t,void 0]):void 0}),iZ(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${iX(t.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(e.value===void 0){if(t.innerType._zod.optin!==`defaulted`)return e;let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(t=>s1(e,t)):s1(e,r)}return t.innerType._zod.run(e,n)}}),l1=Q(`$ZodExactOptional`,(e,t)=>{c1.init(e,t),iZ(e,`values`,e=>e.def.innerType._zod.values),iZ(e,`pattern`,e=>e.def.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),u1=Q(`$ZodNullable`,(e,t)=>{GQ.init(e,t),iZ(e,`optin`,e=>e.def.innerType._zod.optin),iZ(e,`optout`,e=>e.def.innerType._zod.optout),iZ(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${iX(t.source)}|null)$`):void 0}),iZ(e,`values`,e=>e.def.innerType._zod.values?new Set([...e.def.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),d1=Q(`$ZodDefault`,(e,t)=>{GQ.init(e,t),e._zod.optin=`defaulted`,iZ(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>f1(e,t)):f1(r,t)}});function f1(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var p1=Q(`$ZodPrefault`,(e,t)=>{GQ.init(e,t),e._zod.optin=`defaulted`,iZ(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),m1=Q(`$ZodNonOptional`,(e,t)=>{GQ.init(e,t),iZ(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>h1(t,e)):h1(i,e)}});function h1(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}function g1(e,t,n,r){return t.issues.length?(e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map(e=>UX(e,r,hZ()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}var _1=Q(`$ZodCatch`,(e,t)=>{GQ.init(e,t),iZ(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),iZ(e,`optout`,e=>e.def.innerType._zod.optout),iZ(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(r=>g1(e,r,t,n)):g1(e,r,t,n)}}),v1=Q(`$ZodPipe`,(e,t)=>{GQ.init(e,t),iZ(e,`values`,e=>e.def.in._zod.values),iZ(e,`optin`,e=>e.def.in._zod.optin),iZ(e,`optout`,e=>e.def.out._zod.optout),iZ(e,`propValues`,e=>e.def.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>y1(e,t.in,n)):y1(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>y1(e,t.out,n)):y1(r,t.out,n)}});function y1(e,t,n){return e.issues.some(e=>e.code!==`unrecognized_keys`)?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}var b1=Q(`$ZodReadonly`,(e,t)=>{GQ.init(e,t),iZ(e,`propValues`,e=>e.def.innerType._zod.propValues),iZ(e,`values`,e=>e.def.innerType._zod.values),iZ(e,`optin`,e=>e.def.innerType?._zod?.optin),iZ(e,`optout`,e=>e.def.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(x1):x1(r)}});function x1(e){return e.memo||(e.value=Object.freeze(e.value)),e}var S1=Q(`$ZodLazy`,(e,t)=>{GQ.init(e,t),sX(e._zod,`innerType`,()=>{let e=t;return e._cachedInner||=t.getter(),e._cachedInner}),iZ(e,`pattern`,e=>e.innerType?._zod?.pattern),iZ(e,`propValues`,e=>e.innerType?._zod?.propValues),iZ(e,`optin`,e=>e.innerType?._zod?.optin??void 0),iZ(e,`optout`,e=>e.innerType?._zod?.optout??void 0),e._zod.parse=(t,n)=>e._zod.innerType._zod.run(t,n)}),C1=Q(`$ZodCustom`,(e,t)=>{TQ.init(e,t),GQ.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>w1(t,n,r,e));w1(i,n,r,e)}});function w1(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(JX(e))}}var T1=class extends Error{constructor(){super(`Cannot parse a reference cycle that closes through a transform`),this.name=`ZodCyclicError`}},E1=`~memo`,D1=[];function O1(e){return typeof e==`object`&&!!e}function k1(e){return e.map(e=>e.path?{...e,path:e.path.slice()}:{...e})}var A1=new WeakMap,j1=0,M1=1,N1=2;function P1(e,t,n){let r=A1.get(e);if(r!==void 0)return r?N1:j1;if(t.has(e))return N1;t.add(e);let i=j1,a=e=>{if(i!==N1&&e?._zod){let r=P1(e,t,n);r>i&&(i=r)}},o=(e,r)=>{let i=j1;for(let a of Reflect.ownKeys(e)){let o=Object.getOwnPropertyDescriptor(e,a);if(r&&!o.enumerable)continue;let s=o.get?M1:o.value?._zod?P1(o.value,t,n):j1;s>i&&(i=s)}return i},s=e=>{e>i&&(i=e)},c=e._zod.def;switch(c.type){case`object`:{let e=lX(c);s(e?o(e,!0):M1),a(c.catchall);break}case`array`:a(c.element);break;case`tuple`:for(let e of c.items)a(e);a(c.rest);break;case`record`:case`map`:a(c.keyType),a(c.valueType);break;case`set`:a(c.valueType);break;case`union`:for(let e of c.options)a(e);break;case`intersection`:a(c.left),a(c.right);break;case`optional`:case`nullable`:case`default`:case`prefault`:case`catch`:case`readonly`:case`nonoptional`:case`promise`:case`success`:a(c.innerType);break;case`pipe`:a(c.in),a(c.out);break;case`function`:a(c.input),a(c.output);break;case`lazy`:{let r=c._cachedInner??(n?e._zod.innerType:void 0);s(r?P1(r,t,!1):M1);break}case`template_literal`:case`string`:case`number`:case`int`:case`boolean`:case`bigint`:case`symbol`:case`undefined`:case`null`:case`void`:case`never`:case`any`:case`unknown`:case`date`:case`nan`:case`enum`:case`literal`:case`file`:case`transform`:case`custom`:break;default:for(let e in c){let t=Object.getOwnPropertyDescriptor(c,e);if(!t||t.get)continue;let n=t.value;if(n&&typeof n==`object`){if(n._zod)a(n);else if(Array.isArray(n))for(let e of n)a(e)}}}return t.delete(e),F1(e,i)}function F1(e,t){return t!==M1&&A1.set(e,t===N1),t}function I1(e,t){let n=e.buckets.get(t);return n||(n=new WeakMap,e.buckets.set(t,n)),n}var L1,R1=[],z1={alloc(e,t,n){let r=L1;if(!r)return n;L1=void 0;let i={value:n,issues:null};return r.set(t.value,i),R1.push(i),n},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,n=(e,n)=>{if(n.direction!==`backward`&&V1(n,e.value))throw new T1;return t(e,n)};e._zod.parse=n,e._zod.run===t&&(e._zod.run=n)})},attach(e){var t;let n,r=!1,i,a;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,o=(s,c)=>{if(n===void 0){let i=P1(e,new Set,!1);if(i===j1)return e._zod.parse=t,e._zod.run===o&&(e._zod.run=t),t(s,c);i===N1||r?n=!0:r=!0}let l=s.value;if(!O1(l))return t(s,c);let u=c[E1];u||(u={buckets:new WeakMap,backEdges:void 0},c[E1]=u);let d;i===c?d=a:(d=I1(u,e),i=c,a=d);let f=d.get(l);if(f)return s.value=f.value,f.issues?f.issues.length&&s.issues.push(...k1(f.issues)):(s.memo=!0,u.backEdges??(u.backEdges=new WeakSet),u.backEdges.add(f.value)),s;L1=d;let p=R1.length,m=t(s,c);L1=void 0;let h=R1.length>p?R1.pop():void 0;return m instanceof Promise?m.then(e=>(h&&(h.issues=e.issues.length?k1(e.issues):D1),e)):(h&&(h.issues=m.issues.length?k1(m.issues):D1),m)};e._zod.parse=o,e._zod.run===t&&(e._zod.run=o)})}};function B1(){return z1}function V1(e,t){let n=e[E1]?.backEdges;return n!==void 0&&O1(t)&&n.has(t)}var H1=()=>{let e={string:{unit:`characters`,verb:`to have`},file:{unit:`bytes`,verb:`to have`},array:{unit:`items`,verb:`to have`},set:{unit:`items`,verb:`to have`},map:{unit:`entries`,verb:`to have`}};function t(t){return e[t]??null}let n={regex:`input`,email:`email address`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO datetime`,date:`ISO date`,time:`ISO time`,duration:`ISO duration`,ipv4:`IPv4 address`,ipv6:`IPv6 address`,mac:`MAC address`,cidrv4:`IPv4 range`,cidrv6:`IPv6 range`,base64:`base64-encoded string`,base64url:`base64url-encoded string`,json_string:`JSON string`,e164:`E.164 number`,currency_code:`currency code`,credit_card:`credit card number`,iban:`IBAN`,jwt:`JWT`,template_literal:`input`},r={nan:`NaN`};function i(e,t){return e===`number`&&typeof t==`number`&&!Number.isFinite(t)?String(t):r[e]??e}return e=>{switch(e.code){case`invalid_type`:return`Invalid input: expected ${i(e.expected)}, received ${i(qX(e.input),e.input)}`;case`invalid_value`:return e.values.length===1?`Invalid input: expected ${EX(e.values[0])}`:`Invalid option: expected one of ${$Y(e.values,`|`)}`;case`too_big`:{let n=e.exact?`exactly `:e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Too big: expected ${e.origin??`value`} to have ${n}${e.maximum.toString()} ${r.unit??`elements`}`:`Too big: expected ${e.origin??`value`} to be ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.exact?`exactly `:e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Too small: expected ${e.origin} to have ${n}${e.minimum.toString()} ${r.unit}`:`Too small: expected ${e.origin} to be ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Invalid string: must start with "${t.prefix}"`:t.format===`ends_with`?`Invalid string: must end with "${t.suffix}"`:t.format===`includes`?`Invalid string: must include "${t.includes}"`:t.format===`regex`?`Invalid string: must match pattern ${t.pattern}`:`Invalid ${n[t.format]??e.format}`}case`not_multiple_of`:return`Invalid number: must be a multiple of ${e.divisor}`;case`unrecognized_keys`:return`Unrecognized key${e.keys.length>1?`s`:``}: ${$Y(e.keys,`, `)}`;case`invalid_key`:return`Invalid key in ${e.origin}`;case`invalid_union`:return e.options&&Array.isArray(e.options)&&e.options.length>0?`Invalid discriminator value. Expected ${e.options.map(e=>`'${e}'`).join(` | `)}`:e.inclusive===!1?`Invalid input: more than one option matched`:`Invalid input`;case`invalid_element`:return`Invalid value in ${e.origin}`;default:return`Invalid input`}}};function U1(){return{localeError:H1()}}var W1,G1=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function K1(){return new G1}(W1=globalThis).__zod_globalRegistry??(W1.__zod_globalRegistry=K1());var q1=globalThis.__zod_globalRegistry;function J1(e){return e.checks&&=[...e.checks],e}function Y1(e,t){return new e(J1({type:`string`,...Z(t)}))}function X1(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...Z(t)})}function Z1(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...Z(t)})}function Q1(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...Z(t)})}function $1(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...Z(t)})}function e0(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...Z(t)})}function t0(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...Z(t)})}function n0(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...Z(t)})}function r0(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...Z(t)})}function i0(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...Z(t)})}function a0(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...Z(t)})}function o0(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...Z(t)})}function s0(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...Z(t)})}function c0(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...Z(t)})}function l0(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...Z(t)})}function u0(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...Z(t)})}function d0(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...Z(t)})}function f0(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...Z(t)})}function p0(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...Z(t)})}function m0(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...Z(t)})}function h0(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...Z(t)})}function g0(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...Z(t)})}function _0(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...Z(t)})}function v0(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...Z(t)})}function y0(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...Z(t)})}function b0(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...Z(t)})}function x0(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...Z(t)})}function S0(e,t){return new e(J1({type:`number`,checks:[],...Z(t)}))}function C0(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...Z(t)})}function w0(e,t){return new e({type:`boolean`,...Z(t)})}function T0(e,t){return new e({type:`null`,...Z(t)})}function E0(e){return new e({type:`any`})}function D0(e){return new e({type:`unknown`})}function O0(e,t){return new e({type:`never`,...Z(t)})}function k0(e,t){return new OQ({check:`less_than`,...Z(t),value:e,inclusive:!1})}function A0(e,t){return new OQ({check:`less_than`,...Z(t),value:e,inclusive:!0})}function j0(e,t){return new kQ({check:`greater_than`,...Z(t),value:e,inclusive:!1})}function M0(e,t){return new kQ({check:`greater_than`,...Z(t),value:e,inclusive:!0})}function N0(e,t){return new AQ({check:`multiple_of`,...Z(t),value:e})}function P0(e,t){return new MQ({check:`max_length`,...Z(t),maximum:e})}function F0(e,t){return new NQ({check:`min_length`,...Z(t),minimum:e})}function I0(e,t){return new PQ({check:`length_equals`,...Z(t),length:e})}function L0(e,t){return new IQ({check:`string_format`,format:`regex`,...Z(t),pattern:e})}function R0(e){return new LQ({check:`string_format`,format:`lowercase`,...Z(e)})}function z0(e){return new RQ({check:`string_format`,format:`uppercase`,...Z(e)})}function B0(e,t){return new zQ({check:`string_format`,format:`includes`,...Z(t),includes:e})}function V0(e,t){return new BQ({check:`string_format`,format:`starts_with`,...Z(t),prefix:e})}function H0(e,t){return new VQ({check:`string_format`,format:`ends_with`,...Z(t),suffix:e})}function U0(e){return new HQ({check:`overwrite`,tx:e})}function W0(e){return U0(t=>t.normalize(e))}function G0(){return U0(e=>e.trim())}function K0(){return U0(e=>e.toLowerCase())}function q0(){return U0(e=>e.toUpperCase())}function J0(){return U0(e=>_X(e))}function Y0(e,t,n){return new e({type:`array`,element:t,...Z(n)})}function X0(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...Z(n)})}function Z0(e,t){let n=Q0(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(JX(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,`input`in r||(r.input=t.value),r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(JX(r))}},e(t.value,t)),t);return n}function Q0(e,t){let n=new TQ({check:`custom`,...Z(t)});return n._zod.check=e,n}function $0(e,...t){for(let n of t)for(let t of Reflect.ownKeys(n))Object.prototype.propertyIsEnumerable.call(n,t)&&cX(e,t,n[t]);return e}function e2(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??q1,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,intersections:[],deferred:[],external:e?.external??void 0}}function t2(e,t,n,r,i){let a=typeof t.unrepresentable==`function`?t.unrepresentable({zodSchema:e,path:r.path,message:i}):t.unrepresentable;if(a===`any`)return!1;if(a===void 0||a===`throw`)throw Error(i);return Object.assign(n,a),!0}function n2(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,n2(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&$0(o.schema,c),t.io===`input`&&f2(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&`_prefault`in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function r2(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}function i2(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);if(e.external&&e.sharedDefsExtractedFor===e.external)return;let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${r2(a)}`}}let i=`#/${r}/`;if(t[1]===n&&!t[1].schema.id)return{ref:`#`};let a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+r2(a)}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
150
+
151
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}r.count>1&&e.reused===`ref`&&a(n)}e.external&&(e.sharedDefsExtractedFor=e.external)}function a2(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let e of t){if(!e||typeof e!=`object`)return;a2(e);let t=Object.keys(e);if(t.length!==1||t[0]!==`type`)return;let r=e.type;for(let e of Array.isArray(r)?r:[r]){if(typeof e!=`string`)return;n.includes(e)||n.push(e)}}delete e.anyOf,e.type=n.length===1?n[0]:n}var o2=new Set([`type`,`properties`,`required`,`additionalProperties`]),s2=[`oneOf`,`anyOf`];function c2(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!=`object`||!t?null:Object.keys(t).length?t:null}function l2(e){let t=[];for(let n of e){if(typeof n!=`object`||n.type!==`object`)return null;for(let e in n)if(!o2.has(e))return null;t.push(n)}let n={},r=new Set;for(let e of t){for(let r in e.properties){if(Object.prototype.hasOwnProperty.call(n,r))continue;let e=[];for(let n of t){let t=n.properties?.[r]??c2(n);t!=null&&(e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t))}cX(n,r,e.length===1?e[0]:l2(e)??{allOf:e})}for(let t of e.required??[])r.add(t)}let i={type:`object`,properties:n};if(r.size&&(i.required=[...r]),t.every(e=>e.additionalProperties===!1))i.additionalProperties=!1;else{let e=[];for(let n of t){let t=c2(n);t&&!e.some(e=>JSON.stringify(e)===JSON.stringify(t))&&e.push(t)}e.length===1?i.additionalProperties=e[0]:e.length>1&&(i.additionalProperties={allOf:e})}return i}function u2(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let t of o2)if(t in e)return;let n=t.filter(e=>s2.some(t=>Array.isArray(e[t]))),r=null;if(!n.length)r=l2(t);else{let e=n[0],i=s2.find(t=>Array.isArray(e[t]));if(Object.keys(e).length!==1)return;let a=t.filter(t=>t!==e),o=e[i].map(e=>l2([...a,e]));if(o.some(e=>!e))return;r={[i]:o}}r&&(delete e.allOf,$0(e,r))}function d2(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):$0(i,s),$0(i,a),t._zod.parent===o)for(let e in i)e!==`$ref`&&e!==`allOf`&&(e in a||delete i[e]);if(s.$ref&&n.def)for(let e in i)e!==`$ref`&&e!==`allOf`&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e!==`$ref`&&e!==`allOf`&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let t of[...e.seen.entries()].reverse())r(t[0]);if(e.target!==`openapi-3.0`)for(let t of e.seen.entries())a2(t[1].def??t[1].schema);for(let t of e.deferred)t();if(e.intersections.length){let t=new Map;for(let n of e.seen.values())for(let e of[n.schema,n.def]){let n=e?.allOf;if(!Array.isArray(n))continue;let r=t.get(n);r?r.push(e):t.set(n,[e])}for(let n of e.intersections)for(let e of t.get(n)??[])u2(e)}}let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}$0(i,n.defId?n.schema:n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,cX(o,e.defId,e.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:m2(t,`input`,e.processors),output:m2(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function f2(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return f2(r.element,n);if(r.type===`set`)return f2(r.valueType,n);if(r.type===`lazy`)return f2(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`||r.type===`catch`)return f2(r.innerType,n);if(r.type===`intersection`)return f2(r.left,n)||f2(r.right,n);if(r.type===`record`||r.type===`map`)return f2(r.keyType,n)||f2(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:f2(r.in,n)||f2(r.out,n);if(r.type===`object`){for(let e in r.shape)if(f2(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(f2(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(f2(e,n))return!0;return!!(r.rest&&f2(r.rest,n))}return!1}var p2=(e,t={})=>n=>{let r=e2({...n,processors:t});return n2(e,r),i2(r,e),d2(r,e)},m2=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=e2({...i??{},target:a,io:t,processors:n});return n2(e,o),i2(o,e),d2(o,e)},h2=(e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},g2=(e,t,n)=>{(e[t]===void 0||n<e[t])&&(e[t]=n)},_2=(e,t)=>{h2(e,`minimum`,t),g2(e,`maximum`,t)},v2=(e,t)=>{e.multipleOf??=[],e.multipleOf.includes(t)||e.multipleOf.push(t)},y2=(e,t)=>{e.patterns??=new Set,e.patterns.add(t)},b2=(e,t)=>{e.mime=e.mime?e.mime.filter(e=>t.includes(e)):[...t]},x2=(e,t)=>{e.format=t,t.includes(`int`)&&(e.isInt=!0)},S2=(e,t)=>h2(e,`minimum`,t.minimum),C2=(e,t)=>g2(e,`maximum`,t.maximum),w2=e=>(t,n)=>{x2(t,n.format);let[r,i]=e[n.format];h2(t,`minimum`,r),g2(t,`maximum`,i)},T2={greater_than:(e,t)=>h2(e,t.inclusive?`minimum`:`exclusiveMinimum`,t.value),less_than:(e,t)=>g2(e,t.inclusive?`maximum`:`exclusiveMaximum`,t.value),multiple_of:(e,t)=>v2(e,t.value),number_format:w2(OX),bigint_format:w2(kX),min_length:S2,max_length:C2,length_equals:(e,t)=>_2(e,t.length),min_size:S2,max_size:C2,size_equals:(e,t)=>_2(e,t.size),string_format:(e,t)=>{x2(e,t.format),t.pattern&&y2(e,t.pattern),(t.format===`base64`||t.format===`base64url`)&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>b2(e,t.mime)};function E2(e){let t={},n=e._zod.def,r=e._zod.traits.has(`$ZodCheck`)?[e,...n.checks??[]]:n.checks??[];for(let e of r)T2[e._zod.def.check]?.(t,e._zod.def);let i=e._zod.bag;i.minimum!==void 0&&h2(t,`minimum`,i.minimum),i.exclusiveMinimum!==void 0&&h2(t,`exclusiveMinimum`,i.exclusiveMinimum),i.maximum!==void 0&&g2(t,`maximum`,i.maximum),i.exclusiveMaximum!==void 0&&g2(t,`exclusiveMaximum`,i.exclusiveMaximum),i.multipleOf!==void 0&&v2(t,i.multipleOf),i.format!==void 0&&(t.format??=i.format,i.format.includes(`int`)&&(t.isInt=!0)),i.mime&&b2(t,i.mime);for(let e of i.patterns??[])y2(t,e);return t}var D2={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},O2=new Map([[D$,cQ],[k$,lQ]]),k2=e=>O2.get(e)??e,A2=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l,laxFormat:u}=E2(e);if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=D2[s]??s,i.format===``&&delete i.format,(s===`time`||u)&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c].map(k2);e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},j2=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,multipleOf:s,exclusiveMaximum:c,exclusiveMinimum:l,isInt:u}=E2(e);i.type=u?`integer`:`number`;let d=typeof l==`number`&&l>=(a??-1/0),f=typeof c==`number`&&c<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;if(d?p?(i.minimum=l,i.exclusiveMinimum=!0):i.exclusiveMinimum=l:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=c,i.exclusiveMaximum=!0):i.exclusiveMaximum=c:typeof o==`number`&&(i.maximum=o),s){let n=new Set;for(let a of s)Number.isFinite(a)&&a!==0?n.add(Math.abs(a)):t2(e,t,i,r,`A multipleOf divisor of ${a} cannot be represented in JSON Schema`);let[a,...o]=n;a!==void 0&&(i.multipleOf=a),o.length&&(i.allOf=[...i.allOf??[],...o.map(e=>({multipleOf:e}))])}},M2=(e,t,n,r)=>{n.type=`boolean`},N2=(e,t,n,r)=>{t2(e,t,n,r,`BigInt cannot be represented in JSON Schema`)},P2=(e,t,n,r)=>{t2(e,t,n,r,`Symbols cannot be represented in JSON Schema`)},F2=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},I2=(e,t,n,r)=>{t2(e,t,n,r,`Undefined cannot be represented in JSON Schema`)},L2=(e,t,n,r)=>{t2(e,t,n,r,`Void cannot be represented in JSON Schema`)},R2=(e,t,n,r)=>{n.not={}},z2=(e,t,n,r)=>{},B2=(e,t,n,r)=>{},V2=(e,t,n,r)=>{t2(e,t,n,r,`Date cannot be represented in JSON Schema`)},H2=(e,t,n,r)=>{let i=e._zod.def,a=QY(i.entries);if(a.length===0){n.not={};return}a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},U2=(e,t,n,r)=>{let i=e._zod.def;if(i.values.length===0){n.not={};return}let a=[];for(let o of i.values)if(o===void 0){if(t2(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof o==`bigint`){if(t2(e,t,n,r,`BigInt literals cannot be represented in JSON Schema`))return;a.push(Number(o))}else a.push(o);if(a.length!==0){if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a}},W2=(e,t,n,r)=>{t2(e,t,n,r,`NaN cannot be represented in JSON Schema`)},G2=(e,t,n,r)=>{let i=n,a=e._zod.pattern;if(!a)throw Error(`Pattern not found in template literal`);i.type=`string`,i.pattern=a.source},K2=(e,t,n,r)=>{let i=n;i.type=`string`,i.format=`binary`,i.contentEncoding=`binary`;let{minimum:a,maximum:o,mime:s}=E2(e);a!==void 0&&(i.minLength=a),o!==void 0&&(i.maxLength=o),s&&(s.length===0?i.not={}:s.length===1?i.contentMediaType=s[0]:i.anyOf=s.map(e=>({contentMediaType:e})))},q2=(e,t,n,r)=>{n.type=`boolean`},J2=(e,t,n,r)=>{t2(e,t,n,r,`Custom types cannot be represented in JSON Schema`)},Y2=(e,t,n,r)=>{t2(e,t,n,r,`Function types cannot be represented in JSON Schema`)},X2=(e,t,n,r)=>{t2(e,t,n,r,`Transforms cannot be represented in JSON Schema`)},Z2=(e,t,n,r)=>{t2(e,t,n,r,`Map cannot be represented in JSON Schema`)},Q2=(e,t,n,r)=>{t2(e,t,n,r,`Set cannot be represented in JSON Schema`)},$2=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=E2(e);typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=n2(a.element,t,{...r,path:[...r.path,`items`]})};function e4(e){let t=e._zod.def;return t.type===`pipe`&&t.in._zod.traits.has(`$ZodTransform`)?e4(t.out):t.type===`catch`?e4(t.innerType):e._zod.optin}var t4=(e,t,n,r)=>{let i=n,a=e._zod.def,o=a.shape;if(Object.getOwnPropertySymbols(o).length&&t2(e,t,i,r,`Symbol keys cannot be represented in JSON Schema`))return;i.type=`object`,i.properties={};for(let e in o)cX(i.properties,e,n2(o[e],t,{...r,path:[...r.path,`properties`,e]}));let s=[];for(let e of Object.keys(o)){let n=a.shape[e];(t.io===`input`?e4(n)===void 0:n._zod.optout===void 0)&&s.push(e)}s.length>0&&(i.required=s),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=n2(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},n4=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>n2(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},r4=(e,t,n,r)=>{let i=e._zod.def,a=n2(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=n2(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1,c=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]];n.allOf=c,t.intersections.push(c)},i4=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`array`;let o=t.target===`draft-2020-12`?`prefixItems`:`items`,s=t.target===`draft-2020-12`||t.target===`openapi-3.0`?`items`:`additionalItems`,c=a.items.map((e,n)=>n2(e,t,{...r,path:[...r.path,o,n]})),l=a.rest?n2(a.rest,t,{...r,path:[...r.path,s,...t.target===`openapi-3.0`?[a.items.length]:[]]}):null,u=a.items.length;for(;u>0;){let e=a.items[u-1];if(!(t.io===`input`?e4(e)!==void 0:e._zod.optout===`optional`))break;u--}let d=a.items.length,f=!a.rest;t.target===`draft-2020-12`?(i.prefixItems=c,f?i.items=!1:l&&(i.items=l),u>0&&(i.minItems=u),f&&(i.maxItems=d)):t.target===`openapi-3.0`?(i.items={anyOf:c},l&&i.items.anyOf.push(l),u>0&&(i.minItems=u),f&&(i.maxItems=d)):(i.items=c,f?i.additionalItems=!1:l&&(i.additionalItems=l),u>0&&(i.minItems=u),f&&(i.maxItems=d));let{minimum:p,maximum:m}=E2(e);typeof p==`number`&&(i.minItems=p),typeof m==`number`&&(i.maxItems=m)};function a4(e,t,n){if(t.$ref){if(n.has(t))return t;n.add(t);let r=e.get(t)?.def;if(!r)return t;let i=a4(e,r,n);return i===r?t:i}for(let r of[`anyOf`,`oneOf`]){let i=t[r];if(!Array.isArray(i))continue;let a=i.map(t=>a4(e,t,n));a.some((e,t)=>e!==i[t])&&(t={...t,[r]:a})}let r=Array.isArray(t.type)?t.type:[t.type],i=!r.includes(`string`)&&r.some(e=>e===`number`||e===`integer`),a=t.enum??(t.const===void 0?void 0:[t.const]);if(!i&&!a?.some(e=>typeof e==`number`))return t;let{minimum:o,maximum:s,exclusiveMinimum:c,exclusiveMaximum:l,multipleOf:u,format:d,id:f,...p}=t;return p.enum?p.enum=p.enum.map(e=>typeof e==`number`?String(e):e):typeof p.const==`number`&&(p.const=String(p.const)),i?(p.type=`string`,a||(p.pattern=(r.includes(`number`)?bQ:yQ).source),p):p}var o4=new WeakMap;function s4(e){let t=new Map;for(let n of e.seen.values())n.def&&!t.has(n.schema)&&t.set(n.schema,n);let n=new Map;for(let r of o4.get(e)??[]){let i=e.seen.get(r),a=(i?.def??i?.schema)?.propertyNames;if(!a||a===!0||n.has(a))continue;let o=a4(t,a,new Set);o!==a&&n.set(a,o)}if(n.size)for(let t of e.seen.values())for(let e of[t.schema,t.def]){let t=e&&n.get(e.propertyNames);t&&(e.propertyNames=t)}}var c4=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=E2(o).patterns;if(a.mode===`loose`&&s&&s.size>0){let e=n2(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)cX(i.patternProperties,k2(t).source,e)}else{if(t.target===`draft-07`||t.target===`draft-2020-12`){i.propertyNames=n2(a.keyType,t,{...r,path:[...r.path,`propertyNames`]});let n=o4.get(t);n||(n=[],o4.set(t,n),t.deferred.push(()=>s4(t))),n.push(e)}i.additionalProperties=n2(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]})}let c=o._zod.values,l=t.io===`input`&&e4(a.valueType)!==void 0;if(c&&!a.partial&&!l){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e.map(String))}},l4=(e,t,n,r)=>{let i=e._zod.def,a=n2(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},u4=(e,t,n,r)=>{let i=e._zod.def;n2(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},d4=Symbol();function f4(e,t,n,r,i){let a=!1,o=JSON.stringify(e,(e,t)=>typeof t==`bigint`?(a=!0,null):t);return a?(t2(t,n,r,i,`BigInt defaults cannot be represented in JSON Schema`),d4):JSON.parse(o)}var p4=(e,t,n,r)=>{let i=e._zod.def;n2(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o=f4(i.defaultValue,e,t,n,r);o!==d4&&(n.default=o)},m4=(e,t,n,r)=>{let i=e._zod.def;n2(i.innerType,t,r);let a=t.seen.get(e);if(a.ref=i.innerType,t.io!==`input`)return;let o=f4(i.defaultValue,e,t,n,r);o!==d4&&(n._prefault=o)},h4=(e,t,n,r)=>{let i=e._zod.def;n2(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{t2(e,t,n,r,`Dynamic catch values are not supported in JSON Schema`);return}n.default=o},g4=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;n2(o,t,r);let s=t.seen.get(e);s.ref=o},_4=(e,t,n,r)=>{let i=e._zod.def;n2(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},v4=(e,t,n,r)=>{let i=e._zod.def;n2(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},y4=(e,t,n,r)=>{let i=e._zod.def;n2(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},b4=(e,t,n,r)=>{let i=e._zod.innerType;n2(i,t,r);let a=t.seen.get(e);a.ref=i},x4={string:A2,number:j2,boolean:M2,bigint:N2,symbol:P2,null:F2,undefined:I2,void:L2,never:R2,any:z2,unknown:B2,date:V2,enum:H2,literal:U2,nan:W2,template_literal:G2,file:K2,success:q2,custom:J2,function:Y2,transform:X2,map:Z2,set:Q2,array:$2,object:t4,union:n4,intersection:r4,tuple:i4,record:c4,nullable:l4,nonoptional:u4,default:p4,prefault:m4,catch:h4,pipe:g4,readonly:_4,promise:v4,optional:y4,lazy:b4};function S4(e,t){if(`_idmap`in e){let n=e,r=e2({...t,processors:x4}),i={};for(let e of n._idmap.entries()){let[t,n]=e;n2(n,r)}let a={};r.external={registry:n,uri:t?.uri,defs:i};for(let e of n._idmap.entries()){let[t,n]=e;i2(r,n),cX(a,t,d2(r,n))}return Object.keys(i).length>0&&(a.__shared={[r.target===`draft-2020-12`?`$defs`:`definitions`]:i}),{schemas:a}}let n=e2({...t,processors:x4});return n2(e,n),i2(n,e),d2(n,e)}var C4=new WeakSet([Object.prototype,Error.prototype]);function w4(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let e=n(this);return Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0})}})}var T4=Q(`ZodError`,(e,t)=>{SZ.init(e,t),e.name=`ZodError`;let n=Object.getPrototypeOf(e);C4.has(n)||(C4.add(n),w4(n,`format`,e=>t=>TZ(e,t)),w4(n,`flatten`,e=>t=>wZ(e,t)),w4(n,`addIssue`,e=>t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,eX,2)}),w4(n,`addIssues`,e=>t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,eX,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},void 0,{Parent:Error}),E4=DZ(T4),D4=OZ(T4),O4=kZ(T4),k4=jZ(T4),A4=LZ(T4),j4=RZ(T4),M4=zZ(T4),N4=BZ(T4),P4=VZ(T4),F4=HZ(T4),I4=UZ(T4),L4=WZ(T4);function R4(){mZ.localeError||hZ(U1())}function z4(){mZ.memoizer||hZ({memoizer:B1()})}var B4=Q(`ZodType`,(e,t)=>(R4(),GQ.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(hX(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return TX(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(p6(e,t))},superRefine(e,t){return this.check(m6(e,t))},overwrite(e){return this.check(U0(e))},optional(){return q3(this)},exactOptional(){return Y3(this)},nullable(){return Z3(this)},nullish(){return q3(Z3(this))},nonoptional(e){return r6(this,e)},array(){return k3(this)},or(e){return N3([this,e])},and(e){return L3(this,e)},transform(e){return s6(this,G3(e))},default(e){return $3(this,e)},prefault(e){return t6(this,e)},catch(e){return a6(this,e)},pipe(e){return s6(this,e)},readonly(){return l6(this)},describe(e){let t=this.clone();return q1.add(t,{description:e}),t},meta(...e){if(e.length===0)return q1.get(this);let t=this.clone();return q1.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return ZX(this,`~standard`,{...JQ(this),jsonSchema:{input:m2(this,`input`),output:m2(this,`output`)}})},set"~standard"(e){XX(this,`~standard`,e)},parse:function e(t,n){return E4(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await D4(this,t,n,{callee:e})},safeParse(e,t){return O4(this,e,t)},async safeParseAsync(e,t){return k4(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){XX(this,`spa`,e)},validate(e,t){return PZ(this,e,t)},validateAsync(e,t){return IZ(this,e,t)},encode:function e(t,n){return A4(this,t,n,{callee:e})},decode:function e(t,n){return j4(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await M4(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await N4(this,t,n,{callee:e})},safeEncode(e,t){return P4(this,e,t)},safeDecode(e,t){return F4(this,e,t)},async safeEncodeAsync(e,t){return I4(this,e,t)},async safeDecodeAsync(e,t){return L4(this,e,t)},toJSONSchema(e){return p2(this,{})(e)},get description(){return q1.get(this)?.description},get _def(){return this._zod.def}}),V4=Q(`_ZodString`,(e,t)=>{YQ.init(e,t),B4.init(e,t),e._zod.processJSONSchema=(t,n,r)=>A2(e,t,n,r)},QX({format:e=>E2(e).format??null,minLength:e=>E2(e).minimum??null,maxLength:e=>E2(e).maximum??null},{regex(...e){return this.check(L0(...e))},includes(...e){return this.check(B0(...e))},startsWith(...e){return this.check(V0(...e))},endsWith(...e){return this.check(H0(...e))},min(...e){return this.check(F0(...e))},max(...e){return this.check(P0(...e))},length(...e){return this.check(I0(...e))},nonempty(...e){return this.check(F0(1,...e))},lowercase(e){return this.check(R0(e))},uppercase(e){return this.check(z0(e))},trim(){return this.check(G0())},normalize(...e){return this.check(W0(...e))},toLowerCase(){return this.check(K0())},toUpperCase(){return this.check(q0())},slugify(){return this.check(J0())}})),H4=Q(`ZodString`,(e,t)=>{YQ.init(e,t),V4.init(e,t)},{email(e){return this.check(X1(Y4,e))},url(e){return this.check(n0(Q4,e))},jwt(e){return this.check(_0(p3,e))},emoji(e){return this.check(r0($4,e))},guid(e){return this.check(Z1(X4,e))},uuid(e){return this.check(Q1(Z4,e))},uuidv4(e){return this.check($1(Z4,e))},uuidv6(e){return this.check(e0(Z4,e))},uuidv7(e){return this.check(t0(Z4,e))},nanoid(e){return this.check(i0(e3,e))},cuid(e){return this.check(a0(t3,e))},cuid2(e){return this.check(o0(n3,e))},ulid(e){return this.check(s0(r3,e))},base64(e){return this.check(m0(u3,e))},base64url(e){return this.check(h0(d3,e))},xid(e){return this.check(c0(i3,e))},ksuid(e){return this.check(l0(a3,e))},ipv4(e){return this.check(u0(o3,e))},ipv6(e){return this.check(d0(s3,e))},cidrv4(e){return this.check(f0(c3,e))},cidrv6(e){return this.check(p0(l3,e))},e164(e){return this.check(g0(f3,e))},datetime(e){return this.check(v0(G4,e))},date(e){return this.check(y0(K4,e))},time(e){return this.check(b0(q4,e))},duration(e){return this.check(x0(J4,e))}});function U4(e){return Y1(H4,e)}var W4=Q(`ZodStringFormat`,(e,t)=>{XQ.init(e,t),V4.init(e,t)}),G4=Q(`ZodISODateTime`,(e,t)=>{h$.init(e,t),W4.init(e,t)}),K4=Q(`ZodISODate`,(e,t)=>{g$.init(e,t),W4.init(e,t)}),q4=Q(`ZodISOTime`,(e,t)=>{_$.init(e,t),W4.init(e,t)}),J4=Q(`ZodISODuration`,(e,t)=>{v$.init(e,t),W4.init(e,t)}),Y4=Q(`ZodEmail`,(e,t)=>{$Q.init(e,t),W4.init(e,t)}),X4=Q(`ZodGUID`,(e,t)=>{ZQ.init(e,t),W4.init(e,t)}),Z4=Q(`ZodUUID`,(e,t)=>{QQ.init(e,t),W4.init(e,t)}),Q4=Q(`ZodURL`,(e,t)=>{s$.init(e,t),W4.init(e,t)}),$4=Q(`ZodEmoji`,(e,t)=>{c$.init(e,t),W4.init(e,t)}),e3=Q(`ZodNanoID`,(e,t)=>{l$.init(e,t),W4.init(e,t)}),t3=Q(`ZodCUID`,(e,t)=>{u$.init(e,t),W4.init(e,t)}),n3=Q(`ZodCUID2`,(e,t)=>{d$.init(e,t),W4.init(e,t)}),r3=Q(`ZodULID`,(e,t)=>{f$.init(e,t),W4.init(e,t)}),i3=Q(`ZodXID`,(e,t)=>{p$.init(e,t),W4.init(e,t)}),a3=Q(`ZodKSUID`,(e,t)=>{m$.init(e,t),W4.init(e,t)}),o3=Q(`ZodIPv4`,(e,t)=>{y$.init(e,t),W4.init(e,t)}),s3=Q(`ZodIPv6`,(e,t)=>{S$.init(e,t),W4.init(e,t)}),c3=Q(`ZodCIDRv4`,(e,t)=>{C$.init(e,t),W4.init(e,t)}),l3=Q(`ZodCIDRv6`,(e,t)=>{T$.init(e,t),W4.init(e,t)}),u3=Q(`ZodBase64`,(e,t)=>{O$.init(e,t),W4.init(e,t)}),d3=Q(`ZodBase64URL`,(e,t)=>{j$.init(e,t),W4.init(e,t)}),f3=Q(`ZodE164`,(e,t)=>{M$.init(e,t),W4.init(e,t)}),p3=Q(`ZodJWT`,(e,t)=>{P$.init(e,t),W4.init(e,t)}),m3=Q(`ZodNumber`,(e,t)=>{F$.init(e,t),B4.init(e,t),e._zod.processJSONSchema=(t,n,r)=>j2(e,t,n,r),e.isFinite=!0},QX({minValue:e=>{let{minimum:t,exclusiveMinimum:n}=E2(e);return Math.max(t??-1/0,n??-1/0)},maxValue:e=>{let{maximum:t,exclusiveMaximum:n}=E2(e);return Math.min(t??1/0,n??1/0)},isInt:e=>{let{isInt:t,multipleOf:n}=E2(e);return!!t||!!n?.some(Number.isSafeInteger)},format:e=>E2(e).format??null},{gt(e,t){return this.check(j0(e,t))},gte(e,t){return this.check(M0(e,t))},min(e,t){return this.check(M0(e,t))},lt(e,t){return this.check(k0(e,t))},lte(e,t){return this.check(A0(e,t))},max(e,t){return this.check(A0(e,t))},int(e){return this.check(_3(e))},safe(e){return this.check(_3(e))},positive(e){return this.check(j0(0,e))},nonnegative(e){return this.check(M0(0,e))},negative(e){return this.check(k0(0,e))},nonpositive(e){return this.check(A0(0,e))},multipleOf(e,t){return this.check(N0(e,t))},step(e,t){return this.check(N0(e,t))},finite(){return this}}));function h3(e){return S0(m3,e)}var g3=Q(`ZodNumberFormat`,(e,t)=>{I$.init(e,t),m3.init(e,t)});function _3(e){return C0(g3,e)}var v3=Q(`ZodBoolean`,(e,t)=>{L$.init(e,t),B4.init(e,t),e._zod.processJSONSchema=(t,n,r)=>M2(e,t,n,r)});function y3(e){return w0(v3,e)}var b3=Q(`ZodNull`,(e,t)=>{R$.init(e,t),B4.init(e,t),e._zod.processJSONSchema=(t,n,r)=>F2(e,t,n,r)});function x3(e){return T0(b3,e)}var S3=Q(`ZodAny`,(e,t)=>{z$.init(e,t),B4.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function C3(){return E0(S3)}var w3=Q(`ZodUnknown`,(e,t)=>{B$.init(e,t),B4.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function T3(){return D0(w3)}var E3=Q(`ZodNever`,(e,t)=>{V$.init(e,t),B4.init(e,t),e._zod.processJSONSchema=(t,n,r)=>R2(e,t,n,r)});function D3(e){return O0(E3,e)}var O3=Q(`ZodArray`,(e,t)=>{z4(),U$.init(e,t),B4.init(e,t),e._zod.processJSONSchema=(t,n,r)=>$2(e,t,n,r),e.element=t.element},{min(e,t){return this.check(F0(e,t))},nonempty(e){return this.check(F0(1,e))},max(e,t){return this.check(P0(e,t))},length(e,t){return this.check(I0(e,t))},unwrap(){return this.element}});function k3(e,t){return Y0(O3,e,t)}var A3=Q(`ZodObject`,(e,t)=>{z4(),Y$.init(e,t),B4.init(e,t),e._zod.processJSONSchema=(t,n,r)=>t4(e,t,n,r),aZ(e,`shape`,e=>e._zod.def.shape,!1)},{keyof(){return V3(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(hX(this._zod.def,{catchall:e}))},passthrough(){return this.clone(hX(this._zod.def,{catchall:T3()}))},loose(){return this.clone(hX(this._zod.def,{catchall:T3()}))},strict(){return this.clone(hX(this._zod.def,{catchall:D3()}))},strip(){return this.clone(hX(this._zod.def,{catchall:void 0}))},extend(e){return NX(this,e)},safeExtend(e){return FX(this,e)},merge(e){return IX(this,e)},pick(e){return AX(this,e)},omit(e){return MX(this,e)},partial(...e){return LX(K3,this,e[0])},exactPartial(...e){return LX(J3,this,e[0],`exactPartial`)},required(...e){return RX(n6,this,e[0])}});function j3(e,t){return new A3({type:`object`,shape:e??{},...Z(t)})}var M3=Q(`ZodUnion`,(e,t)=>{Z$.init(e,t),B4.init(e,t),e._zod.processJSONSchema=(t,n,r)=>n4(e,t,n,r),e.options=t.options});function N3(e,t){return new M3({type:`union`,options:e,...Z(t)})}var P3=Q(`ZodDiscriminatedUnion`,(e,t)=>{M3.init(e,t),$$.init(e,t)});function F3(e,t,n){return new P3({type:`union`,options:t,discriminator:e,...Z(n)})}var I3=Q(`ZodIntersection`,(e,t)=>{e1.init(e,t),B4.init(e,t),e._zod.processJSONSchema=(t,n,r)=>r4(e,t,n,r)});function L3(e,t){return new I3({type:`intersection`,left:e,right:t})}var R3=Q(`ZodRecord`,(e,t)=>{z4(),r1.init(e,t),B4.init(e,t),e._zod.processJSONSchema=(t,n,r)=>c4(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function z3(e,t,n){return!t||!t._zod?new R3({type:`record`,keyType:U4(),valueType:e,...Z(t)}):new R3({type:`record`,keyType:e,valueType:t,...Z(n)})}var B3=Q(`ZodEnum`,(e,t)=>{i1.init(e,t),B4.init(e,t),e._zod.processJSONSchema=(t,n,r)=>H2(e,t,n,r),e.enum=t.entries,e.options=[...e._zod.values];let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new B3({...t,checks:[],...Z(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new B3({...t,checks:[],...Z(r),entries:i})}});function V3(e,t){return new B3({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...Z(t)})}var H3=Q(`ZodLiteral`,(e,t)=>{a1.init(e,t),B4.init(e,t),e._zod.processJSONSchema=(t,n,r)=>U2(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function U3(e,t){return new H3({type:`literal`,values:Array.isArray(e)?e:[e],...Z(t)})}var W3=Q(`ZodTransform`,(e,t)=>{z4(),o1.init(e,t),B4.init(e,t),e._zod.processJSONSchema=(t,n,r)=>X2(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new pZ(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(JX(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,`input`in t||(t.input=n.value),t.inst??=e,n.issues.push(JX(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function G3(e){return new W3({type:`transform`,transform:e})}var K3=Q(`ZodOptional`,(e,t)=>{c1.init(e,t),B4.init(e,t),e._zod.processJSONSchema=(t,n,r)=>y4(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function q3(e){return new K3({type:`optional`,innerType:e})}var J3=Q(`ZodExactOptional`,(e,t)=>{l1.init(e,t),B4.init(e,t),e._zod.processJSONSchema=(t,n,r)=>y4(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Y3(e){return new J3({type:`optional`,innerType:e})}var X3=Q(`ZodNullable`,(e,t)=>{u1.init(e,t),B4.init(e,t),e._zod.processJSONSchema=(t,n,r)=>l4(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Z3(e){return new X3({type:`nullable`,innerType:e})}var Q3=Q(`ZodDefault`,(e,t)=>{d1.init(e,t),B4.init(e,t),e._zod.processJSONSchema=(t,n,r)=>p4(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function $3(e,t){return new Q3({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():SX(t)}})}var e6=Q(`ZodPrefault`,(e,t)=>{p1.init(e,t),B4.init(e,t),e._zod.processJSONSchema=(t,n,r)=>m4(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function t6(e,t){return new e6({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():SX(t)}})}var n6=Q(`ZodNonOptional`,(e,t)=>{m1.init(e,t),B4.init(e,t),e._zod.processJSONSchema=(t,n,r)=>u4(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function r6(e,t){return new n6({type:`nonoptional`,innerType:e,...Z(t)})}var i6=Q(`ZodCatch`,(e,t)=>{_1.init(e,t),B4.init(e,t),e._zod.processJSONSchema=(t,n,r)=>h4(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function a6(e,t){return new i6({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:sZ(t)})}var o6=Q(`ZodPipe`,(e,t)=>{v1.init(e,t),B4.init(e,t),e._zod.processJSONSchema=(t,n,r)=>g4(e,t,n,r),e.in=t.in,e.out=t.out});function s6(e,t){return new o6({type:`pipe`,in:e,out:t})}var c6=Q(`ZodReadonly`,(e,t)=>{b1.init(e,t),B4.init(e,t),e._zod.processJSONSchema=(t,n,r)=>_4(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function l6(e){return new c6({type:`readonly`,innerType:e})}var u6=Q(`ZodLazy`,(e,t)=>{S1.init(e,t),B4.init(e,t),e._zod.processJSONSchema=(t,n,r)=>b4(e,t,n,r),e.unwrap=()=>e._zod.def.getter()});function d6(e){return new u6({type:`lazy`,getter:e})}var f6=Q(`ZodCustom`,(e,t)=>{C1.init(e,t),B4.init(e,t),e._zod.processJSONSchema=(t,n,r)=>J2(e,t,n,r)});function p6(e,t={}){return X0(f6,e,t)}function m6(e,t){return Z0(e,t)}function h6(e){let t=d6(()=>N3([U4(e),h3(),y3(),x3(),k3(t),z3(U4(),t)]));return t}var g6=class extends Error{constructor(e,t){super(e),this.name=`ParseError`,this.type=t.type,this.field=t.field,this.value=t.value,this.line=t.line}},_6=10,v6=13,y6=32;function b6(e){}function x6(e){if(typeof e==`function`)throw TypeError("`config` must be an object, got a function instead. Did you mean `createParser({onEvent: fn})`?");let{onEvent:t=b6,onError:n=b6,onRetry:r=b6,onComment:i,maxBufferSize:a}=e,o=[],s=0,c=!0,l,u=``,d=0,f,p=!1;function m(e){if(p)throw Error("Cannot feed parser: it was terminated after exceeding the configured max buffer size. Call `reset()` to resume parsing.");if(c&&(c=!1,e.charCodeAt(0)===239&&e.charCodeAt(1)===187&&e.charCodeAt(2)===191&&(e=e.slice(3))),o.length===0){let t=g(e);t!==``&&(o.push(t),s=t.length),h();return}if(e.indexOf(`
152
+ `)===-1&&e.indexOf(`\r`)===-1){o.push(e),s+=e.length,h();return}o.push(e);let t=o.join(``);o.length=0,s=0;let n=g(t);n!==``&&(o.push(n),s=n.length),h()}function h(){a!==void 0&&(s+u.length<=a||(p=!0,o.length=0,s=0,l=void 0,u=``,d=0,f=void 0,n(new g6(`Buffered data exceeded max buffer size of ${a} characters`,{type:`max-buffer-size-exceeded`}))))}function g(e){let n=0;if(e.indexOf(`\r`)===-1){let r=e.indexOf(`
153
+ `,n);for(;r!==-1;){if(n===r){d>0&&t({id:l,event:f,data:u}),l=void 0,u=``,d=0,f=void 0,n=r+1,r=e.indexOf(`
154
+ `,n);continue}let i=e.charCodeAt(n);if(S6(e,n,i)){let i=e.charCodeAt(n+5)===y6?n+6:n+5,a=e.slice(i,r);if(d===0&&e.charCodeAt(r+1)===_6){t({id:l,event:f,data:a}),l=void 0,u=``,f=void 0,n=r+2,r=e.indexOf(`
155
+ `,n);continue}u=d===0?a:`${u}
156
+ ${a}`,d++}else C6(e,n,i)?f=e.slice(e.charCodeAt(n+6)===y6?n+7:n+6,r)||void 0:_(e,n,r);n=r+1,r=e.indexOf(`
157
+ `,n)}return e.slice(n)}for(;n<e.length;){let t=e.indexOf(`\r`,n),r=e.indexOf(`
158
+ `,n),i=-1;if(t!==-1&&r!==-1?i=t<r?t:r:t===-1?r!==-1&&(i=r):i=t===e.length-1?-1:t,i===-1)break;_(e,n,i),n=i+1,e.charCodeAt(n-1)===v6&&e.charCodeAt(n)===_6&&n++}return e.slice(n)}function _(e,t,n){if(t===n){y();return}let r=e.charCodeAt(t);if(S6(e,t,r)){let r=e.charCodeAt(t+5)===y6?t+6:t+5,i=e.slice(r,n);u=d===0?i:`${u}
159
+ ${i}`,d++;return}if(C6(e,t,r)){f=e.slice(e.charCodeAt(t+6)===y6?t+7:t+6,n)||void 0;return}if(r===105&&e.charCodeAt(t+1)===100&&e.charCodeAt(t+2)===58){let r=e.slice(e.charCodeAt(t+3)===y6?t+4:t+3,n);r.includes(`\0`)||(l=r);return}if(r===58){if(i){let r=e.slice(t,n);i(r.slice(e.charCodeAt(t+1)===y6?2:1))}return}let a=e.slice(t,n),o=a.indexOf(`:`);if(o===-1){v(a,``,a);return}let s=a.slice(0,o),c=a.charCodeAt(o+1)===y6?2:1;v(s,a.slice(o+c),a)}function v(e,t,i){switch(e){case`event`:f=t||void 0;break;case`data`:u=d===0?t:`${u}
160
+ ${t}`,d++;break;case`id`:t.includes(`\0`)||(l=t);break;case`retry`:/^\d+$/.test(t)?r(parseInt(t,10)):n(new g6(`Invalid \`retry\` value: "${t}"`,{type:`invalid-retry`,value:t,line:i}));break;default:n(new g6(`Unknown field "${e.length>20?`${e.slice(0,20)}\u2026`:e}"`,{type:`unknown-field`,field:e,value:t,line:i}))}}function y(){d>0&&t({id:l,event:f,data:u}),l=void 0,u=``,d=0,f=void 0}function b(e={}){if(e.consume&&o.length>0){let e=o.join(``);_(e,0,e.length)}c=!0,l=void 0,u=``,d=0,f=void 0,o.length=0,s=0,p=!1}return{feed:m,reset:b}}function S6(e,t,n){return n===100&&e.charCodeAt(t+1)===97&&e.charCodeAt(t+2)===116&&e.charCodeAt(t+3)===97&&e.charCodeAt(t+4)===58}function C6(e,t,n){return n===101&&e.charCodeAt(t+1)===118&&e.charCodeAt(t+2)===101&&e.charCodeAt(t+3)===110&&e.charCodeAt(t+4)===116&&e.charCodeAt(t+5)===58}var w6=class extends TransformStream{constructor({onError:e,onRetry:t,onComment:n,maxBufferSize:r}={}){let i;super({start(a){i=x6({onEvent:e=>{a.enqueue(e)},onError(t){typeof e==`function`&&e(t),(e===`terminate`||t.type===`max-buffer-size-exceeded`)&&a.error(t)},onRetry:t,onComment:n,maxBufferSize:r})},transform(e){i.feed(e)}})}},T6=Symbol.for(`workflow-serialize`),E6=Symbol.for(`workflow-deserialize`);function D6(...e){return e.reduce((e,t)=>({...e,...t}),{})}function O6(e){return Object.fromEntries(Object.entries(e).filter(([e,t])=>t!=null))}async function k6(e,t){if(e==null)return;let n=t?.abortSignal;return new Promise((t,r)=>{if(n?.aborted){r(A6());return}let i=setTimeout(()=>{a(),t()},e),a=()=>{clearTimeout(i),n?.removeEventListener(`abort`,o)},o=()=>{a(),r(A6())};n?.addEventListener(`abort`,o)})}function A6(){return new DOMException(`Delay was aborted`,`AbortError`)}function j6(e){let t=e??globalThis.WebSocket;if(t==null)throw Error(`No WebSocket implementation available.`);return t}var M6=new TextDecoder;async function N6(e){return typeof e==`string`?e:e instanceof ArrayBuffer||ArrayBuffer.isView(e)?M6.decode(e):typeof Blob<`u`&&e instanceof Blob?e.text():String(e)}var P6=1;async function F6(e,{highWaterMark:t=1048576,pollIntervalMs:n=20,abortSignal:r}={}){for(;e.readyState===P6&&(e.bufferedAmount??0)>t;){if(r?.aborted===!0)return;await k6(n)}}function I6({url:e,protocols:t,headers:n,webSocket:r,abortSignal:i,onOpen:a,onMessageText:o,onProcessingError:s,onSocketError:c,onClose:l,onAbort:u}){let d,f,p=e=>{f!=null&&(i?.removeEventListener(`abort`,f),f=void 0);try{d?.close(e)}catch{}};if(i?.aborted)return u?.(i.reason??Error(`Aborted`)),{socket:void 0,close:p};try{d=new(j6(r))(e,t,{headers:O6(n??{})})}catch(e){return s(e),{socket:void 0,close:p}}i!=null&&u!=null&&(f=()=>u(i.reason??Error(`Aborted`)),i.addEventListener(`abort`,f,{once:!0}));let m=d;d.onopen=()=>{try{a?.(m)}catch(e){s(e)}};let h=Promise.resolve();return d.onmessage=e=>{h=h.then(()=>N6(e.data)).then(e=>o(e)).catch(s)},d.onerror=()=>{h=h.then(()=>c?.()).catch(s)},d.onclose=e=>{let t=e,n=typeof t?.code==`number`?t.code:void 0,r=typeof t?.reason==`string`?t.reason:void 0;h=h.then(()=>l?.({code:n,reason:r})).catch(s)},{socket:d,close:p}}function L6(e){let t=!1;return new ReadableStream({async pull(n){if(!t)try{let{value:t,done:r}=await e.next();r?n.close():n.enqueue(t)}catch(e){n.error(e)}},async cancel(n){if(t=!0,e.return)try{await e.return(n)}catch{}}})}var{btoa:R6,atob:z6}=globalThis;function B6(e){let t=z6(e.replace(/-/g,`+`).replace(/_/g,`/`));return Uint8Array.from(t,e=>e.codePointAt(0))}function V6(e){let t=[],n=4096;for(let r=0;r<e.length;r+=n)t.push(String.fromCodePoint(...e.subarray(r,r+n)));return R6(t.join(``))}function H6(e){return Object.fromEntries([...e.headers])}function U6(e=globalThis){return e.navigator?.userAgent?e.navigator.userAgent.toLowerCase():e.process?.versions?.node?`node.js/${e.process.version}`:e.EdgeRuntime?`vercel-edge`:``}function W6(e){return(e instanceof Error||typeof DOMException==`function`&&e instanceof DOMException)&&(e.name===`AbortError`||e.name===`ResponseAborted`||e.name===`TimeoutError`)}var G6=[`fetch failed`,`failed to fetch`],K6=new Set([`ConnectionRefused`,`ConnectionClosed`,`FailedToOpenSocket`,`ECONNRESET`,`ECONNREFUSED`,`ETIMEDOUT`,`EPIPE`,`UND_ERR_SOCKET`,`UND_ERR_HEADERS_TIMEOUT`,`UND_ERR_BODY_TIMEOUT`,`UND_ERR_CONNECT_TIMEOUT`]);function q6(e){let t=new Set,n=e;for(;n instanceof Error&&!t.has(n);){t.add(n);let e=n;if(typeof e.code==`string`&&K6.has(e.code))return e;n=n.cause}}function J6({error:e,url:t,requestBodyValues:n}){if(W6(e))return e;if(e instanceof TypeError&&G6.includes(e.message.toLowerCase())){let r=e.cause;if(r!=null)return new AY({message:`Cannot connect to API: ${r.message}`,cause:r,url:t,requestBodyValues:n,isRetryable:!0})}let r=q6(e);return r==null?e:AY.isInstance(e)?new AY({message:e.message,cause:e.cause,url:e.url,requestBodyValues:e.requestBodyValues,statusCode:e.statusCode,responseHeaders:e.responseHeaders,responseBody:e.responseBody,data:e.data,isRetryable:!0}):new AY({message:`Cannot connect to API: ${e instanceof Error?e.message:r.message}`,cause:e,url:t,requestBodyValues:n,isRetryable:!0})}var Y6=`5.0.53`;function X6(e){if(e==null)return{};let t={};if(e instanceof Headers)e.forEach((e,n)=>{t[n.toLowerCase()]=e});else{Array.isArray(e)||(e=Object.entries(e));for(let[n,r]of e)r!=null&&(t[n.toLowerCase()]=r)}return t}function Z6(e,...t){let n=new Headers(X6(e)),r=n.get(`user-agent`)||``;return n.set(`user-agent`,[r,...t].filter(Boolean).join(` `)),Object.fromEntries(n.entries())}async function Q6(e){try{await e.body?.cancel()}catch{}}var $6=`AI_DownloadError`,e8=`vercel.ai.error.${$6}`,t8=Symbol.for(e8),n8=class extends EY{constructor({url:e,statusCode:t,statusText:n,cause:r,message:i=r==null?`Failed to download ${e}: ${t} ${n}`:`Failed to download ${e}: ${r}`}){super({name:$6,message:i,cause:r}),this[t8]=!0,this.url=e,this.statusCode=t,this.statusText=n}static isInstance(e){return EY.hasMarker(e,e8)}};function r8(e=globalThis){return e.window!=null}function i8(e,t){try{return new URL(e).origin===new URL(t).origin}catch{return!1}}function a8(e){let t;try{t=new URL(e)}catch{throw new n8({url:e,message:`Invalid URL: ${e}`})}if(t.protocol===`data:`)return;if(t.protocol!==`http:`&&t.protocol!==`https:`)throw new n8({url:e,message:`URL scheme must be http, https, or data, got ${t.protocol}`});let n=t.hostname.toLowerCase().replace(/\.+$/,``);if(!n)throw new n8({url:e,message:`URL must have a hostname`});if(n===`localhost`||n.endsWith(`.local`)||n.endsWith(`.localhost`))throw new n8({url:e,message:`URL with hostname ${n} is not allowed`});if(n.startsWith(`[`)&&n.endsWith(`]`)){if(u8(n.slice(1,-1)))throw new n8({url:e,message:`URL with IPv6 address ${n} is not allowed`});return}if(s8(n)&&c8(n))throw new n8({url:e,message:`URL with IP address ${n} is not allowed`})}function o8({address:e,family:t,hostname:n}){if(t===4?!s8(e)||c8(e):t!==6||u8(e))throw new n8({url:n,message:`Hostname ${n} resolved to disallowed IP address ${e}`})}function s8(e){let t=e.split(`.`);return t.length===4&&t.every(e=>{let t=Number(e);return Number.isInteger(t)&&t>=0&&t<=255&&String(t)===e})}function c8(e){let[t,n,r]=e.split(`.`).map(Number);return t===0||t===10||t===100&&n>=64&&n<=127||t===127||t===169&&n===254||t===172&&n>=16&&n<=31||t===192&&n===0&&r===0||t===192&&n===0&&r===2||t===192&&n===168||t===198&&(n===18||n===19)||t===198&&n===51&&r===100||t===203&&n===0&&r===113||t>=224}function l8(e){let t=e.toLowerCase(),n=t.indexOf(`%`);n!==-1&&(t=t.slice(0,n));let r=t.split(`::`);if(r.length>2)return null;let i=e=>{if(e===``)return[];let t=[],n=e.split(`:`);for(let e=0;e<n.length;e++){let r=n[e];if(r.includes(`.`)){if(e!==n.length-1||!s8(r))return null;let[i,a,o,s]=r.split(`.`).map(Number);t.push(i<<8|a,o<<8|s);continue}if(!/^[0-9a-f]{1,4}$/.test(r))return null;t.push(parseInt(r,16))}return t},a=i(r[0]);if(a===null)return null;if(r.length===2){let e=i(r[1]);if(e===null)return null;let t=8-a.length-e.length;return t<0?null:[...a,...Array(t).fill(0),...e]}return a.length===8?a:null}function u8(e){let t=l8(e);if(t===null)return!0;let n=e=>t.slice(0,e).every(e=>e===0);return n(7)&&(t[7]===0||t[7]===1)||(t[0]&65024)==64512||(t[0]&65472)==65152||(t[0]&65472)==65216||(t[0]&65280)==65280||t[0]===8193&&t[1]===3512||t[0]===16383&&!(t[1]&61440)?!0:n(6)||n(5)&&t[5]===65535||n(4)&&t[4]===65535&&t[5]===0||t[0]===100&&t[1]===65435&&t[2]===0&&t[3]===0&&t[4]===0&&t[5]===0||t[0]===100&&t[1]===65435&&t[2]===1?c8(`${t[6]>>8&255}.${t[6]&255}.${t[7]>>8&255}.${t[7]&255}`):!1}function d8(e){return((t,n,r)=>{e(t,{...n,all:!0},(e,i)=>{if(e){r(e);return}try{let[e]=i;if(e==null)throw Error(`Hostname ${t} did not resolve to an address`);for(let{address:e,family:n}of i)o8({address:e,family:n,hostname:t});n.all===!0?r(null,i):r(null,e.address,e.family)}catch(e){r(e instanceof Error?e:Error(String(e)))}})})}var f8;function p8(){let e=globalThis.process;return e?.release?.name===`node`&&e.versions?.bun==null&&e.versions?.deno==null&&e.title!==`workerd`&&globalThis.EdgeRuntime==null}async function m8(){return p8()?f8??=Promise.resolve().then(h8):globalThis.fetch}function h8(){let e=g8(`node:module`),{lookup:t}=g8(`node:dns`),{Agent:n,fetch:r}=e.createRequire(_8())(`undici`),i=new n({connect:{lookup:d8(t)}});return((e,t)=>r(e,{...t,dispatcher:i}))}function g8(e){let t=globalThis.process?.getBuiltinModule?.(e);if(t==null)throw Error(`Node.js built-in module ${e} is unavailable`);return t}function _8(){let e=Error.prepareStackTrace;try{Error.prepareStackTrace=(e,t)=>t;let e=Error(`Capture current module path`);Error.captureStackTrace(e,_8);let[t]=e.stack,n=t?.getFileName();if(n==null)throw Error(`Unable to determine the current module path`);return n}finally{Error.prepareStackTrace=e}}var v8=[`connection`,`keep-alive`,`te`,`trailer`,`transfer-encoding`,`upgrade`,`host`,`forwarded`,`proxy-authorization`,`via`,`x-forwarded-for`,`x-forwarded-host`,`x-forwarded-proto`,`x-real-ip`,`metadata`,`metadata-flavor`,`x-aws-ec2-metadata-token`,`x-metadata-token`,`cookie`,`set-cookie`];function y8(e){let t=new Headers(e);for(let e of v8)t.delete(e);return t}var b8=10,x8=new Set([301,302,303,307,308]);async function S8(e){return e==null||e===globalThis.fetch?await m8():e}async function C8({url:e,headers:t,abortSignal:n,maxRedirects:r=b8,fetch:i,trustedOrigin:a}){let o=t===void 0?void 0:y8(t),s=e=>{let t={signal:n,redirect:e};return o!==void 0&&(t.headers=new Headers(o)),t},c=e;for(let t=0;t<=r;t++){let t=a!==void 0&&i8(c,a);t||a8(c);let n=t&&i!=null?i:t?globalThis.fetch:await S8(i),r=await n(c,s(`manual`));if(r.type===`opaqueredirect`){if(!r8())throw new n8({url:e,message:`Redirect from ${c} could not be validated and was blocked`});return await n(c,s(`follow`))}let l=r.headers?.get(`location`);if(x8.has(r.status)&&l){Q6(r);let e=new URL(l,c).toString();if(o!==void 0&&!i8(e,c)){let e=o.get(`user-agent`);o=new Headers(e==null?void 0:{"user-agent":e})}c=e;continue}return r}throw new n8({url:e,message:`Too many redirects (max ${r})`})}var w8=2147483648;async function T8({response:e,url:t,maxBytes:n=w8}){let r=e.headers.get(`content-length`);if(r!=null){let i=parseInt(r,10);if(!isNaN(i)&&i>n)throw await Q6(e),new n8({url:t,message:`Download of ${t} exceeded maximum size of ${n} bytes (Content-Length: ${i}).`})}let i=e.body;if(i==null)return new Uint8Array;let a=i.getReader(),o=[],s=0;try{for(;;){let{done:e,value:r}=await a.read();if(e)break;if(s+=r.length,s>n)throw new n8({url:t,message:`Download of ${t} exceeded maximum size of ${n} bytes.`});o.push(r)}}finally{try{await a.cancel()}catch{}finally{a.releaseLock()}}let c=new Uint8Array(s),l=0;for(let e of o)c.set(e,l),l+=e.length;return c}(({prefix:e,size:t=16,alphabet:n=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz`,separator:r=`-`}={})=>{let i=()=>{let e=n.length,r=Array(t);for(let i=0;i<t;i++)r[i]=n[Math.random()*e|0];return r.join(``)};if(e==null)return i;if(n.includes(r))throw new zY({argument:`separator`,message:`The separator "${r}" must not be part of the alphabet "${n}".`});return()=>`${e}${r}${i()}`})();var E8=()=>globalThis.fetch,D8=async({url:e,headers:t={},successfulResponseHandler:n,failedResponseHandler:r,abortSignal:i,fetch:a,validateUrl:o,credentialedOrigin:s,trustedOrigin:c})=>{try{let l=a??E8(),u=Z6(s!==void 0&&!i8(e,s)?{}:t,`ai-sdk-provider-utils/${Y6}`,U6()),d=o?await C8({url:e,headers:u,abortSignal:i,fetch:a,trustedOrigin:c}):await l(e,{method:`GET`,headers:u,signal:i}),f=H6(d);if(!d.ok){let t;try{t=await r({response:d,url:e,requestBodyValues:{}})}catch(t){throw W6(t)||AY.isInstance(t)?t:new AY({message:`Failed to process error response`,cause:t,statusCode:d.status,url:e,responseHeaders:f,requestBodyValues:{}})}throw t.value}try{return await n({response:d,url:e,requestBodyValues:{}})}catch(t){throw t instanceof Error&&(W6(t)||AY.isInstance(t))?t:new AY({message:`Failed to process successful response`,cause:t,statusCode:d.status,url:e,responseHeaders:f,requestBodyValues:{}})}}catch(t){throw J6({error:t,url:e,requestBodyValues:{}})}};function O8(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function k8({settingValue:e,environmentVariableName:t}){if(typeof e==`string`||e==null&&typeof process<`u`&&(e={}[t],e!=null&&typeof e==`string`))return e}function A8({total:e,pending:t,completed:n,failed:r}){if(j8(e)&&j8(t)&&j8(n)&&j8(r)&&t+n+r===e)return{total:e,pending:t,completed:n,failed:r}}function j8(e){return e!=null&&Number.isSafeInteger(e)&&e>=0}var M8=/"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/,N8=/"(?: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 P8(e){let t=JSON.parse(e);return typeof t!=`object`||!t||M8.test(e)===!1&&N8.test(e)===!1?t:F8(t)}function F8(e){let t=[e];for(;t.length;){let e=t;t=[];for(let n of e){if(Object.prototype.hasOwnProperty.call(n,`__proto__`)||Object.prototype.hasOwnProperty.call(n,`constructor`)&&n.constructor!==null&&typeof n.constructor==`object`&&Object.prototype.hasOwnProperty.call(n.constructor,`prototype`))throw SyntaxError(`Object contains forbidden prototype property`);for(let e in n){let r=n[e];r&&typeof r==`object`&&t.push(r)}}}return e}function I8(e){let{stackTraceLimit:t}=Error;try{Error.stackTraceLimit=0}catch{return P8(e)}try{return P8(e)}finally{Error.stackTraceLimit=t}}function L8(e){if(e.type===`object`||Array.isArray(e.type)&&e.type.includes(`object`)){let{additionalProperties:t}=e;e.additionalProperties=t!=null&&typeof t!=`boolean`&&R8(t);let{properties:n}=e;if(n!=null)for(let e of Object.keys(n))n[e]=R8(n[e])}e.items!=null&&(e.items=Array.isArray(e.items)?e.items.map(R8):R8(e.items)),e.anyOf!=null&&(e.anyOf=e.anyOf.map(R8)),e.allOf!=null&&(e.allOf=e.allOf.map(R8)),e.oneOf!=null&&(e.oneOf=e.oneOf.map(R8));let{definitions:t}=e;if(t!=null)for(let e of Object.keys(t))t[e]=R8(t[e]);return e}function R8(e){return typeof e==`boolean`?e:L8(e)}var z8=Symbol(`Let zodToJsonSchema decide on which parser to use`),B8={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`},V8=e=>typeof e==`string`?{...B8,name:e}:{...B8,...e};function H8(){return{}}function U8(e,t){let n={type:`array`};return e.type?._def&&e.type?._def?.typeName!==`ZodAny`&&(n.items=P5(e.type._def,{...t,currentPath:[...t.currentPath,`items`]})),e.minLength&&(n.minItems=e.minLength.value),e.maxLength&&(n.maxItems=e.maxLength.value),e.exactLength&&(n.minItems=e.exactLength.value,n.maxItems=e.exactLength.value),n}function W8(e){let t={type:`integer`,format:`int64`};if(!e.checks)return t;for(let n of e.checks)switch(n.kind){case`min`:n.inclusive?t.minimum=n.value:t.exclusiveMinimum=n.value;break;case`max`:n.inclusive?t.maximum=n.value:t.exclusiveMaximum=n.value;break;case`multipleOf`:t.multipleOf=n.value}return t}function G8(){return{type:`boolean`}}function K8(e,t){return P5(e.type._def,t)}var q8=(e,t)=>P5(e.innerType._def,t);function J8(e,t,n){let r=n??t.dateStrategy;if(Array.isArray(r))return{anyOf:r.map(n=>J8(e,t,n))};switch(r){case`string`:case`format:date-time`:return{type:`string`,format:`date-time`};case`format:date`:return{type:`string`,format:`date`};case`integer`:return Y8(e)}}var Y8=e=>{let t={type:`integer`,format:`unix-time`};for(let n of e.checks)switch(n.kind){case`min`:t.minimum=n.value;break;case`max`:t.maximum=n.value}return t};function X8(e,t){return{...P5(e.innerType._def,t),default:e.defaultValue()}}function Z8(e,t){return t.effectStrategy===`input`?P5(e.schema._def,t):H8()}function Q8(e){return{type:`string`,enum:Array.from(e.values)}}var $8=e=>`type`in e&&e.type===`string`?!1:`allOf`in e;function e5(e,t){let n=[P5(e.left._def,{...t,currentPath:[...t.currentPath,`allOf`,`0`]}),P5(e.right._def,{...t,currentPath:[...t.currentPath,`allOf`,`1`]})].filter(e=>!!e),r=[];return n.forEach(e=>{if($8(e))r.push(...e.allOf);else{let t=e;if(`additionalProperties`in e&&e.additionalProperties===!1){let{additionalProperties:n,...r}=e;t=r}r.push(t)}}),r.length?{allOf:r}:void 0}function t5(e){let 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 n5=void 0,r5={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:()=>(n5===void 0&&(n5=RegExp(`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`,`u`)),n5),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 i5(e,t){let n={type:`string`};if(e.checks)for(let r of e.checks)switch(r.kind){case`min`:n.minLength=typeof n.minLength==`number`?Math.max(n.minLength,r.value):r.value;break;case`max`:n.maxLength=typeof n.maxLength==`number`?Math.min(n.maxLength,r.value):r.value;break;case`email`:switch(t.emailStrategy){case`format:email`:c5(n,`email`,r.message,t);break;case`format:idn-email`:c5(n,`idn-email`,r.message,t);break;case`pattern:zod`:l5(n,r5.email,r.message,t)}break;case`url`:c5(n,`uri`,r.message,t);break;case`uuid`:c5(n,`uuid`,r.message,t);break;case`regex`:l5(n,r.regex,r.message,t);break;case`cuid`:l5(n,r5.cuid,r.message,t);break;case`cuid2`:l5(n,r5.cuid2,r.message,t);break;case`startsWith`:l5(n,RegExp(`^${a5(r.value,t)}`),r.message,t);break;case`endsWith`:l5(n,RegExp(`${a5(r.value,t)}$`),r.message,t);break;case`datetime`:c5(n,`date-time`,r.message,t);break;case`date`:c5(n,`date`,r.message,t);break;case`time`:c5(n,`time`,r.message,t);break;case`duration`:c5(n,`duration`,r.message,t);break;case`length`:n.minLength=typeof n.minLength==`number`?Math.max(n.minLength,r.value):r.value,n.maxLength=typeof n.maxLength==`number`?Math.min(n.maxLength,r.value):r.value;break;case`includes`:l5(n,RegExp(a5(r.value,t)),r.message,t);break;case`ip`:r.version!==`v6`&&c5(n,`ipv4`,r.message,t),r.version!==`v4`&&c5(n,`ipv6`,r.message,t);break;case`base64url`:l5(n,r5.base64url,r.message,t);break;case`jwt`:l5(n,r5.jwt,r.message,t);break;case`cidr`:r.version!==`v6`&&l5(n,r5.ipv4Cidr,r.message,t),r.version!==`v4`&&l5(n,r5.ipv6Cidr,r.message,t);break;case`emoji`:l5(n,r5.emoji(),r.message,t);break;case`ulid`:l5(n,r5.ulid,r.message,t);break;case`base64`:switch(t.base64Strategy){case`format:binary`:c5(n,`binary`,r.message,t);break;case`contentEncoding:base64`:n.contentEncoding=`base64`;break;case`pattern:zod`:l5(n,r5.base64,r.message,t)}break;case`nanoid`:l5(n,r5.nanoid,r.message,t)}return n}function a5(e,t){return t.patternStrategy===`escape`?s5(e):e}var o5=new Set(`ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789`);function s5(e){let t=``;for(let n=0;n<e.length;n++)o5.has(e[n])||(t+=`\\`),t+=e[n];return t}function c5(e,t,n,r){e.format||e.anyOf?.some(e=>e.format)?(e.anyOf||=[],e.format&&(e.anyOf.push({format:e.format}),delete e.format),e.anyOf.push({format:t,...n&&r.errorMessages&&{errorMessage:{format:n}}})):e.format=t}function l5(e,t,n,r){e.pattern||e.allOf?.some(e=>e.pattern)?(e.allOf||=[],e.pattern&&(e.allOf.push({pattern:e.pattern}),delete e.pattern),e.allOf.push({pattern:u5(t,r),...n&&r.errorMessages&&{errorMessage:{pattern:n}}})):e.pattern=u5(t,r)}function u5(e,t){if(!t.applyRegexFlags||!e.flags)return e.source;let n={i:e.flags.includes(`i`),m:e.flags.includes(`m`),s:e.flags.includes(`s`)},r=n.i?e.source.toLowerCase():e.source,i=``,a=!1,o=!1,s=!1;for(let e=0;e<r.length;e++){if(a){i+=r[e],a=!1;continue}if(n.i){if(o){if(r[e].match(/[a-z]/)){s?(i+=r[e],i+=`${r[e-2]}-${r[e]}`.toUpperCase(),s=!1):r[e+1]===`-`&&r[e+2]?.match(/[a-z]/)?(i+=r[e],s=!0):i+=`${r[e]}${r[e].toUpperCase()}`;continue}}else if(r[e].match(/[a-z]/)){i+=`[${r[e]}${r[e].toUpperCase()}]`;continue}}if(n.m){if(r[e]===`^`){i+=`(^|(?<=[\r
161
+ ]))`;continue}if(r[e]===`$`){i+=`($|(?=[\r
162
+ ]))`;continue}}if(n.s&&r[e]===`.`){i+=o?`${r[e]}\r\n`:`[${r[e]}\r\n]`;continue}i+=r[e],r[e]===`\\`?a=!0:o&&r[e]===`]`?o=!1:!o&&r[e]===`[`&&(o=!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 d5(e,t){let n={type:`object`,additionalProperties:P5(e.valueType._def,{...t,currentPath:[...t.currentPath,`additionalProperties`]})??t.allowedAdditionalProperties};if(e.keyType?._def.typeName===`ZodString`&&e.keyType._def.checks?.length){let{type:r,...i}=i5(e.keyType._def,t);return{...n,propertyNames:i}}if(e.keyType?._def.typeName===`ZodEnum`)return{...n,propertyNames:{enum:e.keyType._def.values}};if(e.keyType?._def.typeName===`ZodBranded`&&e.keyType._def.type._def.typeName===`ZodString`&&e.keyType._def.type._def.checks?.length){let{type:r,...i}=K8(e.keyType._def,t);return{...n,propertyNames:i}}return n}function f5(e,t){return t.mapStrategy===`record`?d5(e,t):{type:`array`,maxItems:125,items:{type:`array`,items:[P5(e.keyType._def,{...t,currentPath:[...t.currentPath,`items`,`items`,`0`]})||H8(),P5(e.valueType._def,{...t,currentPath:[...t.currentPath,`items`,`items`,`1`]})||H8()],minItems:2,maxItems:2}}}function p5(e){let t=e.values,n=Object.keys(e.values).filter(e=>typeof t[t[e]]!=`number`).map(e=>t[e]),r=Array.from(new Set(n.map(e=>typeof e)));return{type:r.length===1?r[0]===`string`?`string`:`number`:[`string`,`number`],enum:n}}function m5(){return{not:H8()}}function h5(){return{type:`null`}}var g5={ZodString:`string`,ZodNumber:`number`,ZodBigInt:`integer`,ZodBoolean:`boolean`,ZodNull:`null`};function _5(e,t){let n=e.options instanceof Map?Array.from(e.options.values()):e.options;if(n.every(e=>e._def.typeName in g5&&(!e._def.checks||!e._def.checks.length))){let e=n.reduce((e,t)=>{let n=g5[t._def.typeName];return n&&!e.includes(n)?[...e,n]:e},[]);return{type:e.length>1?e:e[0]}}if(n.every(e=>e._def.typeName===`ZodLiteral`&&!e.description)){let e=n.reduce((e,t)=>{let n=typeof t._def.value;switch(n){case`string`:case`number`:case`boolean`:return[...e,n];case`bigint`:return[...e,`integer`];case`object`:if(t._def.value===null)return[...e,`null`];default:return e}},[]);if(e.length===n.length){let t=e.filter((e,t,n)=>n.indexOf(e)===t);return{type:t.length>1?t:t[0],enum:n.reduce((e,t)=>e.includes(t._def.value)?e:[...e,t._def.value],[])}}}else if(n.every(e=>e._def.typeName===`ZodEnum`))return{type:`string`,enum:n.reduce((e,t)=>[...e,...t._def.values.filter(t=>!e.includes(t))],[])};return v5(e,t)}var v5=(e,t)=>{let n=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((e,n)=>P5(e._def,{...t,currentPath:[...t.currentPath,`anyOf`,`${n}`]})).filter(e=>!!e&&(!t.strictUnions||typeof e==`object`&&Object.keys(e).length>0));return n.length?{anyOf:n}:void 0};function y5(e,t){if([`ZodString`,`ZodNumber`,`ZodBigInt`,`ZodBoolean`,`ZodNull`].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length))return{type:[g5[e.innerType._def.typeName],`null`]};let n=P5(e.innerType._def,{...t,currentPath:[...t.currentPath,`anyOf`,`0`]});return n&&{anyOf:[n,{type:`null`}]}}function b5(e){let t={type:`number`};if(!e.checks)return t;for(let n of e.checks)switch(n.kind){case`int`:t.type=`integer`;break;case`min`:n.inclusive?t.minimum=n.value:t.exclusiveMinimum=n.value;break;case`max`:n.inclusive?t.maximum=n.value:t.exclusiveMaximum=n.value;break;case`multipleOf`:t.multipleOf=n.value}return t}function x5(e,t){let n={type:`object`,properties:{}},r=[],i=e.shape();for(let e in i){let a=i[e];if(a===void 0||a._def===void 0)continue;let o=C5(a),s=P5(a._def,{...t,currentPath:[...t.currentPath,`properties`,e],propertyPath:[...t.currentPath,`properties`,e]});s!==void 0&&(n.properties[e]=s,o||r.push(e))}r.length&&(n.required=r);let a=S5(e,t);return a!==void 0&&(n.additionalProperties=a),n}function S5(e,t){if(e.catchall._def.typeName!==`ZodNever`)return P5(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 C5(e){try{return e.isOptional()}catch{return!0}}var w5=(e,t)=>{if(t.currentPath.toString()===t.propertyPath?.toString())return P5(e.innerType._def,t);let n=P5(e.innerType._def,{...t,currentPath:[...t.currentPath,`anyOf`,`1`]});return n?{anyOf:[{not:H8()},n]}:H8()},T5=(e,t)=>{if(t.pipeStrategy===`input`)return P5(e.in._def,t);if(t.pipeStrategy===`output`)return P5(e.out._def,t);let n=P5(e.in._def,{...t,currentPath:[...t.currentPath,`allOf`,`0`]});return{allOf:[n,P5(e.out._def,{...t,currentPath:[...t.currentPath,`allOf`,n?`1`:`0`]})].filter(e=>e!==void 0)}};function E5(e,t){return P5(e.type._def,t)}function D5(e,t){let n={type:`array`,uniqueItems:!0,items:P5(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 O5(e,t){return e.rest?{type:`array`,minItems:e.items.length,items:e.items.map((e,n)=>P5(e._def,{...t,currentPath:[...t.currentPath,`items`,`${n}`]})).reduce((e,t)=>t===void 0?e:[...e,t],[]),additionalItems:P5(e.rest._def,{...t,currentPath:[...t.currentPath,`additionalItems`]})}:{type:`array`,minItems:e.items.length,maxItems:e.items.length,items:e.items.map((e,n)=>P5(e._def,{...t,currentPath:[...t.currentPath,`items`,`${n}`]})).reduce((e,t)=>t===void 0?e:[...e,t],[])}}function k5(){return{not:H8()}}function A5(){return H8()}var j5=(e,t)=>P5(e.innerType._def,t),M5=(e,t,n)=>{switch(t){case`ZodString`:return i5(e,n);case`ZodNumber`:return b5(e);case`ZodObject`:return x5(e,n);case`ZodBigInt`:return W8(e);case`ZodBoolean`:return G8();case`ZodDate`:return J8(e,n);case`ZodUndefined`:return k5();case`ZodNull`:return h5();case`ZodArray`:return U8(e,n);case`ZodUnion`:case`ZodDiscriminatedUnion`:return _5(e,n);case`ZodIntersection`:return e5(e,n);case`ZodTuple`:return O5(e,n);case`ZodRecord`:return d5(e,n);case`ZodLiteral`:return t5(e);case`ZodEnum`:return Q8(e);case`ZodNativeEnum`:return p5(e);case`ZodNullable`:return y5(e,n);case`ZodOptional`:return w5(e,n);case`ZodMap`:return f5(e,n);case`ZodSet`:return D5(e,n);case`ZodLazy`:return()=>e.getter()._def;case`ZodPromise`:return E5(e,n);case`ZodNaN`:case`ZodNever`:return m5();case`ZodEffects`:return Z8(e,n);case`ZodAny`:return H8();case`ZodUnknown`:return A5();case`ZodDefault`:return X8(e,n);case`ZodBranded`:return K8(e,n);case`ZodReadonly`:return j5(e,n);case`ZodCatch`:return q8(e,n);case`ZodPipeline`:return T5(e,n);case`ZodFunction`:case`ZodVoid`:case`ZodSymbol`:return;default:return(e=>void 0)(t)}},N5=(e,t)=>{let n=0;for(;n<e.length&&n<t.length&&e[n]===t[n];n++);return[(e.length-n).toString(),...t.slice(n)].join(`/`)};function P5(e,t,n=!1){let r=t.seen.get(e);if(t.override){let i=t.override?.(e,t,r,n);if(i!==z8)return i}if(r&&!n){let e=F5(r,t);if(e!==void 0)return e}let i={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,i);let a=M5(e,e.typeName,t),o=typeof a==`function`?P5(a(),t):a;if(o&&I5(e,t,o),t.postProcess){let n=t.postProcess(o,e,t);return i.jsonSchema=o,n}return i.jsonSchema=o,o}var F5=(e,t)=>{switch(t.$refStrategy){case`root`:return{$ref:e.path.join(`/`)};case`relative`:return{$ref:N5(t.currentPath,e.path)};case`none`:case`seen`:return e.path.length<t.currentPath.length&&e.path.every((e,n)=>t.currentPath[n]===e)?(console.warn(`Recursive reference detected at ${t.currentPath.join(`/`)}! Defaulting to any`),H8()):t.$refStrategy===`seen`?H8():void 0}},I5=(e,t,n)=>(e.description&&(n.description=e.description),n),L5=e=>{let t=V8(e),n=t.name===void 0?t.basePath:[...t.basePath,t.definitionPath,t.name];return{...t,currentPath:n,propertyPath:void 0,seen:new Map(Object.entries(t.definitions).map(([e,n])=>[n._def,{def:n._def,path:[...t.basePath,t.definitionPath,e],jsonSchema:void 0}]))}},R5=(e,t)=>{let n=L5(t),r=typeof t==`object`&&t.definitions?Object.entries(t.definitions).reduce((e,[t,r])=>({...e,[t]:P5(r._def,{...n,currentPath:[...n.basePath,n.definitionPath,t]},!0)??H8()}),{}):void 0,i=typeof t==`string`?t:t?.nameStrategy===`title`?void 0:t?.name,a=P5(e._def,i===void 0?n:{...n,currentPath:[...n.basePath,n.definitionPath,i]},!1)??H8(),o=typeof t==`object`&&t.name!==void 0&&t.nameStrategy===`title`?t.name:void 0;o!==void 0&&(a.title=o);let s=i===void 0?r?{...a,[n.definitionPath]:r}:a:{$ref:[...n.$refStrategy===`relative`?[]:n.basePath,n.definitionPath,i].join(`/`),[n.definitionPath]:{...r,[i]:a}};return s.$schema=`http://json-schema.org/draft-07/schema#`,s},z5=Symbol.for(`vercel.ai.schema`);function B5(e){let t;return()=>(t??=e(),t)}function V5(e,{validate:t}={}){return{[z5]:!0,_type:void 0,get jsonSchema(){return typeof e==`function`&&(e=e()),e},validate:t}}function H5(e){return typeof e==`object`&&!!e&&z5 in e&&e[z5]===!0&&`jsonSchema`in e&&`validate`in e}function U5(e){return e==null?V5({type:`object`,properties:{},additionalProperties:!1}):H5(e)?e:`~standard`in e?e[`~standard`].vendor===`zod`?Y5(e):W5(e):e()}function W5(e){return V5(()=>{if(!G5(e))throw Error(`Standard schema vendor '${e[`~standard`].vendor}' does not support JSON Schema conversion.`);return L8(e[`~standard`].jsonSchema.input({target:`draft-07`}))},{validate:async t=>{let n=await e[`~standard`].validate(t);return`value`in n?{success:!0,value:n.value}:{success:!1,error:new qY({value:t,cause:n.issues})}}})}function G5(e){return e[`~standard`].jsonSchema!=null}function K5(e,t){let n=t?.useReferences??!1;return V5(()=>R5(e,{$refStrategy:n?`root`:`none`}),{validate:async t=>{let n=await e.safeParseAsync(t);return n.success?{success:!0,value:n.data}:{success:!1,error:n.error}}})}function q5(e,t){let n=t?.useReferences??!1;return V5(()=>L8(S4(e,{target:`draft-7`,io:`input`,reused:n?`ref`:`inline`})),{validate:async t=>{let n=await k4(e,t);return n.success?{success:!0,value:n.data}:{success:!1,error:n.error}}})}function J5(e){return`_zod`in e}function Y5(e,t){return J5(e)?q5(e,t):K5(e,t)}async function X5({value:e,schema:t,context:n}){let r=await Z5({value:e,schema:t,context:n});if(!r.success)throw qY.wrap({value:e,cause:r.error,context:n});return r.value}async function Z5({value:e,schema:t,context:n}){let r=U5(t);try{if(r.validate==null)return{success:!0,value:e,rawValue:e};let t=await r.validate(e);return t.success?{success:!0,value:t.value,rawValue:e}:{success:!1,error:qY.wrap({value:e,cause:t.error,context:n}),rawValue:e}}catch(t){return{success:!1,error:qY.wrap({value:e,cause:t,context:n}),rawValue:e}}}async function Q5({text:e,schema:t}){try{let n=I8(e);return t==null?n:await X5({value:n,schema:t})}catch(t){throw UY.isInstance(t)||qY.isInstance(t)?t:new UY({text:e,cause:t})}}async function $5({text:e,schema:t}){try{let n=I8(e);return t==null?{success:!0,value:n,rawValue:n}:await Z5({value:n,schema:t})}catch(t){return{success:!1,error:UY.isInstance(t)?t:new UY({text:e,cause:t}),rawValue:void 0}}}function e7({stream:e,schema:t}){return e.pipeThrough(new TextDecoderStream).pipeThrough(new w6).pipeThrough(new TransformStream({async transform({data:e},n){e!==`[DONE]`&&n.enqueue(await $5({text:e,schema:t}))}}))}async function t7({provider:e,providerOptions:t,schema:n}){if(t?.[e]==null)return;let r=await Z5({value:t[e],schema:n});if(!r.success)throw new zY({argument:`providerOptions`,message:`invalid ${e} provider options`,cause:r.error});return r.value}var n7=()=>globalThis.fetch,r7=async({url:e,headers:t,body:n,failedResponseHandler:r,successfulResponseHandler:i,abortSignal:a,fetch:o})=>await i7({url:e,headers:{"Content-Type":`application/json`,...t},body:{content:JSON.stringify(n),values:n},failedResponseHandler:r,successfulResponseHandler:i,abortSignal:a,fetch:o}),i7=async({url:e,headers:t={},body:n,successfulResponseHandler:r,failedResponseHandler:i,abortSignal:a,fetch:o=n7()})=>{try{let s=await o(e,{method:`POST`,headers:Z6(t,`ai-sdk-provider-utils/${Y6}`,U6()),body:n.content,signal:a}),c=H6(s);if(!s.ok){let t;try{t=await i({response:s,url:e,requestBodyValues:n.values})}catch(t){throw W6(t)||AY.isInstance(t)?t:new AY({message:`Failed to process error response`,cause:t,statusCode:s.status,url:e,responseHeaders:c,requestBodyValues:n.values})}throw t.value}try{return await r({response:s,url:e,requestBodyValues:n.values})}catch(t){throw t instanceof Error&&(W6(t)||AY.isInstance(t))?t:new AY({message:`Failed to process successful response`,cause:t,statusCode:s.status,url:e,responseHeaders:c,requestBodyValues:n.values})}}catch(t){throw J6({error:t,url:e,requestBodyValues:n.values})}};function a7(e){return e}function o7({id:e,inputSchema:t,outputSchema:n,supportsDeferredResults:r}){return({onInputStart:i,onInputDelta:a,onInputAvailable:o,...s})=>a7({type:`provider`,isProviderExecuted:!0,id:e,args:s,inputSchema:t,outputSchema:n,onInputStart:i,onInputDelta:a,onInputAvailable:o,supportsDeferredResults:r})}async function s7(e){return typeof e==`function`&&(e=e()),e}var c7=new TextDecoder;function l7({stream:e,url:t,requestBodyValues:n,statusCode:r,responseHeaders:i}){let a=e.getReader(),o=!1,s=()=>{o||=(a.releaseLock(),!0)};return new ReadableStream({async pull(e){try{let{done:t,value:n}=await a.read();t?(s(),e.close()):e.enqueue(n)}catch(a){if(s(),W6(a)){e.error(a);return}e.error(J6({error:new AY({message:`Failed to process successful response`,cause:a,statusCode:r,url:t,responseHeaders:i,requestBodyValues:n}),url:t,requestBodyValues:n}))}},async cancel(e){try{await a.cancel(e)}finally{s()}}})}async function u7({response:e,url:t}){return c7.decode(await T8({response:e,url:t}))}var d7=({errorSchema:e,errorToMessage:t,isRetryable:n})=>async({response:r,url:i,requestBodyValues:a})=>{let o=await u7({response:r,url:i}),s=H6(r);if(o.trim()===``)return{responseHeaders:s,value:new AY({message:r.statusText,url:i,requestBodyValues:a,statusCode:r.status,responseHeaders:s,responseBody:o,isRetryable:n?.(r)})};try{let c=await Q5({text:o,schema:e});return{responseHeaders:s,value:new AY({message:t(c),url:i,requestBodyValues:a,statusCode:r.status,responseHeaders:s,responseBody:o,data:c,isRetryable:n?.(r,c)})}}catch{return{responseHeaders:s,value:new AY({message:r.statusText,url:i,requestBodyValues:a,statusCode:r.status,responseHeaders:s,responseBody:o,isRetryable:n?.(r)})}}},f7=e=>async({response:t,url:n,requestBodyValues:r})=>{let i=H6(t);if(t.body==null)throw new PY({});return{responseHeaders:i,value:e7({stream:l7({stream:t.body,url:n,requestBodyValues:r,statusCode:t.status,responseHeaders:i}),schema:e})}},p7=e=>async({response:t,url:n,requestBodyValues:r})=>{let i=await u7({response:t,url:n}),a=await $5({text:i,schema:e}),o=H6(t);if(!a.success)throw new AY({message:`Invalid JSON response`,cause:a.error,statusCode:t.status,responseHeaders:o,responseBody:i,url:n,requestBodyValues:r});return{responseHeaders:o,value:a.value,rawValue:a.rawValue}},m7=e=>async({response:t})=>{let n=H6(t);if(t.body==null)throw new PY({});return{responseHeaders:n,value:h7({stream:t.body,schema:e})}};async function*h7({stream:e,schema:t}){let n=e.getReader(),r=new TextDecoder,i=``,a=!1;try{for(;;){let{done:e,value:o}=await n.read();if(e){a=!0,i+=r.decode();break}i+=r.decode(o,{stream:!0});let s=i.indexOf(`
163
+ `);for(;s!==-1;){let e=i.slice(0,s).replace(/\r$/,``);i=i.slice(s+1),e.trim().length>0&&(yield await Q5({text:e,schema:t})),s=i.indexOf(`
164
+ `)}}let e=i.replace(/\r$/,``);e.trim().length>0&&(yield await Q5({text:e,schema:t}))}finally{a||await n.cancel().catch(()=>{}),n.releaseLock()}}function g7(e){if(e==null)return!0;let t=typeof e;return t===`string`||t===`number`||t===`boolean`?!0:t===`function`||t===`symbol`||t===`bigint`?!1:Array.isArray(e)?e.every(g7):Object.getPrototypeOf(e)===Object.prototype&&Object.values(e).every(g7)}var _7=`AI_SerializationError`,v7=`vercel.ai.error.${_7}`,y7=Symbol.for(v7),b7=class extends EY{constructor({message:e=`Failed to serialize value.`,cause:t}={}){super({name:_7,message:e,cause:t}),this[y7]=!0}static isInstance(e){return EY.hasMarker(e,v7)}};function x7(e){let t={};for(let[n,r]of Object.entries(e.config))if(n===`headers`){let e=S7(r);g7(e)&&(t[n]=e)}else g7(r)&&(t[n]=r);return{modelId:e.modelId,config:t}}function S7(e){let t=e;if(typeof e==`function`&&(t=e()),t instanceof Promise)throw new b7({message:`Cannot serialize asynchronous model options.`});return t}var C7=`transcription-stream.start`,w7=`transcription-stream.audio-done`;function T7(e){let t;try{t=I8(e)}catch{return}if(typeof t!=`object`||!t||Array.isArray(t))return;let n=t;switch(n.type){case`stream-start`:return Array.isArray(n.warnings)&&n.warnings.every(k7)?n:void 0;case`transcript-delta`:return E7(n.delta)&&O7(n.id,E7)&&O7(n.providerMetadata,O8)?n:void 0;case`transcript-partial`:return E7(n.text)&&O7(n.id,E7)&&O7(n.startSecond,D7)&&O7(n.durationInSeconds,D7)&&O7(n.channelIndex,D7)&&O7(n.providerMetadata,O8)?n:void 0;case`transcript-final`:return E7(n.text)&&O7(n.id,E7)&&O7(n.startSecond,D7)&&O7(n.endSecond,D7)&&O7(n.channelIndex,D7)&&O7(n.providerMetadata,O8)?n:void 0;case`finish`:return E7(n.text)&&Array.isArray(n.segments)&&n.segments.every(A7)&&O7(n.language,E7)&&O7(n.durationInSeconds,D7)&&O7(n.usage,O8)&&O7(n.providerMetadata,O8)?n:void 0;case`response-metadata`:{if(!(O7(n.modelId,E7)&&O7(n.headers,O8)))return;let e=n.timestamp;if(e==null)return{...n,timestamp:void 0};if(typeof e!=`string`)return;let t=new Date(e);return Number.isNaN(t.getTime())?void 0:{...n,timestamp:t}}case`raw`:return`rawValue`in n?n:void 0;case`error`:return`error`in n?n:void 0;default:return}}function E7(e){return typeof e==`string`}function D7(e){return typeof e==`number`}function O7(e,t){return e===void 0||t(e)}function k7(e){return O8(e)&&E7(e.type)}function A7(e){return O8(e)&&E7(e.text)&&D7(e.startSecond)&&D7(e.endSecond)}function j7(e){return e?.replace(/\/$/,``)}var M7=n(((e,t)=>{var n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,o=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},s=(e,t,o,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of i(t))!a.call(e,c)&&c!==o&&n(e,c,{get:()=>t[c],enumerable:!(s=r(t,c))||s.enumerable});return e},c=e=>s(n({},`__esModule`,{value:!0}),e),l={};o(l,{SYMBOL_FOR_REQ_CONTEXT:()=>u,getContext:()=>d}),t.exports=c(l);var u=Symbol.for(`@vercel/request-context`);function d(){return globalThis[u]?.get?.()??{}}0&&(t.exports={SYMBOL_FOR_REQ_CONTEXT:u,getContext:d})})),N7=n(((e,t)=>{var n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,o=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},s=(e,t,o,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of i(t))!a.call(e,c)&&c!==o&&n(e,c,{get:()=>t[c],enumerable:!(s=r(t,c))||s.enumerable});return e},c=e=>s(n({},`__esModule`,{value:!0}),e),l={};o(l,{AccessTokenMissingError:()=>u,RefreshAccessTokenFailedError:()=>d}),t.exports=c(l);var u=class extends Error{constructor(){super(`No authentication found. Please log in with the Vercel CLI (vercel login).`),this.name=`AccessTokenMissingError`}},d=class extends Error{constructor(e){super(`Failed to refresh authentication token.`,{cause:e}),this.name=`RefreshAccessTokenFailedError`}};0&&(t.exports={AccessTokenMissingError:u,RefreshAccessTokenFailedError:d})})),P7=n(((e,t)=>{var n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,o=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},s=(e,t,o,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of i(t))!a.call(e,c)&&c!==o&&n(e,c,{get:()=>t[c],enumerable:!(s=r(t,c))||s.enumerable});return e},c=e=>s(n({},`__esModule`,{value:!0}),e),l={};o(l,{AccessTokenMissingError:()=>d.AccessTokenMissingError,RefreshAccessTokenFailedError:()=>d.RefreshAccessTokenFailedError,getContext:()=>u.getContext,getVercelOidcToken:()=>f,getVercelOidcTokenSync:()=>p,getVercelToken:()=>m}),t.exports=c(l);var u=M7(),d=N7();async function f(){return``}function p(){return``}async function m(){throw Error(`getVercelToken is not supported in browser environments`)}0&&(t.exports={AccessTokenMissingError,RefreshAccessTokenFailedError,getContext,getVercelOidcToken:f,getVercelOidcTokenSync:p,getVercelToken:m})}))(),F7=`ai-gateway-realtime.v1`,I7=`ai-gateway-transcription.v1`,L7=`ai-gateway-auth.`,R7=`ai-gateway-team.`;function z7(e,t){return V7(F7,e,t)}function B7(e,t){return V7(I7,e,t)}function V7(e,t,n){let r=[e,`${L7}${t}`];return n?.teamIdOrSlug&&r.push(`${R7}${H7(n.teamIdOrSlug)}`),r}function H7(e){let t=new TextEncoder().encode(e),n=``;for(let e of t)n+=String.fromCharCode(e);return btoa(n).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/u,``)}var $={any:C3,array:k3,boolean:y3,discriminatedUnion:F3,enum:V3,literal:U3,json:h6,number:h3,object:j3,record:z3,string:U4,union:N3,unknown:T3},U7=Symbol.for(`vercel.ai.gateway.error`),W7=class e extends Error{constructor({message:e,statusCode:t=500,cause:n,generationId:r,isRetryable:i=t!=null&&(t===408||t===409||t===429||t>=500)}){super(r?`${e} [${r}]`:e),this[U7]=!0,this.statusCode=t,this.cause=n,this.generationId=r,this.isRetryable=i}static isInstance(t){return e.hasMarker(t)}static hasMarker(e){return typeof e==`object`&&!!e&&U7 in e&&e[U7]===!0}},G7=`GatewayAuthenticationError`,K7=`vercel.ai.gateway.error.${G7}`,q7=Symbol.for(K7),J7=class e extends W7{constructor({message:e=`Authentication failed`,statusCode:t=401,cause:n,generationId:r}={}){super({message:e,statusCode:t,cause:n,generationId:r}),this[q7]=!0,this.name=G7,this.type=`authentication_error`}static isInstance(e){return W7.hasMarker(e)&&q7 in e}static createContextualError({apiKeyProvided:t,oidcTokenProvided:n,statusCode:r=401,cause:i,generationId:a}){let o;return o=t?`AI Gateway authentication failed: Invalid API key or token.
165
+
166
+ Create a new API key: https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai%2Fapi-keys
167
+
168
+ Provide an API key or Vercel access token via 'apiKey' option or 'AI_GATEWAY_API_KEY' environment variable.`:n?`AI Gateway authentication failed: Invalid OIDC token.
169
+
170
+ Run 'npx vercel link' to link your project, then 'vc env pull' to fetch the token.
171
+
172
+ Alternatively, use an API key: https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai%2Fapi-keys
173
+ or pass a Vercel access token via the 'apiKey' option.`:`AI Gateway authentication failed: No authentication provided.
174
+
175
+ Option 1 - API key:
176
+ Create an API key: https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai%2Fapi-keys
177
+ Provide via 'apiKey' option or 'AI_GATEWAY_API_KEY' environment variable.
178
+
179
+ Option 2 - Vercel access token:
180
+ Pass a Vercel personal access token or Vercel app access token via the 'apiKey' option.
181
+
182
+ Option 3 - OIDC token:
183
+ Run 'npx vercel link' to link your project, then 'vc env pull' to fetch the token.`,new e({message:o,statusCode:r,cause:i,generationId:a})}},Y7=`GatewayInvalidRequestError`,cte=`vercel.ai.gateway.error.${Y7}`,X7=Symbol.for(cte),lte=class extends W7{constructor({message:e=`Invalid request`,statusCode:t=400,cause:n,generationId:r}={}){super({message:e,statusCode:t,cause:n,generationId:r}),this[X7]=!0,this.name=Y7,this.type=`invalid_request_error`}static isInstance(e){return W7.hasMarker(e)&&X7 in e}},Z7=`GatewayRateLimitError`,ute=`vercel.ai.gateway.error.${Z7}`,Q7=Symbol.for(ute),dte=class extends W7{constructor({message:e=`Rate limit exceeded`,statusCode:t=429,cause:n,generationId:r}={}){super({message:e,statusCode:t,cause:n,generationId:r}),this[Q7]=!0,this.name=Z7,this.type=`rate_limit_exceeded`}static isInstance(e){return W7.hasMarker(e)&&Q7 in e}},$7=`GatewayModelNotFoundError`,fte=`vercel.ai.gateway.error.${$7}`,e9=Symbol.for(fte),pte=B5(()=>Y5($.object({modelId:$.string()}))),mte=class extends W7{constructor({message:e=`Model not found`,statusCode:t=404,modelId:n,cause:r,generationId:i}={}){super({message:e,statusCode:t,cause:r,generationId:i}),this[e9]=!0,this.name=$7,this.type=`model_not_found`,this.modelId=n}static isInstance(e){return W7.hasMarker(e)&&e9 in e}},t9=`GatewayNotFoundError`,hte=`vercel.ai.gateway.error.${t9}`,n9=Symbol.for(hte),gte=class extends W7{constructor({message:e=`Resource not found`,statusCode:t=404,cause:n,generationId:r}={}){super({message:e,statusCode:t,cause:n,generationId:r}),this[n9]=!0,this.name=t9,this.type=`not_found`}static isInstance(e){return W7.hasMarker(e)&&n9 in e}},r9=`GatewayInternalServerError`,_te=`vercel.ai.gateway.error.${r9}`,i9=Symbol.for(_te),a9=class extends W7{constructor({message:e=`Internal server error`,statusCode:t=500,cause:n,generationId:r}={}){super({message:e,statusCode:t,cause:n,generationId:r}),this[i9]=!0,this.name=r9,this.type=`internal_server_error`}static isInstance(e){return W7.hasMarker(e)&&i9 in e}},o9=`GatewayFailedDependencyError`,vte=`vercel.ai.gateway.error.${o9}`,s9=Symbol.for(vte),yte=class extends W7{constructor({message:e=`Failed dependency`,statusCode:t=424,cause:n,generationId:r}={}){super({message:e,statusCode:t,cause:n,generationId:r}),this[s9]=!0,this.name=o9,this.type=`failed_dependency`}static isInstance(e){return W7.hasMarker(e)&&s9 in e}},c9=`GatewayForbiddenError`,bte=`vercel.ai.gateway.error.${c9}`,l9=Symbol.for(bte),xte=B5(()=>Y5($.object({ruleId:$.string()}))),Ste=class extends W7{constructor({message:e=`Forbidden`,statusCode:t=403,cause:n,generationId:r,ruleId:i}={}){super({message:e,statusCode:t,cause:n,generationId:r}),this[l9]=!0,this.name=c9,this.type=`forbidden`,this.ruleId=i}static isInstance(e){return W7.hasMarker(e)&&l9 in e}},u9=`GatewayResponseError`,Cte=`vercel.ai.gateway.error.${u9}`,d9=Symbol.for(Cte),f9=class extends W7{constructor({message:e=`Invalid response from Gateway`,statusCode:t=502,response:n,validationError:r,cause:i,generationId:a,isRetryable:o}={}){super({message:e,statusCode:t,cause:i,generationId:a,isRetryable:o}),this[d9]=!0,this.name=u9,this.type=`response_error`,this.response=n,this.validationError=r}static isInstance(e){return W7.hasMarker(e)&&d9 in e}};async function p9({response:e,statusCode:t,defaultMessage:n=`Gateway request failed`,cause:r,authMethod:i,isRetryable:a}){let o=await Z5({value:e,schema:wte});if(!o.success){let i=typeof e==`object`&&e&&`generationId`in e?e.generationId:void 0;return new f9({message:`Invalid error response format: ${n}`,statusCode:t,response:e,validationError:o.error,cause:r,generationId:i,isRetryable:a})}let s=o.value,c=s.error.type,l=s.error.message,u=s.generationId??void 0;switch(c){case`authentication_error`:return J7.createContextualError({apiKeyProvided:i===`api-key`,oidcTokenProvided:i===`oidc`,statusCode:t,cause:r,generationId:u});case`invalid_request_error`:return new lte({message:l,statusCode:t,cause:r,generationId:u});case`rate_limit_exceeded`:return new dte({message:l,statusCode:t,cause:r,generationId:u});case`model_not_found`:{let e=await Z5({value:s.error.param,schema:pte});return new mte({message:l,statusCode:t,modelId:e.success?e.value.modelId:void 0,cause:r,generationId:u})}case`not_found`:return new gte({message:l,statusCode:t,cause:r,generationId:u});case`internal_server_error`:return new a9({message:l,statusCode:t,cause:r,generationId:u});case`failed_dependency`:return new yte({message:l,statusCode:t,cause:r,generationId:u});case`forbidden`:{let e=await Z5({value:s.error.param,schema:xte});return new Ste({message:l,statusCode:t,cause:r,generationId:u,ruleId:e.success?e.value.ruleId:void 0})}default:return new a9({message:l,statusCode:t,cause:r,generationId:u})}}var wte=B5(()=>Y5($.object({error:$.object({message:$.string(),type:$.string().nullish(),param:$.unknown().nullish(),code:$.union([$.string(),$.number()]).nullish()}),generationId:$.string().nullish()})));function Tte(e){if(e.data!==void 0)return e.data;if(e.responseBody!=null)try{return I8(e.responseBody)}catch{return e.responseBody}return{}}var m9=`GatewayTimeoutError`,Ete=`vercel.ai.gateway.error.${m9}`,h9=Symbol.for(Ete),g9=class e extends W7{constructor({message:e=`Request timed out`,statusCode:t=408,cause:n,generationId:r}={}){super({message:e,statusCode:t,cause:n,generationId:r}),this[h9]=!0,this.name=m9,this.type=`timeout_error`}static isInstance(e){return W7.hasMarker(e)&&h9 in e}static createTimeoutError({originalMessage:t,statusCode:n=408,cause:r,generationId:i}){let a=`Gateway request timed out: ${t}
184
+
185
+ This is a client-side timeout. To resolve this, increase your timeout configuration: https://vercel.com/docs/ai-gateway/capabilities/video-generation#extending-timeouts-for-node.js`;return new e({message:a,statusCode:n,cause:r,generationId:i})}};function _9(e){if(!(e instanceof Error))return!1;let t=e.code;return typeof t==`string`&&[`UND_ERR_HEADERS_TIMEOUT`,`UND_ERR_BODY_TIMEOUT`,`UND_ERR_CONNECT_TIMEOUT`].includes(t)}async function v9(e,t){return W7.isInstance(e)?e:_9(e)?g9.createTimeoutError({originalMessage:e instanceof Error?e.message:`Unknown error`,cause:e}):AY.isInstance(e)?e.cause&&_9(e.cause)?g9.createTimeoutError({originalMessage:e.message,cause:e}):await p9({response:Tte(e),statusCode:e.statusCode??500,defaultMessage:`Gateway request failed`,cause:e,authMethod:t,isRetryable:e.isRetryable&&(e.statusCode==null||e.statusCode<400)?!0:void 0}):await p9({response:{},statusCode:500,defaultMessage:e instanceof Error?`Gateway request failed: ${e.message}`:`Unknown Gateway error`,cause:e,authMethod:t})}var y9=`ai-gateway-auth-method`,b9=`x-vercel-ai-gateway-team`;async function x9(e){let t=await Z5({value:e[y9],schema:Dte});return t.success?t.value:void 0}var Dte=B5(()=>Y5($.union([$.literal(`api-key`),$.literal(`oidc`)]))),Ote=[`embedding`,`evaluation`,`image`,`language`,`realtime`,`reranking`,`speech`,`transcription`,`video`],S9=class{constructor(e){this.config=e}async getAvailableModels(){try{let{value:e}=await D8({url:`${this.config.baseURL}/config`,validateUrl:!1,headers:this.config.headers?await s7(this.config.headers):void 0,successfulResponseHandler:p7(Ate),failedResponseHandler:d7({errorSchema:$.any(),errorToMessage:e=>FY(e)??`unknown error`}),fetch:this.config.fetch});return e}catch(e){throw await v9(e)}}async getCredits(){try{let e=new URL(this.config.baseURL),t=this.config.headers?await s7(this.config.headers):void 0,n=new URL(`/v1/credits`,e.origin),r=kte(t);r&&n.searchParams.set(r.startsWith(`team_`)?`teamId`:`slug`,r);let{value:i}=await D8({url:n.toString(),validateUrl:!1,headers:t,successfulResponseHandler:p7(jte),failedResponseHandler:d7({errorSchema:$.any(),errorToMessage:e=>FY(e)??`unknown error`}),fetch:this.config.fetch});return i}catch(e){throw await v9(e)}}};function kte(e){if(e){for(let[t,n]of Object.entries(e))if(t.toLowerCase()===`x-vercel-ai-gateway-team`)return n?.trim()||void 0}}var Ate=B5(()=>Y5($.object({models:$.array($.object({id:$.string(),name:$.string(),description:$.string().nullish(),pricing:$.object({input:$.string(),output:$.string(),input_cache_read:$.string().nullish(),input_cache_write:$.string().nullish()}).transform(({input:e,output:t,input_cache_read:n,input_cache_write:r})=>({input:e,output:t,...n?{cachedInputTokens:n}:{},...r?{cacheCreationInputTokens:r}:{}})).nullish(),specification:$.object({specificationVersion:$.literal(`v4`),provider:$.string(),modelId:$.string()}),modelType:$.string().nullish()})).transform(e=>e.filter(e=>e.modelType==null||Ote.includes(e.modelType)))}))),jte=B5(()=>Y5($.object({balance:$.string(),total_used:$.string()}).transform(({balance:e,total_used:t})=>({balance:e,totalUsed:t})))),Mte=class{constructor(e){this.config=e}async getSpendReport(e){try{let t=new URL(this.config.baseURL),n=new URLSearchParams;n.set(`start_date`,e.startDate),n.set(`end_date`,e.endDate),e.groupBy&&n.set(`group_by`,e.groupBy),e.datePart&&n.set(`date_part`,e.datePart),e.userId&&n.set(`user_id`,e.userId),e.model&&n.set(`model`,e.model),e.provider&&n.set(`provider`,e.provider),e.credentialType&&n.set(`credential_type`,e.credentialType),e.tags&&e.tags.length>0&&n.set(`tags`,e.tags.join(`,`));let{value:r}=await D8({url:`${t.origin}/v1/report?${n.toString()}`,validateUrl:!1,headers:this.config.headers?await s7(this.config.headers):void 0,successfulResponseHandler:p7(Nte),failedResponseHandler:d7({errorSchema:$.any(),errorToMessage:e=>FY(e)??`unknown error`}),fetch:this.config.fetch});return r}catch(e){throw await v9(e)}}},Nte=B5(()=>Y5($.object({results:$.array($.object({day:$.string().optional(),hour:$.string().optional(),user:$.string().optional(),model:$.string().optional(),tag:$.string().optional(),provider:$.string().optional(),credential_type:$.enum([`byok`,`system`]).optional(),total_cost:$.number(),market_cost:$.number().optional(),input_tokens:$.number().optional(),output_tokens:$.number().optional(),cached_input_tokens:$.number().optional(),cache_creation_input_tokens:$.number().optional(),reasoning_tokens:$.number().optional(),request_count:$.number().optional()}).transform(({credential_type:e,total_cost:t,market_cost:n,input_tokens:r,output_tokens:i,cached_input_tokens:a,cache_creation_input_tokens:o,reasoning_tokens:s,request_count:c,...l})=>({...l,...e===void 0?{}:{credentialType:e},totalCost:t,...n===void 0?{}:{marketCost:n},...r===void 0?{}:{inputTokens:r},...i===void 0?{}:{outputTokens:i},...a===void 0?{}:{cachedInputTokens:a},...o===void 0?{}:{cacheCreationInputTokens:o},...s===void 0?{}:{reasoningTokens:s},...c===void 0?{}:{requestCount:c}})))}))),Pte=class{constructor(e){this.config=e}async getGenerationInfo(e){try{let{value:t}=await D8({url:`${new URL(this.config.baseURL).origin}/v1/generation?id=${encodeURIComponent(e.id)}`,validateUrl:!1,headers:this.config.headers?await s7(this.config.headers):void 0,successfulResponseHandler:p7(Fte),failedResponseHandler:d7({errorSchema:$.any(),errorToMessage:e=>FY(e)??`unknown error`}),fetch:this.config.fetch});return t}catch(e){throw await v9(e)}}},Fte=B5(()=>Y5($.object({data:$.object({id:$.string(),total_cost:$.number(),upstream_inference_cost:$.number(),usage:$.number(),created_at:$.string(),model:$.string(),is_byok:$.boolean(),provider_name:$.string(),streamed:$.boolean(),finish_reason:$.string(),latency:$.number(),generation_time:$.number(),native_tokens_prompt:$.number(),native_tokens_completion:$.number(),native_tokens_reasoning:$.number(),native_tokens_cached:$.number(),native_tokens_cache_creation:$.number(),billable_web_search_calls:$.number()}).transform(({total_cost:e,upstream_inference_cost:t,created_at:n,is_byok:r,provider_name:i,finish_reason:a,generation_time:o,native_tokens_prompt:s,native_tokens_completion:c,native_tokens_reasoning:l,native_tokens_cached:u,native_tokens_cache_creation:d,billable_web_search_calls:f,...p})=>({...p,totalCost:e,upstreamInferenceCost:t,createdAt:n,isByok:r,providerName:i,finishReason:a,generationTime:o,promptTokens:s,completionTokens:c,reasoningTokens:l,cachedTokens:u,cacheCreationTokens:d,billableWebSearchCalls:f}))}).transform(({data:e})=>e))),Ite=class{constructor(e){this.config=e,this.specificationVersion=`v4`,this.supportedUrls={"*/*":[/.*/]},this.provider=`${e.provider}.batch`}async doStartBatch({requests:e,providerOptions:t,headers:n,abortSignal:r,webhookUrl:i}){zte(e);let a=Rte(e),o=this.config.headers?await s7(this.config.headers):void 0,s=Bte(t),c=Vte(t);try{let{value:t}=await r7({url:this.getBatchUrl(`start`),headers:D6(o,n,{"ai-model-id":a},await s7(this.config.o11yHeaders),s==null?void 0:{"idempotency-key":s}),body:{...i!=null&&{callbackUrl:i},requests:e.map(e=>({id:e.id,type:e.type,modelId:e.modelId,options:Lte(e.options)})),...c!=null&&{providerOptions:c}},successfulResponseHandler:p7(qte),failedResponseHandler:d7({errorSchema:$.any(),errorToMessage:e=>FY(e)??`unknown error`}),...r&&{abortSignal:r},fetch:this.config.fetch});return{batchId:t.batchId,...T9(t),warnings:t.warnings??[]}}catch(e){throw w9(e)?e:await v9(e,await x9(o??{}))}}async doGetBatchStatus({batchId:e,headers:t,abortSignal:n}){let r=this.config.headers?await s7(this.config.headers):void 0;try{let{value:i}=await r7({url:this.getBatchUrl(`status`),headers:D6(r,t,await s7(this.config.o11yHeaders)),body:{batchId:e},successfulResponseHandler:p7(D9),failedResponseHandler:d7({errorSchema:$.any(),errorToMessage:e=>FY(e)??`unknown error`}),...n&&{abortSignal:n},fetch:this.config.fetch});return T9(i)}catch(e){throw w9(e)?e:await v9(e,await x9(r??{}))}}async doGetBatchResults({batchId:e,headers:t,abortSignal:n}){let r=this.config.headers?await s7(this.config.headers):void 0;try{let{value:i}=await r7({url:this.getBatchUrl(`results`),headers:D6(r,t,await s7(this.config.o11yHeaders)),body:{batchId:e},successfulResponseHandler:m7(Ute),failedResponseHandler:d7({errorSchema:$.any(),errorToMessage:e=>FY(e)??`unknown error`}),...n&&{abortSignal:n},fetch:this.config.fetch});return L6(Hte(i))}catch(e){throw w9(e)?e:await v9(e,await x9(r??{}))}}async doCancelBatch({batchId:e,headers:t,abortSignal:n}){let r=this.config.headers?await s7(this.config.headers):void 0;try{let{value:i}=await r7({url:this.getBatchUrl(`cancel`),headers:D6(r,t,await s7(this.config.o11yHeaders)),body:{batchId:e},successfulResponseHandler:p7(D9),failedResponseHandler:d7({errorSchema:$.any(),errorToMessage:e=>FY(e)??`unknown error`}),...n&&{abortSignal:n},fetch:this.config.fetch});return{...i.providerMetadata!=null&&{providerMetadata:i.providerMetadata}}}catch(e){throw w9(e)?e:await v9(e,await x9(r??{}))}}getBatchUrl(e){return`${this.config.baseURL}/batch/${e}`}};function Lte(e){for(let t of e.prompt)if(Array.isArray(t.content)){for(let e of t.content)if(e.type===`file`||e.type===`reasoning-file`)e.data=C9(e.data);else if(e.type===`tool-result`&&e.output.type===`content`)for(let t of e.output.value)t.type===`file`&&(t.data=C9(t.data))}return e}function C9(e){if(e.type===`data`){let t=e.data;if(t instanceof Uint8Array)return{...e,data:Buffer.from(t).toString(`base64`)}}return e}function Rte(e){let t=e[0]?.modelId;if(t==null)throw new zY({argument:`requests`,message:`The AI Gateway Batch API requires at least one request.`});for(let n of e)if(n.modelId!==t)throw new zY({argument:`requests`,message:`The AI Gateway Batch API requires all requests in a batch to use the same model. Found "${t}" and "${n.modelId}".`});return t}function zte(e){for(let t of e){let e=t.type;if(e!==`text`)throw new ZY({functionality:`batch request type: ${e}`,message:`The AI Gateway Batch API does not support batch requests with type "${e}".`})}}function Bte(e){let t=e?.gateway;if(typeof t!=`object`||!t||Array.isArray(t))return;let n=t.idempotencyKey;return typeof n==`string`&&n.length>0?n:void 0}function Vte(e){let t=e?.gateway;if(typeof t!=`object`||!t||Array.isArray(t)||!(`idempotencyKey`in t))return e;let{idempotencyKey:n,...r}=t,i={...e};if(Object.keys(r).length===0?delete i.gateway:i.gateway=r,Object.keys(i).length!==0)return i}function w9(e){return e instanceof Error||e instanceof DOMException?e.name===`AbortError`||e.name===`TimeoutError`:!1}function T9(e){let t=A8({total:e.requestCounts?.total,pending:e.requestCounts?.pending,completed:e.requestCounts?.completed,failed:e.requestCounts?.failed});return{status:e.status,...e.rawStatus!=null&&{rawStatus:e.rawStatus},...t!=null&&{requestCounts:t},...e.error!=null&&{error:{message:e.error.message,...e.error.type!=null&&{type:e.error.type},...e.error.code!=null&&{code:e.error.code},...e.error.statusCode!=null&&{statusCode:e.error.statusCode}}},...e.createdAt!=null&&{createdAt:e.createdAt},...e.expiresAt!=null&&{expiresAt:e.expiresAt},...e.providerMetadata!=null&&{providerMetadata:e.providerMetadata}}}async function*Hte(e){for await(let t of e){let e=t;if(e.status===`succeeded`){let t=e.result?.response;t!==void 0&&typeof t.timestamp==`string`&&(t.timestamp=new Date(t.timestamp))}yield e}}var Ute=$.object({type:$.literal(`text`),id:$.string(),status:$.enum([`cancelled`,`expired`,`failed`,`succeeded`])}).catchall($.unknown()),Wte=$.object({message:$.string(),type:$.string().nullish(),code:$.string().nullish(),statusCode:$.number().nullish()}),Gte=$.object({total:$.number().nullish(),pending:$.number().nullish(),completed:$.number().nullish(),failed:$.number().nullish()}),Kte=$.record($.string(),$.record($.string(),$.unknown())),E9=$.object({status:$.enum([`completed`,`failed`,`pending`]),rawStatus:$.string().nullish(),requestCounts:Gte.nullish(),error:Wte.nullish(),createdAt:$.string().nullish(),expiresAt:$.string().nullish(),providerMetadata:Kte.nullish()}),qte=E9.extend({batchId:$.string(),warnings:$.array($.object({requestId:$.string().nullish(),warning:$.unknown()}).catchall($.unknown())).nullish()}),D9=E9,Jte=class e{static[T6](e){return x7({modelId:e.modelId,config:e.config})}static[E6](t){return new e(t.modelId,t.config)}constructor(e,t){this.modelId=e,this.config=t,this.specificationVersion=`v4`,this.supportedUrls={"*/*":[/.*/]}}get provider(){return this.config.provider}async getArgs(e){let{abortSignal:t,...n}=e;return{args:this.maybeEncodeFileParts(n),warnings:[]}}async doGenerate(e){let{args:t,warnings:n}=await this.getArgs(e),{abortSignal:r}=e,i=this.config.headers?await s7(this.config.headers):void 0;try{let{responseHeaders:a,value:o,rawValue:s}=await r7({url:this.getUrl(),headers:D6(i,e.headers,this.getModelConfigHeaders(this.modelId,!1),await s7(this.config.o11yHeaders)),body:t,successfulResponseHandler:p7($.any()),failedResponseHandler:d7({errorSchema:$.any(),errorToMessage:e=>FY(e)??`unknown error`}),...r&&{abortSignal:r},fetch:this.config.fetch});return{...o,request:{body:t},response:{headers:a,body:s},warnings:[...o.warnings??[],...n]}}catch(e){throw await v9(e,await x9(i??{}))}}async doStream(e){let{args:t,warnings:n}=await this.getArgs(e),{abortSignal:r}=e,i=this.config.headers?await s7(this.config.headers):void 0;try{let{value:a,responseHeaders:o}=await r7({url:this.getUrl(),headers:D6(i,e.headers,this.getModelConfigHeaders(this.modelId,!0),await s7(this.config.o11yHeaders)),body:t,successfulResponseHandler:f7($.any()),failedResponseHandler:d7({errorSchema:$.any(),errorToMessage:e=>FY(e)??`unknown error`}),...r&&{abortSignal:r},fetch:this.config.fetch});return{stream:a.pipeThrough(new TransformStream({start(e){n.length>0&&e.enqueue({type:`stream-start`,warnings:n})},transform(t,n){if(t.success){let r=t.value;if(r.type===`raw`&&!e.includeRawChunks)return;r.type===`response-metadata`&&r.timestamp&&typeof r.timestamp==`string`&&(r.timestamp=new Date(r.timestamp)),n.enqueue(r)}else n.error(t.error)}})),request:{body:t},response:{headers:o}}}catch(e){throw await v9(e,await x9(i??{}))}}maybeEncodeFileParts(e){for(let t of e.prompt)if(Array.isArray(t.content)){for(let e of t.content)if(e.type===`file`||e.type===`reasoning-file`)e.data=O9(e.data);else if(e.type===`tool-result`&&e.output.type===`content`)for(let t of e.output.value)t.type===`file`&&(t.data=O9(t.data))}return e}getUrl(){return`${this.config.baseURL}/language-model`}getModelConfigHeaders(e,t){return{"ai-language-model-specification-version":`4`,"ai-language-model-id":e,"ai-language-model-streaming":String(t)}}};function O9(e){if(e.type===`data`){let t=e.data;if(t instanceof Uint8Array)return{...e,data:Buffer.from(t).toString(`base64`)}}return e}var Yte=class e{static[T6](e){return x7({modelId:e.modelId,config:e.config})}static[E6](t){return new e(t.modelId,t.config)}constructor(e,t){this.modelId=e,this.config=t,this.specificationVersion=`v4`,this.maxEmbeddingsPerCall=2048,this.supportsParallelCalls=!0}get provider(){return this.config.provider}async doEmbed({values:e,headers:t,abortSignal:n,providerOptions:r}){let i=this.config.headers?await s7(this.config.headers):void 0;try{let{responseHeaders:a,value:o,rawValue:s}=await r7({url:this.getUrl(),headers:D6(i,t??{},this.getModelConfigHeaders(),await s7(this.config.o11yHeaders)),body:{values:e,...r?{providerOptions:r}:{}},successfulResponseHandler:p7(Zte),failedResponseHandler:d7({errorSchema:$.any(),errorToMessage:e=>FY(e)??`unknown error`}),...n&&{abortSignal:n},fetch:this.config.fetch});return{embeddings:o.embeddings,usage:o.usage??void 0,providerMetadata:o.providerMetadata,response:{headers:a,body:s},warnings:o.warnings??[]}}catch(e){throw await v9(e,await x9(i??{}))}}getUrl(){return`${this.config.baseURL}/embedding-model`}getModelConfigHeaders(){return{"ai-embedding-model-specification-version":`4`,"ai-model-id":this.modelId}}},Xte=$.discriminatedUnion(`type`,[$.object({type:$.literal(`unsupported`),feature:$.string(),details:$.string().optional()}),$.object({type:$.literal(`compatibility`),feature:$.string(),details:$.string().optional()}),$.object({type:$.literal(`deprecated`),setting:$.string(),message:$.string()}),$.object({type:$.literal(`other`),message:$.string()})]),Zte=B5(()=>Y5($.object({embeddings:$.array($.array($.number())),usage:$.object({tokens:$.number()}).nullish(),warnings:$.array(Xte).optional(),providerMetadata:$.record($.string(),$.record($.string(),$.unknown())).optional()}))),Qte=class e{static[T6](e){return x7({modelId:e.modelId,config:e.config})}static[E6](t){return new e(t.modelId,t.config)}constructor(e,t){this.modelId=e,this.config=t,this.specificationVersion=`v4`,this.maxImagesPerCall=2**53-1}get provider(){return this.config.provider}async doGenerate({prompt:e,n:t,size:n,aspectRatio:r,seed:i,files:a,mask:o,providerOptions:s,headers:c,abortSignal:l}){let u=this.config.headers?await s7(this.config.headers):void 0;try{let{responseHeaders:d,value:f}=await r7({url:this.getUrl(),headers:D6(u,c??{},this.getModelConfigHeaders(),await s7(this.config.o11yHeaders)),body:{prompt:e,n:t,...n&&{size:n},...r&&{aspectRatio:r},...i&&{seed:i},...s&&{providerOptions:s},...a&&{files:a.map(e=>k9(e))},...o&&{mask:k9(o)}},successfulResponseHandler:p7(nne),failedResponseHandler:d7({errorSchema:$.any(),errorToMessage:e=>FY(e)??`unknown error`}),...l&&{abortSignal:l},fetch:this.config.fetch});return{images:f.images,...f.isRetryable!=null&&{isRetryable:f.isRetryable},warnings:f.warnings??[],providerMetadata:f.providerMetadata,response:{timestamp:new Date,modelId:this.modelId,headers:d},...f.usage!=null&&{usage:{inputTokens:f.usage.inputTokens??void 0,outputTokens:f.usage.outputTokens??void 0,totalTokens:f.usage.totalTokens??void 0}}}}catch(e){throw await v9(e,await x9(u??{}))}}getUrl(){return`${this.config.baseURL}/image-model`}getModelConfigHeaders(){return{"ai-image-model-specification-version":`4`,"ai-model-id":this.modelId}}};function k9(e){return e.type===`file`&&e.data instanceof Uint8Array?{...e,data:V6(e.data)}:e}var $te=$.object({images:$.array($.unknown()).optional()}).catchall($.unknown()),ene=$.discriminatedUnion(`type`,[$.object({type:$.literal(`unsupported`),feature:$.string(),details:$.string().optional()}),$.object({type:$.literal(`compatibility`),feature:$.string(),details:$.string().optional()}),$.object({type:$.literal(`deprecated`),setting:$.string(),message:$.string()}),$.object({type:$.literal(`other`),message:$.string()})]),tne=$.object({inputTokens:$.number().nullish(),outputTokens:$.number().nullish(),totalTokens:$.number().nullish()}),nne=$.object({images:$.array($.string()),isRetryable:$.boolean().optional(),warnings:$.array(ene).optional(),providerMetadata:$.record($.string(),$te).optional(),usage:tne.optional()}),rne=class{constructor(e,t){this.modelId=e,this.config=t,this.specificationVersion=`v4`,this.maxVideosPerCall=2**53-1}get provider(){return this.config.provider}async doGenerate(e){let{headers:t,abortSignal:n}=e,r=this.config.headers?await s7(this.config.headers):void 0;try{let{responseHeaders:i,value:a}=await r7({url:this.getUrl(),headers:D6(r,t??{},this.getModelConfigHeaders(),await s7(this.config.o11yHeaders),{accept:`text/event-stream`}),body:this.buildRequestBody(e),successfulResponseHandler:async({response:e,url:t,requestBodyValues:n})=>{if(e.body==null)throw new AY({message:`SSE response body is empty`,url:t,requestBodyValues:n,statusCode:e.status});let r=e7({stream:e.body,schema:ine}).getReader(),{done:i,value:a}=await r.read();if(r.releaseLock(),i||!a)throw new AY({message:`SSE stream ended without a data event`,url:t,requestBodyValues:n,statusCode:e.status});if(!a.success)throw new AY({message:`Failed to parse video SSE event`,cause:a.error,url:t,requestBodyValues:n,statusCode:e.status});let o=a.value;if(o.type===`error`)throw new AY({message:o.message,statusCode:o.statusCode,url:t,requestBodyValues:n,responseHeaders:Object.fromEntries([...e.headers]),responseBody:JSON.stringify(o),data:{error:{message:o.message,type:o.errorType,param:o.param}}});return{value:{videos:o.videos,warnings:o.warnings,providerMetadata:o.providerMetadata},responseHeaders:Object.fromEntries([...e.headers])}},failedResponseHandler:d7({errorSchema:$.any(),errorToMessage:e=>FY(e)??`unknown error`}),...n&&{abortSignal:n},fetch:this.config.fetch});return{videos:a.videos,warnings:a.warnings??[],providerMetadata:a.providerMetadata??void 0,response:{timestamp:new Date,modelId:this.modelId,headers:i}}}catch(e){throw await v9(e,await x9(r??{}))}}async handleWebhookOption({webhook:e}){let{url:t,received:n}=await e();return{webhookUrl:t,received:n}}async doStart(e){let{headers:t,abortSignal:n,webhookUrl:r}=e,i=this.config.headers?await s7(this.config.headers):void 0;try{let{responseHeaders:a,value:o}=await r7({url:this.getStartUrl(),headers:D6(i,t??{},this.getModelConfigHeaders(),await s7(this.config.o11yHeaders)),body:{...this.buildRequestBody(e),...r&&{callbackUrl:r}},successfulResponseHandler:p7(ane),failedResponseHandler:d7({errorSchema:$.any(),errorToMessage:e=>FY(e)??`unknown error`}),...n&&{abortSignal:n},fetch:this.config.fetch});return{operation:o.operation,warnings:o.warnings??[],providerMetadata:o.providerMetadata??void 0,response:{timestamp:new Date,modelId:this.modelId,headers:a}}}catch(e){throw await v9(e,await x9(i??{}))}}async doStatus({operation:e,abortSignal:t,headers:n}){let r=this.config.headers?await s7(this.config.headers):void 0;try{let{responseHeaders:i,value:a}=await r7({url:this.getStatusUrl(),headers:D6(r,n??{},this.getModelConfigHeaders(),await s7(this.config.o11yHeaders)),body:{operation:e},successfulResponseHandler:p7(one),failedResponseHandler:d7({errorSchema:$.any(),errorToMessage:e=>FY(e)??`unknown error`}),...t&&{abortSignal:t},fetch:this.config.fetch}),o={timestamp:new Date,modelId:this.modelId,headers:i};return a.status===`completed`?{status:`completed`,videos:a.videos,warnings:a.warnings??[],providerMetadata:a.providerMetadata??void 0,response:o}:a.status===`error`?{status:`error`,error:a.error,providerMetadata:a.providerMetadata??void 0,response:o}:a.status===`cancelled`?{status:`error`,error:`Video generation was cancelled.`,providerMetadata:a.providerMetadata??void 0,response:o}:{status:`pending`,warnings:a.warnings??[],providerMetadata:a.providerMetadata??void 0,response:o}}catch(e){throw await v9(e,await x9(r??{}))}}buildRequestBody({prompt:e,n:t,aspectRatio:n,resolution:r,duration:i,fps:a,seed:o,generateAudio:s,image:c,frameImages:l,inputReferences:u,providerOptions:d}){return{prompt:e,n:t,...n&&{aspectRatio:n},...r&&{resolution:r},...i&&{duration:i},...a&&{fps:a},...o&&{seed:o},...s!==void 0&&{generateAudio:s},...d&&{providerOptions:d},...c&&{image:A9(c)},...l&&{frameImages:l.map(e=>({...e,image:A9(e.image)}))},...u&&{inputReferences:u.map(e=>A9(e))}}}getUrl(){return`${this.config.baseURL}/video-model`}getStartUrl(){return`${this.config.baseURL}/video-model/start`}getStatusUrl(){return`${this.config.baseURL}/video-model/status`}getModelConfigHeaders(){return{"ai-video-model-specification-version":`4`,"ai-model-id":this.modelId}}};function A9(e){return e.type===`file`&&e.data instanceof Uint8Array?{...e,data:V6(e.data)}:e}var j9=$.object({videos:$.array($.unknown()).optional()}).catchall($.unknown()),M9=$.union([$.object({type:$.literal(`url`),url:$.string(),mediaType:$.string()}),$.object({type:$.literal(`base64`),data:$.string(),mediaType:$.string()})]),N9=$.discriminatedUnion(`type`,[$.object({type:$.literal(`unsupported`),feature:$.string(),details:$.string().optional()}),$.object({type:$.literal(`compatibility`),feature:$.string(),details:$.string().optional()}),$.object({type:$.literal(`deprecated`),setting:$.string(),message:$.string()}),$.object({type:$.literal(`other`),message:$.string()})]),ine=$.discriminatedUnion(`type`,[$.object({type:$.literal(`result`),videos:$.array(M9),warnings:$.array(N9).optional(),providerMetadata:$.record($.string(),j9).optional()}),$.object({type:$.literal(`error`),message:$.string(),errorType:$.string(),statusCode:$.number(),param:$.unknown().nullable()})]),ane=$.object({operation:$.unknown(),warnings:$.array(N9).nullish(),providerMetadata:$.record($.string(),j9).nullish()}),one=$.discriminatedUnion(`status`,[$.object({status:$.literal(`pending`),warnings:$.array(N9).nullish(),providerMetadata:$.record($.string(),j9).nullish()}),$.object({status:$.literal(`completed`),videos:$.array(M9),warnings:$.array(N9).nullish(),providerMetadata:$.record($.string(),j9).nullish()}),$.object({status:$.literal(`error`),error:$.string(),providerMetadata:$.record($.string(),j9).nullish()}),$.object({status:$.literal(`cancelled`),providerMetadata:$.record($.string(),j9).nullish()})]),sne=B5(()=>Y5($.object({models:une.optional()}).catchall($.unknown()))),P9=$.number().finite().min(0).max(1),F9=$.string().min(1).max(256),I9=$.union([$.object({question:F9.optional(),confidenceBelow:P9}).strict(),$.object({question:F9.optional(),probabilityBetween:$.array(P9).length(2).refine(([e,t])=>e<=t,{message:`probabilityBetween minimum must be less than or equal to maximum`})}).strict()]),cne=$.union([$.object({any:$.unknown()}),$.object({all:$.unknown()}),$.object({atLeast:$.unknown()})]).superRefine((e,t)=>{t.addIssue({code:`custom`,message:`conditions can be nested at most 5 levels deep`})}),lne=$.object({model:$.string().min(1),when:L9(1)}).strict(),une=$.array($.union([$.string(),lne])).superRefine((e,t)=>{let n=e.flatMap((e,t)=>typeof e==`string`?[]:[t]);n.length>1&&t.addIssue({code:`custom`,message:`models supports at most one conditional evaluation fallback`}),n[0]!==void 0&&n[0]!==0&&t.addIssue({code:`custom`,message:`a conditional evaluation fallback must be the first models entry`,path:[n[0]]})});function L9(e){if(e===5)return $.union([I9,cne]);let t=L9(e+1),n=$.array(t).min(1).max(20);return $.union([I9,$.object({any:n}).strict(),$.object({all:n}).strict(),$.object({atLeast:$.object({count:$.number().int().min(1),conditions:n}).strict().refine(({count:e,conditions:t})=>e<=t.length,{message:`atLeast count cannot exceed the number of conditions`,path:[`count`]})}).strict()])}var dne=class{constructor(e,t){this.modelId=e,this.config=t,this.specificationVersion=`v4`,this.supportedQuestionTypes=[`choice`,`score`,`boolean`]}get provider(){return this.config.provider}async doEvaluate({state:e,questions:t,headers:n,abortSignal:r,providerOptions:i}){let a=await t7({provider:`gateway`,providerOptions:i,schema:sne}),o=a==null?i:{...i,gateway:a},s=this.config.headers?await s7(this.config.headers):void 0;try{let{responseHeaders:i,value:a,rawValue:c}=await r7({url:this.getUrl(),headers:D6(s,n??{},this.getModelConfigHeaders(),await s7(this.config.o11yHeaders)),body:{state:e,questions:t,...o?{providerOptions:o}:{}},successfulResponseHandler:p7(mne),failedResponseHandler:d7({errorSchema:$.any(),errorToMessage:e=>FY(e)??`unknown error`}),...r&&{abortSignal:r},fetch:this.config.fetch});return{answers:a.answers,...a.rounding?{rounding:a.rounding}:{},...a.usage?{usage:a.usage}:{},warnings:a.warnings??[],providerMetadata:a.providerMetadata,response:{modelId:a.model??this.modelId,headers:i,body:c}}}catch(e){throw await v9(e,await x9(s??{}))}}getUrl(){return`${this.config.baseURL}/evaluation-model`}getModelConfigHeaders(){return{"ai-evaluation-model-specification-version":`4`,"ai-model-id":this.modelId}}},fne=$.discriminatedUnion(`type`,[$.object({type:$.literal(`choice`),choice:$.string(),probabilities:$.record($.string(),$.number()).optional()}),$.object({type:$.literal(`score`),score:$.number(),probabilities:$.record($.string(),$.number()).optional()}),$.object({type:$.literal(`boolean`),probability:$.number()})]),pne=$.discriminatedUnion(`type`,[$.object({type:$.literal(`unsupported`),feature:$.string(),details:$.string().optional()}),$.object({type:$.literal(`compatibility`),feature:$.string(),details:$.string().optional()}),$.object({type:$.literal(`deprecated`),setting:$.string(),message:$.string()}),$.object({type:$.literal(`other`),message:$.string()})]),mne=B5(()=>Y5($.object({answers:$.record($.string(),fne),model:$.string().optional(),rounding:$.object({probabilityDecimals:$.number().optional(),scoreDecimals:$.number().optional()}).optional(),usage:$.object({inputTokens:$.number().optional(),outputTokens:$.number().optional()}).optional(),warnings:$.array(pne).optional(),providerMetadata:$.record($.string(),$.record($.string(),$.unknown())).optional()}))),hne=class{constructor(e,t){this.modelId=e,this.config=t,this.specificationVersion=`v4`}get provider(){return this.config.provider}async doRerank({documents:e,query:t,topN:n,headers:r,abortSignal:i,providerOptions:a}){let o=this.config.headers?await s7(this.config.headers):void 0;try{let{responseHeaders:s,value:c,rawValue:l}=await r7({url:this.getUrl(),headers:D6(o,r??{},this.getModelConfigHeaders(),await s7(this.config.o11yHeaders)),body:{documents:e,query:t,...n==null?{}:{topN:n},...a?{providerOptions:a}:{}},successfulResponseHandler:p7(_ne),failedResponseHandler:d7({errorSchema:$.any(),errorToMessage:e=>FY(e)??`unknown error`}),...i&&{abortSignal:i},fetch:this.config.fetch});return{ranking:c.ranking,providerMetadata:c.providerMetadata,response:{headers:s,body:l},warnings:c.warnings??[]}}catch(e){throw await v9(e,await x9(o??{}))}}getUrl(){return`${this.config.baseURL}/reranking-model`}getModelConfigHeaders(){return{"ai-reranking-model-specification-version":`4`,"ai-model-id":this.modelId}}},gne=$.discriminatedUnion(`type`,[$.object({type:$.literal(`unsupported`),feature:$.string(),details:$.string().optional()}),$.object({type:$.literal(`compatibility`),feature:$.string(),details:$.string().optional()}),$.object({type:$.literal(`deprecated`),setting:$.string(),message:$.string()}),$.object({type:$.literal(`other`),message:$.string()})]),_ne=B5(()=>Y5($.object({ranking:$.array($.object({index:$.number(),relevanceScore:$.number()})),warnings:$.array(gne).optional(),providerMetadata:$.record($.string(),$.record($.string(),$.unknown())).optional()}))),vne=class{constructor(e,t){this.modelId=e,this.config=t,this.specificationVersion=`v4`}get provider(){return this.config.provider}async doGenerate({text:e,voice:t,outputFormat:n,instructions:r,speed:i,language:a,providerOptions:o,headers:s,abortSignal:c}){let l=this.config.headers?await s7(this.config.headers):void 0;try{let{responseHeaders:u,value:d,rawValue:f}=await r7({url:this.getUrl(),headers:D6(l,s??{},this.getModelConfigHeaders(),await s7(this.config.o11yHeaders)),body:{text:e,...t&&{voice:t},...n&&{outputFormat:n},...r&&{instructions:r},...i!=null&&{speed:i},...a&&{language:a},...o&&{providerOptions:o}},successfulResponseHandler:p7(xne),failedResponseHandler:d7({errorSchema:$.any(),errorToMessage:e=>FY(e)??`unknown error`}),...c&&{abortSignal:c},fetch:this.config.fetch});return{audio:d.audio,warnings:d.warnings??[],...d.usage!=null&&{usage:d.usage},providerMetadata:d.providerMetadata,response:{timestamp:new Date,modelId:this.modelId,headers:u,body:f}}}catch(e){throw await v9(e,await x9(l??{}))}}getUrl(){return`${this.config.baseURL}/speech-model`}getModelConfigHeaders(){return{"ai-speech-model-specification-version":`4`,"ai-model-id":this.modelId}}},yne=$.object({}).catchall($.unknown()),bne=$.discriminatedUnion(`type`,[$.object({type:$.literal(`unsupported`),feature:$.string(),details:$.string().optional()}),$.object({type:$.literal(`compatibility`),feature:$.string(),details:$.string().optional()}),$.object({type:$.literal(`deprecated`),setting:$.string(),message:$.string()}),$.object({type:$.literal(`other`),message:$.string()})]),xne=$.object({audio:$.string(),warnings:$.array(bne).optional(),usage:$.record($.string(),$.json()).optional(),providerMetadata:$.record($.string(),yne).optional()}),Sne=class{constructor(e,t){this.modelId=e,this.config=t,this.specificationVersion=`v4`}get provider(){return this.config.provider}async doGenerate({audio:e,mediaType:t,providerOptions:n,headers:r,abortSignal:i}){let a=this.config.headers?await s7(this.config.headers):void 0;try{let{responseHeaders:o,value:s,rawValue:c}=await r7({url:this.getUrl(),headers:D6(a,r??{},this.getModelConfigHeaders(),await s7(this.config.o11yHeaders)),body:{audio:e instanceof Uint8Array?V6(e):e,mediaType:t,...n&&{providerOptions:n}},successfulResponseHandler:p7(Dne),failedResponseHandler:d7({errorSchema:$.any(),errorToMessage:e=>FY(e)??`unknown error`}),...i&&{abortSignal:i},fetch:this.config.fetch});return{text:s.text,segments:s.segments??[],language:s.language??void 0,durationInSeconds:s.durationInSeconds??void 0,warnings:s.warnings??[],...s.usage!=null&&{usage:s.usage},providerMetadata:s.providerMetadata,response:{timestamp:new Date,modelId:this.modelId,headers:o,body:c}}}catch(e){throw await v9(e,await x9(a??{}))}}async doStream(e){let t=this.config._internal?.currentDate?.()??new Date,n=D6(await s7(this.config.headers??{}),e.headers??{},this.getModelConfigHeaders(),await s7(this.config.o11yHeaders)),r=await x9(n),i={type:C7,inputAudioFormat:e.inputAudioFormat,...e.providerOptions!=null&&{providerOptions:e.providerOptions},...e.includeRawChunks!=null&&{includeRawChunks:e.includeRawChunks}};return{stream:wne({webSocket:this.config.webSocket,url:R9(this.config.baseURL,this.modelId),protocols:Cne(n),headers:n,startFrame:i,audio:e.audio,abortSignal:e.abortSignal,authMethod:r}),request:{body:i},response:{timestamp:t,modelId:this.modelId}}}getUrl(){return`${this.config.baseURL}/transcription-model`}getModelConfigHeaders(){return{"ai-transcription-model-specification-version":`4`,"ai-model-id":this.modelId}}};function R9(e,t){let n=new URL(`${e.replace(/^http/,`ws`)}/transcription-model`);return n.searchParams.set(`ai-model-id`,t),n.toString()}function Cne(e){let t=X6(e),n=t.authorization,r=n?.startsWith(`Bearer `)?n.slice(7):void 0;return r==null?[I7]:B7(r,{teamIdOrSlug:t[b9]})}var z9=65536;function wne({webSocket:e,url:t,protocols:n,headers:r,startFrame:i,audio:a,abortSignal:o,authMethod:s}){let c=!1,l=()=>{};return new ReadableStream({start:u=>{let d,f=!1,p,m=!1,h;l=e=>{d==null?a.cancel().catch(()=>{}):d.cancel().catch(()=>{}),h?.close(e)};let g=()=>{m=!0,d==null?a.cancel().catch(()=>{}):(d.cancel().catch(()=>{}),d=void 0)},_=e=>{c||(c=!0,l(),One(u,e,s))},v=async e=>{let t=a.getReader();d=t;try{for(;;){let{done:n,value:r}=await t.read();if(n||c)break;let i=typeof r==`string`?B6(r):r;for(let t=0;t<i.length&&!c;t+=z9)e.send(i.subarray(t,t+z9)),await F6(e)}}finally{t.releaseLock(),d===t&&(d=void 0)}!c&&!m&&e.send(JSON.stringify({type:w7}))};h=I6({url:t,protocols:n,headers:r,webSocket:e,abortSignal:o,onAbort:e=>{c||(c=!0,l(),u.error(e))},onProcessingError:_,onOpen:e=>{e.send(JSON.stringify(i)),v(e).catch(_)},onMessageText:e=>{if(c)return;let t=T7(e);if(t!=null){if(t.type===`finish`){c=!0,u.enqueue(t),u.close(),l(1e3);return}t.type===`error`&&(f=!0,p=t.error,g()),u.enqueue(t)}},onSocketError:()=>{_(Error(`Connection error on AI Gateway transcription stream`))},onClose:()=>{if(f){if(c)return;Ane(p,s).then(_);return}_(Error(`AI Gateway transcription stream closed before a finish part was received`))}})},cancel:()=>{c||(c=!0,l())}})}var Tne=$.object({}).catchall($.unknown()),Ene=$.discriminatedUnion(`type`,[$.object({type:$.literal(`unsupported`),feature:$.string(),details:$.string().optional()}),$.object({type:$.literal(`compatibility`),feature:$.string(),details:$.string().optional()}),$.object({type:$.literal(`deprecated`),setting:$.string(),message:$.string()}),$.object({type:$.literal(`other`),message:$.string()})]),Dne=$.object({text:$.string(),segments:$.array($.object({text:$.string(),startSecond:$.number(),endSecond:$.number()})).optional(),language:$.string().nullish(),durationInSeconds:$.number().nullish(),warnings:$.array(Ene).optional(),usage:$.record($.string(),$.json()).optional(),providerMetadata:$.record($.string(),Tne).optional()});async function One(e,t,n){e.error(await v9(t,n))}function kne(e){return typeof e==`object`&&e&&`message`in e&&typeof e.message==`string`?e.message:FY(e)}var B9={authentication_error:401,failed_dependency:424,forbidden:403,internal_server_error:500,invalid_request_error:400,model_not_found:404,rate_limit_exceeded:429};async function Ane(e,t){return typeof e==`object`&&e&&`message`in e&&typeof e.message==`string`&&`type`in e&&typeof e.type==`string`&&e.type in B9?p9({response:{error:{message:e.message,type:e.type}},statusCode:B9[e.type],authMethod:t}):Error(`AI Gateway transcription stream failed: ${kne(e)}`)}var jne=class{constructor(e,t){this.specificationVersion=`v4`,this.modelId=e,this.provider=t.provider,this.config=t}async doCreateClientSecret(e){let t=await this.config.createClientSecret({modelId:this.modelId,...e?.expiresAfterSeconds!=null&&{expiresAfterSeconds:e.expiresAfterSeconds}});return{token:t.token,url:Mne(this.config.baseURL,this.modelId),...t.expiresAt!=null&&{expiresAt:t.expiresAt}}}getWebSocketConfig(e){return{url:e.url,protocols:z7(e.token,{teamIdOrSlug:this.config.teamIdOrSlug})}}parseServerEvent(e){return e}serializeClientEvent(e){return e}buildSessionConfig(e){return e}};function Mne(e,t){let n=new URL(`${e.replace(/^http/,`ws`)}/realtime-model`);return n.searchParams.set(`ai-model-id`,t),n.toString()}var V9=$.record($.string(),$.unknown()),Nne=o7({id:`gateway.browserbase_fetch`,inputSchema:B5(()=>Y5($.object({url:$.string().url().describe(`URL of the page to fetch.`),allow_redirects:$.boolean().optional().describe(`Whether to follow HTTP redirects (default: false).`),allow_insecure_ssl:$.boolean().optional().describe(`Whether to bypass TLS certificate verification (default: false). Only use for trusted hosts.`),proxies:$.boolean().optional().describe(`Whether to route the request through Browserbase proxies (default: false).`),format:$.enum([`raw`,`json`,`markdown`]).optional().describe(`Output format. raw returns the response body unchanged, markdown returns page content as Markdown, and json returns structured content using schema.`),schema:V9.optional().describe(`JSON Schema for structured extraction. Only use with format set to json.`)}))),outputSchema:B5(()=>Y5($.union([$.object({id:$.string(),content:$.union([$.string(),V9]),contentType:$.string(),encoding:$.string(),headers:$.record($.string(),$.string()),statusCode:$.number()}),$.object({error:$.enum([`api_error`,`configuration_error`,`execution_error`,`invalid_input`,`rate_limit`,`timeout`,`unknown`]),statusCode:$.number().optional(),message:$.string()})])))}),Pne=(e={})=>Nne(e),Fne=o7({id:`gateway.browserbase_search`,inputSchema:B5(()=>Y5($.object({query:$.string().min(1).max(200).describe(`Web search query. Must be between 1 and 200 characters.`),num_results:$.number().int().min(1).max(25).optional().describe(`Maximum number of results to return (1-25, default: 10).`)}))),outputSchema:B5(()=>Y5($.union([$.object({query:$.string(),requestId:$.string(),results:$.array($.object({id:$.string(),title:$.string(),url:$.string(),author:$.string().optional(),favicon:$.string().optional(),image:$.string().optional(),publishedDate:$.string().optional()}))}),$.object({error:$.enum([`api_error`,`configuration_error`,`execution_error`,`invalid_input`,`rate_limit`,`timeout`,`unknown`]),statusCode:$.number().optional(),message:$.string()})])))}),Ine=(e={})=>Fne(e),Lne=o7({id:`gateway.exa_search`,inputSchema:B5(()=>Y5($.object({query:$.string().describe(`Natural-language web search query. This is required.`),type:$.enum([`auto`,`fast`,`instant`]).optional().describe(`Search method. Use auto for the default balance of speed and quality.`),num_results:$.number().optional().describe(`Maximum number of results to return (1-100, default: 10).`),category:$.enum([`company`,`people`,`research paper`,`news`,`personal site`,`financial report`]).optional().describe(`Optional content category to focus results.`),user_location:$.string().optional().describe(`Two-letter ISO country code such as 'US'.`),include_domains:$.array($.string()).optional().describe(`Only return results from these domains.`),exclude_domains:$.array($.string()).optional().describe(`Exclude results from these domains.`),start_published_date:$.string().optional().describe(`Only return links published after this ISO 8601 date.`),end_published_date:$.string().optional().describe(`Only return links published before this ISO 8601 date.`),contents:$.object({text:$.union([$.boolean(),$.object({max_characters:$.number().optional(),include_html_tags:$.boolean().optional(),verbosity:$.enum([`compact`,`standard`,`full`]).optional(),include_sections:$.array($.enum([`header`,`navigation`,`banner`,`body`,`sidebar`,`footer`,`metadata`])).optional(),exclude_sections:$.array($.enum([`header`,`navigation`,`banner`,`body`,`sidebar`,`footer`,`metadata`])).optional()})]).optional(),highlights:$.union([$.boolean(),$.object({query:$.string().optional(),max_characters:$.number().optional()})]).optional(),max_age_hours:$.number().optional(),livecrawl_timeout:$.number().optional(),subpages:$.number().optional(),subpage_target:$.union([$.string(),$.array($.string())]).optional(),extras:$.object({links:$.number().optional(),image_links:$.number().optional()}).optional()}).optional().describe(`Controls extracted page content and freshness.`)}))),outputSchema:B5(()=>Y5($.union([$.object({requestId:$.string(),searchType:$.string().optional(),resolvedSearchType:$.string().optional(),results:$.array($.object({title:$.string(),url:$.string(),id:$.string(),publishedDate:$.string().nullable().optional(),author:$.string().nullable().optional(),image:$.string().nullable().optional(),favicon:$.string().nullable().optional(),text:$.string().optional(),highlights:$.array($.string()).optional(),highlightScores:$.array($.number()).optional(),summary:$.string().optional(),subpages:$.array($.any()).optional(),extras:$.object({links:$.array($.string()).optional(),imageLinks:$.array($.string()).optional()}).optional()})),costDollars:$.object({total:$.number().optional(),search:$.record($.string(),$.number()).optional()}).optional()}),$.object({error:$.enum([`api_error`,`rate_limit`,`timeout`,`invalid_input`,`configuration_error`,`execution_error`,`unknown`]),statusCode:$.number().optional(),message:$.string()})])))}),Rne=(e={})=>Lne(e),zne=o7({id:`gateway.parallel_search`,inputSchema:B5(()=>Y5($.object({objective:$.string().describe(`Natural-language description of the web research goal, including source or freshness guidance and broader context from the task. Maximum 5000 characters.`),search_queries:$.array($.string()).optional().describe(`Optional search queries to supplement the objective. Maximum 200 characters per query.`),mode:$.enum([`one-shot`,`agentic`]).optional().describe(`Mode preset: "one-shot" for comprehensive results with longer excerpts (default), "agentic" for concise, token-efficient results for multi-step workflows.`),max_results:$.number().optional().describe(`Maximum number of results to return (1-20). Defaults to 10 if not specified.`),source_policy:$.object({include_domains:$.array($.string()).optional().describe(`Limit results to these domains. Use plain domain names only — e.g. example.com or sub.example.gov, or a bare extension like .edu. Do not include a scheme, path, or port (e.g. not https://example.com/page).`),exclude_domains:$.array($.string()).optional().describe(`Exclude results from these domains. Use plain domain names only — e.g. example.com or sub.example.gov, or a bare extension like .edu. Do not include a scheme, path, or port (e.g. not https://example.com/page).`),after_date:$.string().optional().describe(`Only include results published after this date. Use an ISO 8601 calendar date formatted YYYY-MM-DD (e.g. 2025-01-01); do not include a time.`)}).optional().describe(`Source policy for controlling which domains to include/exclude and freshness.`),excerpts:$.object({max_chars_per_result:$.number().optional().describe(`Maximum characters per result.`),max_chars_total:$.number().optional().describe(`Maximum total characters across all results.`)}).optional().describe(`Excerpt configuration for controlling result length.`),fetch_policy:$.object({max_age_seconds:$.number().optional().describe(`Maximum age in seconds for cached content. Set to 0 to always fetch fresh content.`)}).optional().describe(`Fetch policy for controlling content freshness.`)}))),outputSchema:B5(()=>Y5($.union([$.object({searchId:$.string(),results:$.array($.object({url:$.string(),title:$.string(),excerpt:$.string(),publishDate:$.string().nullable().optional(),relevanceScore:$.number().optional()}))}),$.object({error:$.enum([`api_error`,`rate_limit`,`timeout`,`invalid_input`,`configuration_error`,`unknown`]),statusCode:$.number().optional(),message:$.string()})])))}),Bne=(e={})=>zne(e),Vne=o7({id:`gateway.perplexity_search`,inputSchema:B5(()=>Y5($.object({query:$.union([$.string(),$.array($.string())]).describe(`Search query (string) or multiple queries (array of up to 5 strings). Multi-query searches return combined results from all queries.`),max_results:$.number().optional().describe(`Maximum number of search results to return (1-20, default: 10)`),max_tokens_per_page:$.number().optional().describe(`Maximum number of tokens to extract per search result page (256-2048, default: 2048)`),max_tokens:$.number().optional().describe(`Maximum total tokens across all search results (default: 25000, max: 1000000)`),country:$.string().optional().describe(`Two-letter ISO 3166-1 alpha-2 country code for regional search results (e.g., 'US', 'GB', 'FR')`),search_domain_filter:$.array($.string()).optional().describe(`List of domains to include or exclude from search results (max 20). To include: ['nature.com', 'science.org']. To exclude: ['-example.com', '-spam.net']`),search_language_filter:$.array($.string()).optional().describe(`List of ISO 639-1 language codes to filter results (max 10, lowercase). Examples: ['en', 'fr', 'de']`),search_after_date:$.string().optional().describe(`Include only results published after this date. Format: 'MM/DD/YYYY' (e.g., '3/1/2025'). Cannot be used with search_recency_filter.`),search_before_date:$.string().optional().describe(`Include only results published before this date. Format: 'MM/DD/YYYY' (e.g., '3/15/2025'). Cannot be used with search_recency_filter.`),last_updated_after_filter:$.string().optional().describe(`Include only results last updated after this date. Format: 'MM/DD/YYYY' (e.g., '3/1/2025'). Cannot be used with search_recency_filter.`),last_updated_before_filter:$.string().optional().describe(`Include only results last updated before this date. Format: 'MM/DD/YYYY' (e.g., '3/15/2025'). Cannot be used with search_recency_filter.`),search_recency_filter:$.enum([`day`,`week`,`month`,`year`]).optional().describe(`Filter results by relative time period. Cannot be used with search_after_date or search_before_date.`)}))),outputSchema:B5(()=>Y5($.union([$.object({results:$.array($.object({title:$.string(),url:$.string(),snippet:$.string(),date:$.string().optional(),lastUpdated:$.string().optional()})),id:$.string()}),$.object({error:$.enum([`api_error`,`rate_limit`,`timeout`,`invalid_input`,`unknown`]),statusCode:$.number().optional(),message:$.string()})])))}),Hne=(e={})=>Vne(e),Une=$.object({count:$.number().optional().describe(`Maximum number of data results to return (1-20). When include_contents is true, each additional result adds its own data surcharge.`),include_contents:$.boolean().optional().describe(`Inline rows for each data result. This adds a data surcharge based on row count and dataset source. To estimate cost, search with include_contents disabled and inspect cards.content.export_pricing. This applies to every returned card; limit sources.data.count and sources.data.max_rows to control cost.`),mode:$.enum([`inline`,`url`]).optional().describe(`Requested data delivery mode. Search card data is always inline.`),content_format:$.enum([`card_json`,`csv`,`json_compact`,`json_records`]).optional().describe(`Serialization for inlined card data.`),max_rows:$.number().optional().describe(`Maximum rows to inline per result. Omit to use the allowance in cards.content.export_pricing. A data surcharge applies per 1,000 exported rows; lower values reduce cost.`),node_ids:$.array($.string()).optional().describe(`Data Graph node IDs to prioritize. Maximum 20.`),strict:$.boolean().optional().describe(`Only return cards matching node_ids. Requires a non-empty node_ids.`)}),Wne=$.object({count:$.number().optional().describe(`Maximum number of web results to return (1-20).`),include_contents:$.boolean().optional().describe(`Inline extracted web page text. This can add a data charge.`),category:$.enum([`finance`,`news`,`sports`]).optional().describe(`Optional web-result category filter.`),include_domains:$.array($.string()).optional().describe(`Only return results from these bare domains.`),exclude_domains:$.array($.string()).optional().describe(`Exclude results from these bare domains.`),snippet_max_chars:$.number().optional().describe(`Maximum characters in each web-result snippet.`),highlights:$.boolean().optional().describe(`Include highlighted passages in web results. Defaults to true in AI Gateway.`),article_content_max_chars:$.number().optional().describe(`Maximum extracted characters per web page when including contents.`),published_after:$.string().optional().describe(`Keep results published on or after this ISO date (YYYY-MM-DD).`),published_before:$.string().optional().describe(`Keep results published on or before this ISO date (YYYY-MM-DD).`)}),Gne=B5(()=>Y5($.object({query:$.string().describe(`Natural-language search query. Include the entity, metric, and time period. Quote a phrase to force it to one entity, for example "Tesla":PRODUCT price.`),effort:$.enum([`deep`,`fast`,`instant`]).optional().describe(`Search effort. fast is the balanced default, instant favors cached results and low latency, and deep broadens retrieval with reranking at higher cost and latency.`),sources:$.object({data:Une.optional(),web:Wne.optional()}).optional().describe(`Sources to search. Omit to search both curated data and the web. When provided, only keys present are searched.`),location:$.object({latitude:$.number().describe(`Latitude between -90 and 90.`),longitude:$.number().describe(`Longitude between -180 and 180.`)}).optional().describe(`End-user coordinates for localized results.`),country_code:$.string().optional().describe(`Two-letter ISO 3166-1 country code, such as 'US'.`),locale:$.string().optional().describe(`BCP-47 locale, such as 'en-US'.`),timezone:$.string().optional().describe(`IANA timezone, such as 'America/New_York'.`),output_settings:$.object({image_dark_mode:$.boolean().optional().describe(`Render card preview images in dark mode.`),force_refresh:$.boolean().optional().describe(`Instant-effort only. Request a refreshed instant result.`)}).optional().describe(`Controls card rendering in the search response.`),include_related:$.number().optional().describe(`Maximum related search suggestions to include (1-20).`)}))),H9=$.union([$.boolean(),$.number(),$.string()]).nullable(),U9=$.object({content_format:$.enum([`card_json`,`csv`,`json_compact`,`json_records`]).nullish(),cost:$.number().optional(),data:$.string().nullish(),records:$.array($.record($.string(),H9)).nullish(),dataset:$.object({columns:$.array($.object({name:$.string(),type:$.enum([`boolean`,`date`,`datetime`,`number`,`string`]),unit:$.string().nullish()})),rows:$.array($.array(H9)),total_rows:$.number(),truncated:$.boolean(),ref:$.string(),sources:$.array($.object({name:$.string(),index:$.enum([`data`,`web`]).optional()})),provenance:$.enum([`query`,`web_extraction`]).optional()}).nullish(),card_data:$.object({}).passthrough().nullish(),card_data_schema:$.object({}).passthrough().nullish(),url:$.string().nullish(),expires_at:$.string().nullish(),total_rows:$.number().nullish(),truncated:$.boolean().optional(),export_pricing:$.object({baseline_usd:$.number(),free_rows:$.number(),max_rows_ceiling:$.number(),row_cpm_usd:$.number()}).nullish(),manifest:$.array($.object({dtype:$.enum([`boolean`,`date`,`datetime`,`number`,`string`]).nullish(),entity:$.string().nullish(),metric:$.string().nullish(),name:$.string().nullish(),unit:$.string().nullish()})).nullish()}).passthrough(),Kne=$.object({card_id:$.string().nullish(),title:$.string().nullish(),description:$.string().nullish(),semantic_description:$.string().nullish(),webpage_url:$.string().nullish(),image_url:$.string().nullish(),embed_url:$.string().nullish(),sources:$.array($.object({source_name:$.string().nullish(),source_description:$.string().nullish(),source_index:$.enum([`data`,`web`]),source_text:$.string().nullish(),url:$.string().nullish()})).nullish(),methodologies:$.array($.object({methodology_name:$.string().nullable(),methodology_description:$.string().nullable()})).nullish(),source_indexes:$.array($.enum([`data`,`web`])).nullish(),card_type:$.string().nullish(),relevance:$.enum([`High`,`Low`,`Medium`]).nullish(),content:U9.nullish(),exportable:$.boolean().optional(),nodes:$.array($.object({id:$.string(),type:$.enum([`entity`,`metric`]),name:$.string(),description:$.string().nullish()})).nullish(),metric_definitions:$.array($.object({name:$.string(),definition:$.string()})).nullish(),data_freshness:$.object({coverage_end:$.string().nullish(),data_as_of:$.string().nullish(),last_updated:$.string().nullish()}).nullish()}).passthrough(),qne=$.object({title:$.string(),url:$.string(),snippet:$.string().nullish(),source_name:$.string().nullish(),publish_date:$.string().nullish(),content:U9.nullish()}).passthrough(),Jne=o7({id:`gateway.tako_search`,inputSchema:Gne,outputSchema:B5(()=>Y5($.union([$.object({request_id:$.string(),cards:$.array(Kne).optional(),web_results:$.array(qne).optional(),usage:$.object({total_cost_usd:$.number(),compute:$.object({cost_usd:$.number()}).nullish(),data:$.object({cost_usd:$.number(),datasets:$.number()}).nullish()}).nullish(),related:$.array($.object({}).passthrough()).nullish()}).passthrough(),$.object({error:$.enum([`api_error`,`configuration_error`,`execution_error`,`invalid_input`,`rate_limit`,`timeout`,`unknown_tool`]),statusCode:$.number().optional(),message:$.string()})])))}),Yne={browserbaseFetch:Pne,browserbaseSearch:Ine,exaSearch:Rne,parallelSearch:Bne,perplexitySearch:Hne,takoSearch:(e={})=>Jne(e)};async function Xne(){return(0,P7.getContext)().headers?.[`x-vercel-id`]}var Zne=`4.0.103`,Qne=`0.0.1`,$ne=$.object({token:$.string(),expiresAt:$.number().nullish()});function W9(e={}){let t=null,n=null,r=e.metadataCacheRefreshMillis??3e5,i=0,a=j7(e.baseURL)??`https://ai-gateway.vercel.sh/v4/ai`,o=t=>Z6({Authorization:`Bearer ${t.token}`,"ai-gateway-protocol-version":Qne,[y9]:t.authMethod,...e.teamIdOrSlug==null?{}:{[b9]:e.teamIdOrSlug},...e.headers},`ai-sdk-gateway/${Zne}`),s=async()=>{try{return o(await G9(e))}catch(e){throw J7.createContextualError({apiKeyProvided:!1,oidcTokenProvided:!1,statusCode:401,cause:e})}},c=async()=>{try{return await G9(e)}catch(e){throw J7.createContextualError({apiKeyProvided:!1,oidcTokenProvided:!1,statusCode:401,cause:e})}},l=async t=>{ere();let n=await c(),r=o(n),i=new URL(`/v1/realtime/client-secrets`,a).toString();try{let{value:n}=await r7({url:i,headers:r,body:{model:t.modelId,...t.routeKind!=null&&{routeKind:t.routeKind},...t.expiresAfterSeconds!=null&&{expiresIn:t.expiresAfterSeconds}},successfulResponseHandler:p7($ne),failedResponseHandler:d7({errorSchema:$.any(),errorToMessage:e=>FY(e)??`unknown error`}),fetch:e.fetch});return{token:n.token,...n.expiresAt!=null&&{expiresAt:n.expiresAt}}}catch(e){throw await v9(e,await x9(r))}},u=()=>{let e=k8({settingValue:void 0,environmentVariableName:`VERCEL_DEPLOYMENT_ID`}),t=k8({settingValue:void 0,environmentVariableName:`VERCEL_ENV`}),n=k8({settingValue:void 0,environmentVariableName:`VERCEL_REGION`}),r=k8({settingValue:void 0,environmentVariableName:`VERCEL_PROJECT_ID`});return async()=>{let i=await Xne();return{...e&&{"ai-o11y-deployment-id":e},...t&&{"ai-o11y-environment":t},...n&&{"ai-o11y-region":n},...i&&{"ai-o11y-request-id":i},...r&&{"ai-o11y-project-id":r}}}},d=t=>new Jte(t,{provider:`gateway`,baseURL:a,headers:s,fetch:e.fetch,o11yHeaders:u()}),f=()=>new Ite({provider:`gateway`,baseURL:a,headers:s,fetch:e.fetch,o11yHeaders:u()}),p=async()=>{let o=e._internal?.currentDate?.().getTime()??Date.now();return(!t||o-i>r)&&(i=o,t=new S9({baseURL:a,headers:s,fetch:e.fetch}).getAvailableModels().then(e=>(n=e,e)).catch(async e=>{throw await v9(e,await x9(await s()))})),n?Promise.resolve(n):t},m=async()=>new S9({baseURL:a,headers:s,fetch:e.fetch}).getCredits().catch(async e=>{throw await v9(e,await x9(await s()))}),h=async t=>new Mte({baseURL:a,headers:s,fetch:e.fetch}).getSpendReport(t).catch(async e=>{throw await v9(e,await x9(await s()))}),g=async t=>new Pte({baseURL:a,headers:s,fetch:e.fetch}).getGenerationInfo(t).catch(async e=>{throw await v9(e,await x9(await s()))}),_=function(e){if(new.target)throw Error(`The Gateway Provider model function cannot be called with the new keyword.`);return d(e)};_.specificationVersion=`v4`,_.getAvailableModels=p,_.getCredits=m,_.getSpendReport=h,_.getGenerationInfo=g,_.imageModel=t=>new Qte(t,{provider:`gateway`,baseURL:a,headers:s,fetch:e.fetch,o11yHeaders:u()}),_.languageModel=d,_.experimental_batch=f;let v=t=>new Yte(t,{provider:`gateway`,baseURL:a,headers:s,fetch:e.fetch,o11yHeaders:u()});_.embeddingModel=v,_.textEmbeddingModel=v,_.videoModel=t=>new rne(t,{provider:`gateway`,baseURL:a,headers:s,fetch:e.fetch,o11yHeaders:u()});let y=t=>new hne(t,{provider:`gateway`,baseURL:a,headers:s,fetch:e.fetch,o11yHeaders:u()});_.rerankingModel=y,_.reranking=y;let b=t=>new dne(t,{provider:`gateway`,baseURL:a,headers:s,fetch:e.fetch,o11yHeaders:u()});_.evaluationModel=b,_.evaluation=b;let x=t=>new vne(t,{provider:`gateway`,baseURL:a,headers:s,fetch:e.fetch,o11yHeaders:u()});_.speechModel=x,_.speech=x;let S=t=>new Sne(t,{provider:`gateway`,baseURL:a,headers:s,fetch:e.fetch,o11yHeaders:u(),webSocket:e.webSocket});_.transcriptionModel=S,_.transcription=S,_.experimental_transcription=Object.assign(e=>S(e),{getToken:async e=>{let t=await l({modelId:e.model,routeKind:`transcription`,...e.expiresAfterSeconds!=null&&{expiresAfterSeconds:e.expiresAfterSeconds}});return{token:t.token,url:R9(a,e.model),...t.expiresAt!=null&&{expiresAt:t.expiresAt}}}});let C=t=>new jne(t,{provider:`gateway.realtime`,baseURL:a,teamIdOrSlug:e.teamIdOrSlug,createClientSecret:l});return _.experimental_realtime=Object.assign(e=>C(e),{getToken:async e=>{let{model:t,...n}=e,r=await C(t).doCreateClientSecret(n);return{token:r.token,url:r.url,...r.expiresAt!=null&&{expiresAt:r.expiresAt}}}}),_.chat=_.languageModel,_.embedding=_.embeddingModel,_.image=_.imageModel,_.video=_.videoModel,_.tools=Yne,_}W9();async function G9(e){let t=k8({settingValue:e.apiKey,environmentVariableName:`AI_GATEWAY_API_KEY`});return t?{token:t,authMethod:`api-key`}:{token:await(0,P7.getVercelOidcToken)(),authMethod:`oidc`}}function ere(){if(globalThis.window!==void 0)throw Error(`AI Gateway client secrets must be minted server-side: minting needs your Gateway credential, which must never reach the browser. Call gateway.experimental_realtime.getToken() or gateway.experimental_transcription.getToken() from your server and pass the returned token to the client.`)}async function tre(e){let{models:t}=await W9({apiKey:e}).getAvailableModels();return t.filter(e=>(e.modelType??`language`)===`language`).map(e=>({id:e.id,name:e.name,pricing:e.pricing?{input:Number(e.pricing.input)*1e6,output:Number(e.pricing.output)*1e6}:void 0}))}async function nre(e){let t=await fetch(`https://api.anthropic.com/v1/models?limit=1000`,{headers:{"x-api-key":e,"anthropic-version":`2023-06-01`,"anthropic-dangerous-direct-browser-access":`true`}});if(!t.ok)throw Error(`Anthropic API request failed (${t.status})`);return(await t.json()).data.map(e=>({id:e.id,name:e.display_name}))}async function rre(e,t){let n=await fetch(`${e.replace(/\/+$/,``)}/models`,{headers:{Authorization:`Bearer ${t}`}});if(!n.ok)throw Error(`Model list request failed (${n.status})`);return(await n.json()).data.map(e=>({id:e.id,name:e.id}))}function K9(e){switch(e.provider){case`gateway`:return tre(e.gatewayToken);case`anthropic`:return nre(e.anthropicApiKey);case`openai-compatible`:return rre(e.openaiBaseUrl,e.openaiApiKey)}}var ire=t({AGENT_SYSTEM_PROMPT:()=>CJ,AnalysisSchema:()=>XJ,CHAT_CONTEXT_CHAR_LIMIT:()=>_Y,CHAT_SYSTEM_SECTION:()=>wJ,INLINE_DIFF_CHAR_LIMIT:()=>SJ,LANGUAGE_REMINDER:()=>yY,LLM_SCHEMA_VERSION:()=>1,MAX_CHAT_TURNS:()=>8,MAX_TURNS:()=>12,OMITTED_DIFF_TEXT:()=>vY,READ_BUDGET_CHARS:()=>lY,READ_CALL_CHAR_CAP:()=>ZJ,STEER_TURN:()=>10,UPDATE_GROUPING_DECLARATION:()=>sY,buildAnalysisPrompt:()=>kJ,buildManifest:()=>OJ,compactContext:()=>xY,createChatSession:()=>CY,createCorsSafeFetch:()=>MJ,createLedger:()=>QJ,createReadDiffsTool:()=>nY,createStreamFn:()=>NJ,createSubmitGroupingTool:()=>oY,createUpdateGroupingTool:()=>cY,findCoverageIssues:()=>$J,listModels:()=>K9,prepareGroupingArguments:()=>aY,renderFilesAsText:()=>xJ,runAgent:()=>pY,runLlmAnalysis:()=>gY,toGroupedResult:()=>hY,toLlmMessages:()=>dY,withChatInstructions:()=>bY,withLanguageReminder:()=>SY});function q9(e){switch(e.provider){case`gateway`:return e.gatewayToken;case`anthropic`:return e.anthropicApiKey;case`openai-compatible`:return e.openaiApiKey}}function J9(e){return(e.provider===`openai-compatible`?`${e.openaiBaseUrl}\n`:``)+q9(e)}var Y9=`diffs:llm-models`;function X9(){let e=localStorage.getItem(Y9);if(!e)return{};try{return JSON.parse(e)}catch{return{}}}function are(){let e=Ne(null),t=Ne(!1),n=Ne(),r=0;return Te(()=>{r++}),Nt(()=>[In.value.llm.provider,J9(In.value.llm)],async([i])=>{let a=++r;if(e.value=null,n.value=void 0,!q9(In.value.llm))return;let o=J9(In.value.llm);t.value=!0;try{let t=await Od(o);if(a!==r)return;let n=X9()[i],s=n?.hash===t?n.models:await K9(In.value.llm);if(a!==r)return;if(n?.hash!==t){let e={...X9(),[i]:{hash:t,models:s}};localStorage.setItem(Y9,JSON.stringify(e))}e.value=s}catch(e){a===r&&(n.value=e instanceof Error?e.message:String(e))}finally{a===r&&(t.value=!1)}},{immediate:!0}),{models:e,loading:t,error:n}}var ore={key:0,class:`fixed inset-0 z-modal flex items-center justify-center p-4`},sre=[`aria-label`],cre={class:`min-w-0`},lre={key:0,class:`color-base font-medium`},ure={key:1,class:`text-sm op-fade`},dre=[`aria-label`],fre={key:1,class:`flex shrink-0 justify-end gap-2 border-t border-base px-2 py-2`},Z9=F({__name:`AppModal`,props:{open:{type:Boolean},title:{},description:{},document:{},spacious:{type:Boolean}},emits:[`update:open`],setup(e,{emit:t}){let n=e,r=t,i=P(()=>n.document instanceof ShadowRoot?n.document:`body`);function a(){r(`update:open`,!1)}function o(e){e.key===`Escape`&&a()}return Nt(()=>n.open,e=>{e?document.addEventListener(`keydown`,o):document.removeEventListener(`keydown`,o)}),xt(()=>document.removeEventListener(`keydown`,o)),(t,n)=>(L(),Me(S,{to:i.value},[e.open?(L(),T(`div`,ore,[D(`div`,{class:`fixed inset-0 z-modal-backdrop bg-[#ddd]/40 backdrop-blur-sm dark:bg-black/40`,onClick:a}),D(`div`,{role:`dialog`,"aria-modal":`true`,"aria-label":e.title,class:Oe([`relative z-modal-content max-h-full w-full flex flex-col overflow-hidden border border-base rounded-lg bg-base shadow-xl outline-none`,e.spacious?`max-w-2xl`:`max-w-xl`])},[e.title||e.description||t.$slots.header?(L(),T(`header`,{key:0,class:Oe([`flex shrink-0 items-start justify-between gap-2 border-b border-base`,e.spacious?`px-6 py-3`:`px-3 py-2`])},[D(`div`,cre,[e.title?(L(),T(`h2`,lre,b(e.title),1)):Ie(``,!0),e.description?(L(),T(`p`,ure,b(e.description),1)):Ie(``,!0),k(t.$slots,`header`)]),D(`button`,{type:`button`,class:`btn-icon h-7 w-7 shrink-0`,"aria-label":t.$t(`common.close`),onClick:a},[...n[0]||=[D(`span`,{class:`i-ph:x`,"aria-hidden":`true`},null,-1)]],8,dre)],2)):Ie(``,!0),D(`div`,{class:Oe([`flex-1 overflow-auto`,e.spacious?`p-6`:`p-3`])},[k(t.$slots,`default`)],2),t.$slots.footer?(L(),T(`footer`,fre,[k(t.$slots,`footer`)])):Ie(``,!0)],10,sre)])):Ie(``,!0)],8,[`to`]))}}),pre={class:`mb-2 text-sm color-base font-medium`},mre=F({__name:`AutoRefreshSettingsSection`,setup(e){return(e,t)=>(L(),T(`div`,null,[D(`h3`,pre,b(e.$t(`settings.cached`)),1),N(cc,{modelValue:i(bd),"onUpdate:modelValue":t[0]||=e=>C(bd)?bd.value=e:null,label:e.$t(`settings.autoRefresh`)},null,8,[`modelValue`,`label`])]))}}),Q9=rt(`diffs:layout`,`split`),hre={class:`mb-2 text-sm color-base font-medium`},gre=F({__name:`LayoutSettingsSection`,setup(e){let{t}=Et(),n=P(()=>[{value:`unified`,label:t(`settings.unified`),icon:`i-ph:rows-duotone`},{value:`split`,label:t(`settings.split`),icon:`i-ph:columns-duotone`}]);return(e,t)=>(L(),T(`div`,null,[D(`h3`,hre,b(e.$t(`settings.layout`)),1),N(Mb,{"model-value":i(Q9),options:n.value,"onUpdate:modelValue":t[0]||=e=>Q9.value=e},null,8,[`model-value`,`options`])]))}}),_re={key:1,class:`flex flex-col border border-base rounded bg-raised`},vre=[`aria-expanded`],yre={key:0,class:`flex items-center gap-2 op-fade`},bre={key:1,class:`min-w-0 flex items-center gap-2 color-base`},xre={class:`truncate`},Sre=[`title`],Cre={class:`p-1.5`},wre={class:`max-h-56 of-y-auto pb-1`,role:`listbox`},Tre={key:0,class:`px-3 py-4 text-center text-sm op-mute`},Ere={key:1,class:`px-3 py-4 text-center text-sm op-mute`},Dre=[`aria-selected`,`onClick`],Ore={class:`min-w-0 flex-1 truncate`},kre=[`title`],Are={key:1,class:`i-ph:check shrink-0 text-xs`,"aria-hidden":`true`},jre={class:`min-w-0 flex-1 truncate`},Mre=F({__name:`ModelPicker`,props:Qt({models:{},loading:{type:Boolean},error:{}},{modelValue:{required:!0},modelModifiers:{}}),emits:[`update:modelValue`],setup(e){let t=e,n=jt(e,`modelValue`),{t:r}=Et(),i=Ne(!1),a=Ne(``),o=St(`listEl`);Nt(i,async e=>{a.value=``,e&&(await x(),o.value?.scrollIntoView({block:`nearest`}))});let s=P(()=>t.models?.find(e=>e.id===n.value)),c=P(()=>{let e=a.value.trim().toLowerCase(),n=t.models??[];return e?n.filter(t=>t.name.toLowerCase().includes(e)||t.id.toLowerCase().includes(e)):n}),l=P(()=>{let e=a.value.trim();if(e&&!t.models?.some(t=>t.id===e))return e});function u(e){n.value=e,i.value=!1}function d(e){return`$${e>=1&&Number.isInteger(e)?e:e.toFixed(2)}`}function f(e){if(e.pricing)return e.pricing.input===0&&e.pricing.output===0?r(`settings.models.free`):`${d(e.pricing.input)} / ${d(e.pricing.output)}`}function p(e){if(e.pricing)return r(`settings.models.priceTitle`,{input:d(e.pricing.input),output:d(e.pricing.output)})}return(t,r)=>e.error?(L(),Me(rb,{key:0,modelValue:n.value,"onUpdate:modelValue":r[0]||=e=>n.value=e,placeholder:t.$t(`settings.models.placeholder`)},null,8,[`modelValue`,`placeholder`])):(L(),T(`div`,_re,[D(`button`,{type:`button`,class:`h-9 inline-flex items-center justify-between gap-2 px-2.5 text-sm outline-none transition focus-visible:ring-2 focus-visible:ring-primary-500/40`,"aria-expanded":i.value,onClick:r[1]||=e=>i.value=!i.value},[e.loading?(L(),T(`span`,yre,[r[4]||=D(`span`,{class:`i-ph:circle-notch animate-spin`,"aria-hidden":`true`},null,-1),Ge(` `+b(t.$t(`settings.models.loading`)),1)])):(L(),T(`span`,bre,[D(`span`,xre,b(s.value?.name??n.value),1),s.value&&f(s.value)?(L(),T(`span`,{key:0,class:`shrink-0 text-xs tabular-nums op-mute`,title:p(s.value)},b(f(s.value)),9,Sre)):Ie(``,!0)])),D(`span`,{class:Oe([i.value?`i-ph:caret-up`:`i-ph:caret-down`,`shrink-0 op-fade`]),"aria-hidden":`true`},null,2)],8,vre),i.value?(L(),T(`div`,{key:0,ref_key:`listEl`,ref:o,class:`flex flex-col border-t border-base`},[D(`div`,Cre,[N(rb,{modelValue:a.value,"onUpdate:modelValue":r[2]||=e=>a.value=e,size:`sm`,icon:`i-ph:magnifying-glass`,placeholder:t.$t(`settings.models.search`),clearable:``,class:`w-full`},null,8,[`modelValue`,`placeholder`])]),D(`div`,wre,[e.loading?(L(),T(`div`,Tre,b(t.$t(`settings.models.loading`)),1)):!c.value.length&&!l.value?(L(),T(`div`,Ere,b(t.$t(`settings.models.noMatch`)),1)):Ie(``,!0),(L(!0),T(gt,null,E(c.value,e=>(L(),T(`button`,{key:e.id,type:`button`,role:`option`,"aria-selected":e.id===n.value,class:Oe([`w-full flex items-center gap-2 px-3 py-1.5 text-left text-sm outline-none transition focus-visible:bg-hover`,e.id===n.value?`color-active bg-active`:`op-fade hover:op100 hover:bg-hover`]),onClick:t=>u(e.id)},[D(`span`,Ore,b(e.name),1),f(e)?(L(),T(`span`,{key:0,class:Oe([`shrink-0 text-xs tabular-nums`,e.pricing?.input===0&&e.pricing.output===0?`color-active`:`op-mute`]),title:p(e)},b(f(e)),11,kre)):Ie(``,!0),e.id===n.value?(L(),T(`span`,Are)):Ie(``,!0)],10,Dre))),128)),l.value?(L(),T(`button`,{key:2,type:`button`,class:`w-full flex items-center gap-2 px-3 py-1.5 text-left text-sm op-fade outline-none transition focus-visible:bg-hover hover:bg-hover hover:op100`,onClick:r[3]||=e=>u(l.value)},[r[5]||=D(`span`,{class:`i-ph:plus shrink-0 text-xs`,"aria-hidden":`true`},null,-1),D(`span`,jre,b(t.$t(`settings.models.useCustom`,{id:l.value})),1)])):Ie(``,!0)])],512)):Ie(``,!0)]))}}),Nre={class:`relative`},Pre=[`inert`],Fre={class:`mb1 flex items-center gap-1 text-sm color-base font-medium`},Ire={class:`text-sm color-faint`},Lre={class:`flex items-center gap-2`},Rre={href:`https://console.anthropic.com/settings/keys`,target:`_blank`,rel:`noopener`,class:`hover:underline`},zre=[`href`],Bre={class:`h-9 flex items-center gap-2 border border-base rounded bg-raised px-3 text-sm`},Vre={class:`color-base`},Hre={class:`font-mono op-mute`},Ure={key:0,class:`flex-1 truncate text-xs op-mute`},Wre={key:1,class:`flex-1`},Gre={key:0,class:`absolute inset-0 flex flex-col items-center justify-center gap-1 px-4 text-center`},Kre={class:`text-sm color-base font-medium`},qre={href:`https://pulls.review`,target:`_blank`,rel:`noopener`,class:`color-base hover:underline`},Jre=F({__name:`LlmSettingsSection`,props:{llmSettings:{},models:{},modelsLoading:{type:Boolean},modelsError:{}},emits:[`update:llmSettings`],setup(e,{emit:t}){let n=e,r=t,a={gateway:{tokenKey:`gatewayToken`,modelKey:`gatewayModel`,placeholder:`vck_…`,createKey:{vendor:`Vercel`,url:`https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai-gateway%2Fapi-keys`}},anthropic:{tokenKey:`anthropicApiKey`,modelKey:`anthropicModel`,placeholder:`sk-ant-…`,createKey:{vendor:`Anthropic`,url:`https://console.anthropic.com/settings/keys`}},"openai-compatible":{tokenKey:`openaiApiKey`,modelKey:`openaiModel`,placeholder:`sk-…`,createKey:{vendor:`OpenAI`,url:`https://platform.openai.com/api-keys`}}},o=[{value:`gateway`,label:`AI Gateway`,icon:`i-simple-icons-vercel`},{value:`anthropic`,label:`Anthropic`,icon:`i-simple-icons-claude`},{value:`openai-compatible`,label:`OpenAI-compatible`,icon:`i-simple-icons-openai`}],s=P(()=>a[n.llmSettings.provider]),c=P(()=>n.llmSettings[s.value.tokenKey]),l=P(()=>n.llmSettings.provider===`openai-compatible`);function u(e){r(`update:llmSettings`,{...n.llmSettings,...e})}let d=Ne(!1),f=Ne(``),p=Ne(n.llmSettings.openaiBaseUrl);Nt(()=>n.llmSettings.provider,()=>{d.value=!1,f.value=``,p.value=n.llmSettings.openaiBaseUrl});function m(){let e={[s.value.tokenKey]:f.value};l.value&&(e.openaiBaseUrl=p.value),u(e),d.value=!1,f.value=``}function h(){d.value=!1,f.value=``,p.value=n.llmSettings.openaiBaseUrl}function g(){u({[s.value.tokenKey]:``}),h()}let _=P({get:()=>n.llmSettings[s.value.modelKey],set:e=>u({[s.value.modelKey]:e})});return(t,n)=>{let r=Lt(`i18n-t`);return L(),T(`div`,Nre,[D(`div`,{class:Oe([`flex flex-col gap-4 transition`,i(!1)?`pointer-events-none opacity-40 blur-[2px] select-none`:``]),inert:i(!1)},[D(`div`,null,[D(`div`,Fre,[n[6]||=D(`div`,{class:`i-ph-sparkle-duotone text-lg`},null,-1),Ge(` `+b(t.$t(`settings.llm.title`)),1)]),D(`p`,Ire,b(t.$t(`settings.llm.description`)),1)]),N(tb,{label:t.$t(`settings.llm.provider`)},{default:I(()=>[N(Mb,{"model-value":e.llmSettings.provider,options:o,"onUpdate:modelValue":n[0]||=e=>u({provider:e})},null,8,[`model-value`])]),_:1},8,[`label`]),!c.value||d.value?(L(),T(gt,{key:0},[l.value?(L(),Me(tb,{key:0,label:t.$t(`settings.llm.baseUrl`),description:t.$t(`settings.llm.baseUrlDescription`)},{default:I(()=>[N(rb,{modelValue:p.value,"onUpdate:modelValue":n[1]||=e=>p.value=e,placeholder:`https://api.openai.com/v1`},null,8,[`modelValue`])]),_:1},8,[`label`,`description`])):Ie(``,!0),N(tb,{label:t.$t(`settings.llm.apiKey`)},{description:I(()=>[e.llmSettings.provider===`gateway`?(L(),Me(r,{key:0,keypath:`settings.llm.gatewayHint`,scope:`global`},{link:I(()=>[...n[7]||=[D(`a`,{href:`https://vercel.com/docs/ai-gateway`,target:`_blank`,rel:`noopener`,class:`hover:underline`},`Vercel AI Gateway`,-1)]]),_:1})):e.llmSettings.provider===`anthropic`?(L(),Me(r,{key:1,keypath:`settings.llm.anthropicHint`,scope:`global`},{link:I(()=>[D(`a`,Rre,b(t.$t(`settings.llm.anthropicLink`)),1)]),_:1})):(L(),T(gt,{key:2},[Ge(b(t.$t(`settings.llm.openaiHint`)),1)],64)),n[8]||=D(`br`,null,null,-1),D(`a`,{href:s.value.createKey.url,target:`_blank`,rel:`noopener`,class:`text-primary hover:underline`},b(t.$t(`settings.llm.createKey`,{provider:s.value.createKey.vendor})),9,zre)]),default:I(()=>[D(`div`,Lre,[N(rb,{modelValue:f.value,"onUpdate:modelValue":n[2]||=e=>f.value=e,type:`password`,icon:`i-ph-key-duotone`,placeholder:s.value.placeholder,class:`flex-1`,onKeyup:n[3]||=nn(e=>f.value&&m(),[`enter`])},null,8,[`modelValue`,`placeholder`]),N(Bn,{disabled:!f.value,onClick:m},{default:I(()=>[Ge(b(t.$t(`common.save`)),1)]),_:1},8,[`disabled`]),d.value?(L(),Me(Bn,{key:0,variant:`text`,onClick:h},{default:I(()=>[Ge(b(t.$t(`common.cancel`)),1)]),_:1})):Ie(``,!0),d.value?(L(),Me(Bn,{key:1,variant:`text`,onClick:g},{default:I(()=>[Ge(b(t.$t(`common.remove`)),1)]),_:1})):Ie(``,!0)])]),_:1},8,[`label`])],64)):(L(),T(gt,{key:1},[N(tb,{label:t.$t(`settings.llm.apiKey`)},{default:I(()=>[D(`div`,Bre,[n[9]||=D(`span`,{class:`i-ph:check-circle-duotone shrink-0 color-active`,"aria-hidden":`true`},null,-1),D(`span`,Vre,b(t.$t(`settings.llm.configured`)),1),D(`span`,Hre,`••••`+b(c.value.slice(-4)),1),l.value?(L(),T(`span`,Ure,b(e.llmSettings.openaiBaseUrl),1)):(L(),T(`span`,Wre)),N(ns,{icon:`i-ph:pencil-simple-duotone`,label:t.$t(`settings.llm.changeKey`),tooltip:t.$t(`settings.llm.changeKey`),compact:``,class:`text-sm`,onClick:n[4]||=e=>d.value=!0},null,8,[`label`,`tooltip`])])]),_:1},8,[`label`]),N(tb,{label:t.$t(`settings.llm.model`)},He({default:I(()=>[N(Mre,{modelValue:_.value,"onUpdate:modelValue":n[5]||=e=>_.value=e,models:e.models,loading:e.modelsLoading,error:e.modelsError},null,8,[`modelValue`,`models`,`loading`,`error`])]),_:2},[e.modelsError?{name:`error`,fn:I(()=>[Ge(b(t.$t(`settings.llm.modelListFailed`,{error:e.modelsError})),1)]),key:`0`}:void 0]),1032,[`label`])],64))],10,Pre),i(!1)?(L(),T(`div`,Gre,[n[10]||=D(`span`,{class:`i-ph:shield-warning-duotone text-2xl op-fade`,"aria-hidden":`true`},null,-1),D(`p`,Kre,b(t.$t(`settings.llm.embedUnavailable`)),1),N(r,{keypath:`settings.llm.embedReason`,tag:`p`,class:`max-w-72 text-xs color-faint`,scope:`global`},{link:I(()=>[D(`a`,qre,b(t.$t(`settings.llm.goToWebsite`)),1)]),_:1})])):Ie(``,!0)])}}}),Yre={class:`mb-2 text-sm color-base font-medium`},Xre={class:`grid gap-2 sm:grid-cols-2`},Zre={class:`flex items-center gap-1.5 text-xs op-fade`},Qre=[`value`,`onChange`],$re=[`label`],eie=[`value`],tie=F({__name:`SyntaxThemeSettingsSection`,setup(e){let t={pierre:`Pierre`,shiki:`Shiki`};function n(e){let n=new Map;for(let t of e)n.set(t.collection,[...n.get(t.collection)??[],t]);return[...n].map(([e,n])=>({label:t[e]??e,options:n}))}let r=[`light`,`dark`].map(e=>({scheme:e,icon:e===`light`?`i-ph:sun-duotone`:`i-ph:moon-duotone`,groups:n(Eb(e))}));return(e,t)=>(L(),T(`div`,null,[D(`h3`,Yre,b(e.$t(`settings.syntaxTheme.label`)),1),D(`div`,Xre,[(L(!0),T(gt,null,E(i(r),({scheme:t,icon:n,groups:r})=>(L(),T(`label`,{key:t,class:`flex flex-col gap-1`},[D(`span`,Zre,[D(`span`,{class:Oe(n),"aria-hidden":`true`},null,2),Ge(` `+b(e.$t(`settings.syntaxTheme.${t}`)),1)]),D(`select`,{value:i(kb)[t],class:`h-9 w-full border border-base rounded bg-raised px-2 text-sm color-base outline-none transition focus-visible:ring-2 focus-visible:ring-primary-500/40`,onChange:e=>i(Ab)(t,e.target.value)},[(L(!0),T(gt,null,E(r,e=>(L(),T(`optgroup`,{key:e.label,label:e.label},[(L(!0),T(gt,null,E(e.options,e=>(L(),T(`option`,{key:e.value,value:e.value},b(e.label),9,eie))),128))],8,$re))),128))],40,Qre)]))),128))])]))}}),nie={class:`flex flex-col gap-4 p2`},rie=F({__name:`SettingsPanel`,props:{githubTokenSet:{type:Boolean},githubTokenMeta:{},githubTokenBusy:{type:Boolean},githubTokenError:{},llmSettings:{},models:{},modelsLoading:{type:Boolean},modelsError:{}},emits:[`saveGithubToken`,`update:llmSettings`],setup(e){return(t,n)=>(L(),T(`div`,nie,[N(gre),n[2]||=D(`div`,{class:`border-t border-base`},null,-1),N(tie),n[3]||=D(`div`,{class:`border-t border-base`},null,-1),N(mre),n[4]||=D(`div`,{class:`border-t border-base`},null,-1),N(xb,{"token-set":e.githubTokenSet,meta:e.githubTokenMeta,busy:e.githubTokenBusy,error:e.githubTokenError,onSave:n[0]||=e=>t.$emit(`saveGithubToken`,e)},null,8,[`token-set`,`meta`,`busy`,`error`]),n[5]||=D(`div`,{class:`border-t border-base`},null,-1),N(Jre,{"llm-settings":e.llmSettings,models:e.models,"models-loading":e.modelsLoading,"models-error":e.modelsError,"onUpdate:llmSettings":n[1]||=e=>t.$emit(`update:llmSettings`,e)},null,8,[`llm-settings`,`models`,`models-loading`,`models-error`])]))}}),iie=F({__name:`SettingsModal`,props:{open:{type:Boolean},document:{}},emits:[`update:open`],setup(e,{emit:t}){let n=t,r=Id(),a=are();return(t,o)=>(L(),Me(Z9,{title:t.$t(`common.settings`),open:e.open,document:e.document,"onUpdate:open":o[2]||=e=>n(`update:open`,e??!1)},{default:I(()=>[N(rie,{"github-token-set":!!i(In).githubToken,"github-token-meta":i(r).meta.value,"github-token-busy":i(r).busy.value,"github-token-error":i(r).error.value,"llm-settings":i(In).llm,models:i(a).models.value,"models-loading":i(a).loading.value,"models-error":i(a).error.value,onSaveGithubToken:o[0]||=e=>i(r).saveToken(e),"onUpdate:llmSettings":o[1]||=e=>In.value={...i(In),llm:e}},null,8,[`github-token-set`,`github-token-meta`,`github-token-busy`,`github-token-error`,`llm-settings`,`models`,`models-loading`,`models-error`])]),_:1},8,[`title`,`open`,`document`]))}}),aie={class:`flex shrink-0 items-center gap-1`},oie=F({__name:`NavControls`,props:{document:{}},setup(e){return(t,n)=>(L(),T(gt,null,[D(`div`,aie,[k(t.$slots,`default`),N(zb),N(ns,{icon:`i-ph:gear-duotone`,label:t.$t(`common.settings`),tooltip:t.$t(`common.settings`),onClick:n[0]||=e=>Nb.value=!0},null,8,[`label`,`tooltip`]),i(!1)?Ie(``,!0):(L(),Me(Pb,{key:0}))]),i(!1)?Ie(``,!0):(L(),Me(iie,{key:0,open:i(Nb),"onUpdate:open":n[1]||=e=>C(Nb)?Nb.value=e:null,document:e.document},null,8,[`open`,`document`]))],64))}}),sie=[`title`],cie=F({__name:`PrStatusIcon`,props:{state:{}},setup(e){let t={open:`i-ph:git-pull-request-duotone`,draft:`i-ph:git-pull-request-duotone`,closed:`i-ph:git-pull-request-duotone`,merged:`i-ph:git-merge-duotone`},n={open:`color-success-500`,draft:`color-gray-500`,closed:`color-error-500`,merged:`color-purple-500`};return(r,i)=>(L(),T(`span`,{class:Oe([[t[e.state],n[e.state]],`shrink-0 text-lg`]),title:r.$t(`prState.${e.state}`)},null,10,sie))}}),$9=`pulls.review`;function lie(e,t=` · `){ct(()=>{let n=Ke(e)?.trim();return n?`${n}${t}${$9}`:$9})}export{xc as $,vr as $t,Qu as A,ns as At,pu as B,Qa as Bt,Dd as C,gs as Ct,bd as D,us as Dt,wd as E,ds as Et,Lu as F,Za as Ft,Oc as G,Lr as Gt,ku as H,Qi as Ht,Au as I,$a as It,Ec as J,Kr as Jt,_c as K,Gr as Kt,fu as L,to as Lt,Iu as M,eo as Mt,Gu as N,qa as Nt,vd as O,ls as Ot,Du as P,no as Pt,Sc as Q,Mr as Qt,uu as R,Ja as Rt,jd as S,_s as St,Cd as T,ms as Tt,hu as U,$r as Ut,ou as V,Yi as Vt,Gc as W,ni as Wt,Cc as X,Jr as Xt,vc as Y,Vr as Yt,wc as Z,jr as Zt,Dy as _,Ps as _t,Z9 as a,Yn as an,gc as at,Id as b,ws as bt,Mb as c,dc as ct,Cb as d,cc as dt,rr as en,lc as et,xb as f,tc as ft,Py as g,Fs as gt,Yy as h,Ls as ht,Q9 as i,$n as in,hc as it,su as j,ts as jt,ud as k,cs as kt,kb as l,yc as lt,tb as m,Hs as mt,cie as n,Qn as nn,fc as nt,ire as o,mc as ot,rb as p,ec as pt,Tc as q,Ir as qt,oie as r,er as rn,uc as rt,Nb as s,pc as st,lie as t,Zn as tn,Dc as tt,Sb as u,bc as ut,by as v,Os as vt,Td as w,hs as wt,Md as x,bs as xt,Fd as y,Ds as yt,du as z,Xa as zt};