pulls.review 0.2.1 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (96) hide show
  1. package/README.md +5 -0
  2. package/dist/client/assets/ActionButton-V4dY2wPS.js +1 -0
  3. package/dist/client/assets/ActionIconButton-4b5xelMn.js +1 -0
  4. package/dist/client/assets/ChatMessage-Ccffh_8Z.js +80 -0
  5. package/dist/client/assets/ChatWidget-BFjNWi3R.js +1 -0
  6. package/dist/client/assets/DisplayFileIcon-DIcJdZir.js +151 -0
  7. package/dist/client/assets/GithubAvatar-DGJrpCsX.js +1 -0
  8. package/dist/client/assets/LandingHero-CS9lP7Qs.js +1 -0
  9. package/dist/client/assets/LocalAgentSettings-C4AeYCZ0.js +1 -0
  10. package/dist/client/assets/ModelPicker-CDTiUMZ3.js +3 -0
  11. package/dist/client/assets/SelectViewport-DF4P4Akh.js +1 -0
  12. package/dist/client/assets/_repo_-DtGh1V5_.js +22 -0
  13. package/dist/client/assets/analyze-CTcNbJBk.js +1 -0
  14. package/dist/client/assets/anthropic-messages-Btz8sjqp.js +41 -0
  15. package/dist/client/assets/browser-agent-rpc-BXhoSh1z-DrvKG05N.js +1 -0
  16. package/dist/client/assets/core-messages-CsAgH4H9.js +1 -0
  17. package/dist/client/assets/de-DQCc3irO.js +1 -0
  18. package/dist/client/assets/diagnostics-CrG4-M7r.js +1 -0
  19. package/dist/client/assets/{diff-BKQFn0my.js → diff-Bq6jHPox.js} +3 -3
  20. package/dist/client/assets/diff-BsZcYqbE.js +1 -0
  21. package/dist/client/assets/diffs-store-CzecLzBW.js +1431 -0
  22. package/dist/client/assets/en-CBwAorrh.js +1 -0
  23. package/dist/client/assets/{es-QcvEBShr.js → es-hetdr90_.js} +1 -1
  24. package/dist/client/assets/floating-ui.dom-CfpSQvPs.js +1 -0
  25. package/dist/client/assets/fr-Cayf6fbk.js +1 -0
  26. package/dist/client/assets/i18n-CgsK6PK3.js +2 -0
  27. package/dist/client/assets/{id-NIGs9Xhn.js → id-lw2zLhUO.js} +1 -1
  28. package/dist/client/assets/index-DP4XBqUv.js +2 -0
  29. package/dist/client/assets/index-DSHKSKKf.css +1 -0
  30. package/dist/client/assets/install-DKy8VRs5.js +4 -0
  31. package/dist/client/assets/{it-DjRuurmk.js → it-BfFzmCsC.js} +1 -1
  32. package/dist/client/assets/{ja-BAKkDsQ5.js → ja-DxaV4C1r.js} +1 -1
  33. package/dist/client/assets/ko-D93r2P2k.js +1 -0
  34. package/dist/client/assets/llm-XBWohzAo.js +87 -0
  35. package/dist/client/assets/llm-store-7CdL0d74.js +1 -0
  36. package/dist/client/assets/local-agents-BQLn-Ppw.js +1 -0
  37. package/dist/client/assets/models-D651LTTp.js +8 -0
  38. package/dist/client/assets/nanoid-Cya-tyvy.js +1 -0
  39. package/dist/client/assets/node.browser-C0q8i5sA.js +1 -0
  40. package/dist/client/assets/{openai-completions-CSvY9IVo.js → openai-completions-DvmbMyzl.js} +5 -5
  41. package/dist/client/assets/pages-Tf2MYsp8.js +1 -0
  42. package/dist/client/assets/pages-local-iBHcLWBK.js +1 -0
  43. package/dist/client/assets/pages-web-Bmq8l7JI.js +21 -0
  44. package/dist/client/assets/portalTarget-DQg8GgWm.js +1 -0
  45. package/dist/client/assets/pt-BR-Isafy_5V.js +1 -0
  46. package/dist/client/assets/rpc-backends-CLzNPIWN.js +1 -0
  47. package/dist/client/assets/ru-Bx9Wj7Aa.js +1 -0
  48. package/dist/client/assets/runtime-dom.esm-bundler-Du_ZCcVN.js +2 -0
  49. package/dist/client/assets/{source-hSji-yvG.js → source-Dk1PNoY7.js} +1 -1
  50. package/dist/client/assets/sync-interval-oKvsW-lT.js +1 -0
  51. package/dist/client/assets/{transform-messages-C8U1xonk.js → transform-messages-Cg_2u7I2.js} +1 -1
  52. package/dist/client/assets/upload-CFwsDMhO.js +1 -0
  53. package/dist/client/assets/useDocumentTitle-ByFCALbG.js +92 -0
  54. package/dist/client/assets/useNonce-CwUrgryd.js +1 -0
  55. package/dist/client/assets/{vue-i18n-DVI_S4Q5.js → vue-i18n-CGHHpbTP.js} +3 -3
  56. package/dist/client/assets/zh-CN-CgGEKuLF.js +1 -0
  57. package/dist/client/assets/zh-TW-DzNR26_1.js +1 -0
  58. package/dist/client/index.html +9 -8
  59. package/dist/devframe-D66W-pHy.mjs +1002 -0
  60. package/dist/devframe.mjs +1 -1
  61. package/dist/index.mjs +28 -8
  62. package/package.json +7 -3
  63. package/dist/client/assets/ChatWidget-BsnoQ6oS.js +0 -1
  64. package/dist/client/assets/DisplayFileIcon-DzBo3Ez5.js +0 -151
  65. package/dist/client/assets/GithubAvatar-CSsUV5vf.js +0 -1
  66. package/dist/client/assets/LandingHero-BkTBSu71.js +0 -1
  67. package/dist/client/assets/_repo_-Dcgj3PGg.js +0 -22
  68. package/dist/client/assets/analyze-509KQQBC.js +0 -1
  69. package/dist/client/assets/anthropic-messages-Cd2DkgOC.js +0 -41
  70. package/dist/client/assets/browser-agent-rpc-BXhoSh1z-DrxWeI3_.js +0 -1
  71. package/dist/client/assets/de-Bq9RfdAn.js +0 -1
  72. package/dist/client/assets/diff-Bx6SazPw.js +0 -1
  73. package/dist/client/assets/diffs-store-ncE62OUU.js +0 -1510
  74. package/dist/client/assets/dist-Dh0a8u-Y.js +0 -1
  75. package/dist/client/assets/en-8hQdak1X.js +0 -1
  76. package/dist/client/assets/fr-DAWKVvDP.js +0 -1
  77. package/dist/client/assets/i18n-CGV_MDS8.js +0 -2
  78. package/dist/client/assets/index-BCCy9wJJ.js +0 -2
  79. package/dist/client/assets/index-BDPZiDIt.css +0 -1
  80. package/dist/client/assets/install-B-q5w2uE.js +0 -4
  81. package/dist/client/assets/ko-DHculY2W.js +0 -1
  82. package/dist/client/assets/llm-DYDmh8Ki.js +0 -2
  83. package/dist/client/assets/llm-store-CVM33nlB.js +0 -2
  84. package/dist/client/assets/node.browser-BX-QLlU2.js +0 -1
  85. package/dist/client/assets/pages-B5mEqsbn.js +0 -1
  86. package/dist/client/assets/pages-local-x_ACBinc.js +0 -1
  87. package/dist/client/assets/pages-web-DitAPN6U.js +0 -21
  88. package/dist/client/assets/portalTarget-C60SzJiK.js +0 -1
  89. package/dist/client/assets/pt-BR-LLtJ99P6.js +0 -1
  90. package/dist/client/assets/ru-DvkrOLxc.js +0 -1
  91. package/dist/client/assets/runtime-dom.esm-bundler-CqL7__VR.js +0 -2
  92. package/dist/client/assets/upload-GnI9kmJu.js +0 -1
  93. package/dist/client/assets/useDocumentTitle-nuqxXiNo.js +0 -185
  94. package/dist/client/assets/zh-CN-BIibd6kG.js +0 -1
  95. package/dist/client/assets/zh-TW-3FtUHjoZ.js +0 -1
  96. package/dist/devframe-CX5butdC.mjs +0 -493
@@ -0,0 +1,92 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./LocalAgentSettings-C4AeYCZ0.js","./vue-i18n-CGHHpbTP.js","./ModelPicker-CDTiUMZ3.js","./rolldown-runtime-Dd_uD5pT.js","./runtime-dom.esm-bundler-Du_ZCcVN.js","./floating-ui.dom-CfpSQvPs.js","./SelectViewport-DF4P4Akh.js","./useNonce-CwUrgryd.js","./local-agents-BQLn-Ppw.js"])))=>i.map(i=>d[i]);
2
+ import{n as e,t}from"./rolldown-runtime-Dd_uD5pT.js";import{$ as n,At as r,Bt as i,Cr as a,Dr as o,Dt as s,Er as c,Et as l,G as u,H as d,I as f,In as p,Jt as m,K as h,Kn as g,Kt as _,M as v,Pt as y,Q as b,Qn as x,Rt as ee,Tr as te,Tt as ne,U as S,W as C,Wn as w,X as re,Xn as ie,Xt as ae,Zn as oe,_ as se,an as ce,bt as le,d as ue,dt as de,er as T,et as fe,g as pe,gn as me,h as he,hn as ge,i as _e,jn as ve,lt as ye,mn as be,n as xe,p as Se,qn as Ce,qt as we,s as Te,sn as Ee,tt as E,un as De,xn as Oe,yn as D,zn as ke}from"./vue-i18n-CGHHpbTP.js";import{C as Ae,w as je}from"./runtime-dom.esm-bundler-Du_ZCcVN.js";import{D as Me,E as Ne,O as Pe,d as Fe,f as Ie,k as Le,m as Re,n as ze,o as Be,p as Ve,s as He,t as Ue,v as We,w as Ge,x as Ke,y as qe}from"./ModelPicker-CDTiUMZ3.js";import{n as Je,t as Ye}from"./diagnostics-CrG4-M7r.js";import{n as Xe,r as O}from"./i18n-CgsK6PK3.js";import{r as Ze}from"./source-Dk1PNoY7.js";import{t as Qe}from"./locales-SpkpwNqX.js";import{t as k}from"./preload-helper-BaNbYf_w.js";import{t as $e}from"./ActionButton-V4dY2wPS.js";import{n as et,t as tt}from"./ActionIconButton-4b5xelMn.js";import{n as nt}from"./local-agents-BQLn-Ppw.js";import{n as rt}from"./core-messages-CsAgH4H9.js";var it=`https://api.github.com`,at=100,ot=class extends Error{status;constructor(e,t){super(t),this.status=e,this.name=`GithubApiError`}};function st(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=`${it}${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 ot(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=${at}&page=${i}`)).json();if(t.push(...a),a.length<at)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 ot(r.errors.some(e=>e.type===`FORBIDDEN`)?403:500,r.errors.map(e=>e.message).join(`; `));if(!r.data)throw new ot(500,`GitHub GraphQL response contained no data`);return r.data}}}function ct(e){if(!e)return null;let t=Date.parse(e.replace(` UTC`,`Z`).replace(` `,`T`));return Number.isNaN(t)?null:t}async function lt(e){let t;try{t=await st(Ze(e)).request(`/user`)}catch(e){throw e instanceof ot&&e.status===401?Ye.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:ct(t.headers.get(`github-authentication-token-expiration`))}}function ut(e,t){return Ge(e)?!1:Array.isArray(e)?e.some(e=>Pe(e,t)):Pe(e,t)}function dt(){let e=ye()?.vnode?.scopeId;return e?{[e]:``}:{}}function ft({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 pt({type:e,defaultValue:t,modelValue:n}){return e||ft({type:e,defaultValue:t,modelValue:n})}function mt({type:e,defaultValue:t}){return t===void 0?e===`single`?void 0:[]:t}function ht(e,t){let n=d(()=>pt(e)),r=se(e,`modelValue`,t,{defaultValue:mt(e),passive:e.modelValue===void 0,deep:!0});function i(e){if(n.value===`single`)r.value=Pe(e,r.value)?void 0:e;else{let t=Array.isArray(r.value)?[...r.value||[]]:[r.value].filter(Boolean);if(ut(t,e)){let n=t.findIndex(t=>Pe(t,e));t.splice(n,1)}else t.push(e);r.value=t}}return{modelValue:r,changeModelValue:i,isSingle:d(()=>n.value===`single`)}}var gt=E({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}=Fe(),a=d(()=>t.checked??t.value);return be(a,(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)=>(i(),C(Be,l({ref_key:`primitiveElement`,ref:n},{...t,...e.$attrs},{as:`input`}),null,16))}}),_t=E({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=d(()=>typeof t.value==`object`&&Array.isArray(t.value)&&t.value.length===0&&t.required),r=d(()=>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,a)=>(i(),h(v,null,[u(` We render single input if it's required `),n.value?(i(),C(gt,l({key:e.name},{...t,...e.$attrs},{name:e.name,value:e.value}),null,16,[`name`,`value`])):(i(!0),h(v,{key:1},_(r.value,n=>(i(),C(gt,l({key:n.name},{ref_for:!0},{...t,...e.$attrs},{name:n.name,value:n.value}),null,16,[`name`,`value`]))),128))],2112))}}),vt=`rovingFocusGroup.onEntryFocus`,yt={bubbles:!1,cancelable:!0},bt={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function xt(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}function St(e,t,n){let r=xt(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return bt[r]}function Ct(e,t=!1){let n=Ne();for(let r of e)if(r===n||(r.focus({preventScroll:t}),Ne()!==n))return}function wt(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var[Tt,Et]=Me(`RovingFocusGroup`),Dt=E({__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:r}){let a=e,o=r,{loop:s,orientation:c,dir:l}=oe(a),u=Ke(l),d=se(a,`currentTabStopId`,o,{defaultValue:a.defaultCurrentTabStopId,passive:a.currentTabStopId===void 0}),f=w(!1),p=w(!1),m=w(0),{getItems:h,CollectionSlot:g}=He({isProvider:!0});function _(e){let t=!p.value;if(e.currentTarget&&e.target===e.currentTarget&&t&&!f.value){let t=new CustomEvent(vt,yt);if(e.currentTarget.dispatchEvent(t),o(`entryFocus`,t),!t.defaultPrevented){let e=h().map(e=>e.ref).filter(e=>e.dataset.disabled!==``);Ct([e.find(e=>e.getAttribute(`data-active`)===``),e.find(e=>e.getAttribute(`data-highlighted`)===``),e.find(e=>e.id===d.value),...e].filter(Boolean),a.preventScrollOnEntryFocus)}}p.value=!1}function v(){setTimeout(()=>{p.value=!1},1)}return t({getItems:h}),Et({loop:s,dir:u,orientation:c,currentTabStopId:d,onItemFocus:e=>{d.value=e},onItemShiftTab:()=>{f.value=!0},onFocusableItemAdd:()=>{m.value++},onFocusableItemRemove:()=>{m.value--}}),(e,t)=>(i(),C(T(g),null,{default:D(()=>[n(T(Ie),{tabindex:f.value||m.value===0?-1:0,"data-orientation":T(c),as:e.as,"as-child":e.asChild,dir:T(u),style:{outline:`none`},onMousedown:t[0]||=e=>p.value=!0,onMouseup:v,onFocus:_,onBlur:t[1]||=e=>f.value=!1},{default:D(()=>[we(e.$slots,`default`)]),_:3},8,[`tabindex`,`data-orientation`,`as`,`as-child`,`dir`])]),_:3}))}}),Ot=E({__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,r=Tt(),a=Re(),o=d(()=>t.tabStopId||a),c=d(()=>r.currentTabStopId.value===o.value),{getItems:l,CollectionItem:u}=He();y(()=>{t.focusable&&r.onFocusableItemAdd()}),ee(()=>{t.focusable&&r.onFocusableItemRemove()}),be(()=>t.focusable,(e,t)=>{e!==t&&(e?r.onFocusableItemAdd():r.onFocusableItemRemove())});function f(e){if(e.key===`Tab`&&e.shiftKey){r.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let n=St(e,r.orientation.value,r.dir.value);if(n!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||!t.allowShiftKey&&e.shiftKey)return;e.preventDefault();let i=[...l().map(e=>e.ref).filter(e=>e.dataset.disabled!==``)];if(n===`last`)i.reverse();else if(n===`prev`||n===`next`){n===`prev`&&i.reverse();let t=i.indexOf(e.currentTarget);i=r.loop.value?wt(i,t+1):i.slice(t+1)}s(()=>Ct(i))}}return(e,t)=>(i(),C(T(u),null,{default:D(()=>[n(T(Ie),{tabindex:c.value?0:-1,"data-orientation":T(r).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?T(r).onItemFocus(o.value):t.preventDefault()},onFocus:t[1]||=e=>T(r).onItemFocus(o.value),onKeydown:f},{default:D(()=>[we(e.$slots,`default`)]),_:3},8,[`tabindex`,`data-orientation`,`data-active`,`data-disabled`,`as`,`as-child`])]),_:3}))}}),[kt,At]=Me(`CheckboxGroupRoot`);function jt(e){return e===`indeterminate`}function Mt(e){return jt(e)?`indeterminate`:e?`checked`:`unchecked`}var[Nt,Pt]=Me(`CheckboxRoot`),Ft=E({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}=We(),s=kt(null),c=se(n,`modelValue`,r,{defaultValue:n.defaultValue??n.falseValue,passive:n.modelValue===void 0}),f=d(()=>s?.disabled.value||n.disabled),p=d(()=>Pe(c.value,n.trueValue)),m=d(()=>Ge(s?.modelValue.value)?c.value===`indeterminate`?`indeterminate`:p.value:ut(s.modelValue.value,n.value));function g(){if(Ge(s?.modelValue.value))c.value===`indeterminate`?c.value=n.trueValue:c.value=p.value?n.falseValue:n.trueValue;else{let e=[...s.modelValue.value||[]];if(ut(e,n.value)){let t=e.findIndex(e=>Pe(e,n.value));e.splice(t,1)}else e.push(n.value);s.modelValue.value=e}}let _=qe(o),y=dt(),b=ce(),x=d(()=>{if(!b[`aria-label`])return n.id&&o.value?document.querySelector(`[for="${n.id}"]`)?.innerText:void 0});return Pt({disabled:f,state:m}),(e,t)=>(i(),h(v,null,[(i(),C(ae(T(s)?.rovingFocus.value?T(Ot):T(Ie)),l({...e.$attrs,...T(y)},{id:e.id,ref:T(a),role:`checkbox`,"as-child":e.asChild,as:e.as,type:e.as===`button`?`button`:void 0,"aria-checked":T(jt)(m.value)?`mixed`:m.value,"aria-required":e.required,"aria-label":e.$attrs[`aria-label`]||x.value,"data-state":T(Mt)(m.value),"data-disabled":f.value?``:void 0,disabled:f.value,focusable:T(s)?.rovingFocus.value?!f.value:void 0,onKeydown:Ae(je(()=>{},[`prevent`]),[`enter`]),onClick:g}),{default:D(()=>[we(e.$slots,`default`,{modelValue:T(c),state:m.value})]),_:3},16,[`id`,`as-child`,`as`,`type`,`aria-checked`,`aria-required`,`aria-label`,`data-state`,`data-disabled`,`disabled`,`focusable`,`onKeydown`])),T(_)&&e.name&&!T(s)?(i(),C(T(_t),l({key:0,type:`checkbox`,checked:!!m.value,name:e.name,value:e.value,disabled:f.value,required:e.required},T(y)),null,16,[`checked`,`name`,`value`,`disabled`,`required`])):u(`v-if`,!0)],64))}}),It=E({__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}=We(),r=Nt();return(e,a)=>(i(),C(T(Ve),{present:e.forceMount||T(jt)(T(r).state.value)||T(r).state.value===!0},{default:D(()=>[n(T(Ie),l({ref:T(t),"data-state":T(Mt)(T(r).state.value),"data-disabled":T(r).disabled.value?``:void 0,style:{pointerEvents:`none`},"as-child":e.asChild,as:e.as},e.$attrs),{default:D(()=>[we(e.$slots,`default`)]),_:3},16,[`data-state`,`data-disabled`,`as-child`,`as`])]),_:3},8,[`present`]))}}),[Lt,Rt]=Me(`TabsRoot`),zt=E({__name:`TabsRoot`,props:{defaultValue:{type:null,required:!1},orientation:{type:String,required:!1,default:`horizontal`},dir:{type:String,required:!1},activationMode:{type:String,required:!1,default:`automatic`},modelValue:{type:null,required:!1},unmountOnHide:{type:Boolean,required:!1,default:!0},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:[`update:modelValue`],setup(e,{emit:t}){let n=e,r=t,{orientation:a,unmountOnHide:o,dir:s}=oe(n),c=Ke(s);We();let l=se(n,`modelValue`,r,{defaultValue:n.defaultValue,passive:n.modelValue===void 0}),u=w(),d=Ce(new Set);return Rt({modelValue:l,changeModelValue:e=>{l.value=e},orientation:a,dir:c,unmountOnHide:o,activationMode:n.activationMode,baseId:Re(void 0,`reka-tabs`),tabsList:u,contentIds:d,registerContent:e=>{d.value=new Set([...d.value,e])},unregisterContent:e=>{let t=new Set(d.value);t.delete(e),d.value=t}}),(e,t)=>(i(),C(T(Ie),{dir:T(c),"data-orientation":T(a),"as-child":e.asChild,as:e.as},{default:D(()=>[we(e.$slots,`default`,{modelValue:T(l)})]),_:3},8,[`dir`,`data-orientation`,`as-child`,`as`]))}});function Bt(e,t){return`${e}-trigger-${t}`}function Vt(e,t){return`${e}-content-${t}`}var Ht=E({__name:`TabsContent`,props:{value:{type:[String,Number],required:!0},forceMount:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(e){let t=e,{forwardRef:a}=We(),o=Lt(),s=d(()=>Bt(o.baseId,t.value)),l=d(()=>Vt(o.baseId,t.value)),f=d(()=>t.value===o.modelValue.value),p=w(f.value);return y(()=>{o.registerContent(t.value),requestAnimationFrame(()=>{p.value=!1})}),r(()=>{o.unregisterContent(t.value)}),(e,t)=>(i(),C(T(Ve),{present:e.forceMount||f.value,"force-mount":``},{default:D(({present:t})=>[n(T(Ie),{id:l.value,ref:T(a),"as-child":e.asChild,as:e.as,role:`tabpanel`,"data-state":f.value?`active`:`inactive`,"data-orientation":T(o).orientation.value,"aria-labelledby":s.value,hidden:!t,tabindex:`0`,style:c({animationDuration:p.value?`0s`:void 0})},{default:D(()=>[!T(o).unmountOnHide.value||t?we(e.$slots,`default`,{key:0}):u(`v-if`,!0)]),_:2},1032,[`id`,`as-child`,`as`,`data-state`,`data-orientation`,`aria-labelledby`,`hidden`,`style`])]),_:3},8,[`present`]))}}),Ut=E({__name:`TabsIndicator`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(e,{expose:t}){let n=e,r=Lt();t({updateIndicatorStyle:c}),We();let a=Se(),o=w({size:null,thickness:null,position:null}),s=w([]);be(()=>[r.modelValue.value,r?.dir.value],()=>{c()},{immediate:!0,flush:`post`}),me(()=>{s.value=Array.from(r.tabsList.value?.querySelectorAll(`[role="tab"]`)||[])}),he(d(()=>[r.tabsList.value,...s.value]),c);function c(){let e=r.tabsList.value?.querySelector(`[role="tab"][data-state="active"]`);e&&(r.orientation.value===`horizontal`?o.value={size:e.offsetWidth,thickness:e.offsetHeight,position:e.offsetLeft}:o.value={size:e.offsetHeight,thickness:e.offsetWidth,position:e.offsetTop})}return(e,t)=>T(a)&&typeof o.value.size==`number`?(i(),C(T(Ie),l({key:0},n,{style:{"--reka-tabs-indicator-size":`${o.value.size}px`,"--reka-tabs-indicator-thickness":`${o.value.thickness}px`,"--reka-tabs-indicator-position":`${o.value.position}px`}}),{default:D(()=>[we(e.$slots,`default`)]),_:3},16,[`style`])):u(`v-if`,!0)}}),Wt=E({__name:`TabsList`,props:{loop:{type:Boolean,required:!1,default:!0},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(e){let{loop:t}=oe(e),{forwardRef:r,currentElement:a}=We(),o=Lt();return o.tabsList=a,(e,a)=>(i(),C(T(Dt),{"as-child":``,orientation:T(o).orientation.value,dir:T(o).dir.value,loop:T(t)},{default:D(()=>[n(T(Ie),{ref:T(r),role:`tablist`,"as-child":e.asChild,as:e.as,"aria-orientation":T(o).orientation.value},{default:D(()=>[we(e.$slots,`default`)]),_:3},8,[`as-child`,`as`,`aria-orientation`])]),_:3},8,[`orientation`,`dir`,`loop`]))}}),Gt=E({__name:`TabsTrigger`,props:{value:{type:[String,Number],required:!0},disabled:{type:Boolean,required:!1,default:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`button`}},setup(e){let t=e,{forwardRef:r}=We(),a=Lt(),o=d(()=>Bt(a.baseId,t.value)),s=d(()=>a.contentIds.value.has(t.value)?Vt(a.baseId,t.value):void 0),c=d(()=>t.value===a.modelValue.value);return(e,t)=>(i(),C(T(Ot),{"as-child":``,focusable:!e.disabled,active:c.value},{default:D(()=>[n(T(Ie),{id:o.value,ref:T(r),role:`tab`,type:e.as===`button`?`button`:void 0,as:e.as,"as-child":e.asChild,"aria-selected":c.value?`true`:`false`,"aria-controls":s.value,"data-state":c.value?`active`:`inactive`,disabled:e.disabled,"data-disabled":e.disabled?``:void 0,"data-orientation":T(a).orientation.value,onMousedown:t[0]||=je(t=>{!e.disabled&&t.ctrlKey===!1?T(a).changeModelValue(e.value):t.preventDefault()},[`left`]),onKeydown:t[1]||=Ae(t=>T(a).changeModelValue(e.value),[`enter`,`space`]),onFocus:t[2]||=()=>{let t=T(a).activationMode!==`manual`;!c.value&&!e.disabled&&t&&T(a).changeModelValue(e.value)}},{default:D(()=>[we(e.$slots,`default`)]),_:3},8,[`id`,`type`,`as`,`as-child`,`aria-selected`,`aria-controls`,`data-state`,`disabled`,`data-disabled`,`data-orientation`])]),_:3},8,[`focusable`,`active`]))}}),[Kt,qt]=Me(`ToggleGroupRoot`),Jt=E({__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 r=e,a=t,{loop:o,rovingFocus:s,disabled:c,dir:l}=oe(r),d=Ke(l),{forwardRef:f,currentElement:p}=We(),{modelValue:m,changeModelValue:h,isSingle:g}=ht(r,a),_=qe(p);return qt({isSingle:g,modelValue:m,changeModelValue:h,dir:d,orientation:r.orientation,loop:o,rovingFocus:s,disabled:c}),(e,t)=>(i(),C(ae(T(s)?T(Dt):T(Ie)),{"as-child":``,orientation:T(s)?e.orientation:void 0,dir:T(d),loop:T(s)?T(o):void 0},{default:D(()=>[n(T(Ie),{ref:T(f),role:`group`,"as-child":e.asChild,as:e.as},{default:D(()=>[we(e.$slots,`default`,{modelValue:T(m)}),T(_)&&e.name?(i(),C(_t,{key:0,name:e.name,required:e.required,value:T(m)},null,8,[`name`,`required`,`value`])):u(`v-if`,!0)]),_:3},8,[`as-child`,`as`])]),_:3},8,[`orientation`,`dir`,`loop`]))}}),Yt=E({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 r=e,a=t,{forwardRef:o,currentElement:s}=We(),c=dt(),f=Kt(null),p=se(r,`modelValue`,a,{defaultValue:r.defaultValue,passive:r.modelValue===void 0});function m(){p.value=!p.value}let g=d(()=>p.value?`on`:`off`),_=qe(s);return(e,t)=>(i(),h(v,null,[n(T(Ie),l({ref:T(o),type:e.as===`button`?`button`:void 0,"as-child":r.asChild,as:e.as,"aria-pressed":T(p),"data-state":g.value,"data-disabled":e.disabled?``:void 0,disabled:e.disabled},{...T(c),...e.$attrs},{onClick:m}),{default:D(()=>[we(e.$slots,`default`,{modelValue:T(p),disabled:e.disabled,pressed:T(p),state:g.value})]),_:3},16,[`type`,`as-child`,`as`,`aria-pressed`,`data-state`,`data-disabled`,`disabled`]),T(_)&&e.name&&!T(f)?(i(),C(_t,l({key:0,type:`checkbox`,name:e.name,value:T(p),required:e.required},T(c)),null,16,[`name`,`value`,`required`])):u(`v-if`,!0)],64))}}),Xt=E({__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,r=Kt(),a=d(()=>r.disabled?.value||t.disabled),o=d(()=>ut(r.modelValue.value,t.value)),{forwardRef:s}=We(),c=dt();return(e,u)=>(i(),C(ae(T(r).rovingFocus.value?T(Ot):T(Ie)),l({"as-child":``},T(r).rovingFocus.value?{focusable:!a.value,active:o.value}:{}),{default:D(()=>[n(T(Yt),l({...T(c),...t},{ref:T(s),disabled:a.value,"model-value":o.value,"onUpdate:modelValue":u[0]||=t=>T(r).changeModelValue(e.value)}),{default:D(t=>[we(e.$slots,`default`,te(de(t)))]),_:3},16,[`disabled`,`model-value`])]),_:3},16))}}),Zt=`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`,Qt=E({inheritAttrs:!1,__name:`FormCheckbox`,props:ne({label:{},disabled:{type:Boolean}},{modelValue:{type:Boolean,default:!1},modelModifiers:{}}),emits:[`update:modelValue`],setup(e){let t=Ee(e,`modelValue`);return(r,s)=>e.label||r.$slots.default?(i(),h(`label`,l({key:0},r.$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(T(Ft),{modelValue:t.value,"onUpdate:modelValue":s[0]||=e=>t.value=e,disabled:e.disabled,class:a(Zt)},{default:D(()=>[n(T(It),{class:`text-white`},{default:D(()=>[...s[2]||=[S(`div`,{class:`i-ph:check-bold text-micro text-white mt--1px`,"aria-hidden":`true`},null,-1)]]),_:1})]),_:1},8,[`modelValue`,`disabled`]),S(`span`,null,[we(r.$slots,`default`,{},()=>[b(o(e.label),1)])])],16)):(i(),C(T(Ft),l({key:1},r.$attrs,{modelValue:t.value,"onUpdate:modelValue":s[1]||=e=>t.value=e,disabled:e.disabled,class:Zt}),{default:D(()=>[n(T(It),{class:`text-white`},{default:D(()=>[...s[3]||=[S(`div`,{class:`i-ph:check-bold text-micro text-white mt--1px`,"aria-hidden":`true`},null,-1)]]),_:1})]),_:1},16,[`modelValue`,`disabled`]))}}),$t=`diffs-container`,en=/(?=^diff --git)/gm,tn=/(?<=\n)/,nn=/^(---|\+\+\+)\s+([^\t\r\n]+)/,rn=/^index ([0-9a-f]+)\.\.([0-9a-f]+)(?: (\d+))?$/i,an=`header-prefix`,on=`header-filename-suffix`,sn=`header-metadata`,cn=`header-custom`,ln={dark:`pierre-dark`,light:`pierre-light`},un=`data-theme-css`,dn=`data-unsafe-css`,fn=`data-diffs-scrollbar-measure`,pn=`--diffs-scrollbar-gutter-measured`,mn=1e5,hn={hunkLineCount:50,lineHeight:20,diffHeaderHeight:44,spacing:8};({...hn});var gn=Object.freeze({fromStart:0,fromEnd:0}),_n={startingLine:0,totalLines:1/0,bufferBefore:0,bufferAfter:0},vn={startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:0},yn=class extends Error{constructor(e){super(e),this.name=`ShikiError`}};function bn(e){return xn(e)}function xn(e){return Array.isArray(e)?Sn(e):e instanceof RegExp?e:typeof e==`object`?Cn(e):e}function Sn(e){let t=[];for(let n=0,r=e.length;n<r;n++)t[n]=xn(e[n]);return t}function Cn(e){let t={};for(let n in e)t[n]=xn(e[n]);return t}function wn(e,...t){return t.forEach(t=>{for(let n in t)e[n]=t[n]}),e}function Tn(e){let t=~e.lastIndexOf(`/`)||~e.lastIndexOf(`\\`);return t===0?e:~t===e.length-1?Tn(e.substring(0,e.length-1)):e.substr(~t+1)}var En=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,Dn=class{static hasCaptures(e){return e!==null&&(En.lastIndex=0,En.test(e))}static replaceCaptures(e,t,n){return e.replace(En,(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 On(e,t){return e<t?-1:+(e>t)}function kn(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=On(e[r],t[r]);if(n!==0)return n}return 0}return n-r}function An(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 jn(e){return e.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,`\\$&`)}var Mn=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}},Nn=class{constructor(e,t,n){this._colorMap=e,this._defaults=t,this._root=n}static createFromRawTheme(e,t){return this.createFromParsedTheme(Rn(e),t)}static createFromParsedTheme(e,t){return Vn(e,t)}_cachedMatchRoot=new Mn(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=>Fn(e.parent,t.parentScopes));return n?new Ln(n.fontStyle,n.foreground,n.background):null}},Pn=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 Fn(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&&!In(e.scopeName,r);){if(i)return!1;e=e.parent}if(!e)return!1;e=e.parent}return!0}function In(e,t){return t===e||e.startsWith(t)&&e[t.length]===`.`}var Ln=class{constructor(e,t,n){this.fontStyle=e,this.foregroundId=t,this.backgroundId=n}};function Rn(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`&&An(i.settings.foreground)&&(s=i.settings.foreground);let c=null;typeof i.settings.background==`string`&&An(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 zn(l,u,e,o,s,c)}}return n}var zn=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}},Bn=(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))(Bn||{});function Vn(e,t){e.sort((e,t)=>{let n=On(e.scope,t.scope);return n!==0||(n=kn(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 Hn(t),o=new Ln(n,a.getId(r),a.getId(i)),s=new Gn(new Wn(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 Nn(a,o,s)}var Hn=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)}},Un=Object.freeze([]),Wn=class e{scopeDepth;parentScopes;fontStyle;foreground;background;constructor(e,t,n,r,i){this.scopeDepth=e,this.parentScopes=t||Un,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)}},Gn=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(),Wn.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(kn(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 Wn(e,t,n,r,i))}},Kn=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=Jn(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 qn(e){return e}function Jn(e){return e}function Yn(e,t){let n=[],r=Zn(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(Xn(i)){let e=[];do e.push(i),i=r.next();while(Xn(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 Xn(e){return!!e&&!!e.match(/[\w\.:]+/)}function Zn(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 Qn(e){typeof e.dispose==`function`&&e.dispose()}var $n=class{constructor(e){this.scopeName=e}toKey(){return this.scopeName}},er=class{constructor(e,t){this.scopeName=e,this.ruleName=t}toKey(){return`${this.scopeName}#${this.ruleName}`}},tr=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))}},nr=class{constructor(e,t){this.repo=e,this.initialScopeName=t,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new $n(this.initialScopeName)]}seenFullScopeRequests=new Set;seenPartialScopeRequests=new Set;Q;processQueue(){let e=this.Q;this.Q=[];let t=new tr;for(let n of e)rr(n,this.initialScopeName,this.repo,t);for(let e of t.references)if(e instanceof $n){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 rr(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 $n?ar({baseGrammar:a,selfGrammar:i},r):ir(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 $n(e))}function ir(e,t,n){if(t.repository&&t.repository[e]){let r=t.repository[e];or([r],t,n)}}function ar(e,t){e.selfGrammar.patterns&&Array.isArray(e.selfGrammar.patterns)&&or(e.selfGrammar.patterns,{...e,repository:e.selfGrammar.repository},t),e.selfGrammar.injections&&or(Object.values(e.selfGrammar.injections),{...e,repository:e.selfGrammar.repository},t)}function or(e,t,n){for(let r of e){if(n.visitedRule.has(r))continue;n.visitedRule.add(r);let e=r.repository?wn({},t.repository,r.repository):t.repository;Array.isArray(r.patterns)&&or(r.patterns,{...t,repository:e},n);let i=r.include;if(!i)continue;let a=fr(i);switch(a.kind){case 0:ar({...t,selfGrammar:t.baseGrammar},n);break;case 1:ar(t,n);break;case 2:ir(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?ir(a.ruleName,i,n):ar(i,n)}else a.kind===4?n.add(new er(a.scopeName,a.ruleName)):n.add(new $n(a.scopeName))}}}var sr=class{kind=0},cr=class{kind=1},lr=class{constructor(e){this.ruleName=e}kind=2},ur=class{constructor(e){this.scopeName=e}kind=3},dr=class{constructor(e,t){this.scopeName=e,this.ruleName=t}kind=4};function fr(e){if(e===`$base`)return new sr;if(e===`$self`)return new cr;let t=e.indexOf(`#`);return t===-1?new ur(e):t===0?new lr(e.substring(1)):new dr(e.substring(0,t),e.substring(t+1))}var pr=/\\(\d+)/,mr=/\\(\d+)/g,hr=-1,gr=-2;function _r(e){return e}function vr(e){return e}var yr=class{$location;id;_nameIsCapturing;_name;_contentNameIsCapturing;_contentName;constructor(e,t,n,r){this.$location=e,this.id=t,this._name=n||null,this._nameIsCapturing=Dn.hasCaptures(this._name),this._contentName=r||null,this._contentNameIsCapturing=Dn.hasCaptures(this._contentName)}get debugName(){let e=this.$location?`${Tn(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:Dn.replaceCaptures(this._name,e,t)}getContentName(e,t){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:Dn.replaceCaptures(this._contentName,e,t)}},br=class extends yr{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!`)}},xr=class extends yr{_match;captures;_cachedCompiledPatterns;constructor(e,t,n,r,i){super(e,t,n,null),this._match=new Er(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 Dr,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},Sr=class extends yr{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 Dr,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},Cr=class extends yr{_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 Er(i,this.id),this.beginCaptures=a,this._end=new Er(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 Dr;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}},wr=class extends yr{_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 Er(i,this.id),this.beginCaptures=a,this.whileCaptures=s,this._while=new Er(o,gr),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 Dr;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 Dr,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,t||`￿`),this._cachedCompiledWhilePatterns}},Tr=class e{static createCaptureRule(e,t,n,r,i){return e.registerRule(e=>new br(t,e,n,r,i))}static getCompiledRuleId(t,n,r){return t.id||n.registerRule(i=>{if(t.id=i,t.match)return new xr(t.$vscodeTextmateLocation,t.id,t.name,t.match,e._compileCaptures(t.captures,n,r));if(t.begin===void 0){t.repository&&(r=wn({},r,t.repository));let i=t.patterns;return i===void 0&&t.include&&(i=[{include:t.include}]),new Sr(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,e._compilePatterns(i,n,r))}return t.while?new wr(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 Cr(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=fr(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 Sr||e instanceof Cr||e instanceof wr)&&e.hasMissingPatterns&&e.patterns.length===0&&(t=!0),t)continue;i.push(s)}}return{patterns:i,hasMissingPatterns:(t?t.length:0)!==i.length}}},Er=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`&&pr.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 mr.lastIndex=0,this.source.replace(mr,(e,t)=>jn(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}},Dr=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 Or(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 Or(e,this._items.map(e=>e.resolveAnchors(t,n)),this._items.map(e=>e.ruleId))}},Or=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(`
3
+ `)}findNextMatchSync(e,t,n){let r=this.scanner.findNextMatchSync(e,t,n);return r?{ruleId:this.rules[r.index],captureIndices:r.captureIndices}:null}},kr=class{constructor(e,t){this.languageId=e,this.tokenType=t}},Ar=class e{_defaultAttributes;_embeddedLanguagesMatcher;constructor(e,t){this._defaultAttributes=new kr(e,8),this._embeddedLanguagesMatcher=new jr(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 kr(0,0);_getBasicScopeAttributes=new Mn(e=>new kr(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/},jr=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])=>jn(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 Mr=class{constructor(e,t){this.stack=e,this.stoppedEarly=t}};function Nr(e,t,n,r,i,a,o,s){let c=t.content.length,l=!1,u=-1;if(o){let o=Pr(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 Mr(i,!0);f()}return new Mr(i,!1);function f(){let o=Fr(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===hr){let o=i.getRule(e);a.produce(i,s[0].start),i=i.withContentNameScopesList(i.nameScopesList),Br(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 Cr){let r=o;Br(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 wr){let r=o;Br(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(Br(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 Pr(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 wr&&s.push({rule:n,stack:t})}for(let c=s.pop();c;c=s.pop()){let{ruleScanner:s,findOptions:l}=zr(c.rule,e,c.stack.endRule,n,r===o),u=s.findNextMatchSync(t,r,l);if(u){if(u.ruleId!==gr){i=c.stack.pop();break}u.captureIndices&&u.captureIndices.length&&(a.produce(c.stack,u.captureIndices[0].start),Br(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 Fr(e,t,n,r,i,a){let o=Ir(e,t,n,r,i,a),s=e.getInjections();if(s.length===0)return o;let c=Lr(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 Ir(e,t,n,r,i,a){let{ruleScanner:o,findOptions:s}=Rr(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 Lr(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}=Rr(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 Rr(e,t,n,r,i){return{ruleScanner:e.compileAG(t,n,r,i),findOptions:0}}function zr(e,t,n,r,i){return{ruleScanner:e.compileWhileAG(t,n,r,i),findOptions:0}}function Br(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));Nr(e,p,n&&d.start===0,d.start,f,i,!1,0),Qn(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 Vr(t,d.end))}}for(;l.length>0;)i.produceFromScopes(l[l.length-1].scopes,l[l.length-1].endPos),l.pop()}var Vr=class{scopes;endPos;constructor(e,t){this.scopes=e,this.endPos=t}};function Hr(e,t,n,r,i,a,o,s){return new Kr(e,t,n,r,i,a,o,s)}function Ur(e,t,n,r,i){let a=Yn(t,Wr),o=Tr.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 Wr(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(Gr(t[r],e))return n=r+1,!0;return!1})}function Gr(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 Kr=class{constructor(e,t,n,r,i,a,o,s){if(this._rootScopeName=e,this.balancedBracketSelectors=a,this._onigLib=s,this._basicScopeAttributesProvider=new Ar(n,r),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=o,this._grammar=qr(t,null),this._injections=null,this._tokenTypeMatchers=[],i)for(let e of Object.keys(i)){let t=Yn(e,Wr);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)Ur(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&&Ur(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(_r(t));return this._ruleId2desc[t]=n,n}getRule(e){return this._ruleId2desc[vr(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]=qr(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=Tr.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections());let i;if(!t||t===Yr.NULL){i=!0;let e=this._basicScopeAttributesProvider.getDefaultAttributes(),n=this.themeProvider.getDefaults(),r=Kn.set(0,e.languageId,e.tokenType,null,n.fontStyle,n.foregroundId,n.backgroundId),a=this.getRule(this._rootId).getName(null,null),o;o=a?Jr.createRootAndLookUpScopeName(a,r,this):Jr.createRoot(`unknown`,r),t=new Yr(null,this._rootId,-1,-1,!1,null,o,o)}else i=!1,t.reset();e+=`
4
+ `;let a=this.createOnigString(e),o=a.content.length,s=new Zr(n,e,this._tokenTypeMatchers,this.balancedBracketSelectors),c=Nr(this,a,i,0,t,s,!0,r);return Qn(a),{lineLength:o,lineTokens:s,ruleStack:c.stack,stoppedEarly:c.stoppedEarly}}};function qr(e,t){return e=bn(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 Jr=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=Pn.push(i,t.scopeNames),r=new e(r,i,t.encodedTokenAttributes);return r}static createRoot(t,n){return new e(null,new Pn(null,t),n)}static createRootAndLookUpScopeName(t,n,r){let i=r.getMetadataForScope(t),a=new Pn(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),Kn.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}},Yr=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)?Jr.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:vr(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=Jr.fromExtension(t?.nameScopesList??null,n.nameScopesList);return new e(t,_r(n.ruleId),n.enterPos??-1,n.anchorPos??-1,n.beginRuleCapturedEOL,n.endRule,r,Jr.fromExtension(r,n.contentNameScopesList))}},Xr=class{balancedBracketScopes;unbalancedBracketScopes;allowAny=!1;constructor(e,t){this.balancedBracketScopes=e.flatMap(e=>e===`*`?(this.allowAny=!0,[]):Yn(e,Wr).map(e=>e.matcher)),this.unbalancedBracketScopes=t.flatMap(e=>Yn(e,Wr).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}},Zr=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=Kn.set(n,0,qn(e.type),null,-1,0,0));this.balancedBracketSelectors&&(r=this.balancedBracketSelectors.match(t))}if(r&&(n=Kn.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}},Qr=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,Hr(e,a,t,n,r,i,this,this._onigLib))}return this._grammars.get(e)}},$r=class{_options;_syncRegistry;_ensureGrammarCache;constructor(e){this._options=e,this._syncRegistry=new Qr(Nn.createFromRawTheme(e.theme,e.colorMap),e.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(e,t){this._syncRegistry.setTheme(Nn.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 Xr(n.balancedBracketSelectors||[],n.unbalancedBracketSelectors||[]))}loadGrammar(e){return this._loadGrammar(e,0,null,null,null)}_loadGrammar(e,t,n,r,i){let a=new nr(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)}},ei=Yr.NULL;function ti(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 ni(e,t){return e&&(t?.[e?.toLowerCase()]||e)}function ri(e){return Array.isArray(e)?e:[e]}async function ii(e){return Promise.resolve(typeof e==`function`?e():e).then(e=>e.default||e)}function ai(e){return!e||[`plaintext`,`txt`,`text`,`plain`].includes(e)}function oi(e){return e===`ansi`||ai(e)}function si(e){return e===`none`}function ci(e){return si(e)}var li=/(\r?\n)/g;function ui(e,t=!1){if(e.length===0)return[[``,0]];let n=e.split(li),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 di={light:`#333333`,dark:`#bbbbbb`},fi={light:`#fffffe`,dark:`#1e1e1e`},pi=`__shiki_resolved`;function mi(e){if(e?.[pi])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`?di.light:di.dark,n||=t.type===`light`?fi.light:fi.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,pi,{enumerable:!1,writable:!1,value:!0}),t}async function hi(e){return[...new Set((await Promise.all(e.filter(e=>!oi(e)).map(async e=>await ii(e).then(e=>Array.isArray(e)?e:[e])))).flat())]}async function gi(e){return(await Promise.all(e.map(async e=>ci(e)?null:mi(await ii(e))))).filter(e=>!!e)}function _i(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 yn(`Circular alias \`${[...n].join(` -> `)} -> ${e}\``);n.add(e)}}return e}var vi=class extends $r{_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=mi(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=Nn.createFromRawTheme(e),this._textmateThemeCache.set(e,t)),this._syncRegistry.setTheme(t)}getGrammar(e){return e=_i(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 yn(`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))}},yi=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}},bi=0;function xi(e){bi+=1,e.warnings!==!1&&bi>=10&&bi%10==0&&console.warn(`[Shiki] ${bi} 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 yn("`engine` option is required for synchronous mode");let n=(e.langs||[]).flat(1),r=(e.themes||[]).flat(1).map(mi),i=new vi(new yi(e.engine,n),r,n,e.langAlias),a;function o(t){return _i(t,e.langAlias)}function s(e){g();let t=i.getGrammar(typeof e==`string`?e:e.name);if(!t)throw new yn(`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 yn(`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 hi(e))}function m(...e){g();for(let t of e.flat(1))i.loadTheme(t)}async function h(...e){return g(),m(await gi(e))}function g(){if(t)throw new yn(`Shiki instance has been disposed`)}function _(){t||(t=!0,i.dispose(),--bi)}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 Si(e){e.engine||console.warn("`engine` option is required. Use `createOnigurumaEngine` or `createJavaScriptRegexEngine` to create an engine.");let[t,n,r]=await Promise.all([gi(e.themes||[]),hi(e.langs||[]),e.engine]);return xi({...e,themes:t,langs:n,engine:r})}var Ci=new WeakMap;function wi(e,t){Ci.set(e,t)}function Ti(e){return Ci.get(e)}var Ei=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(ri(n).map(e=>[e,ei])),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 Di(this._stacks[e])}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.getScopes()}}};function Di(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 Oi(e,t){if(!(e instanceof Ei))throw new yn(`Invalid grammar state`);return e.getInternalStack(t)}var ki=/,/,Ai=/ /;function ji(e,t,n={}){let{theme:r=e.getLoadedThemes()[0]}=n;if(ai(e.resolveLangAlias(n.lang||`text`))||si(r))return ui(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 yn(`Grammar state language "${n.grammarState.lang}" does not match highlight language "${o.name}"`);if(!n.grammarState.themes.includes(i.name))throw new yn(`Grammar state themes "${n.grammarState.themes}" do not contain highlight theme "${i.name}"`)}return Ni(t,o,i,a,n)}function Mi(...e){if(e.length===2)return Ti(e[1]);let[t,n,r={}]=e,{lang:i=`text`,theme:a=t.getLoadedThemes()[0]}=r;if(ai(i)||si(a))throw new yn(`Plain language does not have grammar state`);if(i===`ansi`)throw new yn(`ANSI language does not have grammar state`);let{theme:o,colorMap:s}=t.setTheme(a),c=t.getLanguage(i);return new Ei(Pi(n,c,o,s,r).stateStack,c.name,o.name)}function Ni(e,t,n,r,i){let a=Pi(e,t,n,r,i),o=new Ei(a.stateStack,t.name,n.name);return wi(a.tokens,o),a.tokens}function Pi(e,t,n,r,i){let a=ti(n,i),{tokenizeMaxLineLength:o=0,tokenizeTimeLimit:s=500,includeExplanation:c=!1}=i,l=ui(e),u=i.grammarState?Oi(i.grammarState,n.name)??ei:i.grammarContextCode==null?ei:Pi(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=ni(r[Kn.getForeground(s)],a),u=Kn.getFontStyle(s),f={content:i.substring(t,o),offset:p+t,color:l,fontStyle:u};if(c===`tokenType`)f.type=Kn.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(ki).map(e=>e.trim());break;case`object`:n=t.scope;break;default:continue}e.push({settings:t,selectors:n.map(e=>e.split(Ai))})}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`?Fi(t.scopes):Ii(e,t.scopes)}),g+=1}}d.push(f)}f.push(d),d=[],u=_.ruleStack}return{tokens:f,stateStack:u}}function Fi(e){return e.map(e=>({scopeName:e}))}function Ii(e,t){let n=[];for(let r=0,i=t.length;r<i;r++){let i=t[r];n[r]={scopeName:i,themeMatches:zi(e,i,t.slice(0,r))}}return n}function Li(e,t){return e===t||t.substring(0,e.length)===e&&t[e.length]===`.`}function Ri(e,t,n){if(!Li(e.at(-1),t))return!1;let r=e.length-2,i=n.length-1;for(;r>=0&&i>=0;)Li(e[r],n[i])&&--r,--i;return r===-1}function zi(e,t,n){let r=[];for(let{selectors:i,settings:a}of e)for(let e of i)if(Ri(e,t,n)){r.push(a);break}return r}function Bi(e,t,n,r=ji){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:Ti(a),theme:typeof i.theme==`string`?i.theme:i.theme.name}}),o=Vi(...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 Ei(Object.fromEntries(a.map(e=>[e.theme,e.state?.getInternalStack(e.theme)])),a[0].state.lang):void 0;return c&&wi(s,c),s}function Vi(...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 Hi(e){let t=[],n=new Set;for(let r of Ui(e.themes)){let e=Ki(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 Hi({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 Hi({themes:t})},registerInto(e){for(let t of r)e.registerThemeIfAbsent(t.name,t.load)}}}function Ui(e){return Wi(e)?[e]:e}function Wi(e){return Ki(e)||Gi(e)}function Gi(e){return typeof e.name==`string`&&typeof e.load==`function`}function Ki(e){return typeof e.getThemes==`function`}function qi(e){return typeof e==`object`&&e&&`default`in e?e.default:e}function Ji({name:e,load:t,colorScheme:n,collection:r,displayName:i}){return{name:e,colorScheme:n,collection:r,displayName:i,load:Yi(t)}}function Yi(e){return async()=>mi(qi(await e()))}var Xi=`pierre`,Zi=[`pierre-dark`,`pierre-dark-soft`,`pierre-dark-vibrant`,`pierre-dark-protanopia-deuteranopia`,`pierre-dark-tritanopia`],Qi=[`pierre-light`,`pierre-light-soft`,`pierre-light-vibrant`,`pierre-light-protanopia-deuteranopia`,`pierre-light-tritanopia`],$i=[...Qi,...Zi],ea=new Set(Qi);function ta(e){return ea.has(e)?`light`:`dark`}var na={"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`},ra={"pierre-dark":()=>k(()=>import(`./pierre-dark-CpLgRqie.js`),[],import.meta.url),"pierre-dark-soft":()=>k(()=>import(`./pierre-dark-soft-kZQmAZld.js`),[],import.meta.url),"pierre-dark-vibrant":()=>k(()=>import(`./pierre-dark-vibrant-CpQYzh95.js`),[],import.meta.url),"pierre-dark-protanopia-deuteranopia":()=>k(()=>import(`./pierre-dark-protanopia-deuteranopia-B35FxJx-.js`),[],import.meta.url),"pierre-dark-tritanopia":()=>k(()=>import(`./pierre-dark-tritanopia-CpjhbsIL.js`),[],import.meta.url),"pierre-light":()=>k(()=>import(`./pierre-light-CoaEpmwp.js`),[],import.meta.url),"pierre-light-soft":()=>k(()=>import(`./pierre-light-soft-lWLdNTOI.js`),[],import.meta.url),"pierre-light-vibrant":()=>k(()=>import(`./pierre-light-vibrant-D80Fkn33.js`),[],import.meta.url),"pierre-light-protanopia-deuteranopia":()=>k(()=>import(`./pierre-light-protanopia-deuteranopia-0fSaH845.js`),[],import.meta.url),"pierre-light-tritanopia":()=>k(()=>import(`./pierre-light-tritanopia-CEbqgOJL.js`),[],import.meta.url)};function ia(e){return Ji({name:e,collection:Xi,colorScheme:ta(e),displayName:na[e],load:ra[e]})}var aa=Hi({themes:$i.map(e=>ia(e))}),oa=`shiki`,sa=[`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`],ca=`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(`.`),la=new Set(sa);function ua(e){return la.has(e)?`light`:`dark`}var da={andromeeda:()=>k(()=>import(`./andromeeda-vGVdxbeo.js`),[],import.meta.url),"aurora-x":()=>k(()=>import(`./aurora-x-CDeNXAV0.js`),[],import.meta.url),"ayu-dark":()=>k(()=>import(`./ayu-dark-DluEY0Gj.js`),[],import.meta.url),"ayu-light":()=>k(()=>import(`./ayu-light-C3h-C4tm.js`),[],import.meta.url),"ayu-mirage":()=>k(()=>import(`./ayu-mirage-Bqwy1Gya.js`),[],import.meta.url),"catppuccin-frappe":()=>k(()=>import(`./catppuccin-frappe-C9Q5zVZY.js`),[],import.meta.url),"catppuccin-latte":()=>k(()=>import(`./catppuccin-latte-CtsyrtPq.js`),[],import.meta.url),"catppuccin-macchiato":()=>k(()=>import(`./catppuccin-macchiato-R8nAf1vR.js`),[],import.meta.url),"catppuccin-mocha":()=>k(()=>import(`./catppuccin-mocha-DjuaAJKi.js`),[],import.meta.url),"dark-plus":()=>k(()=>import(`./dark-plus-Cs2F2srj.js`),[],import.meta.url),dracula:()=>k(()=>import(`./dracula-BHWKrbxM.js`),[],import.meta.url),"dracula-soft":()=>k(()=>import(`./dracula-soft-5eyTD99u.js`),[],import.meta.url),"everforest-dark":()=>k(()=>import(`./everforest-dark-sB-x3p7T.js`),[],import.meta.url),"everforest-light":()=>k(()=>import(`./everforest-light-Df2xbC6M.js`),[],import.meta.url),"github-dark":()=>k(()=>import(`./github-dark-C-LZuMrd.js`),[],import.meta.url),"github-dark-default":()=>k(()=>import(`./github-dark-default-DXG-b-1a.js`),[],import.meta.url),"github-dark-dimmed":()=>k(()=>import(`./github-dark-dimmed-Bx1FflLF.js`),[],import.meta.url),"github-dark-high-contrast":()=>k(()=>import(`./github-dark-high-contrast-B_tTalzw.js`),[],import.meta.url),"github-light":()=>k(()=>import(`./github-light-EUqPIrTm.js`),[],import.meta.url),"github-light-default":()=>k(()=>import(`./github-light-default-BXViO-2h.js`),[],import.meta.url),"github-light-high-contrast":()=>k(()=>import(`./github-light-high-contrast-B68TUdTA.js`),[],import.meta.url),"gruvbox-dark-hard":()=>k(()=>import(`./gruvbox-dark-hard-C820rvS2.js`),[],import.meta.url),"gruvbox-dark-medium":()=>k(()=>import(`./gruvbox-dark-medium-BPjhmG05.js`),[],import.meta.url),"gruvbox-dark-soft":()=>k(()=>import(`./gruvbox-dark-soft-MrdJrrXF.js`),[],import.meta.url),"gruvbox-light-hard":()=>k(()=>import(`./gruvbox-light-hard-BC_s9l72.js`),[],import.meta.url),"gruvbox-light-medium":()=>k(()=>import(`./gruvbox-light-medium-BAWPOn9u.js`),[],import.meta.url),"gruvbox-light-soft":()=>k(()=>import(`./gruvbox-light-soft-BSMLrYjP.js`),[],import.meta.url),horizon:()=>k(()=>import(`./horizon-CE9ld1lL.js`),[],import.meta.url),"horizon-bright":()=>k(()=>import(`./horizon-bright-DSNQnXHK.js`),[],import.meta.url),houston:()=>k(()=>import(`./houston-CsvMBhTu.js`),[],import.meta.url),"kanagawa-dragon":()=>k(()=>import(`./kanagawa-dragon-Bozd7klA.js`),[],import.meta.url),"kanagawa-lotus":()=>k(()=>import(`./kanagawa-lotus-BmuOG9ZW.js`),[],import.meta.url),"kanagawa-wave":()=>k(()=>import(`./kanagawa-wave-BML5mF2J.js`),[],import.meta.url),laserwave:()=>k(()=>import(`./laserwave-C_8bwKvT.js`),[],import.meta.url),"light-plus":()=>k(()=>import(`./light-plus-DVQuIRkW.js`),[],import.meta.url),"material-theme":()=>k(()=>import(`./material-theme-Bm3Qr25_.js`),[],import.meta.url),"material-theme-darker":()=>k(()=>import(`./material-theme-darker-2IIEA8gg.js`),[],import.meta.url),"material-theme-lighter":()=>k(()=>import(`./material-theme-lighter-uhdI0v04.js`),[],import.meta.url),"material-theme-ocean":()=>k(()=>import(`./material-theme-ocean-CHQ94UKr.js`),[],import.meta.url),"material-theme-palenight":()=>k(()=>import(`./material-theme-palenight-B5W6OYN7.js`),[],import.meta.url),"min-dark":()=>k(()=>import(`./min-dark-BSWPekZh.js`),[],import.meta.url),"min-light":()=>k(()=>import(`./min-light-DDpmG2fV.js`),[],import.meta.url),monokai:()=>k(()=>import(`./monokai-B_bV9PQ9.js`),[],import.meta.url),"night-owl":()=>k(()=>import(`./night-owl-DhmEMT88.js`),[],import.meta.url),"night-owl-light":()=>k(()=>import(`./night-owl-light-eJ-hLW7d.js`),[],import.meta.url),nord:()=>k(()=>import(`./nord-Cb4Vim4T.js`),[],import.meta.url),"one-dark-pro":()=>k(()=>import(`./one-dark-pro-CLwyXe_n.js`),[],import.meta.url),"one-light":()=>k(()=>import(`./one-light-D7Lr4KcI.js`),[],import.meta.url),plastic:()=>k(()=>import(`./plastic-DQwYfKfQ.js`),[],import.meta.url),poimandres:()=>k(()=>import(`./poimandres-DRFjx7u4.js`),[],import.meta.url),red:()=>k(()=>import(`./red-DX1BQOs8.js`),[],import.meta.url),"rose-pine":()=>k(()=>import(`./rose-pine-aMsaMD1D.js`),[],import.meta.url),"rose-pine-dawn":()=>k(()=>import(`./rose-pine-dawn-8PwUyIlP.js`),[],import.meta.url),"rose-pine-moon":()=>k(()=>import(`./rose-pine-moon-DO-qXg-I.js`),[],import.meta.url),"slack-dark":()=>k(()=>import(`./slack-dark-DnToyrRv.js`),[],import.meta.url),"slack-ochin":()=>k(()=>import(`./slack-ochin-B2OO5cIa.js`),[],import.meta.url),"snazzy-light":()=>k(()=>import(`./snazzy-light-4G7pJPwS.js`),[],import.meta.url),"solarized-dark":()=>k(()=>import(`./solarized-dark-UdsmMDCL.js`),[],import.meta.url),"solarized-light":()=>k(()=>import(`./solarized-light-C1IUL_tW.js`),[],import.meta.url),"synthwave-84":()=>k(()=>import(`./synthwave-84-nFMaYfgc.js`),[],import.meta.url),"tokyo-night":()=>k(()=>import(`./tokyo-night-oM2G3aXe.js`),[],import.meta.url),vesper:()=>k(()=>import(`./vesper-DdrHHSXu.js`),[],import.meta.url),"vitesse-black":()=>k(()=>import(`./vitesse-black-fwtXNY1n.js`),[],import.meta.url),"vitesse-dark":()=>k(()=>import(`./vitesse-dark-BZCL-v6S.js`),[],import.meta.url),"vitesse-light":()=>k(()=>import(`./vitesse-light-VbXTXTou.js`),[],import.meta.url)};function fa(e){return Ji({name:e,collection:oa,colorScheme:ua(e),load:da[e]})}var pa=Hi({themes:Object.freeze([...sa.map(e=>fa(e)),...ca.map(e=>fa(e))])}),ma=Hi({themes:[aa,pa]}),ha=ue(`diffs:auto-refresh`,!1);async function ga(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 _a=`diffs:github-token-meta`;function va(){let e=localStorage.getItem(_a);if(!e)return null;try{return JSON.parse(e)}catch{return null}}async function ya(e){try{let t=await ga(e),n=va();if(n?.hash===t)return n.meta;let r={...await lt(e),setAt:Date.now()};return localStorage.setItem(_a,JSON.stringify({hash:t,meta:r})),r}catch{return}}function ba(){let e=w(null),t=w(!1),n=w(),r=!1;ke(()=>{r=!0});async function i(e,t){let n=await ga(e),r={...await lt(e),setAt:t};return localStorage.setItem(_a,JSON.stringify({hash:n,meta:r})),r}be(()=>O.value.githubToken,async a=>{if(!a){e.value=null;return}t.value=!0,n.value=void 0;try{let t=await ga(a);if(r)return;let n=va();e.value=n?.hash===t?n.meta:await i(a,Date.now())}catch(e){n.value=rt(e).message}finally{t.value=!1}},{immediate:!0});async function a(r){if(n.value=void 0,!r)return localStorage.removeItem(_a),e.value=null,O.value={...O.value,githubToken:``},!0;t.value=!0;try{return e.value=await i(r,Date.now()),O.value={...O.value,githubToken:r},!0}catch(e){return n.value=rt(e).message,!1}finally{t.value=!1}}return{meta:e,busy:t,error:n,saveToken:a}}var xa=Symbol(`antfu-design-color-scheme`);function Sa(e){let t=le(xa,void 0);return d(()=>e?.()??t?.value??`light`)}function Ca(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 wa(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function A(e,t,n=[0,0,0]){let r=wa(e,t[0]),i=wa(e,t[1]),a=wa(e,t[2]);return n[0]=r,n[1]=i,n[2]=a,n}var Ta=e({bisectLeft:()=>La,clamp:()=>Pa,copySign:()=>Fa,diag:()=>za,interpolate:()=>ja,interpolateInv:()=>Ma,inv:()=>Ga,isInstance:()=>Ra,isNone:()=>j,isString:()=>Ea,lu:()=>Ba,mapRange:()=>Na,multiplyMatrices:()=>Ca,multiply_v3_m3x3:()=>A,serializeNumber:()=>Oa,skipNone:()=>ka,solve:()=>Ka,spow:()=>M,toPrecision:()=>Aa,type:()=>Da,zdiv:()=>Ia});function Ea(e){return Da(e)===`string`}function Da(e){return(Object.prototype.toString.call(e).match(/^\[object\s+(.*?)\]$/)[1]||``).toLowerCase()}function Oa(e,{precision:t=16,unit:n}){return j(e)?`none`:(e=+Aa(e,t),e+(n??``))}function j(e){return e===null}function ka(e){return j(e)?0:e}function Aa(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 ja(e,t,n){return j(e)||isNaN(e)?t:j(t)||isNaN(t)?e:e+(t-e)*n}function Ma(e,t,n){return(n-e)/(t-e)}function Na(e,t,n){return!e||!t||e===t||e[0]===t[0]&&e[1]===t[1]||isNaN(n)||n===null?n:ja(t[0],t[1],Ma(e[0],e[1],n))}function Pa(e,t,n){return Math.max(Math.min(n,t),e)}function Fa(e,t){return Math.sign(e)===Math.sign(t)?e:-e}function M(e,t){return Fa(Math.abs(e)**t,e)}function Ia(e,t){return t===0?0:e/t}function La(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 Ra(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 za(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 Ba(e,{pIndices:t=!1}={}){let n,r,i,a,o=e.length;t?(n=Array.from({length:o},(e,t)=>t),i=za(Array(o).fill(1))):(r=za(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 Va(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 Ha(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 Ua(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 Wa(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 Ga(e){let[t,n,r]=Ba(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 Ha(r,Va(n,t,i),i)}function Ka(e,t){let[n,r,i]=Ba(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 Wa(i,Ua(r,n.map(e=>t[e]),a),a)}var qa=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)})}},Ja={gamut_mapping:`css`,precision:5,deltaE:`76`,verbose:!0,warn:function(e){this.verbose&&globalThis?.console?.warn?.(e)}},Ya=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()),Na(t,n,e)}serialize(e,t){let n=this.type===`<percentage>`?this.percentageRange(100):this.computedRange,r=this.unit;return e=Na(this.coordRange,n,e),Oa(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 Ra(e,this)?e:new this(e,t)}},Xa=Symbol(`instance`),Za=class e{type;name;spaceCoords;coords;id;alpha;constructor(e,t=e.space){e[Xa]=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=>Ya.get(e,n))}))}serializeCoords(e,t,n){return n=e.map((e,t)=>Ya.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(j(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||Ra(t,this)?t:t[Xa]?t[Xa]:new e(t,...n)}},Qa={D50:[.3457/.3585,1,.2958/.3585],D65:[.3127/.329,1,.3583/.329]};function $a(e){return Array.isArray(e)?e:Qa[e]}function eo(e,t,n,r={}){if(e=$a(e),t=$a(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(qa.run(`chromatic-adaptation-start`,i),i.M||(i.W1===Qa.D65&&i.W2===Qa.D50?i.M=[[1.0479297925449969,.022946870601609652,-.05019226628920524],[.02962780877005599,.9904344267538799,-.017073799063418826],[-.009243040646204504,.015055191490298152,.7518742814281371]]:i.W1===Qa.D50&&i.W2===Qa.D65&&(i.M=[[.955473421488075,-.02309845494876471,.06325924320057072],[-.0283697093338637,1.0099953980813041,.021041441191917323],[.012314014864481998,-.020507649298898964,1.330365926242124]])),qa.run(`chromatic-adaptation-end`,i),i.M)return A(i.XYZ,i.M);throw TypeError(`Only Bradford CAT with white points D50 and D65 supported for now.`)}function to(e,t){let n={str:String(e)?.trim(),options:t};if(qa.run(`parse-start`,n),n.color)return n.color;n.parsed=ao(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=P.findFormat({name:t,id:l,type:`function`}),!a){let t,a=r in P.registry?r:i;if(a in P.registry){let n=P.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(`--`)&&Ja.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(`--`)&&Ja.warn(`${o.name} is a standard space and supported in the CSS spec. Use color(${a.id}) instead of prefixed color(${r}).`)}else a=P.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 P.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=j(r.alpha)?r.alpha:r.alpha===void 0?1:Pa(0,r.alpha,1),r}var no={"%":.01,deg:1,grad:.9,rad:180/Math.PI,turn:360},ro={function:/^([a-z]+)\(((?:calc\(NaN\)|.)+?)\)$/i,number:/^([-+]?(?:[0-9]*\.)?[0-9]+(e[-+]?[0-9]+)?)$/i,unitValue:RegExp(`(${Object.keys(no).join(`|`)})$`),singleArgument:/\/?\s*(none|NaN|calc\(NaN\)|[-+\w.]+(?:%|deg|g?rad|turn)?)/g};function io(e){let t={},n=e.match(ro.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*no[n]):ro.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 ao(e){if(!e)return;e=e.trim();let t=e.match(ro.function);if(t){let e=[],n=[],r=!1,i=t[1].toLowerCase(),a=t[2].replace(ro.singleArgument,(t,a)=>{let{value:o,meta:s}=io(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 N(e,t){if(Array.isArray(e))return e.map(e=>N(e,t));if(!e)throw TypeError(`Empty color reference`);Ea(e)&&(e=to(e,t));let n=e.space||e.spaceId;return typeof n==`string`&&(e.space=P.get(n)),e.alpha===void 0&&(e.alpha=1),e}var oo=75e-6,P=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=$a(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:so(this).reverse(),writable:!1,enumerable:!0,configurable:!0}),qa.run(`colorspace-init-end`,this)}inGamut(e,{epsilon:t=oo}={}){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(j(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=Za.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=N(t);[t,n]=[e.space,e.coords]}if(t=e.get(t),this.equals(t))return n;n=n.map(e=>j(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=N(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||Ra(t,this))return t;if(Da(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=Za.get(r,e);return t!==r&&(e.formats[r.name]=t),t}}return null}static resolveCoord(t,n){let r=Da(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=Da(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 so(e){let t=[e];for(let n=e;n=n.base;)t.push(n);return t}var co=new P({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`]}),lo=class extends P{constructor(e){e.coords||={r:{range:[0,1],name:`Red`},g:{range:[0,1],name:`Green`},b:{range:[0,1],name:`Blue`}},e.base||=co;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=A(e,this.M.toXYZ);return this.white!==this.base.white&&(t=eo(this.white,this.base.white,t)),t}fromBase(e){return e=eo(this.base.white,this.white,e),A(e,this.M.fromXYZ)}},uo=new P({id:`xyz-d50`,name:`XYZ D50`,white:`D50`,base:co,fromBase:e=>eo(co.white,`D50`,e),toBase:e=>eo(`D50`,co.white,e)}),fo=216/24389,po=24/116,mo=24389/27,ho=Qa.D50,go=new P({id:`lab`,name:`Lab`,coords:{l:{refRange:[0,100],name:`Lightness`},a:{refRange:[-125,125]},b:{refRange:[-125,125]}},white:ho,base:uo,fromBase(e){let t=e.map((e,t)=>e/ho[t]).map(e=>e>fo?Math.cbrt(e):(mo*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]>po?i[0]**3:(116*i[0]-16)/mo,e[0]>8?((e[0]+16)/116)**3:e[0]/mo,i[2]>po?i[2]**3:(116*i[2]-16)/mo].map((e,t)=>e*ho[t])},formats:{lab:{coords:[`<percentage> | <number>`,`<number> | <percentage>`,`<number> | <percentage>`]}}});function _o(e){return typeof e==`number`?(e%360+360)%360:e}function vo(e,t){let[n,r]=t,i=j(n),a=j(r);if(i&&a)return[n,r];if(i?n=r:a&&(r=n),e===`raw`)return t;n=_o(n),r=_o(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 yo=new P({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:go,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:_o(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 j(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>`]}}}),bo=25**7,xo=Math.PI,So=180/xo,Co=xo/180;function wo(e){let t=e*e;return t*t*t*e}function To(e,t,{kL:n=1,kC:r=1,kH:i=1}={}){[e,t]=N([e,t]);let[a,o,s]=go.from(e),c=yo.from(go,[a,o,s])[1],[l,u,d]=go.from(t),f=yo.from(go,[l,u,d])[1];c<0&&(c=0),f<0&&(f=0);let p=wo((c+f)/2),m=.5*(1-Math.sqrt(p/(p+bo))),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*xo),b<0&&(b+=2*xo),y*=So,b*=So;let x=l-a,ee=v-_,te=b-y,ne=y+b,S=Math.abs(te),C;_*v===0?C=0:S<=180?C=te:te>180?C=te-360:te<-180?C=te+360:Ja.warn(`the unthinkable has happened`);let w=2*Math.sqrt(v*_)*Math.sin(C*Co/2),re=(a+l)/2,ie=(_+v)/2,ae=wo(ie),oe;oe=_*v===0?ne:S<=180?ne/2:ne<360?(ne+360)/2:(ne-360)/2;let se=(re-50)**2,ce=1+.015*se/Math.sqrt(20+se),le=1+.045*ie,ue=1;ue-=.17*Math.cos((oe-30)*Co),ue+=.24*Math.cos(2*oe*Co),ue+=.32*Math.cos((3*oe+6)*Co),ue-=.2*Math.cos((4*oe-63)*Co);let de=1+.015*ie*ue,T=30*Math.exp(-1*((oe-275)/25)**2),fe=2*Math.sqrt(ae/(ae+bo)),pe=-1*Math.sin(2*T*Co)*fe,me=(x/(n*ce))**2;return me+=(ee/(r*le))**2,me+=(w/(i*de))**2,me+=pe*(ee/(r*le))*(w/(i*de)),Math.sqrt(me)}var Eo={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]]},Do=new P({id:`oklab`,name:`Oklab`,coords:{l:{refRange:[0,1],name:`Lightness`},a:{refRange:[-.4,.4]},b:{refRange:[-.4,.4]}},white:`D65`,base:co,M:Eo,fromBase(e){let t=A(e,Eo.XYZtoLMS);return t[0]=Math.cbrt(t[0]),t[1]=Math.cbrt(t[1]),t[2]=Math.cbrt(t[2]),A(t,Eo.LMStoLab,t)},toBase(e){let t=A(e,Eo.LabtoLMS);return t[0]**=3,t[1]**=3,t[2]**=3,A(t,Eo.LMStoXYZ,t)},formats:{oklab:{coords:[`<percentage> | <number>`,`<number> | <percentage>`,`<number> | <percentage>`]}}});function Oo(e,t){[e,t]=N([e,t]);let[n,r,i]=Do.from(e),[a,o,s]=Do.from(t),c=n-a,l=r-o,u=i-s;return Math.sqrt(c**2+l**2+u**2)}var ko=75e-6;function Ao(e,t,{epsilon:n=ko}={}){e=N(e),t||=e.space,t=P.get(t);let r=e.coords;return t!==e.space&&(r=t.from(e)),t.inGamut(r,{epsilon:n})}function F(e,t,{inGamut:n}={}){e=N(e),t=P.get(t);let r=t.from(e),i={space:t,coords:r,alpha:e.alpha};return n&&(i=wl(i,n===!0?void 0:n)),i}F.returns=`color`;function jo(e,t){e=N(e);let n=P.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=>Aa(e,r))}function Mo(e,t){if(e=N(e),t===`alpha`)return e.alpha??1;let{space:n,index:r}=P.resolveCoord(t,e.space);return jo(e,n)[r]}var No=new P({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:Do,fromBase:yo.fromBase,toBase:yo.toBase,formats:{oklch:{coords:[`<percentage> | <number>`,`<number> | <percentage>`,`<number> | <angle>`]}}});function Po(e,t,n,r){return e=N(e),Array.isArray(t)&&([t,n,r]=[e.space,t,n]),t=P.get(t),e.coords=t===e.space?n.slice():t.to(e.space,n),r!==void 0&&(e.alpha=r),e}Po.returns=`color`;function Fo(e,t,n){if(e=N(e),arguments.length===2&&Da(arguments[1])===`object`){let t=arguments[1];for(let n in t)Fo(e,n,t[n])}else if(typeof n==`function`&&(n=n(Mo(e,t))),t===`alpha`)e.alpha=n;else{let{space:r,index:i}=P.resolveCoord(t,e.space),a=jo(e,r);a[i]=n,Po(e,r,a)}return e}Fo.returns=`color`;function Io(e){return{space:e.space,coords:e.coords.slice(),alpha:e.alpha}}function Lo(e,t,n=`lab`){n=P.get(n);let r=n.from(e),i=n.from(t);return Math.sqrt(r.reduce((e,t,n)=>{let r=i[n];return j(t)||j(r)?e:e+(r-t)**2},0))}function Ro(e,t){return Lo(e,t,`lab`)}var zo=Math.PI/180;function Bo(e,t,{l:n=2,c:r=1}={}){[e,t]=N([e,t]);let[i,a,o]=go.from(e),[,s,c]=yo.from(go,[i,a,o]),[l,u,d]=go.from(t),f=yo.from(go,[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;j(c)&&(c=0),b=c>=164&&c<=345?.56+Math.abs(.2*Math.cos((c+168)*zo)):.36+Math.abs(.4*Math.cos((c+35)*zo));let x=s**4,ee=Math.sqrt(x/(x+1900)),te=y*(ee*b+1-ee),ne=(p/(n*v))**2;return ne+=(m/(r*y))**2,ne+=_/te**2,Math.sqrt(ne)}var Vo=203,Ho=new P({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:co,fromBase(e){return e.map(e=>e*Vo)},toBase(e){return e.map(e=>e/Vo)}}),Uo=1.15,Wo=.66,Go=2610/2**14,Ko=2**14/2610,qo=3424/4096,Jo=2413/128,Yo=2392/128,Xo=1.7*2523/32,Zo=32/(1.7*2523),Qo=-.56,$o=16295499532821565e-27,es={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]]},ts=new P({id:`jzazbz`,name:`Jzazbz`,coords:{jz:{refRange:[0,1],name:`Jz`},az:{refRange:[-.21,.21]},bz:{refRange:[-.21,.21]}},base:Ho,M:es,fromBase(e){let[t,n,r]=e,[i,a,o]=A(A([Uo*t-.1499999999999999*r,Wo*n- -.33999999999999997*t,r],es.XYZtoCone).map(function(e){return M((qo+Jo*M(e/1e4,Go))/(1+Yo*M(e/1e4,Go)),Xo)}),es.ConetoIab);return[.43999999999999995*i/(1+Qo*i)-$o,a,o]},toBase(e){let[t,n,r]=e,[i,a,o]=A(A([(t+$o)/(.43999999999999995-Qo*(t+$o)),n,r],es.IabtoCone).map(function(e){return 1e4*M((qo-M(e,Zo))/(Yo*M(e,Zo)-Jo),Ko)}),es.ConetoXYZ),s=(i+.1499999999999999*o)/Uo;return[s,(a+-.33999999999999997*s)/Wo,o]},formats:{jzazbz:{coords:[`<percentage> | <number>`,`<number> | <percentage>`,`<number> | <percentage>`]}}}),ns=new P({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:ts,fromBase:yo.fromBase,toBase:yo.toBase,formats:{jzczhz:{coords:[`<percentage> | <number>`,`<number> | <percentage>`,`<number> | <angle>`]}}});function rs(e,t){[e,t]=N([e,t]);let[n,r,i]=ns.from(e),[a,o,s]=ns.from(t),c=n-a,l=r-o;j(i)&&j(s)?(i=0,s=0):j(i)?i=s:j(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 is=3424/4096,as=2413/128,os=2392/128,ss=2610/16384,cs=2523/32,ls=16384/2610,us=32/2523,ds={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]]},fs=new P({id:`ictcp`,name:`ICTCP`,coords:{i:{refRange:[0,1],name:`I`},ct:{refRange:[-.5,.5],name:`CT`},cp:{refRange:[-.5,.5],name:`CP`}},base:Ho,M:ds,fromBase(e){return ps(A(e,ds.XYZtoLMS))},toBase(e){return A(ms(e),ds.LMStoXYZ)},formats:{ictcp:{coords:[`<percentage> | <number>`,`<number> | <percentage>`,`<number> | <percentage>`]}}});function ps(e){return A(e.map(function(e){return((is+as*(e/1e4)**ss)/(1+os*(e/1e4)**ss))**cs}),ds.LMStoIPT)}function ms(e){return A(e,ds.IPTtoLMS).map(function(e){return 1e4*(Math.max(e**us-is,0)/(as-os*e**us))**ls})}function hs(e,t){[e,t]=N([e,t]);let[n,r,i]=fs.from(e),[a,o,s]=fs.from(t);return 720*Math.sqrt((n-a)**2+.25*(r-o)**2+(i-s)**2)}function gs(e,t){[e,t]=N([e,t]);let[n,r,i]=Do.from(e),[a,o,s]=Do.from(t),c=n-a,l=2*(r-o),u=2*(i-s);return Math.sqrt(c**2+l**2+u**2)}var _s=Qa.D65,vs=.42,ys=1/vs,bs=2*Math.PI,xs={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]]},Ss={dark:[.8,.525,.8],dim:[.9,.59,.9],average:[1,.69,1]},Cs={h:[20.14,90,164.25,237.53,380.14],e:[.8,.7,1,1.2,.8],H:[0,100,200,300,400]},ws=180/Math.PI,Ts=Math.PI/180;function Es(e,t){return e.map(e=>{let n=M(t*Math.abs(e)*.01,vs);return 400*Fa(n,e)/(n+27.13)})}function Ds(e,t){let n=100/t*27.13**ys;return e.map(e=>{let t=Math.abs(e);return Fa(n*M(t/(400-t),ys),e)})}function Os(e){let t=_o(e);t<=Cs.h[0]&&(t+=360);let n=La(Cs.h,t)-1,[r,i]=Cs.h.slice(n,n+2),[a,o]=Cs.e.slice(n,n+2),s=Cs.H[n],c=(t-r)/a;return s+100*c/(c+(i-t)/o)}function ks(e){let t=(e%400+400)%400,n=Math.floor(.01*t);t%=100;let[r,i]=Cs.h.slice(n,n+2),[a,o]=Cs.e.slice(n,n+2);return _o((t*(o*r-a*i)-100*r*o)/(t*(o-a)-100*o))}function As(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=A(o,xs.cat16),l=Ss[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=>ja(1,s/e,f)),a.dRgbInv=a.dRgb.map(e=>1/e);let p=Es(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 js=As(_s,64/Math.PI*.2,20,`average`,!1);function Ms(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?ks(e.H)*Ts:_o(e.h)*Ts;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=M(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=M(o*(1.64-.29**t.n)**-.73,10/9),c=.25*(Math.cos(n+2)+3.8),l=t.aW*M(a,2/t.c/t.z),u=5e4/13*t.nc*t.ncb*c,d=l/t.nbb,f=23*(d+.305)*Ia(s,23*u+s*(11*r+108*i));return A(Ds(A([d,f*r,f*i],xs.m1).map(e=>e*1/1403),t.fl).map((e,n)=>e*t.dRgbInv[n]),xs.cat16Inv).map(e=>e/100)}function Ns(e,t){let n=Es(A(e.map(e=>e*100),xs.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)%bs+bs)%bs,o=.25*(Math.cos(a+2)+3.8),s=M(5e4/13*t.nc*t.ncb*Ia(o*Math.sqrt(r**2+i**2),n[0]+n[1]+1.05*n[2]+.305),.9)*(1.64-.29**t.n)**.73,c=M(t.nbb*(2*n[0]+n[1]+.05*n[2])/t.aW,.5*t.c*t.z),l=100*M(c,2),u=4/t.c*c*(t.aW+4)*t.flRoot,d=s*c,f=d*t.flRoot,p=_o(a*ws),m=Os(p);return{J:l,C:d,h:p,s:50*M(t.c*s/(t.aW+4),1/2),Q:u,M:f,H:m}}var Ps=new P({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:co,M:xs,fromBase(e){this.ε===void 0&&(this.ε=Object.values(this.coords)[1].refRange[1]/1e5);let t=Ns(e,js),n=Math.abs(t.M)<this.ε;return[t.J,n?0:t.M,n?null:t.h]},toBase(e){return Ms({J:e[0],M:e[1],h:e[2]},js)}}),Fs=Qa.D65,Is=216/24389,Ls=24389/27;function Rs(e){return 116*(e>Is?Math.cbrt(e):(Ls*e+16)/116)-16}function zs(e){return e>8?((e+16)/116)**3:e/Ls}function Bs(e,t){let[n,r,i]=e,a=[],o=0;if(i===0)return[0,0,0];let s=zs(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=Ms({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 Vs(e,t){let n=Rs(e[1]);if(n===0)return[0,0,0];let r=Ns(e,Hs);return[_o(r.h),r.C,n]}var Hs=As(Fs,200/Math.PI*zs(50),zs(50)*100,`average`,!1),Us=new P({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:co,fromBase(e){this.ε===void 0&&(this.ε=Object.values(this.coords)[1].refRange[1]/1e5);let t=Vs(e,Hs);return t[1]<this.ε&&(t[1]=0,t[0]=null),t},toBase(e){return Bs(e,Hs)},formats:{color:{id:`--hct`,coords:[`<number> | <angle>`,`<percentage> | <number>`,`<percentage> | <number>`]}}}),Ws=Math.PI/180,Gs=[1,.007,.0228];function Ks(e){e[1]<0&&(e=Us.fromBase(Us.toBase(e)));let t=Math.log(Math.max(1+Gs[2]*e[1]*Hs.flRoot,1))/Gs[2],n=e[0]*Ws,r=t*Math.cos(n),i=t*Math.sin(n);return[e[2],r,i]}function qs(e,t){[e,t]=N([e,t]);let[n,r,i]=Ks(Us.from(e)),[a,o,s]=Ks(Us.from(t));return Math.sqrt((n-a)**2+(r-o)**2+(i-s)**2)}var{cos:I,sin:L,sqrt:Js,atan2:Ys,exp:Xs,abs:Zs,pow:Qs,PI:$s}=Math,ec=[[1.000042977349746,20718877053183e-18,-4361018085669474e-20],[26946201090235744e-21,.9999906145080147,-14898828405401079e-21],[-7941753620756204e-21,12875204405137254e-21,.9997859822609763]],tc=[[.9999570254019492,-2071874272730964e-20,4361733292468361e-20],[-2694517763358666e-20,1.000009385946497,1490098223546482e-20],[7943459292954202e-21,-1287824596735154e-20,1.000214063706999]],nc=[[.7212986433113499,.45344826541531813,-.19288975751942616],[-.788211869495579,1.795241376757236,.0876172451181785],[-.0917700599912156,.45765588659459255,1.2922045513917677]],rc=[[1.065107295808859,-.3150044075301121,.1803492381741039],[.4721107713837796,.4271995765962455,.04150680489380985],[-.09156391926309541,-.1736709363194979,.7719790382558294]],ic=[.47229813098762524,.5149184096354483,.5113233386366979],ac=[2.1173067060606283,1.9420552485353544,1.9557096741686448],oc={CAT_TO_HELM:ec,CAT_FROM_HELM:tc,M1:nc,M1_INV:rc,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]]},sc=-.02833024015436984,cc=-.21131429516166544,lc=.2189784817615645,uc=-.06871898981942523,dc=.005506053349515315,fc=-.0641329861299175,pc=-.053592461436994296,mc=-.00954137464208059,hc=.2676231133101982,gc=.8934892185255707,_c=.7173169828841472,vc=.6915224124600773,yc=.48647127559605596,bc=.9853124591201782,xc=.5385456675962418,Sc=.12508858146241716,Cc=.6768950256217603,wc=-.4963251525324449,Tc=-.09564696283240552,Ec=-.029053748937210654,Dc=1.3346761652952872,Oc=-.1698908144723919,kc=-.195370576218515,Ac=.5330819227283227,jc=.08863325582067766,Mc=.9365540137751136,Nc=.13789738139719568,Pc=.061650260197979936,Fc=.0641970862504494,Ic=-.027401052793571013,Lc=-.09900209889026965,Rc=.059635520647228726,zc=-.013586499967803128,Bc=.2253393118474472,Vc=-1.5239477450767043,Hc=-1.751157310240011,Uc=-.43576378069144767,Wc=1.060094063845983,Gc=.47931193034584496,Kc=-.2622579649434462,qc=.13610794232685908,Jc=.1168702235362288,Yc=-.01617739641422492,Xc=.038145638815030566,Zc=-28.2*$s/180,Qc=I(Zc),$c=L(Zc);function el(e){return sc*I(e)+cc*L(e)+lc*I(2*e)+uc*L(2*e)+dc*I(3*e)+fc*L(3*e)+pc*I(4*e)+mc*L(4*e)}function tl(e){return .02833024015436984*L(e)+cc*I(e)+-2*lc*L(2*e)+2*uc*I(2*e)+-3*dc*L(3*e)+3*fc*I(3*e)+-4*pc*L(4*e)+4*mc*I(4*e)}function nl(e){return Xs(kc*I(e)+Ac*L(e)+jc*I(2*e)+Mc*L(2*e)+Nc*I(3*e)+Pc*L(3*e)+Fc*I(4*e)+Ic*L(4*e))}function rl(e){let t=e-.5;return Xs(Pa(-30,Vc*t+Hc*t*t,30))}function il(e,t){let n=Uc*I(e)+Wc*L(e)+Gc*I(2*e)+Kc*L(2*e);return Xs(Pa(-30,(t-.5)*n,30))}function al(e){return Xs(qc*I(e)+Jc*L(e)+Yc*I(2*e)+Xc*L(2*e))}function ol(e){return 1+Lc*I(e)+Rc*L(e)+zc*I(2*e)+Bc*L(2*e)}function sl(e,t){let n=e*(1-e),r=e+xc*n+Sc*n*(.5-e)+Cc*n*n;return r+=n*(wc*I(t)+Tc*L(t)),r}function cl(e,t){let n=wc*I(t)+Tc*L(t),r=e;for(let t=0;t<15;t++){let t=r*(1-r),i=1-2*r,a=r+(xc+n)*t+Sc*t*(.5-r)+Cc*t*t-e,o=1+(xc+n)*i+Sc*(i*(.5-r)-t)+Cc*2*t*i;Zs(o)<1e-10&&(o=1),r-=a/o}return r}function ll(e,t){let n=Ec+Dc*I(t)+Oc*L(t),r=e<1?1-e:0;return e*Xs(Pa(-30,n*e*r*r,30))}function ul(e,t){let n=Ec+Dc*I(t)+Oc*L(t),r=e;for(let t=0;t<12;t++){let t=r<1?1-r:0,i=Xs(Pa(-30,n*r*t*t,30)),a=r*i-e,o=n*t*(1-3*r),s=i*(1+r*o);Zs(s)<1e-10&&(s=1),r-=a/s}return r}var dl=function(e){let[t,n,r]=A(A(e,oc.CAT_TO_HELM),oc.M1),[i,a,o]=A([M(t,ic[0]),M(n,ic[1]),M(r,ic[2])],oc.M2),s=Ys(o,a),c=Js(a*a+o*o),l=el(s),u=s+l;a=c*I(u),o=c*L(u);let d=hc*Qs(Js(a*a+o*o),Pa(.01,gc,10)),f=Ys(o,a),p=1+_c*I(f)+vc*L(f)+yc*I(2*f)+bc*L(2*f);i+=d*p,s=Ys(o,a),i=sl(i,s),s=Ys(o,a),i=ll(i,s),s=Ys(o,a);let m=nl(s);a*=m,o*=m,s=Ys(o,a),c=Js(a*a+o*o);let h=ol(s),g=c>0?Qs(c,h):0;a=g*I(s),o=g*L(s);let _=rl(i);a*=_,o*=_,s=Ys(o,a);let v=il(s,i);a*=v,o*=v,s=Ys(o,a),i*=al(s);let y=a*Qc-o*$c,b=a*$c+o*Qc;return[i,y,b]},fl=function(e){let[t,n,r]=e,i=n*Qc+r*$c,a=-n*$c+r*Qc;n=i,r=a;let o=Ys(r,n);t/=al(o),o=Ys(r,n);let s=il(o,t);n/=s,r/=s;let c=rl(t);n/=c,r/=c,o=Ys(r,n);let l=Js(n*n+r*r),u=ol(o),d=l>0?Qs(l,1/u):0;n=d*I(o),r=d*L(o),o=Ys(r,n);let f=nl(o);n/=f,r/=f,o=Ys(r,n),t=ul(t,o),o=Ys(r,n),t=cl(t,o);let p=hc*Qs(Js(n*n+r*r),Pa(.01,gc,10)),m=Ys(r,n),h=1+_c*I(m)+vc*L(m)+yc*I(2*m)+bc*L(2*m);t-=p*h;let g=Ys(r,n);l=Js(n*n+r*r);let _=g;for(let e=0;e<8;e++){let e=_+el(_)-g,t=1+tl(_);Zs(t)<1e-10&&(t=1),_-=e/t}n=l*I(_),r=l*L(_);let[v,y,b]=A([t,n,r],oc.M2_INV);return A(A([M(v,ac[0]),M(y,ac[1]),M(b,ac[2])],oc.M1_INV),oc.CAT_FROM_HELM)},pl=new P({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:co,M:oc,fromBase(e){return dl(e)},toBase(e){return fl(e)}}),ml=-.9155125151657894,hl=2.9268353744941558,gl=3.966003089807536,_l=1.9737081170404969,vl=52.473130649294724,yl=.47897301074925214;function bl(e,t){[e,t]=N([e,t]);let[n,r,i]=pl.from(e),[a,o,s]=pl.from(t),c=n-a,l=r-o,u=i-s,d=1+ml*((n+a)*.5-.5)**2,f=1+hl*((Math.sqrt(r**2+i**2)+Math.sqrt(o**2+s**2))*.5),p=(c**2/d**2+gl*(l**2+u**2)/f**2)**(_l/2);return(p/(1+vl*p))**yl}var xl={deltaE76:Ro,deltaECMC:Bo,deltaE2000:To,deltaEJz:rs,deltaEITP:hs,deltaEOK:Oo,deltaEOK2:gs,deltaEHCT:qs,deltaEHelmlab:bl};function Sl(e){return Math.max(parseFloat(`1e${(e?Math.floor(Math.log10(Math.abs(e))):0)-2}`),1e-6)}var Cl={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 wl(e,{method:t=Ja.gamut_mapping,space:n=void 0,deltaEMethod:r=``,jnd:i=2,blackWhiteClamp:a=void 0}={}){if(e=N(e),Ea(arguments[1])?n=arguments[1]:n||=e.space,n=P.get(n),Ao(e,n,{epsilon:0}))return e;let o;if(t===`css`)o=El(e,{space:n});else if(t===`raytrace`)o=Ol(e,{space:n});else{if(t!==`clip`){Object.prototype.hasOwnProperty.call(Cl,t)&&({method:t,jnd:i,deltaEMethod:r,blackWhiteClamp:a}=Cl[t]);let s=To;if(r!==``){for(let e in xl)if(`deltae`+r.toLowerCase()===e.toLowerCase()){s=xl[e];break}}i===0&&(i=1e-16);let c=wl(F(e,n),{method:`clip`,space:n});if(s(e,c)>i){if(a&&Object.keys(a).length===3){let t=P.resolveCoord(a.channel),n=Mo(F(e,t.space),t.id);if(j(n)&&(n=0),n>=a.max)return F({space:`xyz-d65`,coords:Qa.D65},e.space);if(n<=a.min)return F({space:`xyz-d65`,coords:[0,0,0]},e.space)}let r=P.resolveCoord(t),c=r.space,l=r.id,u=F(e,c);u.coords.forEach((e,t)=>{j(e)&&(u.coords[t]=0)});let d=(r.range||r.refRange)[0],f=Sl(i),p=d,m=Mo(u,l);for(;m-p>f;){let e=Io(u);e=wl(e,{space:n,method:`clip`}),s(u,e)-i<f?p=Mo(u,l):m=Mo(u,l),Fo(u,l,(p+m)/2)}o=F(u,n)}else o=c}else o=F(e,n);if(t===`clip`||!Ao(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=F(o,e.space)),e.coords=o.coords,e}wl.returns=`color`;var Tl={WHITE:{space:Do,coords:[1,0,0],alpha:1},BLACK:{space:Do,coords:[0,0,0],alpha:1}};function El(e,{space:t}={}){let n=.02,r=1e-4;if(e=N(e),t||=e.space,t=P.get(t),t.isUnbounded)return F(e,t);let i=F(e,No),a=i.coords[0];if(a>=1){let n=F(Tl.WHITE,t);return n.alpha=e.alpha,F(n,t)}if(a<=0){let n=F(Tl.BLACK,t);return n.alpha=e.alpha,F(n,t)}if(Ao(i,t,{epsilon:0}))return F(i,t);function o(e){let n=F(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 Pa(n,e,i)}return e}),n}let s=0,c=i.coords[1],l=!0,u=Io(i),d=o(u),f=Oo(d,u);if(f<n)return d;for(;c-s>r;){let e=(s+c)/2;if(u.coords[1]=e,l&&Ao(u,t,{epsilon:0}))s=e;else if(d=o(u),f=Oo(d,u),f<n){if(n-f<r)break;l=!1,s=e}else c=e}return d}function Dl(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 Ol(e,{space:t}={}){if(e=N(e),t||=e.space,t=P.get(t),t.isUnbounded)return F(e,t);let n=F(e,No),[r,i,a]=n.coords;if(r>=1){let n=F(Tl.WHITE,t);return n.alpha=e.alpha,F(n,t)}if(r<=0){let n=F(Tl.BLACK,t);return n.alpha=e.alpha,F(n,t)}let o=t,s=t.rgbGamut;if(s!==void 0&&(t=s),!Ra(t,lo))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=F({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=F(n,t);if(!p.coords.every(e=>c<=e&&e<=l)){let e=F({space:No,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=F(p,No);e.coords[0]=r,e.coords[2]=a,p=F(e,t)}let c=Dl(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=F(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 Pa(n,e,r)}return e}),p}var kl=class extends P{constructor(e){let t=P.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,wl({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&&j(e))?e[this.chromaIndex]!==0&&(e[this.chromaIndex]=null):j(e[this.chromaIndex])||(e[this.chromaIndex]*=this.maxChroma(e)),e}fromBase(e){if(e=[...e],e.some((e,t)=>t!==this.chromaIndex&&j(e)))e[this.chromaIndex]!==0&&(e[this.chromaIndex]=null);else if(!j(e[this.chromaIndex])){let t=this.maxChroma(e);e[this.chromaIndex]=t?e[this.chromaIndex]/t:0}return e}};function Al(e,t={}){if(Array.isArray(e))return e.map(e=>Al(e,t));let{cssProperty:n=`background-color`,element:r,...i}=t,a=null;try{return N(e,i)}catch(e){a=e}let{CSS:o,getComputedStyle:s}=globalThis;if(Ea(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 N(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 jl(e,t={}){let{precision:n=Ja.precision,format:r,inGamut:i=!0,coords:a,alpha:o,commas:s}=t,c,l=N(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)??P.findFormat(u)),r||(r=l.space.getFormat(`default`)??P.DEFAULT_FORMAT,u=r.name),r&&r.space&&r.space!==l.space&&(l=F(l,r.space));let f=l.coords.slice();if(i||=r.toGamut,i&&!Ao(l)&&(f=wl(Io(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=Oa(i,{precision:n,unit:e})}p=`${s?`,`:` /`} ${i}`}c=`${e}(${t.join(s?`, `:` `)}${p})`}return c}var Ml={toXYZ:[[.6369580483012914,.14461690358620832,.1688809751641721],[.2627002120112671,.6779980715188708,.05930171646986196],[0,.028072693049087428,1.060985057710791]],fromXYZ:[[1.716651187971268,-.355670783776392,-.25336628137366],[-.666684351832489,1.616481236634939,.0157685458139111],[.017639857445311,-.042770613257809,.942103121235474]]},Nl=new lo({id:`rec2020-linear`,cssId:`--rec2020-linear`,name:`Linear REC.2020`,white:`D65`,M:Ml}),Pl=new lo({id:`rec2020`,name:`REC.2020`,base:Nl,linearGamut:Nl,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)})}}),Fl=new lo({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]]}}),Il={toXYZ:[[.41239079926595934,.357584339383878,.1804807884018343],[.21263900587151027,.715168678767756,.07219231536073371],[.01933081871559182,.11919477979462598,.9505321522496607]],fromXYZ:[[3.2409699419045226,-1.537383177570094,-.4986107602930034],[-.9692436362808796,1.8759675015077202,.04155505740717559],[.05563007969699366,-.20397695888897652,1.0569715142428786]]},Ll=new lo({id:`srgb-linear`,name:`Linear sRGB`,white:`D65`,M:Il}),Rl={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]},zl=[,,,].fill(`<percentage> | <number>[0, 255]`),Bl=[,,,].fill(`<number>[0, 255]`),Vl=new lo({id:`srgb`,name:`sRGB`,base:Ll,linearGamut:Ll,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:zl},rgb_number:{name:`rgb`,commas:!0,coords:Bl,alpha:!1},color:{},rgba:{coords:zl,commas:!0,alpha:!0},rgba_number:{name:`rgba`,commas:!0,coords:Bl},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=Rl.black,t.alpha=0):t.coords=Rl[e],t.coords)return t}}}}),Hl=new lo({id:`p3`,cssId:`display-p3`,name:`P3`,base:Fl,linearGamut:Fl,fromBase:Vl.fromBase,toBase:Vl.toBase});Ja.display_space=Vl;var Ul;if(typeof CSS<`u`&&CSS.supports)for(let e of[go,Pl,Hl]){let t=jl({space:e,coords:e.getMinCoords(),alpha:1});if(CSS.supports(`color`,t)){Ja.display_space=e;break}}function Wl(e,{space:t,supports:n=globalThis.CSS?.supports,...r}={}){e=N(e);let i=jl(e,r);if(!n||n(`color`,i)||!Ja.display_space)i=new String(i),i.color=e;else{let a=e;if((e.coords.some(j)||j(e.alpha))&&!(Ul??=n(`color`,`hsl(none 50% 50%)`))&&(a=Io(e),a.coords=a.coords.map(ka),a.alpha=ka(a.alpha),i=jl(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=F(a,t),o=jl(e,r);if(n(`color`,o))return i=new String(o),i.color=e,i}t=Ja.display_space}a=F(a,t),i=new String(jl(a,r)),i.color=a}return i}function Gl(e,t,{space:n,hue:r=`shorter`}={}){e=N(e),n||=e.space,n=P.get(n);let i=Object.values(n.coords);[e,t]=[e,t].map(e=>F(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]=vo(r,[e,a])),Kl(e,a)}),c=Kl(e.alpha,t.alpha);return{space:n,coords:s,alpha:c}}function Kl(e,t){return j(e)||j(t)?e===t?null:0:e-t}function ql(e,t){return e=N(e),t=N(t),e.space===t.space&&e.alpha===t.alpha&&e.coords.every((e,n)=>e===t.coords[n])}var Jl=e({getLuminance:()=>Yl,register:()=>Zl,setLuminance:()=>Xl});function Yl(e){return Mo(e,[co,`y`])}function Xl(e,t){Fo(e,[co,`y`],t)}function Zl(e){Object.defineProperty(e.prototype,"luminance",{get(){return Yl(this)},set(e){Xl(this,e)}})}function Ql(e,t){e=N(e),t=N(t);let n=Math.max(Yl(e),0),r=Math.max(Yl(t),0);return r>n&&([n,r]=[r,n]),(n+.05)/(r+.05)}var $l=.56,eu=.57,tu=.62,nu=.65,ru=.022,iu=1.414,au=.1,ou=5e-4,su=1.14,cu=.027,lu=1.14;function uu(e){return e>=ru?e:e+(ru-e)**iu}function du(e){return(e<0?-1:1)*Math.abs(e)**2.4}function fu(e,t){t=N(t),e=N(e);let n,r,i,a,o,s;t=F(t,`srgb`),[a,o,s]=t.coords.map(e=>j(e)?0:e);let c=du(a)*.2126729+du(o)*.7151522+du(s)*.072175;e=F(e,`srgb`),[a,o,s]=e.coords.map(e=>j(e)?0:e);let l=du(a)*.2126729+du(o)*.7151522+du(s)*.072175,u=uu(c),d=uu(l),f=d>u;return Math.abs(d-u)<ou?r=0:f?(n=d**$l-u**eu,r=n*su):(n=d**nu-u**tu,r=n*lu),i=Math.abs(r)<au?0:r>0?r-cu:r+cu,i*100}function pu(e,t){e=N(e),t=N(t);let n=Math.max(Yl(e),0),r=Math.max(Yl(t),0);r>n&&([n,r]=[r,n]);let i=n+r;return i===0?0:(n-r)/i}var mu=5e4;function hu(e,t){e=N(e),t=N(t);let n=Math.max(Yl(e),0),r=Math.max(Yl(t),0);return r>n&&([n,r]=[r,n]),r===0?mu:(n-r)/r}function gu(e,t){e=N(e),t=N(t);let n=Mo(e,[go,`l`]),r=Mo(t,[go,`l`]);return Math.abs(n-r)}var _u=216/24389,vu=24/116,yu=24389/27,bu=Qa.D65,xu=new P({id:`lab-d65`,name:`Lab D65`,coords:{l:{refRange:[0,100],name:`Lightness`},a:{refRange:[-125,125]},b:{refRange:[-125,125]}},white:bu,base:co,fromBase(e){let t=e.map((e,t)=>e/bu[t]).map(e=>e>_u?Math.cbrt(e):(yu*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]>vu?t[0]**3:(116*t[0]-16)/yu,e[0]>8?((e[0]+16)/116)**3:e[0]/yu,t[2]>vu?t[2]**3:(116*t[2]-16)/yu].map((e,t)=>e*bu[t])},formats:{"lab-d65":{coords:[`<number> | <percentage>`,`<number> | <percentage>`,`<number> | <percentage>`]}}}),Su=5**.5*.5+.5;function Cu(e,t){e=N(e),t=N(t);let n=Mo(e,[xu,`l`]),r=Mo(t,[xu,`l`]),i=Math.abs(n**+Su-r**+Su)**(1/Su)*Math.SQRT2-40;return i<7.5?0:i}var wu=e({contrastAPCA:()=>fu,contrastDeltaPhi:()=>Cu,contrastLstar:()=>gu,contrastMichelson:()=>pu,contrastWCAG21:()=>Ql,contrastWeber:()=>hu});function Tu(e,t,n){Ea(n)&&(n={algorithm:n});let{algorithm:r,...i}=n||{};if(!r){let e=Object.keys(wu).map(e=>e.replace(/^contrast/,``)).join(`, `);throw TypeError(`contrast() function needs a contrast algorithm. Please specify one of: ${e}`)}e=N(e),t=N(t);for(let n in wu)if(`contrast`+r.toLowerCase()===n.toLowerCase())return wu[n](e,t,i);throw TypeError(`Unknown contrast algorithm: ${r}`)}var Eu=e({register:()=>ku,uv:()=>Du,xy:()=>Ou});function Du(e){let[t,n,r]=jo(e,co),i=t+15*n+3*r;return[4*t/i,9*n/i]}function Ou(e){let[t,n,r]=jo(e,co),i=t+n+r;return[t/i,n/i]}function ku(e){Object.defineProperty(e.prototype,"uv",{get(){return Du(this)}}),Object.defineProperty(e.prototype,"xy",{get(){return Ou(this)}})}function Au(e,t,n={}){Ea(n)&&(n={method:n});let{method:r=Ja.deltaE,...i}=n;for(let n in xl)if(`deltae`+r.toLowerCase()===n.toLowerCase())return xl[n](e,t,i);throw TypeError(`Unknown deltaE method: ${r}`)}var ju=e({darken:()=>Nu,lighten:()=>Mu});function Mu(e,t=.25){return Fo(e,[P.get(`oklch`,`lch`),`l`],e=>e*(1+t))}function Nu(e,t=.25){return Fo(e,[P.get(`oklch`,`lch`),`l`],e=>e*(1-t))}Mu.returns=`color`,Nu.returns=`color`;var Pu=e({isRange:()=>zu,mix:()=>Fu,range:()=>Lu,register:()=>Bu,steps:()=>Iu});function Fu(e,t,n,r={}){return[e,t]=[N(e),N(t)],Da(n)===`object`&&([n,r]=[.5,n]),Lu(e,t,r)(n??.5)}function Iu(e,t,n={}){let r;zu(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]=[N(e),N(t)],Lu(e,t,c));let l=Au(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=Au(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,Au(s,n.color,a),Au(s,i.color,a)),d.splice(t,0,{p:o,color:r(o)}),t++}}}return d=d.map(e=>e.color),d}function Lu(e,t,n={}){if(zu(e)){let[n,r]=[e,t];return Lu(...n.rangeArgs.colors,{...n.rangeArgs.options,...r})}let{space:r,outputSpace:i,progression:a,premultiplied:o}=n;e=N(e),t=N(t),e=Io(e),t=Io(t);let s={colors:[e,t],options:n};r=r?P.get(r):P.registry[Ja.interpolationSpace]||e.space,i=i?P.get(i):r,e=F(e,r),t=F(t,r),e=wl(e),t=wl(t);let c=r.hueId,l=r.hueIndex;if(c){let i=n.hue=n.hue||`shorter`,a=[r,c],[o,s]=[Mo(e,a),Mo(t,a)];j(o)&&!j(s)?o=s:j(s)&&!j(o)&&(s=o),[o,s]=vo(i,[o,s]),Fo(e,a,o),Fo(t,a,s)}return j(e.alpha)&&!j(t.alpha)?e.alpha=t.alpha:j(t.alpha)&&!j(e.alpha)&&(t.alpha=e.alpha),o&&(e.coords=Ru(e.coords,e.alpha,l),t.coords=Ru(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 ja(e,i,n)}),c=ja(e.alpha,t.alpha,n),u={space:r,coords:s,alpha:c};return o&&(u.coords=Ru(u.coords,c,l,!0)),i!==r&&(u=F(u,i)),u},{rangeArgs:s})}function Ru(e,t,n,r=!1){return j(t)||r&&t===0?e:e.map((e,i)=>i===n||j(e)?e:r?e/t:e*t)}function zu(e){return Da(e)===`function`&&!!e.rangeArgs}Ja.interpolationSpace=`lab`;function Bu(e){e.defineFunction(`mix`,Fu,{returns:`color`}),e.defineFunction(`range`,Lu,{returns:`function<color>`}),e.defineFunction(`steps`,Iu,{returns:`array<color>`})}var Vu=new P({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:Vl,rgbGamut:Vl,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}}}),Hu=new P({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:Hl,rgbGamut:Hl,fromBase:Vu.fromBase,toBase:Vu.toBase}),Uu=new P({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:Pl,rgbGamut:Pl,fromBase:Vu.fromBase,toBase:Vu.toBase}),Wu=new P({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:Vl,rgbGamut:Vl,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>`]}}}),Gu=new P({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:Wu,rgbGamut:Vl,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>`]}}}),Ku=new lo({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]]}}),qu=new lo({id:`a98rgb`,cssId:`a98-rgb`,name:`Adobe® 98 RGB compatible`,base:Ku,linearGamut:Ku,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))}),Ju=new lo({id:`prophoto-linear`,cssId:`--prophoto-rgb-linear`,name:`Linear ProPhoto`,white:`D50`,base:uo,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]]}}),Yu=1/512,Xu=16/512,Zu=new lo({id:`prophoto`,cssId:`prophoto-rgb`,name:`ProPhoto`,base:Ju,linearGamut:Ju,toBase(e){return e.map(e=>{let t=e<0?-1:1,n=e*t;return n<Xu?e/16:t*n**1.8})},fromBase(e){return e.map(e=>{let t=e<0?-1:1,n=e*t;return n>=Yu?t*n**(1/1.8):16*e})}}),Qu=1.09929682680944,$u=.018053968510807,ed=new lo({id:`--rec2020-oetf`,name:`REC.2020_Scene_Referred`,base:Nl,linearGamut:Nl,referred:`scene`,toBase(e){return e.map(function(e){let t=e<0?-1:1,n=e*t;return n<$u*4.5?e/4.5:t*((n+Qu-1)/Qu)**(1/.45)})},fromBase(e){return e.map(function(e){let t=e<0?-1:1,n=e*t;return n>=$u?t*(Qu*n**.45-.09929682680944008):4.5*e})}}),td=new kl({id:`oklch-p3`,cssId:`--oklch-p3`,name:`OKLCh P3`,base:No,gamutSpace:Hl}),nd=new kl({id:`oklch-srgb`,cssId:`--oklch-srgb`,name:`OKLCh sRGB`,base:No,gamutSpace:Vl}),rd=new kl({id:`oklch-rec2020`,cssId:`--oklch-rec2020`,name:`OKLCh Rec.2020`,base:No,gamutSpace:Pl}),id=new kl({id:`lch-p3`,cssId:`--lch-p3`,name:`LCH P3`,base:yo,gamutSpace:Hl}),ad=new kl({id:`lch-srgb`,cssId:`--lch-srgb`,name:`LCH sRGB`,base:yo,gamutSpace:Vl}),od=new kl({id:`lch-rec2020`,cssId:`--lch-rec2020`,name:`LCH Rec.2020`,base:yo,gamutSpace:Pl}),sd=2*Math.PI,cd={...Do.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]]},ld=[[[-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]]],ud=Number.MAX_VALUE,dd=.206,fd=.03,pd=1.206/1.03;function md(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 hd(e){return .5*(pd*e-dd+Math.sqrt((pd*e-dd)*(pd*e-dd)+4*fd*pd*e))}function gd(e){return(e**2+dd*e)/(pd*(e+fd))}function _d(e){let[t,n]=e;return[n/t,n/(1-t)]}function vd(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 yd(e,t){let n=A(e,cd.LabtoLMS);return n[0]**=3,n[1]**=3,n[2]**=3,A(n,t,n)}function bd(e,t,n,r){let i=Cd(e,t,n,r),a=yd([1,i*e,i*t],n),o=M(1/Math.max(...a),1/3);return[o,o*i]}function xd(e,t,n,r,i,a,o,s){let c;if(s===void 0&&(s=bd(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=md(cd.LabtoLMS[0].slice(1),[e,t]),d=md(cd.LabtoLMS[1].slice(1),[e,t]),f=md(cd.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,ee=y**3,te=b**3,ne=3*p*v**2,S=3*m*y**2,C=3*h*b**2,w=6*p**2*v,re=6*m**2*y,ie=6*h**2*b,ae=md(a[0],[x,ee,te])-1,oe=md(a[0],[ne,S,C]),se=md(a[0],[w,re,ie]),ce=oe/(oe*oe-.5*ae*se),le=-ae*ce,ue=md(a[1],[x,ee,te])-1,de=md(a[1],[ne,S,C]),T=md(a[1],[w,re,ie]),fe=de/(de*de-.5*ue*T),pe=-ue*fe,me=md(a[2],[x,ee,te])-1,he=md(a[2],[ne,S,C]),ge=md(a[2],[w,re,ie]),_e=he/(he*he-.5*me*ge),ve=-me*_e;le=ce>=0?le:ud,pe=fe>=0?pe:ud,ve=_e>=0?ve:ud,c+=Math.min(le,Math.min(pe,ve))}return c}function Sd(e,t,n){let[r,i,a]=e,o=bd(i,a,t,n),s=xd(i,a,r,1,r,t,n,o),c=_d(o),l=s/Math.min(r*c[0],(1-r)*c[1]),u=vd(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 Cd(e,t,n,r){let i,a,o,s,c,l,u,d;md(r[0][0],[e,t])>1?([i,a,o,s,c]=r[0][1],[l,u,d]=n[0]):md(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=md(cd.LabtoLMS[0].slice(1),[e,t]),m=md(cd.LabtoLMS[1].slice(1),[e,t]),h=md(cd.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,ee=3*p*g**2,te=3*m*_**2,ne=3*h*v**2,S=6*p**2*g,C=6*m**2*_,w=6*h**2*v,re=l*y+u*b+d*x,ie=l*ee+u*te+d*ne,ae=l*S+u*C+d*w;return f-=re*ie/(ie**2-.5*re*ae),f}function wd(e,t,n){let[r,i,a]=e,o=gd(a),s=null,c=null;if(r=_o(r)/360,o!==0&&o!==1&&i!==0){let e=Math.cos(sd*r),a=Math.sin(sd*r),[l,u,d]=Sd([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 Td(e,t,n){let r=e[0],i=0,a=hd(r),o=Math.sqrt(e[1]**2+e[2]**2),s=.5+Math.atan2(-e[2],-e[1])/sd;if(a!==0&&a!==1&&o!==0){let[a,s,c]=Sd([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=_o(s*360),[s,i,a]}var Ed=new P({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:Do,gamutSpace:`self`,M:cd,fromBase(e){return Td(e,cd.toSRGBLinear,ld)},toBase(e){return wd(e,cd.toSRGBLinear,ld)},formats:{color:{id:`--okhsl`,coords:[`<number> | <angle>`,`<percentage> | <number>`,`<percentage> | <number>`]}}});Ed.rgbGamut=new lo({id:`okhsl-prism`,cssId:`--okhsl-prism`,name:`Okhsl Prism`,base:Ed,fromBase(e){return Vu.toBase([e[0],e[1]*100,e[2]*100])},toBase(e){let t=Vu.fromBase(e);return t[1]/=100,t[2]/=100,t}});var Dd=new P({id:`oklrab`,name:`Oklrab`,coords:{l:{refRange:[0,1],name:`Lightness`},a:{refRange:[-.4,.4]},b:{refRange:[-.4,.4]}},white:`D65`,base:Do,fromBase(e){return[hd(e[0]),e[1],e[2]]},toBase(e){return[gd(e[0]),e[1],e[2]]},formats:{color:{coords:[`<percentage> | <number>`,`<number> | <percentage>[-1,1]`,`<number> | <percentage>[-1,1]`]}}}),Od=new P({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:Dd,fromBase:yo.fromBase,toBase:yo.toBase,formats:{color:{coords:[`<percentage> | <number>`,`<number> | <percentage>[0,1]`,`<number> | <angle>`]}}}),kd={toSRGBLinear:Ed.M.toSRGBLinear};function Ad(e,t,n){let[r,i,a]=e;r=_o(r)/360;let o=gd(a),s=null,c=null;if(o!==0&&i!==0){let e=Math.cos(sd*r),l=Math.sin(sd*r),[u,d]=_d(bd(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,_=gd(m),v=h*_/m,y=gd(o);g=g*y/o,o=y;let[b,x,ee]=yd([_,e*v,l*v],t),te=M(1/Math.max(Math.max(b,x),Math.max(ee,0)),1/3);o*=te,g*=te,s=g*e,c=g*l}return[o,s,c]}function jd(e,t,n){let r=e[0],i=0,a=hd(r),o=Math.sqrt(e[1]**2+e[2]**2),s=.5+Math.atan2(-e[2],-e[1])/sd;if(r!==0&&r!==1&&o!==0){let s=e[1]/o,c=e[2]/o,[l,u]=_d(bd(s,c,t,n)),d=.5,f=1-d/l,p=u/(o+r*u),m=p*r,h=p*o,g=gd(m),_=h*g/m,[v,y,b]=yd([g,s*_,c*_],t),x=M(1/Math.max(Math.max(v,y),Math.max(b,0)),1/3);r/=x,o/=x,o=o*hd(r)/r,r=hd(r),a=r/m,i=(d+u)*h/(u*d+u*f*h)}return s=Math.abs(i)<1e-4||a===0?null:_o(s*360),[s,i,a]}var Md=new P({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:Do,gamutSpace:`self`,M:kd,fromBase(e){return jd(e,kd.toSRGBLinear,ld)},toBase(e){return Ad(e,kd.toSRGBLinear,ld)},formats:{color:{id:`--okhsv`,coords:[`<number> | <angle>`,`<percentage> | <number>`,`<percentage> | <number>`]}}});Md.rgbGamut=new lo({id:`okhsv-prism`,cssId:`--okhsv-prism`,name:`Okhsv Prism`,base:Md,fromBase(e){return Vu.toBase([e[0],e[1]*100,e[2]*100])},toBase(e){let t=Vu.fromBase(e);return t[1]/=100,t[2]/=100,t}});var Nd=Qa.D65,Pd=216/24389,Fd=24389/27,[Id,Ld]=Du({space:co,coords:Nd}),Rd=new P({id:`luv`,name:`Luv`,coords:{l:{refRange:[0,100],name:`Lightness`},u:{refRange:[-215,215]},v:{refRange:[-215,215]}},white:Nd,base:co,fromBase(e){let t=[ka(e[0]),ka(e[1]),ka(e[2])],n=t[1],[r,i]=Du({space:co,coords:t});if(!Number.isFinite(r)||!Number.isFinite(i))return[0,0,0];let a=n<=Pd?Fd*n:116*Math.cbrt(n)-16;return[a,13*a*(r-Id),13*a*(i-Ld)]},toBase(e){let[t,n,r]=e;if(t===0||j(t))return[0,0,0];n=ka(n),r=ka(r);let i=n/(13*t)+Id,a=r/(13*t)+Ld,o=t<=8?t/Fd:((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>`]}}}),zd=new P({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:Rd,fromBase:yo.fromBase,toBase:yo.toBase,formats:{color:{id:`--lchuv`,coords:[`<number> | <percentage>`,`<number> | <percentage>`,`<number> | <angle>`]}}}),Bd=216/24389,Vd=24389/27,Hd=Il.fromXYZ,Ud=Hd[0][0],Wd=Hd[0][1],Gd=Hd[0][2],Kd=Hd[1][0],qd=Hd[1][1],Jd=Hd[1][2],Yd=Hd[2][0],Xd=Hd[2][1],Zd=Hd[2][2];function Qd(e,t,n){let r=t/(Math.sin(n)-e*Math.cos(n));return r<0?1/0:r}function $d(e){let t=(e+16)**3/1560896,n=t>Bd?t:e/Vd,r=n*(284517*Ud-94839*Gd),i=n*(838422*Gd+769860*Wd+731718*Ud),a=n*(632260*Gd-126452*Wd),o=n*(284517*Kd-94839*Jd),s=n*(838422*Jd+769860*qd+731718*Kd),c=n*(632260*Jd-126452*qd),l=n*(284517*Yd-94839*Zd),u=n*(838422*Zd+769860*Xd+731718*Yd),d=n*(632260*Zd-126452*Xd);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 ef(e,t){let n=t/360*Math.PI*2,r=Qd(e.r0s,e.r0i,n),i=Qd(e.r1s,e.r1i,n),a=Qd(e.g0s,e.g0i,n),o=Qd(e.g1s,e.g1i,n),s=Qd(e.b0s,e.b0i,n),c=Qd(e.b1s,e.b1i,n);return Math.min(r,i,a,o,s,c)}var tf=new P({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:zd,gamutSpace:Vl,rgbGamut:Vl,fromBase(e){let[t,n,r]=[ka(e[0]),ka(e[1]),ka(e[2])],i;return t>99.9999999?(i=0,t=100):t<1e-8?(i=0,t=0):i=n/ef($d(t),r)*100,[r,i,t]},toBase(e){let[t,n,r]=[ka(e[0]),ka(e[1]),ka(e[2])],i;return r>99.9999999?(r=100,i=0):r<1e-8?(r=0,i=0):i=ef($d(r),t)/100*n,[r,i,t]},formats:{color:{id:`--hsluv`,coords:[`<number> | <angle>`,`<percentage> | <number>`,`<percentage> | <number>`]}}}),nf=Il.fromXYZ;nf[0][0],nf[0][1],nf[0][2],nf[1][0],nf[1][1],nf[1][2],nf[2][0],nf[2][1],nf[2][2];function rf(e,t){return Math.abs(t)/Math.sqrt(e**2+1)}function af(e){let t=rf(e.r0s,e.r0i),n=rf(e.r1s,e.r1i),r=rf(e.g0s,e.g0i),i=rf(e.g1s,e.g1i),a=rf(e.b0s,e.b0i),o=rf(e.b1s,e.b1i);return Math.min(t,n,r,i,a,o)}var of=new P({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:zd,gamutSpace:`self`,fromBase(e){let[t,n,r]=[ka(e[0]),ka(e[1]),ka(e[2])],i;return t>99.9999999?(i=0,t=100):t<1e-8?(i=0,t=0):i=n/af($d(t))*100,[r,i,t]},toBase(e){let[t,n,r]=[ka(e[0]),ka(e[1]),ka(e[2])],i;return r>99.9999999?(r=100,i=0):r<1e-8?(r=0,i=0):i=af($d(r))/100*n,[r,i,t]},formats:{color:{id:`--hpluv`,coords:[`<number> | <angle>`,`<percentage> | <number>`,`<percentage> | <number>`]}}});of.rgbGamut=new lo({id:`hpluv-prism`,cssId:`--hpluv-prism`,name:`HPLuv Prism`,base:of,fromBase(e){return Vu.toBase(e)},toBase(e){return Vu.fromBase(e)}});var sf=.021,cf=Math.sqrt(sf/3),lf=cf*cf*cf,uf=.978,df=.058,ff=264.5*Math.PI/180,pf=.7,mf=.37,hf={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]]},gf=[0,.05,.1,.15,.2,.25,.3,.35,.4,.45,.5,.55,.6,.65,.7,.75,.8,.85,.9,.95,1],_f=[0,.009494013522189627,.02564569838030986,.055259661658689105,.10574901531227408,.16055853320726027,.21405964892993756,.26786230508811226,.3220435246104499,.3739052098520243,.43020997780918835,.4835465162128873,.5399824670411353,.5956710081330342,.6542161666450478,.7115380216519989,.7702762412711669,.8293313467712837,.889406386197059,.9462829573474728,1],vf=gf.length;function yf(e){let t=e/(2*lf),n=2*cf*Math.sinh(Math.asinh(t)/3),r=n*n*n+sf*n-e,i=3*n*n+sf,a=6*n,o=2*i*i-r*a;return Math.abs(o)>1e-30&&(n-=2*r*i/o),n}function bf(e){return e*e*e+sf*e}function xf(e){let t=Math.max(0,Math.min(1,(e-mf)/.63));return Math.sin(Math.PI*t)**2}function Sf(e,t,n){let r=Math.sqrt(t*t+n*n);if(r<1e-12)return[t,n];let i=xf(e);if(i<1e-12)return[t,n];let a=Math.atan2(n,t),o=a-ff;o-=Math.round(o/(2*Math.PI))*2*Math.PI;let s=Math.exp(-.5*(o/pf)**2),c=a+df*i*s;return[r*Math.cos(c),r*Math.sin(c)]}function Cf(e,t,n){let r=Math.sqrt(t*t+n*n);if(r<1e-12)return[t,n];let i=xf(e);if(i<1e-12)return[t,n];let a=Math.atan2(n,t),o=pf*pf,s=df*i,c=a;for(let e=0;e<8;e++){let e=c-ff;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 wf(e){if(e<=0||e>=1)return e;let t=0,n=vf-1;for(;n-t>1;){let r=t+n>>1;gf[r]<=e?t=r:n=r}let r=(e-gf[t])/(gf[n]-gf[t]);return _f[t]+r*(_f[n]-_f[t])}function Tf(e){if(e<=_f[0]||e>=_f[vf-1])return e;let t=0,n=vf-1;for(;n-t>1;){let r=t+n>>1;_f[r]<=e?t=r:n=r}let r=(e-_f[t])/(_f[n]-_f[t]);return gf[t]+r*(gf[n]-gf[t])}var Ef=new P({id:`helmgen`,name:`HelmGen`,cssId:`--helmgen`,coords:{l:{refRange:[0,1],name:`Lightness`},a:{refRange:[-.6,.6]},b:{refRange:[-.6,.6]}},white:`D65`,base:co,M:hf,fromBase(e){let t=A(e,hf.M1),n=yf(Math.max(t[0],0)),r=yf(Math.max(t[1],0)),i=yf(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]=A([n,r,i],hf.M2);{let e=Math.sqrt(o*o+s*s);if(e>1e-12){let t=e**+uf/e;o*=t,s*=t}}return a=wf(a),[o,s]=Sf(a,o,s),[a,o,s]},toBase(e){let[t,n,r]=e;[n,r]=Cf(t,n,r),t=Tf(t);{let e=Math.sqrt(n*n+r*r);if(e>1e-12){let t=e**(1/uf)/e;n*=t,r*=t}}let[i,a,o]=A([t,n,r],hf.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 A([bf(i),bf(a),bf(o)],hf.M1_INV)}}),Df=new P({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:Ef,fromBase:yo.fromBase,toBase:yo.toBase}),Of=new lo({id:`rec2100-linear`,name:`Linear REC.2100`,white:`D65`,M:Ml}),kf=203,Af=2610/2**14,jf=2**14/2610,Mf=2523/32,Nf=32/2523,Pf=3424/4096,Ff=2413/128,If=2392/128,Lf=new lo({id:`rec2100pq`,cssId:`rec2100-pq`,name:`REC.2100-PQ`,base:Of,linearGamut:Of,toBase(e){return e.map(function(e){return(Math.max(e**Nf-Pf,0)/(Ff-If*e**Nf))**jf*1e4/kf})},fromBase(e){return e.map(function(e){let t=Math.max(e*kf/1e4,0);return((Pf+Ff*t**Af)/(1+If*t**Af))**Mf})}}),Rf=.17883277,zf=.28466892,Bf=.55991073,Vf=3.7743,Hf=new lo({id:`rec2100hlg`,cssId:`rec2100-hlg`,name:`REC.2100-HLG`,referred:`scene`,base:Of,linearGamut:Of,toBase(e){return e.map(function(e){return e<=.5?e**2/3*Vf:(Math.exp((e-Bf)/Rf)+zf)/12*Vf})},fromBase(e){return e.map(function(e){return e/=Vf,e<=1/12?M(3*e,.5):Rf*Math.log(12*e-zf)+Bf})}}),Uf={};qa.add(`chromatic-adaptation-start`,e=>{e.options.method&&(e.M=Gf(e.W1,e.W2,e.options.method))}),qa.add(`chromatic-adaptation-end`,e=>{e.M||=Gf(e.W1,e.W2,e.options.method)});function Wf({id:e,toCone_M:t,fromCone_M:n}){Uf[e]=arguments[0]}function Gf(e,t,n=`Bradford`){let r=Uf[n],[i,a,o]=Ca(r.toCone_M,e),[s,c,l]=Ca(r.toCone_M,t),u=Ca([[s/i,0,0],[0,c/a,0],[0,0,l/o]],r.toCone_M);return Ca(r.fromCone_M,u)}Wf({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]]}),Wf({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]]}),Wf({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]]}),Wf({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(Qa,{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]}),Qa.ACES=[.32168/.33767,1,.34065/.33767];var Kf=new lo({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:Qa.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]]}}),qf=2**-16,Jf=-.35828683,Yf=(Math.log2(65504)+9.72)/17.52,Xf=new lo({id:`acescc`,cssId:`--acescc`,name:`ACEScc`,coords:{r:{range:[Jf,Yf],name:`Red`},g:{range:[Jf,Yf],name:`Green`},b:{range:[Jf,Yf],name:`Blue`}},referred:`scene`,base:Kf,linearGamut:Kf,toBase(e){return e.map(function(e){return e<=-.3013698630136986?(2**(e*17.52-9.72)-qf)*2:e<Yf?2**(e*17.52-9.72):65504})},fromBase(e){return e.map(function(e){return e<=0?(Math.log2(qf)+9.72)/17.52:e<qf?(Math.log2(qf+e*.5)+9.72)/17.52:(Math.log2(e)+9.72)/17.52})}}),Zf=e({A98RGB:()=>qu,A98RGB_Linear:()=>Ku,ACEScc:()=>Xf,ACEScg:()=>Kf,CAM16_JMh:()=>Ps,HCT:()=>Us,HPLuv:()=>of,HSL:()=>Vu,HSL_P3:()=>Hu,HSL_REC2020:()=>Uu,HSLuv:()=>tf,HSV:()=>Wu,HWB:()=>Gu,HelmGen:()=>Ef,HelmGenLCh:()=>Df,Helmlab:()=>pl,ICTCP:()=>fs,JzCzHz:()=>ns,Jzazbz:()=>ts,LCH:()=>yo,LCH_P3:()=>id,LCH_REC_2020:()=>od,LCH_sRGB:()=>ad,LCHuv:()=>zd,Lab:()=>go,Lab_D65:()=>xu,Luv:()=>Rd,OKLCH:()=>No,OKLCH_P3:()=>td,OKLCH_REC_2020:()=>rd,OKLCH_sRGB:()=>nd,OKLab:()=>Do,OKLrCH:()=>Od,OKLrab:()=>Dd,Okhsl:()=>Ed,Okhsv:()=>Md,P3:()=>Hl,P3_Linear:()=>Fl,ProPhoto:()=>Zu,ProPhoto_Linear:()=>Ju,REC_2020:()=>Pl,REC_2020_Linear:()=>Nl,REC_2020_Scene_Referred:()=>ed,REC_2100_HLG:()=>Hf,REC_2100_Linear:()=>Of,REC_2100_PQ:()=>Lf,XYZ_ABS_D65:()=>Ho,XYZ_D50:()=>uo,XYZ_D65:()=>co,sRGB:()=>Vl,sRGB_Linear:()=>Ll}),Qf=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=N(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:P.get(n),writable:!1,enumerable:!0,configurable:!0}),this.coords=r?r.slice():[0,0,0],this.alpha=j(i)?i:i===void 0?1:Pa(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=Wl(this,...t);return n.color=new e(n.color),n}static get(t,...n){return Ra(t,this)?t:new e(t,...n)}static try(t,n){if(Ra(t,this))return t;let r=Al(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])}};Qf.defineFunctions({get:Mo,getAll:jo,set:Fo,setAll:Po,to:F,equals:ql,inGamut:Ao,toGamut:wl,distance:Lo,deltas:Gl,toString:jl}),Object.assign(Qf,{util:Ta,hooks:qa,WHITES:Qa,Space:P,spaces:P.registry,parse:to,defaults:Ja});for(let e of Object.keys(Zf))P.register(Zf[e]);for(let e in P.registry)$f(e,P.registry[e]);qa.add(`colorspace-init-end`,e=>{$f(e.id,e),e.aliases?.forEach(t=>{$f(t,e)})});function $f(e,t){let n=e.replace(/-/g,`_`);Object.defineProperty(Qf.prototype,n,{get(){let n=this.getAll(e);if(typeof Proxy>`u`)return n;let r=new Proxy(n,{has:(e,n)=>{try{return P.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}=P.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}=P.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})}Qf.extend(xl),Qf.extend({deltaE:Au}),Object.assign(Qf,{deltaEMethods:xl}),Qf.extend(ju),Qf.extend({contrast:Tu}),Qf.extend(Eu),Qf.extend(Jl),Qf.extend(Pu),Qf.extend(wu);var ep=Qf;function tp(e,t=1,n=!1){return`hsla(${e}, ${n?50:65}%, ${n?60:40}%, ${t})`}function np(e,t=1,n=!1){let r=0;for(let t=0;t<e.length;t++)r=e.charCodeAt(t)+((r<<5)-r);return tp((r%360+360)%360,t,n)}var rp=new Map;function ip(e,t,n){return new ep(`oklch`,[e,t,n]).to(`srgb`).toGamut({space:`srgb`}).toString({format:`hex`,collapse:!1})}function ap(e,t=!1){let n=`${e}|${t?`d`:`l`}`,r=rp.get(n);if(r)return r;let[,i,a]=new ep(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:ip(.8,s,o),background:ip(.22,s*.5,o),borderColor:ip(.38,s*.7,o)}:{color:ip(.42,s,o),background:ip(.94,s*.35,o),borderColor:ip(.82,s*.5,o)};return rp.set(n,c),c}var op=[`vite-plugin-`,`rollup-plugin-`,`webpack-plugin-`,`unplugin-`,`nuxt-`,`eslint-plugin-`,`postcss-`,`vite:`,`rollup:`,`rolldown:`,`webpack:`,`__`];function sp(e){let t=e.map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)).join(`|`);return RegExp(`^(?:@[^/]+\\/)?(?:${t})`)}sp(op);function cp(e,t){let[n,r,i]=new ep(e).to(`srgb`).coords.map(e=>Math.round(Math.max(0,Math.min(1,e??0))*255));return`rgba(${n}, ${r}, ${i}, ${t})`}var lp=[`src`,`alt`],up=E({__name:`DisplaySafeImage`,props:{src:{},alt:{},fit:{},preload:{type:Boolean}},setup(e){let t=e,n=w(!1),r=w(!t.preload);return be(()=>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,o)=>e.src&&!n.value&&r.value?(i(),h(`img`,{key:0,src:e.src,alt:e.alt,class:a([`block`,e.fit&&`object-${e.fit}`]),onError:o[0]||=e=>n.value=!0},null,42,lp)):we(t.$slots,`fallback`,{},void 0,void 0,1)}}),dp=E({__name:`DisplayAvatar`,props:{src:{},name:{},size:{default:32},square:{type:Boolean},colorScheme:{}},setup(e){let t=e,r=Sa(()=>t.colorScheme),s=d(()=>r.value===`dark`),l=d(()=>(t.name??``).split(/[\s/-]+/).filter(Boolean).slice(0,2).map(e=>e[0].toUpperCase()).join(``)),u=d(()=>({background:np(t.name??``,.18,s.value),color:np(t.name??``,1,s.value)}));return(t,r)=>(i(),h(`span`,{class:a([`text-xs font-medium inline-flex shrink-0 select-none items-center justify-center overflow-hidden`,e.square?`rounded-md`:`rounded-full`]),style:c({width:`${e.size}px`,height:`${e.size}px`})},[n(up,{src:e.src,alt:e.name},{fallback:D(()=>[S(`span`,{class:`inline-flex h-full w-full items-center justify-center`,style:c(u.value)},o(l.value),5)]),_:1},8,[`src`,`alt`])],6))}}),fp=E({__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=Sa(()=>t.colorScheme),s=d(()=>r.value===`dark`),l=d(()=>typeof t.color==`string`&&!n(t.color)),f=d(()=>{let{color:e,text:r}=t;if(typeof e==`number`)return tp(e,1,s.value);if(typeof e==`string`&&n(e))return e;if(e===!0&&r)return np(r,1,s.value)}),p=d(()=>{let{color:e,text:r}=t;if(typeof e==`number`)return tp(e,t.variant===`solid`?1:.12,s.value);if(typeof e==`string`&&n(e))return t.variant===`solid`?e:cp(e,.12);if(e===!0&&r)return np(r,t.variant===`solid`?1:.12,s.value)}),m=d(()=>{let{color:e,text:r}=t;if(typeof e==`number`)return tp(e,.2,s.value);if(typeof e==`string`&&n(e))return t.variant===`solid`?e:cp(e,.2);if(e===!0&&r)return np(r,.2,s.value)}),g=d(()=>{let e={padding:`${t.paddingY}em ${t.paddingX}em`,...typeof t.rounded==`number`?{borderRadius:`${t.rounded}em`}:{}};return f.value?t.variant===`solid`?{...e,color:`#fff`,background:p.value,border:`1px solid ${p.value}`}:l.value?{...e,color:f.value,background:p.value}:{...e,color:f.value,background:p.value,border:`1px solid ${m.value}`}:e}),_=d(()=>l.value?`badge-color-${t.color}`:t.color===!1?`bg-#8881 color-muted`:``),v=d(()=>typeof t.rounded==`number`?``:t.rounded===`full`?`rounded-full`:`rounded-md`);return(t,n)=>(i(),C(ae(e.as||`span`),{class:a([`leading-none font-medium inline-flex gap-1 items-center`,[v.value,_.value]]),style:c(g.value)},{default:D(()=>[e.icon?(i(),h(`span`,{key:0,class:a(e.icon),"aria-hidden":`true`},null,2)):u(``,!0),we(t.$slots,`default`,{},()=>[b(o(e.text),1)])]),_:3},8,[`class`,`style`]))}});function pp(e,t){return ve()?(ke(e,t),!0):!1}var mp=typeof window<`u`&&typeof document<`u`;typeof WorkerGlobalScope<`u`&&globalThis instanceof WorkerGlobalScope;function hp(e,t=1e3,n={}){let{immediate:r=!0,immediateCallback:i=!1}=n,a=null,o=Ce(!1);function s(){a&&=(clearInterval(a),null)}function c(){o.value=!1,s()}function l(){let n=x(t);n<=0||(o.value=!0,i&&e(),s(),o.value&&(a=setInterval(e,n)))}return r&&mp&&l(),(p(t)||typeof t==`function`)&&pp(be(t,()=>{o.value&&mp&&l()})),pp(c),{isActive:g(o),pause:c,resume:l}}var gp={neutral:`color-scale-neutral`,low:`color-scale-low`,medium:`color-scale-medium`,high:`color-scale-high`,critical:`color-scale-critical`};function _p(e,t){for(let[n,r]of t)if(e<=n)return r;return t.at(-1)?.[1]??gp.neutral}var vp=`en-US`;function yp(e,t,n){return new Intl.NumberFormat(n??vp,t).format(e)}var bp=1024,xp=1024*bp;80*bp,gp.neutral,500*bp,gp.low,gp.medium,10*xp,gp.high,gp.critical,gp.neutral,gp.low,gp.medium,gp.high,gp.critical;var Sp=1e3,Cp=60*Sp,wp=60*Cp,Tp=24*wp,Ep=30*Tp,Dp=365*Tp,Op=[[Cp,Sp,`s`],[wp,Cp,`min`],[Tp,wp,`h`],[Ep,Tp,`d`],[Dp,Ep,`mo`],[1/0,Dp,`y`]];function kp(e,t=Date.now()){let n=t-(e instanceof Date?e.getTime():e),r=Math.abs(n);if(r<Sp)return`just now`;for(let[e,t,i]of Op)if(r<e){let e=Math.round(r/t);return n>=0?`${e} ${i} ago`:`in ${e} ${i}`}return``}var Ap=[[180*Tp,gp.neutral],[365*Tp,gp.low],[3*Dp,gp.medium],[5*Dp,gp.high],[1/0,gp.critical]];function jp(e,t=Ap){return _p(e,t)}function Mp(e,t,n){return new Intl.DateTimeFormat(n??vp,t??{dateStyle:`medium`,timeStyle:`short`}).format(e)}var Np=[`datetime`],Pp=E({__name:`DisplayDate`,props:{date:{},colorize:{type:Boolean},scale:{},live:{type:Boolean},interval:{default:3e4}},setup(e){let t=e,n=w(Date.now());hp(()=>{t.live&&(n.value=Date.now())},ie(t,`interval`)),be(()=>t.date,()=>{t.live&&(n.value=Date.now())});let r=d(()=>new Date(t.date).getTime()),s=d(()=>kp(r.value,t.live?n.value:Date.now())),c=d(()=>Mp(r.value)),l=d(()=>t.colorize?jp(Math.abs(n.value-r.value),t.scale):``);return(e,t)=>Oe((i(),h(`time`,{datetime:new Date(r.value).toISOString(),class:a(l.value)},[we(e.$slots,`default`,{relative:s.value,exact:c.value},()=>[b(o(s.value),1)])],10,Np)),[[T(et),c.value]])}}),Fp={class:`flex items-center gap-1 pb1`},Ip={class:`flex items-center gap-2`},Lp={href:`https://github.com/settings/tokens/new?description=pulls.review&scopes=repo`,target:`_blank`,rel:`noopener`,class:`text-primary hover:underline`},Rp={class:`flex items-center gap-1`},zp={class:`flex flex-col gap-2 border border-base rounded bg-raised p-3`},Bp={key:0,class:`flex items-start gap-3`},Vp={class:`min-w-0 flex flex-1 flex-col gap-1.5`},Hp={class:`flex items-baseline gap-2`},Up={class:`truncate text-sm color-base font-medium`},Wp={key:0,class:`truncate text-xs color-faint`},Gp={class:`flex flex-wrap items-center gap-1`},Kp={key:0,class:`text-xs color-faint`},qp={class:`flex flex-wrap items-center gap-x-3 gap-y-1 text-xs color-faint`},Jp={key:0},Yp={key:1},Xp={key:1,class:`flex items-center gap-2 text-sm color-faint`},Zp={class:`flex-1 text-red-600 dark:text-red-400`},Qp=E({__name:`GithubTokenSettings`,props:{tokenSet:{type:Boolean},meta:{},busy:{type:Boolean},error:{}},emits:[`save`],setup(e,{emit:t}){let r=e,a=t,s=w(!1),c=w(``);be(()=>r.busy,(e,t)=>{t&&!e&&!r.error&&(s.value=!1,c.value=``)});function l(){s.value=!1,c.value=``}function d(){a(`save`,``),l()}return(t,r)=>{let f=m(`i18n-t`);return!e.tokenSet||s.value?(i(),C(Le,{key:0,error:e.error},{label:D(()=>[S(`div`,Fp,[r[5]||=S(`div`,{class:`i-carbon-logo-github text-lg`},null,-1),b(` `+o(t.$t(`settings.token.label`)),1)])]),description:D(()=>[b(o(t.$t(`settings.token.optional`)),1),r[8]||=S(`br`,null,null,-1),n(f,{keypath:`settings.token.scopes`,scope:`global`},{repo:D(()=>[...r[6]||=[S(`code`,{class:`rounded bg-sunken px1 font-medium`},`repo`,-1)]]),fineGrained:D(()=>[...r[7]||=[S(`code`,{class:`rounded bg-sunken px1 font-medium`},`Pull requests: Read and write`,-1)]]),_:1}),r[9]||=S(`br`,null,null,-1),b(` `+o(t.$t(`settings.token.storedLocally`))+` `,1),r[10]||=S(`br`,null,null,-1),S(`a`,Lp,o(t.$t(`settings.token.generate`)),1)]),default:D(()=>[S(`div`,Ip,[n(ze,{modelValue:c.value,"onUpdate:modelValue":r[0]||=e=>c.value=e,type:`password`,icon:`i-ph-key-duotone`,placeholder:`ghp_…`,class:`flex-1`,disabled:e.busy,invalid:!!e.error,onKeyup:r[1]||=Ae(e=>c.value&&a(`save`,c.value),[`enter`])},null,8,[`modelValue`,`disabled`,`invalid`]),n($e,{loading:e.busy,disabled:!c.value,onClick:r[2]||=e=>a(`save`,c.value)},{default:D(()=>[b(o(t.$t(`common.save`)),1)]),_:1},8,[`loading`,`disabled`]),s.value?(i(),C($e,{key:0,variant:`text`,disabled:e.busy,onClick:l},{default:D(()=>[b(o(t.$t(`common.cancel`)),1)]),_:1},8,[`disabled`])):u(``,!0),s.value?(i(),C($e,{key:1,variant:`text`,disabled:e.busy,onClick:d},{default:D(()=>[b(o(t.$t(`common.remove`)),1)]),_:1},8,[`disabled`])):u(``,!0)])]),_:1},8,[`error`])):(i(),C(Le,{key:1},{label:D(()=>[S(`div`,Rp,[r[11]||=S(`div`,{class:`i-carbon-logo-github text-lg`},null,-1),b(` `+o(t.$t(`settings.token.label`)),1)])]),default:D(()=>[S(`div`,zp,[e.meta?(i(),h(`div`,Bp,[n(dp,{src:e.meta.avatarUrl,name:e.meta.login,size:36},null,8,[`src`,`name`]),S(`div`,Vp,[S(`div`,Hp,[S(`span`,Up,o(e.meta.login),1),e.meta.name?(i(),h(`span`,Wp,o(e.meta.name),1)):u(``,!0)]),S(`div`,Gp,[(i(!0),h(v,null,_(e.meta.scopes,e=>(i(),C(fp,{key:e,text:e,class:`text-xs`},null,8,[`text`]))),128)),e.meta.scopes.length?u(``,!0):(i(),h(`span`,Kp,o(t.$t(`settings.token.fineGrained`)),1))]),S(`div`,qp,[S(`span`,null,[b(o(t.$t(`settings.token.updated`))+` `,1),n(Pp,{date:e.meta.setAt},null,8,[`date`])]),e.meta.expiresAt?(i(),h(`span`,Jp,[b(o(t.$t(`settings.token.expires`))+` `,1),n(Pp,{date:e.meta.expiresAt},null,8,[`date`])])):(i(),h(`span`,Yp,o(t.$t(`settings.token.neverExpires`)),1))])]),n(tt,{icon:`i-ph:pencil-simple-duotone`,label:t.$t(`settings.token.change`),tooltip:t.$t(`settings.token.change`),class:`text-sm`,onClick:r[3]||=e=>s.value=!0},null,8,[`label`,`tooltip`])])):(i(),h(`div`,Xp,[e.busy?(i(),h(v,{key:0},[r[12]||=S(`span`,{class:`i-ph:circle-notch animate-spin`,"aria-hidden":`true`},null,-1),b(` `+o(t.$t(`settings.token.checking`)),1)],64)):(i(),h(v,{key:1},[S(`span`,Zp,o(e.error??t.$t(`settings.token.couldNotVerify`)),1),n(tt,{icon:`i-ph:pencil-simple-duotone`,label:t.$t(`settings.token.change`),tooltip:t.$t(`settings.token.change`),class:`text-sm`,onClick:r[4]||=e=>s.value=!0},null,8,[`label`,`tooltip`])],64))]))])]),_:1}))}}}),$p=Te(),em=Symbol(`diffs-is-dark`),tm={github:`GitHub`};function nm(e){return e.split(`-`).map(e=>tm[e]??e.charAt(0).toUpperCase()+e.slice(1)).join(` `)}function rm(e){return ma.getThemes({colorScheme:e}).map(e=>({value:e.name,label:e.displayName??nm(e.name),collection:e.collection??``}))}function im(e,t){return typeof t==`string`&&ma.getTheme(t)?.colorScheme===e}var am=ue(`diffs:syntax-theme`,ln,{mergeDefaults:!0}),om=d(()=>({light:im(`light`,am.value.light)?am.value.light:ln.light,dark:im(`dark`,am.value.dark)?am.value.dark:ln.dark}));function sm(e,t){am.value={...om.value,[e]:t}}var cm=ue(`diffs:wrap-lines`,!0),lm={key:1},um=E({__name:`ActionToggleGroup`,props:ne({options:{},multiple:{type:Boolean,default:!1},iconOnly:{type:Boolean}},{modelValue:{},modelModifiers:{}}),emits:[`update:modelValue`],setup(e){let t=Ee(e,`modelValue`);return(n,r)=>(i(),C(T(Jt),{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:D(()=>[(i(!0),h(v,null,_(e.options,t=>(i(),C(T(Xt),{key:t.value,value:t.value,disabled:t.disabled,"aria-label":t.label??t.value,class:a([`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:D(()=>[t.icon?(i(),h(`span`,{key:0,class:a(t.icon),"aria-hidden":`true`},null,2)):u(``,!0),e.iconOnly?u(``,!0):(i(),h(`span`,lm,o(t.label??t.value),1))]),_:2},1032,[`value`,`disabled`,`aria-label`,`class`]))),128))]),_:1},8,[`modelValue`,`type`]))}}),dm=w(!1),fm=w(`appearance`);function pm(e){e&&(fm.value=e),dm.value=!0}var mm=E({__name:`DarkToggle`,setup(e){let t=document.head.appendChild(document.createElement(`meta`));t.name=`theme-color`,ge(()=>{t.content=$p.value?`#222222`:`#ffffff`});function n(){$p.value=!$p.value}return(e,t)=>(i(),C(tt,{icon:`i-ph-sun-duotone dark:i-ph-moon-duotone`,onClick:n}))}}),hm={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`},gm=[`aria-selected`,`onClick`],_m={class:`min-w-0 flex-1 whitespace-nowrap`},vm={key:0,class:`i-ph:check shrink-0 text-xs`,"aria-hidden":`true`},ym=E({__name:`LanguageMenu`,setup(e){let t=w(!1),r=De(`root`);_e(r,()=>t.value=!1);function s(e){O.value={...O.value,locale:e},t.value=!1}return(e,c)=>(i(),h(`div`,{ref_key:`root`,ref:r,class:`relative`},[n(tt,{icon:`i-ph:translate-duotone`,label:e.$t(`settings.language`),tooltip:e.$t(`settings.language`),active:t.value,"aria-expanded":t.value,onClick:c[0]||=e=>t.value=!t.value},null,8,[`label`,`tooltip`,`active`,`aria-expanded`]),t.value?(i(),h(`div`,hm,[(i(!0),h(v,null,_(T(Qe),e=>(i(),h(`button`,{key:e.code,type:`button`,role:`option`,"aria-selected":e.code===T(O).locale,class:a([`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===T(O).locale?`color-active`:`color-base`]),onClick:t=>s(e.code)},[S(`span`,_m,o(e.native),1),e.code===T(O).locale?(i(),h(`span`,vm)):u(``,!0)],10,gm))),128))])):u(``,!0)],512))}}),bm=`vercel.ai.error`,xm=Symbol.for(bm),Sm=class e extends Error{constructor({name:e,message:t,cause:n}){super(t),this[xm]=!0,this.name=e,this.cause=n}static isInstance(t){return e.hasMarker(t,bm)}static hasMarker(e,t){let n=Symbol.for(t);return typeof e==`object`&&!!e&&n in e&&typeof e[n]==`boolean`&&e[n]===!0}},Cm=`AI_APICallError`,wm=`vercel.ai.error.${Cm}`,Tm=Symbol.for(wm),R=class extends Sm{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:Cm,message:e,cause:o}),this[Tm]=!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 Sm.hasMarker(e,wm)}},Em=`AI_EmptyResponseBodyError`,Dm=`vercel.ai.error.${Em}`,Om=Symbol.for(Dm),km=class extends Sm{constructor({message:e=`Empty response body`}={}){super({name:Em,message:e}),this[Om]=!0}static isInstance(e){return Sm.hasMarker(e,Dm)}};function z(e){return e==null?`unknown error`:typeof e==`string`?e:e instanceof Error?e.toString():JSON.stringify(e)}var Am=`AI_InvalidArgumentError`,jm=`vercel.ai.error.${Am}`,Mm=Symbol.for(jm),Nm=class extends Sm{constructor({message:e,cause:t,argument:n}){super({name:Am,message:e,cause:t}),this[Mm]=!0,this.argument=n}static isInstance(e){return Sm.hasMarker(e,jm)}},Pm=`AI_JSONParseError`,Fm=`vercel.ai.error.${Pm}`,Im=Symbol.for(Fm),Lm=class extends Sm{constructor({text:e,cause:t}){super({name:Pm,message:`JSON parsing failed: Text: ${e}.\nError message: ${z(t)}`,cause:t}),this[Im]=!0,this.text=e}static isInstance(e){return Sm.hasMarker(e,Fm)}},Rm=`AI_TypeValidationError`,zm=`vercel.ai.error.${Rm}`,Bm=Symbol.for(zm),Vm=class e extends Sm{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:Rm,message:`${r}: Value: ${JSON.stringify(e)}.\nError message: ${z(t)}`,cause:t}),this[Bm]=!0,this.value=e,this.context=n}static isInstance(e){return Sm.hasMarker(e,zm)}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})}},Hm=`AI_UnsupportedFunctionalityError`,Um=`vercel.ai.error.${Hm}`,Wm=Symbol.for(Um),Gm=class extends Sm{constructor({functionality:e,message:t=`'${e}' functionality not supported.`}){super({name:Hm,message:t}),this[Wm]=!0,this.functionality=e}static isInstance(e){return Sm.hasMarker(e,Um)}};function Km(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 qm(e,t=`|`){return e.map(e=>bh(e)).join(t)}function Jm(e,t){return typeof t==`bigint`?t.toString():t}var Ym=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 Xm(e){return new Ym(e)}function Zm(e){return e==null}function Qm(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function $m(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 eh=Symbol(`evaluating`);function th(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==eh)return r===void 0&&(r=eh,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function nh(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function rh(e){let t=Object.getOwnPropertyDescriptor(e,`shape`);return t?.get?t.get.raw:t?.value}function ih(e){return rh(e._zod.def)??e._zod.def.shape}function ah(e,t,n){Object.defineProperty(e,t,{get(){let e=n();return nh(this,t,e),e},enumerable:!0,configurable:!0})}function oh(e,t,n){t in e?nh(e,t,n):e[t]=n}function sh(e,t,n,r){let i=ih(t);for(let a of n){let n=Object.getOwnPropertyDescriptor(i,a);n.enumerable&&(n.get?ah(e,a,()=>{let e=t._zod.def.shape[a];return r?r(e,a):e}):oh(e,a,r?r(n.value,a):n.value))}}function ch(e,t){for(let n of Reflect.ownKeys(t)){let r=Object.getOwnPropertyDescriptor(t,n);r.enumerable&&(r.get?ah(e,n,()=>t[n]):oh(e,n,r.value))}}function lh(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function uh(e){return JSON.stringify(e)}function dh(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var fh=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function ph(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var mh=Xm(()=>{if(cg.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function hh(e){if(ph(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return ph(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function gh(e){return hh(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var _h=new Set([`string`,`number`,`symbol`]);function vh(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function yh(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function B(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 bh(e){return typeof e==`bigint`?e.toString()+`n`:typeof e==`string`?`"${e}"`:`${e}`}function xh(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout===`optional`)}var Sh={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},Ch={int64:[BigInt(`-9223372036854775808`),BigInt(`9223372036854775807`)],uint64:[BigInt(0),BigInt(`18446744073709551615`)]};function wh(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 sh(i,e,Th(e,t)),yh(e,lh(n,{shape:i,checks:[]}))}function Th(e,t){let n=ih(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 Eh(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(Th(e,t)),a={};return sh(a,e,Reflect.ownKeys(ih(e)).filter(e=>!i.has(e))),yh(e,lh(n,{shape:a,checks:[]}))}function Dh(e,t){if(!hh(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=ih(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 yh(e,lh(e._zod.def,{shape:Oh(e,t)}))}function Oh(e,t){let n={};return sh(n,e,Reflect.ownKeys(ih(e))),ch(n,t),n}function kh(e,t){if(!hh(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return yh(e,lh(e._zod.def,{shape:Oh(e,t)}))}function Ah(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 sh(n,e,Reflect.ownKeys(ih(e))),sh(n,t,Reflect.ownKeys(ih(t))),yh(e,lh(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function jh(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(Th(t,n)):void 0,o={};return sh(o,t,Reflect.ownKeys(ih(t)),e&&((t,n)=>a&&!a.has(n)?t:new e({type:`optional`,innerType:t}))),yh(t,lh(t._zod.def,{shape:o,checks:[]}))}function Mh(e,t,n){let r=n?new Set(Th(t,n)):void 0,i={};return sh(i,t,Reflect.ownKeys(ih(t)),(t,n)=>r&&!r.has(n)?t:new e({type:`nonoptional`,innerType:t})),yh(t,lh(t._zod.def,{shape:i}))}function Nh(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 Ph(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 Fh(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function Ih(e){return typeof e==`string`?e:e?.message}function Lh(e,t,n){var r;for(let i=t;i<e.length;i++)(r=e[i]).schema??(r.schema=n)}function Rh(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:Ih(e.inst?._zod.def?.error?.(e))??Ih(a?.(e))??Ih(t?.error?.(e))??Ih(n.customError?.(e))??Ih(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 zh=/[\uD800-\uDBFF]/;function Bh(e){let t=e.length;if(!zh.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 Vh(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function Hh(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 Uh(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}function Wh(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);r.get?Object.defineProperty(e,n,{...r,enumerable:!1}):Jh(e,n,r.value)}}function Gh(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function Kh(e,t,n){return Gh(e,t,n,!1)}function qh(e,t){for(let n in e){let r=e[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get(){return Gh(this,n,r(this))},set(e){Gh(this,n,e)}})}return t}function Jh(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:Gh(this,t,n.bind(this))},set(e){Gh(this,t,e)}})}function Yh(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}var Xh,Zh=!1,Qh={configurable:!0,get(){Zh=!0}};function V(e,t,n){let r=Object.getPrototypeOf(e._zod);if(t in r&&Xh!==e._zod){Xh=void 0;return}Xh=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,Qh);let e=Zh;Zh=!1;try{let r=n(this);return Zh?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:r}),Zh||=e,r}catch(n){throw delete this[t],Zh||=e,n}},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}})}function $h(e,t,n,r){let i=Yh(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 eg=`~constantCatch`;function tg(e){let t=()=>e;return t[eg]=!0,t}var ng,rg={value:void 0,enumerable:!1},ig=`captureStackTrace`in Error?Error:null;function ag(e){let t=ig;if(t){let n=t.stackTraceLimit;if(typeof n==`number`){try{t.stackTraceLimit=0}catch{return ig=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function H(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){rg.value=new a(r);try{Object.defineProperty(n,"_zod",rg)}finally{rg.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),Wh(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?ag(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 og=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},sg=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(ng=globalThis).__zod_globalConfig??(ng.__zod_globalConfig={});var cg=globalThis.__zod_globalConfig;function lg(e){return e&&Object.assign(cg,e),cg}function ug(){let e=this._zod;return e.message??=JSON.stringify(e.def,Jm,2),e.message}function dg(e){this._zod.message=e}var fg={get:ug,set:dg,enumerable:!0,configurable:!0},pg={value:void 0,enumerable:!1},mg=new WeakSet([Object.prototype,Error.prototype]),hg=(e,t)=>{e.name=`$ZodError`,pg.value=t,Object.defineProperty(e,"issues",pg),pg.value=void 0,Object.defineProperty(e,"message",fg);let n=Object.getPrototypeOf(e);mg.has(n)||(mg.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})}}))},gg=H(`$ZodError`,hg);H(`$ZodError`,hg,void 0,{Parent:Error});function _g(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 vg(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?_g(n,i.path[0],()=>[]).push(t(i)):r.push(t(i));return{formErrors:r,fieldErrors:n}}function yg(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 bg(e,t){return{callee:t?.callee??e,Err:t?.Err}}var xg=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 og;if(s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>Rh(e,o,lg())));throw fh(n,a?.callee??t),n}return s.value};return t},Sg=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=>Rh(e,o,lg())));throw fh(n,a?.callee??t),n}return s.value};return t},Cg=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 og;return a.issues.length?wg(e,a.issues,i):{success:!0,data:a.value}};function wg(e,t,n){let r;return{success:!1,get error(){return r||(r=new e(t.map(e=>Rh(e,n,lg()))),t=void 0,n=void 0),r},set error(e){r=e,t=void 0,n=void 0}}}var Tg=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?wg(e,a.issues,i):{success:!0,data:a.value}},Eg=Symbol.for(`zod.compile.invalid`),Dg=Symbol.for(`zod.compile.fallback`),Og=((e,t,n)=>{let r=e._zod.bag.validator;if(r!==void 0){if(r(t)!==Eg)return!0;if(r.definite===!0&&n===void 0)return!1}return kg(e,t,n)});function kg(e,t,n){let r=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},i=e._zod.bag.fallbackRun,a;if(i?(r[Dg]=!0,a=i({value:t,issues:[]},r)):a=e._zod.run({value:t,issues:[]},r),a instanceof Promise)throw new og;return a.issues.length===0}var Ag=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},jg=e=>{let t=xg(e),n=(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return t(e,r,o,bg(n,a))};return n},Mg=e=>{let t=xg(e),n=(e,r,i,a)=>t(e,r,i,bg(n,a));return n},Ng=e=>{let t=Sg(e),n=async(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return await t(e,r,o,bg(n,a))};return n},Pg=e=>{let t=Sg(e),n=async(e,r,i,a)=>await t(e,r,i,bg(n,a));return n},Fg=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Cg(e)(t,n,i)},Ig=e=>(t,n,r)=>Cg(e)(t,n,r),Lg=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Tg(e)(t,n,i)},Rg=e=>async(t,n,r)=>Tg(e)(t,n,r),zg=/^[cC][0-9a-z]{6,}$/,Bg=/^[0-9a-z]+$/,Vg=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,Hg=/^[0-9a-vA-V]{20}$/,Ug=/^[A-Za-z0-9]{27}$/,Wg=/^[a-zA-Z0-9_-]{21}$/;function Gg(e){return RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var Kg=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,qg=/^([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})$/,Jg=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)$/,Yg=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Xg=`^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`;function Zg(){return new RegExp(Xg,`u`)}var Qg=/^(?:(?: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])$/,$g=/^(([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}|:))$/,e_=/^((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])$/,t_=/^(([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])$/,n_=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,r_=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,i_=/^https?$/,a_=/^\+[1-9]\d{6,14}$/,o_=`(?:(?:\\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 s_(e){return RegExp(`^${e}$`)}var c_=s_(o_);function l_(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 u_(e){return RegExp(`^${l_(e)}$`)}function d_(e){let t=[`Z`];e.offset&&t.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let n=`${l_({precision:e.precision,seconds:!0})}(?:${t.join(`|`)})`,r=e.local?`${n}|${l_({precision:e.precision})}`:n;return RegExp(`^${o_}T(?:${r})$`)}var f_=/^[\s\S]{0,}$/,p_=/^-?\d+$/,m_=/^-?\d+(?:\.\d+)?$/,h_=/^(?:true|false)$/i,g_=/^null$/i,__=/^[^A-Z]*$/,v_=/^[^a-z]*$/,y_=H(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),b_=e=>{let t=e.value;return!Zm(t)&&t.length!==void 0},x_={number:`number`,bigint:`bigint`,object:`date`},S_=H(`$ZodCheckLessThan`,(e,t)=>{y_.init(e,t);let n=x_[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:x_[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})}}),C_=H(`$ZodCheckGreaterThan`,(e,t)=>{y_.init(e,t);let n=x_[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:x_[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})}}),w_=H(`$ZodCheckMultipleOf`,(e,t)=>{y_.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):$m(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})}}),T_=H(`$ZodCheckNumberFormat`,(e,t)=>{y_.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=Sh[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})}}),E_=H(`$ZodCheckMaxLength`,(e,t)=>{var n;y_.init(e,t),(n=e._zod.def).when??(n.when=b_),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>t.maximum?Bh(r):i)<=t.maximum)return;let a=Vh(r);n.issues.push({origin:a,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),D_=H(`$ZodCheckMinLength`,(e,t)=>{var n;y_.init(e,t),(n=e._zod.def).when??(n.when=b_),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>=t.minimum&&i<t.minimum*2?Bh(r):i)>=t.minimum)return;let a=Vh(r);n.issues.push({origin:a,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),O_=H(`$ZodCheckLengthEquals`,(e,t)=>{var n;y_.init(e,t),(n=e._zod.def).when??(n.when=b_),e._zod.check=n=>{let r=n.value,i=r.length,a=typeof r==`string`&&i>=t.length&&i<=t.length*2?Bh(r):i;if(a===t.length)return;let o=Vh(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})}}),k_=H(`$ZodCheckStringFormat`,(e,t)=>{var n,r;y_.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=()=>{})}),A_=H(`$ZodCheckRegex`,(e,t)=>{k_.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})}}),j_=H(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=__,k_.init(e,t)}),M_=H(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=v_,k_.init(e,t)}),N_=H(`$ZodCheckIncludes`,(e,t)=>{y_.init(e,t);let n=vh(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})}}),P_=H(`$ZodCheckStartsWith`,(e,t)=>{y_.init(e,t);let n=RegExp(`^${vh(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})}}),F_=H(`$ZodCheckEndsWith`,(e,t)=>{y_.init(e,t);let n=RegExp(`.*${vh(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})}}),I_=H(`$ZodCheckOverwrite`,(e,t)=>{y_.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),L_=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(`
5
+ `).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(`
6
+ `)}\n};`)(...Object.values(this.closed))}},R_={major:4,minor:6,patch:5},U=H(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=R_;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=Nh(t),a;for(let o of n){if(o._zod.def.when){if(Ph(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 og;if(a||s instanceof Promise)a=(a??Promise.resolve()).then(async()=>{await s,t.issues.length!==n&&(Lh(t.issues,n,e),i||=Nh(t,n))});else{if(t.issues.length===n)continue;Lh(t.issues,n,e),i||=Nh(t,n)}}return a?a.then(()=>t):t},n=(n,r,a)=>{if(Nh(n))return n.aborted=!0,n;let o=t(r,i,a);if(o instanceof Promise){if(a.async===!1)throw new og;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 og;return o.then(e=>t(e,i,a))}return t(o,i,a)}}},{get"~standard"(){return Kh(this,`~standard`,V_(this))},set"~standard"(e){Gh(this,`~standard`,e)}}),z_=(e,t)=>e.issues.length?{issues:e.issues.map(e=>Rh(e,t,lg()))}:{value:e.value};async function B_(e,t){let n={async:!0};return z_(await e._zod.run({value:t,issues:[]},n),n)}function V_(e){return{validate:t=>{let n={async:!1};try{let r=e._zod.run({value:t,issues:[]},n);if(!(r instanceof Promise))return z_(r,n)}catch{}return B_(e,t)},vendor:`zod`,version:1}}var H_=H(`$ZodString`,(e,t)=>{U.init(e,t),e._zod.pattern=t.pattern??f_,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}}),W=H(`$ZodStringFormat`,(e,t)=>{k_.init(e,t),H_.init(e,t)}),U_=H(`$ZodGUID`,(e,t)=>{t.pattern??=qg,W.init(e,t)}),W_=H(`$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??=Jg(e)}else t.pattern??=Jg();W.init(e,t)}),G_=H(`$ZodEmail`,(e,t)=>{t.pattern??=Yg,W.init(e,t)});function K_(e){try{return typeof URL<`u`&&typeof URL.canParse==`function`?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function q_(e,t){return!(`normalize`in t)&&!(`hostname`in t)&&!(`protocol`in t)?K_(e)||2:J_(e,t)}function J_(e,t){if(!t.normalize&&t.protocol?.source===i_.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 Y_=/[\t\n\r]/g;function X_(e){return e.replace(Y_,``)}function Z_(e,t){return t.lastIndex=0,t.test(e.hostname)}function Q_(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(`:`)?e.protocol.slice(0,-1):e.protocol)}var $_=H(`$ZodURL`,(e,t)=>{W.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=q_(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=X_(r);return}t.hostname&&!Z_(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&&!Q_(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:X_(r);return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),ev=H(`$ZodEmoji`,(e,t)=>{t.pattern??=Zg(),W.init(e,t)}),tv=H(`$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?Wg:Gg(t.length),W.init(e,t)}),nv=H(`$ZodCUID`,(e,t)=>{t.pattern??=zg,W.init(e,t)}),rv=H(`$ZodCUID2`,(e,t)=>{t.pattern??=Bg,W.init(e,t)}),iv=H(`$ZodULID`,(e,t)=>{t.pattern??=Vg,W.init(e,t)}),av=H(`$ZodXID`,(e,t)=>{t.pattern??=Hg,W.init(e,t)}),ov=H(`$ZodKSUID`,(e,t)=>{t.pattern??=Ug,W.init(e,t)}),sv=H(`$ZodISODateTime`,(e,t)=>{t.pattern??=d_(t),W.init(e,t)}),cv=H(`$ZodISODate`,(e,t)=>{t.pattern??=c_,W.init(e,t)}),lv=H(`$ZodISOTime`,(e,t)=>{t.pattern??=u_(t),W.init(e,t)}),uv=H(`$ZodISODuration`,(e,t)=>{t.pattern??=Kg,W.init(e,t)}),dv=H(`$ZodIPv4`,(e,t)=>{t.pattern??=Qg,W.init(e,t)}),fv=/^[0-9a-fA-F:.]+$/;function pv(e){return fv.test(e)?K_(`http://[${e}]`):!1}var mv=H(`$ZodIPv6`,(e,t)=>{t.pattern??=$g,W.init(e,t),e._zod.check=n=>{pv(n.value)||n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}),hv=H(`$ZodCIDRv4`,(e,t)=>{t.pattern??=e_,W.init(e,t)});function gv(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:pv(n)}var _v=H(`$ZodCIDRv6`,(e,t)=>{t.pattern??=t_,W.init(e,t),e._zod.check=n=>{gv(n.value)||n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}});function vv(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var yv=/^[0-9a-zA-Z+/]*={0,2}$/,bv=H(`$ZodBase64`,(e,t)=>{t.pattern??=yv,W.init(e,t),e._zod.check=n=>{vv(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}}),xv=/^[A-Za-z0-9_-]*$/;function Sv(e){if(!xv.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return vv(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var Cv=H(`$ZodBase64URL`,(e,t)=>{t.pattern??=xv,W.init(e,t),e._zod.check=n=>{Sv(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),wv=H(`$ZodE164`,(e,t)=>{t.pattern??=a_,W.init(e,t)});function Tv(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 Ev=H(`$ZodJWT`,(e,t)=>{W.init(e,t),e._zod.check=n=>{Tv(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),Dv=H(`$ZodNumber`,(e,t)=>{U.init(e,t),e._zod.pattern=m_,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}}),Ov=H(`$ZodNumberFormat`,(e,t)=>{T_.init(e,t),Dv.init(e,t)}),kv=H(`$ZodBoolean`,(e,t)=>{U.init(e,t),e._zod.pattern=h_,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}}),Av=H(`$ZodNull`,(e,t)=>{U.init(e,t),e._zod.pattern=g_,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}}),jv=H(`$ZodAny`,(e,t)=>{U.init(e,t),e._zod.parse=e=>e}),Mv=H(`$ZodUnknown`,(e,t)=>{U.init(e,t),e._zod.parse=e=>e}),Nv=H(`$ZodNever`,(e,t)=>{U.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function Pv(e,t,n){e.issues.length&&t.issues.push(...Fh(n,e.issues)),t.value[n]=e.value}var Fv=H(`$ZodArray`,(e,t)=>{U.init(e,t);let n=cg.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=>Pv(t,r,e)));else if(Pv(c,r,e),s&&c.issues.length!==0&&Nh(c))break}return o.length?Promise.all(o).then(()=>r):r}});function Iv(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(...Fh(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 Lv=[];function Rv(e){let t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:Lv,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=xh(e.shape);return{...e,allKeys:i,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(a)}}function zv(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(Nh(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=>Iv(e,n,i,t,d,f))):Iv(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 Bv=H(`$ZodObject`,(e,t)=>{U.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=Xm(()=>Rv(t));V(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)||nh(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=ph,o=t.catchall,s,c=cg.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(Nh(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=>Iv(n,t,e,r,a,o))):Iv(s,t,e,r,a,o)}return o?zv(l,r,t,n,i.value,e,d===!0):l.length?Promise.all(l).then(()=>t):t}}),Vv=H(`$ZodObjectJIT`,(e,t)=>{Bv.init(e,t);let n=e._zod.parse,r=Xm(()=>Rv(t)),i=cg.memoizer,a=t=>{let n=r.value,a=n.symbolKeys,o=new L_([`payload`,`ctx`],{shape:t,inst:e,memo:i,syms:a}),s=e=>`shape[${e}]._zod.run({ value: input[${e}], issues: [] }, ctx)`,c=(e,t)=>`
7
+ let ${e}_ab = false;
8
+ for (let i = 0; i < ${e}.issues.length; i++) {
9
+ const iss = ${e}.issues[i];
10
+ iss.path = iss.path ? [${t}, ...iss.path] : [${t}];
11
+ payload.issues.push(iss);
12
+ if (iss.continue !== true) ${e}_ab = true;
13
+ }
14
+ if (${e}_ab && ctx && ctx.abortEarly) {
15
+ payload.value = newResult;
16
+ return payload;
17
+ }`;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)}]`:uh(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(`
18
+ const ${n}_present = ${i};
19
+ if (!${n}.issues.length || ${n}_present) {
20
+ if (${n}.issues.length) {${c(n,r)}
21
+ }
22
+
23
+ if (${e}) {
24
+ newResult[${r}] = ${n}.value;
25
+ }
26
+ }
27
+
28
+ `)}else f?(o.write(`
29
+ if (${n}.issues.length) {${c(n,r)}
30
+ }
31
+ `),d===`defaulted`?o.write(`newResult[${r}] = ${n}.value;`):o.write(`
32
+ if (${n}.value !== undefined || ${i}) {
33
+ newResult[${r}] = ${n}.value;
34
+ }
35
+ `)):o.write(`
36
+ const ${n}_present = ${i};
37
+ if (${n}.issues.length) {${c(n,r)}
38
+ }
39
+ if (!${n}_present && !${n}.issues.length) {
40
+ payload.issues.push({
41
+ code: "invalid_type",
42
+ expected: "nonoptional",
43
+ input: undefined,
44
+ path: [${r}]
45
+ });
46
+ if (ctx && ctx.abortEarly) {
47
+ payload.value = newResult;
48
+ return payload;
49
+ }
50
+ }
51
+
52
+ if (${n}_present) {
53
+ newResult[${r}] = ${n}.value;
54
+ }
55
+
56
+ `)}return o.write(`payload.value = newResult;`),o.write(`return payload;`),o.compile()},o,s=ph,c=!cg.jitless,l=c&&mh.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?zv([],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 Hv(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=>!Nh(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=>Rh(e,r,lg())))}),t)}var Uv=H(`$ZodUnion`,(e,t)=>{U.init(e,t),V(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),V(e,`optout`,e=>e.def.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),V(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)))}),V(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=>Qm(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=>Hv(t,r,e,i)):Hv(o,r,e,i)}});function Wv(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 Gv=H(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,Uv.init(e,t);let n=e._zod.parse;V(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)||nh(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=rh(e._zod.def);if(r&&!Object.prototype.hasOwnProperty.call(r,t.discriminator))throw Error(`Invalid discriminated union option at index "${n}"`)});let r=Xm(()=>Wv(t));e._zod.parse=(i,a)=>{let o=i.value;if(!ph(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)}}),Kv=H(`$ZodIntersection`,(e,t)=>{U.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])=>Jv(e,t,n)):Jv(e,i,a)}});function qv(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(hh(e)&&hh(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=qv(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=qv(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 Jv(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=qv(t.value,n.value);if(!c.valid){if(Nh(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}var Yv=H(`$ZodRecord`,(e,t)=>{U.init(e,t);let n=cg.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!hh(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=>Rh(e,i,lg())),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(...Fh(n,e.issues)),r.value[l]=e.value})):(u.issues.length&&r.issues.push(...Fh(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`&&m_.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=>Rh(e,i,lg())),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(...Fh(n,e.issues)),r.value[u]=e.value})):(d.issues.length&&r.issues.push(...Fh(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}}),Xv=H(`$ZodEnum`,(e,t)=>{U.init(e,t);let n=Km(t.entries),r=new Set(n);e._zod.values=r,V(e,`pattern`,e=>{let t=Km(e.def.entries).filter(e=>_h.has(typeof e));return RegExp(t.length?`^(${t.map(e=>vh(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}}),Zv=H(`$ZodLiteral`,(e,t)=>{U.init(e,t);let n=new Set(t.values);e._zod.values=n,V(e,`pattern`,e=>{let t=e.def.values;return RegExp(t.length?`^(${t.map(e=>typeof e==`string`?vh(e):e?vh(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}}),Qv=H(`$ZodTransform`,(e,t)=>{U.init(e,t),e._zod.optin=`optional`,cg.memoizer?.guard(e),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new sg(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 og;return n.value=i,n}});function $v(e,t){return e.value=t.issues.length?void 0:t.value,e}var ey=H(`$ZodOptional`,(e,t)=>{U.init(e,t),V(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),e._zod.optout=`optional`,V(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t,void 0]):void 0}),V(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${Qm(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=>$v(e,t)):$v(e,r)}return t.innerType._zod.run(e,n)}}),ty=H(`$ZodExactOptional`,(e,t)=>{ey.init(e,t),V(e,`values`,e=>e.def.innerType._zod.values),V(e,`pattern`,e=>e.def.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),ny=H(`$ZodNullable`,(e,t)=>{U.init(e,t),V(e,`optin`,e=>e.def.innerType._zod.optin),V(e,`optout`,e=>e.def.innerType._zod.optout),V(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${Qm(t.source)}|null)$`):void 0}),V(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)}),ry=H(`$ZodDefault`,(e,t)=>{U.init(e,t),e._zod.optin=`defaulted`,V(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=>iy(e,t)):iy(r,t)}});function iy(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var ay=H(`$ZodPrefault`,(e,t)=>{U.init(e,t),e._zod.optin=`defaulted`,V(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))}),oy=H(`$ZodNonOptional`,(e,t)=>{U.init(e,t),V(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=>sy(t,e)):sy(i,e)}});function sy(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 cy(e,t,n,r){return t.issues.length?(e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map(e=>Rh(e,r,lg()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}var ly=H(`$ZodCatch`,(e,t)=>{U.init(e,t),V(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),V(e,`optout`,e=>e.def.innerType._zod.optout),V(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=>cy(e,r,t,n)):cy(e,r,t,n)}}),uy=H(`$ZodPipe`,(e,t)=>{U.init(e,t),V(e,`values`,e=>e.def.in._zod.values),V(e,`optin`,e=>e.def.in._zod.optin),V(e,`optout`,e=>e.def.out._zod.optout),V(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=>dy(e,t.in,n)):dy(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>dy(e,t.out,n)):dy(r,t.out,n)}});function dy(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 fy=H(`$ZodReadonly`,(e,t)=>{U.init(e,t),V(e,`propValues`,e=>e.def.innerType._zod.propValues),V(e,`values`,e=>e.def.innerType._zod.values),V(e,`optin`,e=>e.def.innerType?._zod?.optin),V(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(py):py(r)}});function py(e){return e.memo||(e.value=Object.freeze(e.value)),e}var my=H(`$ZodLazy`,(e,t)=>{U.init(e,t),th(e._zod,`innerType`,()=>{let e=t;return e._cachedInner||=t.getter(),e._cachedInner}),V(e,`pattern`,e=>e.innerType?._zod?.pattern),V(e,`propValues`,e=>e.innerType?._zod?.propValues),V(e,`optin`,e=>e.innerType?._zod?.optin??void 0),V(e,`optout`,e=>e.innerType?._zod?.optout??void 0),e._zod.parse=(t,n)=>e._zod.innerType._zod.run(t,n)}),hy=H(`$ZodCustom`,(e,t)=>{y_.init(e,t),U.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=>gy(t,n,r,e));gy(i,n,r,e)}});function gy(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(Uh(e))}}var _y=class extends Error{constructor(){super(`Cannot parse a reference cycle that closes through a transform`),this.name=`ZodCyclicError`}},vy=`~memo`,yy=[];function by(e){return typeof e==`object`&&!!e}function xy(e){return e.map(e=>e.path?{...e,path:e.path.slice()}:{...e})}var Sy=new WeakMap,Cy=0,wy=1,Ty=2;function Ey(e,t,n){let r=Sy.get(e);if(r!==void 0)return r?Ty:Cy;if(t.has(e))return Ty;t.add(e);let i=Cy,a=e=>{if(i!==Ty&&e?._zod){let r=Ey(e,t,n);r>i&&(i=r)}},o=(e,r)=>{let i=Cy;for(let a of Reflect.ownKeys(e)){let o=Object.getOwnPropertyDescriptor(e,a);if(r&&!o.enumerable)continue;let s=o.get?wy:o.value?._zod?Ey(o.value,t,n):Cy;s>i&&(i=s)}return i},s=e=>{e>i&&(i=e)},c=e._zod.def;switch(c.type){case`object`:{let e=rh(c);s(e?o(e,!0):wy),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?Ey(r,t,!1):wy);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),Dy(e,i)}function Dy(e,t){return t!==wy&&Sy.set(e,t===Ty),t}function Oy(e,t){let n=e.buckets.get(t);return n||(n=new WeakMap,e.buckets.set(t,n)),n}var ky,Ay=[],jy={alloc(e,t,n){let r=ky;if(!r)return n;ky=void 0;let i={value:n,issues:null};return r.set(t.value,i),Ay.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`&&Ny(n,e.value))throw new _y;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=Ey(e,new Set,!1);if(i===Cy)return e._zod.parse=t,e._zod.run===o&&(e._zod.run=t),t(s,c);i===Ty||r?n=!0:r=!0}let l=s.value;if(!by(l))return t(s,c);let u=c[vy];u||(u={buckets:new WeakMap,backEdges:void 0},c[vy]=u);let d;i===c?d=a:(d=Oy(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(...xy(f.issues)):(s.memo=!0,u.backEdges??(u.backEdges=new WeakSet),u.backEdges.add(f.value)),s;ky=d;let p=Ay.length,m=t(s,c);ky=void 0;let h=Ay.length>p?Ay.pop():void 0;return m instanceof Promise?m.then(e=>(h&&(h.issues=e.issues.length?xy(e.issues):yy),e)):(h&&(h.issues=m.issues.length?xy(m.issues):yy),m)};e._zod.parse=o,e._zod.run===t&&(e._zod.run=o)})}};function My(){return jy}function Ny(e,t){let n=e[vy]?.backEdges;return n!==void 0&&by(t)&&n.has(t)}var Py=()=>{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(Hh(e.input),e.input)}`;case`invalid_value`:return e.values.length===1?`Invalid input: expected ${bh(e.values[0])}`:`Invalid option: expected one of ${qm(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`:``}: ${qm(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 Fy(){return{localeError:Py()}}var Iy,Ly=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 Ry(){return new Ly}(Iy=globalThis).__zod_globalRegistry??(Iy.__zod_globalRegistry=Ry());var zy=globalThis.__zod_globalRegistry;function By(e){return e.checks&&=[...e.checks],e}function Vy(e,t){return new e(By({type:`string`,...B(t)}))}function Hy(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...B(t)})}function Uy(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...B(t)})}function Wy(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...B(t)})}function Gy(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...B(t)})}function Ky(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...B(t)})}function qy(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...B(t)})}function Jy(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...B(t)})}function Yy(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...B(t)})}function Xy(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...B(t)})}function Zy(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...B(t)})}function Qy(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...B(t)})}function $y(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...B(t)})}function eb(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...B(t)})}function tb(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...B(t)})}function nb(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...B(t)})}function rb(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...B(t)})}function ib(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...B(t)})}function ab(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...B(t)})}function ob(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...B(t)})}function sb(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...B(t)})}function cb(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...B(t)})}function lb(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...B(t)})}function ub(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...B(t)})}function db(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...B(t)})}function fb(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...B(t)})}function pb(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...B(t)})}function mb(e,t){return new e(By({type:`number`,checks:[],...B(t)}))}function hb(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...B(t)})}function gb(e,t){return new e({type:`boolean`,...B(t)})}function _b(e,t){return new e({type:`null`,...B(t)})}function vb(e){return new e({type:`any`})}function yb(e){return new e({type:`unknown`})}function bb(e,t){return new e({type:`never`,...B(t)})}function xb(e,t){return new S_({check:`less_than`,...B(t),value:e,inclusive:!1})}function Sb(e,t){return new S_({check:`less_than`,...B(t),value:e,inclusive:!0})}function Cb(e,t){return new C_({check:`greater_than`,...B(t),value:e,inclusive:!1})}function wb(e,t){return new C_({check:`greater_than`,...B(t),value:e,inclusive:!0})}function Tb(e,t){return new w_({check:`multiple_of`,...B(t),value:e})}function Eb(e,t){return new E_({check:`max_length`,...B(t),maximum:e})}function Db(e,t){return new D_({check:`min_length`,...B(t),minimum:e})}function Ob(e,t){return new O_({check:`length_equals`,...B(t),length:e})}function kb(e,t){return new A_({check:`string_format`,format:`regex`,...B(t),pattern:e})}function Ab(e){return new j_({check:`string_format`,format:`lowercase`,...B(e)})}function jb(e){return new M_({check:`string_format`,format:`uppercase`,...B(e)})}function Mb(e,t){return new N_({check:`string_format`,format:`includes`,...B(t),includes:e})}function Nb(e,t){return new P_({check:`string_format`,format:`starts_with`,...B(t),prefix:e})}function Pb(e,t){return new F_({check:`string_format`,format:`ends_with`,...B(t),suffix:e})}function Fb(e){return new I_({check:`overwrite`,tx:e})}function Ib(e){return Fb(t=>t.normalize(e))}function Lb(){return Fb(e=>e.trim())}function Rb(){return Fb(e=>e.toLowerCase())}function zb(){return Fb(e=>e.toUpperCase())}function Bb(){return Fb(e=>dh(e))}function Vb(e,t,n){return new e({type:`array`,element:t,...B(n)})}function Hb(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...B(n)})}function Ub(e,t){let n=Wb(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(Uh(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(Uh(r))}},e(t.value,t)),t);return n}function Wb(e,t){let n=new y_({check:`custom`,...B(t)});return n._zod.check=e,n}function Gb(e,...t){for(let n of t)for(let t of Reflect.ownKeys(n))Object.prototype.propertyIsEnumerable.call(n,t)&&nh(e,t,n[t]);return e}function Kb(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??zy,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 qb(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 G(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,G(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Gb(o.schema,c),t.io===`input`&&rx(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 Jb(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}function Yb(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}/${Jb(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+Jb(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>
57
+
58
+ 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 Xb(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;Xb(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 Zb=new Set([`type`,`properties`,`required`,`additionalProperties`]),Qb=[`oneOf`,`anyOf`];function $b(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!=`object`||!t?null:Object.keys(t).length?t:null}function ex(e){let t=[];for(let n of e){if(typeof n!=`object`||n.type!==`object`)return null;for(let e in n)if(!Zb.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]??$b(n);t!=null&&(e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t))}nh(n,r,e.length===1?e[0]:ex(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=$b(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 tx(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let t of Zb)if(t in e)return;let n=t.filter(e=>Qb.some(t=>Array.isArray(e[t]))),r=null;if(!n.length)r=ex(t);else{let e=n[0],i=Qb.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=>ex([...a,e]));if(o.some(e=>!e))return;r={[i]:o}}r&&(delete e.allOf,Gb(e,r))}function nx(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)):Gb(i,s),Gb(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())Xb(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)??[])tx(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)}Gb(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,nh(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:ax(t,`input`,e.processors),output:ax(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function rx(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 rx(r.element,n);if(r.type===`set`)return rx(r.valueType,n);if(r.type===`lazy`)return rx(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 rx(r.innerType,n);if(r.type===`intersection`)return rx(r.left,n)||rx(r.right,n);if(r.type===`record`||r.type===`map`)return rx(r.keyType,n)||rx(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:rx(r.in,n)||rx(r.out,n);if(r.type===`object`){for(let e in r.shape)if(rx(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(rx(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(rx(e,n))return!0;return!!(r.rest&&rx(r.rest,n))}return!1}var ix=(e,t={})=>n=>{let r=Kb({...n,processors:t});return G(e,r),Yb(r,e),nx(r,e)},ax=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=Kb({...i??{},target:a,io:t,processors:n});return G(e,o),Yb(o,e),nx(o,e)},ox=(e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},sx=(e,t,n)=>{(e[t]===void 0||n<e[t])&&(e[t]=n)},cx=(e,t)=>{ox(e,`minimum`,t),sx(e,`maximum`,t)},lx=(e,t)=>{e.multipleOf??=[],e.multipleOf.includes(t)||e.multipleOf.push(t)},ux=(e,t)=>{e.patterns??=new Set,e.patterns.add(t)},dx=(e,t)=>{e.mime=e.mime?e.mime.filter(e=>t.includes(e)):[...t]},fx=(e,t)=>{e.format=t,t.includes(`int`)&&(e.isInt=!0)},px=(e,t)=>ox(e,`minimum`,t.minimum),mx=(e,t)=>sx(e,`maximum`,t.maximum),hx=e=>(t,n)=>{fx(t,n.format);let[r,i]=e[n.format];ox(t,`minimum`,r),sx(t,`maximum`,i)},gx={greater_than:(e,t)=>ox(e,t.inclusive?`minimum`:`exclusiveMinimum`,t.value),less_than:(e,t)=>sx(e,t.inclusive?`maximum`:`exclusiveMaximum`,t.value),multiple_of:(e,t)=>lx(e,t.value),number_format:hx(Sh),bigint_format:hx(Ch),min_length:px,max_length:mx,length_equals:(e,t)=>cx(e,t.length),min_size:px,max_size:mx,size_equals:(e,t)=>cx(e,t.size),string_format:(e,t)=>{fx(e,t.format),t.pattern&&ux(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)=>dx(e,t.mime)};function _x(e){let t={},n=e._zod.def,r=e._zod.traits.has(`$ZodCheck`)?[e,...n.checks??[]]:n.checks??[];for(let e of r)gx[e._zod.def.check]?.(t,e._zod.def);let i=e._zod.bag;i.minimum!==void 0&&ox(t,`minimum`,i.minimum),i.exclusiveMinimum!==void 0&&ox(t,`exclusiveMinimum`,i.exclusiveMinimum),i.maximum!==void 0&&sx(t,`maximum`,i.maximum),i.exclusiveMaximum!==void 0&&sx(t,`exclusiveMaximum`,i.exclusiveMaximum),i.multipleOf!==void 0&&lx(t,i.multipleOf),i.format!==void 0&&(t.format??=i.format,i.format.includes(`int`)&&(t.isInt=!0)),i.mime&&dx(t,i.mime);for(let e of i.patterns??[])ux(t,e);return t}var vx={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},yx=new Map([[yv,n_],[xv,r_]]),bx=e=>yx.get(e)??e,xx=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l,laxFormat:u}=_x(e);if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=vx[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(bx);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}))])}},Sx=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,multipleOf:s,exclusiveMaximum:c,exclusiveMinimum:l,isInt:u}=_x(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)):qb(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}))])}},Cx=(e,t,n,r)=>{n.type=`boolean`},wx=(e,t,n,r)=>{qb(e,t,n,r,`BigInt cannot be represented in JSON Schema`)},Tx=(e,t,n,r)=>{qb(e,t,n,r,`Symbols cannot be represented in JSON Schema`)},Ex=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},Dx=(e,t,n,r)=>{qb(e,t,n,r,`Undefined cannot be represented in JSON Schema`)},Ox=(e,t,n,r)=>{qb(e,t,n,r,`Void cannot be represented in JSON Schema`)},kx=(e,t,n,r)=>{n.not={}},Ax=(e,t,n,r)=>{},jx=(e,t,n,r)=>{},Mx=(e,t,n,r)=>{qb(e,t,n,r,`Date cannot be represented in JSON Schema`)},Nx=(e,t,n,r)=>{let i=e._zod.def,a=Km(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},Px=(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(qb(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof o==`bigint`){if(qb(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}},Fx=(e,t,n,r)=>{qb(e,t,n,r,`NaN cannot be represented in JSON Schema`)},Ix=(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},Lx=(e,t,n,r)=>{let i=n;i.type=`string`,i.format=`binary`,i.contentEncoding=`binary`;let{minimum:a,maximum:o,mime:s}=_x(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})))},Rx=(e,t,n,r)=>{n.type=`boolean`},zx=(e,t,n,r)=>{qb(e,t,n,r,`Custom types cannot be represented in JSON Schema`)},Bx=(e,t,n,r)=>{qb(e,t,n,r,`Function types cannot be represented in JSON Schema`)},Vx=(e,t,n,r)=>{qb(e,t,n,r,`Transforms cannot be represented in JSON Schema`)},Hx=(e,t,n,r)=>{qb(e,t,n,r,`Map cannot be represented in JSON Schema`)},Ux=(e,t,n,r)=>{qb(e,t,n,r,`Set cannot be represented in JSON Schema`)},Wx=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=_x(e);typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=G(a.element,t,{...r,path:[...r.path,`items`]})};function Gx(e){let t=e._zod.def;return t.type===`pipe`&&t.in._zod.traits.has(`$ZodTransform`)?Gx(t.out):t.type===`catch`?Gx(t.innerType):e._zod.optin}var Kx=(e,t,n,r)=>{let i=n,a=e._zod.def,o=a.shape;if(Object.getOwnPropertySymbols(o).length&&qb(e,t,i,r,`Symbol keys cannot be represented in JSON Schema`))return;i.type=`object`,i.properties={};for(let e in o)nh(i.properties,e,G(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`?Gx(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=G(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},qx=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>G(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Jx=(e,t,n,r)=>{let i=e._zod.def,a=G(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=G(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)},Yx=(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)=>G(e,t,{...r,path:[...r.path,o,n]})),l=a.rest?G(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`?Gx(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}=_x(e);typeof p==`number`&&(i.minItems=p),typeof m==`number`&&(i.maxItems=m)};function Xx(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=Xx(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=>Xx(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`)?m_:p_).source),p):p}var Zx=new WeakMap;function Qx(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 Zx.get(e)??[]){let i=e.seen.get(r),a=(i?.def??i?.schema)?.propertyNames;if(!a||a===!0||n.has(a))continue;let o=Xx(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 $x=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=_x(o).patterns;if(a.mode===`loose`&&s&&s.size>0){let e=G(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)nh(i.patternProperties,bx(t).source,e)}else{if(t.target===`draft-07`||t.target===`draft-2020-12`){i.propertyNames=G(a.keyType,t,{...r,path:[...r.path,`propertyNames`]});let n=Zx.get(t);n||(n=[],Zx.set(t,n),t.deferred.push(()=>Qx(t))),n.push(e)}i.additionalProperties=G(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]})}let c=o._zod.values,l=t.io===`input`&&Gx(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))}},eS=(e,t,n,r)=>{let i=e._zod.def,a=G(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`}]},tS=(e,t,n,r)=>{let i=e._zod.def;G(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},nS=Symbol();function rS(e,t,n,r,i){let a=!1,o=JSON.stringify(e,(e,t)=>typeof t==`bigint`?(a=!0,null):t);return a?(qb(t,n,r,i,`BigInt defaults cannot be represented in JSON Schema`),nS):JSON.parse(o)}var iS=(e,t,n,r)=>{let i=e._zod.def;G(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o=rS(i.defaultValue,e,t,n,r);o!==nS&&(n.default=o)},aS=(e,t,n,r)=>{let i=e._zod.def;G(i.innerType,t,r);let a=t.seen.get(e);if(a.ref=i.innerType,t.io!==`input`)return;let o=rS(i.defaultValue,e,t,n,r);o!==nS&&(n._prefault=o)},oS=(e,t,n,r)=>{let i=e._zod.def;G(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{qb(e,t,n,r,`Dynamic catch values are not supported in JSON Schema`);return}n.default=o},sS=(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;G(o,t,r);let s=t.seen.get(e);s.ref=o},cS=(e,t,n,r)=>{let i=e._zod.def;G(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},lS=(e,t,n,r)=>{let i=e._zod.def;G(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},uS=(e,t,n,r)=>{let i=e._zod.def;G(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},dS=(e,t,n,r)=>{let i=e._zod.innerType;G(i,t,r);let a=t.seen.get(e);a.ref=i},fS={string:xx,number:Sx,boolean:Cx,bigint:wx,symbol:Tx,null:Ex,undefined:Dx,void:Ox,never:kx,any:Ax,unknown:jx,date:Mx,enum:Nx,literal:Px,nan:Fx,template_literal:Ix,file:Lx,success:Rx,custom:zx,function:Bx,transform:Vx,map:Hx,set:Ux,array:Wx,object:Kx,union:qx,intersection:Jx,tuple:Yx,record:$x,nullable:eS,nonoptional:tS,default:iS,prefault:aS,catch:oS,pipe:sS,readonly:cS,promise:lS,optional:uS,lazy:dS};function pS(e,t){if(`_idmap`in e){let n=e,r=Kb({...t,processors:fS}),i={};for(let e of n._idmap.entries()){let[t,n]=e;G(n,r)}let a={};r.external={registry:n,uri:t?.uri,defs:i};for(let e of n._idmap.entries()){let[t,n]=e;Yb(r,n),nh(a,t,nx(r,n))}return Object.keys(i).length>0&&(a.__shared={[r.target===`draft-2020-12`?`$defs`:`definitions`]:i}),{schemas:a}}let n=Kb({...t,processors:fS});return G(e,n),Yb(n,e),nx(n,e)}var mS=new WeakSet([Object.prototype,Error.prototype]);function hS(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 gS=H(`ZodError`,(e,t)=>{gg.init(e,t),e.name=`ZodError`;let n=Object.getPrototypeOf(e);mS.has(n)||(mS.add(n),hS(n,`format`,e=>t=>yg(e,t)),hS(n,`flatten`,e=>t=>vg(e,t)),hS(n,`addIssue`,e=>t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,Jm,2)}),hS(n,`addIssues`,e=>t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,Jm,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},void 0,{Parent:Error}),_S=xg(gS),vS=Sg(gS),yS=Cg(gS),bS=Tg(gS),xS=jg(gS),SS=Mg(gS),CS=Ng(gS),wS=Pg(gS),TS=Fg(gS),ES=Ig(gS),DS=Lg(gS),OS=Rg(gS);function kS(){cg.localeError||lg(Fy())}function AS(){cg.memoizer||lg({memoizer:My()})}var K=H(`ZodType`,(e,t)=>(kS(),U.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(lh(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 yh(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(nw(e,t))},superRefine(e,t){return this.check(rw(e,t))},overwrite(e){return this.check(Fb(e))},optional(){return IC(this)},exactOptional(){return RC(this)},nullable(){return BC(this)},nullish(){return IC(BC(this))},nonoptional(e){return KC(this,e)},array(){return vC(this)},or(e){return SC([this,e])},and(e){return EC(this,e)},transform(e){return XC(this,PC(e))},default(e){return HC(this,e)},prefault(e){return WC(this,e)},catch(e){return JC(this,e)},pipe(e){return XC(this,e)},readonly(){return QC(this)},describe(e){let t=this.clone();return zy.add(t,{description:e}),t},meta(...e){if(e.length===0)return zy.get(this);let t=this.clone();return zy.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 Kh(this,`~standard`,{...V_(this),jsonSchema:{input:ax(this,`input`),output:ax(this,`output`)}})},set"~standard"(e){Gh(this,`~standard`,e)},parse:function e(t,n){return _S(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await vS(this,t,n,{callee:e})},safeParse(e,t){return yS(this,e,t)},async safeParseAsync(e,t){return bS(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){Gh(this,`spa`,e)},validate(e,t){return Og(this,e,t)},validateAsync(e,t){return Ag(this,e,t)},encode:function e(t,n){return xS(this,t,n,{callee:e})},decode:function e(t,n){return SS(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await CS(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await wS(this,t,n,{callee:e})},safeEncode(e,t){return TS(this,e,t)},safeDecode(e,t){return ES(this,e,t)},async safeEncodeAsync(e,t){return DS(this,e,t)},async safeDecodeAsync(e,t){return OS(this,e,t)},toJSONSchema(e){return ix(this,{})(e)},get description(){return zy.get(this)?.description},get _def(){return this._zod.def}}),jS=H(`_ZodString`,(e,t)=>{H_.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>xx(e,t,n,r)},qh({format:e=>_x(e).format??null,minLength:e=>_x(e).minimum??null,maxLength:e=>_x(e).maximum??null},{regex(...e){return this.check(kb(...e))},includes(...e){return this.check(Mb(...e))},startsWith(...e){return this.check(Nb(...e))},endsWith(...e){return this.check(Pb(...e))},min(...e){return this.check(Db(...e))},max(...e){return this.check(Eb(...e))},length(...e){return this.check(Ob(...e))},nonempty(...e){return this.check(Db(1,...e))},lowercase(e){return this.check(Ab(e))},uppercase(e){return this.check(jb(e))},trim(){return this.check(Lb())},normalize(...e){return this.check(Ib(...e))},toLowerCase(){return this.check(Rb())},toUpperCase(){return this.check(zb())},slugify(){return this.check(Bb())}})),MS=H(`ZodString`,(e,t)=>{H_.init(e,t),jS.init(e,t)},{email(e){return this.check(Hy(RS,e))},url(e){return this.check(Jy(VS,e))},jwt(e){return this.check(lb(nC,e))},emoji(e){return this.check(Yy(HS,e))},guid(e){return this.check(Uy(zS,e))},uuid(e){return this.check(Wy(BS,e))},uuidv4(e){return this.check(Gy(BS,e))},uuidv6(e){return this.check(Ky(BS,e))},uuidv7(e){return this.check(qy(BS,e))},nanoid(e){return this.check(Xy(US,e))},cuid(e){return this.check(Zy(WS,e))},cuid2(e){return this.check(Qy(GS,e))},ulid(e){return this.check($y(KS,e))},base64(e){return this.check(ob($S,e))},base64url(e){return this.check(sb(eC,e))},xid(e){return this.check(eb(qS,e))},ksuid(e){return this.check(tb(JS,e))},ipv4(e){return this.check(nb(YS,e))},ipv6(e){return this.check(rb(XS,e))},cidrv4(e){return this.check(ib(ZS,e))},cidrv6(e){return this.check(ab(QS,e))},e164(e){return this.check(cb(tC,e))},datetime(e){return this.check(ub(PS,e))},date(e){return this.check(db(FS,e))},time(e){return this.check(fb(IS,e))},duration(e){return this.check(pb(LS,e))}});function NS(e){return Vy(MS,e)}var q=H(`ZodStringFormat`,(e,t)=>{W.init(e,t),jS.init(e,t)}),PS=H(`ZodISODateTime`,(e,t)=>{sv.init(e,t),q.init(e,t)}),FS=H(`ZodISODate`,(e,t)=>{cv.init(e,t),q.init(e,t)}),IS=H(`ZodISOTime`,(e,t)=>{lv.init(e,t),q.init(e,t)}),LS=H(`ZodISODuration`,(e,t)=>{uv.init(e,t),q.init(e,t)}),RS=H(`ZodEmail`,(e,t)=>{G_.init(e,t),q.init(e,t)}),zS=H(`ZodGUID`,(e,t)=>{U_.init(e,t),q.init(e,t)}),BS=H(`ZodUUID`,(e,t)=>{W_.init(e,t),q.init(e,t)}),VS=H(`ZodURL`,(e,t)=>{$_.init(e,t),q.init(e,t)}),HS=H(`ZodEmoji`,(e,t)=>{ev.init(e,t),q.init(e,t)}),US=H(`ZodNanoID`,(e,t)=>{tv.init(e,t),q.init(e,t)}),WS=H(`ZodCUID`,(e,t)=>{nv.init(e,t),q.init(e,t)}),GS=H(`ZodCUID2`,(e,t)=>{rv.init(e,t),q.init(e,t)}),KS=H(`ZodULID`,(e,t)=>{iv.init(e,t),q.init(e,t)}),qS=H(`ZodXID`,(e,t)=>{av.init(e,t),q.init(e,t)}),JS=H(`ZodKSUID`,(e,t)=>{ov.init(e,t),q.init(e,t)}),YS=H(`ZodIPv4`,(e,t)=>{dv.init(e,t),q.init(e,t)}),XS=H(`ZodIPv6`,(e,t)=>{mv.init(e,t),q.init(e,t)}),ZS=H(`ZodCIDRv4`,(e,t)=>{hv.init(e,t),q.init(e,t)}),QS=H(`ZodCIDRv6`,(e,t)=>{_v.init(e,t),q.init(e,t)}),$S=H(`ZodBase64`,(e,t)=>{bv.init(e,t),q.init(e,t)}),eC=H(`ZodBase64URL`,(e,t)=>{Cv.init(e,t),q.init(e,t)}),tC=H(`ZodE164`,(e,t)=>{wv.init(e,t),q.init(e,t)}),nC=H(`ZodJWT`,(e,t)=>{Ev.init(e,t),q.init(e,t)}),rC=H(`ZodNumber`,(e,t)=>{Dv.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Sx(e,t,n,r),e.isFinite=!0},qh({minValue:e=>{let{minimum:t,exclusiveMinimum:n}=_x(e);return Math.max(t??-1/0,n??-1/0)},maxValue:e=>{let{maximum:t,exclusiveMaximum:n}=_x(e);return Math.min(t??1/0,n??1/0)},isInt:e=>{let{isInt:t,multipleOf:n}=_x(e);return!!t||!!n?.some(Number.isSafeInteger)},format:e=>_x(e).format??null},{gt(e,t){return this.check(Cb(e,t))},gte(e,t){return this.check(wb(e,t))},min(e,t){return this.check(wb(e,t))},lt(e,t){return this.check(xb(e,t))},lte(e,t){return this.check(Sb(e,t))},max(e,t){return this.check(Sb(e,t))},int(e){return this.check(oC(e))},safe(e){return this.check(oC(e))},positive(e){return this.check(Cb(0,e))},nonnegative(e){return this.check(wb(0,e))},negative(e){return this.check(xb(0,e))},nonpositive(e){return this.check(Sb(0,e))},multipleOf(e,t){return this.check(Tb(e,t))},step(e,t){return this.check(Tb(e,t))},finite(){return this}}));function iC(e){return mb(rC,e)}var aC=H(`ZodNumberFormat`,(e,t)=>{Ov.init(e,t),rC.init(e,t)});function oC(e){return hb(aC,e)}var sC=H(`ZodBoolean`,(e,t)=>{kv.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Cx(e,t,n,r)});function cC(e){return gb(sC,e)}var lC=H(`ZodNull`,(e,t)=>{Av.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ex(e,t,n,r)});function uC(e){return _b(lC,e)}var dC=H(`ZodAny`,(e,t)=>{jv.init(e,t),K.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function fC(){return vb(dC)}var pC=H(`ZodUnknown`,(e,t)=>{Mv.init(e,t),K.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function mC(){return yb(pC)}var hC=H(`ZodNever`,(e,t)=>{Nv.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>kx(e,t,n,r)});function gC(e){return bb(hC,e)}var _C=H(`ZodArray`,(e,t)=>{AS(),Fv.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Wx(e,t,n,r),e.element=t.element},{min(e,t){return this.check(Db(e,t))},nonempty(e){return this.check(Db(1,e))},max(e,t){return this.check(Eb(e,t))},length(e,t){return this.check(Ob(e,t))},unwrap(){return this.element}});function vC(e,t){return Vb(_C,e,t)}var yC=H(`ZodObject`,(e,t)=>{AS(),Vv.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Kx(e,t,n,r),$h(e,`shape`,e=>e._zod.def.shape,!1)},{keyof(){return AC(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(lh(this._zod.def,{catchall:e}))},passthrough(){return this.clone(lh(this._zod.def,{catchall:mC()}))},loose(){return this.clone(lh(this._zod.def,{catchall:mC()}))},strict(){return this.clone(lh(this._zod.def,{catchall:gC()}))},strip(){return this.clone(lh(this._zod.def,{catchall:void 0}))},extend(e){return Dh(this,e)},safeExtend(e){return kh(this,e)},merge(e){return Ah(this,e)},pick(e){return wh(this,e)},omit(e){return Eh(this,e)},partial(...e){return jh(FC,this,e[0])},exactPartial(...e){return jh(LC,this,e[0],`exactPartial`)},required(...e){return Mh(GC,this,e[0])}});function bC(e,t){return new yC({type:`object`,shape:e??{},...B(t)})}var xC=H(`ZodUnion`,(e,t)=>{Uv.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>qx(e,t,n,r),e.options=t.options});function SC(e,t){return new xC({type:`union`,options:e,...B(t)})}var CC=H(`ZodDiscriminatedUnion`,(e,t)=>{xC.init(e,t),Gv.init(e,t)});function wC(e,t,n){return new CC({type:`union`,options:t,discriminator:e,...B(n)})}var TC=H(`ZodIntersection`,(e,t)=>{Kv.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Jx(e,t,n,r)});function EC(e,t){return new TC({type:`intersection`,left:e,right:t})}var DC=H(`ZodRecord`,(e,t)=>{AS(),Yv.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>$x(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function OC(e,t,n){return!t||!t._zod?new DC({type:`record`,keyType:NS(),valueType:e,...B(t)}):new DC({type:`record`,keyType:e,valueType:t,...B(n)})}var kC=H(`ZodEnum`,(e,t)=>{Xv.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Nx(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 kC({...t,checks:[],...B(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 kC({...t,checks:[],...B(r),entries:i})}});function AC(e,t){return new kC({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...B(t)})}var jC=H(`ZodLiteral`,(e,t)=>{Zv.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Px(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 MC(e,t){return new jC({type:`literal`,values:Array.isArray(e)?e:[e],...B(t)})}var NC=H(`ZodTransform`,(e,t)=>{AS(),Qv.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Vx(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new sg(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Uh(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(Uh(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function PC(e){return new NC({type:`transform`,transform:e})}var FC=H(`ZodOptional`,(e,t)=>{ey.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>uS(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function IC(e){return new FC({type:`optional`,innerType:e})}var LC=H(`ZodExactOptional`,(e,t)=>{ty.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>uS(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function RC(e){return new LC({type:`optional`,innerType:e})}var zC=H(`ZodNullable`,(e,t)=>{ny.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>eS(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function BC(e){return new zC({type:`nullable`,innerType:e})}var VC=H(`ZodDefault`,(e,t)=>{ry.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>iS(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function HC(e,t){return new VC({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():gh(t)}})}var UC=H(`ZodPrefault`,(e,t)=>{ay.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>aS(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function WC(e,t){return new UC({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():gh(t)}})}var GC=H(`ZodNonOptional`,(e,t)=>{oy.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>tS(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function KC(e,t){return new GC({type:`nonoptional`,innerType:e,...B(t)})}var qC=H(`ZodCatch`,(e,t)=>{ly.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>oS(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function JC(e,t){return new qC({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:tg(t)})}var YC=H(`ZodPipe`,(e,t)=>{uy.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>sS(e,t,n,r),e.in=t.in,e.out=t.out});function XC(e,t){return new YC({type:`pipe`,in:e,out:t})}var ZC=H(`ZodReadonly`,(e,t)=>{fy.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>cS(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function QC(e){return new ZC({type:`readonly`,innerType:e})}var $C=H(`ZodLazy`,(e,t)=>{my.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>dS(e,t,n,r),e.unwrap=()=>e._zod.def.getter()});function ew(e){return new $C({type:`lazy`,getter:e})}var tw=H(`ZodCustom`,(e,t)=>{hy.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>zx(e,t,n,r)});function nw(e,t={}){return Hb(tw,e,t)}function rw(e,t){return Ub(e,t)}function iw(e){let t=ew(()=>SC([NS(e),iC(),cC(),uC(),vC(t),OC(NS(),t)]));return t}var aw=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}},ow=10,sw=13,cw=32;function lw(e){}function uw(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=lw,onError:n=lw,onRetry:r=lw,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(`
59
+ `)===-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 aw(`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(`
60
+ `,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(`
61
+ `,n);continue}let i=e.charCodeAt(n);if(dw(e,n,i)){let i=e.charCodeAt(n+5)===cw?n+6:n+5,a=e.slice(i,r);if(d===0&&e.charCodeAt(r+1)===ow){t({id:l,event:f,data:a}),l=void 0,u=``,f=void 0,n=r+2,r=e.indexOf(`
62
+ `,n);continue}u=d===0?a:`${u}
63
+ ${a}`,d++}else fw(e,n,i)?f=e.slice(e.charCodeAt(n+6)===cw?n+7:n+6,r)||void 0:_(e,n,r);n=r+1,r=e.indexOf(`
64
+ `,n)}return e.slice(n)}for(;n<e.length;){let t=e.indexOf(`\r`,n),r=e.indexOf(`
65
+ `,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)===sw&&e.charCodeAt(n)===ow&&n++}return e.slice(n)}function _(e,t,n){if(t===n){y();return}let r=e.charCodeAt(t);if(dw(e,t,r)){let r=e.charCodeAt(t+5)===cw?t+6:t+5,i=e.slice(r,n);u=d===0?i:`${u}
66
+ ${i}`,d++;return}if(fw(e,t,r)){f=e.slice(e.charCodeAt(t+6)===cw?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)===cw?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)===cw?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)===cw?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}
67
+ ${t}`,d++;break;case`id`:t.includes(`\0`)||(l=t);break;case`retry`:/^\d+$/.test(t)?r(parseInt(t,10)):n(new aw(`Invalid \`retry\` value: "${t}"`,{type:`invalid-retry`,value:t,line:i}));break;default:n(new aw(`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 dw(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 fw(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 pw=class extends TransformStream{constructor({onError:e,onRetry:t,onComment:n,maxBufferSize:r}={}){let i;super({start(a){i=uw({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)}})}},mw=Symbol.for(`workflow-serialize`),hw=Symbol.for(`workflow-deserialize`);function gw(...e){return e.reduce((e,t)=>({...e,...t}),{})}function _w(e){return Object.fromEntries(Object.entries(e).filter(([e,t])=>t!=null))}async function vw(e,t){if(e==null)return;let n=t?.abortSignal;return new Promise((t,r)=>{if(n?.aborted){r(yw());return}let i=setTimeout(()=>{a(),t()},e),a=()=>{clearTimeout(i),n?.removeEventListener(`abort`,o)},o=()=>{a(),r(yw())};n?.addEventListener(`abort`,o)})}function yw(){return new DOMException(`Delay was aborted`,`AbortError`)}function bw(e){let t=e??globalThis.WebSocket;if(t==null)throw Error(`No WebSocket implementation available.`);return t}var xw=new TextDecoder;async function Sw(e){return typeof e==`string`?e:e instanceof ArrayBuffer||ArrayBuffer.isView(e)?xw.decode(e):typeof Blob<`u`&&e instanceof Blob?e.text():String(e)}var Cw=1;async function ww(e,{highWaterMark:t=1048576,pollIntervalMs:n=20,abortSignal:r}={}){for(;e.readyState===Cw&&(e.bufferedAmount??0)>t;){if(r?.aborted===!0)return;await vw(n)}}function Tw({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(bw(r))(e,t,{headers:_w(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(()=>Sw(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 Ew(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:Dw,atob:Ow}=globalThis;function kw(e){let t=Ow(e.replace(/-/g,`+`).replace(/_/g,`/`));return Uint8Array.from(t,e=>e.codePointAt(0))}function Aw(e){let t=[],n=4096;for(let r=0;r<e.length;r+=n)t.push(String.fromCodePoint(...e.subarray(r,r+n)));return Dw(t.join(``))}function jw(e){return Object.fromEntries([...e.headers])}function Mw(e=globalThis){return e.navigator?.userAgent?e.navigator.userAgent.toLowerCase():e.process?.versions?.node?`node.js/${e.process.version}`:e.EdgeRuntime?`vercel-edge`:``}function Nw(e){return(e instanceof Error||typeof DOMException==`function`&&e instanceof DOMException)&&(e.name===`AbortError`||e.name===`ResponseAborted`||e.name===`TimeoutError`)}var Pw=[`fetch failed`,`failed to fetch`],Fw=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 Iw(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`&&Fw.has(e.code))return e;n=n.cause}}function Lw({error:e,url:t,requestBodyValues:n}){if(Nw(e))return e;if(e instanceof TypeError&&Pw.includes(e.message.toLowerCase())){let r=e.cause;if(r!=null)return new R({message:`Cannot connect to API: ${r.message}`,cause:r,url:t,requestBodyValues:n,isRetryable:!0})}let r=Iw(e);return r==null?e:R.isInstance(e)?new R({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 R({message:`Cannot connect to API: ${e instanceof Error?e.message:r.message}`,cause:e,url:t,requestBodyValues:n,isRetryable:!0})}var Rw=`5.0.53`;function zw(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 Bw(e,...t){let n=new Headers(zw(e)),r=n.get(`user-agent`)||``;return n.set(`user-agent`,[r,...t].filter(Boolean).join(` `)),Object.fromEntries(n.entries())}async function Vw(e){try{await e.body?.cancel()}catch{}}var Hw=`AI_DownloadError`,Uw=`vercel.ai.error.${Hw}`,Ww=Symbol.for(Uw),Gw=class extends Sm{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:Hw,message:i,cause:r}),this[Ww]=!0,this.url=e,this.statusCode=t,this.statusText=n}static isInstance(e){return Sm.hasMarker(e,Uw)}};function Kw(e=globalThis){return e.window!=null}function qw(e,t){try{return new URL(e).origin===new URL(t).origin}catch{return!1}}function Jw(e){let t;try{t=new URL(e)}catch{throw new Gw({url:e,message:`Invalid URL: ${e}`})}if(t.protocol===`data:`)return;if(t.protocol!==`http:`&&t.protocol!==`https:`)throw new Gw({url:e,message:`URL scheme must be http, https, or data, got ${t.protocol}`});let n=t.hostname.toLowerCase().replace(/\.+$/,``);if(!n)throw new Gw({url:e,message:`URL must have a hostname`});if(n===`localhost`||n.endsWith(`.local`)||n.endsWith(`.localhost`))throw new Gw({url:e,message:`URL with hostname ${n} is not allowed`});if(n.startsWith(`[`)&&n.endsWith(`]`)){if($w(n.slice(1,-1)))throw new Gw({url:e,message:`URL with IPv6 address ${n} is not allowed`});return}if(Xw(n)&&Zw(n))throw new Gw({url:e,message:`URL with IP address ${n} is not allowed`})}function Yw({address:e,family:t,hostname:n}){if(t===4?!Xw(e)||Zw(e):t!==6||$w(e))throw new Gw({url:n,message:`Hostname ${n} resolved to disallowed IP address ${e}`})}function Xw(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 Zw(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 Qw(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||!Xw(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 $w(e){let t=Qw(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?Zw(`${t[6]>>8&255}.${t[6]&255}.${t[7]>>8&255}.${t[7]&255}`):!1}function eT(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)Yw({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 tT;function nT(){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 rT(){return nT()?tT??=Promise.resolve().then(iT):globalThis.fetch}function iT(){let e=aT(`node:module`),{lookup:t}=aT(`node:dns`),{Agent:n,fetch:r}=e.createRequire(oT())(`undici`),i=new n({connect:{lookup:eT(t)}});return((e,t)=>r(e,{...t,dispatcher:i}))}function aT(e){let t=globalThis.process?.getBuiltinModule?.(e);if(t==null)throw Error(`Node.js built-in module ${e} is unavailable`);return t}function oT(){let e=Error.prepareStackTrace;try{Error.prepareStackTrace=(e,t)=>t;let e=Error(`Capture current module path`);Error.captureStackTrace(e,oT);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 sT=[`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 cT(e){let t=new Headers(e);for(let e of sT)t.delete(e);return t}var lT=10,uT=new Set([301,302,303,307,308]);async function dT(e){return e==null||e===globalThis.fetch?await rT():e}async function fT({url:e,headers:t,abortSignal:n,maxRedirects:r=lT,fetch:i,trustedOrigin:a}){let o=t===void 0?void 0:cT(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&&qw(c,a);t||Jw(c);let n=t&&i!=null?i:t?globalThis.fetch:await dT(i),r=await n(c,s(`manual`));if(r.type===`opaqueredirect`){if(!Kw())throw new Gw({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(uT.has(r.status)&&l){Vw(r);let e=new URL(l,c).toString();if(o!==void 0&&!qw(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 Gw({url:e,message:`Too many redirects (max ${r})`})}var pT=2147483648;async function mT({response:e,url:t,maxBytes:n=pT}){let r=e.headers.get(`content-length`);if(r!=null){let i=parseInt(r,10);if(!isNaN(i)&&i>n)throw await Vw(e),new Gw({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 Gw({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 Nm({argument:`separator`,message:`The separator "${r}" must not be part of the alphabet "${n}".`});return()=>`${e}${r}${i()}`})();var hT=()=>globalThis.fetch,gT=async({url:e,headers:t={},successfulResponseHandler:n,failedResponseHandler:r,abortSignal:i,fetch:a,validateUrl:o,credentialedOrigin:s,trustedOrigin:c})=>{try{let l=a??hT(),u=Bw(s!==void 0&&!qw(e,s)?{}:t,`ai-sdk-provider-utils/${Rw}`,Mw()),d=o?await fT({url:e,headers:u,abortSignal:i,fetch:a,trustedOrigin:c}):await l(e,{method:`GET`,headers:u,signal:i}),f=jw(d);if(!d.ok){let t;try{t=await r({response:d,url:e,requestBodyValues:{}})}catch(t){throw Nw(t)||R.isInstance(t)?t:new R({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&&(Nw(t)||R.isInstance(t))?t:new R({message:`Failed to process successful response`,cause:t,statusCode:d.status,url:e,responseHeaders:f,requestBodyValues:{}})}}catch(t){throw Lw({error:t,url:e,requestBodyValues:{}})}};function _T(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function vT({settingValue:e,environmentVariableName:t}){if(typeof e==`string`||e==null&&typeof process<`u`&&(e={}[t],e!=null&&typeof e==`string`))return e}function yT({total:e,pending:t,completed:n,failed:r}){if(bT(e)&&bT(t)&&bT(n)&&bT(r)&&t+n+r===e)return{total:e,pending:t,completed:n,failed:r}}function bT(e){return e!=null&&Number.isSafeInteger(e)&&e>=0}var xT=/"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/,ST=/"(?: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 CT(e){let t=JSON.parse(e);return typeof t!=`object`||!t||xT.test(e)===!1&&ST.test(e)===!1?t:wT(t)}function wT(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 TT(e){let{stackTraceLimit:t}=Error;try{Error.stackTraceLimit=0}catch{return CT(e)}try{return CT(e)}finally{Error.stackTraceLimit=t}}function ET(e){if(e.type===`object`||Array.isArray(e.type)&&e.type.includes(`object`)){let{additionalProperties:t}=e;e.additionalProperties=t!=null&&typeof t!=`boolean`&&DT(t);let{properties:n}=e;if(n!=null)for(let e of Object.keys(n))n[e]=DT(n[e])}e.items!=null&&(e.items=Array.isArray(e.items)?e.items.map(DT):DT(e.items)),e.anyOf!=null&&(e.anyOf=e.anyOf.map(DT)),e.allOf!=null&&(e.allOf=e.allOf.map(DT)),e.oneOf!=null&&(e.oneOf=e.oneOf.map(DT));let{definitions:t}=e;if(t!=null)for(let e of Object.keys(t))t[e]=DT(t[e]);return e}function DT(e){return typeof e==`boolean`?e:ET(e)}var OT=Symbol(`Let zodToJsonSchema decide on which parser to use`),kT={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`},AT=e=>typeof e==`string`?{...kT,name:e}:{...kT,...e};function jT(){return{}}function MT(e,t){let n={type:`array`};return e.type?._def&&e.type?._def?.typeName!==`ZodAny`&&(n.items=J(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 NT(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 PT(){return{type:`boolean`}}function FT(e,t){return J(e.type._def,t)}var IT=(e,t)=>J(e.innerType._def,t);function LT(e,t,n){let r=n??t.dateStrategy;if(Array.isArray(r))return{anyOf:r.map(n=>LT(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 RT(e)}}var RT=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 zT(e,t){return{...J(e.innerType._def,t),default:e.defaultValue()}}function BT(e,t){return t.effectStrategy===`input`?J(e.schema._def,t):jT()}function VT(e){return{type:`string`,enum:Array.from(e.values)}}var HT=e=>`type`in e&&e.type===`string`?!1:`allOf`in e;function UT(e,t){let n=[J(e.left._def,{...t,currentPath:[...t.currentPath,`allOf`,`0`]}),J(e.right._def,{...t,currentPath:[...t.currentPath,`allOf`,`1`]})].filter(e=>!!e),r=[];return n.forEach(e=>{if(HT(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 WT(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 GT=void 0,KT={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:()=>(GT===void 0&&(GT=RegExp(`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`,`u`)),GT),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 qT(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`:ZT(n,`email`,r.message,t);break;case`format:idn-email`:ZT(n,`idn-email`,r.message,t);break;case`pattern:zod`:QT(n,KT.email,r.message,t)}break;case`url`:ZT(n,`uri`,r.message,t);break;case`uuid`:ZT(n,`uuid`,r.message,t);break;case`regex`:QT(n,r.regex,r.message,t);break;case`cuid`:QT(n,KT.cuid,r.message,t);break;case`cuid2`:QT(n,KT.cuid2,r.message,t);break;case`startsWith`:QT(n,RegExp(`^${JT(r.value,t)}`),r.message,t);break;case`endsWith`:QT(n,RegExp(`${JT(r.value,t)}$`),r.message,t);break;case`datetime`:ZT(n,`date-time`,r.message,t);break;case`date`:ZT(n,`date`,r.message,t);break;case`time`:ZT(n,`time`,r.message,t);break;case`duration`:ZT(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`:QT(n,RegExp(JT(r.value,t)),r.message,t);break;case`ip`:r.version!==`v6`&&ZT(n,`ipv4`,r.message,t),r.version!==`v4`&&ZT(n,`ipv6`,r.message,t);break;case`base64url`:QT(n,KT.base64url,r.message,t);break;case`jwt`:QT(n,KT.jwt,r.message,t);break;case`cidr`:r.version!==`v6`&&QT(n,KT.ipv4Cidr,r.message,t),r.version!==`v4`&&QT(n,KT.ipv6Cidr,r.message,t);break;case`emoji`:QT(n,KT.emoji(),r.message,t);break;case`ulid`:QT(n,KT.ulid,r.message,t);break;case`base64`:switch(t.base64Strategy){case`format:binary`:ZT(n,`binary`,r.message,t);break;case`contentEncoding:base64`:n.contentEncoding=`base64`;break;case`pattern:zod`:QT(n,KT.base64,r.message,t)}break;case`nanoid`:QT(n,KT.nanoid,r.message,t)}return n}function JT(e,t){return t.patternStrategy===`escape`?XT(e):e}var YT=new Set(`ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789`);function XT(e){let t=``;for(let n=0;n<e.length;n++)YT.has(e[n])||(t+=`\\`),t+=e[n];return t}function ZT(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 QT(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:$T(t,r),...n&&r.errorMessages&&{errorMessage:{pattern:n}}})):e.pattern=$T(t,r)}function $T(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
68
+ ]))`;continue}if(r[e]===`$`){i+=`($|(?=[\r
69
+ ]))`;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 eE(e,t){let n={type:`object`,additionalProperties:J(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}=qT(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}=FT(e.keyType._def,t);return{...n,propertyNames:i}}return n}function tE(e,t){return t.mapStrategy===`record`?eE(e,t):{type:`array`,maxItems:125,items:{type:`array`,items:[J(e.keyType._def,{...t,currentPath:[...t.currentPath,`items`,`items`,`0`]})||jT(),J(e.valueType._def,{...t,currentPath:[...t.currentPath,`items`,`items`,`1`]})||jT()],minItems:2,maxItems:2}}}function nE(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 rE(){return{not:jT()}}function iE(){return{type:`null`}}var aE={ZodString:`string`,ZodNumber:`number`,ZodBigInt:`integer`,ZodBoolean:`boolean`,ZodNull:`null`};function oE(e,t){let n=e.options instanceof Map?Array.from(e.options.values()):e.options;if(n.every(e=>e._def.typeName in aE&&(!e._def.checks||!e._def.checks.length))){let e=n.reduce((e,t)=>{let n=aE[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 sE(e,t)}var sE=(e,t)=>{let n=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((e,n)=>J(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 cE(e,t){if([`ZodString`,`ZodNumber`,`ZodBigInt`,`ZodBoolean`,`ZodNull`].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length))return{type:[aE[e.innerType._def.typeName],`null`]};let n=J(e.innerType._def,{...t,currentPath:[...t.currentPath,`anyOf`,`0`]});return n&&{anyOf:[n,{type:`null`}]}}function lE(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 uE(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=fE(a),s=J(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=dE(e,t);return a!==void 0&&(n.additionalProperties=a),n}function dE(e,t){if(e.catchall._def.typeName!==`ZodNever`)return J(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 fE(e){try{return e.isOptional()}catch{return!0}}var pE=(e,t)=>{if(t.currentPath.toString()===t.propertyPath?.toString())return J(e.innerType._def,t);let n=J(e.innerType._def,{...t,currentPath:[...t.currentPath,`anyOf`,`1`]});return n?{anyOf:[{not:jT()},n]}:jT()},mE=(e,t)=>{if(t.pipeStrategy===`input`)return J(e.in._def,t);if(t.pipeStrategy===`output`)return J(e.out._def,t);let n=J(e.in._def,{...t,currentPath:[...t.currentPath,`allOf`,`0`]});return{allOf:[n,J(e.out._def,{...t,currentPath:[...t.currentPath,`allOf`,n?`1`:`0`]})].filter(e=>e!==void 0)}};function hE(e,t){return J(e.type._def,t)}function gE(e,t){let n={type:`array`,uniqueItems:!0,items:J(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 _E(e,t){return e.rest?{type:`array`,minItems:e.items.length,items:e.items.map((e,n)=>J(e._def,{...t,currentPath:[...t.currentPath,`items`,`${n}`]})).reduce((e,t)=>t===void 0?e:[...e,t],[]),additionalItems:J(e.rest._def,{...t,currentPath:[...t.currentPath,`additionalItems`]})}:{type:`array`,minItems:e.items.length,maxItems:e.items.length,items:e.items.map((e,n)=>J(e._def,{...t,currentPath:[...t.currentPath,`items`,`${n}`]})).reduce((e,t)=>t===void 0?e:[...e,t],[])}}function vE(){return{not:jT()}}function yE(){return jT()}var bE=(e,t)=>J(e.innerType._def,t),xE=(e,t,n)=>{switch(t){case`ZodString`:return qT(e,n);case`ZodNumber`:return lE(e);case`ZodObject`:return uE(e,n);case`ZodBigInt`:return NT(e);case`ZodBoolean`:return PT();case`ZodDate`:return LT(e,n);case`ZodUndefined`:return vE();case`ZodNull`:return iE();case`ZodArray`:return MT(e,n);case`ZodUnion`:case`ZodDiscriminatedUnion`:return oE(e,n);case`ZodIntersection`:return UT(e,n);case`ZodTuple`:return _E(e,n);case`ZodRecord`:return eE(e,n);case`ZodLiteral`:return WT(e);case`ZodEnum`:return VT(e);case`ZodNativeEnum`:return nE(e);case`ZodNullable`:return cE(e,n);case`ZodOptional`:return pE(e,n);case`ZodMap`:return tE(e,n);case`ZodSet`:return gE(e,n);case`ZodLazy`:return()=>e.getter()._def;case`ZodPromise`:return hE(e,n);case`ZodNaN`:case`ZodNever`:return rE();case`ZodEffects`:return BT(e,n);case`ZodAny`:return jT();case`ZodUnknown`:return yE();case`ZodDefault`:return zT(e,n);case`ZodBranded`:return FT(e,n);case`ZodReadonly`:return bE(e,n);case`ZodCatch`:return IT(e,n);case`ZodPipeline`:return mE(e,n);case`ZodFunction`:case`ZodVoid`:case`ZodSymbol`:return;default:return(e=>void 0)(t)}},SE=(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 J(e,t,n=!1){let r=t.seen.get(e);if(t.override){let i=t.override?.(e,t,r,n);if(i!==OT)return i}if(r&&!n){let e=CE(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=xE(e,e.typeName,t),o=typeof a==`function`?J(a(),t):a;if(o&&wE(e,t,o),t.postProcess){let n=t.postProcess(o,e,t);return i.jsonSchema=o,n}return i.jsonSchema=o,o}var CE=(e,t)=>{switch(t.$refStrategy){case`root`:return{$ref:e.path.join(`/`)};case`relative`:return{$ref:SE(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`),jT()):t.$refStrategy===`seen`?jT():void 0}},wE=(e,t,n)=>(e.description&&(n.description=e.description),n),TE=e=>{let t=AT(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}]))}},EE=(e,t)=>{let n=TE(t),r=typeof t==`object`&&t.definitions?Object.entries(t.definitions).reduce((e,[t,r])=>({...e,[t]:J(r._def,{...n,currentPath:[...n.basePath,n.definitionPath,t]},!0)??jT()}),{}):void 0,i=typeof t==`string`?t:t?.nameStrategy===`title`?void 0:t?.name,a=J(e._def,i===void 0?n:{...n,currentPath:[...n.basePath,n.definitionPath,i]},!1)??jT(),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},DE=Symbol.for(`vercel.ai.schema`);function Y(e){let t;return()=>(t??=e(),t)}function OE(e,{validate:t}={}){return{[DE]:!0,_type:void 0,get jsonSchema(){return typeof e==`function`&&(e=e()),e},validate:t}}function kE(e){return typeof e==`object`&&!!e&&DE in e&&e[DE]===!0&&`jsonSchema`in e&&`validate`in e}function AE(e){return e==null?OE({type:`object`,properties:{},additionalProperties:!1}):kE(e)?e:`~standard`in e?e[`~standard`].vendor===`zod`?X(e):jE(e):e()}function jE(e){return OE(()=>{if(!ME(e))throw Error(`Standard schema vendor '${e[`~standard`].vendor}' does not support JSON Schema conversion.`);return ET(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 Vm({value:t,cause:n.issues})}}})}function ME(e){return e[`~standard`].jsonSchema!=null}function NE(e,t){let n=t?.useReferences??!1;return OE(()=>EE(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 PE(e,t){let n=t?.useReferences??!1;return OE(()=>ET(pS(e,{target:`draft-7`,io:`input`,reused:n?`ref`:`inline`})),{validate:async t=>{let n=await bS(e,t);return n.success?{success:!0,value:n.data}:{success:!1,error:n.error}}})}function FE(e){return`_zod`in e}function X(e,t){return FE(e)?PE(e,t):NE(e,t)}async function IE({value:e,schema:t,context:n}){let r=await LE({value:e,schema:t,context:n});if(!r.success)throw Vm.wrap({value:e,cause:r.error,context:n});return r.value}async function LE({value:e,schema:t,context:n}){let r=AE(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:Vm.wrap({value:e,cause:t.error,context:n}),rawValue:e}}catch(t){return{success:!1,error:Vm.wrap({value:e,cause:t,context:n}),rawValue:e}}}async function RE({text:e,schema:t}){try{let n=TT(e);return t==null?n:await IE({value:n,schema:t})}catch(t){throw Lm.isInstance(t)||Vm.isInstance(t)?t:new Lm({text:e,cause:t})}}async function zE({text:e,schema:t}){try{let n=TT(e);return t==null?{success:!0,value:n,rawValue:n}:await LE({value:n,schema:t})}catch(t){return{success:!1,error:Lm.isInstance(t)?t:new Lm({text:e,cause:t}),rawValue:void 0}}}function BE({stream:e,schema:t}){return e.pipeThrough(new TextDecoderStream).pipeThrough(new pw).pipeThrough(new TransformStream({async transform({data:e},n){e!==`[DONE]`&&n.enqueue(await zE({text:e,schema:t}))}}))}async function VE({provider:e,providerOptions:t,schema:n}){if(t?.[e]==null)return;let r=await LE({value:t[e],schema:n});if(!r.success)throw new Nm({argument:`providerOptions`,message:`invalid ${e} provider options`,cause:r.error});return r.value}var HE=()=>globalThis.fetch,UE=async({url:e,headers:t,body:n,failedResponseHandler:r,successfulResponseHandler:i,abortSignal:a,fetch:o})=>await WE({url:e,headers:{"Content-Type":`application/json`,...t},body:{content:JSON.stringify(n),values:n},failedResponseHandler:r,successfulResponseHandler:i,abortSignal:a,fetch:o}),WE=async({url:e,headers:t={},body:n,successfulResponseHandler:r,failedResponseHandler:i,abortSignal:a,fetch:o=HE()})=>{try{let s=await o(e,{method:`POST`,headers:Bw(t,`ai-sdk-provider-utils/${Rw}`,Mw()),body:n.content,signal:a}),c=jw(s);if(!s.ok){let t;try{t=await i({response:s,url:e,requestBodyValues:n.values})}catch(t){throw Nw(t)||R.isInstance(t)?t:new R({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&&(Nw(t)||R.isInstance(t))?t:new R({message:`Failed to process successful response`,cause:t,statusCode:s.status,url:e,responseHeaders:c,requestBodyValues:n.values})}}catch(t){throw Lw({error:t,url:e,requestBodyValues:n.values})}};function GE(e){return e}function KE({id:e,inputSchema:t,outputSchema:n,supportsDeferredResults:r}){return({onInputStart:i,onInputDelta:a,onInputAvailable:o,...s})=>GE({type:`provider`,isProviderExecuted:!0,id:e,args:s,inputSchema:t,outputSchema:n,onInputStart:i,onInputDelta:a,onInputAvailable:o,supportsDeferredResults:r})}async function Z(e){return typeof e==`function`&&(e=e()),e}var qE=new TextDecoder;function JE({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(),Nw(a)){e.error(a);return}e.error(Lw({error:new R({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 YE({response:e,url:t}){return qE.decode(await mT({response:e,url:t}))}var XE=({errorSchema:e,errorToMessage:t,isRetryable:n})=>async({response:r,url:i,requestBodyValues:a})=>{let o=await YE({response:r,url:i}),s=jw(r);if(o.trim()===``)return{responseHeaders:s,value:new R({message:r.statusText,url:i,requestBodyValues:a,statusCode:r.status,responseHeaders:s,responseBody:o,isRetryable:n?.(r)})};try{let c=await RE({text:o,schema:e});return{responseHeaders:s,value:new R({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 R({message:r.statusText,url:i,requestBodyValues:a,statusCode:r.status,responseHeaders:s,responseBody:o,isRetryable:n?.(r)})}}},ZE=e=>async({response:t,url:n,requestBodyValues:r})=>{let i=jw(t);if(t.body==null)throw new km({});return{responseHeaders:i,value:BE({stream:JE({stream:t.body,url:n,requestBodyValues:r,statusCode:t.status,responseHeaders:i}),schema:e})}},QE=e=>async({response:t,url:n,requestBodyValues:r})=>{let i=await YE({response:t,url:n}),a=await zE({text:i,schema:e}),o=jw(t);if(!a.success)throw new R({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}},$E=e=>async({response:t})=>{let n=jw(t);if(t.body==null)throw new km({});return{responseHeaders:n,value:eD({stream:t.body,schema:e})}};async function*eD({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(`
70
+ `);for(;s!==-1;){let e=i.slice(0,s).replace(/\r$/,``);i=i.slice(s+1),e.trim().length>0&&(yield await RE({text:e,schema:t})),s=i.indexOf(`
71
+ `)}}let e=i.replace(/\r$/,``);e.trim().length>0&&(yield await RE({text:e,schema:t}))}finally{a||await n.cancel().catch(()=>{}),n.releaseLock()}}function tD(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(tD):Object.getPrototypeOf(e)===Object.prototype&&Object.values(e).every(tD)}var nD=`AI_SerializationError`,rD=`vercel.ai.error.${nD}`,iD=Symbol.for(rD),aD=class extends Sm{constructor({message:e=`Failed to serialize value.`,cause:t}={}){super({name:nD,message:e,cause:t}),this[iD]=!0}static isInstance(e){return Sm.hasMarker(e,rD)}};function oD(e){let t={};for(let[n,r]of Object.entries(e.config))if(n===`headers`){let e=sD(r);tD(e)&&(t[n]=e)}else tD(r)&&(t[n]=r);return{modelId:e.modelId,config:t}}function sD(e){let t=e;if(typeof e==`function`&&(t=e()),t instanceof Promise)throw new aD({message:`Cannot serialize asynchronous model options.`});return t}var cD=`transcription-stream.start`,lD=`transcription-stream.audio-done`;function uD(e){let t;try{t=TT(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(mD)?n:void 0;case`transcript-delta`:return dD(n.delta)&&pD(n.id,dD)&&pD(n.providerMetadata,_T)?n:void 0;case`transcript-partial`:return dD(n.text)&&pD(n.id,dD)&&pD(n.startSecond,fD)&&pD(n.durationInSeconds,fD)&&pD(n.channelIndex,fD)&&pD(n.providerMetadata,_T)?n:void 0;case`transcript-final`:return dD(n.text)&&pD(n.id,dD)&&pD(n.startSecond,fD)&&pD(n.endSecond,fD)&&pD(n.channelIndex,fD)&&pD(n.providerMetadata,_T)?n:void 0;case`finish`:return dD(n.text)&&Array.isArray(n.segments)&&n.segments.every(hD)&&pD(n.language,dD)&&pD(n.durationInSeconds,fD)&&pD(n.usage,_T)&&pD(n.providerMetadata,_T)?n:void 0;case`response-metadata`:{if(!(pD(n.modelId,dD)&&pD(n.headers,_T)))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 dD(e){return typeof e==`string`}function fD(e){return typeof e==`number`}function pD(e,t){return e===void 0||t(e)}function mD(e){return _T(e)&&dD(e.type)}function hD(e){return _T(e)&&dD(e.text)&&fD(e.startSecond)&&fD(e.endSecond)}function gD(e){return e?.replace(/\/$/,``)}var _D=t(((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})})),vD=t(((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})})),yD=t(((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=_D(),d=vD();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})}))(),bD=`ai-gateway-realtime.v1`,xD=`ai-gateway-transcription.v1`,SD=`ai-gateway-auth.`,CD=`ai-gateway-team.`;function wD(e,t){return ED(bD,e,t)}function TD(e,t){return ED(xD,e,t)}function ED(e,t,n){let r=[e,`${SD}${t}`];return n?.teamIdOrSlug&&r.push(`${CD}${DD(n.teamIdOrSlug)}`),r}function DD(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 Q={any:fC,array:vC,boolean:cC,discriminatedUnion:wC,enum:AC,literal:MC,json:iw,number:iC,object:bC,record:OC,string:NS,union:SC,unknown:mC},OD=Symbol.for(`vercel.ai.gateway.error`),kD=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[OD]=!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&&OD in e&&e[OD]===!0}},AD=`GatewayAuthenticationError`,jD=`vercel.ai.gateway.error.${AD}`,MD=Symbol.for(jD),ND=class e extends kD{constructor({message:e=`Authentication failed`,statusCode:t=401,cause:n,generationId:r}={}){super({message:e,statusCode:t,cause:n,generationId:r}),this[MD]=!0,this.name=AD,this.type=`authentication_error`}static isInstance(e){return kD.hasMarker(e)&&MD 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.
72
+
73
+ Create a new API key: https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai%2Fapi-keys
74
+
75
+ 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.
76
+
77
+ Run 'npx vercel link' to link your project, then 'vc env pull' to fetch the token.
78
+
79
+ Alternatively, use an API key: https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai%2Fapi-keys
80
+ or pass a Vercel access token via the 'apiKey' option.`:`AI Gateway authentication failed: No authentication provided.
81
+
82
+ Option 1 - API key:
83
+ Create an API key: https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai%2Fapi-keys
84
+ Provide via 'apiKey' option or 'AI_GATEWAY_API_KEY' environment variable.
85
+
86
+ Option 2 - Vercel access token:
87
+ Pass a Vercel personal access token or Vercel app access token via the 'apiKey' option.
88
+
89
+ Option 3 - OIDC token:
90
+ 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})}},PD=`GatewayInvalidRequestError`,FD=`vercel.ai.gateway.error.${PD}`,ID=Symbol.for(FD),LD=class extends kD{constructor({message:e=`Invalid request`,statusCode:t=400,cause:n,generationId:r}={}){super({message:e,statusCode:t,cause:n,generationId:r}),this[ID]=!0,this.name=PD,this.type=`invalid_request_error`}static isInstance(e){return kD.hasMarker(e)&&ID in e}},RD=`GatewayRateLimitError`,zD=`vercel.ai.gateway.error.${RD}`,BD=Symbol.for(zD),VD=class extends kD{constructor({message:e=`Rate limit exceeded`,statusCode:t=429,cause:n,generationId:r}={}){super({message:e,statusCode:t,cause:n,generationId:r}),this[BD]=!0,this.name=RD,this.type=`rate_limit_exceeded`}static isInstance(e){return kD.hasMarker(e)&&BD in e}},HD=`GatewayModelNotFoundError`,UD=`vercel.ai.gateway.error.${HD}`,WD=Symbol.for(UD),GD=Y(()=>X(Q.object({modelId:Q.string()}))),KD=class extends kD{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[WD]=!0,this.name=HD,this.type=`model_not_found`,this.modelId=n}static isInstance(e){return kD.hasMarker(e)&&WD in e}},qD=`GatewayNotFoundError`,JD=`vercel.ai.gateway.error.${qD}`,YD=Symbol.for(JD),XD=class extends kD{constructor({message:e=`Resource not found`,statusCode:t=404,cause:n,generationId:r}={}){super({message:e,statusCode:t,cause:n,generationId:r}),this[YD]=!0,this.name=qD,this.type=`not_found`}static isInstance(e){return kD.hasMarker(e)&&YD in e}},ZD=`GatewayInternalServerError`,QD=`vercel.ai.gateway.error.${ZD}`,$D=Symbol.for(QD),eO=class extends kD{constructor({message:e=`Internal server error`,statusCode:t=500,cause:n,generationId:r}={}){super({message:e,statusCode:t,cause:n,generationId:r}),this[$D]=!0,this.name=ZD,this.type=`internal_server_error`}static isInstance(e){return kD.hasMarker(e)&&$D in e}},tO=`GatewayFailedDependencyError`,nO=`vercel.ai.gateway.error.${tO}`,rO=Symbol.for(nO),iO=class extends kD{constructor({message:e=`Failed dependency`,statusCode:t=424,cause:n,generationId:r}={}){super({message:e,statusCode:t,cause:n,generationId:r}),this[rO]=!0,this.name=tO,this.type=`failed_dependency`}static isInstance(e){return kD.hasMarker(e)&&rO in e}},aO=`GatewayForbiddenError`,oO=`vercel.ai.gateway.error.${aO}`,sO=Symbol.for(oO),cO=Y(()=>X(Q.object({ruleId:Q.string()}))),lO=class extends kD{constructor({message:e=`Forbidden`,statusCode:t=403,cause:n,generationId:r,ruleId:i}={}){super({message:e,statusCode:t,cause:n,generationId:r}),this[sO]=!0,this.name=aO,this.type=`forbidden`,this.ruleId=i}static isInstance(e){return kD.hasMarker(e)&&sO in e}},uO=`GatewayResponseError`,dO=`vercel.ai.gateway.error.${uO}`,fO=Symbol.for(dO),pO=class extends kD{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[fO]=!0,this.name=uO,this.type=`response_error`,this.response=n,this.validationError=r}static isInstance(e){return kD.hasMarker(e)&&fO in e}};async function mO({response:e,statusCode:t,defaultMessage:n=`Gateway request failed`,cause:r,authMethod:i,isRetryable:a}){let o=await LE({value:e,schema:hO});if(!o.success){let i=typeof e==`object`&&e&&`generationId`in e?e.generationId:void 0;return new pO({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 ND.createContextualError({apiKeyProvided:i===`api-key`,oidcTokenProvided:i===`oidc`,statusCode:t,cause:r,generationId:u});case`invalid_request_error`:return new LD({message:l,statusCode:t,cause:r,generationId:u});case`rate_limit_exceeded`:return new VD({message:l,statusCode:t,cause:r,generationId:u});case`model_not_found`:{let e=await LE({value:s.error.param,schema:GD});return new KD({message:l,statusCode:t,modelId:e.success?e.value.modelId:void 0,cause:r,generationId:u})}case`not_found`:return new XD({message:l,statusCode:t,cause:r,generationId:u});case`internal_server_error`:return new eO({message:l,statusCode:t,cause:r,generationId:u});case`failed_dependency`:return new iO({message:l,statusCode:t,cause:r,generationId:u});case`forbidden`:{let e=await LE({value:s.error.param,schema:cO});return new lO({message:l,statusCode:t,cause:r,generationId:u,ruleId:e.success?e.value.ruleId:void 0})}default:return new eO({message:l,statusCode:t,cause:r,generationId:u})}}var hO=Y(()=>X(Q.object({error:Q.object({message:Q.string(),type:Q.string().nullish(),param:Q.unknown().nullish(),code:Q.union([Q.string(),Q.number()]).nullish()}),generationId:Q.string().nullish()})));function gO(e){if(e.data!==void 0)return e.data;if(e.responseBody!=null)try{return TT(e.responseBody)}catch{return e.responseBody}return{}}var _O=`GatewayTimeoutError`,vO=`vercel.ai.gateway.error.${_O}`,yO=Symbol.for(vO),bO=class e extends kD{constructor({message:e=`Request timed out`,statusCode:t=408,cause:n,generationId:r}={}){super({message:e,statusCode:t,cause:n,generationId:r}),this[yO]=!0,this.name=_O,this.type=`timeout_error`}static isInstance(e){return kD.hasMarker(e)&&yO in e}static createTimeoutError({originalMessage:t,statusCode:n=408,cause:r,generationId:i}){let a=`Gateway request timed out: ${t}
91
+
92
+ 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 xO(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 $(e,t){return kD.isInstance(e)?e:xO(e)?bO.createTimeoutError({originalMessage:e instanceof Error?e.message:`Unknown error`,cause:e}):R.isInstance(e)?e.cause&&xO(e.cause)?bO.createTimeoutError({originalMessage:e.message,cause:e}):await mO({response:gO(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 mO({response:{},statusCode:500,defaultMessage:e instanceof Error?`Gateway request failed: ${e.message}`:`Unknown Gateway error`,cause:e,authMethod:t})}var SO=`ai-gateway-auth-method`,CO=`x-vercel-ai-gateway-team`;async function wO(e){let t=await LE({value:e[SO],schema:TO});return t.success?t.value:void 0}var TO=Y(()=>X(Q.union([Q.literal(`api-key`),Q.literal(`oidc`)]))),EO=[`embedding`,`evaluation`,`image`,`language`,`realtime`,`reranking`,`speech`,`transcription`,`video`],DO=class{constructor(e){this.config=e}async getAvailableModels(){try{let{value:e}=await gT({url:`${this.config.baseURL}/config`,validateUrl:!1,headers:this.config.headers?await Z(this.config.headers):void 0,successfulResponseHandler:QE(kO),failedResponseHandler:XE({errorSchema:Q.any(),errorToMessage:e=>z(e)??`unknown error`}),fetch:this.config.fetch});return e}catch(e){throw await $(e)}}async getCredits(){try{let e=new URL(this.config.baseURL),t=this.config.headers?await Z(this.config.headers):void 0,n=new URL(`/v1/credits`,e.origin),r=OO(t);r&&n.searchParams.set(r.startsWith(`team_`)?`teamId`:`slug`,r);let{value:i}=await gT({url:n.toString(),validateUrl:!1,headers:t,successfulResponseHandler:QE(AO),failedResponseHandler:XE({errorSchema:Q.any(),errorToMessage:e=>z(e)??`unknown error`}),fetch:this.config.fetch});return i}catch(e){throw await $(e)}}};function OO(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 kO=Y(()=>X(Q.object({models:Q.array(Q.object({id:Q.string(),name:Q.string(),description:Q.string().nullish(),pricing:Q.object({input:Q.string(),output:Q.string(),input_cache_read:Q.string().nullish(),input_cache_write:Q.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:Q.object({specificationVersion:Q.literal(`v4`),provider:Q.string(),modelId:Q.string()}),modelType:Q.string().nullish()})).transform(e=>e.filter(e=>e.modelType==null||EO.includes(e.modelType)))}))),AO=Y(()=>X(Q.object({balance:Q.string(),total_used:Q.string()}).transform(({balance:e,total_used:t})=>({balance:e,totalUsed:t})))),jO=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 gT({url:`${t.origin}/v1/report?${n.toString()}`,validateUrl:!1,headers:this.config.headers?await Z(this.config.headers):void 0,successfulResponseHandler:QE(MO),failedResponseHandler:XE({errorSchema:Q.any(),errorToMessage:e=>z(e)??`unknown error`}),fetch:this.config.fetch});return r}catch(e){throw await $(e)}}},MO=Y(()=>X(Q.object({results:Q.array(Q.object({day:Q.string().optional(),hour:Q.string().optional(),user:Q.string().optional(),model:Q.string().optional(),tag:Q.string().optional(),provider:Q.string().optional(),credential_type:Q.enum([`byok`,`system`]).optional(),total_cost:Q.number(),market_cost:Q.number().optional(),input_tokens:Q.number().optional(),output_tokens:Q.number().optional(),cached_input_tokens:Q.number().optional(),cache_creation_input_tokens:Q.number().optional(),reasoning_tokens:Q.number().optional(),request_count:Q.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}})))}))),NO=class{constructor(e){this.config=e}async getGenerationInfo(e){try{let{value:t}=await gT({url:`${new URL(this.config.baseURL).origin}/v1/generation?id=${encodeURIComponent(e.id)}`,validateUrl:!1,headers:this.config.headers?await Z(this.config.headers):void 0,successfulResponseHandler:QE(PO),failedResponseHandler:XE({errorSchema:Q.any(),errorToMessage:e=>z(e)??`unknown error`}),fetch:this.config.fetch});return t}catch(e){throw await $(e)}}},PO=Y(()=>X(Q.object({data:Q.object({id:Q.string(),total_cost:Q.number(),upstream_inference_cost:Q.number(),usage:Q.number(),created_at:Q.string(),model:Q.string(),is_byok:Q.boolean(),provider_name:Q.string(),streamed:Q.boolean(),finish_reason:Q.string(),latency:Q.number(),generation_time:Q.number(),native_tokens_prompt:Q.number(),native_tokens_completion:Q.number(),native_tokens_reasoning:Q.number(),native_tokens_cached:Q.number(),native_tokens_cache_creation:Q.number(),billable_web_search_calls:Q.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))),FO=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}){zO(e);let a=RO(e),o=this.config.headers?await Z(this.config.headers):void 0,s=BO(t),c=VO(t);try{let{value:t}=await UE({url:this.getBatchUrl(`start`),headers:gw(o,n,{"ai-model-id":a},await Z(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:IO(e.options)})),...c!=null&&{providerOptions:c}},successfulResponseHandler:QE(XO),failedResponseHandler:XE({errorSchema:Q.any(),errorToMessage:e=>z(e)??`unknown error`}),...r&&{abortSignal:r},fetch:this.config.fetch});return{batchId:t.batchId,...UO(t),warnings:t.warnings??[]}}catch(e){throw HO(e)?e:await $(e,await wO(o??{}))}}async doGetBatchStatus({batchId:e,headers:t,abortSignal:n}){let r=this.config.headers?await Z(this.config.headers):void 0;try{let{value:i}=await UE({url:this.getBatchUrl(`status`),headers:gw(r,t,await Z(this.config.o11yHeaders)),body:{batchId:e},successfulResponseHandler:QE(ZO),failedResponseHandler:XE({errorSchema:Q.any(),errorToMessage:e=>z(e)??`unknown error`}),...n&&{abortSignal:n},fetch:this.config.fetch});return UO(i)}catch(e){throw HO(e)?e:await $(e,await wO(r??{}))}}async doGetBatchResults({batchId:e,headers:t,abortSignal:n}){let r=this.config.headers?await Z(this.config.headers):void 0;try{let{value:i}=await UE({url:this.getBatchUrl(`results`),headers:gw(r,t,await Z(this.config.o11yHeaders)),body:{batchId:e},successfulResponseHandler:$E(GO),failedResponseHandler:XE({errorSchema:Q.any(),errorToMessage:e=>z(e)??`unknown error`}),...n&&{abortSignal:n},fetch:this.config.fetch});return Ew(WO(i))}catch(e){throw HO(e)?e:await $(e,await wO(r??{}))}}async doCancelBatch({batchId:e,headers:t,abortSignal:n}){let r=this.config.headers?await Z(this.config.headers):void 0;try{let{value:i}=await UE({url:this.getBatchUrl(`cancel`),headers:gw(r,t,await Z(this.config.o11yHeaders)),body:{batchId:e},successfulResponseHandler:QE(ZO),failedResponseHandler:XE({errorSchema:Q.any(),errorToMessage:e=>z(e)??`unknown error`}),...n&&{abortSignal:n},fetch:this.config.fetch});return{...i.providerMetadata!=null&&{providerMetadata:i.providerMetadata}}}catch(e){throw HO(e)?e:await $(e,await wO(r??{}))}}getBatchUrl(e){return`${this.config.baseURL}/batch/${e}`}};function IO(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=LO(e.data);else if(e.type===`tool-result`&&e.output.type===`content`)for(let t of e.output.value)t.type===`file`&&(t.data=LO(t.data))}return e}function LO(e){if(e.type===`data`){let t=e.data;if(t instanceof Uint8Array)return{...e,data:Buffer.from(t).toString(`base64`)}}return e}function RO(e){let t=e[0]?.modelId;if(t==null)throw new Nm({argument:`requests`,message:`The AI Gateway Batch API requires at least one request.`});for(let n of e)if(n.modelId!==t)throw new Nm({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 zO(e){for(let t of e){let e=t.type;if(e!==`text`)throw new Gm({functionality:`batch request type: ${e}`,message:`The AI Gateway Batch API does not support batch requests with type "${e}".`})}}function BO(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 VO(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 HO(e){return e instanceof Error||e instanceof DOMException?e.name===`AbortError`||e.name===`TimeoutError`:!1}function UO(e){let t=yT({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*WO(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 GO=Q.object({type:Q.literal(`text`),id:Q.string(),status:Q.enum([`cancelled`,`expired`,`failed`,`succeeded`])}).catchall(Q.unknown()),KO=Q.object({message:Q.string(),type:Q.string().nullish(),code:Q.string().nullish(),statusCode:Q.number().nullish()}),qO=Q.object({total:Q.number().nullish(),pending:Q.number().nullish(),completed:Q.number().nullish(),failed:Q.number().nullish()}),JO=Q.record(Q.string(),Q.record(Q.string(),Q.unknown())),YO=Q.object({status:Q.enum([`completed`,`failed`,`pending`]),rawStatus:Q.string().nullish(),requestCounts:qO.nullish(),error:KO.nullish(),createdAt:Q.string().nullish(),expiresAt:Q.string().nullish(),providerMetadata:JO.nullish()}),XO=YO.extend({batchId:Q.string(),warnings:Q.array(Q.object({requestId:Q.string().nullish(),warning:Q.unknown()}).catchall(Q.unknown())).nullish()}),ZO=YO,QO=class e{static[mw](e){return oD({modelId:e.modelId,config:e.config})}static[hw](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 Z(this.config.headers):void 0;try{let{responseHeaders:a,value:o,rawValue:s}=await UE({url:this.getUrl(),headers:gw(i,e.headers,this.getModelConfigHeaders(this.modelId,!1),await Z(this.config.o11yHeaders)),body:t,successfulResponseHandler:QE(Q.any()),failedResponseHandler:XE({errorSchema:Q.any(),errorToMessage:e=>z(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 $(e,await wO(i??{}))}}async doStream(e){let{args:t,warnings:n}=await this.getArgs(e),{abortSignal:r}=e,i=this.config.headers?await Z(this.config.headers):void 0;try{let{value:a,responseHeaders:o}=await UE({url:this.getUrl(),headers:gw(i,e.headers,this.getModelConfigHeaders(this.modelId,!0),await Z(this.config.o11yHeaders)),body:t,successfulResponseHandler:ZE(Q.any()),failedResponseHandler:XE({errorSchema:Q.any(),errorToMessage:e=>z(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 $(e,await wO(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=$O(e.data);else if(e.type===`tool-result`&&e.output.type===`content`)for(let t of e.output.value)t.type===`file`&&(t.data=$O(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 $O(e){if(e.type===`data`){let t=e.data;if(t instanceof Uint8Array)return{...e,data:Buffer.from(t).toString(`base64`)}}return e}var ek=class e{static[mw](e){return oD({modelId:e.modelId,config:e.config})}static[hw](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 Z(this.config.headers):void 0;try{let{responseHeaders:a,value:o,rawValue:s}=await UE({url:this.getUrl(),headers:gw(i,t??{},this.getModelConfigHeaders(),await Z(this.config.o11yHeaders)),body:{values:e,...r?{providerOptions:r}:{}},successfulResponseHandler:QE(nk),failedResponseHandler:XE({errorSchema:Q.any(),errorToMessage:e=>z(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 $(e,await wO(i??{}))}}getUrl(){return`${this.config.baseURL}/embedding-model`}getModelConfigHeaders(){return{"ai-embedding-model-specification-version":`4`,"ai-model-id":this.modelId}}},tk=Q.discriminatedUnion(`type`,[Q.object({type:Q.literal(`unsupported`),feature:Q.string(),details:Q.string().optional()}),Q.object({type:Q.literal(`compatibility`),feature:Q.string(),details:Q.string().optional()}),Q.object({type:Q.literal(`deprecated`),setting:Q.string(),message:Q.string()}),Q.object({type:Q.literal(`other`),message:Q.string()})]),nk=Y(()=>X(Q.object({embeddings:Q.array(Q.array(Q.number())),usage:Q.object({tokens:Q.number()}).nullish(),warnings:Q.array(tk).optional(),providerMetadata:Q.record(Q.string(),Q.record(Q.string(),Q.unknown())).optional()}))),rk=class e{static[mw](e){return oD({modelId:e.modelId,config:e.config})}static[hw](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 Z(this.config.headers):void 0;try{let{responseHeaders:d,value:f}=await UE({url:this.getUrl(),headers:gw(u,c??{},this.getModelConfigHeaders(),await Z(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=>ik(e))},...o&&{mask:ik(o)}},successfulResponseHandler:QE(ck),failedResponseHandler:XE({errorSchema:Q.any(),errorToMessage:e=>z(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 $(e,await wO(u??{}))}}getUrl(){return`${this.config.baseURL}/image-model`}getModelConfigHeaders(){return{"ai-image-model-specification-version":`4`,"ai-model-id":this.modelId}}};function ik(e){return e.type===`file`&&e.data instanceof Uint8Array?{...e,data:Aw(e.data)}:e}var ak=Q.object({images:Q.array(Q.unknown()).optional()}).catchall(Q.unknown()),ok=Q.discriminatedUnion(`type`,[Q.object({type:Q.literal(`unsupported`),feature:Q.string(),details:Q.string().optional()}),Q.object({type:Q.literal(`compatibility`),feature:Q.string(),details:Q.string().optional()}),Q.object({type:Q.literal(`deprecated`),setting:Q.string(),message:Q.string()}),Q.object({type:Q.literal(`other`),message:Q.string()})]),sk=Q.object({inputTokens:Q.number().nullish(),outputTokens:Q.number().nullish(),totalTokens:Q.number().nullish()}),ck=Q.object({images:Q.array(Q.string()),isRetryable:Q.boolean().optional(),warnings:Q.array(ok).optional(),providerMetadata:Q.record(Q.string(),ak).optional(),usage:sk.optional()}),lk=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 Z(this.config.headers):void 0;try{let{responseHeaders:i,value:a}=await UE({url:this.getUrl(),headers:gw(r,t??{},this.getModelConfigHeaders(),await Z(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 R({message:`SSE response body is empty`,url:t,requestBodyValues:n,statusCode:e.status});let r=BE({stream:e.body,schema:mk}).getReader(),{done:i,value:a}=await r.read();if(r.releaseLock(),i||!a)throw new R({message:`SSE stream ended without a data event`,url:t,requestBodyValues:n,statusCode:e.status});if(!a.success)throw new R({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 R({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:XE({errorSchema:Q.any(),errorToMessage:e=>z(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 $(e,await wO(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 Z(this.config.headers):void 0;try{let{responseHeaders:a,value:o}=await UE({url:this.getStartUrl(),headers:gw(i,t??{},this.getModelConfigHeaders(),await Z(this.config.o11yHeaders)),body:{...this.buildRequestBody(e),...r&&{callbackUrl:r}},successfulResponseHandler:QE(hk),failedResponseHandler:XE({errorSchema:Q.any(),errorToMessage:e=>z(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 $(e,await wO(i??{}))}}async doStatus({operation:e,abortSignal:t,headers:n}){let r=this.config.headers?await Z(this.config.headers):void 0;try{let{responseHeaders:i,value:a}=await UE({url:this.getStatusUrl(),headers:gw(r,n??{},this.getModelConfigHeaders(),await Z(this.config.o11yHeaders)),body:{operation:e},successfulResponseHandler:QE(gk),failedResponseHandler:XE({errorSchema:Q.any(),errorToMessage:e=>z(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 $(e,await wO(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:uk(c)},...l&&{frameImages:l.map(e=>({...e,image:uk(e.image)}))},...u&&{inputReferences:u.map(e=>uk(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 uk(e){return e.type===`file`&&e.data instanceof Uint8Array?{...e,data:Aw(e.data)}:e}var dk=Q.object({videos:Q.array(Q.unknown()).optional()}).catchall(Q.unknown()),fk=Q.union([Q.object({type:Q.literal(`url`),url:Q.string(),mediaType:Q.string()}),Q.object({type:Q.literal(`base64`),data:Q.string(),mediaType:Q.string()})]),pk=Q.discriminatedUnion(`type`,[Q.object({type:Q.literal(`unsupported`),feature:Q.string(),details:Q.string().optional()}),Q.object({type:Q.literal(`compatibility`),feature:Q.string(),details:Q.string().optional()}),Q.object({type:Q.literal(`deprecated`),setting:Q.string(),message:Q.string()}),Q.object({type:Q.literal(`other`),message:Q.string()})]),mk=Q.discriminatedUnion(`type`,[Q.object({type:Q.literal(`result`),videos:Q.array(fk),warnings:Q.array(pk).optional(),providerMetadata:Q.record(Q.string(),dk).optional()}),Q.object({type:Q.literal(`error`),message:Q.string(),errorType:Q.string(),statusCode:Q.number(),param:Q.unknown().nullable()})]),hk=Q.object({operation:Q.unknown(),warnings:Q.array(pk).nullish(),providerMetadata:Q.record(Q.string(),dk).nullish()}),gk=Q.discriminatedUnion(`status`,[Q.object({status:Q.literal(`pending`),warnings:Q.array(pk).nullish(),providerMetadata:Q.record(Q.string(),dk).nullish()}),Q.object({status:Q.literal(`completed`),videos:Q.array(fk),warnings:Q.array(pk).nullish(),providerMetadata:Q.record(Q.string(),dk).nullish()}),Q.object({status:Q.literal(`error`),error:Q.string(),providerMetadata:Q.record(Q.string(),dk).nullish()}),Q.object({status:Q.literal(`cancelled`),providerMetadata:Q.record(Q.string(),dk).nullish()})]),_k=Y(()=>X(Q.object({models:Ck.optional()}).catchall(Q.unknown()))),vk=Q.number().finite().min(0).max(1),yk=Q.string().min(1).max(256),bk=Q.union([Q.object({question:yk.optional(),confidenceBelow:vk}).strict(),Q.object({question:yk.optional(),probabilityBetween:Q.array(vk).length(2).refine(([e,t])=>e<=t,{message:`probabilityBetween minimum must be less than or equal to maximum`})}).strict()]),xk=Q.union([Q.object({any:Q.unknown()}),Q.object({all:Q.unknown()}),Q.object({atLeast:Q.unknown()})]).superRefine((e,t)=>{t.addIssue({code:`custom`,message:`conditions can be nested at most 5 levels deep`})}),Sk=Q.object({model:Q.string().min(1),when:wk(1)}).strict(),Ck=Q.array(Q.union([Q.string(),Sk])).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 wk(e){if(e===5)return Q.union([bk,xk]);let t=wk(e+1),n=Q.array(t).min(1).max(20);return Q.union([bk,Q.object({any:n}).strict(),Q.object({all:n}).strict(),Q.object({atLeast:Q.object({count:Q.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 Tk=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 VE({provider:`gateway`,providerOptions:i,schema:_k}),o=a==null?i:{...i,gateway:a},s=this.config.headers?await Z(this.config.headers):void 0;try{let{responseHeaders:i,value:a,rawValue:c}=await UE({url:this.getUrl(),headers:gw(s,n??{},this.getModelConfigHeaders(),await Z(this.config.o11yHeaders)),body:{state:e,questions:t,...o?{providerOptions:o}:{}},successfulResponseHandler:QE(Ok),failedResponseHandler:XE({errorSchema:Q.any(),errorToMessage:e=>z(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 $(e,await wO(s??{}))}}getUrl(){return`${this.config.baseURL}/evaluation-model`}getModelConfigHeaders(){return{"ai-evaluation-model-specification-version":`4`,"ai-model-id":this.modelId}}},Ek=Q.discriminatedUnion(`type`,[Q.object({type:Q.literal(`choice`),choice:Q.string(),probabilities:Q.record(Q.string(),Q.number()).optional()}),Q.object({type:Q.literal(`score`),score:Q.number(),probabilities:Q.record(Q.string(),Q.number()).optional()}),Q.object({type:Q.literal(`boolean`),probability:Q.number()})]),Dk=Q.discriminatedUnion(`type`,[Q.object({type:Q.literal(`unsupported`),feature:Q.string(),details:Q.string().optional()}),Q.object({type:Q.literal(`compatibility`),feature:Q.string(),details:Q.string().optional()}),Q.object({type:Q.literal(`deprecated`),setting:Q.string(),message:Q.string()}),Q.object({type:Q.literal(`other`),message:Q.string()})]),Ok=Y(()=>X(Q.object({answers:Q.record(Q.string(),Ek),model:Q.string().optional(),rounding:Q.object({probabilityDecimals:Q.number().optional(),scoreDecimals:Q.number().optional()}).optional(),usage:Q.object({inputTokens:Q.number().optional(),outputTokens:Q.number().optional()}).optional(),warnings:Q.array(Dk).optional(),providerMetadata:Q.record(Q.string(),Q.record(Q.string(),Q.unknown())).optional()}))),kk=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 Z(this.config.headers):void 0;try{let{responseHeaders:s,value:c,rawValue:l}=await UE({url:this.getUrl(),headers:gw(o,r??{},this.getModelConfigHeaders(),await Z(this.config.o11yHeaders)),body:{documents:e,query:t,...n==null?{}:{topN:n},...a?{providerOptions:a}:{}},successfulResponseHandler:QE(jk),failedResponseHandler:XE({errorSchema:Q.any(),errorToMessage:e=>z(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 $(e,await wO(o??{}))}}getUrl(){return`${this.config.baseURL}/reranking-model`}getModelConfigHeaders(){return{"ai-reranking-model-specification-version":`4`,"ai-model-id":this.modelId}}},Ak=Q.discriminatedUnion(`type`,[Q.object({type:Q.literal(`unsupported`),feature:Q.string(),details:Q.string().optional()}),Q.object({type:Q.literal(`compatibility`),feature:Q.string(),details:Q.string().optional()}),Q.object({type:Q.literal(`deprecated`),setting:Q.string(),message:Q.string()}),Q.object({type:Q.literal(`other`),message:Q.string()})]),jk=Y(()=>X(Q.object({ranking:Q.array(Q.object({index:Q.number(),relevanceScore:Q.number()})),warnings:Q.array(Ak).optional(),providerMetadata:Q.record(Q.string(),Q.record(Q.string(),Q.unknown())).optional()}))),Mk=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 Z(this.config.headers):void 0;try{let{responseHeaders:u,value:d,rawValue:f}=await UE({url:this.getUrl(),headers:gw(l,s??{},this.getModelConfigHeaders(),await Z(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:QE(Fk),failedResponseHandler:XE({errorSchema:Q.any(),errorToMessage:e=>z(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 $(e,await wO(l??{}))}}getUrl(){return`${this.config.baseURL}/speech-model`}getModelConfigHeaders(){return{"ai-speech-model-specification-version":`4`,"ai-model-id":this.modelId}}},Nk=Q.object({}).catchall(Q.unknown()),Pk=Q.discriminatedUnion(`type`,[Q.object({type:Q.literal(`unsupported`),feature:Q.string(),details:Q.string().optional()}),Q.object({type:Q.literal(`compatibility`),feature:Q.string(),details:Q.string().optional()}),Q.object({type:Q.literal(`deprecated`),setting:Q.string(),message:Q.string()}),Q.object({type:Q.literal(`other`),message:Q.string()})]),Fk=Q.object({audio:Q.string(),warnings:Q.array(Pk).optional(),usage:Q.record(Q.string(),Q.json()).optional(),providerMetadata:Q.record(Q.string(),Nk).optional()}),Ik=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 Z(this.config.headers):void 0;try{let{responseHeaders:o,value:s,rawValue:c}=await UE({url:this.getUrl(),headers:gw(a,r??{},this.getModelConfigHeaders(),await Z(this.config.o11yHeaders)),body:{audio:e instanceof Uint8Array?Aw(e):e,mediaType:t,...n&&{providerOptions:n}},successfulResponseHandler:QE(Uk),failedResponseHandler:XE({errorSchema:Q.any(),errorToMessage:e=>z(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 $(e,await wO(a??{}))}}async doStream(e){let t=this.config._internal?.currentDate?.()??new Date,n=gw(await Z(this.config.headers??{}),e.headers??{},this.getModelConfigHeaders(),await Z(this.config.o11yHeaders)),r=await wO(n),i={type:cD,inputAudioFormat:e.inputAudioFormat,...e.providerOptions!=null&&{providerOptions:e.providerOptions},...e.includeRawChunks!=null&&{includeRawChunks:e.includeRawChunks}};return{stream:Bk({webSocket:this.config.webSocket,url:Lk(this.config.baseURL,this.modelId),protocols:Rk(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 Lk(e,t){let n=new URL(`${e.replace(/^http/,`ws`)}/transcription-model`);return n.searchParams.set(`ai-model-id`,t),n.toString()}function Rk(e){let t=zw(e),n=t.authorization,r=n?.startsWith(`Bearer `)?n.slice(7):void 0;return r==null?[xD]:TD(r,{teamIdOrSlug:t[CO]})}var zk=65536;function Bk({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(),Wk(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`?kw(r):r;for(let t=0;t<i.length&&!c;t+=zk)e.send(i.subarray(t,t+zk)),await ww(e)}}finally{t.releaseLock(),d===t&&(d=void 0)}!c&&!m&&e.send(JSON.stringify({type:lD}))};h=Tw({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=uD(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;qk(p,s).then(_);return}_(Error(`AI Gateway transcription stream closed before a finish part was received`))}})},cancel:()=>{c||(c=!0,l())}})}var Vk=Q.object({}).catchall(Q.unknown()),Hk=Q.discriminatedUnion(`type`,[Q.object({type:Q.literal(`unsupported`),feature:Q.string(),details:Q.string().optional()}),Q.object({type:Q.literal(`compatibility`),feature:Q.string(),details:Q.string().optional()}),Q.object({type:Q.literal(`deprecated`),setting:Q.string(),message:Q.string()}),Q.object({type:Q.literal(`other`),message:Q.string()})]),Uk=Q.object({text:Q.string(),segments:Q.array(Q.object({text:Q.string(),startSecond:Q.number(),endSecond:Q.number()})).optional(),language:Q.string().nullish(),durationInSeconds:Q.number().nullish(),warnings:Q.array(Hk).optional(),usage:Q.record(Q.string(),Q.json()).optional(),providerMetadata:Q.record(Q.string(),Vk).optional()});async function Wk(e,t,n){e.error(await $(t,n))}function Gk(e){return typeof e==`object`&&e&&`message`in e&&typeof e.message==`string`?e.message:z(e)}var Kk={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 qk(e,t){return typeof e==`object`&&e&&`message`in e&&typeof e.message==`string`&&`type`in e&&typeof e.type==`string`&&e.type in Kk?mO({response:{error:{message:e.message,type:e.type}},statusCode:Kk[e.type],authMethod:t}):Error(`AI Gateway transcription stream failed: ${Gk(e)}`)}var Jk=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:Yk(this.config.baseURL,this.modelId),...t.expiresAt!=null&&{expiresAt:t.expiresAt}}}getWebSocketConfig(e){return{url:e.url,protocols:wD(e.token,{teamIdOrSlug:this.config.teamIdOrSlug})}}parseServerEvent(e){return e}serializeClientEvent(e){return e}buildSessionConfig(e){return e}};function Yk(e,t){let n=new URL(`${e.replace(/^http/,`ws`)}/realtime-model`);return n.searchParams.set(`ai-model-id`,t),n.toString()}var Xk=Q.record(Q.string(),Q.unknown()),Zk=KE({id:`gateway.browserbase_fetch`,inputSchema:Y(()=>X(Q.object({url:Q.string().url().describe(`URL of the page to fetch.`),allow_redirects:Q.boolean().optional().describe(`Whether to follow HTTP redirects (default: false).`),allow_insecure_ssl:Q.boolean().optional().describe(`Whether to bypass TLS certificate verification (default: false). Only use for trusted hosts.`),proxies:Q.boolean().optional().describe(`Whether to route the request through Browserbase proxies (default: false).`),format:Q.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:Xk.optional().describe(`JSON Schema for structured extraction. Only use with format set to json.`)}))),outputSchema:Y(()=>X(Q.union([Q.object({id:Q.string(),content:Q.union([Q.string(),Xk]),contentType:Q.string(),encoding:Q.string(),headers:Q.record(Q.string(),Q.string()),statusCode:Q.number()}),Q.object({error:Q.enum([`api_error`,`configuration_error`,`execution_error`,`invalid_input`,`rate_limit`,`timeout`,`unknown`]),statusCode:Q.number().optional(),message:Q.string()})])))}),Qk=(e={})=>Zk(e),$k=KE({id:`gateway.browserbase_search`,inputSchema:Y(()=>X(Q.object({query:Q.string().min(1).max(200).describe(`Web search query. Must be between 1 and 200 characters.`),num_results:Q.number().int().min(1).max(25).optional().describe(`Maximum number of results to return (1-25, default: 10).`)}))),outputSchema:Y(()=>X(Q.union([Q.object({query:Q.string(),requestId:Q.string(),results:Q.array(Q.object({id:Q.string(),title:Q.string(),url:Q.string(),author:Q.string().optional(),favicon:Q.string().optional(),image:Q.string().optional(),publishedDate:Q.string().optional()}))}),Q.object({error:Q.enum([`api_error`,`configuration_error`,`execution_error`,`invalid_input`,`rate_limit`,`timeout`,`unknown`]),statusCode:Q.number().optional(),message:Q.string()})])))}),eA=(e={})=>$k(e),tA=KE({id:`gateway.exa_search`,inputSchema:Y(()=>X(Q.object({query:Q.string().describe(`Natural-language web search query. This is required.`),type:Q.enum([`auto`,`fast`,`instant`]).optional().describe(`Search method. Use auto for the default balance of speed and quality.`),num_results:Q.number().optional().describe(`Maximum number of results to return (1-100, default: 10).`),category:Q.enum([`company`,`people`,`research paper`,`news`,`personal site`,`financial report`]).optional().describe(`Optional content category to focus results.`),user_location:Q.string().optional().describe(`Two-letter ISO country code such as 'US'.`),include_domains:Q.array(Q.string()).optional().describe(`Only return results from these domains.`),exclude_domains:Q.array(Q.string()).optional().describe(`Exclude results from these domains.`),start_published_date:Q.string().optional().describe(`Only return links published after this ISO 8601 date.`),end_published_date:Q.string().optional().describe(`Only return links published before this ISO 8601 date.`),contents:Q.object({text:Q.union([Q.boolean(),Q.object({max_characters:Q.number().optional(),include_html_tags:Q.boolean().optional(),verbosity:Q.enum([`compact`,`standard`,`full`]).optional(),include_sections:Q.array(Q.enum([`header`,`navigation`,`banner`,`body`,`sidebar`,`footer`,`metadata`])).optional(),exclude_sections:Q.array(Q.enum([`header`,`navigation`,`banner`,`body`,`sidebar`,`footer`,`metadata`])).optional()})]).optional(),highlights:Q.union([Q.boolean(),Q.object({query:Q.string().optional(),max_characters:Q.number().optional()})]).optional(),max_age_hours:Q.number().optional(),livecrawl_timeout:Q.number().optional(),subpages:Q.number().optional(),subpage_target:Q.union([Q.string(),Q.array(Q.string())]).optional(),extras:Q.object({links:Q.number().optional(),image_links:Q.number().optional()}).optional()}).optional().describe(`Controls extracted page content and freshness.`)}))),outputSchema:Y(()=>X(Q.union([Q.object({requestId:Q.string(),searchType:Q.string().optional(),resolvedSearchType:Q.string().optional(),results:Q.array(Q.object({title:Q.string(),url:Q.string(),id:Q.string(),publishedDate:Q.string().nullable().optional(),author:Q.string().nullable().optional(),image:Q.string().nullable().optional(),favicon:Q.string().nullable().optional(),text:Q.string().optional(),highlights:Q.array(Q.string()).optional(),highlightScores:Q.array(Q.number()).optional(),summary:Q.string().optional(),subpages:Q.array(Q.any()).optional(),extras:Q.object({links:Q.array(Q.string()).optional(),imageLinks:Q.array(Q.string()).optional()}).optional()})),costDollars:Q.object({total:Q.number().optional(),search:Q.record(Q.string(),Q.number()).optional()}).optional()}),Q.object({error:Q.enum([`api_error`,`rate_limit`,`timeout`,`invalid_input`,`configuration_error`,`execution_error`,`unknown`]),statusCode:Q.number().optional(),message:Q.string()})])))}),nA=(e={})=>tA(e),rA=KE({id:`gateway.parallel_search`,inputSchema:Y(()=>X(Q.object({objective:Q.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:Q.array(Q.string()).optional().describe(`Optional search queries to supplement the objective. Maximum 200 characters per query.`),mode:Q.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:Q.number().optional().describe(`Maximum number of results to return (1-20). Defaults to 10 if not specified.`),source_policy:Q.object({include_domains:Q.array(Q.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:Q.array(Q.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:Q.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:Q.object({max_chars_per_result:Q.number().optional().describe(`Maximum characters per result.`),max_chars_total:Q.number().optional().describe(`Maximum total characters across all results.`)}).optional().describe(`Excerpt configuration for controlling result length.`),fetch_policy:Q.object({max_age_seconds:Q.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:Y(()=>X(Q.union([Q.object({searchId:Q.string(),results:Q.array(Q.object({url:Q.string(),title:Q.string(),excerpt:Q.string(),publishDate:Q.string().nullable().optional(),relevanceScore:Q.number().optional()}))}),Q.object({error:Q.enum([`api_error`,`rate_limit`,`timeout`,`invalid_input`,`configuration_error`,`unknown`]),statusCode:Q.number().optional(),message:Q.string()})])))}),iA=(e={})=>rA(e),aA=KE({id:`gateway.perplexity_search`,inputSchema:Y(()=>X(Q.object({query:Q.union([Q.string(),Q.array(Q.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:Q.number().optional().describe(`Maximum number of search results to return (1-20, default: 10)`),max_tokens_per_page:Q.number().optional().describe(`Maximum number of tokens to extract per search result page (256-2048, default: 2048)`),max_tokens:Q.number().optional().describe(`Maximum total tokens across all search results (default: 25000, max: 1000000)`),country:Q.string().optional().describe(`Two-letter ISO 3166-1 alpha-2 country code for regional search results (e.g., 'US', 'GB', 'FR')`),search_domain_filter:Q.array(Q.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:Q.array(Q.string()).optional().describe(`List of ISO 639-1 language codes to filter results (max 10, lowercase). Examples: ['en', 'fr', 'de']`),search_after_date:Q.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:Q.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:Q.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:Q.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:Q.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:Y(()=>X(Q.union([Q.object({results:Q.array(Q.object({title:Q.string(),url:Q.string(),snippet:Q.string(),date:Q.string().optional(),lastUpdated:Q.string().optional()})),id:Q.string()}),Q.object({error:Q.enum([`api_error`,`rate_limit`,`timeout`,`invalid_input`,`unknown`]),statusCode:Q.number().optional(),message:Q.string()})])))}),oA=(e={})=>aA(e),sA=Q.object({count:Q.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:Q.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:Q.enum([`inline`,`url`]).optional().describe(`Requested data delivery mode. Search card data is always inline.`),content_format:Q.enum([`card_json`,`csv`,`json_compact`,`json_records`]).optional().describe(`Serialization for inlined card data.`),max_rows:Q.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:Q.array(Q.string()).optional().describe(`Data Graph node IDs to prioritize. Maximum 20.`),strict:Q.boolean().optional().describe(`Only return cards matching node_ids. Requires a non-empty node_ids.`)}),cA=Q.object({count:Q.number().optional().describe(`Maximum number of web results to return (1-20).`),include_contents:Q.boolean().optional().describe(`Inline extracted web page text. This can add a data charge.`),category:Q.enum([`finance`,`news`,`sports`]).optional().describe(`Optional web-result category filter.`),include_domains:Q.array(Q.string()).optional().describe(`Only return results from these bare domains.`),exclude_domains:Q.array(Q.string()).optional().describe(`Exclude results from these bare domains.`),snippet_max_chars:Q.number().optional().describe(`Maximum characters in each web-result snippet.`),highlights:Q.boolean().optional().describe(`Include highlighted passages in web results. Defaults to true in AI Gateway.`),article_content_max_chars:Q.number().optional().describe(`Maximum extracted characters per web page when including contents.`),published_after:Q.string().optional().describe(`Keep results published on or after this ISO date (YYYY-MM-DD).`),published_before:Q.string().optional().describe(`Keep results published on or before this ISO date (YYYY-MM-DD).`)}),lA=Y(()=>X(Q.object({query:Q.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:Q.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:Q.object({data:sA.optional(),web:cA.optional()}).optional().describe(`Sources to search. Omit to search both curated data and the web. When provided, only keys present are searched.`),location:Q.object({latitude:Q.number().describe(`Latitude between -90 and 90.`),longitude:Q.number().describe(`Longitude between -180 and 180.`)}).optional().describe(`End-user coordinates for localized results.`),country_code:Q.string().optional().describe(`Two-letter ISO 3166-1 country code, such as 'US'.`),locale:Q.string().optional().describe(`BCP-47 locale, such as 'en-US'.`),timezone:Q.string().optional().describe(`IANA timezone, such as 'America/New_York'.`),output_settings:Q.object({image_dark_mode:Q.boolean().optional().describe(`Render card preview images in dark mode.`),force_refresh:Q.boolean().optional().describe(`Instant-effort only. Request a refreshed instant result.`)}).optional().describe(`Controls card rendering in the search response.`),include_related:Q.number().optional().describe(`Maximum related search suggestions to include (1-20).`)}))),uA=Q.union([Q.boolean(),Q.number(),Q.string()]).nullable(),dA=Q.object({content_format:Q.enum([`card_json`,`csv`,`json_compact`,`json_records`]).nullish(),cost:Q.number().optional(),data:Q.string().nullish(),records:Q.array(Q.record(Q.string(),uA)).nullish(),dataset:Q.object({columns:Q.array(Q.object({name:Q.string(),type:Q.enum([`boolean`,`date`,`datetime`,`number`,`string`]),unit:Q.string().nullish()})),rows:Q.array(Q.array(uA)),total_rows:Q.number(),truncated:Q.boolean(),ref:Q.string(),sources:Q.array(Q.object({name:Q.string(),index:Q.enum([`data`,`web`]).optional()})),provenance:Q.enum([`query`,`web_extraction`]).optional()}).nullish(),card_data:Q.object({}).passthrough().nullish(),card_data_schema:Q.object({}).passthrough().nullish(),url:Q.string().nullish(),expires_at:Q.string().nullish(),total_rows:Q.number().nullish(),truncated:Q.boolean().optional(),export_pricing:Q.object({baseline_usd:Q.number(),free_rows:Q.number(),max_rows_ceiling:Q.number(),row_cpm_usd:Q.number()}).nullish(),manifest:Q.array(Q.object({dtype:Q.enum([`boolean`,`date`,`datetime`,`number`,`string`]).nullish(),entity:Q.string().nullish(),metric:Q.string().nullish(),name:Q.string().nullish(),unit:Q.string().nullish()})).nullish()}).passthrough(),fA=Q.object({card_id:Q.string().nullish(),title:Q.string().nullish(),description:Q.string().nullish(),semantic_description:Q.string().nullish(),webpage_url:Q.string().nullish(),image_url:Q.string().nullish(),embed_url:Q.string().nullish(),sources:Q.array(Q.object({source_name:Q.string().nullish(),source_description:Q.string().nullish(),source_index:Q.enum([`data`,`web`]),source_text:Q.string().nullish(),url:Q.string().nullish()})).nullish(),methodologies:Q.array(Q.object({methodology_name:Q.string().nullable(),methodology_description:Q.string().nullable()})).nullish(),source_indexes:Q.array(Q.enum([`data`,`web`])).nullish(),card_type:Q.string().nullish(),relevance:Q.enum([`High`,`Low`,`Medium`]).nullish(),content:dA.nullish(),exportable:Q.boolean().optional(),nodes:Q.array(Q.object({id:Q.string(),type:Q.enum([`entity`,`metric`]),name:Q.string(),description:Q.string().nullish()})).nullish(),metric_definitions:Q.array(Q.object({name:Q.string(),definition:Q.string()})).nullish(),data_freshness:Q.object({coverage_end:Q.string().nullish(),data_as_of:Q.string().nullish(),last_updated:Q.string().nullish()}).nullish()}).passthrough(),pA=Q.object({title:Q.string(),url:Q.string(),snippet:Q.string().nullish(),source_name:Q.string().nullish(),publish_date:Q.string().nullish(),content:dA.nullish()}).passthrough(),mA=KE({id:`gateway.tako_search`,inputSchema:lA,outputSchema:Y(()=>X(Q.union([Q.object({request_id:Q.string(),cards:Q.array(fA).optional(),web_results:Q.array(pA).optional(),usage:Q.object({total_cost_usd:Q.number(),compute:Q.object({cost_usd:Q.number()}).nullish(),data:Q.object({cost_usd:Q.number(),datasets:Q.number()}).nullish()}).nullish(),related:Q.array(Q.object({}).passthrough()).nullish()}).passthrough(),Q.object({error:Q.enum([`api_error`,`configuration_error`,`execution_error`,`invalid_input`,`rate_limit`,`timeout`,`unknown_tool`]),statusCode:Q.number().optional(),message:Q.string()})])))}),hA={browserbaseFetch:Qk,browserbaseSearch:eA,exaSearch:nA,parallelSearch:iA,perplexitySearch:oA,takoSearch:(e={})=>mA(e)};async function gA(){return(0,yD.getContext)().headers?.[`x-vercel-id`]}var _A=`4.0.103`,vA=`0.0.1`,yA=Q.object({token:Q.string(),expiresAt:Q.number().nullish()});function bA(e={}){let t=null,n=null,r=e.metadataCacheRefreshMillis??3e5,i=0,a=gD(e.baseURL)??`https://ai-gateway.vercel.sh/v4/ai`,o=t=>Bw({Authorization:`Bearer ${t.token}`,"ai-gateway-protocol-version":vA,[SO]:t.authMethod,...e.teamIdOrSlug==null?{}:{[CO]:e.teamIdOrSlug},...e.headers},`ai-sdk-gateway/${_A}`),s=async()=>{try{return o(await xA(e))}catch(e){throw ND.createContextualError({apiKeyProvided:!1,oidcTokenProvided:!1,statusCode:401,cause:e})}},c=async()=>{try{return await xA(e)}catch(e){throw ND.createContextualError({apiKeyProvided:!1,oidcTokenProvided:!1,statusCode:401,cause:e})}},l=async t=>{SA();let n=await c(),r=o(n),i=new URL(`/v1/realtime/client-secrets`,a).toString();try{let{value:n}=await UE({url:i,headers:r,body:{model:t.modelId,...t.routeKind!=null&&{routeKind:t.routeKind},...t.expiresAfterSeconds!=null&&{expiresIn:t.expiresAfterSeconds}},successfulResponseHandler:QE(yA),failedResponseHandler:XE({errorSchema:Q.any(),errorToMessage:e=>z(e)??`unknown error`}),fetch:e.fetch});return{token:n.token,...n.expiresAt!=null&&{expiresAt:n.expiresAt}}}catch(e){throw await $(e,await wO(r))}},u=()=>{let e=vT({settingValue:void 0,environmentVariableName:`VERCEL_DEPLOYMENT_ID`}),t=vT({settingValue:void 0,environmentVariableName:`VERCEL_ENV`}),n=vT({settingValue:void 0,environmentVariableName:`VERCEL_REGION`}),r=vT({settingValue:void 0,environmentVariableName:`VERCEL_PROJECT_ID`});return async()=>{let i=await gA();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 QO(t,{provider:`gateway`,baseURL:a,headers:s,fetch:e.fetch,o11yHeaders:u()}),f=()=>new FO({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 DO({baseURL:a,headers:s,fetch:e.fetch}).getAvailableModels().then(e=>(n=e,e)).catch(async e=>{throw await $(e,await wO(await s()))})),n?Promise.resolve(n):t},m=async()=>new DO({baseURL:a,headers:s,fetch:e.fetch}).getCredits().catch(async e=>{throw await $(e,await wO(await s()))}),h=async t=>new jO({baseURL:a,headers:s,fetch:e.fetch}).getSpendReport(t).catch(async e=>{throw await $(e,await wO(await s()))}),g=async t=>new NO({baseURL:a,headers:s,fetch:e.fetch}).getGenerationInfo(t).catch(async e=>{throw await $(e,await wO(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 rk(t,{provider:`gateway`,baseURL:a,headers:s,fetch:e.fetch,o11yHeaders:u()}),_.languageModel=d,_.experimental_batch=f;let v=t=>new ek(t,{provider:`gateway`,baseURL:a,headers:s,fetch:e.fetch,o11yHeaders:u()});_.embeddingModel=v,_.textEmbeddingModel=v,_.videoModel=t=>new lk(t,{provider:`gateway`,baseURL:a,headers:s,fetch:e.fetch,o11yHeaders:u()});let y=t=>new kk(t,{provider:`gateway`,baseURL:a,headers:s,fetch:e.fetch,o11yHeaders:u()});_.rerankingModel=y,_.reranking=y;let b=t=>new Tk(t,{provider:`gateway`,baseURL:a,headers:s,fetch:e.fetch,o11yHeaders:u()});_.evaluationModel=b,_.evaluation=b;let x=t=>new Mk(t,{provider:`gateway`,baseURL:a,headers:s,fetch:e.fetch,o11yHeaders:u()});_.speechModel=x,_.speech=x;let ee=t=>new Ik(t,{provider:`gateway`,baseURL:a,headers:s,fetch:e.fetch,o11yHeaders:u(),webSocket:e.webSocket});_.transcriptionModel=ee,_.transcription=ee,_.experimental_transcription=Object.assign(e=>ee(e),{getToken:async e=>{let t=await l({modelId:e.model,routeKind:`transcription`,...e.expiresAfterSeconds!=null&&{expiresAfterSeconds:e.expiresAfterSeconds}});return{token:t.token,url:Lk(a,e.model),...t.expiresAt!=null&&{expiresAt:t.expiresAt}}}});let te=t=>new Jk(t,{provider:`gateway.realtime`,baseURL:a,teamIdOrSlug:e.teamIdOrSlug,createClientSecret:l});return _.experimental_realtime=Object.assign(e=>te(e),{getToken:async e=>{let{model:t,...n}=e,r=await te(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=hA,_}bA();async function xA(e){let t=vT({settingValue:e.apiKey,environmentVariableName:`AI_GATEWAY_API_KEY`});return t?{token:t,authMethod:`api-key`}:{token:await(0,yD.getVercelOidcToken)(),authMethod:`oidc`}}function SA(){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 CA(e){let{models:t}=await bA({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 wA(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 TA(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 EA(e){switch(e.provider){case`gateway`:return CA(e.gatewayToken);case`anthropic`:return wA(e.anthropicApiKey);case`openai-compatible`:return TA(e.openaiBaseUrl,e.openaiApiKey);case`local-agent`:return Promise.resolve([])}}function DA(e){switch(e.provider){case`gateway`:return e.gatewayToken;case`anthropic`:return e.anthropicApiKey;case`openai-compatible`:return e.openaiApiKey;case`local-agent`:return``}}function OA(e){return(e.provider===`openai-compatible`?`${e.openaiBaseUrl}\n`:``)+DA(e)}var kA=`diffs:llm-models`;function AA(){let e=localStorage.getItem(kA);if(!e)return{};try{return JSON.parse(e)}catch{return{}}}function jA(){let e=w(null),t=w(!1),n=w(),r=nt(),i=0;ke(()=>{i++});let a=()=>{let e=r?.value?.find(e=>e.name===O.value.llm.agent);return e?[{id:``,name:Xe(`settings.models.agentDefault`)},...e.models]:null};return be(()=>[O.value.llm.provider,O.value.llm.agent,OA(O.value.llm),r?.value],async([r])=>{let o=++i;if(e.value=null,n.value=void 0,r===`local-agent`){e.value=a();return}if(!DA(O.value.llm))return;let s=OA(O.value.llm);t.value=!0;try{let t=await ga(s);if(o!==i)return;let n=AA()[r],a=n?.hash===t?n.models:await EA(O.value.llm);if(o!==i)return;if(n?.hash!==t){let e={...AA(),[r]:{hash:t,models:a}};localStorage.setItem(kA,JSON.stringify(e))}e.value=a}catch(e){o===i&&(n.value=e instanceof Error?e.message:String(e))}finally{o===i&&(t.value=!1)}},{immediate:!0}),{models:e,loading:t,error:n}}var MA={key:0,class:`fixed inset-0 z-modal flex items-center justify-center p-4`},NA=[`aria-label`],PA={key:0,class:`flex shrink-0 items-center justify-between gap-2 border-b border-base px-4 py-2`},FA={class:`min-w-0`},IA={key:0,class:`color-base font-medium`},LA={key:1,class:`text-sm op-fade`},RA=[`aria-label`],zA={key:1,class:`flex shrink-0 justify-end gap-2 border-t border-base px-2 py-2`},BA=E({__name:`AppModal`,props:{open:{type:Boolean},title:{},description:{},document:{},padding:{},bodyClass:{}},emits:[`update:open`],setup(e,{emit:t}){let n=e,s=t,c=d(()=>n.document instanceof ShadowRoot?n.document:`body`);function l(){s(`update:open`,!1)}function p(e){e.key===`Escape`&&l()}be(()=>n.open,e=>{e?document.addEventListener(`keydown`,p):document.removeEventListener(`keydown`,p)}),r(()=>document.removeEventListener(`keydown`,p));let m=d(()=>n.padding===`large`?`p-6`:n.padding===`medium`?`p-4`:n.padding===`small`?`p-3`:n.padding===`none`?``:`p-2`);return(t,n)=>(i(),C(f,{to:c.value},[e.open?(i(),h(`div`,MA,[S(`div`,{class:`fixed inset-0 z-modal-backdrop bg-[#ddd]/40 backdrop-blur-sm dark:bg-black/40`,onClick:l}),S(`div`,{role:`dialog`,"aria-modal":`true`,"aria-label":e.title,class:`relative z-modal-content max-h-full max-w-3xl w-full flex flex-col overflow-hidden border border-base rounded-lg bg-base shadow-xl outline-none`},[e.title||e.description||t.$slots.header?(i(),h(`header`,PA,[S(`div`,FA,[e.title?(i(),h(`h2`,IA,o(e.title),1)):u(``,!0),e.description?(i(),h(`p`,LA,o(e.description),1)):u(``,!0),we(t.$slots,`header`)]),S(`button`,{type:`button`,class:`btn-icon h-7 w-7 shrink-0`,"aria-label":t.$t(`common.close`),onClick:l},[...n[0]||=[S(`span`,{class:`i-ph:x`,"aria-hidden":`true`},null,-1)]],8,RA)])):u(``,!0),S(`div`,{class:a([`flex-1 overflow-auto`,[m.value,e.bodyClass]])},[we(t.$slots,`default`)],2),t.$slots.footer?(i(),h(`footer`,zA,[we(t.$slots,`footer`)])):u(``,!0)],8,NA)])):u(``,!0)],8,[`to`]))}}),VA={class:`mb-2 text-sm color-base font-medium`},HA=E({__name:`AutoRefreshSettingsSection`,setup(e){return(e,t)=>(i(),h(`div`,null,[S(`h3`,VA,o(e.$t(`settings.cached`)),1),n(Qt,{modelValue:T(ha),"onUpdate:modelValue":t[0]||=e=>p(ha)?ha.value=e:null,label:e.$t(`settings.autoRefresh`)},null,8,[`modelValue`,`label`])]))}}),UA=ue(`diffs:layout`,`split`),WA={class:`mb-2 text-sm color-base font-medium`},GA={class:`mt-3`},KA=E({__name:`LayoutSettingsSection`,setup(e){let{t}=xe(),r=d(()=>[{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)=>(i(),h(`div`,null,[S(`h3`,WA,o(e.$t(`settings.layout`)),1),n(um,{"model-value":T(UA),options:r.value,"onUpdate:modelValue":t[0]||=e=>UA.value=e},null,8,[`model-value`,`options`]),S(`div`,GA,[n(Qt,{modelValue:T(cm),"onUpdate:modelValue":t[1]||=e=>p(cm)?cm.value=e:null,label:e.$t(`settings.wrapLines`)},null,8,[`modelValue`,`label`])])]))}}),qA={class:`relative`},JA=[`inert`],YA={class:`mb1 flex items-center gap-1 text-sm color-base font-medium`},XA={class:`text-sm color-faint`},ZA={class:`text-sm color-faint`},QA={class:`flex items-center gap-2`},$A={href:`https://console.anthropic.com/settings/keys`,target:`_blank`,rel:`noopener`,class:`hover:underline`},ej=[`href`],tj={class:`h-9 flex items-center gap-2 border border-base rounded bg-raised px-3 text-sm`},nj={class:`color-base`},rj={class:`font-mono op-mute`},ij={key:0,class:`flex-1 truncate text-xs op-mute`},aj={key:1,class:`flex-1`},oj={key:0,class:`absolute inset-0 flex flex-col items-center justify-center gap-1 px-4 text-center`},sj={class:`text-sm color-base font-medium`},cj={href:`https://pulls.review`,target:`_blank`,rel:`noopener`,class:`color-base hover:underline`},lj=E({__name:`LlmSettingsSection`,props:{llmSettings:{},models:{},modelsLoading:{type:Boolean},modelsError:{}},emits:[`update:llmSettings`],setup(e,{emit:t}){let r=e,s=t,c={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`}}},l=[{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`},{value:`local-agent`,label:`Local agent`,icon:`i-ph:terminal-window-duotone`}],f=d(()=>r.llmSettings.provider===`local-agent`?void 0:c[r.llmSettings.provider]),p=d(()=>f.value?r.llmSettings[f.value.tokenKey]:``),g=d(()=>r.llmSettings.provider===`openai-compatible`),_=fe(()=>k(()=>import(`./LocalAgentSettings-C4AeYCZ0.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8]),import.meta.url));function y(e){s(`update:llmSettings`,{...r.llmSettings,...e})}let x=w(!1),ee=w(``),te=w(r.llmSettings.openaiBaseUrl);be(()=>r.llmSettings.provider,()=>{x.value=!1,ee.value=``,te.value=r.llmSettings.openaiBaseUrl});function ne(){if(!f.value)return;let e={[f.value.tokenKey]:ee.value};g.value&&(e.openaiBaseUrl=te.value),y(e),x.value=!1,ee.value=``}function ie(){x.value=!1,ee.value=``,te.value=r.llmSettings.openaiBaseUrl}function ae(){f.value&&y({[f.value.tokenKey]:``}),ie()}let oe=d({get:()=>f.value?r.llmSettings[f.value.modelKey]:``,set:e=>f.value&&y({[f.value.modelKey]:e})});return(t,r)=>{let c=m(`i18n-t`);return i(),h(`div`,qA,[S(`div`,{class:a([`flex flex-col gap-4 transition`,T(!1)?`pointer-events-none opacity-40 blur-[2px] select-none`:``]),inert:T(!1)},[S(`div`,null,[S(`div`,YA,[r[7]||=S(`div`,{class:`i-ph-sparkle-duotone text-lg`},null,-1),b(` `+o(t.$t(`settings.llm.title`)),1)]),S(`p`,XA,o(t.$t(`settings.llm.description`)),1)]),n(Le,{label:t.$t(`settings.llm.provider`)},{default:D(()=>[n(um,{"model-value":e.llmSettings.provider,options:l,"onUpdate:modelValue":r[0]||=e=>y({provider:e})},null,8,[`model-value`])]),_:1},8,[`label`]),f.value?!p.value||x.value?(i(),h(v,{key:1},[g.value?(i(),C(Le,{key:0,label:t.$t(`settings.llm.baseUrl`),description:t.$t(`settings.llm.baseUrlDescription`)},{default:D(()=>[n(ze,{modelValue:te.value,"onUpdate:modelValue":r[2]||=e=>te.value=e,placeholder:`https://api.openai.com/v1`},null,8,[`modelValue`])]),_:1},8,[`label`,`description`])):u(``,!0),n(Le,{label:t.$t(`settings.llm.apiKey`)},{description:D(()=>[e.llmSettings.provider===`gateway`?(i(),C(c,{key:0,keypath:`settings.llm.gatewayHint`,scope:`global`},{link:D(()=>[...r[8]||=[S(`a`,{href:`https://vercel.com/docs/ai-gateway`,target:`_blank`,rel:`noopener`,class:`hover:underline`},`Vercel AI Gateway`,-1)]]),_:1})):e.llmSettings.provider===`anthropic`?(i(),C(c,{key:1,keypath:`settings.llm.anthropicHint`,scope:`global`},{link:D(()=>[S(`a`,$A,o(t.$t(`settings.llm.anthropicLink`)),1)]),_:1})):(i(),h(v,{key:2},[b(o(t.$t(`settings.llm.openaiHint`)),1)],64)),r[9]||=S(`br`,null,null,-1),f.value?(i(),h(`a`,{key:3,href:f.value.createKey.url,target:`_blank`,rel:`noopener`,class:`text-primary hover:underline`},o(t.$t(`settings.llm.createKey`,{provider:f.value.createKey.vendor})),9,ej)):u(``,!0)]),default:D(()=>[S(`div`,QA,[n(ze,{modelValue:ee.value,"onUpdate:modelValue":r[3]||=e=>ee.value=e,type:`password`,icon:`i-ph-key-duotone`,placeholder:f.value?.placeholder,class:`flex-1`,onKeyup:r[4]||=Ae(e=>ee.value&&ne(),[`enter`])},null,8,[`modelValue`,`placeholder`]),n($e,{disabled:!ee.value,onClick:ne},{default:D(()=>[b(o(t.$t(`common.save`)),1)]),_:1},8,[`disabled`]),x.value?(i(),C($e,{key:0,variant:`text`,onClick:ie},{default:D(()=>[b(o(t.$t(`common.cancel`)),1)]),_:1})):u(``,!0),x.value?(i(),C($e,{key:1,variant:`text`,onClick:ae},{default:D(()=>[b(o(t.$t(`common.remove`)),1)]),_:1})):u(``,!0)])]),_:1},8,[`label`])],64)):(i(),h(v,{key:2},[n(Le,{label:t.$t(`settings.llm.apiKey`)},{default:D(()=>[S(`div`,tj,[r[10]||=S(`span`,{class:`i-ph:check-circle-duotone shrink-0 color-active`,"aria-hidden":`true`},null,-1),S(`span`,nj,o(t.$t(`settings.llm.configured`)),1),S(`span`,rj,`••••`+o(p.value.slice(-4)),1),g.value?(i(),h(`span`,ij,o(e.llmSettings.openaiBaseUrl),1)):(i(),h(`span`,aj)),n(tt,{icon:`i-ph:pencil-simple-duotone`,label:t.$t(`settings.llm.changeKey`),tooltip:t.$t(`settings.llm.changeKey`),compact:``,class:`text-sm`,onClick:r[5]||=e=>x.value=!0},null,8,[`label`,`tooltip`])])]),_:1},8,[`label`]),n(Le,{label:t.$t(`settings.llm.model`)},re({default:D(()=>[n(Ue,{modelValue:oe.value,"onUpdate:modelValue":r[6]||=e=>oe.value=e,models:e.models,loading:e.modelsLoading,error:e.modelsError},null,8,[`modelValue`,`models`,`loading`,`error`])]),_:2},[e.modelsError?{name:`error`,fn:D(()=>[b(o(t.$t(`settings.llm.modelListFailed`,{error:e.modelsError})),1)]),key:`0`}:void 0]),1032,[`label`])],64)):(i(),h(v,{key:0},[T(_)?(i(),C(T(_),{key:0,"llm-settings":e.llmSettings,models:e.models,"models-loading":e.modelsLoading,"models-error":e.modelsError,"onUpdate:llmSettings":r[1]||=e=>s(`update:llmSettings`,e)},null,8,[`llm-settings`,`models`,`models-loading`,`models-error`])):(i(),C(Le,{key:1,label:t.$t(`settings.llm.agent`)},{default:D(()=>[S(`p`,ZA,o(t.$t(`settings.llm.agentNeedsCli`)),1)]),_:1},8,[`label`]))],64))],10,JA),T(!1)?(i(),h(`div`,oj,[r[11]||=S(`span`,{class:`i-ph:shield-warning-duotone text-2xl op-fade`,"aria-hidden":`true`},null,-1),S(`p`,sj,o(t.$t(`settings.llm.embedUnavailable`)),1),n(c,{keypath:`settings.llm.embedReason`,tag:`p`,class:`max-w-72 text-xs color-faint`,scope:`global`},{link:D(()=>[S(`a`,cj,o(t.$t(`settings.llm.goToWebsite`)),1)]),_:1})])):u(``,!0)])}}}),uj={class:`mb-2 text-sm color-base font-medium`},dj={class:`grid gap-2 sm:grid-cols-2`},fj={class:`flex items-center gap-1.5 text-xs op-fade`},pj=[`value`,`onChange`],mj=[`label`],hj=[`value`],gj=E({__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(rm(e))}));return(e,t)=>(i(),h(`div`,null,[S(`h3`,uj,o(e.$t(`settings.syntaxTheme.label`)),1),S(`div`,dj,[(i(!0),h(v,null,_(T(r),({scheme:t,icon:n,groups:r})=>(i(),h(`label`,{key:t,class:`flex flex-col gap-1`},[S(`span`,fj,[S(`span`,{class:a(n),"aria-hidden":`true`},null,2),b(` `+o(e.$t(`settings.syntaxTheme.${t}`)),1)]),S(`select`,{value:T(om)[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=>T(sm)(t,e.target.value)},[(i(!0),h(v,null,_(r,e=>(i(),h(`optgroup`,{key:e.label,label:e.label},[(i(!0),h(v,null,_(e.options,e=>(i(),h(`option`,{key:e.value,value:e.value},o(e.label),9,hj))),128))],8,mj))),128))],40,pj)]))),128))])]))}}),_j=[`title`],vj=E({__name:`SettingsPanel`,props:ne({githubTokenSet:{type:Boolean},githubTokenMeta:{},githubTokenBusy:{type:Boolean},githubTokenError:{},llmSettings:{},models:{},modelsLoading:{type:Boolean},modelsError:{}},{tab:{default:`appearance`},tabModifiers:{}}),emits:ne([`saveGithubToken`,`update:llmSettings`],[`update:tab`]),setup(e){let t=e,r=Ee(e,`tab`),{t:s}=xe(),c=d(()=>Je(t.llmSettings)!==void 0||t.llmSettings.provider===`local-agent`&&!!t.llmSettings.agent),l=d(()=>[{value:`appearance`,label:s(`settings.tabs.appearance`),icon:`i-ph:paint-brush-duotone`},{value:`behavior`,label:s(`settings.tabs.behavior`),icon:`i-ph:sliders-duotone`},{value:`github`,label:s(`settings.tabs.github`),icon:`i-ph:github-logo-duotone`,attention:!t.githubTokenSet},{value:`ai`,label:s(`settings.tabs.ai`),icon:`i-ph:sparkle-duotone`,attention:!c.value}]);return(t,s)=>(i(),C(T(zt),{modelValue:r.value,"onUpdate:modelValue":s[2]||=e=>r.value=e,class:`flex flex-col`},{default:D(()=>[n(T(Wt),{class:`relative flex items-center gap-1 border-b border-base px-2 pt2`,"aria-label":t.$t(`common.settings`)},{default:D(()=>[(i(!0),h(v,null,_(l.value,e=>(i(),C(T(Gt),{key:e.value,value:e.value,class:`relative flex items-center gap-1.5 border-b-2 border-transparent px-3 py-2 text-sm color-muted outline-none transition -mb-px data-[state=active]:color-active hover:color-base focus-visible:ring-2 focus-visible:ring-primary-500/40`},{default:D(()=>[S(`span`,{class:a(e.icon),"aria-hidden":`true`},null,2),b(` `+o(e.label)+` `,1),e.attention?(i(),h(`span`,{key:0,class:`h-1.5 w-1.5 rounded-full bg-warning-500`,title:t.$t(`settings.tabs.notSetUp`)},null,8,_j)):u(``,!0)]),_:2},1032,[`value`]))),128)),n(T(Ut),{class:`absolute bottom-0 left-0 h-0.5 w-[--reka-tabs-indicator-size] translate-x-[--reka-tabs-indicator-position] rounded-full bg-primary-500 transition-all duration-200`})]),_:1},8,[`aria-label`]),n(T(Ht),{value:`appearance`,class:`flex flex-col gap-4 p4 outline-none data-[state=inactive]:hidden`},{default:D(()=>[n(KA),s[3]||=S(`div`,{class:`border-t border-base`},null,-1),n(gj)]),_:1}),n(T(Ht),{value:`behavior`,class:`flex flex-col gap-4 p4 outline-none data-[state=inactive]:hidden`},{default:D(()=>[n(HA)]),_:1}),n(T(Ht),{value:`github`,class:`flex flex-col gap-4 p4 outline-none data-[state=inactive]:hidden`},{default:D(()=>[n(Qp,{"token-set":e.githubTokenSet,meta:e.githubTokenMeta,busy:e.githubTokenBusy,error:e.githubTokenError,onSave:s[0]||=e=>t.$emit(`saveGithubToken`,e)},null,8,[`token-set`,`meta`,`busy`,`error`])]),_:1}),n(T(Ht),{value:`ai`,class:`flex flex-col gap-4 p4 outline-none data-[state=inactive]:hidden`},{default:D(()=>[n(lj,{"llm-settings":e.llmSettings,models:e.models,"models-loading":e.modelsLoading,"models-error":e.modelsError,"onUpdate:llmSettings":s[1]||=e=>t.$emit(`update:llmSettings`,e)},null,8,[`llm-settings`,`models`,`models-loading`,`models-error`])]),_:1})]),_:1},8,[`modelValue`]))}}),yj=E({__name:`SettingsModal`,props:{open:{type:Boolean},document:{}},emits:[`update:open`],setup(e,{emit:t}){let r=t,a=ba(),o=jA();return(t,s)=>(i(),C(BA,{title:t.$t(`common.settings`),open:e.open,padding:`none`,"body-class":`min-h-180`,document:e.document,"onUpdate:open":s[3]||=e=>r(`update:open`,e??!1)},{default:D(()=>[n(vj,{tab:T(fm),"onUpdate:tab":s[0]||=e=>p(fm)?fm.value=e:null,"github-token-set":!!T(O).githubToken,"github-token-meta":T(a).meta.value,"github-token-busy":T(a).busy.value,"github-token-error":T(a).error.value,"llm-settings":T(O).llm,models:T(o).models.value,"models-loading":T(o).loading.value,"models-error":T(o).error.value,onSaveGithubToken:s[1]||=e=>T(a).saveToken(e),"onUpdate:llmSettings":s[2]||=e=>O.value={...T(O),llm:e}},null,8,[`tab`,`github-token-set`,`github-token-meta`,`github-token-busy`,`github-token-error`,`llm-settings`,`models`,`models-loading`,`models-error`])]),_:1},8,[`title`,`open`,`document`]))}}),bj={class:`flex shrink-0 items-center gap-1`},xj=E({__name:`NavControls`,props:{document:{}},setup(e){return(t,r)=>(i(),h(v,null,[S(`div`,bj,[we(t.$slots,`default`),n(ym),n(tt,{icon:`i-ph:gear-duotone`,label:t.$t(`common.settings`),tooltip:t.$t(`common.settings`),onClick:r[0]||=e=>T(pm)()},null,8,[`label`,`tooltip`]),T(!1)?u(``,!0):(i(),C(mm,{key:0}))]),T(!1)?u(``,!0):(i(),C(yj,{key:0,open:T(dm),"onUpdate:open":r[1]||=e=>p(dm)?dm.value=e:null,document:e.document},null,8,[`open`,`document`]))],64))}}),Sj=[`title`],Cj=E({__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,o)=>(i(),h(`span`,{class:a([[t[e.state],n[e.state]],`shrink-0 text-lg`]),title:r.$t(`prState.${e.state}`)},null,10,Sj))}}),wj=`pulls.review`;function Tj(e,t=` · `){pe(()=>{let n=x(e)?.trim();return n?`${n}${t}${wj}`:wj})}export{an as $,si as A,gn as B,qi as C,Si as D,Bi as E,wi as F,pn as G,ln as H,ui as I,vn as J,fn as K,Bn as L,oi as M,ci as N,Mi as O,ti as P,sn as Q,yn as R,aa as S,ji as T,mn as U,_n as V,hn as W,en as X,nn as Y,on as Z,ap as _,BA as a,It as at,ha as b,um as c,_t as ct,$p as d,st as dt,rn as et,em as f,fp as g,yp as h,UA as i,Qt as it,ai as j,Ti as k,cm as l,lt,Pp as m,Cj as n,un as nt,EA as o,Ft as ot,Qp as p,$t as q,xj as r,dn as rt,pm as s,St as st,Tj as t,tn as tt,om as u,ot as ut,ya as v,ni as w,pa as x,ba as y,cn as z};