github-stars-organizer 0.1.0 → 1.1.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.
- package/README.md +6 -23
- package/dist/app/THIRD-PARTY-LICENSES.txt +26 -0
- package/dist/app/apple-touch-icon.png +0 -0
- package/dist/app/assets/backups-r4Hq-y_s.js +1 -0
- package/dist/app/assets/{badge-Ba4FNylI.js → badge-DWmLT6OI.js} +1 -1
- package/dist/app/assets/button-C0MQwO-R.js +14 -0
- package/dist/app/assets/coerce-D595RIhb.js +1 -0
- package/dist/app/assets/{explore-CrybvCPL.js → explore-Cizp4zKW.js} +5 -5
- package/dist/app/assets/{history-C-bdlEYN.js → history-OZ9l4TiG.js} +1 -1
- package/dist/app/assets/index--a4C8I0g.css +2 -0
- package/dist/app/assets/index-Cks444Kn.js +10 -0
- package/dist/app/assets/list._listId-C5TBL1sd.js +2 -0
- package/dist/app/assets/list._listId-Cq8rSqKM.js +1 -0
- package/dist/app/assets/local-backups-BGSAd5Gu.js +1 -0
- package/dist/app/assets/{local-sync-DQzF1V9q.js → local-sync-Dd3hEb9I.js} +1 -1
- package/dist/app/assets/registry-DZ4hp3Pl.js +4 -0
- package/dist/app/assets/routes-C8TmhzRl.js +2 -0
- package/dist/app/assets/routes-CXgqVl-F.js +3 -0
- package/dist/app/assets/schemas-B0gCwksU.js +39 -0
- package/dist/app/assets/{star-DgcTDj5Y.js → star-BoN7NVgv.js} +2 -2
- package/dist/app/assets/triangle-alert-Cgw2r-Xm.js +1 -0
- package/dist/app/favicon.svg +6 -1
- package/dist/app/index.html +10 -9
- package/dist/cli.js +7 -3
- package/package.json +1 -1
- package/dist/app/assets/backups-DxRMQO9O.js +0 -1
- package/dist/app/assets/button-ZbiqMfUE.js +0 -14
- package/dist/app/assets/coerce-B4B_TTls.js +0 -1
- package/dist/app/assets/download-CzXogqy0.js +0 -1
- package/dist/app/assets/index-B6vy4QhK.css +0 -2
- package/dist/app/assets/index-C_V67CMR.js +0 -10
- package/dist/app/assets/list._listId-BHMtNFq8.js +0 -1
- package/dist/app/assets/list._listId-tfkSZzxB.js +0 -2
- package/dist/app/assets/registry-BKuxwL5K.js +0 -4
- package/dist/app/assets/routes-C_O77OAA.js +0 -1
- package/dist/app/assets/routes-lhdAnl7w.js +0 -2
- package/dist/app/assets/schemas-D_ddKDHk.js +0 -39
- package/dist/app/icons.svg +0 -24
- /package/dist/app/assets/{esm-hHQKpih6.js → esm-Cyyp48ez.js} +0 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import{A as e,C as t,D as n,E as r,L as i,M as a,N as o,P as s,R as c,_ as l,a as u,c as d,d as f,et as p,g as m,h,it as g,j as _,k as v,l as y,nt as b,p as x,rt as S,s as C,st as w,tt as ee,u as te,v as T,y as ne}from"./button-C0MQwO-R.js";var re=c(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),E=w(g()),ie=0;function ae(e,t=`mui`){let[n,r]=E.useState(e),i=e||n;return E.useEffect(()=>{n??(ie+=1,r(`${t}-${ie}`))},[n,t]),i}var D=m.useId;function O(e,t){if(D!==void 0){let n=D();return e??(t?`${t}-${n}`:n)}return ae(e,t)}function k(e){return O(e,`base-ui`)}function A(e){return e?.ownerDocument||document}var j=typeof navigator<`u`,oe=fe(),se=F(),M=pe(),ce=typeof CSS>`u`||!CSS.supports?!1:CSS.supports(`-webkit-backdrop-filter:none`),N=oe.platform===`MacIntel`&&oe.maxTouchPoints>1?!0:/iP(hone|ad|od)|iOS/.test(oe.platform);j&&/firefox/i.test(M);var le=j&&/apple/i.test(navigator.vendor);j&&/Edg/i.test(M);var P=j&&/android/i.test(se)||/android/i.test(M),ue=j&&se.toLowerCase().startsWith(`mac`)&&!navigator.maxTouchPoints,de=M.includes(`jsdom/`);function fe(){if(!j)return{platform:``,maxTouchPoints:-1};let e=navigator.userAgentData;return e?.platform?{platform:e.platform,maxTouchPoints:navigator.maxTouchPoints}:{platform:navigator.platform??``,maxTouchPoints:navigator.maxTouchPoints??-1}}function pe(){if(!j)return``;let e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(({brand:e,version:t})=>`${e}/${t}`).join(` `):navigator.userAgent}function F(){if(!j)return``;let e=navigator.userAgentData;return e?.platform?e.platform:navigator.platform??``}var I=b(),me=`data-base-ui-focusable`,L=`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`,he=`ArrowLeft`,ge=`ArrowRight`,_e=`ArrowUp`,ve=`ArrowDown`;function ye(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function R(e,t){if(!e||!t)return!1;let n=t.getRootNode?.();if(e.contains(t))return!0;if(n&&s(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function be(e){return`composedPath`in e?e.composedPath()[0]:e.target}function xe(e,t){if(!v(e))return!1;let n=e;if(t.hasElement(n))return!n.hasAttribute(`data-trigger-disabled`);for(let[,e]of t.entries())if(R(e,n))return!e.hasAttribute(`data-trigger-disabled`);return!1}function z(e,t){if(t==null)return!1;if(`composedPath`in e)return e.composedPath().includes(t);let n=e;return n.target!=null&&t.contains(n.target)}function Se(e){return e.matches(`html,body`)}function Ce(t){return e(t)&&t.matches(`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`)}function we(e){return e?.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${L}`)!=null}function Te(e){return e?e.getAttribute(`role`)===`combobox`&&Ce(e):!1}function Ee(e){if(!e||de)return!0;try{return e.matches(`:focus-visible`)}catch{return!0}}function De(e){return e?e.hasAttribute(`data-base-ui-focusable`)?e:e.querySelector(`[data-base-ui-focusable]`)||e:null}function Oe(e,t,n=!0){return e.filter(e=>e.parentId===t).flatMap(t=>[...!n||t.context?.open?[t]:[],...Oe(e,t.id,n)])}function ke(e,t){let n=[],r=e.find(e=>e.id===t)?.parentId;for(;r;){let t=e.find(e=>e.id===r);r=t?.parentId,t&&(n=n.concat(t))}return n}function Ae(e){e.preventDefault(),e.stopPropagation()}function je(e){return`nativeEvent`in e}function Me(e){return e.pointerType===``&&e.isTrusted?!0:P&&e.pointerType?e.type===`click`&&e.buttons===1:e.detail===0&&!e.pointerType}function Ne(e){return de?!1:!P&&e.width===0&&e.height===0||P&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType===`mouse`||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType===`touch`}function Pe(e,t){let n=[`mouse`,`pen`];return t||n.push(``,void 0),n.includes(e)}function Fe(e){let t=e.type;return t===`click`||t===`mousedown`||t===`keydown`||t===`keyup`}var Ie=[`top`,`right`,`bottom`,`left`],Le=Math.min,Re=Math.max,ze=Math.round,Be=Math.floor,Ve=e=>({x:e,y:e}),He={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function Ue(e,t,n){return Re(e,Le(t,n))}function We(e,t){return typeof e==`function`?e(t):e}function Ge(e){return e.split(`-`)[0]}function Ke(e){return e.split(`-`)[1]}function qe(e){return e===`x`?`y`:`x`}function Je(e){return e===`y`?`height`:`width`}function Ye(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function Xe(e){return qe(Ye(e))}function Ze(e,t,n){n===void 0&&(n=!1);let r=Ke(e),i=Xe(e),a=Je(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=ot(o)),[o,ot(o)]}function Qe(e){let t=ot(e);return[$e(e),t,$e(t)]}function $e(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var et=[`left`,`right`],tt=[`right`,`left`],nt=[`top`,`bottom`],rt=[`bottom`,`top`];function it(e,t,n){switch(e){case`top`:case`bottom`:return n?t?tt:et:t?et:tt;case`left`:case`right`:return t?nt:rt;default:return[]}}function at(e,t,n,r){let i=Ke(e),a=it(Ge(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map($e)))),a}function ot(e){let t=Ge(e);return He[t]+e.slice(t.length)}function st(e){return{top:0,right:0,bottom:0,left:0,...e}}function ct(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:st(e)}function lt(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function ut(e,t,n){return Math.floor(e/t)!==n}function dt(e,t){return t<0||t>=e.length}function ft(e,t){return B(e.current,{disabledIndices:t})}function pt(e,t){return B(e.current,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function B(e,{startingIndex:t=-1,decrement:n=!1,disabledIndices:r,amount:i=1}={}){let a=t;do a+=n?-i:i;while(a>=0&&a<=e.length-1&&vt(e,a,r));return a}function mt(e,{event:t,orientation:n,loopFocus:r,onLoop:i,rtl:a,cols:o,disabledIndices:s,minIndex:c,maxIndex:l,prevIndex:u,stopEvent:d=!1}){let f=u,p;if(t.key===`ArrowUp`?p=`up`:t.key===`ArrowDown`&&(p=`down`),p){let n=[],a=[],m=!1,h=0;{let t=null,r=-1;e.forEach((e,i)=>{if(e==null)return;h+=1;let o=e.closest(`[role="row"]`);o&&(m=!0),(o!==t||r===-1)&&(t=o,r+=1,n[r]=[]),n[r].push(i),a[i]=r})}let g=!1,_=0;if(m)for(let e of n){let t=e.length;t>_&&(_=t),t!==o&&(g=!0)}let v=g&&h<e.length,y=_||o,b=o=>{if(!g||u===-1)return;let c=a[u];if(c==null)return;let l=n[c].indexOf(u),d=o===`up`?-1:1;for(let o=c+d,f=0;f<n.length;f+=1,o+=d){if(o<0||o>=n.length){if(!r||v)return;if(o=o<0?n.length-1:0,i){let e=Math.min(l,n[o].length-1);o=a[i(t,u,n[o][e]??n[o][0])]??o}}let c=n[o];for(let t=Math.min(l,c.length-1);t>=0;--t){let n=c[t];if(!vt(e,n,s))return n}}},x=t=>{if(!v||u===-1)return;let n=u%y,i=t===`up`?-y:y,a=l-l%y,o=Be(l/y)+1;for(let t=u-n+i,c=0;c<o;c+=1,t+=i){if(t<0||t>l){if(!r)return;t=t<0?a:0}let i=Math.min(t+y-1,l);for(let r=Math.min(t+n,i);r>=t;--r)if(!vt(e,r,s))return r}};d&&Ae(t);let S=b(p)??x(p);if(S!==void 0)f=S;else if(u===-1)f=p===`up`?l:c;else if(f=B(e,{startingIndex:u,amount:y,decrement:p===`up`,disabledIndices:s}),r){if(p===`up`&&(u-y<c||f<0)){let e=u%y,n=l%y,r=l-(n-e);f=n===e?l:n>e?r:r-y,i&&(f=i(t,u,f))}p===`down`&&u+y>l&&(f=B(e,{startingIndex:u%y-y,amount:y,disabledIndices:s}),i&&(f=i(t,u,f)))}dt(e,f)&&(f=u)}if(n===`both`){let n=Be(u/o);t.key===(a?`ArrowLeft`:`ArrowRight`)&&(d&&Ae(t),u%o===o-1?r&&(f=B(e,{startingIndex:u-u%o-1,disabledIndices:s}),i&&(f=i(t,u,f))):(f=B(e,{startingIndex:u,disabledIndices:s}),r&&ut(f,o,n)&&(f=B(e,{startingIndex:u-u%o-1,disabledIndices:s}),i&&(f=i(t,u,f)))),ut(f,o,n)&&(f=u)),t.key===(a?`ArrowRight`:`ArrowLeft`)&&(d&&Ae(t),u%o===0?r&&(f=B(e,{startingIndex:u+(o-u%o),decrement:!0,disabledIndices:s}),i&&(f=i(t,u,f))):(f=B(e,{startingIndex:u,decrement:!0,disabledIndices:s}),r&&ut(f,o,n)&&(f=B(e,{startingIndex:u+(o-u%o),decrement:!0,disabledIndices:s}),i&&(f=i(t,u,f)))),ut(f,o,n)&&(f=u));let c=Be(l/o)===n;dt(e,f)&&(r&&c?(f=t.key===(a?`ArrowRight`:`ArrowLeft`)?l:B(e,{startingIndex:u-u%o-1,disabledIndices:s}),i&&(f=i(t,u,f))):f=u)}return f}function ht(e,t,n){let r=[],i=0;return e.forEach(({width:e,height:a},o)=>{let s=!1;for(n&&(i=0);!s;){let n=[];for(let r=0;r<e;r+=1)for(let e=0;e<a;e+=1)n.push(i+r+e*t);i%t+e<=t&&n.every(e=>r[e]==null)?(n.forEach(e=>{r[e]=o}),s=!0):i+=1}}),[...r]}function gt(e,t,n,r,i){if(e===-1)return-1;let a=n.indexOf(e),o=t[e];switch(i){case`tl`:return a;case`tr`:return o?a+o.width-1:a;case`bl`:return o?a+(o.height-1)*r:a;case`br`:return n.lastIndexOf(e);default:return-1}}function _t(e,t){return t.flatMap((t,n)=>e.includes(t)?[n]:[])}function vt(e,t,n){if(typeof n==`function`?n(t):n?.includes(t)??!1)return!0;let r=e[t];return r?bt(r)?!n&&(r.hasAttribute(`disabled`)||r.getAttribute(`aria-disabled`)===`true`):!0:!1}function yt(e){return e.visibility===`hidden`||e.visibility===`collapse`}function bt(e,t=e?ne(e):null){return!e||!e.isConnected||!t||yt(t)?!1:typeof e.checkVisibility==`function`?e.checkVisibility():t.display!==`none`&&t.display!==`contents`}var xt=`a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]`;function St(e){let t=e.assignedSlot;if(t)return t;if(e.parentElement)return e.parentElement;let n=e.getRootNode();return s(n)?n.host:null}function Ct(e){for(let n of Array.from(e.children))if(t(n)===`summary`)return n;return null}function wt(e,t){let n=Ct(t);return!!n&&(e===n||R(n,e))}function Tt(e){let n=e?t(e):``;return e!=null&&e.matches(xt)&&(n!==`summary`||e.parentElement!=null&&t(e.parentElement)===`details`&&Ct(e.parentElement)===e)&&(n!==`details`||Ct(e)==null)&&(n!==`input`||e.type!==`hidden`)}function Et(e){if(!Tt(e)||!e.isConnected||e.matches(`:disabled`))return!1;for(let n=e;n;n=St(n)){let r=n!==e,i=t(n)===`slot`;if(n.hasAttribute(`inert`)||r&&t(n)===`details`&&!n.open&&!wt(e,n)||n.hasAttribute(`hidden`)||!i&&!Dt(n,r))return!1}return!0}function Dt(e,t){let n=ne(e);return t?n.display!==`none`:bt(e,n)}function Ot(n){let r=n.tabIndex;if(r<0){let r=t(n);if(r===`details`||r===`audio`||r===`video`||e(n)&&n.isContentEditable)return 0}return r}function kt(e){if(t(e)!==`input`)return null;let n=e;return n.type===`radio`&&n.name!==``?n:null}function At(e,t){let n=kt(e);if(!n)return!0;let r=t.find(e=>{let t=kt(e);return t?.name===n.name&&t.form===n.form&&t.checked});return r?r===n:t.find(e=>{let t=kt(e);return t?.name===n.name&&t.form===n.form})===n}function jt(n){if(e(n)&&t(n)===`slot`){let e=n.assignedElements({flatten:!0});if(e.length>0)return e}return e(n)&&n.shadowRoot?Array.from(n.shadowRoot.children):Array.from(n.children)}function Mt(e,t){jt(e).forEach(e=>{Tt(e)&&t.push(e),Mt(e,t)})}function Nt(t,n,r){jt(t).forEach(t=>{e(t)&&t.matches(n)&&r.push(t),Nt(t,n,r)})}function Pt(e){return Et(e)&&Ot(e)>=0}function Ft(e){let t=[];return Mt(e,t),t.filter(Et)}function It(e){let t=Ft(e);return t.filter(e=>Ot(e)>=0&&At(e,t))}function Lt(e,t){let n=It(e),r=n.length;if(r===0)return;let i=ye(A(e)),a=n.indexOf(i);return n[a===-1?t===1?0:r-1:a+t]}function Rt(e){return Lt(A(e).body,1)||e}function zt(e){return Lt(A(e).body,-1)||e}function Bt(e,t){if(!e)return null;let n=It(A(e).body),r=n.length;if(r===0)return null;let i=n.indexOf(e);return i===-1?null:n[(i+t+r)%r]}function Vt(e){return Bt(e,1)}function Ht(e){return Bt(e,-1)}function Ut(e,t){let n=t||e.currentTarget,r=e.relatedTarget;return!r||!R(n,r)}function Wt(e){It(e).forEach(e=>{e.dataset.tabindex=e.getAttribute(`tabindex`)||``,e.setAttribute(`tabindex`,`-1`)})}function Gt(e){let t=[];Nt(e,`[data-tabindex]`,t),t.forEach(e=>{let t=e.dataset.tabindex;delete e.dataset.tabindex,t?e.setAttribute(`tabindex`,t):e.removeAttribute(`tabindex`)})}var Kt=[];function qt(e){E.useEffect(e,Kt)}var Jt=0,Yt=class e{static create(){return new e}currentId=Jt;start(e,t){this.clear(),this.currentId=setTimeout(()=>{this.currentId=Jt,t()},e)}isStarted(){return this.currentId!==Jt}clear=()=>{this.currentId!==Jt&&(clearTimeout(this.currentId),this.currentId=Jt)};disposeEffect=()=>this.clear};function Xt(){let e=T(Yt.create).current;return qt(e.disposeEffect),e}var Zt=null;globalThis.requestAnimationFrame;var Qt=new class{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=e=>{this.isScheduled=!1;let t=this.callbacks,n=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,n>0)for(let n=0;n<t.length;n+=1)t[n]?.(e)};request(e){let t=this.nextId;return this.nextId+=1,this.callbacks.push(e),this.callbacksCount+=1,this.isScheduled||=(requestAnimationFrame(this.tick),!0),t}cancel(e){let t=e-this.startId;t<0||t>=this.callbacks.length||(this.callbacks[t]=null,--this.callbacksCount)}},$t=class e{static create(){return new e}static request(e){return Qt.request(e)}static cancel(e){return Qt.cancel(e)}currentId=Zt;request(e){this.cancel(),this.currentId=Qt.request(()=>{this.currentId=Zt,e()})}cancel=()=>{this.currentId!==Zt&&(Qt.cancel(this.currentId),this.currentId=Zt)};disposeEffect=()=>this.cancel};function en(){let e=T($t.create).current;return qt(e.disposeEffect),e}var tn=w(S());function nn(e){return e==null?e:`current`in e?e.current:e}var rn=function(e){return e.startingStyle=`data-starting-style`,e.endingStyle=`data-ending-style`,e}({}),an={[rn.startingStyle]:``},on={[rn.endingStyle]:``},sn={transitionStatus(e){return e===`starting`?an:e===`ending`?on:null}},cn=ee(),ln=p();function un(e,t=!1,n=!0){let r=en();return l((i,a=null)=>{r.cancel();let o=nn(e);if(o==null)return;let s=o,c=()=>{tn.flushSync(i)};if(typeof s.getAnimations!=`function`||globalThis.BASE_UI_ANIMATIONS_DISABLED){i();return}function l(){Promise.all(s.getAnimations().map(e=>e.finished)).then(()=>{a?.aborted||c()}).catch(()=>{if(n){a?.aborted||c();return}let e=s.getAnimations();!a?.aborted&&e.length>0&&e.some(e=>e.pending||e.playState!==`finished`)&&l()})}if(t){let e=rn.startingStyle;if(!s.hasAttribute(e)){r.request(l);return}let t=new MutationObserver(()=>{s.hasAttribute(e)||(t.disconnect(),l())});t.observe(s,{attributes:!0,attributeFilter:[e]}),a?.addEventListener(`abort`,()=>t.disconnect(),{once:!0});return}r.request(l)})}function dn(e){let{enabled:t=!0,open:n,ref:r,onComplete:i}=e,a=l(i),o=un(r,n,!1);E.useEffect(()=>{if(!t)return;let e=new AbortController;return o(a,e.signal),()=>{e.abort()}},[t,n,a,o])}function fn(e,t=!1,n=!1){let[r,i]=E.useState(e&&t?`idle`:void 0),[a,o]=E.useState(e);return e&&!a&&(o(!0),i(`starting`)),!e&&a&&r!==`ending`&&!n&&i(`ending`),!e&&!a&&r===`ending`&&i(void 0),h(()=>{if(!e&&a&&r!==`ending`&&n){let e=$t.request(()=>{i(`ending`)});return()=>{$t.cancel(e)}}},[e,a,r,n]),h(()=>{if(!e||t)return;let n=$t.request(()=>{i(void 0)});return()=>{$t.cancel(n)}},[t,e]),h(()=>{if(!e||!t)return;e&&a&&r!==`idle`&&i(`starting`);let n=$t.request(()=>{i(`idle`)});return()=>{$t.cancel(n)}},[t,e,a,r]),{mounted:a,setMounted:o,transitionStatus:r}}var pn=`none`,mn=`trigger-press`,hn=`trigger-hover`,gn=`trigger-focus`,_n=`outside-press`,vn=`item-press`,yn=`close-press`,bn=`focus-out`,xn=`escape-key`,Sn=`list-navigation`,Cn=`cancel-open`,wn=`sibling-open`,Tn=`imperative-action`;function En(e,t,n,r){let i=!1,a=!1,o=r??C;return{reason:e,event:t??new Event(`base-ui`),cancel(){i=!0},allowPropagation(){a=!0},get isCanceled(){return i},get isPropagationAllowed(){return a},trigger:n,...o}}var Dn=E.createContext(void 0);function On(e){let t=E.useContext(Dn);if(e===!1&&t===void 0)throw Error(x(27));return t}var kn=function(e){return e.open=`data-open`,e.closed=`data-closed`,e[e.startingStyle=rn.startingStyle]=`startingStyle`,e[e.endingStyle=rn.endingStyle]=`endingStyle`,e.anchorHidden=`data-anchor-hidden`,e.side=`data-side`,e.align=`data-align`,e}({}),An=function(e){return e.popupOpen=`data-popup-open`,e.pressed=`data-pressed`,e}({}),jn={[An.popupOpen]:``},Mn={[An.popupOpen]:``,[An.pressed]:``},Nn={[kn.open]:``},Pn={[kn.closed]:``},Fn={[kn.anchorHidden]:``},In={open(e){return e?jn:null}},Ln={open(e){return e?Mn:null}},Rn={open(e){return e?Nn:Pn},anchorHidden(e){return e?Fn:null}},zn={...Rn,...sn},Bn=E.forwardRef(function(e,t){let{render:n,className:r,style:i,forceRender:a=!1,...o}=e,{store:s}=On(),c=s.useState(`open`),l=s.useState(`nested`),d=s.useState(`mounted`);return u(`div`,e,{state:{open:c,transitionStatus:s.useState(`transitionStatus`)},ref:[s.context.backdropRef,t],stateAttributesMapping:zn,props:[{role:`presentation`,hidden:!d,style:{userSelect:`none`,WebkitUserSelect:`none`}},o],enabled:a||!l})}),Vn=E.forwardRef(function(e,t){let{render:n,className:r,disabled:i=!1,nativeButton:a=!0,style:o,...s}=e,{store:c}=On(),l=c.useState(`open`);function d(e){l&&c.setOpen(!1,En(yn,e.nativeEvent))}let{getButtonProps:p,buttonRef:m}=f({disabled:i,native:a});return u(`button`,e,{state:{disabled:i},ref:[t,m],props:[{onClick:d},s,p]})}),Hn=E.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,{store:s}=On(),c=k(a);return s.useSyncedValueWithCleanup(`descriptionElementId`,c),u(`p`,e,{ref:t,props:[{id:c},o]})});function V(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function Un(...e){return()=>{for(let t=0;t<e.length;t+=1){let n=e[t];n&&n()}}}function Wn(e){let t=T(Gn,e).current;return t.next=e,h(t.effect),t}function Gn(e){let t={current:e,next:e,effect:()=>{t.current=t.next}};return t}var Kn={clipPath:`inset(50%)`,overflow:`hidden`,whiteSpace:`nowrap`,border:0,padding:0,width:1,height:1,margin:-1},qn={...Kn,position:`fixed`,top:0,left:0},Jn={...Kn,position:`absolute`},Yn=E.forwardRef(function(e,t){let[n,r]=E.useState();h(()=>{le&&r(`button`)},[]);let i={tabIndex:0,role:n};return(0,I.jsx)(`span`,{...e,ref:t,style:qn,"aria-hidden":n?void 0:!0,...i,"data-base-ui-focus-guard":``})});function Xn(e){return`data-base-ui-${e}`}var Zn=0;function Qn(e,t={}){let{preventScroll:n=!1,cancelPrevious:r=!0,sync:i=!1}=t;r&&cancelAnimationFrame(Zn);let a=()=>e?.focus({preventScroll:n});if(i)return a(),d;let o=requestAnimationFrame(a);return Zn=o,()=>{Zn===o&&(cancelAnimationFrame(o),Zn=0)}}var $n={inert:new WeakMap,"aria-hidden":new WeakMap},er=`data-base-ui-inert`,tr={inert:new WeakSet,"aria-hidden":new WeakSet},nr=new WeakMap,rr=0;function ir(e){return tr[e]}function ar(e){return e?s(e)?e.host:ar(e.parentNode):null}var or=(e,t)=>t.map(t=>{if(e.contains(t))return t;let n=ar(t);return e.contains(n)?n:null}).filter(e=>e!=null),sr=e=>{let t=new Set;return e.forEach(e=>{let n=e;for(;n&&!t.has(n);)t.add(n),n=n.parentNode}),t},cr=(e,n,r)=>{let i=[],a=e=>{!e||r.has(e)||Array.from(e.children).forEach(e=>{t(e)!==`script`&&(n.has(e)?a(e):i.push(e))})};return a(e),i};function lr(e,t,n,r,{mark:i=!0,markerIgnoreElements:a=[]}){let o=r?`inert`:n?`aria-hidden`:null,s=null,c=null,l=or(t,e),u=i?or(t,a):[],d=new Set(u),f=i?cr(t,sr(l),new Set(l)).filter(e=>!d.has(e)):[],p=[],m=[];if(o){let e=$n[o],n=ir(o);c=n,s=e;let r=or(t,Array.from(t.querySelectorAll(`[aria-live]`))),i=l.concat(r);cr(t,sr(i),new Set(i)).forEach(t=>{let r=t.getAttribute(o),i=r!==null&&r!==`false`,a=(e.get(t)||0)+1;e.set(t,a),p.push(t),a===1&&i&&n.add(t),i||t.setAttribute(o,o===`inert`?``:`true`)})}return i&&f.forEach(e=>{let t=(nr.get(e)||0)+1;nr.set(e,t),m.push(e),t===1&&e.setAttribute(er,``)}),rr+=1,()=>{s&&p.forEach(e=>{let t=(s.get(e)||0)-1;s.set(e,t),t||(!c?.has(e)&&o&&e.removeAttribute(o),c?.delete(e))}),i&&m.forEach(e=>{let t=(nr.get(e)||0)-1;nr.set(e,t),t||e.removeAttribute(er)}),--rr,rr||($n.inert=new WeakMap,$n[`aria-hidden`]=new WeakMap,tr.inert=new WeakSet,tr[`aria-hidden`]=new WeakSet,nr=new WeakMap)}}function ur(e,t={}){let{ariaHidden:n=!1,inert:r=!1,mark:i=!0,markerIgnoreElements:a=[]}=t,o=A(e[0]).body;return lr(e,o,n,r,{mark:i,markerIgnoreElements:a})}var dr={style:{transition:`none`}},fr=`data-base-ui-click-trigger`,pr={fallbackAxisSide:`none`},mr={fallbackAxisSide:`end`},hr={clipPath:`inset(50%)`,position:`fixed`,top:0,left:0},gr=E.createContext(null),_r=()=>E.useContext(gr),vr=Xn(`portal`);function yr(e={}){let{ref:t,container:n,componentProps:r=C,elementProps:i}=e,o=O(),s=_r()?.portalNode,[c,d]=E.useState(null),[f,p]=E.useState(null),m=l(e=>{e!==null&&p(e)}),g=E.useRef(null);h(()=>{if(n===null){g.current&&(g.current=null,p(null),d(null));return}if(o==null)return;let e=(n&&(a(n)?n:n.current))??s??document.body;if(e==null){g.current&&(g.current=null,p(null),d(null));return}g.current!==e&&(g.current=e,p(null),d(e))},[n,s,o]);let _=u(`div`,r,{ref:[t,m],props:[{id:o,[vr]:``},i]});return{portalNode:f,portalSubtree:c&&_?tn.createPortal(_,c):null}}var br=E.forwardRef(function(e,t){let{children:n,container:r,className:i,render:a,renderGuards:o,style:s,...c}=e,{portalNode:l,portalSubtree:u}=yr({container:r,ref:t,componentProps:e,elementProps:c}),d=E.useRef(null),f=E.useRef(null),p=E.useRef(null),m=E.useRef(null),[h,g]=E.useState(null),_=E.useRef(!1),v=h?.modal,y=h?.open,b=typeof o==`boolean`?o:!!h&&!h.modal&&h.open&&!!l;E.useEffect(()=>{if(!l||v)return;function e(e){l&&e.relatedTarget&&Ut(e)&&(e.type===`focusin`?_.current&&=(Gt(l),!1):(Wt(l),_.current=!0))}return Un(V(l,`focusin`,e,!0),V(l,`focusout`,e,!0))},[l,v]),E.useEffect(()=>{!l||y!==!1||(Gt(l),_.current=!1)},[y,l]);let x=E.useMemo(()=>({beforeOutsideRef:d,afterOutsideRef:f,beforeInsideRef:p,afterInsideRef:m,portalNode:l,setFocusManagerState:g}),[l]);return(0,I.jsxs)(E.Fragment,{children:[u,(0,I.jsxs)(gr.Provider,{value:x,children:[b&&l&&(0,I.jsx)(Yn,{"data-type":`outside`,ref:d,onFocus:e=>{Ut(e,l)?p.current?.focus():zt(h?h.domReference:null)?.focus()}}),b&&l&&(0,I.jsx)(`span`,{"aria-owns":l.id,style:hr}),l&&tn.createPortal(n,l),b&&l&&(0,I.jsx)(Yn,{"data-type":`outside`,ref:f,onFocus:e=>{Ut(e,l)?m.current?.focus():(Rt(h?h.domReference:null)?.focus(),h?.closeOnFocusOut&&h?.onOpenChange(!1,En(`focus-out`,e.nativeEvent)))}})]})]})});function xr(){let e=new Map;return{emit(t,n){e.get(t)?.forEach(e=>e(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){e.get(t)?.delete(n)}}}var Sr=class{nodesRef={current:[]};events=xr();addNode(e){this.nodesRef.current.push(e)}removeNode(e){let t=this.nodesRef.current.findIndex(t=>t===e);t!==-1&&this.nodesRef.current.splice(t,1)}},Cr=E.createContext(null),wr=E.createContext(null),Tr=()=>E.useContext(Cr)?.id||null,Er=e=>{let t=E.useContext(wr);return e??t};function Dr(e){let t=O(),n=Er(e),r=Tr();return h(()=>{if(!t)return;let e={id:t,parentId:r};return n?.addNode(e),()=>{n?.removeNode(e)}},[n,t,r]),t}function Or(e){let{children:t,id:n}=e,r=Tr();return(0,I.jsx)(Cr.Provider,{value:E.useMemo(()=>({id:n,parentId:r}),[n,r]),children:t})}function kr(e){let{children:t,externalTree:n}=e,r=T(()=>n??new Sr).current;return(0,I.jsx)(wr.Provider,{value:r,children:t})}function Ar(e,t){let r=n(be(e));return e instanceof r.KeyboardEvent?`keyboard`:e instanceof r.FocusEvent?t||`keyboard`:`pointerType`in e?e.pointerType||`keyboard`:`touches`in e?`touch`:e instanceof r.MouseEvent?t||(e.detail===0?`keyboard`:`mouse`):``}var jr=20,Mr=[];function Nr(){Mr=Mr.filter(e=>e.deref()?.isConnected)}function Pr(e){Nr(),e&&t(e)!==`body`&&(Mr.push(new WeakRef(e)),Mr.length>jr&&(Mr=Mr.slice(-jr)))}function Fr(){return Nr(),Mr[Mr.length-1]?.deref()}function Ir(e){return e?Pt(e)?e:It(e)[0]||e:null}function Lr(e,t){if(e.hasAttribute(`tabindex`)&&!e.hasAttribute(`data-tabindex`)||!t.current.includes(`floating`)&&!e.getAttribute(`role`)?.includes(`dialog`))return;let n=Ft(e).filter(e=>{let t=e.getAttribute(`data-tabindex`)||``;return Pt(e)||e.hasAttribute(`data-tabindex`)&&!t.startsWith(`-`)}),r=e.getAttribute(`tabindex`);t.current.includes(`floating`)||n.length===0?r!==`0`&&e.setAttribute(`tabindex`,`0`):(r!==`-1`||e.hasAttribute(`data-tabindex`)&&e.getAttribute(`data-tabindex`)!==`-1`)&&(e.setAttribute(`tabindex`,`-1`),e.setAttribute(`data-tabindex`,`-1`))}function Rr(t){let{context:n,children:r,disabled:i=!1,initialFocus:a=!0,returnFocus:o=!0,restoreFocus:s=!1,modal:c=!0,closeOnFocusOut:u=!0,openInteractionType:d=``,nextFocusableElement:f,previousFocusableElement:p,beforeContentFocusGuardRef:m,externalTree:g,getInsideElements:_}=t,v=`rootStore`in n?n.rootStore:n,y=v.useState(`open`),b=v.useState(`domReferenceElement`),x=v.useState(`floatingElement`),{events:S,dataRef:C}=v.context,w=l(()=>C.current.floatingContext?.nodeId),ee=a===!1,T=Te(b)&&ee,ne=E.useRef([`content`]),re=Wn(a),ie=Wn(o),ae=Wn(d),D=Er(g),O=_r(),k=E.useRef(!1),j=E.useRef(!1),oe=E.useRef(!1),se=E.useRef(null),M=E.useRef(``),N=E.useRef(``),le=E.useRef(null),P=E.useRef(null),ue=te(le,m,O?.beforeInsideRef),de=te(P,O?.afterInsideRef),fe=Xt(),pe=Xt(),F=en(),me=O!=null,L=De(x),he=l((e=L)=>e?It(e):[]),ge=l(()=>_?.().filter(e=>e!=null)??[]);E.useEffect(()=>{if(i||!c)return;function e(e){e.key===`Tab`&&R(L,ye(A(L)))&&he().length===0&&!T&&Ae(e)}return V(A(L),`keydown`,e)},[i,b,L,c,ne,T,he]),E.useEffect(()=>{if(i||!y)return;let e=A(L);function t(){oe.current=!1}function n(e){let t=be(e),n=ge();oe.current=!(R(x,t)||R(b,t)||R(O?.portalNode,t)||n.some(e=>e===t||R(e,t))),N.current=e.pointerType||`keyboard`,t?.closest(`[data-base-ui-click-trigger]`)&&(j.current=!0)}function r(){N.current=`keyboard`}return Un(V(e,`pointerdown`,n,!0),V(e,`pointerup`,t,!0),V(e,`pointercancel`,t,!0),V(e,`keydown`,r,!0))},[i,x,b,L,y,O,ge]),E.useEffect(()=>{if(i||!u)return;let t=A(L);function n(){j.current=!0,pe.start(0,()=>{j.current=!1})}function r(e){let t=be(e);Pt(t)&&(se.current=t)}function a(n){let r=n.relatedTarget,i=n.currentTarget,a=be(n);queueMicrotask(()=>{let o=w(),l=v.context.triggerElements,u=ge(),d=r?.hasAttribute(Xn(`focus-guard`))&&[le.current,P.current,O?.beforeInsideRef.current,O?.afterInsideRef.current,O?.beforeOutsideRef.current,O?.afterOutsideRef.current,nn(p),nn(f)].includes(r),m=!(R(b,r)||R(x,r)||R(r,x)||R(O?.portalNode,r)||u.some(e=>e===r||R(e,r))||r!=null&&l.hasElement(r)||l.hasMatchingElement(e=>R(e,r))||d||D&&(Oe(D.nodesRef.current,o).find(e=>R(e.context?.elements.floating,r)||R(e.context?.elements.domReference,r))||ke(D.nodesRef.current,o).find(e=>[e.context?.elements.floating,De(e.context?.elements.floating)].includes(r)||e.context?.elements.domReference===r)));if(i===b&&L&&Lr(L,ne),s&&i!==b&&!bt(a)&&ye(t)===t.body){if(e(L)&&(L.focus(),s===`popup`)){F.request(()=>{L.focus()});return}let t=he(),n=se.current,r=(n&&t.includes(n)?n:null)||t[t.length-1]||L;e(r)&&r.focus()}if(C.current.insideReactTree){C.current.insideReactTree=!1;return}(T||!c)&&r&&m&&!j.current&&(T||r!==Fr())&&(k.current=!0,v.setOpen(!1,En(bn,n)))})}function o(){oe.current||(C.current.insideReactTree=!0,fe.start(0,()=>{C.current.insideReactTree=!1}))}let l=e(b)?b:null;if(!(!x&&!l))return Un(l&&V(l,`focusout`,a),l&&V(l,`pointerdown`,n),x&&V(x,`focusin`,r),x&&V(x,`focusout`,a),x&&O&&V(x,`focusout`,o,!0))},[i,b,x,L,c,D,O,v,u,s,he,T,w,ne,C,fe,pe,F,f,p,ge]),E.useEffect(()=>{if(i||!x||!y)return;let e=Array.from(O?.portalNode?.querySelectorAll(`[${Xn(`portal`)}]`)||[]),t=(D?ke(D.nodesRef.current,w()):[]).find(e=>Te(e.context?.elements.domReference||null))?.context?.elements.domReference,n=ur([...[x,...e,le.current,P.current,O?.beforeOutsideRef.current,O?.afterOutsideRef.current,...ge()],t,nn(p),nn(f),T?b:null].filter(e=>e!=null),{ariaHidden:c||T,mark:!1}),r=ur([x,...e].filter(e=>e!=null));return()=>{r(),n()}},[y,i,b,x,c,ne,O,T,D,w,f,p,ge]),h(()=>{if(!y||i||!e(L))return;let t=ye(A(L));queueMicrotask(()=>{let e=re.current,n=typeof e==`function`?e(ae.current||``):e;if(n===void 0||n===!1||R(L,t))return;let r=null,i=()=>(r??=he(L),r[0]||L),a;a=n===!0||n===null?i():nn(n),a||=i(),Qn(a,{preventScroll:a===L})})},[i,y,L,ee,he,re,ae]),h(()=>{if(i||!L)return;let t=A(L);Pr(ye(t));function n(e){if(e.open||(M.current=Ar(e.nativeEvent,N.current)),e.reason===`trigger-hover`&&e.nativeEvent.type===`mouseleave`&&(k.current=!0),e.reason===`outside-press`)if(e.nested)k.current=!1;else if(Me(e.nativeEvent)||Ne(e.nativeEvent))k.current=!1;else{let e=!1;A(L).createElement(`div`).focus({get preventScroll(){return e=!0,!1}}),e?k.current=!1:k.current=!0}}S.on(`openchange`,n);function r(){let e=ie.current,t=typeof e==`function`?e(M.current):e;if(t===void 0||t===!1)return null;if(t===null&&(t=!0),typeof t==`boolean`){let e=b||Fr();return e&&e.isConnected?e:null}let n=b||Fr();return nn(t)||n||null}return()=>{S.off(`openchange`,n);let i=ye(t),a=ge(),o=R(x,i)||a.some(e=>e===i||R(e,i))||D&&Oe(D.nodesRef.current,w(),!1).some(e=>R(e.context?.elements.floating,i)),s=ie.current,c=r();queueMicrotask(()=>{let n=Ir(c),r=typeof s!=`boolean`;s&&!k.current&&e(n)&&(!(!r&&n!==i&&i!==t.body)||o)&&n.focus({preventScroll:!0}),k.current=!1})}},[i,x,L,ie,C,S,D,b,w,ge]),h(()=>{if(!ce||y||!x)return;let t=ye(A(x));!e(t)||!Ce(t)||R(x,t)&&t.blur()},[y,x]),h(()=>{if(!(i||!O))return O.setFocusManagerState({modal:c,closeOnFocusOut:u,open:y,onOpenChange:v.setOpen,domReference:b}),()=>{O.setFocusManagerState(null)}},[i,O,c,y,v,u,b]),h(()=>{if(!(i||!L))return Lr(L,ne),()=>{queueMicrotask(Nr)}},[i,L,ne]);let _e=!i&&(c?!T:!0)&&(me||c);return(0,I.jsxs)(E.Fragment,{children:[_e&&(0,I.jsx)(Yn,{"data-type":`inside`,ref:ue,onFocus:e=>{if(c){let e=he();Qn(e[e.length-1])}else O?.portalNode&&(k.current=!1,Ut(e,O.portalNode)?Rt(b)?.focus():nn(p??O.beforeOutsideRef)?.focus())}}),r,_e&&(0,I.jsx)(Yn,{"data-type":`inside`,ref:de,onFocus:e=>{c?Qn(he()[0]):O?.portalNode&&(u&&(k.current=!0),Ut(e,O.portalNode)?zt(b)?.focus():nn(f??O.afterOutsideRef)?.focus())}})]})}var zr={intentional:`onClick`,sloppy:`onPointerDown`};function Br(){return!1}function Vr(e){return{escapeKey:typeof e==`boolean`?e:e?.escapeKey??!1,outsidePress:typeof e==`boolean`?e:e?.outsidePress??!0}}function Hr(t,n={}){let a=`rootStore`in t?t.rootStore:t,o=a.useState(`open`),c=a.useState(`floatingElement`),{dataRef:u}=a.context,{enabled:d=!0,escapeKey:f=!0,outsidePress:p=!0,outsidePressEvent:m=`sloppy`,referencePress:h=Br,referencePressEvent:g=`sloppy`,bubbles:y,externalTree:b}=n,x=Er(b),S=l(typeof p==`function`?p:()=>!1),C=typeof p==`function`?S:p,w=C!==!1,ee=l(()=>m),te=E.useRef(!1),T=E.useRef(!1),re=E.useRef(!1),{escapeKey:ie,outsidePress:ae}=Vr(y),D=E.useRef(null),O=Xt(),k=Xt(),j=l(()=>{k.clear(),u.current.insideReactTree=!1}),oe=E.useRef(!1),se=E.useRef(``),M=l(h),ce=l(e=>{if(!o||!d||!f||e.key!==`Escape`||oe.current)return;let t=u.current.floatingContext?.nodeId,n=x?Oe(x.nodesRef.current,t):[];if(!ie&&n.length>0){let e=!0;if(n.forEach(t=>{t.context?.open&&!t.context.dataRef.current.__escapeKeyBubbles&&(e=!1)}),!e)return}let r=En(xn,je(e)?e.nativeEvent:e);a.setOpen(!1,r),!ie&&!r.isPropagationAllowed&&e.stopPropagation()}),N=l(()=>{u.current.insideReactTree=!0,k.start(0,j)});E.useEffect(()=>{if(!o||!d)return;u.current.__escapeKeyBubbles=ie,u.current.__outsidePressBubbles=ae;let t=new Yt,n=new Yt;function l(){t.clear(),oe.current=!0}function p(){t.start(i()?5:0,()=>{oe.current=!1})}function m(){re.current=!0,n.start(0,()=>{re.current=!1})}function h(){te.current=!1,T.current=!1}function g(){let e=se.current,t=e===`pen`||!e?`mouse`:e,n=ee(),r=typeof n==`function`?n():n;return typeof r==`string`?r:r[t]}function y(e){let t=g();return t===`intentional`&&e.type!==`click`||t===`sloppy`&&e.type===`click`}function b(e){let t=u.current.floatingContext?.nodeId,n=x&&Oe(x.nodesRef.current,t).some(t=>z(e,t.context?.elements.floating));return z(e,a.select(`floatingElement`))||z(e,a.select(`domReferenceElement`))||n}function S(t){if(y(t)){j();return}if(u.current.insideReactTree){j();return}let i=be(t),o=`[${Xn(`inert`)}]`,c=v(i)?i.getRootNode():null,l=Array.from((s(c)?c:A(a.select(`floatingElement`))).querySelectorAll(o)),d=a.context.triggerElements;if(i&&(d.hasElement(i)||d.hasMatchingElement(e=>R(e,i))))return;let f=v(i)?i:null;for(;f&&!_(f);){let e=r(f);if(_(e)||!v(e))break;f=e}if(l.length&&v(i)&&!Se(i)&&!R(i,a.select(`floatingElement`))&&l.every(e=>!R(f,e)))return;if(e(i)&&!(`touches`in t)){let e=_(i),n=ne(i),r=/auto|scroll/,a=e||r.test(n.overflowX),o=e||r.test(n.overflowY),s=a&&i.clientWidth>0&&i.scrollWidth>i.clientWidth,c=o&&i.clientHeight>0&&i.scrollHeight>i.clientHeight,l=n.direction===`rtl`,u=c&&(l?t.offsetX<=i.offsetWidth-i.clientWidth:t.offsetX>i.clientWidth),d=s&&t.offsetY>i.clientHeight;if(u||d)return}if(b(t))return;if(g()===`intentional`&&re.current){n.clear(),re.current=!1;return}if(typeof C==`function`&&!C(t))return;let p=u.current.floatingContext?.nodeId,m=x?Oe(x.nodesRef.current,p):[];if(m.length>0){let e=!0;if(m.forEach(t=>{t.context?.open&&!t.context.dataRef.current.__outsidePressBubbles&&(e=!1)}),!e)return}a.setOpen(!1,En(_n,t)),j()}function E(e){g()!==`sloppy`||e.pointerType===`touch`||!a.select(`open`)||!d||z(e,a.select(`floatingElement`))||z(e,a.select(`domReferenceElement`))||S(e)}function k(e){if(g()!==`sloppy`||!a.select(`open`)||!d||z(e,a.select(`floatingElement`))||z(e,a.select(`domReferenceElement`)))return;let t=e.touches[0];t&&(D.current={startTime:Date.now(),startX:t.clientX,startY:t.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},O.start(1e3,()=>{D.current&&(D.current.dismissOnTouchEnd=!1,D.current.dismissOnMouseDown=!1)}))}function M(e,t){let n=be(e);if(!n)return;let r=V(n,e.type,()=>{t(e),r()})}function N(e){se.current=`touch`,M(e,k)}function le(e){O.clear(),e.type===`pointerdown`&&(se.current=e.pointerType),!(e.type===`mousedown`&&D.current&&!D.current.dismissOnMouseDown)&&M(e,e=>{e.type===`pointerdown`?E(e):S(e)})}function P(e){if(!te.current)return;let t=T.current;if(h(),g()===`intentional`){if(e.type===`pointercancel`){t&&m();return}if(!b(e)){if(t){m();return}typeof C==`function`&&!C(e)||(n.clear(),re.current=!0,j())}}}function ue(e){if(g()!==`sloppy`||!D.current||z(e,a.select(`floatingElement`))||z(e,a.select(`domReferenceElement`)))return;let t=e.touches[0];if(!t)return;let n=Math.abs(t.clientX-D.current.startX),r=Math.abs(t.clientY-D.current.startY),i=Math.sqrt(n*n+r*r);i>5&&(D.current.dismissOnTouchEnd=!0),i>10&&(S(e),O.clear(),D.current=null)}function de(e){M(e,ue)}function fe(e){g()!==`sloppy`||!D.current||z(e,a.select(`floatingElement`))||z(e,a.select(`domReferenceElement`))||(D.current.dismissOnTouchEnd&&S(e),O.clear(),D.current=null)}function pe(e){M(e,fe)}let F=A(c),I=Un(f&&Un(V(F,`keydown`,ce),V(F,`compositionstart`,l),V(F,`compositionend`,p)),w&&Un(V(F,`click`,le,!0),V(F,`pointerdown`,le,!0),V(F,`pointerup`,P,!0),V(F,`pointercancel`,P,!0),V(F,`mousedown`,le,!0),V(F,`mouseup`,P,!0),V(F,`touchstart`,N,!0),V(F,`touchmove`,de,!0),V(F,`touchend`,pe,!0)));return()=>{I(),t.clear(),n.clear(),h(),re.current=!1}},[u,c,f,w,C,o,d,ie,ae,ce,j,ee,x,a,O]),E.useEffect(j,[C,j]);let le=E.useMemo(()=>({onKeyDown:ce,[zr[g]]:e=>{M()&&a.setOpen(!1,En(mn,e.nativeEvent))},...g!==`intentional`&&{onClick(e){M()&&a.setOpen(!1,En(`trigger-press`,e.nativeEvent))}}}),[ce,a,g,M]),P=l(e=>{if(!o||!d||e.button!==0)return;let t=be(e.nativeEvent);R(a.select(`floatingElement`),t)&&(te.current||(te.current=!0,T.current=!1))}),ue=l(e=>{!o||!d||(e.defaultPrevented||e.nativeEvent.defaultPrevented)&&te.current&&(T.current=!0)}),de=E.useMemo(()=>({onKeyDown:ce,onPointerDown:ue,onMouseDown:ue,onClickCapture:N,onMouseDownCapture(e){N(),P(e)},onPointerDownCapture(e){N(),P(e)},onMouseUpCapture:N,onTouchEndCapture:N,onTouchMoveCapture:N}),[ce,N,P,ue]);return E.useMemo(()=>d?{reference:le,floating:de,trigger:le}:{},[d,le,de])}var H=(e,t,n,r,i,a,...o)=>{if(o.length>0)throw Error(x(1));let s;if(e&&t&&n&&r&&i&&a)s=(o,s,c,l)=>a(e(o,s,c,l),t(o,s,c,l),n(o,s,c,l),r(o,s,c,l),i(o,s,c,l),s,c,l);else if(e&&t&&n&&r&&i)s=(a,o,s,c)=>i(e(a,o,s,c),t(a,o,s,c),n(a,o,s,c),r(a,o,s,c),o,s,c);else if(e&&t&&n&&r)s=(i,a,o,s)=>r(e(i,a,o,s),t(i,a,o,s),n(i,a,o,s),a,o,s);else if(e&&t&&n)s=(r,i,a,o)=>n(e(r,i,a,o),t(r,i,a,o),i,a,o);else if(e&&t)s=(n,r,i,a)=>t(e(n,r,i,a),r,i,a);else if(e)s=e;else throw Error(`Missing arguments`);return s},Ur=[],Wr=void 0;function Gr(){return Wr}function Kr(e){Ur.push(e)}function qr(e){let t=(t,n)=>{let r=T(Yr).current,i;try{Wr=r;for(let e of Ur)e.before(r);i=e(t,n);for(let e of Ur)e.after(r);r.didInitialize=!0}finally{Wr=void 0}return i};return t.displayName=e.displayName||e.name,t}function Jr(e){return E.forwardRef(qr(e))}function Yr(){return{didInitialize:!1}}var Xr=y(19)?$r:ei;function Zr(e,t,n,r,i){return Xr(e,t,n,r,i)}function Qr(e,t,n,r,i){let a=E.useCallback(()=>t(e.getSnapshot(),n,r,i),[e,t,n,r,i]);return(0,cn.useSyncExternalStore)(e.subscribe,a,a)}Kr({before(e){e.syncIndex=0,e.didInitialize||(e.syncTick=1,e.syncHooks=[],e.didChangeStore=!0,e.getSnapshot=()=>{let t=!1;for(let n=0;n<e.syncHooks.length;n+=1){let r=e.syncHooks[n],i=r.selector(r.store.state,r.a1,r.a2,r.a3);(r.didChange||!Object.is(r.value,i))&&(t=!0,r.value=i,r.didChange=!1)}return t&&(e.syncTick+=1),e.syncTick})},after(e){e.syncHooks.length>0&&(e.didChangeStore&&(e.didChangeStore=!1,e.subscribe=t=>{let n=new Set;for(let t of e.syncHooks)n.add(t.store);let r=[];for(let e of n)r.push(e.subscribe(t));return()=>{for(let e of r)e()}}),(0,cn.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getSnapshot))}});function $r(e,t,n,r,i){let a=Gr();if(!a)return Qr(e,t,n,r,i);let o=a.syncIndex;a.syncIndex+=1;let s;return a.didInitialize?(s=a.syncHooks[o],(s.store!==e||s.selector!==t||!Object.is(s.a1,n)||!Object.is(s.a2,r)||!Object.is(s.a3,i))&&(s.store!==e&&(a.didChangeStore=!0),s.store=e,s.selector=t,s.a1=n,s.a2=r,s.a3=i,s.didChange=!0)):(s={store:e,selector:t,a1:n,a2:r,a3:i,value:t(e.getSnapshot(),n,r,i),didChange:!1},a.syncHooks.push(s)),s.value}function ei(e,t,n,r,i){return(0,ln.useSyncExternalStoreWithSelector)(e.subscribe,e.getSnapshot,e.getSnapshot,e=>t(e,n,r,i))}var ti=class{constructor(e){this.state=e,this.listeners=new Set,this.updateTick=0}subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});getSnapshot=()=>this.state;setState(e){if(this.state===e)return;this.state=e,this.updateTick+=1;let t=this.updateTick;for(let n of this.listeners){if(t!==this.updateTick)return;n(e)}}update(e){for(let t in e)if(!Object.is(this.state[t],e[t])){this.setState({...this.state,...e});return}}set(e,t){Object.is(this.state[e],t)||this.setState({...this.state,[e]:t})}notifyAll(){let e={...this.state};this.setState(e)}use(e,t,n,r){return Zr(this,e,t,n,r)}},ni=class extends ti{constructor(e,t={},n){super(e),this.context=t,this.selectors=n}useSyncedValue(e,t){E.useDebugValue(e),h(()=>{this.state[e]!==t&&this.set(e,t)},[e,t])}useSyncedValueWithCleanup(e,t){let n=this;h(()=>(n.state[e]!==t&&n.set(e,t),()=>{n.set(e,void 0)}),[n,e,t])}useSyncedValues(e){let t=this;h(()=>{t.update(e)},[t,...Object.values(e)])}useControlledProp(e,t){E.useDebugValue(e);let n=t!==void 0;h(()=>{n&&!Object.is(this.state[e],t)&&super.setState({...this.state,[e]:t})},[e,t,n])}select(e,t,n,r){let i=this.selectors[e];return i(this.state,t,n,r)}useState(e,t,n,r){return E.useDebugValue(e),Zr(this,this.selectors[e],t,n,r)}useContextCallback(e,t){E.useDebugValue(e);let n=l(t??d);this.context[e]=n}useStateSetter(e){let t=E.useRef(void 0);return t.current===void 0&&(t.current=t=>{this.set(e,t)}),t.current}observe(e,t){let n;n=typeof e==`function`?e:this.selectors[e];let r=n(this.state);return t(r,r,this),this.subscribe(e=>{let i=n(e);if(!Object.is(r,i)){let e=r;r=i,t(i,e,this)}})}},ri={open:H(e=>e.open),transitionStatus:H(e=>e.transitionStatus),domReferenceElement:H(e=>e.domReferenceElement),referenceElement:H(e=>e.positionReference??e.referenceElement),floatingElement:H(e=>e.floatingElement),floatingId:H(e=>e.floatingId)},ii=class extends ni{constructor(e){let{syncOnly:t,nested:n,onOpenChange:r,triggerElements:i,...a}=e;super({...a,positionReference:a.referenceElement,domReferenceElement:a.referenceElement},{onOpenChange:r,dataRef:{current:{}},events:xr(),nested:n,triggerElements:i},ri),this.syncOnly=t}syncOpenEvent=(e,t)=>{(!e||!this.state.open||t!=null&&Fe(t))&&(this.context.dataRef.current.openEvent=e?t:void 0)};dispatchOpenChange=(e,t)=>{this.syncOpenEvent(e,t.event);let n={open:e,reason:t.reason,nativeEvent:t.event,nested:this.context.nested,triggerElement:t.trigger};this.context.events.emit(`openchange`,n)};setOpen=(e,t)=>{if(this.syncOnly){this.context.onOpenChange?.(e,t);return}this.dispatchOpenChange(e,t),this.context.onOpenChange?.(e,t)}};function ai(e,t){let n=E.useRef(null),r=E.useRef(null);return E.useCallback(i=>{if(e!==void 0){if(n.current!==null){let e=n.current,i=r.current,a=t.context.triggerElements.getById(e);i&&a===i&&t.context.triggerElements.delete(e),n.current=null,r.current=null}i!==null&&(n.current=e,r.current=i,t.context.triggerElements.add(e,i))}},[t,e])}function oi(e,t,n,r){let i=n.useState(`isMountedByTrigger`,e),a=ai(e,n),o=l(t=>{if(a(t),!t||!n.select(`open`))return;let i=n.select(`activeTriggerId`);if(i===e){n.update({activeTriggerElement:t,...r});return}i??n.update({activeTriggerId:e,activeTriggerElement:t,...r})});return h(()=>{i&&n.update({activeTriggerElement:t.current,...r})},[i,n,t,...Object.values(r)]),{registerTrigger:o,isMountedByThisTrigger:i}}function si(e){let t=e.useState(`open`);h(()=>{if(t&&!e.select(`activeTriggerId`)&&e.context.triggerElements.size===1){let t=e.context.triggerElements.entries().next();if(!t.done){let[n,r]=t.value;e.update({activeTriggerId:n,activeTriggerElement:r})}}},[t,e])}function ci(e,t,n){let{mounted:r,setMounted:i,transitionStatus:a}=fn(e);t.useSyncedValues({mounted:r,transitionStatus:a});let o=l(()=>{i(!1),t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1}),n?.(),t.context.onOpenChangeComplete?.(!1)});return dn({enabled:!t.useState(`preventUnmountingOnClose`),open:e,ref:t.context.popupRef,onComplete(){e||o()}}),{forceUnmount:o,transitionStatus:a}}var li=class{constructor(){this.elementsSet=new Set,this.idMap=new Map}add(e,t){let n=this.idMap.get(e);n!==t&&(n!==void 0&&this.elementsSet.delete(n),this.elementsSet.add(t),this.idMap.set(e,t))}delete(e){let t=this.idMap.get(e);t&&(this.elementsSet.delete(t),this.idMap.delete(e))}hasElement(e){return this.elementsSet.has(e)}hasMatchingElement(e){for(let t of this.elementsSet)if(e(t))return!0;return!1}getById(e){return this.idMap.get(e)}entries(){return this.idMap.entries()}elements(){return this.elementsSet.values()}get size(){return this.idMap.size}};function ui(){return new ii({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:new li,floatingId:``,syncOnly:!1,nested:!1,onOpenChange:void 0})}function di(){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:ui(),preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:C,inactiveTriggerProps:C,popupProps:C}}var fi=H(e=>e.triggerIdProp??e.activeTriggerId),pi={open:H(e=>e.openProp??e.open),mounted:H(e=>e.mounted),transitionStatus:H(e=>e.transitionStatus),floatingRootContext:H(e=>e.floatingRootContext),preventUnmountingOnClose:H(e=>e.preventUnmountingOnClose),payload:H(e=>e.payload),activeTriggerId:fi,activeTriggerElement:H(e=>e.mounted?e.activeTriggerElement:null),isTriggerActive:H((e,t)=>t!==void 0&&fi(e)===t),isOpenedByTrigger:H((e,t)=>t!==void 0&&fi(e)===t&&e.open),isMountedByTrigger:H((e,t)=>t!==void 0&&fi(e)===t&&e.mounted),triggerProps:H((e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps),popupProps:H(e=>e.popupProps),popupElement:H(e=>e.popupElement),positionerElement:H(e=>e.positionerElement)};function mi(e){let{popupStore:t,treatPopupAsFloatingElement:n=!1,onOpenChange:r}=e,i=O(),a=Tr()!=null,o=t.useState(`open`),s=t.useState(`activeTriggerElement`),c=t.useState(n?`popupElement`:`positionerElement`),l=t.context.triggerElements,u=T(()=>new ii({open:o,transitionStatus:void 0,referenceElement:s,floatingElement:c,triggerElements:l,onOpenChange:r,floatingId:i,syncOnly:!0,nested:a})).current;return h(()=>{let e={open:o,floatingId:i,referenceElement:s,floatingElement:c};v(s)&&(e.domReferenceElement=s),u.state.positionReference===u.state.referenceElement&&(e.positionReference=s),u.update(e)},[o,i,s,c,u]),u.context.onOpenChange=r,u.context.nested=a,u}function hi(e=[]){let t=e.map(e=>e?.reference),n=e.map(e=>e?.floating),r=e.map(e=>e?.item),i=e.map(e=>e?.trigger),a=E.useCallback(t=>gi(t,e,`reference`),t),o=E.useCallback(t=>gi(t,e,`floating`),n),s=E.useCallback(t=>gi(t,e,`item`),r),c=E.useCallback(t=>gi(t,e,`trigger`),i);return E.useMemo(()=>({getReferenceProps:a,getFloatingProps:o,getItemProps:s,getTriggerProps:c}),[a,o,s,c])}function gi(e,t,n){let r=new Map,i=n===`item`,a={};n===`floating`&&(a.tabIndex=-1,a[me]=``);for(let t in e)i&&e&&(t===`active`||t===`selected`)||(a[t]=e[t]);for(let o=0;o<t.length;o+=1){let s,c=t[o]?.[n];s=typeof c==`function`?e?c(e):null:c,s&&_i(a,s,i,r)}return _i(a,e,i,r),a}function _i(e,t,n,r){for(let i in t){let a=t[i];n&&(i===`active`||i===`selected`)||(i.startsWith(`on`)?(r.has(i)||r.set(i,[]),typeof a==`function`&&(r.get(i)?.push(a),e[i]=(...e)=>r.get(i)?.map(t=>t(...e)).find(e=>e!==void 0))):e[i]=a)}}var vi=new Map([[`select`,`listbox`],[`combobox`,`listbox`],[`label`,!1]]);function yi(e,t={}){let n=`rootStore`in e?e.rootStore:e,r=n.useState(`open`),i=n.useState(`floatingId`),a=n.useState(`domReferenceElement`),o=n.useState(`floatingElement`),{role:s=`dialog`}=t,c=O(),l=a?.id||c,u=E.useMemo(()=>De(o)?.id||i,[o,i]),d=vi.get(s)??s,f=Tr()!=null,p=E.useMemo(()=>d===`tooltip`||s===`label`?C:{"aria-haspopup":d===`alertdialog`?`dialog`:d,"aria-expanded":`false`,...d===`listbox`&&{role:`combobox`},...d===`menu`&&f&&{role:`menuitem`},...s===`select`&&{"aria-autocomplete":`none`},...s===`combobox`&&{"aria-autocomplete":`list`}},[d,f,s]),m=E.useMemo(()=>d===`tooltip`||s===`label`?{[`aria-${s===`label`?`labelledby`:`describedby`}`]:r?u:void 0}:{...p,"aria-expanded":r?`true`:`false`,"aria-controls":r?u:void 0,...d===`menu`&&{id:l}},[d,u,r,l,s,p]),h=E.useMemo(()=>{let e={id:u,...d&&{role:d}};return d===`tooltip`||s===`label`?e:{...e,...d===`menu`&&{"aria-labelledby":l}}},[d,u,l,s]),g=E.useCallback(({active:e,selected:t})=>{let n={role:`option`,...e&&{id:`${u}-fui-option`}};switch(s){case`select`:case`combobox`:return{...n,"aria-selected":t};default:}return{}},[u,s]);return E.useMemo(()=>({reference:m,floating:h,item:g,trigger:p}),[m,h,p,g])}var bi=function(e){return e.nestedDialogs=`--nested-dialogs`,e}({}),xi=function(e){return e[e.open=kn.open]=`open`,e[e.closed=kn.closed]=`closed`,e[e.startingStyle=kn.startingStyle]=`startingStyle`,e[e.endingStyle=kn.endingStyle]=`endingStyle`,e.nested=`data-nested`,e.nestedDialogOpen=`data-nested-dialog-open`,e}({}),Si=E.createContext(void 0);function Ci(){let e=E.useContext(Si);if(e===void 0)throw Error(x(26));return e}var wi=`ArrowUp`,Ti=`ArrowDown`,Ei=`ArrowLeft`,Di=`ArrowRight`,Oi=`Home`,ki=new Set([Ei,Di]),Ai=new Set([wi,Ti]),ji=new Set([...ki,...Ai]);new Set([...ji,Oi,`End`]);var Mi=new Set([wi,Ti,Ei,Di,Oi,`End`]),Ni={...Rn,...sn,nestedDialogOpen(e){return e?{[xi.nestedDialogOpen]:``}:null}},Pi=E.forwardRef(function(e,t){let{className:n,finalFocus:r,initialFocus:i,render:a,style:o,...s}=e,{store:c}=On(),l=c.useState(`descriptionElementId`),d=c.useState(`disablePointerDismissal`),f=c.useState(`floatingRootContext`),p=c.useState(`popupProps`),m=c.useState(`modal`),h=c.useState(`mounted`),g=c.useState(`nested`),_=c.useState(`nestedOpenDialogCount`),v=c.useState(`open`),y=c.useState(`openMethod`),b=c.useState(`titleElementId`),x=c.useState(`transitionStatus`),S=c.useState(`role`);Ci(),dn({open:v,ref:c.context.popupRef,onComplete(){v&&c.context.onOpenChangeComplete?.(!0)}});function C(e){return e===`touch`?c.context.popupRef.current:!0}let w=i===void 0?C:i,ee=u(`div`,e,{state:{open:v,nested:g,transitionStatus:x,nestedDialogOpen:_>0},props:[p,{"aria-labelledby":b??void 0,"aria-describedby":l??void 0,role:S,tabIndex:-1,hidden:!h,onKeyDown(e){Mi.has(e.key)&&e.stopPropagation()},style:{[bi.nestedDialogs]:_}},s],ref:[t,c.context.popupRef,c.useStateSetter(`popupElement`)],stateAttributesMapping:Ni});return(0,I.jsx)(Rr,{context:f,openInteractionType:y,disabled:!h,closeOnFocusOut:!d,initialFocus:w,returnFocus:r,modal:m!==!1,restoreFocus:`popup`,children:ee})});function Fi(e){return y(19)?e:e?`true`:void 0}var Ii=E.forwardRef(function(e,t){let{cutout:n,...r}=e,i;if(n){let e=n.getBoundingClientRect();i=`polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${e.left}px ${e.top}px,${e.left}px ${e.bottom}px,${e.right}px ${e.bottom}px,${e.right}px ${e.top}px,${e.left}px ${e.top}px)`}return(0,I.jsx)(`div`,{ref:t,role:`presentation`,"data-base-ui-inert":``,...r,style:{position:`fixed`,inset:0,userSelect:`none`,WebkitUserSelect:`none`,clipPath:i}})}),Li=E.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{store:i}=On(),a=i.useState(`mounted`),o=i.useState(`modal`),s=i.useState(`open`);return a||n?(0,I.jsx)(Si.Provider,{value:n,children:(0,I.jsxs)(br,{ref:t,...r,children:[a&&o===!0&&(0,I.jsx)(Ii,{ref:i.context.internalBackdropRef,inert:Fi(!s)}),e.children]})}):null});function Ri(e){let t=E.useRef(!0);t.current&&(t.current=!1,e())}var zi={},Bi={},Vi=``;function Hi(e){if(typeof document>`u`)return!1;let t=A(e);return n(t).innerWidth-t.documentElement.clientWidth>0}function Ui(e){if(!(typeof CSS<`u`&&CSS.supports&&CSS.supports(`scrollbar-gutter`,`stable`))||typeof document>`u`)return!1;let t=A(e),n=t.documentElement,r=t.body,i=o(n)?n:r,a=i.style.overflowY,s=n.style.scrollbarGutter;n.style.scrollbarGutter=`stable`,i.style.overflowY=`scroll`;let c=i.offsetWidth;i.style.overflowY=`hidden`;let l=i.offsetWidth;return i.style.overflowY=a,n.style.scrollbarGutter=s,c===l}function Wi(e){let t=A(e),n=t.documentElement,r=t.body,i=o(n)?n:r,a={overflowY:i.style.overflowY,overflowX:i.style.overflowX};return Object.assign(i.style,{overflowY:`hidden`,overflowX:`hidden`}),()=>{Object.assign(i.style,a)}}function Gi(e){let t=A(e),r=t.documentElement,i=t.body,a=n(r),s=0,c=0,l=!1,u=$t.create();if(ce&&(a.visualViewport?.scale??1)!==1)return()=>{};function d(){let t=a.getComputedStyle(r),n=a.getComputedStyle(i),u=(t.scrollbarGutter||``).includes(`both-edges`)?`stable both-edges`:`stable`;s=r.scrollTop,c=r.scrollLeft,zi={scrollbarGutter:r.style.scrollbarGutter,overflowY:r.style.overflowY,overflowX:r.style.overflowX},Vi=r.style.scrollBehavior,Bi={position:i.style.position,height:i.style.height,width:i.style.width,boxSizing:i.style.boxSizing,overflowY:i.style.overflowY,overflowX:i.style.overflowX,scrollBehavior:i.style.scrollBehavior};let d=r.scrollHeight>r.clientHeight,f=r.scrollWidth>r.clientWidth,p=t.overflowY===`scroll`||n.overflowY===`scroll`,m=t.overflowX===`scroll`||n.overflowX===`scroll`,h=Math.max(0,a.innerWidth-i.clientWidth),g=Math.max(0,a.innerHeight-i.clientHeight),_=parseFloat(n.marginTop)+parseFloat(n.marginBottom),v=parseFloat(n.marginLeft)+parseFloat(n.marginRight),y=o(r)?r:i;if(l=Ui(e),l){r.style.scrollbarGutter=u,y.style.overflowY=`hidden`,y.style.overflowX=`hidden`;return}Object.assign(r.style,{scrollbarGutter:u,overflowY:`hidden`,overflowX:`hidden`}),(d||p)&&(r.style.overflowY=`scroll`),(f||m)&&(r.style.overflowX=`scroll`),Object.assign(i.style,{position:`relative`,height:_||g?`calc(100dvh - ${_+g}px)`:`100dvh`,width:v||h?`calc(100vw - ${v+h}px)`:`100vw`,boxSizing:`border-box`,overflow:`hidden`,scrollBehavior:`unset`}),i.scrollTop=s,i.scrollLeft=c,r.setAttribute(`data-base-ui-scroll-locked`,``),r.style.scrollBehavior=`unset`}function f(){Object.assign(r.style,zi),Object.assign(i.style,Bi),l||(r.scrollTop=s,r.scrollLeft=c,r.removeAttribute(`data-base-ui-scroll-locked`),r.style.scrollBehavior=Vi)}function p(){f(),u.request(d)}d();let m=V(a,`resize`,p);return()=>{u.cancel(),f(),typeof a.removeEventListener==`function`&&m()}}var Ki=new class{lockCount=0;restore=null;timeoutLock=Yt.create();timeoutUnlock=Yt.create();acquire(e){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(e)),this.release}release=()=>{--this.lockCount,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)};unlock=()=>{this.lockCount===0&&this.restore&&(this.restore?.(),this.restore=null)};lock(e){if(this.lockCount===0||this.restore!==null)return;let t=A(e).documentElement,r=n(t).getComputedStyle(t).overflowY;if(r===`hidden`||r===`clip`){this.restore=d;return}let i=N||!Hi(e);this.restore=i?Wi(e):Gi(e)}};function qi(e=!0,t=null){h(()=>{if(e)return Ki.acquire(t)},[e,t])}function Ji(e){let t=E.useRef(``),n=E.useCallback(n=>{n.defaultPrevented||(t.current=n.pointerType,e(n,n.pointerType))},[e]);return{onClick:E.useCallback(n=>{if(n.detail===0){e(n,`keyboard`);return}`pointerType`in n?e(n,n.pointerType):e(n,t.current),t.current=``},[e]),onPointerDown:n}}function Yi(e,t){let n=E.useRef(e),r=l(t);h(()=>{n.current!==e&&r(n.current)},[e,r]),h(()=>{n.current=e},[e])}function Xi(e){let[t,n]=E.useState(null),r=l((t,r)=>{e||n(r||(N?`touch`:``))});Yi(e,t=>{t&&!e&&n(null)});let{onClick:i,onPointerDown:a}=Ji(r);return E.useMemo(()=>({openMethod:t,triggerProps:{onClick:i,onPointerDown:a}}),[t,i,a])}function Zi(e){let{store:t,parentContext:n,actionsRef:r,isDrawer:i}=e,a=t.useState(`open`),o=t.useState(`disablePointerDismissal`),s=t.useState(`modal`),c=t.useState(`popupElement`),{openMethod:l,triggerProps:u}=Xi(a);si(t);let{forceUnmount:d}=ci(a,t),f=E.useCallback(()=>{t.setOpen(!1,En(Tn))},[t]);E.useImperativeHandle(r,()=>({unmount:d,close:f}),[d,f]);let p=mi({popupStore:t,onOpenChange:t.setOpen,treatPopupAsFloatingElement:!0}),[m,h]=E.useState(0),[g,_]=E.useState(0),v=m===0,y=yi(p),b=Hr(p,{outsidePressEvent(){return t.context.internalBackdropRef.current||t.context.backdropRef.current?`intentional`:{mouse:s===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}},outsidePress(e){if(!t.context.outsidePressEnabledRef.current||`button`in e&&e.button!==0||`touches`in e&&e.touches.length!==1)return!1;let n=be(e);if(v&&!o){let e=n;return s&&(t.context.internalBackdropRef.current||t.context.backdropRef.current)?t.context.internalBackdropRef.current===e||t.context.backdropRef.current===e||R(e,c)&&!e?.hasAttribute(`data-base-ui-portal`):!0}return!1},escapeKey:v});qi(a&&s===!0,c);let{getReferenceProps:x,getFloatingProps:S,getTriggerProps:C}=hi([y,b]);t.useContextCallback(`onNestedDialogOpen`,(e,t)=>{h(e),_(t)}),t.useContextCallback(`onNestedDialogClose`,()=>{h(0),_(0)}),E.useEffect(()=>(n?.onNestedDialogOpen&&a&&n.onNestedDialogOpen(m+1,g+ +!!i),n?.onNestedDialogClose&&!a&&n.onNestedDialogClose(),()=>{n?.onNestedDialogClose&&a&&n.onNestedDialogClose()}),[i,a,m,g,n]);let w=E.useMemo(()=>x(u),[x,u]),ee=E.useMemo(()=>C(u),[C,u]),te=E.useMemo(()=>S(),[S]);t.useSyncedValues({openMethod:l,activeTriggerProps:w,inactiveTriggerProps:ee,popupProps:te,floatingRootContext:p,nestedOpenDialogCount:m,nestedOpenDrawerCount:g})}var Qi={...pi,modal:H(e=>e.modal),nested:H(e=>e.nested),nestedOpenDialogCount:H(e=>e.nestedOpenDialogCount),nestedOpenDrawerCount:H(e=>e.nestedOpenDrawerCount),disablePointerDismissal:H(e=>e.disablePointerDismissal),openMethod:H(e=>e.openMethod),descriptionElementId:H(e=>e.descriptionElementId),titleElementId:H(e=>e.titleElementId),viewportElement:H(e=>e.viewportElement),role:H(e=>e.role)},$i=class e extends ni{constructor(e){super(ea(e),{popupRef:E.createRef(),backdropRef:E.createRef(),internalBackdropRef:E.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:new li,onOpenChange:void 0,onOpenChangeComplete:void 0},Qi)}setOpen=(e,t)=>{if(t.preventUnmountOnClose=()=>{this.set(`preventUnmountingOnClose`,!0)},!e&&t.trigger==null&&this.state.activeTriggerId!=null&&(t.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(e,t),t.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(e,t);let n={open:e},r=t.trigger?.id??null;(r||e)&&(n.activeTriggerId=r,n.activeTriggerElement=t.trigger??null),this.update(n)};static useStore(t,n){let r=T(()=>new e(n)).current;return t??r}};function ea(e={}){return{...di(),modal:!0,disablePointerDismissal:!1,popupElement:null,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,nestedOpenDrawerCount:0,role:`dialog`,...e}}var ta=E.createContext(!1);function na(e){let{children:t,open:n,defaultOpen:r=!1,onOpenChange:i,onOpenChangeComplete:a,disablePointerDismissal:o=!1,modal:s=!0,actionsRef:c,handle:l,triggerId:u,defaultTriggerId:d=null}=e,f=On(!0),p=E.useContext(ta),m=!!f,h=$i.useStore(l?.store,{open:r,openProp:n,activeTriggerId:d,triggerIdProp:u,modal:s,disablePointerDismissal:o,nested:m});Ri(()=>{n===void 0&&h.state.open===!1&&r===!0&&h.update({open:!0,activeTriggerId:d})}),h.useControlledProp(`openProp`,n),h.useControlledProp(`triggerIdProp`,u),h.useSyncedValues({disablePointerDismissal:o,nested:m,modal:s}),h.useContextCallback(`onOpenChange`,i),h.useContextCallback(`onOpenChangeComplete`,a);let g=h.useState(`payload`);Zi({store:h,actionsRef:c,parentContext:f?.store.context,isDrawer:p,onOpenChange:i,triggerIdProp:u});let _=E.useMemo(()=>({store:h}),[h]);return(0,I.jsx)(ta.Provider,{value:!1,children:(0,I.jsx)(Dn.Provider,{value:_,children:typeof t==`function`?t({payload:g}):t})})}var ra=E.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,{store:s}=On(),c=k(a);return s.useSyncedValueWithCleanup(`titleElementId`,c),u(`h2`,e,{ref:t,props:[{id:c},o]})});Object.freeze({status:`aborted`});function U(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,`_zod`,{value:{def:r,constr:o,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=o.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in n||(n[t]=i[t].bind(n))}}let i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,`name`,{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,`init`,{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,`name`,{value:e}),o}var ia=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},aa=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}},oa={};function sa(e){return e&&Object.assign(oa,e),oa}function ca(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 la(e,t){return typeof t==`bigint`?t.toString():t}function ua(e){return{get value(){{let t=e();return Object.defineProperty(this,`value`,{value:t}),t}throw Error(`cached value already set`)}}}function da(e){return e==null}function fa(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function pa(e,t){let n=(e.toString().split(`.`)[1]||``).length,r=t.toString(),i=(r.split(`.`)[1]||``).length;if(i===0&&/\d?e-\d?/.test(r)){let e=r.match(/\d?e-(\d?)/);e?.[1]&&(i=Number.parseInt(e[1]))}let a=n>i?n:i;return Number.parseInt(e.toFixed(a).replace(`.`,``))%Number.parseInt(t.toFixed(a).replace(`.`,``))/10**a}var ma=Symbol(`evaluating`);function W(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==ma)return r===void 0&&(r=ma,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function ha(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function ga(...e){let t={};for(let n of e)Object.assign(t,Object.getOwnPropertyDescriptors(n));return Object.defineProperties({},t)}function _a(e){return JSON.stringify(e)}function va(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var ya=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function ba(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var xa=ua(()=>{if(typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function Sa(e){if(ba(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return!(ba(n)===!1||Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)===!1)}function Ca(e){return Sa(e)?{...e}:Array.isArray(e)?[...e]:e}var wa=new Set([`string`,`number`,`symbol`]);function Ta(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Ea(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function G(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 Da(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}var Oa={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function ka(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`);return Ea(e,ga(e._zod.def,{get shape(){let e={};for(let r in t){if(!(r in n.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return ha(this,`shape`,e),e},checks:[]}))}function Aa(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`);return Ea(e,ga(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return ha(this,`shape`,r),r},checks:[]}))}function ja(e,t){if(!Sa(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e in t)if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return Ea(e,ga(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return ha(this,`shape`,n),n}}))}function Ma(e,t){if(!Sa(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return Ea(e,ga(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return ha(this,`shape`,n),n}}))}function Na(e,t){return Ea(e,ga(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return ha(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:[]}))}function Pa(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw Error(`.partial() cannot be used on object schemas containing refinements`);return Ea(t,ga(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return ha(this,`shape`,i),i},checks:[]}))}function Fa(e,t,n){return Ea(t,ga(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return ha(this,`shape`,i),i}}))}function Ia(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 La(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function Ra(e){return typeof e==`string`?e:e?.message}function za(e,t,n){let r={...e,path:e.path??[]};return e.message||(r.message=Ra(e.inst?._zod.def?.error?.(e))??Ra(t?.error?.(e))??Ra(n.customError?.(e))??Ra(n.localeError?.(e))??`Invalid input`),delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}function Ba(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function Va(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}var Ha=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,`_zod`,{value:e._zod,enumerable:!1}),Object.defineProperty(e,`issues`,{value:t,enumerable:!1}),e.message=JSON.stringify(t,la,2),Object.defineProperty(e,`toString`,{value:()=>e.message,enumerable:!1})},Ua=U(`$ZodError`,Ha),Wa=U(`$ZodError`,Ha,{Parent:Error});function Ga(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function Ka(e,t=e=>e.message){let n={_errors:[]},r=e=>{for(let i of e.issues)if(i.code===`invalid_union`&&i.errors.length)i.errors.map(e=>r({issues:e}));else if(i.code===`invalid_key`)r({issues:i.issues});else if(i.code===`invalid_element`)r({issues:i.issues});else if(i.path.length===0)n._errors.push(t(i));else{let e=n,r=0;for(;r<i.path.length;){let n=i.path[r];r===i.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(i))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(e),n}var qa=e=>(t,n,r,i)=>{let a=r?Object.assign(r,{async:!1}):{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new ia;if(o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>za(e,a,sa())));throw ya(t,i?.callee),t}return o.value},Ja=e=>async(t,n,r,i)=>{let a=r?Object.assign(r,{async:!0}):{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>za(e,a,sa())));throw ya(t,i?.callee),t}return o.value},Ya=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 ia;return a.issues.length?{success:!1,error:new(e??Ua)(a.issues.map(e=>za(e,i,sa())))}:{success:!0,data:a.value}},Xa=Ya(Wa),Za=e=>async(t,n,r)=>{let i=r?Object.assign(r,{async:!0}):{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>za(e,i,sa())))}:{success:!0,data:a.value}},Qa=Za(Wa),$a=e=>(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return qa(e)(t,n,i)},eo=e=>(t,n,r)=>qa(e)(t,n,r),to=e=>async(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return Ja(e)(t,n,i)},no=e=>async(t,n,r)=>Ja(e)(t,n,r),ro=e=>(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return Ya(e)(t,n,i)},io=e=>(t,n,r)=>Ya(e)(t,n,r),ao=e=>async(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return Za(e)(t,n,i)},oo=e=>async(t,n,r)=>Za(e)(t,n,r),so=/^[cC][^\s-]{8,}$/,co=/^[0-9a-z]+$/,lo=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,uo=/^[0-9a-vA-V]{20}$/,fo=/^[A-Za-z0-9]{27}$/,po=/^[a-zA-Z0-9_-]{21}$/,mo=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,ho=/^([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})$/,go=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)$/,_o=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,vo=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;function yo(){return new RegExp(vo,`u`)}var bo=/^(?:(?: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])$/,xo=/^(([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}|:))$/,So=/^((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])$/,Co=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,wo=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,To=/^[A-Za-z0-9_-]*$/,Eo=/^\+[1-9]\d{6,14}$/,Do=`(?:(?:\\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])))`,Oo=RegExp(`^${Do}$`);function ko(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}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Ao(e){return RegExp(`^${ko(e)}$`)}function jo(e){let t=ko({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${Do}T(?:${r})$`)}var Mo=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},No=/^-?\d+$/,Po=/^-?\d+(?:\.\d+)?$/,Fo=/^(?:true|false)$/i,Io=/^[^A-Z]*$/,Lo=/^[^a-z]*$/,K=U(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Ro={number:`number`,bigint:`bigint`,object:`date`},zo=U(`$ZodCheckLessThan`,(e,t)=>{K.init(e,t);let n=Ro[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin: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})}}),Bo=U(`$ZodCheckGreaterThan`,(e,t)=>{K.init(e,t);let n=Ro[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin: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})}}),Vo=U(`$ZodCheckMultipleOf`,(e,t)=>{K.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),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`?n.value%t.value===BigInt(0):pa(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})}}),Ho=U(`$ZodCheckNumberFormat`,(e,t)=>{K.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=Oa[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=No)}),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})}}),Uo=U(`$ZodCheckMaxLength`,(e,t)=>{var n;K.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!da(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;if(r.length<=t.maximum)return;let i=Ba(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Wo=U(`$ZodCheckMinLength`,(e,t)=>{var n;K.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!da(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=Ba(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Go=U(`$ZodCheckLengthEquals`,(e,t)=>{var n;K.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!da(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length;if(i===t.length)return;let a=Ba(r),o=i>t.length;n.issues.push({origin:a,...o?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Ko=U(`$ZodCheckStringFormat`,(e,t)=>{var n,r;K.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),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=()=>{})}),qo=U(`$ZodCheckRegex`,(e,t)=>{Ko.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})}}),Jo=U(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=Io,Ko.init(e,t)}),Yo=U(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=Lo,Ko.init(e,t)}),Xo=U(`$ZodCheckIncludes`,(e,t)=>{K.init(e,t);let n=Ta(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),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})}}),Zo=U(`$ZodCheckStartsWith`,(e,t)=>{K.init(e,t);let n=RegExp(`^${Ta(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(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})}}),Qo=U(`$ZodCheckEndsWith`,(e,t)=>{K.init(e,t);let n=RegExp(`.*${Ta(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(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})}}),$o=U(`$ZodCheckOverwrite`,(e,t)=>{K.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),es=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
|
|
2
|
+
`).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?.args,n=[...(this?.content??[``]).map(e=>` ${e}`)];return new e(...t,n.join(`
|
|
3
|
+
`))}},ts={major:4,minor:3,patch:6},q=U(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=ts;let r=[...e._zod.def.checks??[]];e._zod.traits.has(`$ZodCheck`)&&r.unshift(e);for(let t of r)for(let n of t._zod.onattach)n(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(e,t,n)=>{let r=Ia(e),i;for(let a of t){if(a._zod.def.when){if(!a._zod.def.when(e))continue}else if(r)continue;let t=e.issues.length,o=a._zod.check(e);if(o instanceof Promise&&n?.async===!1)throw new ia;if(i||o instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await o,e.issues.length!==t&&(r||=Ia(e,t))});else{if(e.issues.length===t)continue;r||=Ia(e,t)}}return i?i.then(()=>e):e},n=(n,i,a)=>{if(Ia(n))return n.aborted=!0,n;let o=t(i,r,a);if(o instanceof Promise){if(a.async===!1)throw new ia;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction===`backward`){let t=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,i,a)):n(t,i,a)}let o=e._zod.parse(i,a);if(o instanceof Promise){if(a.async===!1)throw new ia;return o.then(e=>t(e,r,a))}return t(o,r,a)}}W(e,`~standard`,()=>({validate:t=>{try{let n=Xa(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return Qa(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}))}),ns=U(`$ZodString`,(e,t)=>{q.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Mo(e._zod.bag),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}}),J=U(`$ZodStringFormat`,(e,t)=>{Ko.init(e,t),ns.init(e,t)}),rs=U(`$ZodGUID`,(e,t)=>{t.pattern??=ho,J.init(e,t)}),is=U(`$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??=go(e)}else t.pattern??=go();J.init(e,t)}),as=U(`$ZodEmail`,(e,t)=>{t.pattern??=_o,J.init(e,t)}),os=U(`$ZodURL`,(e,t)=>{J.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.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&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(`:`)?i.protocol.slice(0,-1):i.protocol)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=i.href:n.value=r;return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),ss=U(`$ZodEmoji`,(e,t)=>{t.pattern??=yo(),J.init(e,t)}),cs=U(`$ZodNanoID`,(e,t)=>{t.pattern??=po,J.init(e,t)}),ls=U(`$ZodCUID`,(e,t)=>{t.pattern??=so,J.init(e,t)}),us=U(`$ZodCUID2`,(e,t)=>{t.pattern??=co,J.init(e,t)}),ds=U(`$ZodULID`,(e,t)=>{t.pattern??=lo,J.init(e,t)}),fs=U(`$ZodXID`,(e,t)=>{t.pattern??=uo,J.init(e,t)}),ps=U(`$ZodKSUID`,(e,t)=>{t.pattern??=fo,J.init(e,t)}),ms=U(`$ZodISODateTime`,(e,t)=>{t.pattern??=jo(t),J.init(e,t)}),hs=U(`$ZodISODate`,(e,t)=>{t.pattern??=Oo,J.init(e,t)}),gs=U(`$ZodISOTime`,(e,t)=>{t.pattern??=Ao(t),J.init(e,t)}),_s=U(`$ZodISODuration`,(e,t)=>{t.pattern??=mo,J.init(e,t)}),vs=U(`$ZodIPv4`,(e,t)=>{t.pattern??=bo,J.init(e,t),e._zod.bag.format=`ipv4`}),ys=U(`$ZodIPv6`,(e,t)=>{t.pattern??=xo,J.init(e,t),e._zod.bag.format=`ipv6`,e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}}),bs=U(`$ZodCIDRv4`,(e,t)=>{t.pattern??=So,J.init(e,t)}),xs=U(`$ZodCIDRv6`,(e,t)=>{t.pattern??=Co,J.init(e,t),e._zod.check=n=>{let r=n.value.split(`/`);try{if(r.length!==2)throw Error();let[e,t]=r;if(!t)throw Error();let n=Number(t);if(`${n}`!==t||n<0||n>128)throw Error();new URL(`http://[${e}]`)}catch{n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}}});function Ss(e){if(e===``)return!0;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var Cs=U(`$ZodBase64`,(e,t)=>{t.pattern??=wo,J.init(e,t),e._zod.bag.contentEncoding=`base64`,e._zod.check=n=>{Ss(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function ws(e){if(!To.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return Ss(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var Ts=U(`$ZodBase64URL`,(e,t)=>{t.pattern??=To,J.init(e,t),e._zod.bag.contentEncoding=`base64url`,e._zod.check=n=>{ws(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),Es=U(`$ZodE164`,(e,t)=>{t.pattern??=Eo,J.init(e,t)});function Ds(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 Os=U(`$ZodJWT`,(e,t)=>{J.init(e,t),e._zod.check=n=>{Ds(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),ks=U(`$ZodNumber`,(e,t)=>{q.init(e,t),e._zod.pattern=e._zod.bag.pattern??Po,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:`Infinity`:void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),As=U(`$ZodNumberFormat`,(e,t)=>{Ho.init(e,t),ks.init(e,t)}),js=U(`$ZodBoolean`,(e,t)=>{q.init(e,t),e._zod.pattern=Fo,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}}),Ms=U(`$ZodUnknown`,(e,t)=>{q.init(e,t),e._zod.parse=e=>e}),Ns=U(`$ZodNever`,(e,t)=>{q.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function Ps(e,t,n){e.issues.length&&t.issues.push(...La(n,e.issues)),t.value[n]=e.value}var Fs=U(`$ZodArray`,(e,t)=>{q.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:`array`,code:`invalid_type`,input:i,inst:e}),n;n.value=Array(i.length);let a=[];for(let e=0;e<i.length;e++){let o=i[e],s=t.element._zod.run({value:o,issues:[]},r);s instanceof Promise?a.push(s.then(t=>Ps(t,n,e))):Ps(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function Is(e,t,n,r,i){if(e.issues.length){if(i&&!(n in r))return;t.issues.push(...La(n,e.issues))}e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}function Ls(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${n}": expected a Zod schema`);let n=Da(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function Rs(e,t,n,r,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type,u=c.optout===`optional`;for(let i in t){if(s.has(i))continue;if(l===`never`){o.push(i);continue}let a=c.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>Is(e,n,i,t,u))):Is(a,n,i,t,u)}return o.length&&n.issues.push({code:`unrecognized_keys`,keys:o,input:t,inst:a}),e.length?Promise.all(e).then(()=>n):n}var zs=U(`$ZodObject`,(e,t)=>{if(q.init(e,t),!Object.getOwnPropertyDescriptor(t,`shape`)?.get){let e=t.shape;Object.defineProperty(t,`shape`,{get:()=>{let n={...e};return Object.defineProperty(t,`shape`,{value:n}),n}})}let n=ua(()=>Ls(t));W(e._zod,`propValues`,()=>{let e=t.shape,n={};for(let t in e){let r=e[t]._zod;if(r.values){n[t]??(n[t]=new Set);for(let e of r.values)n[t].add(e)}}return n});let r=ba,i=t.catchall,a;e._zod.parse=(t,o)=>{a??=n.value;let s=t.value;if(!r(s))return t.issues.push({expected:`object`,code:`invalid_type`,input:s,inst:e}),t;t.value={};let c=[],l=a.shape;for(let e of a.keys){let n=l[e],r=n._zod.optout===`optional`,i=n._zod.run({value:s[e],issues:[]},o);i instanceof Promise?c.push(i.then(n=>Is(n,t,e,s,r))):Is(i,t,e,s,r)}return i?Rs(c,s,t,o,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),Bs=U(`$ZodObjectJIT`,(e,t)=>{zs.init(e,t);let n=e._zod.parse,r=ua(()=>Ls(t)),i=e=>{let t=new es([`shape`,`payload`,`ctx`]),n=r.value,i=e=>{let t=_a(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write(`const input = payload.value;`);let a=Object.create(null),o=0;for(let e of n.keys)a[e]=`key_${o++}`;t.write(`const newResult = {};`);for(let r of n.keys){let n=a[r],o=_a(r),s=e[r]?._zod?.optout===`optional`;t.write(`const ${n} = ${i(r)};`),s?t.write(`
|
|
4
|
+
if (${n}.issues.length) {
|
|
5
|
+
if (${o} in input) {
|
|
6
|
+
payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
|
|
7
|
+
...iss,
|
|
8
|
+
path: iss.path ? [${o}, ...iss.path] : [${o}]
|
|
9
|
+
})));
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
if (${n}.value === undefined) {
|
|
14
|
+
if (${o} in input) {
|
|
15
|
+
newResult[${o}] = undefined;
|
|
16
|
+
}
|
|
17
|
+
} else {
|
|
18
|
+
newResult[${o}] = ${n}.value;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
`):t.write(`
|
|
22
|
+
if (${n}.issues.length) {
|
|
23
|
+
payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
|
|
24
|
+
...iss,
|
|
25
|
+
path: iss.path ? [${o}, ...iss.path] : [${o}]
|
|
26
|
+
})));
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (${n}.value === undefined) {
|
|
30
|
+
if (${o} in input) {
|
|
31
|
+
newResult[${o}] = undefined;
|
|
32
|
+
}
|
|
33
|
+
} else {
|
|
34
|
+
newResult[${o}] = ${n}.value;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
`)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},a,o=ba,s=!oa.jitless,c=s&&xa.value,l=t.catchall,u;e._zod.parse=(d,f)=>{u??=r.value;let p=d.value;return o(p)?s&&c&&f?.async===!1&&f.jitless!==!0?(a||=i(t.shape),d=a(d,f),l?Rs([],p,d,f,u,e):d):n(d,f):(d.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),d)}});function Vs(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=>!Ia(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=>za(e,r,sa())))}),t)}var Hs=U(`$ZodUnion`,(e,t)=>{q.init(e,t),W(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),W(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),W(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),W(e._zod,`pattern`,()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>fa(e.source)).join(`|`)})$`)}});let n=t.options.length===1,r=t.options[0]._zod.run;e._zod.parse=(i,a)=>{if(n)return r(i,a);let o=!1,s=[];for(let e of t.options){let t=e._zod.run({value:i.value,issues:[]},a);if(t instanceof Promise)s.push(t),o=!0;else{if(t.issues.length===0)return t;s.push(t)}}return o?Promise.all(s).then(t=>Vs(t,i,e,a)):Vs(s,i,e,a)}}),Us=U(`$ZodIntersection`,(e,t)=>{q.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])=>Gs(e,t,n)):Gs(e,i,a)}});function Ws(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Sa(e)&&Sa(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=Ws(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=Ws(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 Gs(e,t,n){let r=new Map,i;for(let n of t.issues)if(n.code===`unrecognized_keys`){i??=n;for(let e of n.keys)r.has(e)||r.set(e,{}),r.get(e).l=!0}else e.issues.push(n);for(let t of n.issues)if(t.code===`unrecognized_keys`)for(let e of t.keys)r.has(e)||r.set(e,{}),r.get(e).r=!0;else e.issues.push(t);let a=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(a.length&&i&&e.issues.push({...i,keys:a}),Ia(e))return e;let o=Ws(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}var Ks=U(`$ZodEnum`,(e,t)=>{q.init(e,t);let n=ca(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>wa.has(typeof e)).map(e=>typeof e==`string`?Ta(e):e.toString()).join(`|`)})$`),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}}),qs=U(`$ZodLiteral`,(e,t)=>{if(q.init(e,t),t.values.length===0)throw Error(`Cannot create literal schema with no valid values`);let n=new Set(t.values);e._zod.values=n,e._zod.pattern=RegExp(`^(${t.values.map(e=>typeof e==`string`?Ta(e):e?Ta(e.toString()):String(e)).join(`|`)})$`),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}}),Js=U(`$ZodTransform`,(e,t)=>{q.init(e,t),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new aa(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 ia;return n.value=i,n}});function Ys(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}var Xs=U(`$ZodOptional`,(e,t)=>{q.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,W(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),W(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${fa(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(t.innerType._zod.optin===`optional`){let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(t=>Ys(t,e.value)):Ys(r,e.value)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),Zs=U(`$ZodExactOptional`,(e,t)=>{Xs.init(e,t),W(e._zod,`values`,()=>t.innerType._zod.values),W(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),Qs=U(`$ZodNullable`,(e,t)=>{q.init(e,t),W(e._zod,`optin`,()=>t.innerType._zod.optin),W(e._zod,`optout`,()=>t.innerType._zod.optout),W(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${fa(e.source)}|null)$`):void 0}),W(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),$s=U(`$ZodDefault`,(e,t)=>{q.init(e,t),e._zod.optin=`optional`,W(e._zod,`values`,()=>t.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=>ec(e,t)):ec(r,t)}});function ec(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var tc=U(`$ZodPrefault`,(e,t)=>{q.init(e,t),e._zod.optin=`optional`,W(e._zod,`values`,()=>t.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))}),nc=U(`$ZodNonOptional`,(e,t)=>{q.init(e,t),W(e._zod,`values`,()=>{let e=t.innerType._zod.values;return e?new Set([...e].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=>rc(t,e)):rc(i,e)}});function rc(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}var ic=U(`$ZodCatch`,(e,t)=>{q.init(e,t),W(e._zod,`optin`,()=>t.innerType._zod.optin),W(e._zod,`optout`,()=>t.innerType._zod.optout),W(e._zod,`values`,()=>t.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(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>za(e,n,sa()))},input:e.value}),e.issues=[]),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>za(e,n,sa()))},input:e.value}),e.issues=[]),e)}}),ac=U(`$ZodPipe`,(e,t)=>{q.init(e,t),W(e._zod,`values`,()=>t.in._zod.values),W(e._zod,`optin`,()=>t.in._zod.optin),W(e._zod,`optout`,()=>t.out._zod.optout),W(e._zod,`propValues`,()=>t.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=>oc(e,t.in,n)):oc(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>oc(e,t.out,n)):oc(r,t.out,n)}});function oc(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}var sc=U(`$ZodReadonly`,(e,t)=>{q.init(e,t),W(e._zod,`propValues`,()=>t.innerType._zod.propValues),W(e._zod,`values`,()=>t.innerType._zod.values),W(e._zod,`optin`,()=>t.innerType?._zod?.optin),W(e._zod,`optout`,()=>t.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(cc):cc(r)}});function cc(e){return e.value=Object.freeze(e.value),e}var lc=U(`$ZodCustom`,(e,t)=>{K.init(e,t),q.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=>uc(t,n,r,e));uc(i,n,r,e)}});function uc(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(Va(e))}}var dc,fc=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 pc(){return new fc}(dc=globalThis).__zod_globalRegistry??(dc.__zod_globalRegistry=pc());var mc=globalThis.__zod_globalRegistry;function hc(e,t){return new e({type:`string`,...G(t)})}function gc(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...G(t)})}function _c(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...G(t)})}function vc(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...G(t)})}function yc(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...G(t)})}function bc(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...G(t)})}function xc(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...G(t)})}function Sc(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...G(t)})}function Cc(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...G(t)})}function wc(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...G(t)})}function Tc(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...G(t)})}function Ec(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...G(t)})}function Dc(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...G(t)})}function Oc(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...G(t)})}function kc(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...G(t)})}function Ac(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...G(t)})}function jc(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...G(t)})}function Mc(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...G(t)})}function Nc(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...G(t)})}function Pc(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...G(t)})}function Fc(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...G(t)})}function Ic(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...G(t)})}function Lc(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...G(t)})}function Rc(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...G(t)})}function zc(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...G(t)})}function Bc(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...G(t)})}function Vc(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...G(t)})}function Hc(e,t){return new e({type:`number`,checks:[],...G(t)})}function Uc(e,t){return new e({type:`number`,coerce:!0,checks:[],...G(t)})}function Wc(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...G(t)})}function Gc(e,t){return new e({type:`boolean`,...G(t)})}function Kc(e){return new e({type:`unknown`})}function qc(e,t){return new e({type:`never`,...G(t)})}function Jc(e,t){return new zo({check:`less_than`,...G(t),value:e,inclusive:!1})}function Yc(e,t){return new zo({check:`less_than`,...G(t),value:e,inclusive:!0})}function Xc(e,t){return new Bo({check:`greater_than`,...G(t),value:e,inclusive:!1})}function Zc(e,t){return new Bo({check:`greater_than`,...G(t),value:e,inclusive:!0})}function Qc(e,t){return new Vo({check:`multiple_of`,...G(t),value:e})}function $c(e,t){return new Uo({check:`max_length`,...G(t),maximum:e})}function el(e,t){return new Wo({check:`min_length`,...G(t),minimum:e})}function tl(e,t){return new Go({check:`length_equals`,...G(t),length:e})}function nl(e,t){return new qo({check:`string_format`,format:`regex`,...G(t),pattern:e})}function rl(e){return new Jo({check:`string_format`,format:`lowercase`,...G(e)})}function il(e){return new Yo({check:`string_format`,format:`uppercase`,...G(e)})}function al(e,t){return new Xo({check:`string_format`,format:`includes`,...G(t),includes:e})}function ol(e,t){return new Zo({check:`string_format`,format:`starts_with`,...G(t),prefix:e})}function sl(e,t){return new Qo({check:`string_format`,format:`ends_with`,...G(t),suffix:e})}function cl(e){return new $o({check:`overwrite`,tx:e})}function ll(e){return cl(t=>t.normalize(e))}function ul(){return cl(e=>e.trim())}function dl(){return cl(e=>e.toLowerCase())}function fl(){return cl(e=>e.toUpperCase())}function pl(){return cl(e=>va(e))}function ml(e,t,n){return new e({type:`array`,element:t,...G(n)})}function hl(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...G(n)})}function gl(e){let t=_l(n=>(n.addIssue=e=>{if(typeof e==`string`)n.issues.push(Va(e,n.value,t._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,r.input??=n.value,r.inst??=t,r.continue??=!t._zod.def.abort,n.issues.push(Va(r))}},e(n.value,n)));return t}function _l(e,t){let n=new K({check:`custom`,...G(t)});return n._zod.check=e,n}function vl(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??mc,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,external:e?.external??void 0}}function Y(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);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,Y(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(o.schema,c),t.io===`input`&&X(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&o.schema._prefault&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function yl(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);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}/${a}`}}if(t[1]===n)return{ref:`#`};let i=`#/${r}/`,a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+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>
|
|
38
|
+
|
|
39
|
+
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}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function bl(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)):Object.assign(i,s),Object.assign(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??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);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)}Object.assign(i,n.def??n.schema);let a=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(a[e.defId]=e.def)}e.external||Object.keys(a).length>0&&(e.target===`draft-2020-12`?i.$defs=a:i.definitions=a);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,`~standard`,{value:{...t[`~standard`],jsonSchema:{input:Sl(t,`input`,e.processors),output:Sl(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function X(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 X(r.element,n);if(r.type===`set`)return X(r.valueType,n);if(r.type===`lazy`)return X(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`)return X(r.innerType,n);if(r.type===`intersection`)return X(r.left,n)||X(r.right,n);if(r.type===`record`||r.type===`map`)return X(r.keyType,n)||X(r.valueType,n);if(r.type===`pipe`)return X(r.in,n)||X(r.out,n);if(r.type===`object`){for(let e in r.shape)if(X(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(X(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(X(e,n))return!0;return!!(r.rest&&X(r.rest,n))}return!1}var xl=(e,t={})=>n=>{let r=vl({...n,processors:t});return Y(e,r),yl(r,e),bl(r,e)},Sl=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=vl({...i??{},target:a,io:t,processors:n});return Y(e,o),yl(o,e),bl(o,e)},Cl={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},wl=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=Cl[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];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}))])}},Tl=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;typeof s==`string`&&s.includes(`int`)?i.type=`integer`:i.type=`number`,typeof u==`number`&&(t.target===`draft-04`||t.target===`openapi-3.0`?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u),typeof a==`number`&&(i.minimum=a,typeof u==`number`&&t.target!==`draft-04`&&(u>=a?delete i.minimum:delete i.exclusiveMinimum)),typeof l==`number`&&(t.target===`draft-04`||t.target===`openapi-3.0`?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l),typeof o==`number`&&(i.maximum=o,typeof l==`number`&&t.target!==`draft-04`&&(l<=o?delete i.maximum:delete i.exclusiveMaximum)),typeof c==`number`&&(i.multipleOf=c)},El=(e,t,n,r)=>{n.type=`boolean`},Dl=(e,t,n,r)=>{n.not={}},Ol=(e,t,n,r)=>{let i=e._zod.def,a=ca(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},kl=(e,t,n,r)=>{let i=e._zod.def,a=[];for(let e of i.values)if(e===void 0){if(t.unrepresentable===`throw`)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof e==`bigint`){if(t.unrepresentable===`throw`)throw Error(`BigInt literals cannot be represented in JSON Schema`);a.push(Number(e))}else a.push(e);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},Al=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},jl=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},Ml=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=Y(a.element,t,{...r,path:[...r.path,`items`]})},Nl=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=Y(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=Y(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Pl=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>Y(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Fl=(e,t,n,r)=>{let i=e._zod.def,a=Y(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=Y(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},Il=(e,t,n,r)=>{let i=e._zod.def,a=Y(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`}]},Ll=(e,t,n,r)=>{let i=e._zod.def;Y(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Rl=(e,t,n,r)=>{let i=e._zod.def;Y(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},zl=(e,t,n,r)=>{let i=e._zod.def;Y(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},Bl=(e,t,n,r)=>{let i=e._zod.def;Y(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},Vl=(e,t,n,r)=>{let i=e._zod.def,a=t.io===`input`?i.in._zod.def.type===`transform`?i.out:i.in:i.out;Y(a,t,r);let o=t.seen.get(e);o.ref=a},Hl=(e,t,n,r)=>{let i=e._zod.def;Y(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},Ul=(e,t,n,r)=>{let i=e._zod.def;Y(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Wl=U(`ZodISODateTime`,(e,t)=>{ms.init(e,t),$.init(e,t)});function Gl(e){return Rc(Wl,e)}var Kl=U(`ZodISODate`,(e,t)=>{hs.init(e,t),$.init(e,t)});function ql(e){return zc(Kl,e)}var Jl=U(`ZodISOTime`,(e,t)=>{gs.init(e,t),$.init(e,t)});function Yl(e){return Bc(Jl,e)}var Xl=U(`ZodISODuration`,(e,t)=>{_s.init(e,t),$.init(e,t)});function Zl(e){return Vc(Xl,e)}var Ql=(e,t)=>{Ua.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>Ka(e,t)},flatten:{value:t=>Ga(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,la,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,la,2)}},isEmpty:{get(){return e.issues.length===0}}})};U(`ZodError`,Ql);var Z=U(`ZodError`,Ql,{Parent:Error}),$l=qa(Z),eu=Ja(Z),tu=Ya(Z),nu=Za(Z),ru=$a(Z),iu=eo(Z),au=to(Z),ou=no(Z),su=ro(Z),cu=io(Z),lu=ao(Z),uu=oo(Z),Q=U(`ZodType`,(e,t)=>(q.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:Sl(e,`input`),output:Sl(e,`output`)}}),e.toJSONSchema=xl(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,`_def`,{value:t}),e.check=(...n)=>e.clone(ga(t,{checks:[...t.checks??[],...n.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0}),e.with=e.check,e.clone=(t,n)=>Ea(e,t,n),e.brand=()=>e,e.register=((t,n)=>(t.add(e,n),e)),e.parse=(t,n)=>$l(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>tu(e,t,n),e.parseAsync=async(t,n)=>eu(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>nu(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>ru(e,t,n),e.decode=(t,n)=>iu(e,t,n),e.encodeAsync=async(t,n)=>au(e,t,n),e.decodeAsync=async(t,n)=>ou(e,t,n),e.safeEncode=(t,n)=>su(e,t,n),e.safeDecode=(t,n)=>cu(e,t,n),e.safeEncodeAsync=async(t,n)=>lu(e,t,n),e.safeDecodeAsync=async(t,n)=>uu(e,t,n),e.refine=(t,n)=>e.check(Sd(t,n)),e.superRefine=t=>e.check(Cd(t)),e.overwrite=t=>e.check(cl(t)),e.optional=()=>id(e),e.exactOptional=()=>od(e),e.nullable=()=>cd(e),e.nullish=()=>id(cd(e)),e.nonoptional=t=>md(e,t),e.array=()=>Wu(e),e.or=t=>Ju([e,t]),e.and=t=>Xu(e,t),e.transform=t=>vd(e,nd(t)),e.default=t=>ud(e,t),e.prefault=t=>fd(e,t),e.catch=t=>gd(e,t),e.pipe=t=>vd(e,t),e.readonly=()=>bd(e),e.describe=t=>{let n=e.clone();return mc.add(n,{description:t}),n},Object.defineProperty(e,`description`,{get(){return mc.get(e)?.description},configurable:!0}),e.meta=(...t)=>{if(t.length===0)return mc.get(e);let n=e.clone();return mc.add(n,t[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=t=>t(e),e)),du=U(`_ZodString`,(e,t)=>{ns.init(e,t),Q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>wl(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...t)=>e.check(nl(...t)),e.includes=(...t)=>e.check(al(...t)),e.startsWith=(...t)=>e.check(ol(...t)),e.endsWith=(...t)=>e.check(sl(...t)),e.min=(...t)=>e.check(el(...t)),e.max=(...t)=>e.check($c(...t)),e.length=(...t)=>e.check(tl(...t)),e.nonempty=(...t)=>e.check(el(1,...t)),e.lowercase=t=>e.check(rl(t)),e.uppercase=t=>e.check(il(t)),e.trim=()=>e.check(ul()),e.normalize=(...t)=>e.check(ll(...t)),e.toLowerCase=()=>e.check(dl()),e.toUpperCase=()=>e.check(fl()),e.slugify=()=>e.check(pl())}),fu=U(`ZodString`,(e,t)=>{ns.init(e,t),du.init(e,t),e.email=t=>e.check(gc(mu,t)),e.url=t=>e.check(Sc(_u,t)),e.jwt=t=>e.check(Lc(Mu,t)),e.emoji=t=>e.check(Cc(vu,t)),e.guid=t=>e.check(_c(hu,t)),e.uuid=t=>e.check(vc(gu,t)),e.uuidv4=t=>e.check(yc(gu,t)),e.uuidv6=t=>e.check(bc(gu,t)),e.uuidv7=t=>e.check(xc(gu,t)),e.nanoid=t=>e.check(wc(yu,t)),e.guid=t=>e.check(_c(hu,t)),e.cuid=t=>e.check(Tc(bu,t)),e.cuid2=t=>e.check(Ec(xu,t)),e.ulid=t=>e.check(Dc(Su,t)),e.base64=t=>e.check(Pc(ku,t)),e.base64url=t=>e.check(Fc(Au,t)),e.xid=t=>e.check(Oc(Cu,t)),e.ksuid=t=>e.check(kc(wu,t)),e.ipv4=t=>e.check(Ac(Tu,t)),e.ipv6=t=>e.check(jc(Eu,t)),e.cidrv4=t=>e.check(Mc(Du,t)),e.cidrv6=t=>e.check(Nc(Ou,t)),e.e164=t=>e.check(Ic(ju,t)),e.datetime=t=>e.check(Gl(t)),e.date=t=>e.check(ql(t)),e.time=t=>e.check(Yl(t)),e.duration=t=>e.check(Zl(t))});function pu(e){return hc(fu,e)}var $=U(`ZodStringFormat`,(e,t)=>{J.init(e,t),du.init(e,t)}),mu=U(`ZodEmail`,(e,t)=>{as.init(e,t),$.init(e,t)}),hu=U(`ZodGUID`,(e,t)=>{rs.init(e,t),$.init(e,t)}),gu=U(`ZodUUID`,(e,t)=>{is.init(e,t),$.init(e,t)}),_u=U(`ZodURL`,(e,t)=>{os.init(e,t),$.init(e,t)}),vu=U(`ZodEmoji`,(e,t)=>{ss.init(e,t),$.init(e,t)}),yu=U(`ZodNanoID`,(e,t)=>{cs.init(e,t),$.init(e,t)}),bu=U(`ZodCUID`,(e,t)=>{ls.init(e,t),$.init(e,t)}),xu=U(`ZodCUID2`,(e,t)=>{us.init(e,t),$.init(e,t)}),Su=U(`ZodULID`,(e,t)=>{ds.init(e,t),$.init(e,t)}),Cu=U(`ZodXID`,(e,t)=>{fs.init(e,t),$.init(e,t)}),wu=U(`ZodKSUID`,(e,t)=>{ps.init(e,t),$.init(e,t)}),Tu=U(`ZodIPv4`,(e,t)=>{vs.init(e,t),$.init(e,t)}),Eu=U(`ZodIPv6`,(e,t)=>{ys.init(e,t),$.init(e,t)}),Du=U(`ZodCIDRv4`,(e,t)=>{bs.init(e,t),$.init(e,t)}),Ou=U(`ZodCIDRv6`,(e,t)=>{xs.init(e,t),$.init(e,t)}),ku=U(`ZodBase64`,(e,t)=>{Cs.init(e,t),$.init(e,t)}),Au=U(`ZodBase64URL`,(e,t)=>{Ts.init(e,t),$.init(e,t)}),ju=U(`ZodE164`,(e,t)=>{Es.init(e,t),$.init(e,t)}),Mu=U(`ZodJWT`,(e,t)=>{Os.init(e,t),$.init(e,t)}),Nu=U(`ZodNumber`,(e,t)=>{ks.init(e,t),Q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Tl(e,t,n,r),e.gt=(t,n)=>e.check(Xc(t,n)),e.gte=(t,n)=>e.check(Zc(t,n)),e.min=(t,n)=>e.check(Zc(t,n)),e.lt=(t,n)=>e.check(Jc(t,n)),e.lte=(t,n)=>e.check(Yc(t,n)),e.max=(t,n)=>e.check(Yc(t,n)),e.int=t=>e.check(Iu(t)),e.safe=t=>e.check(Iu(t)),e.positive=t=>e.check(Xc(0,t)),e.nonnegative=t=>e.check(Zc(0,t)),e.negative=t=>e.check(Jc(0,t)),e.nonpositive=t=>e.check(Yc(0,t)),e.multipleOf=(t,n)=>e.check(Qc(t,n)),e.step=(t,n)=>e.check(Qc(t,n)),e.finite=()=>e;let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function Pu(e){return Hc(Nu,e)}var Fu=U(`ZodNumberFormat`,(e,t)=>{As.init(e,t),Nu.init(e,t)});function Iu(e){return Wc(Fu,e)}var Lu=U(`ZodBoolean`,(e,t)=>{js.init(e,t),Q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>El(e,t,n,r)});function Ru(e){return Gc(Lu,e)}var zu=U(`ZodUnknown`,(e,t)=>{Ms.init(e,t),Q.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Bu(){return Kc(zu)}var Vu=U(`ZodNever`,(e,t)=>{Ns.init(e,t),Q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Dl(e,t,n,r)});function Hu(e){return qc(Vu,e)}var Uu=U(`ZodArray`,(e,t)=>{Fs.init(e,t),Q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ml(e,t,n,r),e.element=t.element,e.min=(t,n)=>e.check(el(t,n)),e.nonempty=t=>e.check(el(1,t)),e.max=(t,n)=>e.check($c(t,n)),e.length=(t,n)=>e.check(tl(t,n)),e.unwrap=()=>e.element});function Wu(e,t){return ml(Uu,e,t)}var Gu=U(`ZodObject`,(e,t)=>{Bs.init(e,t),Q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Nl(e,t,n,r),W(e,`shape`,()=>t.shape),e.keyof=()=>Qu(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Bu()}),e.loose=()=>e.clone({...e._zod.def,catchall:Bu()}),e.strict=()=>e.clone({...e._zod.def,catchall:Hu()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>ja(e,t),e.safeExtend=t=>Ma(e,t),e.merge=t=>Na(e,t),e.pick=t=>ka(e,t),e.omit=t=>Aa(e,t),e.partial=(...t)=>Pa(rd,e,t[0]),e.required=(...t)=>Fa(pd,e,t[0])});function Ku(e,t){return new Gu({type:`object`,shape:e??{},...G(t)})}var qu=U(`ZodUnion`,(e,t)=>{Hs.init(e,t),Q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Pl(e,t,n,r),e.options=t.options});function Ju(e,t){return new qu({type:`union`,options:e,...G(t)})}var Yu=U(`ZodIntersection`,(e,t)=>{Us.init(e,t),Q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Fl(e,t,n,r)});function Xu(e,t){return new Yu({type:`intersection`,left:e,right:t})}var Zu=U(`ZodEnum`,(e,t)=>{Ks.init(e,t),Q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ol(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);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 Zu({...t,checks:[],...G(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 Zu({...t,checks:[],...G(r),entries:i})}});function Qu(e,t){return new Zu({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...G(t)})}var $u=U(`ZodLiteral`,(e,t)=>{qs.init(e,t),Q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>kl(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 ed(e,t){return new $u({type:`literal`,values:Array.isArray(e)?e:[e],...G(t)})}var td=U(`ZodTransform`,(e,t)=>{Js.init(e,t),Q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>jl(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new aa(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Va(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(Va(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function nd(e){return new td({type:`transform`,transform:e})}var rd=U(`ZodOptional`,(e,t)=>{Xs.init(e,t),Q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ul(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function id(e){return new rd({type:`optional`,innerType:e})}var ad=U(`ZodExactOptional`,(e,t)=>{Zs.init(e,t),Q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ul(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function od(e){return new ad({type:`optional`,innerType:e})}var sd=U(`ZodNullable`,(e,t)=>{Qs.init(e,t),Q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Il(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function cd(e){return new sd({type:`nullable`,innerType:e})}var ld=U(`ZodDefault`,(e,t)=>{$s.init(e,t),Q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Rl(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function ud(e,t){return new ld({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():Ca(t)}})}var dd=U(`ZodPrefault`,(e,t)=>{tc.init(e,t),Q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>zl(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function fd(e,t){return new dd({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():Ca(t)}})}var pd=U(`ZodNonOptional`,(e,t)=>{nc.init(e,t),Q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ll(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function md(e,t){return new pd({type:`nonoptional`,innerType:e,...G(t)})}var hd=U(`ZodCatch`,(e,t)=>{ic.init(e,t),Q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Bl(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function gd(e,t){return new hd({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var _d=U(`ZodPipe`,(e,t)=>{ac.init(e,t),Q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Vl(e,t,n,r),e.in=t.in,e.out=t.out});function vd(e,t){return new _d({type:`pipe`,in:e,out:t})}var yd=U(`ZodReadonly`,(e,t)=>{sc.init(e,t),Q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Hl(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function bd(e){return new yd({type:`readonly`,innerType:e})}var xd=U(`ZodCustom`,(e,t)=>{lc.init(e,t),Q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Al(e,t,n,r)});function Sd(e,t={}){return hl(xd,e,t)}function Cd(e){return gl(e)}export{Jn as $,qe as $t,ai as A,le as An,Rt as At,Dr as B,ft as Bt,mi as C,R as Cn,dn as Ct,si as D,ge as Dn,Yt as Dt,li as E,he as En,en as Et,H as F,B as Ft,fr as G,Ve as Gt,Er as H,dt as Ht,Hr as I,gt as It,mr as J,Ke as Jt,dr as K,We as Kt,Rr as L,_t as Lt,ni as M,k as Mn,Ht as Mt,qr as N,O as Nn,Ut as Nt,ci as O,_e as On,Xt as Ot,Jr as P,re as Pn,ht as Pt,qn as Q,Qe as Qt,Or as R,mt as Rt,hi as S,ye as Sn,fn as St,pi as T,ve as Tn,sn as Tt,Sr as U,vt as Ut,Tr as V,bt as Vt,br as W,Ue as Wt,Xn as X,Ze as Xt,Qn as Y,Xe as Yt,Yn as Z,Je as Zt,Ii as _,we as _n,_n as _t,ed as a,Re as an,Bn as at,Mi as b,Ce as bn,hn as bt,pu as c,ze as cn,In as ct,na as d,Pe as dn,xn as dt,at as en,Wn as et,Xi as f,Me as fn,bn as ft,Li as g,De as gn,pn as gt,Ri as h,Oe as hn,Sn as ht,Ru as i,Ye as in,Vn as it,ii as j,A as jn,Vt as jt,oi as k,ue as kn,qt as kt,Uc as l,Ie as ln,En as lt,qi as m,Ae as mn,vn as mt,Qu as n,ct as nn,V as nt,Pu as o,Le as on,Rn as ot,Yi as p,Ne as pn,Tn as pt,pr as q,Be as qt,Wu as r,Ge as rn,Hn as rt,Ku as s,lt as sn,Ln as st,Nu as t,ot as tn,Un as tt,ra as u,Fe as un,Cn as ut,Fi as v,xe as vn,wn as vt,di as w,be as wn,un as wt,yi as x,Ee as xn,mn as xt,Pi as y,Te as yn,gn as yt,kr as z,pt as zt};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{R as e,it as t,nt as n,st as r}from"./button-C0MQwO-R.js";import{M as i,a,c as o,d as s,i as c,l,o as u,p as d,s as f,w as p}from"./sync-persistence-f8LlQoHO.js";n();var m=r(t(),1),h=(0,m.createContext)(void 0);function g(){return(0,m.useContext)(h)}var _=Symbol(`liveQueryResultInfo`);function v(e,t){Object.defineProperty(e,_,{configurable:!0,value:t})}function y(e){try{return!1}catch{return!1}try{return{}[e]!==`1`}catch{return!0}}var b=new WeakMap,x=0;function S(e){let t=b.get(e);return t===void 0&&(t=++x,b.set(e,t)),t}function C(e,t,n){return a(e,!t&&n?e=>{throw Error(`[${n}] Collection descriptor "${e}" requires a DbClient when the query is consumed. Wrap this component in <DbProvider client={client}> or use a concrete Collection.`)}:void 0)}function w(){return{unscoped:new Map,byClient:new WeakMap}}function T(e,t,n,r,i){let a=n?e.byClient.get(n):e.unscoped,o=new Map;for(let e of C(t,n,r)){let t=S(e),n=o.get(e.id)??a?.get(e.id);if(n!==void 0&&n!==t)throw i(),Error(`[${r}] Source Collection "${e.id}" was replaced by a different Collection with the same ID while this hook is mounted. Unmount the hook and clean up its previous source and client scope before reusing the ID.`);o.set(e.id,t)}let s=a??new Map;for(let[e,t]of o)s.set(e,t);n&&e.byClient.set(n,s)}var E=1,D=5e3,O=16,k=10,A=50,j=new Set,M=new Set,N=new Set,P=Symbol(`unpreparedQueryValue`),F=new Map,I=new WeakMap;function L(e,t,n){let r=C(e,n,`useLiveSuspenseQuery`).map(S);return r.length===0?t:`${r.join(`,`)}:${t}`}function R(e){if(!e)return F;let t=I.get(e);return t||(t=new Map,I.set(e,t)),t}function z(e,t,n){let r=e.get(t);r?.collection===n&&(e.delete(t),r.removeStatusListeners())}function B(e=`useLiveQuery`){if(!y(`TANSTACK_DB_DISABLE_DEPRECATION_WARNINGS`))return;let t=H(4);j.has(t)||(j.add(t),console.warn(`[${e}] The dependency-array form is deprecated and will be removed in 1.0. Use ${e===`useLiveQuery`?`useLiveQuery({ query })`:`useLiveInfiniteQuery(query, { queryKey })`} instead. Provide queryKey only for functional/opaque queries or to avoid deriving identity from structured query IR on render.`))}function V(){return typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now()}function H(e){let t=Error().stack??`unknown`,n=t.split(`
|
|
2
2
|
`);return n.slice(1).find(e=>!e.includes(`useLiveQuery.ts`)&&!e.includes(`useLiveSuspenseQuery.ts`)&&!e.includes(`useLiveInfiniteQuery.ts`))?.trim()??n[e]?.trim()??t}function U(e,t){if(e.warned||!y(`TANSTACK_DB_DISABLE_QUERY_IDENTITY_WARNINGS`))return;let n=t>=O,r=e.renderCount>=k&&e.totalMs>=A;if(!n&&!r)return;let i=H(5);if(M.has(i)){e.warned=!0;return}M.add(i),e.warned=!0;let a=n?`one render took ${t.toFixed(1)}ms`:`${e.renderCount} renders took ${e.totalMs.toFixed(1)}ms`;console.warn(`[useLiveQuery] Deriving live query identity from structured query IR is running on a hot render path (${a}, max ${e.maxMs.toFixed(1)}ms). Provide an explicit queryKey to skip rebuilding and hashing the IR on every render: useLiveQuery({ queryKey: [...], query }).`)}function W(e){return e&&typeof e==`object`&&Array.isArray(e.queryKey)?e.queryKey:void 0}function G(e){return e&&typeof e==`object`&&`client`in e&&e.client!==void 0?e.client:void 0}function K(e,t,n){return u(e,t,n)}function q(e,t,n,r){let a=y(`TANSTACK_DB_DISABLE_QUERY_IDENTITY_WARNINGS`),o=a?V():0,s=K(e,t,r);try{return{status:`hashable`,value:s,identityDeps:[`derived`,c(s)]}}catch(e){if(e instanceof i)return{status:`unhashable`,value:s,error:e};throw e}finally{if(a){let e=V()-o;n.renderCount+=1,n.totalMs+=e,n.maxMs=Math.max(n.maxMs,e),U(n,e)}}}function J(e){if(!y(`TANSTACK_DB_DISABLE_QUERY_IDENTITY_WARNINGS`))return;let t=H(4);N.has(t)||(N.add(t),console.warn(`[useLiveQuery] This query cannot derive a stable identity because ${e.reason} at ${e.path}. It will keep the legacy mount-stable behavior for now. Add queryKey: [...] to make captured values reactive. Unhashable queries without queryKey will throw in 1.0.`))}function Y(e,t){return Z(e,t)}function X(e){return{collection:null,deps:null,config:null,client:e,legacyUnhashableIdentity:[`legacy-unhashable`],derivedIdentityProfiler:{renderCount:0,totalMs:0,maxMs:0,warned:!1},deferredCollections:new Set,sourceIds:w(),observer:null,queryHash:void 0,suspenseKey:void 0,identityError:void 0,subscribe:null}}function Z(e,t,n=!1){let r=g(),a=s(e),u=a?r:G(e)??r,h=t??[],_=(0,m.useRef)(null),b=_.current??=X(u),x=()=>o(b.deferredCollections),S=a?void 0:W(e),w=P,O,k,A;if(S)O=S,k=[`queryKey`,S];else if(t!==void 0){if(O=h,u||n||y(`TANSTACK_DB_DISABLE_QUERY_IDENTITY_WARNINGS`))try{w=K(e,u,b.deferredCollections),k=[`deps`,h,c(w)]}catch(e){if(!(e instanceof i))throw e;J(e),A=e}}else if(a)O=[],k=[`collection`,e.id];else{let t=q(e,u,b.derivedIdentityProfiler,b.deferredCollections);w=t.value,t.status===`hashable`?(O=t.identityDeps,k=t.identityDeps):(J(t.error),O=b.legacyUnhashableIdentity,A=t.error)}let j;if(k!==void 0)try{j=d(k,`queryKey`)}catch(e){if(e instanceof i){if(S!==void 0)throw e;A=e}else throw e}t!==void 0&&B(),S===void 0&&t===void 0&&w!==P&&T(b.sourceIds,w,u,`useLiveQuery`,x);let M=n&&!a&&j!==void 0&&b.collection!==null&&b.client===u&&b.queryHash===j&&b.suspenseKey!==void 0;n&&!a&&j&&!M&&w===P&&(w=K(e,u,b.deferredCollections));let N=j&&n&&!a?M?b.suspenseKey:L(w,j,u):j,F=n&&!a&&N?R(u):void 0,I=(N?F?.get(N):void 0)?.collection,V=b.deps===null||(t===void 0?!p(b.deps,O):b.deps.length!==O.length||b.deps.some((e,t)=>e!==O[t])),H=!b.collection||a&&b.config!==e||!a&&(b.client!==u||V);if(H){if(a)e.config?.syncMode===`on-demand`&&y(`TANSTACK_DB_DISABLE_QUERY_IDENTITY_WARNINGS`)&&console.warn(`[useLiveQuery] Warning: Passing a collection with syncMode "on-demand" directly to useLiveQuery will not load any data. In on-demand mode, data is only loaded when queries with predicates request it.
|
|
3
3
|
|
|
4
4
|
Instead, use a query builder function:
|
|
5
5
|
const { data } = useLiveQuery({ query: (q) => q.from({ c: myCollection }).select(({ c }) => c) })
|
|
6
6
|
|
|
7
|
-
Or switch to syncMode "eager" if you want all data to sync automatically.`),e.startSyncImmediate(),b.collection=e,b.config=e;else{if(I)b.collection=I;else if(w===P&&(w=K(e,u,b.deferredCollections)),u||C(w,u,`useLiveQuery`),b.collection=f(w,{gcTime:n?D:E,pool:!n&&!u,startSync:!n||u!==void 0}),F&&N&&b.collection){let e=b.collection,t=e.on(`status:cleaned-up`,()=>z(F,N,e)),n=e.on(`status:error`,()=>{setTimeout(()=>z(F,N,e),0)}),r={collection:e,removeStatusListeners:()=>{t(),n()}};F.set(N,r)}b.config=e,b.deps=[...O]}b.client=u,b.queryHash=j,b.suspenseKey=N,b.identityError=A}H&&(b.observer=l(b.collection,{mode:`wholesale`,client:u,queryHash:b.queryHash,onPreload:x}));let U=b.observer;n&&!u&&(b.collection?.status===`idle`||b.collection?.status===`cleaned-up`)&&U.preloadForInitialRender().catch(()=>{}),(!b.subscribe||H)&&(b.subscribe=e=>{let t=U.subscribe(e);return x(),t});let Y=(0,m.useSyncExternalStore)(b.subscribe,()=>U.getSnapshot(),()=>U.getServerSnapshot());return n&&v(Y,{client:u,queryHash:b.queryHash,identityError:b.identityError,observer:U}),Y}var Q=
|
|
7
|
+
Or switch to syncMode "eager" if you want all data to sync automatically.`),e.startSyncImmediate(),b.collection=e,b.config=e;else{if(I)b.collection=I;else if(w===P&&(w=K(e,u,b.deferredCollections)),u||C(w,u,`useLiveQuery`),b.collection=f(w,{gcTime:n?D:E,pool:!n&&!u,startSync:!n||u!==void 0}),F&&N&&b.collection){let e=b.collection,t=e.on(`status:cleaned-up`,()=>z(F,N,e)),n=e.on(`status:error`,()=>{setTimeout(()=>z(F,N,e),0)}),r={collection:e,removeStatusListeners:()=>{t(),n()}};F.set(N,r)}b.config=e,b.deps=[...O]}b.client=u,b.queryHash=j,b.suspenseKey=N,b.identityError=A}H&&(b.observer=l(b.collection,{mode:`wholesale`,client:u,queryHash:b.queryHash,onPreload:x}));let U=b.observer;n&&!u&&(b.collection?.status===`idle`||b.collection?.status===`cleaned-up`)&&U.preloadForInitialRender().catch(()=>{}),(!b.subscribe||H)&&(b.subscribe=e=>{let t=U.subscribe(e);return x(),t});let Y=(0,m.useSyncExternalStore)(b.subscribe,()=>U.getSnapshot(),()=>U.getServerSnapshot());return n&&v(Y,{client:u,queryHash:b.queryHash,identityError:b.identityError,observer:U}),Y}var Q=e(`star`,[[`path`,{d:`M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z`,key:`r04s7s`}]]);export{Y as n,Q as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{R as e}from"./button-C0MQwO-R.js";var t=e(`triangle-alert`,[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]);export{t};
|
package/dist/app/favicon.svg
CHANGED
|
@@ -1 +1,6 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg"
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 240 240">
|
|
2
|
+
<rect rx="48" fill="#0f1513"/>
|
|
3
|
+
<path fill="#22c55e" d="M120 38l24.7 50 55.3 8.1-40 39 9.4 55.1L120 164.2 70.6 190.2 80 135.1l-40-39 55.3-8.1z"/>
|
|
4
|
+
<rect x="88" y="104" width="64" height="9" rx="4.5" fill="#0f1513"/>
|
|
5
|
+
<rect x="88" y="122" width="48" height="9" rx="4.5" fill="#0f1513"/>
|
|
6
|
+
</svg>
|
package/dist/app/index.html
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
|
6
|
+
<link rel="apple-touch-icon" href="/apple-touch-icon.png" />
|
|
6
7
|
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover, interactive-widget=resizes-content" />
|
|
7
8
|
<meta name="theme-color" content="#0a0a0a" />
|
|
8
9
|
<meta name="color-scheme" content="dark" />
|
|
@@ -16,16 +17,16 @@
|
|
|
16
17
|
<meta property="og:image:height" content="600" />
|
|
17
18
|
<meta property="og:image:alt" content="Stars Organizer: finally do something with your GitHub stars. Lists synced to GitHub, a health score per repo, tags, ratings and notes." />
|
|
18
19
|
<meta name="twitter:card" content="summary_large_image" />
|
|
19
|
-
<script type="module" crossorigin src="/assets/index-
|
|
20
|
+
<script type="module" crossorigin src="/assets/index-Cks444Kn.js"></script>
|
|
20
21
|
<link rel="modulepreload" crossorigin href="/assets/sync-persistence-f8LlQoHO.js">
|
|
21
|
-
<link rel="modulepreload" crossorigin href="/assets/button-
|
|
22
|
-
<link rel="modulepreload" crossorigin href="/assets/schemas-
|
|
23
|
-
<link rel="modulepreload" crossorigin href="/assets/coerce-
|
|
24
|
-
<link rel="modulepreload" crossorigin href="/assets/star-
|
|
25
|
-
<link rel="modulepreload" crossorigin href="/assets/history-
|
|
26
|
-
<link rel="modulepreload" crossorigin href="/assets/routes-
|
|
27
|
-
<link rel="modulepreload" crossorigin href="/assets/list._listId-
|
|
28
|
-
<link rel="stylesheet" crossorigin href="/assets/index
|
|
22
|
+
<link rel="modulepreload" crossorigin href="/assets/button-C0MQwO-R.js">
|
|
23
|
+
<link rel="modulepreload" crossorigin href="/assets/schemas-B0gCwksU.js">
|
|
24
|
+
<link rel="modulepreload" crossorigin href="/assets/coerce-D595RIhb.js">
|
|
25
|
+
<link rel="modulepreload" crossorigin href="/assets/star-BoN7NVgv.js">
|
|
26
|
+
<link rel="modulepreload" crossorigin href="/assets/history-OZ9l4TiG.js">
|
|
27
|
+
<link rel="modulepreload" crossorigin href="/assets/routes-C8TmhzRl.js">
|
|
28
|
+
<link rel="modulepreload" crossorigin href="/assets/list._listId-C5TBL1sd.js">
|
|
29
|
+
<link rel="stylesheet" crossorigin href="/assets/index--a4C8I0g.css">
|
|
29
30
|
</head>
|
|
30
31
|
<body>
|
|
31
32
|
<div id="root"></div>
|
package/dist/cli.js
CHANGED
|
@@ -672,6 +672,7 @@ async function fetchViewerLists(graphql) {
|
|
|
672
672
|
//#region server/github.ts
|
|
673
673
|
var DEFAULT_API_URL = "https://api.github.com";
|
|
674
674
|
var GitHubError = class extends Error {
|
|
675
|
+
status;
|
|
675
676
|
constructor(status, message) {
|
|
676
677
|
super(message);
|
|
677
678
|
this.status = status;
|
|
@@ -683,9 +684,12 @@ function createGitHubClient(token, apiUrl = process.env.GITHUB_API_URL ?? DEFAUL
|
|
|
683
684
|
"Content-Type": "application/json",
|
|
684
685
|
"User-Agent": "github-stars-organizer"
|
|
685
686
|
};
|
|
687
|
+
const request = (url, init) => fetch(url, init).catch(() => {
|
|
688
|
+
throw new GitHubError(502, "GitHub can't be reached. Check your internet connection.");
|
|
689
|
+
});
|
|
686
690
|
return {
|
|
687
691
|
async graphql(query, variables) {
|
|
688
|
-
const response = await
|
|
692
|
+
const response = await request(`${apiUrl}/graphql`, {
|
|
689
693
|
method: "POST",
|
|
690
694
|
headers,
|
|
691
695
|
body: JSON.stringify({
|
|
@@ -699,7 +703,7 @@ function createGitHubClient(token, apiUrl = process.env.GITHUB_API_URL ?? DEFAUL
|
|
|
699
703
|
return json.data;
|
|
700
704
|
},
|
|
701
705
|
async rest(method, path) {
|
|
702
|
-
const response = await
|
|
706
|
+
const response = await request(`${apiUrl}${path}`, {
|
|
703
707
|
method,
|
|
704
708
|
headers
|
|
705
709
|
});
|
|
@@ -6988,7 +6992,7 @@ async function launch({ github, login, home, appDir, port }) {
|
|
|
6988
6992
|
//#region cli/src/cli.ts
|
|
6989
6993
|
var DEFAULT_PORT = 5185;
|
|
6990
6994
|
var EXIT_FAILURE = 1;
|
|
6991
|
-
var NOTICE = `Stars Organizer
|
|
6995
|
+
var NOTICE = `Stars Organizer v1.1.0 Copyright (C) 2026 Armanc Keser
|
|
6992
6996
|
Free software under the GNU AGPL v3 or later, with ABSOLUTELY NO WARRANTY.
|
|
6993
6997
|
Source, license and bundled licenses: https://github.com/armanckeser/github-stars-organizer
|
|
6994
6998
|
Not affiliated with or endorsed by GitHub.`;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "github-stars-organizer",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Search, tag, rate and sort your GitHub stars into Lists, using your gh login. Runs locally; nothing to host.",
|
|
5
5
|
"license": "AGPL-3.0-or-later",
|
|
6
6
|
"author": "Armanc Keser",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{H as e,K as t,Q as n,R as r,U as i,V as a,W as o,et as s,n as c,rt as l,t as u}from"./button-ZbiqMfUE.js";import{t as d}from"./download-CzXogqy0.js";import{t as ee}from"./history-C-bdlEYN.js";import{Pn as f,a as p,at as m,c as h,d as te,g,i as _,it as v,n as ne,o as y,r as b,rt as re,s as x,u as S,y as C}from"./schemas-D_ddKDHk.js";import{t as w}from"./local-sync-DQzF1V9q.js";var T=r(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]),E=l(s(),1),D=n();function ie({...e}){return(0,D.jsx)(te,{"data-slot":`dialog`,...e})}function ae({...e}){return(0,D.jsx)(g,{"data-slot":`dialog-portal`,...e})}function O({className:e,...t}){return(0,D.jsx)(m,{"data-slot":`dialog-overlay`,className:c(`fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,e),...t})}function k({className:e,children:t,showCloseButton:n=!0,...r}){return(0,D.jsxs)(ae,{children:[(0,D.jsx)(O,{}),(0,D.jsxs)(C,{"data-slot":`dialog-content`,className:c(`fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-sm text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...r,children:[t,n&&(0,D.jsxs)(v,{"data-slot":`dialog-close`,render:(0,D.jsx)(u,{variant:`ghost`,className:`absolute top-2 right-2`,size:`icon-sm`}),children:[(0,D.jsx)(f,{}),(0,D.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function A({className:e,...t}){return(0,D.jsx)(`div`,{"data-slot":`dialog-header`,className:c(`flex flex-col gap-2`,e),...t})}function j({className:e,showCloseButton:t=!1,children:n,...r}){return(0,D.jsxs)(`div`,{"data-slot":`dialog-footer`,className:c(`-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 p-4 sm:flex-row sm:justify-end`,e),...r,children:[n,t&&(0,D.jsx)(v,{render:(0,D.jsx)(u,{variant:`outline`}),children:`Close`})]})}function M({className:e,...t}){return(0,D.jsx)(S,{"data-slot":`dialog-title`,className:c(`font-heading text-base leading-none font-medium`,e),...t})}function N({className:e,...t}){return(0,D.jsx)(re,{"data-slot":`dialog-description`,className:c(`text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground`,e),...t})}var P=`github-stars-organizer-backup`,F=x({githubId:y().int(),nodeId:h(),fullName:h()}),I=F.extend({starredAt:h()}),L=x({id:h(),name:h(),description:h().nullable(),isPrivate:_(),repos:b(F)}),R=x({repos:b(x({githubId:y().int(),notes:h().nullable(),usefulnessRating:y().int().min(1).max(5).nullable()})),tags:b(x({id:h(),name:h(),color:h()})),repoTags:b(x({githubId:y().int(),tagId:h()}))}),z=x({format:p(P),version:p(1),createdAt:h(),login:h(),reason:ne([`launch`,`manual`,`before-restore`,`uploaded`]),stars:b(I),lists:b(L),local:R.optional()}),B=class extends Error{};function V(e){let t=z.safeParse(e);if(t.success)return t.data;let n=e;if(n?.format!==`github-stars-organizer-backup`)throw new B(`This file isn't a Stars Organizer backup.`);if(typeof n.version==`number`&&n.version>1)throw new B("This backup was made by a newer version. Update with `npx github-stars-organizer@latest`.");let r=t.error.issues[0];throw new B(`This backup is damaged (${r.path.join(`.`)}: ${r.message}).`)}x({local:R.optional()});function H(e){return e.restar.length+e.recreateLists.length+e.addToLists.length}function U({repos:e,tags:t,repo_tags:n}){let r=new Map(e.map(e=>[e.id,e.github_id]));return{repos:e.filter(e=>e.notes||e.usefulness_rating!==null).map(e=>({githubId:e.github_id,notes:e.notes||null,usefulnessRating:e.usefulness_rating})),tags:t.map(({id:e,name:t,color:n})=>({id:e,name:t,color:n})),repoTags:n.flatMap(e=>{let t=r.get(e.repo_id);return t===void 0?[]:[{githubId:t,tagId:e.tag_id}]})}}function W(e,t,n){let r=new Map(t.repos.map(e=>[e.github_id,e])),i=e.repos.flatMap(e=>{let t=r.get(e.githubId);if(!t)return[];let n={id:t.id};return!t.notes&&e.notes&&(n.notes=e.notes),t.usefulness_rating===null&&e.usefulnessRating!==null&&(n.usefulness_rating=e.usefulnessRating),Object.keys(n).length>1?[n]:[]}),a=new Map(t.tags.map(e=>[e.name.toLowerCase(),e.id])),o=[],s=new Map;for(let t of e.tags){let e=a.get(t.name.toLowerCase());if(e){s.set(t.id,e);continue}let r={id:n(),name:t.name,color:t.color};o.push(r),a.set(r.name.toLowerCase(),r.id),s.set(t.id,r.id)}let c=new Set(t.repo_tags.map(e=>`${e.repo_id}:${e.tag_id}`));return{repos:i,tags:o,repo_tags:e.repoTags.flatMap(e=>{let t=r.get(e.githubId),i=s.get(e.tagId);if(!t||!i)return[];let a=`${t.id}:${i}`;return c.has(a)?[]:(c.add(a),[{id:n(),repo_id:t.id,tag_id:i}])})}}async function G(){return await Promise.all([a.preload(),i.preload(),e.preload()]),{repos:a.toArray,tags:i.toArray,repo_tags:e.toArray}}async function K(){return t.backUpNow({local:U(await G())})}async function q(e){let n=await t.readBackup(e.id),r=n.local?n:{...n,local:U(await G())},i=URL.createObjectURL(new Blob([JSON.stringify(r,null,2)],{type:`application/json`})),a=document.createElement(`a`);a.href=i,a.download=`stars-organizer-${n.login}-${e.id}.json`,a.click(),URL.revokeObjectURL(i)}async function J(e){let n;try{n=JSON.parse(await e.text())}catch{throw Error(`${e.name} isn't a JSON file.`)}return t.uploadBackup(V(n))}async function oe(t){let n=W(t,await G(),()=>crypto.randomUUID());return await o(()=>{for(let e of n.repos)a.update(e.id,t=>{Object.assign(t,e)});n.tags.length&&i.insert(n.tags),n.repo_tags.length&&e.insert(n.repo_tags)}),{notesAndRatings:n.repos.length,tags:n.tags.length,tagLinks:n.repo_tags.length}}async function se(e){let n=await t.applyRestore({backupId:e.id});await w();let{local:r}=await t.readBackup(e.id);return{...n,local:r?await oe(r):null}}var ce={launch:`On launch`,manual:`Backed up by hand`,"before-restore":`Before a restore`,uploaded:`From a file`},Y=new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`short`});function X(e){return e instanceof Error?e.message:String(e)}function Z(e,t,n=`${t}s`){return`${e} ${e===1?t:n}`}function le(){return(0,D.jsx)(ue,{})}function ue(){let[e,n]=(0,E.useState)(null),[r,i]=(0,E.useState)(``),[a,o]=(0,E.useState)(!1),[s,c]=(0,E.useState)(null),l=(0,E.useRef)(null);async function f(){n(await t.listBackups())}(0,E.useEffect)(()=>{f().catch(e=>i(`Couldn't read the backups: ${X(e)}`))},[]);async function p(e,t){o(!0),i(e);try{i(await t()),await f()}catch(e){i(X(e))}finally{o(!1)}}function m(){p(`Backing up...`,async()=>{let e=await K();return`Backed up ${Z(e.stars,`star`)} and ${Z(e.lists,`List`)}, with your tags, ratings and notes.`})}function h(e){e&&p(`Reading ${e.name}...`,async()=>(c(await J(e)),`Kept a copy of ${e.name}.`))}return(0,D.jsxs)(`div`,{className:`max-w-3xl space-y-6`,children:[(0,D.jsxs)(`header`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,D.jsxs)(`div`,{className:`space-y-1`,children:[(0,D.jsx)(`h1`,{className:`font-display text-2xl font-bold tracking-tight`,children:`Backups`}),(0,D.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Each launch backs up your stars and Lists before the app can change anything. A restore only adds back what is missing: it never unstars a repo or deletes a List.`}),e&&(0,D.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Saved in `,(0,D.jsx)(`code`,{children:e.directory})]})]}),(0,D.jsx)(u,{onClick:m,disabled:a,children:`Back up now`})]}),r&&(0,D.jsx)(`p`,{role:`status`,className:`text-sm`,children:r}),(0,D.jsxs)(`ul`,{className:`divide-y divide-border rounded-lg border border-border`,children:[e?.backups.length===0&&(0,D.jsx)(`li`,{className:`p-4 text-sm text-muted-foreground`,children:`No backups yet.`}),e?.backups.map(e=>(0,D.jsxs)(`li`,{className:`flex flex-wrap items-center gap-x-4 gap-y-2 p-3`,children:[(0,D.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,D.jsx)(`p`,{className:`text-sm font-medium`,children:Y.format(new Date(e.createdAt))}),(0,D.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[ce[e.reason],` · `,Z(e.stars,`star`),` · `,Z(e.lists,`List`)]})]}),(0,D.jsxs)(u,{variant:`ghost`,size:`sm`,disabled:a,onClick:()=>void p(`Preparing the file...`,async()=>(await q(e),`Downloaded.`)),children:[(0,D.jsx)(d,{className:`mr-1.5 size-4`}),`Download`]}),(0,D.jsxs)(u,{variant:`outline`,size:`sm`,disabled:a,onClick:()=>c(e),children:[(0,D.jsx)(ee,{className:`mr-1.5 size-4`}),`Restore...`]})]},e.id))]}),(0,D.jsxs)(`section`,{className:`space-y-2`,children:[(0,D.jsx)(`h2`,{className:`text-sm font-semibold`,children:`Restore from a file`}),(0,D.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`A backup you downloaded, from this computer or another. You see what it would change before anything does.`}),(0,D.jsx)(`input`,{ref:l,type:`file`,accept:`application/json,.json`,className:`hidden`,onChange:e=>{h(e.target.files?.[0]),e.target.value=``}}),(0,D.jsxs)(u,{variant:`outline`,size:`sm`,disabled:a,onClick:()=>l.current?.click(),children:[(0,D.jsx)(T,{className:`mr-1.5 size-4`}),`Choose a file`]})]}),s&&(0,D.jsx)(de,{backup:s,onClose:()=>c(null),onRestored:()=>void f()})]})}var Q=5;function $({names:e}){let t=e.length-Q;return(0,D.jsxs)(`p`,{className:`truncate text-xs text-muted-foreground`,children:[e.slice(0,Q).join(`, `),t>0&&`, and ${t} more`]})}function de({backup:e,onClose:n,onRestored:r}){let[i,a]=(0,E.useState)({step:`planning`});(0,E.useEffect)(()=>{Promise.all([t.planRestore({backupId:e.id}),t.readBackup(e.id)]).then(([e,t])=>a({step:`review`,plan:e,hasLocal:t.local!==void 0})).catch(e=>a({step:`failed`,message:X(e)}))},[e.id]);async function o(){a({step:`applying`});try{a({step:`done`,result:await se(e)}),r()}catch(e){a({step:`failed`,message:X(e)})}}return(0,D.jsx)(ie,{open:!0,onOpenChange:e=>{!e&&i.step!==`applying`&&n()},children:(0,D.jsxs)(k,{children:[(0,D.jsxs)(A,{children:[(0,D.jsxs)(M,{children:[`Restore the backup from `,Y.format(new Date(e.createdAt))]}),(0,D.jsx)(N,{children:`Only adds what GitHub is missing. Nothing you starred or made since is touched.`})]}),(0,D.jsx)(fe,{state:i}),(0,D.jsxs)(j,{children:[i.step===`review`&&(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(u,{variant:`ghost`,onClick:n,children:`Cancel`}),(0,D.jsx)(u,{onClick:()=>void o(),disabled:H(i.plan)===0&&!i.hasLocal,children:`Restore`})]}),(i.step===`done`||i.step===`failed`)&&(0,D.jsx)(u,{onClick:n,children:`Close`})]})]})})}function fe({state:e}){switch(e.step){case`planning`:return(0,D.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Comparing the backup with GitHub...`});case`applying`:return(0,D.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Restoring. Leave this open until it finishes.`});case`failed`:return(0,D.jsx)(`p`,{className:`text-sm text-destructive`,children:e.message});case`review`:return(0,D.jsx)(pe,{plan:e.plan,hasLocal:e.hasLocal});case`done`:return(0,D.jsx)(he,{result:e.result})}}function pe({plan:e,hasLocal:t}){let n=new Set(e.addToLists.map(e=>e.repo.fullName));return H(e)===0?(0,D.jsxs)(`p`,{className:`text-sm`,children:[`GitHub already has every star and List in this backup.`,t&&` Restoring fills in any tags, ratings and notes this browser is missing.`]}):(0,D.jsxs)(`div`,{className:`space-y-3 text-sm`,children:[e.restar.length>0&&(0,D.jsxs)(`div`,{children:[(0,D.jsxs)(`p`,{children:[`Star `,Z(e.restar.length,`repo`),` again. GitHub dates them today, so they move to the top.`]}),(0,D.jsx)($,{names:e.restar.map(e=>e.fullName)})]}),e.recreateLists.length>0&&(0,D.jsxs)(`div`,{children:[(0,D.jsxs)(`p`,{children:[`Recreate `,Z(e.recreateLists.length,`List`),`.`]}),(0,D.jsx)($,{names:e.recreateLists.map(e=>e.isPrivate?`${e.name} (private)`:e.name)})]}),n.size>0&&(0,D.jsxs)(`div`,{children:[(0,D.jsxs)(`p`,{children:[`Put `,Z(n.size,`repo`),` back in their Lists.`]}),(0,D.jsx)($,{names:[...n]})]}),t&&(0,D.jsx)(`p`,{children:`Fill in tags, ratings and notes this browser is missing. Nothing you have is overwritten.`}),(0,D.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`A backup of how things are now is taken first, so you can go back.`})]})}function me(e){let t=[e.notesAndRatings>0&&`notes or ratings on ${Z(e.notesAndRatings,`repo`)}`,e.tagLinks>0&&Z(e.tagLinks,`tag`)].filter(e=>e!==!1);return t.length===0?`This browser already had every tag, rating and note.`:`Filled in ${t.join(` and `)}.`}function he({result:e}){return(0,D.jsxs)(`div`,{className:`space-y-2 text-sm`,children:[(0,D.jsxs)(`p`,{children:[`Starred `,Z(e.restarred,`repo`),` again, recreated `,Z(e.recreatedLists,`List`),`, and re-added`,` `,Z(e.addedToLists,`List entry`,`List entries`),`.`,e.local&&` ${me(e.local)}`]}),e.failed.length>0&&(0,D.jsxs)(`div`,{className:`rounded-md border border-destructive/40 p-2`,children:[(0,D.jsxs)(`p`,{className:`font-medium text-destructive`,children:[`GitHub refused `,Z(e.failed.length,`change`),`:`]}),(0,D.jsx)(`ul`,{className:`mt-1 space-y-0.5 text-xs`,children:e.failed.map(e=>(0,D.jsxs)(`li`,{children:[e.what,`: `,e.reason]},e.what))})]})]})}export{le as component};
|